基础数据缺陷修复

dev-scheduling
jinna 1 day ago
parent 71956a4937
commit d3a14c668c
  1. 18
      src/views/basicData/ruleMaintenance.vue
  2. 87
      src/views/oem/outsourcingAssignmentControl/index.vue

@ -25,25 +25,37 @@
<el-button type="primary" @click="handleAdd">新增</el-button> <el-button type="primary" @click="handleAdd">新增</el-button>
<el-button type="danger" @click="handleDelete">删除</el-button> <el-button type="danger" @click="handleDelete">删除</el-button>
</template> </template>
<template #menu-right>
<el-button type="primary" @click="handleImport">导入</el-button>
</template>
<template #menu="scope"> <template #menu="scope">
<el-button type="text" @click="editRow(scope.row)">编辑</el-button> <el-button type="text" @click="editRow(scope.row)">编辑</el-button>
<el-button type="text" @click="rowDel(scope.row)">删除</el-button> <el-button type="text" @click="rowDel(scope.row)">删除</el-button>
</template> </template>
</avue-crud> </avue-crud>
<add-rule-dialog v-if="showDialog" :isOpen="showDialog" :row="checkRow" :moldAddMore="moldAddMore" @closeDialog="closeDialog"></add-rule-dialog> <add-rule-dialog v-if="showDialog" :isOpen="showDialog" :row="checkRow" :moldAddMore="moldAddMore" @closeDialog="closeDialog"></add-rule-dialog>
<!-- 导入 -->
<basic-import v-if="isShowImport" title="导入" :isShow="isShowImport"
templateUrl="/blade-desk/bsAssign/downloadExcelTemplate"
templateName="分派规则模板.xls"
importUrl="/blade-desk/bsAssign/importExcel"
@closeDialog="closeDialog"
></basic-import>
</basic-container> </basic-container>
</template> </template>
<script> <script>
import addRuleDialog from './components/addRuleDialog.vue' import addRuleDialog from './components/addRuleDialog.vue'
import basicImport from '@/components/basic-import/main.vue'
import {getList,deleteRules} from "@/api/basicData/ruleMaintenance" import {getList,deleteRules} from "@/api/basicData/ruleMaintenance"
export default { export default {
components: { addRuleDialog }, components: { addRuleDialog,basicImport },
data() { data() {
return { return {
moldAddMore:false, moldAddMore:false,
loading: false, loading: false,
showDialog:false, showDialog:false,
isShowImport:false,
page: { page: {
total: 0, total: 0,
currentPage: 1, currentPage: 1,
@ -264,6 +276,9 @@ export default {
mounted() { mounted() {
}, },
methods:{ methods:{
handleImport(){
this.isShowImport = true
},
handleAdd(){ handleAdd(){
this.checkRow = {} this.checkRow = {}
this.moldAddMore = true this.moldAddMore = true
@ -311,6 +326,7 @@ export default {
}, },
closeDialog(val){ closeDialog(val){
this.showDialog = false this.showDialog = false
this.isShowImport = false
if(val){ if(val){
this.onLoad() this.onLoad()
} }

@ -27,7 +27,7 @@
</template> </template>
<template #platingId="scope"> <template #platingId="scope">
<el-select v-model="scope.row.platingId" filterable> <el-select v-model="scope.row.platingId" filterable>
<el-option v-for="item in abilityData" :key="item.id" :label="item.caName" :value="item.id"></el-option> <el-option v-for="item in scope.row.abilityData" :key="item.id" :label="item.caName" :value="item.id"></el-option>
</el-select> </el-select>
</template> </template>
<template #dsPart="scope"> <template #dsPart="scope">
@ -248,7 +248,7 @@ export default {
}, },
mounted() { mounted() {
this.getSupplierData() this.getSupplierData()
this.getAbility() // this.getAbility()
// this.getPartData() // this.getPartData()
}, },
methods: { methods: {
@ -366,20 +366,77 @@ export default {
this.partData = res.data.data this.partData = res.data.data
}) })
}, },
onLoad() { // onLoad() {
// this.loading = true;
// getList({
// current:this.page.currentPage,
// size:this.page.pageSize,
// ...this.query
// }).then(res =>{
// res.data.data.records.map(item =>{
// item.platingId = item.platingId + ''
// })
// res.data.data.records.map(item =>{
// getProcessAbility({
// supplierId:item.oemId
// }).then(res =>{
// item.abilityData = res.data.data
// })
// })
// this.data = res.data.data.records
// this.page.total = res.data.data.total
// this.loading = false
// })
// },
async onLoad() {
this.loading = true; this.loading = true;
getList({ try {
current:this.page.currentPage, const res = await getList({
size:this.page.pageSize, current: this.page.currentPage,
...this.query size: this.page.pageSize,
}).then(res =>{ ...this.query
res.data.data.records.map(item =>{ });
item.platingId = item.platingId + ''
}) const records = res.data.data.records;
this.data = res.data.data.records
this.page.total = res.data.data.total // 1. platingId select value
this.loading = false records.forEach(item => {
}) item.platingId = item.platingId ? String(item.platingId) : '';
});
// 2.
// 使 Promise.all
const abilityPromises = records.map(async (item) => {
if (item.oemId) {
try {
const abilityRes = await getProcessAbility({
supplierId: item.oemId
});
item.abilityData = abilityRes.data.data || []
// item
// this.$set(item, 'abilityData', abilityRes.data.data || []);
} catch (e) {
console.error('获取工艺能力失败', e);
// this.$set(item, 'abilityData', []);
item.abilityData = []
}
} else {
// this.$set(item, 'abilityData', []);
item.abilityData = []
}
});
await Promise.all(abilityPromises);
// 3. data
this.data = records;
this.page.total = res.data.data.total;
} catch (error) {
console.error(error);
this.$message.error('加载数据失败');
} finally {
this.loading = false;
}
}, },
}, },
}; };

Loading…
Cancel
Save