基础数据缺陷修复

dev-scheduling
jinna 13 hours 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="danger" @click="handleDelete">删除</el-button>
</template>
<template #menu-right>
<el-button type="primary" @click="handleImport">导入</el-button>
</template>
<template #menu="scope">
<el-button type="text" @click="editRow(scope.row)">编辑</el-button>
<el-button type="text" @click="rowDel(scope.row)">删除</el-button>
</template>
</avue-crud>
<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>
</template>
<script>
import addRuleDialog from './components/addRuleDialog.vue'
import basicImport from '@/components/basic-import/main.vue'
import {getList,deleteRules} from "@/api/basicData/ruleMaintenance"
export default {
components: { addRuleDialog },
components: { addRuleDialog,basicImport },
data() {
return {
moldAddMore:false,
loading: false,
showDialog:false,
isShowImport:false,
page: {
total: 0,
currentPage: 1,
@ -264,6 +276,9 @@ export default {
mounted() {
},
methods:{
handleImport(){
this.isShowImport = true
},
handleAdd(){
this.checkRow = {}
this.moldAddMore = true
@ -311,6 +326,7 @@ export default {
},
closeDialog(val){
this.showDialog = false
this.isShowImport = false
if(val){
this.onLoad()
}

@ -27,7 +27,7 @@
</template>
<template #platingId="scope">
<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>
</template>
<template #dsPart="scope">
@ -248,7 +248,7 @@ export default {
},
mounted() {
this.getSupplierData()
this.getAbility()
// this.getAbility()
// this.getPartData()
},
methods: {
@ -366,20 +366,77 @@ export default {
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;
getList({
current:this.page.currentPage,
size:this.page.pageSize,
...this.query
}).then(res =>{
res.data.data.records.map(item =>{
item.platingId = item.platingId + ''
})
this.data = res.data.data.records
this.page.total = res.data.data.total
this.loading = false
})
try {
const res = await getList({
current: this.page.currentPage,
size: this.page.pageSize,
...this.query
});
const records = res.data.data.records;
// 1. platingId select value
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