工序导入

This commit is contained in:
xielue 2023-06-05 11:56:45 +08:00
parent 3b055c6ff1
commit 25e1359d19
2 changed files with 59 additions and 35 deletions

View File

@ -156,7 +156,17 @@ export default {
};
for (let i = 0; i < this.options.exportColumns.length; i++) {
let item = this.options.exportColumns[i];
jsonRow[item.title] = row[item.field] || '';
var v = "";
if(item.dataField){
v = row[item.dataField];
if(item.textField && v){
v = v[item.textField]
}
}else{
v = row[item.field] || '';
}
jsonRow[item.title] = v;
}
jsonRows.push(jsonRow);
});

View File

@ -1,6 +1,4 @@
<template>
<div class="page-body">
<div class="split_wrapper">
<div class="left">
@ -32,8 +30,6 @@
</div>
</div>
</div>
</template>
<script>
@ -65,6 +61,7 @@ export default {
sourceDetailsData: [
],
typeData: [],
treeData: [],
treeLoading: true,
deletedDetailsData: [
@ -99,6 +96,23 @@ export default {
//
methods: {
getTypeId(name) {
for (let i = 0; i < this.typeData.length; i++) {
if (this.typeData[i].name == name) {
return this.typeData[i].id;
}
}
return 0;
},
getOptionValue({ label, options }) {
for (let i = 0; i < options.length; i++) {
if (options[i].label == label) {
return options[i].value;
}
}
return '';
},
pageImport({ data }) {
let rows = [];
data.forEach(item => {
@ -108,15 +122,13 @@ export default {
if (col.title in item) {
let v = item[col.title];
if (col.options) {
col.options.forEach(op=>{
if(op.label == v){
row[col.field] = op.value;
v = this.getOptionValue({ options: col.options, label: v });
} else if (col.field == "sort_id") {
v = this.getTypeId(v);
}
})
}else{
console.log(col.options)
row[col.field] = v;
}
}
})
rows.push(row);
});
@ -152,7 +164,8 @@ export default {
{ title: '编码', field: "code" },
{ title: '工序名称', field: "name" },
{ title: '工序描述', field: "desc" },
{ title: '计工方式',field:"work_type",options:settings.options_work_type }
{ title: '计工方式', field: "work_type", options: settings.options_work_type },
{ title: '工序分类', field: "sort_id", dataField: 'mes_processes_sort', textField: "name" }
],
addPageUrl: "/MesProcesses/MesProcessesAdd",
editPageUrl: "/MesProcesses/MesProcessesUpdate/",
@ -297,6 +310,7 @@ export default {
title: "工序分类",
key: "root"
};
this.typeData = r.data.MesProcessesSort;
let at = toArrayTree(r.data.MesProcessesSort, { parentKey: "parent_id" });
console.log(at);
treedata[childrenFieldName] = at;