基础数据-物料定额表-导入优化

dev-scheduling
ysn 6 hours ago
parent 261496ea53
commit 7fa6ea4d28
  1. 293
      src/views/basicData/materialQuota/components/silverAnode.vue

@ -7,8 +7,8 @@
v-model="form"
v-model:page="page"
ref="crud"
:before-open="beforeOpen"
@row-del="rowDel"
:before-open="beforeOpen"
@row-save="rowSave"
@row-update="rowUpdate"
@search-change="searchChange"
@ -21,19 +21,15 @@
>
<template #menu-left>
<!-- <el-button type="primary" icon="el-icon-plus" @click="addEdit">新增 </el-button> -->
<el-button type="danger" icon="el-icon-delete" @click="handleDelete"
>删除
</el-button>
<el-button type="danger" icon="el-icon-delete" @click="handleDelete">删除 </el-button>
</template>
<template #menu-right>
<el-button type="primary" icon="el-icon-upload" @click="handleImport">导入 </el-button>
</template>
<template #menu="scope">
<!-- <el-button type="text" @click="editFn(scope.row)">编辑 </el-button>
<el-button type="text" @click="handleDelete">删除 </el-button> -->
<!-- <el-button type="text" @click="editFn(scope.row)">编辑 </el-button> -->
<!-- <el-button type="text" @click="handleDelete">删除 </el-button> -->
</template>
<template #produceTsTarget="scope"> </template>
<template #quota-form="{ type, disabled }">
<el-input v-model="form.quota" placeholder="请输入 滚振镀银类定额" @input="validateQuota"></el-input>
</template>
@ -41,30 +37,33 @@
<el-input v-model="form.smallBatQuota" placeholder="请输入 滚振镀银类定额" @input="validateSmallBat"></el-input>
</template>
</avue-crud>
<!-- 导入 -->
<basic-import v-if="isShowImport" title="导入" :isShow="isShowImport"
templateUrl="/blade-desk/QA/CycleTestItem/download-excel-template"
templateName="试验项目模板.xls"
importUrl="/blade-desk/QA/CycleTestItem/import-excel"
@closeDialog="closeDialog"></basic-import>
<basic-import
v-if="isShowImport"
title="导入"
:isShow="isShowImport"
templateUrl="/blade-desk/BA/MaterialQuota/downloadExcelTemplate"
templateName="银钾定额模板.xls"
importUrl="/blade-desk/BA/MaterialQuota/importExcel"
@closeDialog="closeDialog"
/>
</div>
</template>
<script>
import basicImport from '@/components/basic-import/main.vue'
import {getList,addQuota,updateQuota,deleteQuota} from '@/api/basicData/materialQuota'
import basicImport from '@/components/basic-import/main.vue';
import { getList, addQuota, updateQuota, deleteQuota } from '@/api/basicData/materialQuota';
export default {
components: {
basicImport,
},
data() {
return {
isShowImport:false,
isShowImport: false,
selectionList: [],
loading:false,
query:{},
loading: {},
query: {},
option: {
height: "auto",
height: 'auto',
calcHeight: 32,
tip: false,
// size: "medium",
@ -81,11 +80,11 @@ export default {
delBtn: true,
addBtn: true,
editBtn: true,
editBtnText: "修改",
viewBtnIcon: " ",
delBtnIcon: " ",
editBtnIcon: " ",
viewBtnText: "详情",
editBtnText: '修改',
viewBtnIcon: ' ',
delBtnIcon: ' ',
editBtnIcon: ' ',
viewBtnText: '详情',
labelWidth: 120,
menuWidth: 120,
dialogWidth: 640,
@ -98,53 +97,60 @@ export default {
excelBtn: true,
columnSort: true,
showOverflowTooltip: true,
searchLabelPosition: "left",
searchLabelPosition: "left",
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: "thickness",
label: '镀层厚度',
prop: 'thickness',
sortable: true,
filter: true,
span: 24,
search: false,
rule: [
{
required: true,
message: '请输入镀层厚度',
trigger: 'blur',
},
],
},
// {
// label: "",
// prop: "processAbilityId",
// type:'select',
// type:"select",
// sortable: true,
// filter: true,
// span: 24,
// search: false,
// dicUrl:"/api/blade-desk/BA/craftAbility/findList",
// props:{
// label:'caName',
// label:"caName",
// value:"id"
// }
// },
{
label: "滚振镀银类定额",
prop: "quota",
label: '滚振镀银类定额',
prop: 'quota',
sortable: true,
filter: true,
span: 24,
search: false,
},
{
label: "挂镀银类定额",
prop: "smallBatQuota",
label: '挂镀银类定额',
prop: 'smallBatQuota',
sortable: true,
filter: true,
span: 24,
@ -171,7 +177,11 @@ export default {
};
},
methods: {
validateValue(value){
//
handleImport() {
this.isShowImport = true;
},
validateValue(value) {
if (value == null) return '';
// 1
@ -203,15 +213,11 @@ export default {
}
return filterVal;
},
validateQuota(value){
this.form.quota = this.validateValue(value)
validateQuota(value) {
this.form.quota = this.validateValue(value);
},
validateSmallBat(value){
this.form.smallBatQuota = this.validateValue(value)
},
//
handleImport() {
this.isShowImport = true
validateSmallBat(value) {
this.form.smallBatQuota = this.validateValue(value);
},
addEdit() {
this.isOpen = true;
@ -219,9 +225,13 @@ export default {
editFn(row) {
this.isWorkOpen = true;
},
closeDialog() {
closeDialog(val) {
this.isOpen = false;
this.isWorkOpen = false;
this.isShowImport = false;
if (val) {
this.onLoad();
}
},
maintenanceClick() {
// this.$refs.myTable.fullValidate((errMap) => {
@ -263,159 +273,84 @@ export default {
this.$message.error('请选择至少一条数据');
return;
}
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
deleteQuota({
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();
}
})
});
});
},
refreshChange() {
this.onLoad();
},
//
selectionChange(list) {
this.selectionList = list;
},
beforeOpen(done, type){
if(type == 'edit'){
this.form.processAbilityId = this.form.processAbilityId + ''
setTimeout(() =>{
done()
},200)
}else{
done()
beforeOpen(done, type) {
if (type == 'edit') {
this.form.processAbilityId = this.form.processAbilityId + '';
done();
} else {
done();
}
},
rowSave(row, done, loading){
row.quotaType = 2
addQuota(row).then(res =>{
if(res.data.code == 200){
this.$message.success('新增成功')
this.onLoad()
done()
rowSave(row, done, loading) {
row.quotaType = 2;
addQuota(row).then(res => {
if (res.data.code == 200) {
this.$message.success('新增成功');
this.onLoad();
done();
}
})
});
},
rowUpdate(row, index, done, loading){
row.quotaType = 2
updateQuota(row).then(res =>{
if(res.data.code == 200){
this.$message.success('修改成功')
this.onLoad()
done()
rowUpdate(row, index, done, loading) {
row.quotaType = 2;
updateQuota(row).then(res => {
if (res.data.code == 200) {
this.$message.success('修改成功');
this.onLoad();
done();
}
})
});
},
rowDel(row){
rowDel(row) {
this.$confirm('确定删除数据吗?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
deleteQuota({
ids:row.id
}).then(res =>{
if(res.data.code == 200){
this.$message.success('删除成功')
this.onLoad()
ids: row.id,
}).then(res => {
if (res.data.code == 200) {
this.$message.success('删除成功');
this.onLoad();
}
})
})
});
});
},
onLoad() {
this.loading = true;
getList({
current:this.page.currentPage,
size:this.page.pageSize,
quotaType:2,
...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);
current: this.page.currentPage,
size: this.page.pageSize,
quotaType: 2,
...this.query,
}).then(res => {
this.data = res.data.data.records;
this.page.total = res.data.data.total;
this.loading = false;
});
},
},
};

Loading…
Cancel
Save