|
|
|
|
@ -17,39 +17,53 @@ |
|
|
|
|
@size-change="sizeChange" |
|
|
|
|
@refresh-change="refreshChange" |
|
|
|
|
@on-load="onLoad" |
|
|
|
|
@sort-change="sortChange" |
|
|
|
|
:permission="permissionList" |
|
|
|
|
> |
|
|
|
|
<template #menu-left> |
|
|
|
|
<el-button type="danger" @click="handleDelete" |
|
|
|
|
<el-button type="danger" v-if="permission.localPlateParts_del" @click="handleDelete" |
|
|
|
|
>删除 |
|
|
|
|
</el-button> |
|
|
|
|
</template> |
|
|
|
|
<template #menu-right> |
|
|
|
|
<el-button type="primary" @click="handleImport">导入 </el-button> |
|
|
|
|
<el-button type="primary" v-if="permission.localPlateParts_import" @click="handleImport" |
|
|
|
|
>导入 |
|
|
|
|
</el-button> |
|
|
|
|
</template> |
|
|
|
|
</avue-crud> |
|
|
|
|
<!-- 导入 --> |
|
|
|
|
<basic-import v-if="isShowImport" title="导入" :isShow="isShowImport" |
|
|
|
|
<basic-import |
|
|
|
|
v-if="isShowImport" |
|
|
|
|
title="导入" |
|
|
|
|
:isShow="isShowImport" |
|
|
|
|
templateUrl="/blade-desk/BA/LocallyPlatedPart/downloadExcelTemplate" |
|
|
|
|
templateName="局部镀零件模板.xls" |
|
|
|
|
importUrl="/blade-desk/BA/LocallyPlatedPart/importExcel" |
|
|
|
|
@closeDialog="closeDialog"></basic-import> |
|
|
|
|
@closeDialog="closeDialog" |
|
|
|
|
></basic-import> |
|
|
|
|
</basic-container> |
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
|
import basicImport from '@/components/basic-import/main.vue' |
|
|
|
|
import {getList,addPlatedPart,updatePlatedPart,deletePlatedPart} from "@/api/basicData/localPlateParts" |
|
|
|
|
import basicImport from '@/components/basic-import/main.vue'; |
|
|
|
|
import { |
|
|
|
|
getList, |
|
|
|
|
addPlatedPart, |
|
|
|
|
updatePlatedPart, |
|
|
|
|
deletePlatedPart, |
|
|
|
|
} from '@/api/basicData/localPlateParts'; |
|
|
|
|
import { mapGetters } from 'vuex'; |
|
|
|
|
export default { |
|
|
|
|
components: { |
|
|
|
|
basicImport, |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
isShowImport:false, |
|
|
|
|
isShowImport: false, |
|
|
|
|
selectionList: [], |
|
|
|
|
loading:false, |
|
|
|
|
query:{}, |
|
|
|
|
loading: false, |
|
|
|
|
query: {}, |
|
|
|
|
option: { |
|
|
|
|
height: "auto", |
|
|
|
|
height: 'auto', |
|
|
|
|
calcHeight: 32, |
|
|
|
|
tip: false, |
|
|
|
|
// size: "medium", |
|
|
|
|
@ -65,11 +79,11 @@ export default { |
|
|
|
|
viewBtn: false, |
|
|
|
|
delBtn: true, |
|
|
|
|
addBtn: true, |
|
|
|
|
editBtnText: "修改", |
|
|
|
|
viewBtnIcon: " ", |
|
|
|
|
delBtnIcon: " ", |
|
|
|
|
editBtnIcon: " ", |
|
|
|
|
viewBtnText: "详情", |
|
|
|
|
editBtnText: '修改', |
|
|
|
|
viewBtnIcon: ' ', |
|
|
|
|
delBtnIcon: ' ', |
|
|
|
|
editBtnIcon: ' ', |
|
|
|
|
viewBtnText: '详情', |
|
|
|
|
labelWidth: 80, |
|
|
|
|
menuWidth: 120, |
|
|
|
|
dialogWidth: 540, |
|
|
|
|
@ -82,31 +96,31 @@ export default { |
|
|
|
|
excelBtn: true, |
|
|
|
|
columnSort: true, |
|
|
|
|
showOverflowTooltip: true, |
|
|
|
|
searchLabelPosition: "left", |
|
|
|
|
searchLabelPosition: 'left', |
|
|
|
|
searchGutter: 24, |
|
|
|
|
searchSpan: 6, |
|
|
|
|
menuAlign: "center", |
|
|
|
|
menuAlign: 'center', |
|
|
|
|
gridBtn: false, |
|
|
|
|
searchMenuPosition: "right", |
|
|
|
|
addBtnIcon: " ", |
|
|
|
|
viewBtnIcon: " ", |
|
|
|
|
delBtnIcon: " ", |
|
|
|
|
editBtnIcon: " ", |
|
|
|
|
align: "center", |
|
|
|
|
searchMenuPosition: 'right', |
|
|
|
|
addBtnIcon: ' ', |
|
|
|
|
viewBtnIcon: ' ', |
|
|
|
|
delBtnIcon: ' ', |
|
|
|
|
editBtnIcon: ' ', |
|
|
|
|
align: 'center', |
|
|
|
|
|
|
|
|
|
column: [ |
|
|
|
|
{ |
|
|
|
|
label: '零件号', |
|
|
|
|
prop: 'partCode', |
|
|
|
|
sortable: true, |
|
|
|
|
sortable: 'custom', |
|
|
|
|
filter: true, |
|
|
|
|
span: 24, |
|
|
|
|
search: true, |
|
|
|
|
rules:[ |
|
|
|
|
rules: [ |
|
|
|
|
{ |
|
|
|
|
required: true, |
|
|
|
|
message: "请输入零件编号", |
|
|
|
|
trigger: "blur", |
|
|
|
|
message: '请输入零件编号', |
|
|
|
|
trigger: 'blur', |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
validator: (rule, value, callback) => { |
|
|
|
|
@ -116,9 +130,9 @@ export default { |
|
|
|
|
callback(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
trigger: "blur" |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
trigger: 'blur', |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
@ -130,13 +144,23 @@ export default { |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
|
...mapGetters(['permission']), |
|
|
|
|
permissionList() { |
|
|
|
|
return { |
|
|
|
|
addBtn: this.validData(this.permission.localPlateParts_add, false), |
|
|
|
|
editBtn: this.validData(this.permission.localPlateParts_edit, false), |
|
|
|
|
delBtn: this.validData(this.permission.localPlateParts_del, false), |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
// 点击导入按钮 |
|
|
|
|
handleImport() { |
|
|
|
|
this.isShowImport = true |
|
|
|
|
this.isShowImport = true; |
|
|
|
|
}, |
|
|
|
|
refreshChange(){ |
|
|
|
|
this.onLoad() |
|
|
|
|
refreshChange() { |
|
|
|
|
this.onLoad(); |
|
|
|
|
}, |
|
|
|
|
// 搜索 |
|
|
|
|
searchChange(params, done) { |
|
|
|
|
@ -151,85 +175,96 @@ export default { |
|
|
|
|
this.page.currentPage = 1; |
|
|
|
|
this.onLoad(this.page); |
|
|
|
|
}, |
|
|
|
|
rowSave(row, done, loading){ |
|
|
|
|
rowSave(row, done, loading) { |
|
|
|
|
if (row.partCode) { |
|
|
|
|
row.partCode = row.partCode.trim(); |
|
|
|
|
} |
|
|
|
|
addPlatedPart(row).then(res =>{ |
|
|
|
|
if(res.data.code == 200){ |
|
|
|
|
this.$message.success('新增成功') |
|
|
|
|
this.onLoad() |
|
|
|
|
done() |
|
|
|
|
addPlatedPart(row).then(res => { |
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
this.$message.success('新增成功'); |
|
|
|
|
this.onLoad(); |
|
|
|
|
done(); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
rowUpdate(row, index, done, loading){ |
|
|
|
|
rowUpdate(row, index, done, loading) { |
|
|
|
|
if (row.partCode) { |
|
|
|
|
row.partCode = row.partCode.trim(); |
|
|
|
|
} |
|
|
|
|
updatePlatedPart(row).then(res =>{ |
|
|
|
|
if(res.data.code == 200){ |
|
|
|
|
this.$message.success('修改成功') |
|
|
|
|
this.onLoad() |
|
|
|
|
done() |
|
|
|
|
updatePlatedPart(row).then(res => { |
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
this.$message.success('修改成功'); |
|
|
|
|
this.onLoad(); |
|
|
|
|
done(); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
rowDel(row){ |
|
|
|
|
this.$confirm("确定将选择数据删除?", { |
|
|
|
|
confirmButtonText: "确定", |
|
|
|
|
cancelButtonText: "取消", |
|
|
|
|
type: "warning", |
|
|
|
|
rowDel(row) { |
|
|
|
|
this.$confirm('确定将选择数据删除?', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'warning', |
|
|
|
|
}).then(() => { |
|
|
|
|
deletePlatedPart({ids:row.id}).then(res => { |
|
|
|
|
if(res.data.code == 200){ |
|
|
|
|
this.$message.success('删除成功') |
|
|
|
|
this.onLoad() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
deletePlatedPart({ ids: row.id }).then(res => { |
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
this.$message.success('删除成功'); |
|
|
|
|
this.onLoad(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
closeDialog(val) { |
|
|
|
|
this.isShowImport = false |
|
|
|
|
if(val){ |
|
|
|
|
this.onLoad() |
|
|
|
|
this.isShowImport = false; |
|
|
|
|
if (val) { |
|
|
|
|
this.onLoad(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
handleDelete() { |
|
|
|
|
if (this.selectionList.length === 0) { |
|
|
|
|
this.$message.error("请至少选择一条数据"); |
|
|
|
|
this.$message.error('请至少选择一条数据'); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
this.$confirm("确定将选择数据删除?", { |
|
|
|
|
confirmButtonText: "确定", |
|
|
|
|
cancelButtonText: "取消", |
|
|
|
|
type: "warning", |
|
|
|
|
this.$confirm('确定将选择数据删除?', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'warning', |
|
|
|
|
}).then(() => { |
|
|
|
|
deletePlatedPart({ |
|
|
|
|
ids:this.selectionList.map(item => item.id).join(','), |
|
|
|
|
}).then(res =>{ |
|
|
|
|
if(res.data.code == 200){ |
|
|
|
|
this.$message.success("删除成功") |
|
|
|
|
this.onLoad() |
|
|
|
|
ids: this.selectionList.map(item => item.id).join(','), |
|
|
|
|
}).then(res => { |
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
this.$message.success('删除成功'); |
|
|
|
|
this.onLoad(); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// 多选 |
|
|
|
|
selectionChange(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); |
|
|
|
|
}, |
|
|
|
|
onLoad(page, params = {}) { |
|
|
|
|
this.loading = true; |
|
|
|
|
getList({ |
|
|
|
|
current:this.page.currentPage, |
|
|
|
|
size:this.page.pageSize, |
|
|
|
|
...this.query |
|
|
|
|
}).then(res =>{ |
|
|
|
|
this.data = res.data.data.records |
|
|
|
|
this.page.total = res.data.data.total |
|
|
|
|
this.loading = false |
|
|
|
|
}) |
|
|
|
|
current: this.page.currentPage, |
|
|
|
|
size: this.page.pageSize, |
|
|
|
|
...this.query, |
|
|
|
|
}).then(res => { |
|
|
|
|
this.data = res.data.data.records; |
|
|
|
|
this.page.total = res.data.data.total; |
|
|
|
|
this.loading = false; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
|