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

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

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

Loading…
Cancel
Save