|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<avue-crud
|
|
|
|
|
:option="option"
|
|
|
|
|
:table-loading="loading"
|
|
|
|
|
:data="data"
|
|
|
|
|
v-model="form"
|
|
|
|
|
v-model:page="page"
|
|
|
|
|
ref="crud"
|
|
|
|
|
@row-del="rowDel"
|
|
|
|
|
@search-change="searchChange"
|
|
|
|
|
@search-reset="searchReset"
|
|
|
|
|
@selection-change="selectionChange"
|
|
|
|
|
@current-change="currentChange"
|
|
|
|
|
@size-change="sizeChange"
|
|
|
|
|
@refresh-change="refreshChange"
|
|
|
|
|
@on-load="onLoad"
|
|
|
|
|
>
|
|
|
|
|
<template #menu-left>
|
|
|
|
|
<el-button type="primary" @click="addEdit">新增 </el-button>
|
|
|
|
|
<el-button type="danger" @click="handleDelete()"
|
|
|
|
|
>删除
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
<template #menu-right> </template>
|
|
|
|
|
<template #menu="scope">
|
|
|
|
|
<el-button type="text" @click="editFn(scope.row)">编辑 </el-button>
|
|
|
|
|
<el-button type="text" @click="handleDelete(scope.row)">删除 </el-button>
|
|
|
|
|
</template>
|
|
|
|
|
<template #produceTsTarget="scope"> </template>
|
|
|
|
|
</avue-crud>
|
|
|
|
|
<addEditDosing
|
|
|
|
|
v-if="isOpen"
|
|
|
|
|
:showDialog="isOpen"
|
|
|
|
|
:formulaType="1"
|
|
|
|
|
:checkRow="checkRow"
|
|
|
|
|
@closeDialog="closeDialog"
|
|
|
|
|
></addEditDosing>
|
|
|
|
|
<workCenterSet
|
|
|
|
|
v-if="isWorkOpen"
|
|
|
|
|
:showDialog="isWorkOpen"
|
|
|
|
|
@closeDialog="closeDialog"
|
|
|
|
|
></workCenterSet>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import addEditDosing from "./components/addEditDosing.vue";
|
|
|
|
|
import workCenterSet from "./components/workCenterSet.vue";
|
|
|
|
|
import {getList,addFormula,deleteFormula,userListpage} from "@/api/basicData/calculationFormula"
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
addEditDosing,
|
|
|
|
|
workCenterSet,
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
selectionList: [],
|
|
|
|
|
loading:false,
|
|
|
|
|
query:{},
|
|
|
|
|
userListData: [],
|
|
|
|
|
userListLoaded: false,
|
|
|
|
|
option: {
|
|
|
|
|
height: "auto",
|
|
|
|
|
calcHeight: 32,
|
|
|
|
|
tip: false,
|
|
|
|
|
// size: "medium",
|
|
|
|
|
simplePage: true,
|
|
|
|
|
searchShow: true,
|
|
|
|
|
searchMenuSpan: 18,
|
|
|
|
|
searchIcon: true,
|
|
|
|
|
searchIndex: 3,
|
|
|
|
|
tree: false,
|
|
|
|
|
border: true,
|
|
|
|
|
index: false,
|
|
|
|
|
selection: true,
|
|
|
|
|
viewBtn: false,
|
|
|
|
|
delBtn: false,
|
|
|
|
|
addBtn: false,
|
|
|
|
|
editBtn: false,
|
|
|
|
|
editBtnText: "修改",
|
|
|
|
|
viewBtnIcon: " ",
|
|
|
|
|
delBtnIcon: " ",
|
|
|
|
|
editBtnIcon: " ",
|
|
|
|
|
viewBtnText: "详情",
|
|
|
|
|
labelWidth: 120,
|
|
|
|
|
menuWidth: 100,
|
|
|
|
|
dialogWidth: 640,
|
|
|
|
|
dialogClickModal: false,
|
|
|
|
|
searchEnter: true,
|
|
|
|
|
excelBtn: false,
|
|
|
|
|
filterBtn: true,
|
|
|
|
|
searchShowBtn: false,
|
|
|
|
|
columnSort: true,
|
|
|
|
|
excelBtn: true,
|
|
|
|
|
columnSort: true,
|
|
|
|
|
showOverflowTooltip: true,
|
|
|
|
|
searchLabelPosition: "left",
|
|
|
|
|
searchLabelPosition: "left",
|
|
|
|
|
searchGutter: 24,
|
|
|
|
|
searchSpan: 6,
|
|
|
|
|
menuAlign: "center",
|
|
|
|
|
gridBtn: false,
|
|
|
|
|
searchMenuPosition: "right",
|
|
|
|
|
addBtnIcon: " ",
|
|
|
|
|
viewBtnIcon: " ",
|
|
|
|
|
delBtnIcon: " ",
|
|
|
|
|
editBtnIcon: " ",
|
|
|
|
|
align: "center",
|
|
|
|
|
column: [
|
|
|
|
|
{
|
|
|
|
|
label: "公式名称",
|
|
|
|
|
prop: "name",
|
|
|
|
|
sortable: true,
|
|
|
|
|
filter: true,
|
|
|
|
|
span: 24,
|
|
|
|
|
search: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "公式内容",
|
|
|
|
|
prop: "content",
|
|
|
|
|
sortable: true,
|
|
|
|
|
filter: true,
|
|
|
|
|
span: 24,
|
|
|
|
|
search: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "操作人",
|
|
|
|
|
prop: "updateUser",
|
|
|
|
|
sortable: true,
|
|
|
|
|
filter: true,
|
|
|
|
|
span: 24,
|
|
|
|
|
search: false,
|
|
|
|
|
display: true,
|
|
|
|
|
formatter: (row) => {
|
|
|
|
|
return this.userMapObj[row.updateUser] || row.updateUser || '-';
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "更新时间",
|
|
|
|
|
prop: "updateTime",
|
|
|
|
|
sortable: true,
|
|
|
|
|
filter: true,
|
|
|
|
|
span: 24,
|
|
|
|
|
search: false,
|
|
|
|
|
display: true,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
checkRow:{},
|
|
|
|
|
form: {},
|
|
|
|
|
page: {
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
currentPage: 1,
|
|
|
|
|
total: 0,
|
|
|
|
|
},
|
|
|
|
|
isOpen: false,
|
|
|
|
|
isWorkOpen: false,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
userMapObj() {
|
|
|
|
|
const map = {};
|
|
|
|
|
this.userListData.forEach(user => {
|
|
|
|
|
map[user.value] = user.label;
|
|
|
|
|
map[String(user.value)] = user.label;
|
|
|
|
|
map[Number(user.value)] = user.label;
|
|
|
|
|
});
|
|
|
|
|
return map;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
|
|
loadUserList() {
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
userListpage(1, 99999).then(res => {
|
|
|
|
|
if (res.data.code == 200) {
|
|
|
|
|
const users = res.data.data;
|
|
|
|
|
this.userListData = users.map(user => ({
|
|
|
|
|
label: user.realName || user.name,
|
|
|
|
|
value: String(user.id)
|
|
|
|
|
}));
|
|
|
|
|
this.userListLoaded = true;
|
|
|
|
|
}
|
|
|
|
|
resolve();
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
console.error('获取用户列表失败', error);
|
|
|
|
|
resolve();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
addEdit() {
|
|
|
|
|
this.checkRow = {};
|
|
|
|
|
this.isOpen = true;
|
|
|
|
|
},
|
|
|
|
|
editFn(row) {
|
|
|
|
|
this.checkRow = row;
|
|
|
|
|
this.isOpen = true;
|
|
|
|
|
},
|
|
|
|
|
closeDialog(val) {
|
|
|
|
|
this.isOpen = false;
|
|
|
|
|
this.isWorkOpen = false;
|
|
|
|
|
if(val){
|
|
|
|
|
this.onLoad();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
maintenanceClick() {
|
|
|
|
|
// this.$refs.myTable.fullValidate((errMap) => {
|
|
|
|
|
// if (errMap) {
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// const dataList = this.$refs.myTable.getRecordset().updateRecords;
|
|
|
|
|
// this.$ajax
|
|
|
|
|
// .post('oemMerits/maintenance', {
|
|
|
|
|
// dataList,
|
|
|
|
|
// status: 2,
|
|
|
|
|
// type: 'produce'
|
|
|
|
|
// })
|
|
|
|
|
// .then((res) => {
|
|
|
|
|
// if (res.code === 0) {
|
|
|
|
|
// this.$message.success('维护成功');
|
|
|
|
|
// this.queryTable();
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// });
|
|
|
|
|
},
|
|
|
|
|
proofreadClick() {
|
|
|
|
|
// const dataList = this.$refs.myTable.getTableData().tableData;
|
|
|
|
|
// this.$ajax
|
|
|
|
|
// .post('oemMerits/proofread', {
|
|
|
|
|
// dataList,
|
|
|
|
|
// status: 3,
|
|
|
|
|
// type: 'produce'
|
|
|
|
|
// })
|
|
|
|
|
// .then((res) => {
|
|
|
|
|
// if (res.code === 0) {
|
|
|
|
|
// this.$message.success('校对成功');
|
|
|
|
|
// this.queryTable();
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
},
|
|
|
|
|
handleDelete(row) {
|
|
|
|
|
console.log('row---------',row)
|
|
|
|
|
if (!row && this.selectionList.length === 0) {
|
|
|
|
|
this.$message.error('请选择至少一条数据');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.$confirm("确定将选择数据删除?", {
|
|
|
|
|
confirmButtonText: "确定",
|
|
|
|
|
cancelButtonText: "取消",
|
|
|
|
|
type: "warning",
|
|
|
|
|
}).then(() => {
|
|
|
|
|
if(row){
|
|
|
|
|
deleteFormula({ids:row.id}).then(res => {
|
|
|
|
|
if(res.data.code == 200){
|
|
|
|
|
this.$message.success('删除成功')
|
|
|
|
|
this.onLoad()
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}else{
|
|
|
|
|
deleteFormula({
|
|
|
|
|
ids:this.selectionList.map(item => item.id).join(',')
|
|
|
|
|
}).then(res =>{
|
|
|
|
|
if(res.data.code == 200){
|
|
|
|
|
this.$message.success('删除成功')
|
|
|
|
|
this.onLoad()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
searchChange(params, done){
|
|
|
|
|
this.page.currentPage = 1;
|
|
|
|
|
this.query = params;
|
|
|
|
|
this.onLoad()
|
|
|
|
|
done();
|
|
|
|
|
},
|
|
|
|
|
searchReset(){
|
|
|
|
|
this.query = {};
|
|
|
|
|
this.onLoad()
|
|
|
|
|
},
|
|
|
|
|
currentChange(currentPage){
|
|
|
|
|
this.page.currentPage = currentPage;
|
|
|
|
|
},
|
|
|
|
|
sizeChange(pageSize){
|
|
|
|
|
this.page.pageSize = pageSize;
|
|
|
|
|
},
|
|
|
|
|
refreshChange(){
|
|
|
|
|
this.onLoad()
|
|
|
|
|
},
|
|
|
|
|
// 多选
|
|
|
|
|
selectionChange(list) {
|
|
|
|
|
this.selectionList = list;
|
|
|
|
|
},
|
|
|
|
|
async onLoad() {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
// 确保用户列表先加载完成
|
|
|
|
|
if (!this.userListLoaded) {
|
|
|
|
|
await this.loadUserList();
|
|
|
|
|
}
|
|
|
|
|
getList({
|
|
|
|
|
current:this.page.currentPage,
|
|
|
|
|
size:this.page.pageSize,
|
|
|
|
|
formulaType:1,
|
|
|
|
|
...this.query
|
|
|
|
|
}).then(res =>{
|
|
|
|
|
this.data = res.data.data.records
|
|
|
|
|
this.page.total = res.data.data.total
|
|
|
|
|
this.loading = false
|
|
|
|
|
})
|
|
|
|
|
// this.data = [
|
|
|
|
|
// {
|
|
|
|
|
// area: null,
|
|
|
|
|
// configNo: null,
|
|
|
|
|
// keyValue: 27721,
|
|
|
|
|
// material: null,
|
|
|
|
|
// memo: null,
|
|
|
|
|
// partCode: "21E6-040-4006-B1",
|
|
|
|
|
// plate: null,
|
|
|
|
|
// plateCode: null,
|
|
|
|
|
// plateThickness: null,
|
|
|
|
|
// prepared: false,
|
|
|
|
|
// productType: "XXXX",
|
|
|
|
|
// psId: 27721,
|
|
|
|
|
// quota: 1.0,
|
|
|
|
|
// sinTerType: null,
|
|
|
|
|
// sinTerTypeTitle: null,
|
|
|
|
|
// subCode: "107-50-003",
|
|
|
|
|
// subName: null,
|
|
|
|
|
// subType: "B",
|
|
|
|
|
// subTypeTitle: "外购件",
|
|
|
|
|
// updateMan: null,
|
|
|
|
|
// updateTime: null,
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// area: null,
|
|
|
|
|
// configNo: null,
|
|
|
|
|
// keyValue: 27727,
|
|
|
|
|
// material: null,
|
|
|
|
|
// memo: null,
|
|
|
|
|
// partCode: "21E6-040-4271-B1",
|
|
|
|
|
// plate: null,
|
|
|
|
|
// plateCode: null,
|
|
|
|
|
// plateThickness: null,
|
|
|
|
|
// prepared: false,
|
|
|
|
|
// productType: "XXXX",
|
|
|
|
|
// psId: 27727,
|
|
|
|
|
// quota: 1.0,
|
|
|
|
|
// sinTerType: null,
|
|
|
|
|
// sinTerTypeTitle: null,
|
|
|
|
|
// subCode: "21E6-040-4218-B1",
|
|
|
|
|
// subName: null,
|
|
|
|
|
// subType: "A",
|
|
|
|
|
// subTypeTitle: "组合件",
|
|
|
|
|
// updateMan: null,
|
|
|
|
|
// updateTime: null,
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// area: null,
|
|
|
|
|
// configNo: null,
|
|
|
|
|
// keyValue: 27728,
|
|
|
|
|
// material: null,
|
|
|
|
|
// memo: null,
|
|
|
|
|
// partCode: "21E6-040-4271-B1",
|
|
|
|
|
// plate: null,
|
|
|
|
|
// plateCode: null,
|
|
|
|
|
// plateThickness: null,
|
|
|
|
|
// prepared: false,
|
|
|
|
|
// productType: "XXXX",
|
|
|
|
|
// psId: 27728,
|
|
|
|
|
// quota: 1.0,
|
|
|
|
|
// sinTerType: null,
|
|
|
|
|
// sinTerTypeTitle: null,
|
|
|
|
|
// subCode: "05-01-1613",
|
|
|
|
|
// subName: null,
|
|
|
|
|
// subType: "B",
|
|
|
|
|
// subTypeTitle: "外购件",
|
|
|
|
|
// updateMan: null,
|
|
|
|
|
// updateTime: null,
|
|
|
|
|
// },
|
|
|
|
|
// ];
|
|
|
|
|
// this.page.total = this.data.length;
|
|
|
|
|
// this.loading = false;
|
|
|
|
|
// setTimeout(() => {
|
|
|
|
|
// this.selectionClear();
|
|
|
|
|
// }, 500);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="scss" scoped></style>
|