工序导入
This commit is contained in:
parent
3b055c6ff1
commit
25e1359d19
|
|
@ -156,7 +156,17 @@ export default {
|
||||||
};
|
};
|
||||||
for (let i = 0; i < this.options.exportColumns.length; i++) {
|
for (let i = 0; i < this.options.exportColumns.length; i++) {
|
||||||
let item = this.options.exportColumns[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);
|
jsonRows.push(jsonRow);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
|
<div class="page-body">
|
||||||
|
<div class="split_wrapper">
|
||||||
<div class="page-body">
|
|
||||||
<div class="split_wrapper">
|
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<div class="treepanel">
|
<div class="treepanel">
|
||||||
<div class="treepanel-header">
|
<div class="treepanel-header">
|
||||||
|
|
@ -23,7 +21,7 @@
|
||||||
</a-tree>
|
</a-tree>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
|
|
||||||
|
|
@ -31,9 +29,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
@ -65,12 +61,13 @@ export default {
|
||||||
sourceDetailsData: [
|
sourceDetailsData: [
|
||||||
|
|
||||||
],
|
],
|
||||||
|
typeData: [],
|
||||||
treeData: [],
|
treeData: [],
|
||||||
treeLoading: true,
|
treeLoading: true,
|
||||||
deletedDetailsData: [
|
deletedDetailsData: [
|
||||||
|
|
||||||
],
|
],
|
||||||
selectedKeys: [],
|
selectedKeys: [],
|
||||||
selectedKey: null,
|
selectedKey: null,
|
||||||
tableHeight: 500
|
tableHeight: 500
|
||||||
};
|
};
|
||||||
|
|
@ -87,38 +84,53 @@ export default {
|
||||||
// 创建完成
|
// 创建完成
|
||||||
created() {
|
created() {
|
||||||
this.optionsInit();
|
this.optionsInit();
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
|
||||||
this.tableHeight = this.$mk.getWindowSize().height - 260;
|
this.tableHeight = this.$mk.getWindowSize().height - 260;
|
||||||
this.treeInit();
|
this.treeInit();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
// 动作
|
// 动作
|
||||||
methods: {
|
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 }) {
|
pageImport({ data }) {
|
||||||
let rows = [];
|
let rows = [];
|
||||||
data.forEach(item => {
|
data.forEach(item => {
|
||||||
let row = {};
|
let row = {};
|
||||||
this.pageOptions.exportColumns.forEach(col => {
|
this.pageOptions.exportColumns.forEach(col => {
|
||||||
|
|
||||||
if (col.title in item) {
|
if (col.title in item) {
|
||||||
let v = item[col.title];
|
let v = item[col.title];
|
||||||
if(col.options){
|
if (col.options) {
|
||||||
col.options.forEach(op=>{
|
v = this.getOptionValue({ options: col.options, label: v });
|
||||||
if(op.label == v){
|
} else if (col.field == "sort_id") {
|
||||||
row[col.field] = op.value;
|
v = this.getTypeId(v);
|
||||||
}
|
|
||||||
})
|
|
||||||
}else{
|
|
||||||
row[col.field] = v;
|
|
||||||
}
|
}
|
||||||
|
console.log(col.options)
|
||||||
|
row[col.field] = v;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
rows.push(row);
|
rows.push(row);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$mk.post({
|
this.$mk.post({
|
||||||
|
|
@ -144,15 +156,16 @@ export default {
|
||||||
keyName: 'id', // 主键字段名
|
keyName: 'id', // 主键字段名
|
||||||
listFieldName: 'MesProcesses',
|
listFieldName: 'MesProcesses',
|
||||||
|
|
||||||
exportFileTitle :"工序",
|
exportFileTitle: "工序",
|
||||||
enabledExport: true,
|
enabledExport: true,
|
||||||
enabledImport: true,
|
enabledImport: true,
|
||||||
enabledImportTemplate: true,
|
enabledImportTemplate: true,
|
||||||
exportColumns: [
|
exportColumns: [
|
||||||
{ title: '编码',field:"code" },
|
{ title: '编码', field: "code" },
|
||||||
{ title: '工序名称',field:"name" },
|
{ title: '工序名称', field: "name" },
|
||||||
{ title: '工序描述',field:"desc" },
|
{ 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",
|
addPageUrl: "/MesProcesses/MesProcessesAdd",
|
||||||
editPageUrl: "/MesProcesses/MesProcessesUpdate/",
|
editPageUrl: "/MesProcesses/MesProcessesUpdate/",
|
||||||
|
|
@ -243,8 +256,8 @@ export default {
|
||||||
//{ field: 'process_segment_id', sortable: true, title: '工序段id', width: 250 }, // 工序段id
|
//{ field: 'process_segment_id', sortable: true, title: '工序段id', width: 250 }, // 工序段id
|
||||||
//{ field: 'title', sortable: true, title: '工序名称', width: 250 }, // 工序名称
|
//{ field: 'title', sortable: true, title: '工序名称', width: 250 }, // 工序名称
|
||||||
{ field: 'code', sortable: true, title: '工序编码', width: 250 }, // 工序编码
|
{ field: 'code', sortable: true, title: '工序编码', width: 250 }, // 工序编码
|
||||||
{ field: 'name', sortable: true, title: '工序名称', width: 250 },
|
{ field: 'name', sortable: true, title: '工序名称', width: 250 },
|
||||||
|
|
||||||
{ field: 'mes_processes_sort', formatter: 'formatRef', params: { dataType: "object", textField: "name" }, title: '工序分类', width: 250 },
|
{ field: 'mes_processes_sort', formatter: 'formatRef', params: { dataType: "object", textField: "name" }, title: '工序分类', width: 250 },
|
||||||
|
|
||||||
{ field: 'desc', sortable: true, title: '工序描述', width: 250 }, // 工序描述
|
{ field: 'desc', sortable: true, title: '工序描述', width: 250 }, // 工序描述
|
||||||
|
|
@ -297,6 +310,7 @@ export default {
|
||||||
title: "工序分类",
|
title: "工序分类",
|
||||||
key: "root"
|
key: "root"
|
||||||
};
|
};
|
||||||
|
this.typeData = r.data.MesProcessesSort;
|
||||||
let at = toArrayTree(r.data.MesProcessesSort, { parentKey: "parent_id" });
|
let at = toArrayTree(r.data.MesProcessesSort, { parentKey: "parent_id" });
|
||||||
console.log(at);
|
console.log(at);
|
||||||
treedata[childrenFieldName] = at;
|
treedata[childrenFieldName] = at;
|
||||||
|
|
@ -414,7 +428,7 @@ export default {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return find(this.treeData);
|
return find(this.treeData);
|
||||||
},
|
},
|
||||||
reloadData() {
|
reloadData() {
|
||||||
if (this.selectedKey) {
|
if (this.selectedKey) {
|
||||||
this.loadData(this.selectedKey);
|
this.loadData(this.selectedKey);
|
||||||
|
|
@ -441,7 +455,7 @@ export default {
|
||||||
|
|
||||||
if (key && key != "root") {
|
if (key && key != "root") {
|
||||||
var node = this.findTreeNode(key);
|
var node = this.findTreeNode(key);
|
||||||
if (node.children && node.children.length) {
|
if (node.children && node.children.length) {
|
||||||
var ids = this.getAllChildrenIds(node.children);
|
var ids = this.getAllChildrenIds(node.children);
|
||||||
this.$refs.listPage.onSearch({
|
this.$refs.listPage.onSearch({
|
||||||
sort_id: [node.id, ...ids].join(',')
|
sort_id: [node.id, ...ids].join(',')
|
||||||
|
|
@ -453,7 +467,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
this.$refs.listPage.onSearch(null);
|
this.$refs.listPage.onSearch(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -568,7 +582,7 @@ export default {
|
||||||
background: white;
|
background: white;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toolbarbtns .ant-btn {
|
.toolbarbtns .ant-btn {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue