人员检验节点绑定

master
shaoyong 6 months ago
parent f460c1b2b5
commit 6e4c743192

@ -42,3 +42,11 @@ export function delMaterial(id) {
method: 'delete'
});
}
export function getUserList(query) {
return request({
url: '/quality/material/userList',
method: 'get',
params: query
});
}

@ -60,3 +60,27 @@ export function getRightList(query) {
params: query
});
}
export function getSelectedUsers(query) {
return request({
url: '/quality/material/getSelectedUsers',
method: 'get',
params: query
});
}
export function addUserBind(data) {
return request({
url: '/quality/material/addUserBind',
method: 'post',
data: data
});
}
export function deleteByMaterialCode(data) {
return request({
url: '/quality/material/deleteByMaterialCode',
method: 'delete',
data: data
});
}

@ -89,6 +89,12 @@
@click="handleDelete(scope.row)"
v-hasPermi="['quality:checkType:remove']"
>删除</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-connection"
@click="handleBind(scope.row)"
>绑定</el-button>
</template>
</el-table-column>
</el-table>
@ -132,27 +138,61 @@
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 用户绑定 -->
<el-dialog :title="titleUserBind" :visible.sync="openUserBind" width="800px">
<el-table v-loading="userloading" :data="userList" ref="userBindTable" >
<el-table-column label="序号" align="center" type="index" width="50" />
<el-table-column label="员工编号" align="center" prop="userCode" />
<el-table-column label="姓名" align="center" prop="userName" />
<el-table-column fixed="right" label="操作" width="90">
<template slot-scope="scope">
<el-button
size="small"
type="danger"
plain
@click="deleteUser(scope.row)"
>
移除</el-button>
</template>
</el-table-column>
</el-table>
<div class="button-container">
<el-button size="mini" type="primary" @click="addUser()" >新增员工</el-button>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleClose" > </el-button>
</div>
</el-dialog>
<!--人员选择弹窗-->
<ItemSelectUser
ref="itemSelectUser"
@onSelected="onSelectUser"
></ItemSelectUser>
</div>
</template>
<script>
import { listCheckType, getCheckType, delCheckType, addCheckType, updateCheckType } from "@/api/quality/checkType";
import{ getSelectedUsers, addUserBind,deleteByMaterialCode} from "@/api/quality/userbind";
import ItemSelectUser from "./selectUser.vue";
export default {
name: "CheckType",
dicts: ["check_type"],
components: {
ItemSelectUser
},
data() {
return {
//
loading: true,
userloading: true,
//
ids: [],
//
@ -161,12 +201,16 @@ export default {
multiple: true,
//
showSearch: true,
openUserBind: false,
//
total: 0,
//
checkTypeList: [],
userList: [],
userRows: [],
//
title: "",
titleUserBind: "",
//
open: false,
//
@ -180,6 +224,15 @@ export default {
attr1: null,
factoryCode: null,
},
getUserParams: {
pageNum: 1,
pageSize: 10,
userCode: null,
userName: null,
materialCode: null,
materialName: null,
phonenumber: null,
},
//
form: {},
//
@ -293,7 +346,102 @@ export default {
this.download('quality/checkType/export', {
...this.queryParams
}, `checkType_${new Date().getTime()}.xlsx`)
}
},
/** 人员绑定按钮操作页面 */
handleBind(row){
//this.reset();
this.userloading = true;
let sr = row;
//
this.materialCode = sr.orderCode;
this.materialName = sr.checkName;
this.getUserParams.materialCode = sr.orderCode;
//
getSelectedUsers(this.getUserParams).then(response => {
this.userList = response.rows;
this.openUserBind = true;
this.titleUserBind = "人员绑定详情";
this.userloading = false;
});
},
getSelectUserList() {
this.userloading = true;
//this.getUserParams.materialCode = orderCode;
getSelectedUsers(this.getUserParams).then(response => {
this.userList = response.rows;
this.userloading = false;
});
},
userSelection(selection) {
const allRows = this.userRows.concat(selection)
this.userRows = allRows.reduce((acc, cur) => {
const hasDuplicate = acc.some(item => item.materialCode === cur.materialCode);
if (!hasDuplicate) {
acc.push(cur);
}
return acc;
}, []);
},
//
handleClose() {
this.openUserBind = false;
},
//
addUser() {
this.$refs.itemSelectUser.showFlag = true;
},
//
onSelectUser(obj) {
let data = {
materialCode: this.materialCode,
materialName: this.materialName,
userCodes: [],
userNames: [],
}
obj.forEach((item, index) => {
data.userCodes.push(item.userCode);
data.userNames.push(item.userName);
});
addUserBind(data).then(response => {
if(response.code === 200) {
this.$modal.msgSuccess("人员绑定成功");
}else{
this.$modal.msgError(response.msg);
}
this.getSelectUserList();
});
},
deleteUser(row) {
const userCode = row.userCode;
const userName = row.userName;
const data = {
materialCode: this.materialCode,
userCode: userCode,
userName: userName,
}
this.$modal.confirm('是否确认删除用户名为"' + userName + '"的数据项?').then(function() {
return deleteByMaterialCode(data);
}).then(response => {
if(response.code === 200) {
this.$modal.msgSuccess("删除成功");
}else{
this.$modal.msgError(response.msg);
}
this.getSelectUserList();
}).catch(() => {});
},
}
};
</script>
<style scoped>
.button-container {
text-align: right;
margin-top: 10px;
margin-right: 10px;
}
</style>

@ -0,0 +1,182 @@
<template>
<el-dialog title="人员选择"
v-if="showFlag"
:visible.sync="showFlag"
:modal= false
width="1000px"
>
<el-row :gutter="20">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px" align="center">
<el-col :span="6" :xs="6">
<el-form-item label="员工工号">
<el-input
v-model="queryParams.userCode"
placeholder="员工工号"
clearable
style="width: 160px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="员工部门">
<Treeselect
v-model="queryParams.deptId"
:options="deptOptions"
:show-count="true"
placeholder="请选择归属部门"
@keyup.enter.native="handleQuery"
>
<label slot="option-label" slot-scope="{ node, shouldShowCount, count, labelClassName, countClassName }"
:class="labelClassName"
:title="node.label"
>
{{ node.label }}
</label>
</Treeselect>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="员工姓名">
<el-input
v-model="queryParams.userName"
placeholder="员工姓名"
clearable
style="width: 160px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<el-table v-loading="loading" :data="itemList" @selection-change="handleBomSelectionChange" ref="myTable" >
<el-table-column width="50" align="center" type="selection">
</el-table-column>
<!-- 序号 -->
<el-table-column label="员工ID" align="left" key="userId" prop="userId" :show-overflow-tooltip="true" />
<el-table-column label="员工工号" align="left" key="userCode" prop="userCode" :show-overflow-tooltip="true" />
<el-table-column label="员工姓名" align="left" key="userName" prop="userName" :show-overflow-tooltip="true" />
<el-table-column label="员工部门" align="left" key="deptName" prop="deptName" :show-overflow-tooltip="true" />
<el-table-column label="手机号" align="left" key="phonenumber" prop="phonenumber" :show-overflow-tooltip="true" />
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitBomForm"> </el-button>
<el-button @click="showFlag=false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { getUserList } from "@/api/quality/material";
import { deptTreeSelect } from "@/api/system/user";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "itemSelectUser",
components: { Treeselect },
data() {
return {
showFlag:false,
//
selectedRows: {},
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
// BOM
itemList: null,
deptOptions: undefined,
//
bomCode: undefined,
defaultProps: {
id: "id",
label: "label"
},
//
queryParams: {
pageNum: 1,
pageSize: 10,
userCode: '',
userName: '',
deptId: null,
deptName: '',
}
};
},
created() {
this.getList();
this.getDeptTree();
},
methods: {
/** 查询表格列表*/
getList() {
this.loading = true;
getUserList(this.queryParams).then(response => {
this.itemList = response.rows;
this.total = response.total;
this.loading = false;
}
);
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleBomSelectionChange(selection) {
this.selectedRows = selection;
},
/** 查询部门下拉树结构 */
getDeptTree() {
deptTreeSelect().then(response => {
this.deptOptions = response.data;
});
},
submitBomForm() {
this.$emit('onSelected', this.selectedRows);
this.showFlag = false;
}
}
};
</script>
<style scoped>
.labelClassName {
width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>

@ -497,9 +497,9 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
this.download('quality/qcProjectType/export', {
this.download('quality/qcGoal/export', {
...this.queryParams
}, `qcProjectType_${new Date().getTime()}.xlsx`)
}, `qcGoal_${new Date().getTime()}.xlsx`)
},
/** 加载时获取 */
getCheckTypeList() {

@ -296,7 +296,7 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!--订单选择弹窗-->
<!--物料选择弹窗-->
<ItemSelectMaterial
ref="itemSelectMaterial"
@onSelected="onSelectMaterial"
@ -599,11 +599,11 @@ export default {
});
},
/**工单选择弹出框**/
/**物料选择弹出框**/
handleSelectMaterial() {
this.$refs.itemSelectMaterial.showFlag = true;
},
//
//
onSelectMaterial(obj) {
console.log(obj);
this.form.materialName = obj.name;

Loading…
Cancel
Save