Commit 2827262b authored by tanjunxin's avatar tanjunxin

fix: 用户管理工作单元选择优化

parent c020d3ef
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
<workunitSelect <workunitSelect
ref="WorkunitSelect" ref="WorkunitSelect"
:userId="userId" :userId="userId"
:acId="acId"
@onSelected="onworkunitSelected" @onSelected="onworkunitSelected"
></workunitSelect> ></workunitSelect>
</el-form-item> </el-form-item>
...@@ -84,6 +85,7 @@ export default { ...@@ -84,6 +85,7 @@ export default {
workstationworkerList: [], workstationworkerList: [],
// 弹出层标题 // 弹出层标题
title: "", title: "",
acId: "",
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
// 查询参数 // 查询参数
...@@ -180,12 +182,13 @@ export default { ...@@ -180,12 +182,13 @@ export default {
this.single = selection.length!==1 this.single = selection.length!==1
this.multiple = !selection.length this.multiple = !selection.length
}, },
onworkunitSelected(rows){ onworkunitSelected(rows, type){
// console.log(45456, rows); console.log(45456, rows, type);
if (rows != undefined && rows != null) { if (rows != undefined && rows != null) {
rows.forEach((item) => { if(type) {
this.form.workunitId = rows.workunitId;
}); this.form.workunitName = rows.workunitName;
} else {
this.sForm = rows.map(item => { this.sForm = rows.map(item => {
return { return {
...this.form, ...this.form,
...@@ -193,17 +196,17 @@ export default { ...@@ -193,17 +196,17 @@ export default {
workunitName: item.workunitName, workunitName: item.workunitName,
} }
}) })
// this.form.workunitId = row.workunitId;
// this.form.workunitName = row.workunitName;
this.form.workunitId = (rows.map(item => item.workunitId)).join(","); this.form.workunitId = (rows.map(item => item.workunitId)).join(",");
this.form.workunitName = (rows.map(item => item.workunitName)).join(","); this.form.workunitName = (rows.map(item => item.workunitName)).join(",");
// console.log(111111, this.sForm); }
// console.log(111111, this.form); console.log(111111, this.sForm);
console.log(111111, this.form);
} }
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.acId = "";
this.open = true; this.open = true;
this.title = this.$t('common.add_workunit'); this.title = this.$t('common.add_workunit');
}, },
...@@ -211,6 +214,7 @@ export default { ...@@ -211,6 +214,7 @@ export default {
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const id = row.id || this.ids const id = row.id || this.ids
this.acId = id
getWorkunituser(id).then(response => { getWorkunituser(id).then(response => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
...@@ -221,8 +225,8 @@ export default { ...@@ -221,8 +225,8 @@ export default {
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.title != this.$t('common.add_workunit')) {
updateWorkunituser(this.sForm).then(response => { updateWorkunituser(this.form).then(response => {
this.$modal.msgSuccess(this.$t('common.edit_success')); this.$modal.msgSuccess(this.$t('common.edit_success'));
this.open = false; this.open = false;
this.getList(); this.getList();
......
...@@ -58,8 +58,8 @@ ...@@ -58,8 +58,8 @@
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
height="500px" height="500px"
> >
<el-table-column type="selection" width="50" align="center" /> <el-table-column type="selection" width="50" align="center" v-if="!acId"/>
<!-- <el-table-column width="55" align="center"> <el-table-column width="55" align="center" v-else>
<template v-slot="scope"> <template v-slot="scope">
<el-radio <el-radio
v-model="selectedWorkunitId" v-model="selectedWorkunitId"
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
>{{ "" }}</el-radio >{{ "" }}</el-radio
> >
</template> </template>
</el-table-column> --> </el-table-column>
<el-table-column :label="$t('common.workstation_name')" width="180" prop="workstationName" /> <el-table-column :label="$t('common.workstation_name')" width="180" prop="workstationName" />
<el-table-column <el-table-column
:label="$t('common.workunit_code')" :label="$t('common.workunit_code')"
...@@ -114,6 +114,10 @@ ...@@ -114,6 +114,10 @@
type: Number | undefined, type: Number | undefined,
default: undefined, default: undefined,
}, //外部传入的工单过滤信息 }, //外部传入的工单过滤信息
acId: {
type: String | Number,
default: "",
},
}, },
data() { data() {
return { return {
...@@ -160,7 +164,7 @@ ...@@ -160,7 +164,7 @@
this.queryParams.workstationName = this.workstationName; this.queryParams.workstationName = this.workstationName;
this.queryParams.userId = this.userId; this.queryParams.userId = this.userId;
this.queryParams.workstationId = this.workstationId; this.queryParams.workstationId = this.workstationId;
this.getList(); this.resetQuery();
}, },
immediate: true immediate: true
} }
...@@ -184,6 +188,8 @@ ...@@ -184,6 +188,8 @@
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.queryParams.pageNum = 1;
this.queryParams.pageSize = 10;
this.resetForm("queryForm"); this.resetForm("queryForm");
this.handleQuery(); this.handleQuery();
}, },
...@@ -210,7 +216,7 @@ ...@@ -210,7 +216,7 @@
handleRowDbClick(row) { handleRowDbClick(row) {
if (row) { if (row) {
this.selectedRows = row; this.selectedRows = row;
this.$emit("onSelected", this.selectedRows); this.$emit("onSelected", this.selectedRows, this.acId ? 1 : 0);
this.showFlag = false; this.showFlag = false;
} }
}, },
...@@ -224,7 +230,7 @@ ...@@ -224,7 +230,7 @@
}); });
return; return;
} }
this.$emit("onSelected", this.selectedRows); this.$emit("onSelected", this.selectedRows, this.acId ? 1 : 0);
this.showFlag = false; this.showFlag = false;
}, },
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment