|
|
|
@ -15,17 +15,28 @@ |
|
|
|
@size-change="sizeChange" |
|
|
|
@size-change="sizeChange" |
|
|
|
@refresh-change="refreshChange" |
|
|
|
@refresh-change="refreshChange" |
|
|
|
@on-load="onLoad" |
|
|
|
@on-load="onLoad" |
|
|
|
|
|
|
|
@sort-change="sortChange"s |
|
|
|
|
|
|
|
:permission="permissionList" |
|
|
|
> |
|
|
|
> |
|
|
|
<template #menu-left> |
|
|
|
<template #menu-left> |
|
|
|
<el-button type="primary" @click="addEdit">新增 </el-button> |
|
|
|
<el-button type="primary" v-if="permission.calculationFormula1_add" @click="addEdit" |
|
|
|
<el-button type="danger" @click="handleDelete()" |
|
|
|
>新增 |
|
|
|
|
|
|
|
</el-button> |
|
|
|
|
|
|
|
<el-button type="danger" v-if="permission.calculationFormula1_del" @click="handleDelete()" |
|
|
|
>删除 |
|
|
|
>删除 |
|
|
|
</el-button> |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<template #menu-right> </template> |
|
|
|
<template #menu-right> </template> |
|
|
|
<template #menu="scope"> |
|
|
|
<template #menu="scope"> |
|
|
|
<el-button type="text" @click="editFn(scope.row)">修改 </el-button> |
|
|
|
<el-button type="text" v-if="permission.calculationFormula1_edit" @click="editFn(scope.row)" |
|
|
|
<el-button type="text" @click="handleDelete(scope.row)">删除 </el-button> |
|
|
|
>修改 |
|
|
|
|
|
|
|
</el-button> |
|
|
|
|
|
|
|
<el-button |
|
|
|
|
|
|
|
type="text" |
|
|
|
|
|
|
|
v-if="permission.calculationFormula1_del" |
|
|
|
|
|
|
|
@click="handleDelete(scope.row)" |
|
|
|
|
|
|
|
>删除 |
|
|
|
|
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<template #produceTsTarget="scope"> </template> |
|
|
|
<template #produceTsTarget="scope"> </template> |
|
|
|
</avue-crud> |
|
|
|
</avue-crud> |
|
|
|
@ -44,9 +55,15 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import addEditDosing from "./components/addEditDosing.vue"; |
|
|
|
import addEditDosing from './components/addEditDosing.vue'; |
|
|
|
import workCenterSet from "./components/workCenterSet.vue"; |
|
|
|
import workCenterSet from './components/workCenterSet.vue'; |
|
|
|
import {getList,addFormula,deleteFormula,userListpage} from "@/api/basicData/calculationFormula" |
|
|
|
import { |
|
|
|
|
|
|
|
getList, |
|
|
|
|
|
|
|
addFormula, |
|
|
|
|
|
|
|
deleteFormula, |
|
|
|
|
|
|
|
userListpage, |
|
|
|
|
|
|
|
} from '@/api/basicData/calculationFormula'; |
|
|
|
|
|
|
|
import { mapGetters } from 'vuex'; |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
components: { |
|
|
|
components: { |
|
|
|
addEditDosing, |
|
|
|
addEditDosing, |
|
|
|
@ -55,12 +72,12 @@ export default { |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
selectionList: [], |
|
|
|
selectionList: [], |
|
|
|
loading:false, |
|
|
|
loading: false, |
|
|
|
query:{}, |
|
|
|
query: {}, |
|
|
|
userListData: [], |
|
|
|
userListData: [], |
|
|
|
userListLoaded: false, |
|
|
|
userListLoaded: false, |
|
|
|
option: { |
|
|
|
option: { |
|
|
|
height: "auto", |
|
|
|
height: 'auto', |
|
|
|
calcHeight: 32, |
|
|
|
calcHeight: 32, |
|
|
|
tip: false, |
|
|
|
tip: false, |
|
|
|
// size: "medium", |
|
|
|
// size: "medium", |
|
|
|
@ -77,11 +94,11 @@ export default { |
|
|
|
delBtn: false, |
|
|
|
delBtn: false, |
|
|
|
addBtn: false, |
|
|
|
addBtn: false, |
|
|
|
editBtn: false, |
|
|
|
editBtn: false, |
|
|
|
editBtnText: "修改", |
|
|
|
editBtnText: '修改', |
|
|
|
viewBtnIcon: " ", |
|
|
|
viewBtnIcon: ' ', |
|
|
|
delBtnIcon: " ", |
|
|
|
delBtnIcon: ' ', |
|
|
|
editBtnIcon: " ", |
|
|
|
editBtnIcon: ' ', |
|
|
|
viewBtnText: "详情", |
|
|
|
viewBtnText: '详情', |
|
|
|
labelWidth: 120, |
|
|
|
labelWidth: 120, |
|
|
|
menuWidth: 100, |
|
|
|
menuWidth: 100, |
|
|
|
dialogWidth: 640, |
|
|
|
dialogWidth: 640, |
|
|
|
@ -94,51 +111,51 @@ export default { |
|
|
|
excelBtn: true, |
|
|
|
excelBtn: true, |
|
|
|
columnSort: true, |
|
|
|
columnSort: true, |
|
|
|
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: ' ', |
|
|
|
align: "center", |
|
|
|
align: 'center', |
|
|
|
column: [ |
|
|
|
column: [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: "公式名称", |
|
|
|
label: '公式名称', |
|
|
|
prop: "name", |
|
|
|
prop: 'name', |
|
|
|
sortable: true, |
|
|
|
sortable: 'custom', |
|
|
|
filter: true, |
|
|
|
filter: true, |
|
|
|
span: 24, |
|
|
|
span: 24, |
|
|
|
search: true, |
|
|
|
search: true, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: "公式内容", |
|
|
|
label: '公式内容', |
|
|
|
prop: "content", |
|
|
|
prop: 'content', |
|
|
|
sortable: true, |
|
|
|
sortable: 'custom', |
|
|
|
filter: true, |
|
|
|
filter: true, |
|
|
|
span: 24, |
|
|
|
span: 24, |
|
|
|
search: false, |
|
|
|
search: false, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: "操作人", |
|
|
|
label: '操作人', |
|
|
|
prop: "updateUser", |
|
|
|
prop: 'updateUser', |
|
|
|
sortable: true, |
|
|
|
sortable: 'custom', |
|
|
|
filter: true, |
|
|
|
filter: true, |
|
|
|
span: 24, |
|
|
|
span: 24, |
|
|
|
search: false, |
|
|
|
search: false, |
|
|
|
display: true, |
|
|
|
display: true, |
|
|
|
formatter: (row) => { |
|
|
|
formatter: row => { |
|
|
|
return this.userMapObj[row.updateUser] || row.updateUser || '-'; |
|
|
|
return this.userMapObj[row.updateUser] || row.updateUser || '-'; |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: "更新时间", |
|
|
|
label: '更新时间', |
|
|
|
prop: "updateTime", |
|
|
|
prop: 'updateTime', |
|
|
|
sortable: true, |
|
|
|
sortable: 'custom', |
|
|
|
filter: true, |
|
|
|
filter: true, |
|
|
|
span: 24, |
|
|
|
span: 24, |
|
|
|
search: false, |
|
|
|
search: false, |
|
|
|
@ -146,7 +163,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
], |
|
|
|
}, |
|
|
|
}, |
|
|
|
checkRow:{}, |
|
|
|
checkRow: {}, |
|
|
|
form: {}, |
|
|
|
form: {}, |
|
|
|
page: { |
|
|
|
page: { |
|
|
|
pageSize: 10, |
|
|
|
pageSize: 10, |
|
|
|
@ -158,6 +175,14 @@ export default { |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
computed: { |
|
|
|
|
|
|
|
...mapGetters(['permission']), |
|
|
|
|
|
|
|
permissionList() { |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
addBtn: this.validData(this.permission.calculationFormula1_add, false), |
|
|
|
|
|
|
|
editBtn: this.validData(this.permission.calculationFormula1_edit, false), |
|
|
|
|
|
|
|
delBtn: this.validData(this.permission.calculationFormula1_del, false), |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
}, |
|
|
|
userMapObj() { |
|
|
|
userMapObj() { |
|
|
|
const map = {}; |
|
|
|
const map = {}; |
|
|
|
this.userListData.forEach(user => { |
|
|
|
this.userListData.forEach(user => { |
|
|
|
@ -169,20 +194,21 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
|
|
|
|
|
|
|
|
loadUserList() { |
|
|
|
loadUserList() { |
|
|
|
return new Promise((resolve) => { |
|
|
|
return new Promise(resolve => { |
|
|
|
userListpage(1, 99999).then(res => { |
|
|
|
userListpage(1, 99999) |
|
|
|
|
|
|
|
.then(res => { |
|
|
|
if (res.data.code == 200) { |
|
|
|
if (res.data.code == 200) { |
|
|
|
const users = res.data.data; |
|
|
|
const users = res.data.data; |
|
|
|
this.userListData = users.map(user => ({ |
|
|
|
this.userListData = users.map(user => ({ |
|
|
|
label: user.realName || user.name, |
|
|
|
label: user.realName || user.name, |
|
|
|
value: String(user.id) |
|
|
|
value: String(user.id), |
|
|
|
})); |
|
|
|
})); |
|
|
|
this.userListLoaded = true; |
|
|
|
this.userListLoaded = true; |
|
|
|
} |
|
|
|
} |
|
|
|
resolve(); |
|
|
|
resolve(); |
|
|
|
}).catch(error => { |
|
|
|
}) |
|
|
|
|
|
|
|
.catch(error => { |
|
|
|
console.error('获取用户列表失败', error); |
|
|
|
console.error('获取用户列表失败', error); |
|
|
|
resolve(); |
|
|
|
resolve(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
@ -199,7 +225,7 @@ export default { |
|
|
|
closeDialog(val) { |
|
|
|
closeDialog(val) { |
|
|
|
this.isOpen = false; |
|
|
|
this.isOpen = false; |
|
|
|
this.isWorkOpen = false; |
|
|
|
this.isWorkOpen = false; |
|
|
|
if(val){ |
|
|
|
if (val) { |
|
|
|
this.onLoad(); |
|
|
|
this.onLoad(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
@ -239,58 +265,69 @@ export default { |
|
|
|
// }); |
|
|
|
// }); |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleDelete(row) { |
|
|
|
handleDelete(row) { |
|
|
|
console.log('row---------',row) |
|
|
|
console.log('row---------', row); |
|
|
|
if (!row && this.selectionList.length === 0) { |
|
|
|
if (!row && this.selectionList.length === 0) { |
|
|
|
this.$message.error('请选择至少一条数据'); |
|
|
|
this.$message.error('请选择至少一条数据'); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
this.$confirm("确定将选择数据删除?", { |
|
|
|
this.$confirm('确定将选择数据删除?', { |
|
|
|
confirmButtonText: "确定", |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: "取消", |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: "warning", |
|
|
|
type: 'warning', |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
if(row){ |
|
|
|
if (row) { |
|
|
|
deleteFormula({ids:row.id}).then(res => { |
|
|
|
deleteFormula({ ids: row.id }).then(res => { |
|
|
|
if(res.data.code == 200){ |
|
|
|
if (res.data.code == 200) { |
|
|
|
this.$message.success('删除成功') |
|
|
|
this.$message.success('删除成功'); |
|
|
|
this.onLoad() |
|
|
|
this.onLoad(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
deleteFormula({ |
|
|
|
deleteFormula({ |
|
|
|
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(); |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
searchChange(params, done){ |
|
|
|
searchChange(params, done) { |
|
|
|
this.page.currentPage = 1; |
|
|
|
this.page.currentPage = 1; |
|
|
|
this.query = params; |
|
|
|
this.query = params; |
|
|
|
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; |
|
|
|
}, |
|
|
|
}, |
|
|
|
refreshChange(){ |
|
|
|
refreshChange() { |
|
|
|
this.onLoad() |
|
|
|
this.onLoad(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 多选 |
|
|
|
// 多选 |
|
|
|
selectionChange(list) { |
|
|
|
selectionChange(list) { |
|
|
|
this.selectionList = list; |
|
|
|
this.selectionList = list; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// 排序 |
|
|
|
|
|
|
|
sortChange({ prop, order }) { |
|
|
|
|
|
|
|
this.query.descs = undefined; |
|
|
|
|
|
|
|
this.query.ascs = undefined; |
|
|
|
|
|
|
|
let orderByFieldKey = order === 'descending' ? 'descs' : 'ascs'; |
|
|
|
|
|
|
|
this.query[orderByFieldKey] = !prop |
|
|
|
|
|
|
|
? undefined |
|
|
|
|
|
|
|
: prop.replace(/([a-z])([A-Z0-9])/g, '$1_$2').toUpperCase(); |
|
|
|
|
|
|
|
// // 重新加载数据 |
|
|
|
|
|
|
|
this.onLoad(this.page, this.query); |
|
|
|
|
|
|
|
}, |
|
|
|
async onLoad() { |
|
|
|
async onLoad() { |
|
|
|
this.loading = true; |
|
|
|
this.loading = true; |
|
|
|
// 确保用户列表先加载完成 |
|
|
|
// 确保用户列表先加载完成 |
|
|
|
@ -298,15 +335,15 @@ export default { |
|
|
|
await this.loadUserList(); |
|
|
|
await this.loadUserList(); |
|
|
|
} |
|
|
|
} |
|
|
|
getList({ |
|
|
|
getList({ |
|
|
|
current:this.page.currentPage, |
|
|
|
current: this.page.currentPage, |
|
|
|
size:this.page.pageSize, |
|
|
|
size: this.page.pageSize, |
|
|
|
formulaType:1, |
|
|
|
formulaType: 1, |
|
|
|
...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.loading = false |
|
|
|
this.loading = false; |
|
|
|
}) |
|
|
|
}); |
|
|
|
// this.data = [ |
|
|
|
// this.data = [ |
|
|
|
// { |
|
|
|
// { |
|
|
|
// area: null, |
|
|
|
// area: null, |
|
|
|
|