Merge branch 'dev-scheduling' of http://42.192.7.176:3000/suojin/jonhon-mes-web into dev-scheduling

dev-scheduling
zhangdi 2 days ago
commit dcb3d3f192
  1. 494
      src/views/basicData/workCenter.vue

@ -19,9 +19,7 @@
:beforeOpen="beforeOpen" :beforeOpen="beforeOpen"
> >
<template #menu-left> <template #menu-left>
<el-button type="danger" icon="el-icon-delete" @click="handleDelete" <el-button type="danger" @click="handleDelete">删除</el-button>
>删除</el-button
>
</template> </template>
<template #menu="{ row }"> <template #menu="{ row }">
<el-button type="text" @click="setTeam(row)">设置班组</el-button> <el-button type="text" @click="setTeam(row)">设置班组</el-button>
@ -48,9 +46,7 @@
</el-dialog> </el-dialog>
<el-dialog title="设置工艺能力" append-to-body v-model="capacityDialog" width="60%"> <el-dialog title="设置工艺能力" append-to-body v-model="capacityDialog" width="60%">
<div> <div>
<el-button type="primary" icon="el-icon-plus" @click="insertEvent()" <el-button type="primary" icon="el-icon-plus" @click="insertEvent()">插入一行</el-button>
>插入一行</el-button
>
<el-button plain type="danger" @click="remove">删除选择行</el-button> <el-button plain type="danger" @click="remove">删除选择行</el-button>
<!-- <el-button type="primary" @click="handleSave">保存</el-button> --> <!-- <el-button type="primary" @click="handleSave">保存</el-button> -->
</div> </div>
@ -69,19 +65,28 @@
:key="item.id" :key="item.id"
:label="item.caName" :label="item.caName"
:value="item.id" :value="item.id"
:disabled="isAbilitySelected(item.id, scope.$index)"> :disabled="isAbilitySelected(item.id, scope.$index)"
>
</el-option> </el-option>
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="面积" prop="area"> <el-table-column align="center" label="面积" prop="area">
<template #default="scope"> <template #default="scope">
<el-input-number v-model="scope.row.area" :min="0" controls-position="right"></el-input-number> <el-input-number
v-model="scope.row.area"
:min="0"
controls-position="right"
></el-input-number>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="数量" prop="quality"> <el-table-column align="center" label="数量" prop="quality">
<template #default="scope"> <template #default="scope">
<el-input-number v-model="scope.row.quality" :min="0" controls-position="right"></el-input-number> <el-input-number
v-model="scope.row.quality"
:min="0"
controls-position="right"
></el-input-number>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="批次" prop="batch"> <el-table-column align="center" label="批次" prop="batch">
@ -91,38 +96,53 @@
</el-table-column> </el-table-column>
<el-table-column align="center" label="饱和度(%)" prop="saturation"> <el-table-column align="center" label="饱和度(%)" prop="saturation">
<template #default="scope"> <template #default="scope">
<el-input-number v-model="scope.row.saturation" :min="0" controls-position="right"></el-input-number> <el-input-number
v-model="scope.row.saturation"
:min="0"
controls-position="right"
></el-input-number>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button @click="capacityDialog = false"> </el-button> <el-button @click="capacityDialog = false"> </el-button>
<el-button type="primary" @click="submitCapacity"> </el-button> <el-button type="primary" @click="submitCapacity"> </el-button>
</span> </span>
</template> </template>
</el-dialog> </el-dialog>
</basic-container> </basic-container>
</template> </template>
<script> <script>
import {getList,getNotSelectTeam,getSelectTeam,getAbility,addWorkCenter,updateWorkCenter,saveTeam, import {
getSelectCraft,saveCraft,deleteWorkCenter,getAllUser} from "@/api/basicData/workCenter" getList,
getNotSelectTeam,
getSelectTeam,
getAbility,
addWorkCenter,
updateWorkCenter,
saveTeam,
getSelectCraft,
saveCraft,
deleteWorkCenter,
getAllUser,
} from '@/api/basicData/workCenter';
export default { export default {
data() { data() {
return { return {
loading: false, loading: false,
data: [], data: [],
form: {}, form: {},
query:{}, query: {},
capacityList: [], capacityList: [],
page: { page: {
pageSize: 10, pageSize: 10,
currentPage: 1, currentPage: 1,
total: 0, total: 0,
}, },
leaderUsers:[], leaderUsers: [],
abilityList:[], abilityList: [],
teamValue: [], teamValue: [],
capacityDialog: false, capacityDialog: false,
teamData: [], teamData: [],
@ -131,8 +151,8 @@ export default {
option: { option: {
columnSort: true, columnSort: true,
tip: false, tip: false,
height: "auto", height: 'auto',
align: "center", align: 'center',
// rowKey: "wcCode", // rowKey: "wcCode",
calcHeight: 32, calcHeight: 32,
simplePage: false, simplePage: false,
@ -147,9 +167,9 @@ export default {
viewBtn: false, viewBtn: false,
delBtn: false, delBtn: false,
editBtn: true, editBtn: true,
editBtnText: "修改", editBtnText: '修改',
editBtnIcon: " ", editBtnIcon: ' ',
delBtnIcon: " ", delBtnIcon: ' ',
addBtn: true, addBtn: true,
labelWidth: 120, labelWidth: 120,
searchLabelWidth: 100, searchLabelWidth: 100,
@ -162,107 +182,113 @@ export default {
gridBtn: false, gridBtn: false,
searchShowBtn: false, searchShowBtn: false,
showOverflowTooltip: true, showOverflowTooltip: true,
searchLabelPosition: "left", searchLabelPosition: 'left',
searchLabelPosition: "left", searchLabelPosition: 'left',
searchGutter: 24, searchGutter: 24,
searchSpan: 6, searchSpan: 6,
menuAlign: "center", menuAlign: 'center',
gridBtn: false, gridBtn: false,
searchMenuPosition: "right", searchMenuPosition: 'right',
addBtnIcon: " ", addBtnIcon: ' ',
viewBtnIcon: " ", viewBtnIcon: ' ',
delBtnIcon: " ", delBtnIcon: ' ',
editBtnIcon: " ", editBtnIcon: ' ',
column: [ column: [
{ {
label: "编码", label: '编码',
prop: "wcCode", prop: 'wcCode',
span: 24, span: 24,
overflow: true, overflow: true,
search: true, search: true,
sortable: true,
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入编码", message: '请输入编码',
trigger: "blur", trigger: 'blur',
}, },
], ],
}, },
{ {
label: "名称", label: '名称',
prop: "wcName", prop: 'wcName',
span: 24, span: 24,
overflow: true, overflow: true,
search: true, search: true,
sortable: true,
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入名称", message: '请输入名称',
trigger: "blur", trigger: 'blur',
}, },
], ],
}, },
{ {
label: "工序", label: '工序',
prop: "processes", prop: 'processes',
span: 24, span: 24,
hide: true, hide: true,
addDisplay: false, addDisplay: false,
editDisplay: false, editDisplay: false,
overflow: true, overflow: true,
search: false, search: false,
sortable: true,
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入工序", message: '请输入工序',
trigger: "blur", trigger: 'blur',
}, },
], ],
}, },
{ {
label: "工艺能力", label: '工艺能力',
prop: "craftAbility", prop: 'craftAbility',
span: 24, span: 24,
overflow: true, overflow: true,
search: false, search: false,
addDisplay: false, addDisplay: false,
editDisplay: false, editDisplay: false,
sortable: true,
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入工艺能力", message: '请输入工艺能力',
trigger: "blur", trigger: 'blur',
}, },
], ],
}, },
{ {
label: "业务标识", label: '业务标识',
prop: "sign", prop: 'sign',
span: 24, span: 24,
overflow: true, overflow: true,
search: true, search: true,
sortable: true,
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入业务标识", message: '请输入业务标识',
trigger: "blur", trigger: 'blur',
}, },
], ],
}, },
{ {
label: "主管工艺员", label: '主管工艺员',
prop: "leaderUserName", prop: 'leaderUserName',
// type: "select", // type: "select",
span: 24, span: 24,
overflow: true, overflow: true,
// search: true, // search: true,
addDisplay:false, addDisplay: false,
editDisplay:false, editDisplay: false,
sortable: true,
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入主管工艺员", message: '请输入主管工艺员',
trigger: "blur", trigger: 'blur',
}, },
], ],
// filterable:true, // filterable:true,
@ -276,76 +302,80 @@ export default {
// }, // },
}, },
{ {
label: "主管工艺员", label: '主管工艺员',
prop: "leaderUser", prop: 'leaderUser',
type: "select", type: 'select',
span: 24, span: 24,
overflow: true, overflow: true,
search: true, search: true,
hide:true, hide: true,
sortable: true,
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入主管工艺员", message: '请输入主管工艺员',
trigger: "blur", trigger: 'blur',
}, },
], ],
// filterable:true, // filterable:true,
remote:true, remote: true,
dicUrl:"/api/blade-system/user/page?current=1&size=9999&realName={{key}}", dicUrl: '/api/blade-system/user/page?current=1&size=9999&realName={{key}}',
// dicUrl:"/blade-system/user/page?size=999999&current=1", // dicUrl:"/blade-system/user/page?size=999999&current=1",
props: { props: {
label: "realName", label: 'realName',
value: "id", value: 'id',
res:"data.records" res: 'data.records',
}, },
}, },
{ {
label: "班组", label: '班组',
prop: "team", prop: 'team',
span: 24, span: 24,
addDisplay: false, addDisplay: false,
editDisplay: false, editDisplay: false,
overflow: true, overflow: true,
search: true, search: true,
sortable: true,
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入班组", message: '请输入班组',
trigger: "blur", trigger: 'blur',
}, },
], ],
}, },
{ {
label: "交付中心", label: '交付中心',
prop: "jcId", prop: 'jcId',
type: "select", type: 'select',
span: 24, span: 24,
overflow: true, overflow: true,
search: false, search: false,
dicUrl:'/api/blade-system/dict/dictionary?code=workCenterJfCenter', // dicUrl: '/api/blade-system/dict/dictionary?code=workCenterJfCenter', //
props:{ sortable: true,
label:'dictValue', props: {
value:'dictKey', label: 'dictValue',
value: 'dictKey',
}, },
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入交付中心", message: '请输入交付中心',
trigger: "blur", trigger: 'blur',
}, },
], ],
}, },
{ {
label: "描述", label: '描述',
prop: "describe", prop: 'describe',
type: "textarea", type: 'textarea',
span: 24, span: 24,
hide: true, hide: true,
overflow: true, overflow: true,
search: false, search: false,
sortable: true,
// rules: [ // rules: [
// { // {
// required: true, // required: true,
@ -355,13 +385,13 @@ export default {
// ], // ],
}, },
{ {
label: "是否检验标记", label: '是否检验标记',
prop: "checkout", prop: 'checkout',
type: "switch", type: 'switch',
// type: "checkbox", // type: "checkbox",
dicData: [ dicData: [
{ label:"否", value:0}, { label: '否', value: 0 },
{ label: "是", value: 1 }, { label: '是', value: 1 },
], ],
// dicData: [{ label: "", value: 1 }], // dicData: [{ label: "", value: 1 }],
span: 24, span: 24,
@ -377,13 +407,13 @@ export default {
// ], // ],
}, },
{ {
label: "是否镀后标记", label: '是否镀后标记',
prop: "whetherPlate", prop: 'whetherPlate',
// type: "checkbox", // type: "checkbox",
type: "switch", type: 'switch',
dicData: [ dicData: [
{ label:"否", value:0}, { label: '否', value: 0 },
{ label: "是", value: 1 }, { label: '是', value: 1 },
], ],
// dicData: [{ label: "", value: 1 }], // dicData: [{ label: "", value: 1 }],
span: 24, span: 24,
@ -399,13 +429,13 @@ export default {
// ], // ],
}, },
{ {
label: "是否大批量", label: '是否大批量',
prop: "bigBatch", prop: 'bigBatch',
// type: "checkbox", // type: "checkbox",
type:"switch", type: 'switch',
dicData:[ dicData: [
{ label:"否", value:0}, { label: '否', value: 0 },
{ label: "是", value: 1 }, { label: '是', value: 1 },
], ],
// dicData: [{ label: "", value: 1 }], // dicData: [{ label: "", value: 1 }],
span: 24, span: 24,
@ -422,64 +452,62 @@ export default {
}, },
], ],
}, },
checkId:'' checkId: '',
}; };
}, },
mounted() { mounted() {
this.getAbilityData() this.getAbilityData();
}, },
methods: { methods: {
searchChange(params, done) {
searchChange(params, done){
this.query = params; this.query = params;
this.page.currentPage = 1; this.page.currentPage = 1;
this.onLoad() this.onLoad();
done() done();
}, },
searchReset(){ searchReset() {
this.query = {} this.query = {};
this.onLoad() this.onLoad();
}, },
currentChange(currentPage){ currentChange(currentPage) {
this.page.currentPage = currentPage; this.page.currentPage = currentPage;
}, },
sizeChange(pageSize){ sizeChange(pageSize) {
this.page.pageSize = pageSize; this.page.pageSize = pageSize;
}, },
beforeOpen(done, type){ beforeOpen(done, type) {
if(type == 'edit'){ if (type == 'edit') {
console.log('form',this.form) console.log('form', this.form);
this.form.jcId = this.form.jcId + '' this.form.jcId = this.form.jcId + '';
this.form.leaderUser = this.form.leaderUser + '' this.form.leaderUser = this.form.leaderUser + '';
// this.form.checkout = this.form.checkout == 1 ? [1] : [] // this.form.checkout = this.form.checkout == 1 ? [1] : []
// this.form.bigBatch = this.form.bigBatch == 1 ? [1] : [] // this.form.bigBatch = this.form.bigBatch == 1 ? [1] : []
// this.form.whetherPlate = this.form.whetherPlate == 1 ? [1] : [] // this.form.whetherPlate = this.form.whetherPlate == 1 ? [1] : []
this.form.checkout = this.form.checkout == 1 ? 1 : 0 this.form.checkout = this.form.checkout == 1 ? 1 : 0;
this.form.bigBatch = this.form.bigBatch == 1 ? 1 : 0 this.form.bigBatch = this.form.bigBatch == 1 ? 1 : 0;
this.form.whetherPlate = this.form.whetherPlate == 1 ? 1 : 0 this.form.whetherPlate = this.form.whetherPlate == 1 ? 1 : 0;
getAllUser({current:1,size:300}).then(res => { getAllUser({ current: 1, size: 300 }).then(res => {
this.leaderUsers = res.data.data.records this.leaderUsers = res.data.data.records;
let tmp = this.leaderUsers.find(item => item.id == this.form.leaderUser) let tmp = this.leaderUsers.find(item => item.id == this.form.leaderUser);
if(!tmp){ if (!tmp) {
getAllUser({ getAllUser({
realName:this.form.leaderUserName realName: this.form.leaderUserName,
}).then(res =>{ }).then(res => {
this.leaderUsers = [...this.leaderUsers, ...res.data.data.records] this.leaderUsers = [...this.leaderUsers, ...res.data.data.records];
done() done();
}) });
}else{ } else {
done() done();
} }
}) });
}else{ } else {
done() done();
} }
}, },
rowSave(row, done, loading){ rowSave(row, done, loading) {
console.log('row----------',row) console.log('row----------', row);
// let params = { // let params = {
// ...row, // ...row,
// checkout:row.checkout.length != 0 ? 1 : 0, // checkout:row.checkout.length != 0 ? 1 : 0,
@ -489,20 +517,20 @@ export default {
let params = { let params = {
...row, ...row,
checkout:row.checkout == 1 ? 1 : 0, checkout: row.checkout == 1 ? 1 : 0,
bigBatch:row.bigBatch == 1 ? 1 : 0, bigBatch: row.bigBatch == 1 ? 1 : 0,
whetherPlate:row.whetherPlate == 1 ? 1 : 0, whetherPlate: row.whetherPlate == 1 ? 1 : 0,
} };
addWorkCenter(params).then(res =>{ addWorkCenter(params).then(res => {
if(res.data.code === 200){ if (res.data.code === 200) {
this.$message.success('新增成功'); this.$message.success('新增成功');
this.onLoad() this.onLoad();
done() done();
} }
}) });
}, },
rowUpdate(row, index, done, loading){ rowUpdate(row, index, done, loading) {
// let params = { // let params = {
// ...row, // ...row,
// checkout:row.checkout.length != 0 ? 1 : 0, // checkout:row.checkout.length != 0 ? 1 : 0,
@ -512,90 +540,90 @@ export default {
let params = { let params = {
...row, ...row,
checkout:row.checkout == 1 ? 1 : 0, checkout: row.checkout == 1 ? 1 : 0,
bigBatch:row.bigBatch == 1 ? 1 : 0, bigBatch: row.bigBatch == 1 ? 1 : 0,
whetherPlate:row.whetherPlate == 1 ? 1 : 0, whetherPlate: row.whetherPlate == 1 ? 1 : 0,
} };
updateWorkCenter(params).then(res =>{ updateWorkCenter(params).then(res => {
if(res.data.code === 200){ if (res.data.code === 200) {
this.$message.success('修改成功'); this.$message.success('修改成功');
this.onLoad() this.onLoad();
done() done();
} }
}) });
}, },
// //
async setTeam(row) { async setTeam(row) {
this.checkId = row.id this.checkId = row.id;
// this.teamValue = row.teamValue && row.teamValue != "" ? row.teamValue.split(",") : []; // this.teamValue = row.teamValue && row.teamValue != "" ? row.teamValue.split(",") : [];
// console.log("teamValue=================", this.teamValue); // console.log("teamValue=================", this.teamValue);
const selectTeam = await getSelectTeam({id: row.id,}); const selectTeam = await getSelectTeam({ id: row.id });
const noSelectTeam = await getNotSelectTeam({id: row.id,}); const noSelectTeam = await getNotSelectTeam({ id: row.id });
console.log('selectTeam-----------',selectTeam) console.log('selectTeam-----------', selectTeam);
console.log('noSelectTeam-----------',noSelectTeam) console.log('noSelectTeam-----------', noSelectTeam);
this.teamData = [...noSelectTeam.data.data,...selectTeam.data.data] this.teamData = [...noSelectTeam.data.data, ...selectTeam.data.data];
this.teamValue = selectTeam.data.data.map(item => item.id) this.teamValue = selectTeam.data.data.map(item => item.id);
console.log('teamValue-----------',this.teamValue) console.log('teamValue-----------', this.teamValue);
this.teamDialog = true; this.teamDialog = true;
}, },
submitTeam(){ submitTeam() {
console.log('this.teamValue-----------',this.teamValue) console.log('this.teamValue-----------', this.teamValue);
let params = { let params = {
id:this.checkId, id: this.checkId,
teamIds:this.teamValue teamIds: this.teamValue,
} };
saveTeam(params).then(res =>{ saveTeam(params).then(res => {
if(res.data.code === 200){ if (res.data.code === 200) {
this.$message.success('班组设置成功'); this.$message.success('班组设置成功');
this.teamDialog = false this.teamDialog = false;
this.onLoad() this.onLoad();
} }
}) });
}, },
submitCapacity(){ submitCapacity() {
if(this.capacityList.length == 0){ if (this.capacityList.length == 0) {
this.$message.error('请至少填写一条数据') this.$message.error('请至少填写一条数据');
return return;
} }
// //
const emptyAbility = this.capacityList.find(item => !item.id); const emptyAbility = this.capacityList.find(item => !item.id);
if(emptyAbility){ if (emptyAbility) {
this.$message.error('工艺能力为必选项,请选择工艺能力') this.$message.error('工艺能力为必选项,请选择工艺能力');
return return;
} }
// console.log('this.capacityList-----------',this.capacityList) // console.log('this.capacityList-----------',this.capacityList)
// //
const submitData = this.capacityList.map(row => { const submitData = this.capacityList.map(row => {
const { _select, ...validData } = row; // const { _select, ...validData } = row; //
return validData; return validData;
}); });
let params = { let params = {
id:this.checkId, id: this.checkId,
crafs:submitData crafs: submitData,
} };
console.log('params-----------',params) console.log('params-----------', params);
saveCraft(params).then(res =>{ saveCraft(params).then(res => {
if(res.data.code === 200){ if (res.data.code === 200) {
this.$message.success('工艺能力设置成功'); this.$message.success('工艺能力设置成功');
this.capacityDialog = false this.capacityDialog = false;
this.onLoad() this.onLoad();
} }
}) });
}, },
getAbilityData(){ getAbilityData() {
getAbility().then(res =>{ getAbility().then(res => {
this.abilityList = res.data.data this.abilityList = res.data.data;
}) });
}, },
// //
setCapability(row){ setCapability(row) {
this.checkId = row.id this.checkId = row.id;
getSelectCraft({id:row.id}).then(res =>{ getSelectCraft({ id: row.id }).then(res => {
this.capacityList = res.data.data this.capacityList = res.data.data;
this.capacityDialog = true this.capacityDialog = true;
}) });
}, },
// //
insertEvent() { insertEvent() {
@ -616,22 +644,22 @@ export default {
row._select = !row._select; row._select = !row._select;
}, },
remove() { remove() {
let arr = this.capacityList.filter((item) => item._select); let arr = this.capacityList.filter(item => item._select);
if (arr.length != 0) { if (arr.length != 0) {
this.$confirm("确定将选择数据删除?", { this.$confirm('确定将选择数据删除?', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning", type: 'warning',
}).then(() => { }).then(() => {
if (this.rowId) { if (this.rowId) {
let deleteData = this.capacityList.filter((item) => item._select); let deleteData = this.capacityList.filter(item => item._select);
this.deleteTidArr = deleteData.filter((item) => item.tidId); this.deleteTidArr = deleteData.filter(item => item.tidId);
} }
let deleteArr = this.capacityList.filter((item) => !item._select); let deleteArr = this.capacityList.filter(item => !item._select);
this.capacityList = deleteArr; this.capacityList = deleteArr;
}); });
} else { } else {
this.$message.error("请至少选择一条数据进行操作!"); this.$message.error('请至少选择一条数据进行操作!');
} }
}, },
handleSave() { handleSave() {
@ -650,33 +678,33 @@ export default {
}, },
handleDelete() { handleDelete() {
if (this.selectionList.length == 0) { if (this.selectionList.length == 0) {
this.$message.error("请至少选择一条数据"); this.$message.error('请至少选择一条数据');
} else { } else {
this.$confirm("确定删除选中数据?", { this.$confirm('确定删除选中数据?', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning", type: 'warning',
}).then(() => { }).then(() => {
deleteWorkCenter({ deleteWorkCenter({
ids: this.selectionList.map(item => item.id).join(","), ids: this.selectionList.map(item => item.id).join(','),
}).then(res =>{ }).then(res => {
if(res.data.code === 200){ if (res.data.code === 200) {
this.$message.success('删除成功'); this.$message.success('删除成功');
this.onLoad() this.onLoad();
} }
}) });
}); });
} }
}, },
onLoad() { onLoad() {
getList({ getList({
current:this.page.currentPage, current: this.page.currentPage,
size:this.page.pageSize, size: this.page.pageSize,
...this.query ...this.query,
}).then(res =>{ }).then(res => {
this.data = res.data.data.records this.data = res.data.data.records;
this.page.total = res.data.data.total this.page.total = res.data.data.total;
}) });
// this.data = [ // this.data = [
// { // {
// area: 0.0, // area: 0.0,

Loading…
Cancel
Save