Commit 590fddf4 authored by 仇晓婷's avatar 仇晓婷

Merge branch 'product' of http://git.mes123.com/zhouyx/mes-ui into product

parents 596e79e2 146db3e9
<template> <template>
<div class="table-content"> <div class="table-content">
<div class="table-tools" v-if="tool"> <div class="table-tools" v-if="tool">
<div class="table-search"> <div class="table-search">
<slot name="easySearch" v-if="easy"> <slot name="easySearch" v-if="easy">
<Form inline> <Form inline>
<FormItem> <FormItem>
<Input <Input search enter-button :placeholder="placeholder" @on-search="easySearch" v-width="300" v-model="keys" />
search
enter-button
:placeholder="placeholder"
@on-search="easySearch"
v-width="300"
v-model="keys"
/>
</FormItem> </FormItem>
<FormItem> <FormItem>
<Button v-if="high" @click="modalSearch=true" type="text"> <Button v-if="high" @click="modalSearch=true" type="text">
...@@ -42,40 +35,11 @@ ...@@ -42,40 +35,11 @@
</slot> </slot>
</Col> </Col>
</Row> </Row>
<Table <Table v-else :border="border" :columns="columnsNow" :data="list" :height="tableHeight" :draggable="draggable" ref="table" class="tableCommon" @on-expand="expand" @on-drag-drop="onDragDrop" @on-selection-change="selectionChange" @on-select="onSelect" @on-select-all="allChange" :row-key="rowKey" stripe></Table>
v-else
:border="border"
:columns="columnsNow"
:data="list"
:height="tableHeight"
:draggable="draggable"
ref="table"
class="tableCommon"
@on-expand="expand"
@on-drag-drop="onDragDrop"
@on-selection-change="selectionChange"
@on-select="onSelect"
@on-select-all="allChange"
:row-key="rowKey"
stripe
></Table>
</div> </div>
<div class="table-footer"> <div class="table-footer">
<slot name="footer"></slot> <slot name="footer"></slot>
<Page <Page v-if="page" :total="search.total" :current="search.page" class="fr" show-total size="small" show-elevator show-sizer :page-size="search.pageSize" :page-size-opts="pageSizeOpts" @on-change="pageChange" @on-page-size-change="pageSizeChange" />
v-if="page"
:total="search.total"
:current="search.page"
class="fr"
show-total
size="small"
show-elevator
show-sizer
:page-size="search.pageSize"
:page-size-opts="pageSizeOpts"
@on-change="pageChange"
@on-page-size-change="pageSizeChange"
/>
</div> </div>
<Modal v-if="high" v-model="modalSearch" title="高级搜索" draggable width="800" ref="search"> <Modal v-if="high" v-model="modalSearch" title="高级搜索" draggable width="800" ref="search">
<slot name="searchForm"></slot> <slot name="searchForm"></slot>
...@@ -84,14 +48,7 @@ ...@@ -84,14 +48,7 @@
<Button @click="complexSearch" type="primary" style="margin-left:10px;">查询</Button> <Button @click="complexSearch" type="primary" style="margin-left:10px;">查询</Button>
</div> </div>
</Modal> </Modal>
<Drawer <Drawer title="列设置" v-if="set" v-model="config" :scrollable="true" placement="left" :mask="false">
title="列设置"
v-if="set"
v-model="config"
:scrollable="true"
placement="left"
:mask="false"
>
<div slot="header"> <div slot="header">
列设置 列设置
<a @click="undoConfig" class="ml50"> <a @click="undoConfig" class="ml50">
...@@ -99,11 +56,7 @@ ...@@ -99,11 +56,7 @@
</a> </a>
</div> </div>
<ul class="table-columns"> <ul class="table-columns">
<li <li v-for="(li,index) in columnsCur" :key="index" v-dragging="{ item: li, list: columnsCur, group: 'li' }">
v-for="(li,index) in columnsCur"
:key="index"
v-dragging="{ item: li, list: columnsCur, group: 'li' }"
>
<label @click="columnChange(li,index)" :class="{dis:li.hide}"> <label @click="columnChange(li,index)" :class="{dis:li.hide}">
<Icon :type="li.hide?'md-eye-off':'md-eye'" size="16" class="mr10" /> <Icon :type="li.hide?'md-eye-off':'md-eye'" size="16" class="mr10" />
<span>{{li.title}}</span> <span>{{li.title}}</span>
...@@ -118,7 +71,7 @@ ...@@ -118,7 +71,7 @@
<slot name="batch"></slot> <slot name="batch"></slot>
<Button @click="cancelBatch">取消</Button> <Button @click="cancelBatch">取消</Button>
</FooterToolbar> </FooterToolbar>
</div> </div>
</template> </template>
<script> <script>
...@@ -149,6 +102,7 @@ export default { ...@@ -149,6 +102,7 @@ export default {
treeData: [], //物料数据 treeData: [], //物料数据
codeRuleData: [], //物料编码 codeRuleData: [], //物料编码
routingHeaderData: [], //工艺规程 routingHeaderData: [], //工艺规程
allUser: [] //所有user
}; };
}, },
props: { props: {
...@@ -324,6 +278,7 @@ export default { ...@@ -324,6 +278,7 @@ export default {
this.getTreeData(); this.getTreeData();
this.getcodeRuleData(); this.getcodeRuleData();
this.getRoutingHeaderData(); this.getRoutingHeaderData();
this.getAllUser(); //获取所有用户
}, },
methods: { methods: {
//数据加载 //数据加载
...@@ -363,8 +318,7 @@ export default { ...@@ -363,8 +318,7 @@ export default {
}, },
loadUserConfig() { loadUserConfig() {
var query = { var query = {
conditions: [ conditions: [{
{
fieldName: "creatorUserId", fieldName: "creatorUserId",
fieldValue: this.userId, fieldValue: this.userId,
conditionalType: "Equal", conditionalType: "Equal",
...@@ -520,6 +474,36 @@ export default { ...@@ -520,6 +474,36 @@ export default {
selectAll(status) { selectAll(status) {
this.$refs.table.selectAll(status); this.$refs.table.selectAll(status);
}, },
//获取所有用户信息
getAllUser() {
this.$api.post(`${systemUrl}/user/paged`, {
conditions: [],
pageIndex: 1,
pageSize: 1000,
})
.then((r) => {
if (r.success) {
let tempUserInfo = r.result.items
tempUserInfo.forEach(ele => {
let temObj = {
userId: ele.id,
name: ele.userName
}
this.allUser.push(temObj)
})
}
})
},
getUserName(id) {
let name = ''
this.allUser.forEach(ele => {
if (id == ele.userId) {
name = ele.name
}
})
return name
},
//批量取消 //批量取消
cancelBatch() { cancelBatch() {
this.footerToolbar = false; this.footerToolbar = false;
...@@ -570,6 +554,7 @@ export default { ...@@ -570,6 +554,7 @@ export default {
var tempCol = []; var tempCol = [];
var tempCol1 = []; //存放物料相关表头 var tempCol1 = []; //存放物料相关表头
var tempCol2 = []; //存放工艺规程相关表头 var tempCol2 = []; //存放工艺规程相关表头
var tempColUser = []; //存放type=user的表头
var columnsCur = this.$u.clone(this.columnsCur); //导出列标题信息griddata this.$refs.grid.columnsCur var columnsCur = this.$u.clone(this.columnsCur); //导出列标题信息griddata this.$refs.grid.columnsCur
columnsCur.forEach((el) => { columnsCur.forEach((el) => {
if ( if (
...@@ -597,6 +582,12 @@ export default { ...@@ -597,6 +582,12 @@ export default {
code: el.techKey, code: el.techKey,
}); //临时存放工艺规程相关转换 }); //临时存放工艺规程相关转换
} }
if (el.type && el.type == "user") {
tempColUser.push({
key: el.key,
code: el.type,
}); //临时存放user列
}
tHeader.push(el.title); tHeader.push(el.title);
filterVal.push(el.key); filterVal.push(el.key);
...@@ -604,11 +595,42 @@ export default { ...@@ -604,11 +595,42 @@ export default {
}); });
list.forEach((e) => { list.forEach((e) => {
//给导出数据增加数据字典对应的name //给导出数据增加数据字典对应的name
tempCol.forEach((ele) => { // tempCol.forEach((ele) => {
e[ele.key] = this.$u.dirName( // e[ele.key] = this.$u.dirName(
this.$store.getters.dictionaryByKey(ele.code), // this.$store.getters.dictionaryByKey(ele.code),
e[ele.key] // e[ele.key]
// );
// });
tempCol.forEach((elem) => {
if (
e[elem.key] &&
e[elem.key] != "" &&
e[elem.key] != null
) {
//如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值。
let codeArr = []
let keyValue = e[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) { //对应的数据包含一个数据字典项
e[elem.key] = this.$u.dirName(
this.$store.getters.dictionaryByKey(elem.code),
e[elem.key]
); );
} else { //对应的数据包含多个数据字典项
let codeInfo = ''
codeArr.forEach(el => {
codeInfo = codeInfo + this.$u.dirName(this.$store.getters.dictionaryByKey(elem.code), el) + ",";
})
e[elem.key] = codeInfo.substr(0, codeInfo.length - 1)
}
}
}); });
//导出数据增加对应的物料管理信息 code: 1【rootCategoryId 大类】 2【categoryId 大类】 3【codeRuleId 编码名称】 //导出数据增加对应的物料管理信息 code: 1【rootCategoryId 大类】 2【categoryId 大类】 3【codeRuleId 编码名称】
tempCol1.forEach((elcol1) => { tempCol1.forEach((elcol1) => {
...@@ -626,6 +648,16 @@ export default { ...@@ -626,6 +648,16 @@ export default {
e[elcol2.key] = this.getRoutingHeaderName(e[elcol2.key]); e[elcol2.key] = this.getRoutingHeaderName(e[elcol2.key]);
} }
}); });
//导出username相关信息
tempColUser.forEach(eluser => {
if (
e[eluser.key] &&
e[eluser.key] != "" &&
e[eluser.key] != null
) {
e[eluser.key] = this.getUserName(e[eluser.key])
}
})
}); });
let nowDate = this.$u.getNowTime(); //年月日时分秒yyyyMMddhhmmss let nowDate = this.$u.getNowTime(); //年月日时分秒yyyyMMddhhmmss
...@@ -793,6 +825,7 @@ export default { ...@@ -793,6 +825,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%;
...@@ -831,6 +864,7 @@ export default { ...@@ -831,6 +864,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;
} }
......
<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;
} }
......
...@@ -428,12 +428,18 @@ export default { ...@@ -428,12 +428,18 @@ export default {
DipartLocation: { DipartLocation: {
name: "部门", name: "部门",
organizationType: "组织类型", organizationType: "组织类型",
status: '是否生产班组', // status: '是否生产班组',
status: '属性',
departcode: '部门编号', departcode: '部门编号',
department: '部门名称', department: '部门名称',
cityName: '省市县', cityName: '省市县',
creationTime: '创建时间', creationTime: '创建时间',
upMent: '上级部门', upMent: '上级部门',
code:'部门编号',
location:'省市县',
parent_Id:'上级部门',
property:'属性',
parentTitle:'上级部门'
}, },
instance: { instance: {
id: '主键', id: '主键',
......
...@@ -166,6 +166,42 @@ henq.findRoots = (arr1, id) => { ...@@ -166,6 +166,42 @@ henq.findRoots = (arr1, id) => {
forFn(arr1, id) forFn(arr1, id)
return temp return temp
} }
//省市县pacc转为list
henq.treeToList1 = (tree) => {
let list = [];
function treeToList1(data) {
data.map(u => {
if (u.children&&u.level!=1) {
treeToList1(u.children, u)
}
else if(u.children&&u.level==1)
{
list=list.concat(u.children);
}
})
}
treeToList1(tree, null)
return list;
}
//根据departId返出上级所有name
henq.getDepartAllName = (list,id) => {
let names = '';
function getDepartAllName(list,id) {
list.map(u => {
if(id==u.id)
{
names=u.name+"/"+names
if (u.parent_Id>0) {
getDepartAllName(list, u.parent_Id)
}
}
})
}
getDepartAllName(list,id)
return names.slice(0,names.length-1);
}
//导出pdf //导出pdf
henq.outPdf = (ele, fileName) => { henq.outPdf = (ele, fileName) => {
// document.head.innerHTML = // document.head.innerHTML =
......
...@@ -1744,7 +1744,7 @@ ...@@ -1744,7 +1744,7 @@
"dependencies": { "dependencies": {
"ajv": { "ajv": {
"version": "5.5.2", "version": "5.5.2",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", "resolved": "https://registry.npm.taobao.org/ajv/download/ajv-5.5.2.tgz?cache=0&sync_timestamp=1597480760804&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fajv%2Fdownload%2Fajv-5.5.2.tgz",
"integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
"dev": true, "dev": true,
"optional": true, "optional": true,
...@@ -1776,7 +1776,7 @@ ...@@ -1776,7 +1776,7 @@
}, },
"cross-spawn": { "cross-spawn": {
"version": "5.1.0", "version": "5.1.0",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", "resolved": "https://registry.npm.taobao.org/cross-spawn/download/cross-spawn-5.1.0.tgz?cache=0&sync_timestamp=1590421014780&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcross-spawn%2Fdownload%2Fcross-spawn-5.1.0.tgz",
"integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=",
"dev": true, "dev": true,
"optional": true, "optional": true,
...@@ -1856,7 +1856,7 @@ ...@@ -1856,7 +1856,7 @@
}, },
"fast-deep-equal": { "fast-deep-equal": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "resolved": "https://registry.npm.taobao.org/fast-deep-equal/download/fast-deep-equal-1.1.0.tgz",
"integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=",
"dev": true, "dev": true,
"optional": true "optional": true
...@@ -1894,7 +1894,7 @@ ...@@ -1894,7 +1894,7 @@
}, },
"json-schema-traverse": { "json-schema-traverse": {
"version": "0.3.1", "version": "0.3.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", "resolved": "https://registry.npm.taobao.org/json-schema-traverse/download/json-schema-traverse-0.3.1.tgz",
"integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=",
"dev": true, "dev": true,
"optional": true "optional": true
...@@ -1964,7 +1964,7 @@ ...@@ -1964,7 +1964,7 @@
}, },
"yallist": { "yallist": {
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", "resolved": "https://registry.npm.taobao.org/yallist/download/yallist-2.1.2.tgz",
"integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=",
"dev": true, "dev": true,
"optional": true "optional": true
......
...@@ -135,16 +135,39 @@ export default { ...@@ -135,16 +135,39 @@ export default {
}, },
columns1() { columns1() {
let col1 = [{ let col1 = [{
key: "userName", key: "name",
title: this.l("userName"), title: this.l1("name"),
align: "left", align: "left",
}, },
{ {
key: "status", key: "parent_Id",
title: this.l("status"), title: this.l1("parent_Id"),
align: "center", align: "left",
code: "User.base.status", parentDepart: true,
import: true,
},
{
key: "code",
title: this.l1("code"),
align: "left",
},
{
key: "location",
title: this.l1("location"),
align: "left",
location: true,
import: true,
},
{
key: "property",
title: this.l1("property"),
align: "left",
code: "department.property",
},
{
key: "creationTime",
title: this.l1("creationTime"),
align: "left",
}, },
] ]
return col1 return col1
...@@ -629,6 +652,10 @@ export default { ...@@ -629,6 +652,10 @@ export default {
key = "user" + "." + key; key = "user" + "." + key;
return i18n.t(key); return i18n.t(key);
}, },
l1(key) {
key = "DipartLocation" + "." + key;
return i18n.t(key);
},
l2(key) { l2(key) {
key = "resource" + "." + key; key = "resource" + "." + key;
return i18n.t(key); return i18n.t(key);
...@@ -645,8 +672,7 @@ export default { ...@@ -645,8 +672,7 @@ export default {
key = "product_info" + "." + key; key = "product_info" + "." + key;
return i18n.t(key); return i18n.t(key);
}, },
test() test() {
{
ViewUI.Message.error("terterer") ViewUI.Message.error("terterer")
} }
} }
\ No newline at end of file
<template> <template>
<div class="table-contentProcess"> <div class="table-contentProcess">
<div class="table-tools"> <div class="table-tools">
<div class="table-search"> <div class="table-search">
<Form inline> <Form inline>
...@@ -7,12 +7,7 @@ ...@@ -7,12 +7,7 @@
<span>导入到</span> <span>导入到</span>
</FormItem> </FormItem>
<FormItem> <FormItem>
<dictionary <dictionary code="import.im.page" style="width:160px" @on-change="pageChange" v-model="pageType"></dictionary>
code="import.im.page"
style="width:160px"
@on-change="pageChange"
v-model="pageType"
></dictionary>
</FormItem> </FormItem>
<FormItem> <FormItem>
<Button type="primary" @click="openInfoModal" :disabled="btnIm">导入</Button> <Button type="primary" @click="openInfoModal" :disabled="btnIm">导入</Button>
...@@ -22,6 +17,7 @@ ...@@ -22,6 +17,7 @@
<Upload action :before-upload="beforeUpload" ref="uploadfile" :format="formatList"> <Upload action :before-upload="beforeUpload" ref="uploadfile" :format="formatList">
<Button icon="ios-cloud-upload-outline" @click="resetParms">重新上传</Button> <Button icon="ios-cloud-upload-outline" @click="resetParms">重新上传</Button>
</Upload> </Upload>
<Cascader :data="citys" v-show="false"></Cascader>
</div> </div>
</FormItem> </FormItem>
</Form> </Form>
...@@ -61,16 +57,7 @@ ...@@ -61,16 +57,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">
...@@ -83,27 +70,23 @@ ...@@ -83,27 +70,23 @@
</Form> </Form>
</FooterToolbar> </FooterToolbar>
<Modal v-model="infoModal" :title="titleInfo" fullscreen> <Modal v-model="infoModal" :title="titleInfo" 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>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
import BaseColums from "./baseColums"; import BaseColums from "./baseColums";
import citys from "@/libs/citys";
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() {
...@@ -140,6 +123,10 @@ export default { ...@@ -140,6 +123,10 @@ export default {
treeData: [], //物料管理左侧类别树 treeData: [], //物料管理左侧类别树
codeRuleData: [], //物料编码等信息 codeRuleData: [], //物料编码等信息
routingHeaderData: [], //工艺规程列表信息 routingHeaderData: [], //工艺规程列表信息
//部门管理
treeList: [],
citys: citys(),
cityDatas: [], //省市县在一起
}; };
}, },
props: { props: {
...@@ -163,6 +150,7 @@ export default { ...@@ -163,6 +150,7 @@ export default {
this.getcodeRuleData(); this.getcodeRuleData();
//获取工艺规程信息 //获取工艺规程信息
this.getRoutingHeaderData(); this.getRoutingHeaderData();
this.formatCity();
window.onresize = () => { window.onresize = () => {
///浏览器窗口大小变化 ///浏览器窗口大小变化
return (() => { return (() => {
...@@ -316,11 +304,29 @@ export default { ...@@ -316,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)
}
} }
}); });
}); });
...@@ -505,6 +511,9 @@ export default { ...@@ -505,6 +511,9 @@ export default {
case 0: case 0:
this.importUser(); this.importUser();
break; break;
case 1:
this.importDepart();
break;
case 2: case 2:
this.importResource(); this.importResource();
break; break;
...@@ -577,6 +586,82 @@ export default { ...@@ -577,6 +586,82 @@ export default {
}); });
} }
}, },
//批量插入部门
importDepart() {
let tempData = this.$u.clone(this.dataIm);
let tempList = [];
tempData.forEach((ele) => {
let obj = {
parentTitle: ele.parent_Id ? ele.parent_Id : '',
name: ele.name ? ele.name : '', //部门名称
parent_Id: ele.parent_Id ? ele.parent_Id : '', //上级部门 [id]
code: ele.code ? ele.code : '', //部门编号
location: ele.location ? this.getCityValue(ele.location) : '', //省市县
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 (
ele.name &&
ele.name != ""
) {
tempList.push(obj);
}
});
if (tempList.length == 0) {
this.$Message.error("所有导入的数据均不合法!");
} else {
let parms = {
list: tempList,
};
let url = `${systemUrl}/departmentimport/import`;
this.$api.post(url, parms).then((res) => {
if (res.success) {
this.$Message.success(
"成功批量导入部门管理成功模块 " + tempList.length + " 条数据"
);
this.imBtn = false;
this.cancelExcel();
} else {
this.$Message.error("批量导入部门管理失败!");
}
});
}
},
//获取省市县信息
formatCity() {
let list = this.$u.clone(this.treeList);
let cityData = this.$u.clone(this.citys);
let temp = this.$u.treeToList1(cityData);
this.cityDatas = [];
temp.forEach(ele => {
let objTem = {
label: ele.__label.replace(/\s*/g, ""),
value: ele.__value
}
this.cityDatas.push(objTem)
})
},
//根据value获取当前cityname
getCityName(val) {
let cities = this.$u.clone(this.cityDatas)
let label = "";
cities.forEach(ele => {
if (val == ele.value) {
label = ele.label
}
})
return label
},
getCityValue(val) {
let cities = this.$u.clone(this.cityDatas)
let value = "";
cities.forEach(ele => {
if (val == ele.label) {
value = ele.value
}
})
return value
},
//批量插入制造资源 //批量插入制造资源
importResource() { importResource() {
let tempData = this.$u.clone(this.dataIm); let tempData = this.$u.clone(this.dataIm);
...@@ -642,15 +727,12 @@ export default { ...@@ -642,15 +727,12 @@ export default {
code: 0, code: 0,
status: ele.status ? Number(ele.status) : "", status: ele.status ? Number(ele.status) : "",
customProperties: {}, customProperties: {},
categoryId: this.getType2(ele.categoryId) categoryId: this.getType2(ele.categoryId) ?
? this.getType2(ele.categoryId) this.getType2(ele.categoryId) : 1, //左侧树点击的id
: 1, //左侧树点击的id rootCategoryId: this.getType1(ele.rootCategoryId) ?
rootCategoryId: this.getType1(ele.rootCategoryId) this.getType1(ele.rootCategoryId) : 1, //左侧树点击的数据的最顶层id
? this.getType1(ele.rootCategoryId) codeRuleId: this.getType3(ele.codeRuleId) ?
: 1, //左侧树点击的数据的最顶层id this.getType3(ele.codeRuleId) : 1, //类别编码名称
codeRuleId: this.getType3(ele.codeRuleId)
? this.getType3(ele.codeRuleId)
: 1, //类别编码名称
codeRuleType: ele.codeRuleType ? Number(ele.codeRuleType) : 1, //类别codeType codeRuleType: ele.codeRuleType ? Number(ele.codeRuleType) : 1, //类别codeType
}; };
if ( if (
...@@ -825,12 +907,10 @@ export default { ...@@ -825,12 +907,10 @@ export default {
tempData.forEach((ele) => { tempData.forEach((ele) => {
let obj = { let obj = {
routingHeaderId: Number(this.getRoutingHeaderId(ele.routingHeaderId)), routingHeaderId: Number(this.getRoutingHeaderId(ele.routingHeaderId)),
routingDetailId: ele.routingDetailId routingDetailId: ele.routingDetailId ?
? Number(ele.routingDetailId) Number(ele.routingDetailId) : null,
: null, routingDetailNo: ele.routingDetailNo ?
routingDetailNo: ele.routingDetailNo Number(ele.routingDetailNo) : null,
? Number(ele.routingDetailNo)
: null,
routingDetailName: ele.routingDetailName ? ele.routingDetailName : "", routingDetailName: ele.routingDetailName ? ele.routingDetailName : "",
routingStepId: 0, routingStepId: 0,
quantity: ele.quantity ? Number(ele.quantity) : 0, quantity: ele.quantity ? Number(ele.quantity) : 0,
...@@ -842,9 +922,8 @@ export default { ...@@ -842,9 +922,8 @@ export default {
specifications: ele.specifications ? ele.specifications : "", specifications: ele.specifications ? ele.specifications : "",
xhgg: ele.xhgg ? ele.xhgg : "", xhgg: ele.xhgg ? ele.xhgg : "",
texture: ele.texture ? ele.texture : "", texture: ele.texture ? ele.texture : "",
procurementStandards: ele.procurementStandards procurementStandards: ele.procurementStandards ?
? ele.procurementStandards ele.procurementStandards : "",
: "",
qualityGrade: ele.qualityGrade ? ele.qualityGrade : "", qualityGrade: ele.qualityGrade ? ele.qualityGrade : "",
state: null, state: null,
extend: "", extend: "",
...@@ -985,6 +1064,7 @@ export default { ...@@ -985,6 +1064,7 @@ export default {
<style lang="less"> <style lang="less">
@import "../../assets/css/custom.less"; @import "../../assets/css/custom.less";
.table-contentProcess { .table-contentProcess {
position: relative; position: relative;
height: 100%; height: 100%;
...@@ -1023,6 +1103,7 @@ export default { ...@@ -1023,6 +1103,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;
} }
......
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