Commit 2827262b authored by tanjunxin's avatar tanjunxin

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

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