Commit 7e16e1e1 authored by renjintao's avatar renjintao

product process

parent 8428bc03
<template> <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-content">
<div class="table-tools"> <div class="table-tools">
<div class="table-search"> <div class="table-search">
...@@ -36,16 +36,7 @@ ...@@ -36,16 +36,7 @@
</div> </div>
</div> </div>
<div class="table-main" ref="main"> <div class="table-main" ref="main">
<Table <Table :border="true" :columns="columnsImport" :data="excelData" :height="tdHeightExcel" :no-data-text="noDataText" ref="table" class="tableCommon" v-if="tableImport"></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" /> <component :is="detailExcel" ref="comExcel" @on-datalength="datalength" />
</div> </div>
<FooterToolbar v-if="sheetNames.length>1&&tableImport"> <FooterToolbar v-if="sheetNames.length>1&&tableImport">
...@@ -58,26 +49,21 @@ ...@@ -58,26 +49,21 @@
</Form> </Form>
</FooterToolbar> </FooterToolbar>
<Modal v-model="infoModal" :title="modalTitles" fullscreen> <Modal v-model="infoModal" :title="modalTitles" fullscreen>
<DataGrid <DataGrid :tool="false" :page="false" :columns="colsIm" :data="dataIm" :height="tdHeightExcel+30" ref="dataImport"></DataGrid>
:tool="false"
:page="false"
:columns="colsIm"
:data="dataIm"
:height="tdHeightExcel+30"
ref="dataImport"
></DataGrid>
<div slot="footer"> <div slot="footer">
<Button @click="infoModal=false">关闭</Button> <Button @click="infoModal=false">关闭</Button>
<Button type="primary" @click="importOk" v-show="imBtn">确定导入</Button> <Button type="primary" @click="importOk" v-show="imBtn">确定导入</Button>
</div> </div>
</Modal> </Modal>
</div> </div>
</Modal> </Modal>
</template> </template>
<script> <script>
import XLSX from "xlsx"; import XLSX from "xlsx";
import { Switch } from "view-design"; import {
Switch
} from "view-design";
export default { export default {
name: "Edit", name: "Edit",
data() { data() {
...@@ -173,22 +159,19 @@ export default { ...@@ -173,22 +159,19 @@ export default {
} }
}); });
this.colsIm = tempCol; this.colsIm = tempCol;
this.colsIm.unshift( this.colsIm.unshift({
{
type: "index", type: "index",
width: 80, width: 80,
align: "right", align: "right",
title: "序号", title: "序号",
}, }, {
{
key: "ico", key: "ico",
title: " ", title: " ",
align: "center", align: "center",
width: 60, width: 60,
render: (h, params) => { render: (h, params) => {
return h( return h(
"div", "div", {
{
class: "", class: "",
}, },
[ [
...@@ -203,8 +186,7 @@ export default { ...@@ -203,8 +186,7 @@ export default {
] ]
); );
}, },
} });
);
//处理原始数据和表头进行对应 //处理原始数据和表头进行对应
let temCol = this.$u.clone(this.colsIm); //原始数据表头 let temCol = this.$u.clone(this.colsIm); //原始数据表头
let temColPage = this.$u.clone(columns); //需要显示的页面的表头 let temColPage = this.$u.clone(columns); //需要显示的页面的表头
...@@ -273,10 +255,28 @@ export default { ...@@ -273,10 +255,28 @@ export default {
eles[elem.key] != null eles[elem.key] != null
) { ) {
//如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值 //如果数据字典项对应的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( eles[elem.key] = this.$u.dirCode(
this.$store.getters.dictionaryByKey(elem.code), this.$store.getters.dictionaryByKey(elem.code),
eles[elem.key] 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)
}
} }
}); });
}); });
...@@ -463,6 +463,7 @@ export default { ...@@ -463,6 +463,7 @@ export default {
<style lang="less"> <style lang="less">
@import "../../../assets/css/custom.less"; @import "../../../assets/css/custom.less";
.table-content { .table-content {
position: relative; position: relative;
height: 100%; height: 100%;
...@@ -501,6 +502,7 @@ export default { ...@@ -501,6 +502,7 @@ export default {
display: flex; display: flex;
line-height: 50px; line-height: 50px;
background: @right-header-bg; background: @right-header-bg;
.table-search { .table-search {
flex-grow: 1; flex-grow: 1;
} }
......
...@@ -304,11 +304,29 @@ export default { ...@@ -304,11 +304,29 @@ export default {
eles[elem.key] != "" && eles[elem.key] != "" &&
eles[elem.key] != null eles[elem.key] != null
) { ) {
//如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值 //如果数据字典项对应的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( eles[elem.key] = this.$u.dirCode(
this.$store.getters.dictionaryByKey(elem.code), this.$store.getters.dictionaryByKey(elem.code),
eles[elem.key] 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 { ...@@ -579,7 +597,7 @@ export default {
parent_Id: ele.parent_Id ? ele.parent_Id : '', //上级部门 [id] parent_Id: ele.parent_Id ? ele.parent_Id : '', //上级部门 [id]
code: ele.code ? ele.code : '', //部门编号 code: ele.code ? ele.code : '', //部门编号
location: ele.location ? this.getCityValue(ele.location) : '', //省市县 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 : '' //属性 property: ele.property ? ele.property : '' //属性
}; };
if ( 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