Commit 7e16e1e1 authored by renjintao's avatar renjintao

product process

parent 8428bc03
<template>
<Modal v-model="ImportModal" :title="modalTitles" fullscreen footer-hide @on-cancel="cancelModal">
<Modal v-model="ImportModal" :title="modalTitles" fullscreen footer-hide @on-cancel="cancelModal">
<div class="table-content">
<div class="table-tools">
<div class="table-search">
<Form inline>
<FormItem>
<div style="height:34px;overflow: hidden;padding:0;width:120px">
<Upload action :before-upload="beforeUpload" ref="uploadfile" :format="formatList">
<Button icon="ios-cloud-upload-outline">上传文件</Button>
</Upload>
</div>
</FormItem>
<FormItem>
<Button type="primary" @click="openInfoModal" :disabled="btnIm">导入</Button>
</FormItem>
</Form>
<div class="table-tools">
<div class="table-search">
<Form inline>
<FormItem>
<div style="height:34px;overflow: hidden;padding:0;width:120px">
<Upload action :before-upload="beforeUpload" ref="uploadfile" :format="formatList">
<Button icon="ios-cloud-upload-outline">上传文件</Button>
</Upload>
</div>
</FormItem>
<FormItem>
<Button type="primary" @click="openInfoModal" :disabled="btnIm">导入</Button>
</FormItem>
</Form>
</div>
<div class="btns">
<Form inline>
<FormItem>
<RadioGroup v-model="excelType" type="button" @on-change="changeExcel" size="small">
<Tooltip content="文件数据">
<Radio label="0">
<Icon type="ios-list-box-outline" />
</Radio>
</Tooltip>
<Tooltip content="粘贴Excel数据">
<Radio label="1">
<Icon type="ios-copy" />
</Radio>
</Tooltip>
</RadioGroup>
</FormItem>
</Form>
</div>
</div>
<div class="btns">
<Form inline>
<FormItem>
<RadioGroup v-model="excelType" type="button" @on-change="changeExcel" size="small">
<Tooltip content="文件数据">
<Radio label="0">
<Icon type="ios-list-box-outline" />
</Radio>
</Tooltip>
<Tooltip content="粘贴Excel数据">
<Radio label="1">
<Icon type="ios-copy" />
</Radio>
</Tooltip>
</RadioGroup>
</FormItem>
</Form>
<div class="table-main" ref="main">
<Table :border="true" :columns="columnsImport" :data="excelData" :height="tdHeightExcel" :no-data-text="noDataText" ref="table" class="tableCommon" v-if="tableImport"></Table>
<component :is="detailExcel" ref="comExcel" @on-datalength="datalength" />
</div>
</div>
<div class="table-main" ref="main">
<Table
:border="true"
:columns="columnsImport"
:data="excelData"
:height="tdHeightExcel"
:no-data-text="noDataText"
ref="table"
class="tableCommon"
v-if="tableImport"
></Table>
<component :is="detailExcel" ref="comExcel" @on-datalength="datalength" />
</div>
<FooterToolbar v-if="sheetNames.length>1&&tableImport">
<Form inline>
<FormItem>
<Tabs :animated="false" :value="0" @on-click="sheetClick">
<TabPane :label="item" v-for="(item,index) in sheetNames" :key="index"></TabPane>
</Tabs>
</FormItem>
</Form>
</FooterToolbar>
<Modal v-model="infoModal" :title="modalTitles" fullscreen>
<DataGrid
:tool="false"
:page="false"
:columns="colsIm"
:data="dataIm"
:height="tdHeightExcel+30"
ref="dataImport"
></DataGrid>
<div slot="footer">
<Button @click="infoModal=false">关闭</Button>
<Button type="primary" @click="importOk" v-show="imBtn">确定导入</Button>
</div>
</Modal>
<FooterToolbar v-if="sheetNames.length>1&&tableImport">
<Form inline>
<FormItem>
<Tabs :animated="false" :value="0" @on-click="sheetClick">
<TabPane :label="item" v-for="(item,index) in sheetNames" :key="index"></TabPane>
</Tabs>
</FormItem>
</Form>
</FooterToolbar>
<Modal v-model="infoModal" :title="modalTitles" fullscreen>
<DataGrid :tool="false" :page="false" :columns="colsIm" :data="dataIm" :height="tdHeightExcel+30" ref="dataImport"></DataGrid>
<div slot="footer">
<Button @click="infoModal=false">关闭</Button>
<Button type="primary" @click="importOk" v-show="imBtn">确定导入</Button>
</div>
</Modal>
</div>
</Modal>
</Modal>
</template>
<script>
import XLSX from "xlsx";
import { Switch } from "view-design";
import {
Switch
} from "view-design";
export default {
name: "Edit",
data() {
return {
tabVal: 0,
infoModal: false,
entity: {},
downUrl: fileUrlDown,
fileUrlPath: "",
disabled: false,
detailExcel: null,
tableImport: true,
tdHeightExcel: "",
excelData: [],
excelDataBack: [], //临时存储原始数据
formatList: ["xlsx"],
columnsImport: [],
departArr: [], //部门list
sheetNames: [], //excel的表明
workBook: {},
openDatas: [],
dataType: 0,
//new
colsIm: [],
dataIm: [],
excelType: "0",
btnIm: true,
titleInfo: "",
noDataText: "暂无数据",
imBtn: true,
columnsIm: this.columns,
ImportModal: this.open,
batchImportUrl: "",
modalTitles: "导入",
};
},
props: {
eid: Number,
data: {
// 当作table使用,直接显示数据
type: Array,
default: function () {
return [];
},
name: "Edit",
data() {
return {
tabVal: 0,
infoModal: false,
entity: {},
downUrl: fileUrlDown,
fileUrlPath: "",
disabled: false,
detailExcel: null,
tableImport: true,
tdHeightExcel: "",
excelData: [],
excelDataBack: [], //临时存储原始数据
formatList: ["xlsx"],
columnsImport: [],
departArr: [], //部门list
sheetNames: [], //excel的表明
workBook: {},
openDatas: [],
dataType: 0,
//new
colsIm: [],
dataIm: [],
excelType: "0",
btnIm: true,
titleInfo: "",
noDataText: "暂无数据",
imBtn: true,
columnsIm: this.columns,
ImportModal: this.open,
batchImportUrl: "",
modalTitles: "导入",
};
},
columns: {
//要显示的字段
type: Array,
default: [],
props: {
eid: Number,
data: {
// 当作table使用,直接显示数据
type: Array,
default: function () {
return [];
},
},
columns: {
//要显示的字段
type: Array,
default: [],
},
open: {
type: Boolean,
default: false,
},
modalTitle: {
type: String,
default: "",
},
},
open: {
type: Boolean,
default: false,
created() {
this.tdHeightExcel = window.innerHeight - 180;
//导出对列表头进行预加载start
this.$api.get(`${systemUrl}/Department/GetDepartments`).then((r) => {
this.departArr = r.result.items;
});
//导出对列表头进行预加载end
},
modalTitle: {
type: String,
default: "",
mounted() {
//if (this.eid > 0) {
// this.load(this.eid);
//}
this.modalTitles = "导入到【" + this.modalTitle + "】";
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.tdHeightExcel = window.screenHeight - 180;
})();
};
},
},
created() {
this.tdHeightExcel = window.innerHeight - 180;
//导出对列表头进行预加载start
this.$api.get(`${systemUrl}/Department/GetDepartments`).then((r) => {
this.departArr = r.result.items;
});
methods: {
//重新处理colum
loadColum(columns) {
let tempCol = this.$u.clone(columns);
tempCol.forEach((ele, index) => {
if (
ele.key == "action" ||
ele.type == "selection" ||
ele.key == "ico"
) {
ele.hide = true;
}
});
this.colsIm = tempCol;
this.colsIm.unshift({
type: "index",
width: 80,
align: "right",
title: "序号",
}, {
key: "ico",
title: " ",
align: "center",
width: 60,
render: (h, params) => {
return h(
"div", {
class: "",
},
[
h(params.row.ico ? "op" : "", {
attrs: {
icon: "ios-alert",
type: "icon",
title: "数据不合法",
color: "#ff9900",
},
}),
]
);
},
});
//处理原始数据和表头进行对应
let temCol = this.$u.clone(this.colsIm); //原始数据表头
let temColPage = this.$u.clone(columns); //需要显示的页面的表头
//let temData = this.$u.clone(this.excelDataBack); //原始数据
let temData = []; //原始数据
if (this.excelType == "0") {
temData = this.$u.clone(this.excelDataBack);
} else {
temData = this.$u.clone(this.$refs.comExcel.excelData);
}
let arrTitleUse = []; ////使用数据字典的字段
temColPage.forEach((elCode) => {
if (elCode.code) {
arrTitleUse.push({
key: elCode.key,
code: elCode.code,
});
}
});
let useData = []; //重新组织list列表数据
temData.forEach((elData, index) => {
let objTm = {};
temCol.forEach((elTitle) => {
objTm[elTitle.key] = elData[elTitle.title];
});
useData.push(objTm);
});
//导出对列表头进行预加载end
},
mounted() {
//if (this.eid > 0) {
// this.load(this.eid);
//}
this.modalTitles = "导入到【" + this.modalTitle + "】";
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.tdHeightExcel = window.screenHeight - 180;
})();
};
},
methods: {
//重新处理colum
loadColum(columns) {
let tempCol = this.$u.clone(columns);
tempCol.forEach((ele, index) => {
if (
ele.key == "action" ||
ele.type == "selection" ||
ele.key == "ico"
) {
ele.hide = true;
}
});
this.colsIm = tempCol;
this.colsIm.unshift(
{
type: "index",
width: 80,
align: "right",
title: "序号",
//对列表里的部门及数据字典项进行处理
useData.forEach((eles) => {
//如果导入文件没有departmentid,但存在departmentTitle的话,通过title获取id
if (
[
(eles.departmentTitle && eles.departmentTitle != "") ||
(eles.departmentName && eles.departmentName != ""),
] &&
(!eles.departmentId || eles.departmentId == "")
) {
this.departArr.forEach((e) => {
if (
(eles.departmentTitle && eles.departmentTitle == e.name) ||
(eles.departmentName && eles.departmentName == e.name)
) {
eles.departmentId = e.id;
}
});
} else if (
//如果导入文件没有departmentTitle,但存在departmentid的话,通过id获取departmentTitle
eles.departmentId &&
eles.departmentId + "" != "" &&
(!eles.departmentTitle || eles.departmentTitle == "") &&
(!eles.departmentName || eles.departmentName == "")
) {
this.departArr.forEach((e) => {
if (eles.departmentId && eles.departmentId == e.id) {
eles.departmentTitle = e.name;
eles.departmentName = e.name;
}
});
}
arrTitleUse.forEach((elem) => {
if (
eles[elem.key] &&
eles[elem.key] != "" &&
eles[elem.key] != null
) {
//如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值
let codeArr = []
let keyValue = eles[elem.key]
if (keyValue.length > 0 && (keyValue.indexOf(',') > -1 || keyValue.indexOf(',') > -1)) { //如果对应的数据包含多个数据字典项,比如包含“,”或“,”
if (keyValue.indexOf(',') > -1) {
codeArr = keyValue.split(',')
}
if (keyValue.indexOf > -1) {
codeArr = keyValue.split(',')
}
}
if (codeArr.length <= 1) { //对应的数据包含一个数据字典项
eles[elem.key] = this.$u.dirCode(
this.$store.getters.dictionaryByKey(elem.code),
eles[elem.key]
);
} else { //对应的数据包含多个数据字典项
let codeInfo = ''
codeArr.forEach(el => {
codeInfo = codeInfo + this.$u.dirCode(this.$store.getters.dictionaryByKey(elem.code), el) + ",";
})
eles[elem.key] = codeInfo.substr(0, codeInfo.length - 1)
}
}
});
});
this.dataIm = useData;
let tempData = this.$u.clone(this.dataIm);
this.$emit("on-get-data", tempData);
},
{
key: "ico",
title: " ",
align: "center",
width: 60,
render: (h, params) => {
return h(
"div",
{
class: "",
},
[
h(params.row.ico ? "op" : "", {
attrs: {
icon: "ios-alert",
type: "icon",
title: "数据不合法",
color: "#ff9900",
},
}),
]
//导入excel文件
async beforeUpload(file) {
//初始化
this.sheetNames = [];
this.workBook = {};
this.$refs.uploadfile.clearFiles(); //清除上一次上传文件列表
//上传成功后的读取到excel信息
this.workBook = await this.$u.readXLSX(file);
this.sheetNames = this.workBook.SheetNames; //execel里的表明
this.btnIm = false;
this.dealSheet(0); //默认显示第一个表
return false;
},
//对上传的excel表信息进行处理,不对表头进行处理
dealSheet(index) {
this.dataType = 1;
this.columnsImport = [];
this.excelData = [];
this.excelDataBack = [];
const sheet2JSONOpts = {
defval: "", //给defval赋值为空的字符串
};
var csv = XLSX.utils.sheet_to_csv(
this.workBook.Sheets[this.workBook.SheetNames[index]],
sheet2JSONOpts
);
},
}
);
//处理原始数据和表头进行对应
let temCol = this.$u.clone(this.colsIm); //原始数据表头
let temColPage = this.$u.clone(columns); //需要显示的页面的表头
//let temData = this.$u.clone(this.excelDataBack); //原始数据
let temData = []; //原始数据
if (this.excelType == "0") {
temData = this.$u.clone(this.excelDataBack);
} else {
temData = this.$u.clone(this.$refs.comExcel.excelData);
}
let arrTitleUse = []; ////使用数据字典的字段
temColPage.forEach((elCode) => {
if (elCode.code) {
arrTitleUse.push({
key: elCode.key,
code: elCode.code,
});
}
});
let useData = []; //重新组织list列表数据
temData.forEach((elData, index) => {
let objTm = {};
temCol.forEach((elTitle) => {
objTm[elTitle.key] = elData[elTitle.title];
});
useData.push(objTm);
});
//对列表里的部门及数据字典项进行处理
useData.forEach((eles) => {
//如果导入文件没有departmentid,但存在departmentTitle的话,通过title获取id
if (
[
(eles.departmentTitle && eles.departmentTitle != "") ||
(eles.departmentName && eles.departmentName != ""),
] &&
(!eles.departmentId || eles.departmentId == "")
) {
this.departArr.forEach((e) => {
var lines = csv.split("\n"); //第一行标题
var headers = lines[0].split(",");
var headersNow = [];
headersNow.push({
type: "index",
width: 80,
align: "right",
title: "序号",
});
headers.forEach((elHead) => {
let headObj = {};
headObj.title = elHead;
headObj.key = elHead;
headersNow.push(headObj);
});
this.columnsImport = headersNow;
var result = [];
for (var i = 1; i < lines.length - 1; i++) {
var obj = {};
var currentline = lines[i].split(",");
for (var j = 0; j < headers.length; j++) {
obj[headers[j]] = currentline[j];
}
result.push(obj);
}
this.excelData = result;
this.excelDataBack = result;
this.changeExcel(0);
},
//切换sheet表重新加载
sheetClick(val) {
this.tabVal = val;
this.dealSheet(val);
},
handleClose() {
this.$emit("on-close");
},
cancelExcel() {
this.excelData = [];
this.excelDataBack = [];
this.$refs.uploadfile.clearFiles();
let parms = {
status: 1,
id: this.eid,
};
//导入中心列表数据状态更新
this.$emit("on-close");
},
//打开导入数据格式化后的窗口
openInfoModal() {
if (
(eles.departmentTitle && eles.departmentTitle == e.name) ||
(eles.departmentName && eles.departmentName == e.name)
(this.excelType == "0" && this.excelData.length > 0) ||
(this.excelType == "1" && this.$refs.comExcel.excelData.length > 0)
) {
eles.departmentId = e.id;
this.imBtn = true;
this.loadColum(this.columnsIm);
this.titleInfo = "批量导入";
this.infoModal = true;
} else {
this.imBtn = false;
this.$Message.error("没有可导入的数据!");
}
});
} else if (
//如果导入文件没有departmentTitle,但存在departmentid的话,通过id获取departmentTitle
eles.departmentId &&
eles.departmentId + "" != "" &&
(!eles.departmentTitle || eles.departmentTitle == "") &&
(!eles.departmentName || eles.departmentName == "")
) {
this.departArr.forEach((e) => {
if (eles.departmentId && eles.departmentId == e.id) {
eles.departmentTitle = e.name;
eles.departmentName = e.name;
},
//确定导入按钮操作
importOk() {
let imData = [];
let imDataError = [];
this.dataIm.forEach((ele) => {
if (!ele.ico) {
imData.push(ele);
} else {
imDataError.push(ele);
}
});
this.$api
.post(this.batchImportUrl, {
list: imData,
})
.then((r) => {
if (r.success) {
this.$Message.success("批量导入成功" + imData.length + "条数据");
this.dataIm = imDataError;
this.$emit("on-ok");
} else {
this.$Message.error("批量导入失败");
}
})
.catch((err) => {
this.$Message.error("数据异常!");
});
},
//切换列表和excel按钮
changeExcel(val) {
if (val == 1) {
this.tableImport = false;
this.detailExcel = () => import("./detailExcel");
this.excelType = "1";
this.btnIm = true;
} else {
this.detailExcel = null;
this.tableImport = true;
this.excelType = "0";
if (this.excelData.length > 0) {
this.btnIm = false;
} else {
this.btnIm = true;
}
}
});
}
arrTitleUse.forEach((elem) => {
if (
eles[elem.key] &&
eles[elem.key] != "" &&
eles[elem.key] != null
) {
//如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值
eles[elem.key] = this.$u.dirCode(
this.$store.getters.dictionaryByKey(elem.code),
eles[elem.key]
);
}
});
});
this.dataIm = useData;
let tempData = this.$u.clone(this.dataIm);
this.$emit("on-get-data", tempData);
},
//导入excel文件
async beforeUpload(file) {
//初始化
this.sheetNames = [];
this.workBook = {};
this.$refs.uploadfile.clearFiles(); //清除上一次上传文件列表
//上传成功后的读取到excel信息
this.workBook = await this.$u.readXLSX(file);
this.sheetNames = this.workBook.SheetNames; //execel里的表明
this.btnIm = false;
this.dealSheet(0); //默认显示第一个表
return false;
},
//对上传的excel表信息进行处理,不对表头进行处理
dealSheet(index) {
this.dataType = 1;
this.columnsImport = [];
this.excelData = [];
this.excelDataBack = [];
const sheet2JSONOpts = {
defval: "", //给defval赋值为空的字符串
};
var csv = XLSX.utils.sheet_to_csv(
this.workBook.Sheets[this.workBook.SheetNames[index]],
sheet2JSONOpts
);
var lines = csv.split("\n"); //第一行标题
var headers = lines[0].split(",");
var headersNow = [];
headersNow.push({
type: "index",
width: 80,
align: "right",
title: "序号",
});
headers.forEach((elHead) => {
let headObj = {};
headObj.title = elHead;
headObj.key = elHead;
headersNow.push(headObj);
});
this.columnsImport = headersNow;
var result = [];
for (var i = 1; i < lines.length - 1; i++) {
var obj = {};
var currentline = lines[i].split(",");
for (var j = 0; j < headers.length; j++) {
obj[headers[j]] = currentline[j];
}
result.push(obj);
}
this.excelData = result;
this.excelDataBack = result;
this.changeExcel(0);
},
//切换sheet表重新加载
sheetClick(val) {
this.tabVal = val;
this.dealSheet(val);
},
handleClose() {
this.$emit("on-close");
},
cancelExcel() {
this.excelData = [];
this.excelDataBack = [];
this.$refs.uploadfile.clearFiles();
let parms = {
status: 1,
id: this.eid,
};
//导入中心列表数据状态更新
this.$emit("on-close");
},
//打开导入数据格式化后的窗口
openInfoModal() {
if (
(this.excelType == "0" && this.excelData.length > 0) ||
(this.excelType == "1" && this.$refs.comExcel.excelData.length > 0)
) {
this.imBtn = true;
this.loadColum(this.columnsIm);
this.titleInfo = "批量导入";
this.infoModal = true;
} else {
this.imBtn = false;
this.$Message.error("没有可导入的数据!");
}
},
//确定导入按钮操作
importOk() {
let imData = [];
let imDataError = [];
this.dataIm.forEach((ele) => {
if (!ele.ico) {
imData.push(ele);
} else {
imDataError.push(ele);
}
});
this.$api
.post(this.batchImportUrl, {
list: imData,
})
.then((r) => {
if (r.success) {
this.$Message.success("批量导入成功" + imData.length + "条数据");
this.dataIm = imDataError;
this.$emit("on-ok");
} else {
this.$Message.error("批量导入失败");
}
})
.catch((err) => {
this.$Message.error("数据异常!");
});
},
//切换列表和excel按钮
changeExcel(val) {
if (val == 1) {
this.tableImport = false;
this.detailExcel = () => import("./detailExcel");
this.excelType = "1";
this.btnIm = true;
} else {
this.detailExcel = null;
this.tableImport = true;
this.excelType = "0";
if (this.excelData.length > 0) {
this.btnIm = false;
} else {
this.btnIm = true;
}
}
},
datalength(val) {
if (val > 0) {
this.btnIm = false;
}
},
cancelModal() {
this.$emit("on-cancel");
},
//主页面里第二次处理数据
deelData(url, columns, formatList) {
this.dataIm = formatList;
this.batchImportUrl = url;
},
l(key) {
key = "user" + "." + key;
return this.$t(key);
},
},
watch: {
columns() {
this.columns.forEach((u) => {
if (!u.hide) {
u.hide = false;
}
});
this.colsIm = this.$u.clone(this.columns);
this.columnsIm = this.$u.clone(this.columns);
},
open(v) {
this.ImportModal = v;
},
datalength(val) {
if (val > 0) {
this.btnIm = false;
}
},
cancelModal() {
this.$emit("on-cancel");
},
//主页面里第二次处理数据
deelData(url, columns, formatList) {
this.dataIm = formatList;
this.batchImportUrl = url;
},
l(key) {
key = "user" + "." + key;
return this.$t(key);
},
},
modalTitle(v) {
this.modalTitles = "导入到【" + v + "】";
watch: {
columns() {
this.columns.forEach((u) => {
if (!u.hide) {
u.hide = false;
}
});
this.colsIm = this.$u.clone(this.columns);
this.columnsIm = this.$u.clone(this.columns);
},
open(v) {
this.ImportModal = v;
},
modalTitle(v) {
this.modalTitles = "导入到【" + v + "】";
},
},
},
};
</script>
<style lang="less">
@import "../../../assets/css/custom.less";
.table-content {
position: relative;
height: 100%;
display: flex;
flex-direction: column;
position: relative;
height: 100%;
display: flex;
flex-direction: column;
.tip {
display: inline;
}
.tip {
display: inline;
}
form {
display: inline-block;
form {
display: inline-block;
.ivu-form-item {
margin: 0;
vertical-align: middle;
.ivu-form-item {
margin: 0;
vertical-align: middle;
}
}
}
.table-main {
width: 100%;
text-align: left;
padding: 0;
display: block;
overflow-y: auto;
flex-grow: 1;
.table-main {
width: 100%;
text-align: left;
padding: 0;
display: block;
overflow-y: auto;
flex-grow: 1;
tr td .ivu-table-cell {
padding: 0 5px;
}
tr td .ivu-table-cell {
padding: 0 5px;
overflow-x: hidden;
}
overflow-x: hidden;
}
.table-tools {
display: flex;
line-height: 50px;
background: @right-header-bg;
.table-tools {
display: flex;
line-height: 50px;
background: @right-header-bg;
.table-search {
flex-grow: 1;
}
.table-search {
flex-grow: 1;
}
.btns {
min-width: 200px;
text-align: right;
.btns {
min-width: 200px;
text-align: right;
}
}
}
}
</style>
......@@ -304,11 +304,29 @@ export default {
eles[elem.key] != "" &&
eles[elem.key] != null
) {
//如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值
eles[elem.key] = this.$u.dirCode(
this.$store.getters.dictionaryByKey(elem.code),
eles[elem.key]
);
//如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值。
let codeArr = []
let keyValue = eles[elem.key]
if (keyValue.length > 0 && (keyValue.indexOf(',') > -1 || keyValue.indexOf(',') > -1)) { //如果对应的数据包含多个数据字典项,比如包含“,”或“,”
if (keyValue.indexOf(',') > -1) {
codeArr = keyValue.split(',')
}
if (keyValue.indexOf > -1) {
codeArr = keyValue.split(',')
}
}
if (codeArr.length <= 1) { //对应的数据包含一个数据字典项
eles[elem.key] = this.$u.dirCode(
this.$store.getters.dictionaryByKey(elem.code),
eles[elem.key]
);
} else { //对应的数据包含多个数据字典项
let codeInfo = ''
codeArr.forEach(el => {
codeInfo = codeInfo + this.$u.dirCode(this.$store.getters.dictionaryByKey(elem.code), el) + ",";
})
eles[elem.key] = codeInfo.substr(0, codeInfo.length - 1)
}
}
});
});
......@@ -579,7 +597,7 @@ export default {
parent_Id: ele.parent_Id ? ele.parent_Id : '', //上级部门 [id]
code: ele.code ? ele.code : '', //部门编号
location: ele.location ? this.getCityValue(ele.location) : '', //省市县
isProduction: 0, //是否生产班组:1是,0否
isProduction: ele.property.indexOf('1') > -1 && ele.property.indexOf('2') > -1 && ele.property.indexOf('3') > -1 ? 1 : 0, //是否生产班组:1是,0否. 属性值为三个值,则是生产班组
property: ele.property ? ele.property : '' //属性
};
if (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment