Commit 2e4f3489 authored by renjintao's avatar renjintao

process

parent 9eddae69
......@@ -135,16 +135,40 @@ export default {
},
columns1() {
let col1 = [{
key: "userName",
title: this.l("userName"),
key: "name",
title: this.l1("name"),
align: "left",
},
{
key: "status",
title: this.l("status"),
align: "center",
code: "User.base.status",
key: "parent_Id",
title: this.l1("parent_Id"),
align: "left",
hide: true,
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
......@@ -629,6 +653,10 @@ export default {
key = "user" + "." + key;
return i18n.t(key);
},
l1(key) {
key = "DipartLocation" + "." + key;
return i18n.t(key);
},
l2(key) {
key = "resource" + "." + key;
return i18n.t(key);
......@@ -645,8 +673,7 @@ export default {
key = "product_info" + "." + key;
return i18n.t(key);
},
test()
{
test() {
ViewUI.Message.error("terterer")
}
}
\ No newline at end of file
<template>
<div class="table-contentProcess">
<div class="table-contentProcess">
<div class="table-tools">
<div class="table-search">
<Form inline>
......@@ -7,12 +7,7 @@
<span>导入到</span>
</FormItem>
<FormItem>
<dictionary
code="import.im.page"
style="width:160px"
@on-change="pageChange"
v-model="pageType"
></dictionary>
<dictionary code="import.im.page" style="width:160px" @on-change="pageChange" v-model="pageType"></dictionary>
</FormItem>
<FormItem>
<Button type="primary" @click="openInfoModal" :disabled="btnIm">导入</Button>
......@@ -61,16 +56,7 @@
</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>
<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">
......@@ -83,27 +69,22 @@
</Form>
</FooterToolbar>
<Modal v-model="infoModal" :title="titleInfo" fullscreen>
<DataGrid
:tool="false"
:page="false"
:columns="colsIm"
:data="dataIm"
:height="tdHeightExcel+30"
ref="dataImport"
></DataGrid>
<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>
</div>
</template>
<script>
import Api from "./api";
import BaseColums from "./baseColums";
import XLSX from "xlsx";
import { Switch } from "view-design";
import {
Switch
} from "view-design";
export default {
name: "Edit",
data() {
......@@ -505,6 +486,9 @@ export default {
case 0:
this.importUser();
break;
case 1:
this.importDepart();
break;
case 2:
this.importResource();
break;
......@@ -577,6 +561,47 @@ 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: 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("批量导入部门管理失败!");
}
});
}
},
//批量插入制造资源
importResource() {
let tempData = this.$u.clone(this.dataIm);
......@@ -642,15 +667,12 @@ export default {
code: 0,
status: ele.status ? Number(ele.status) : "",
customProperties: {},
categoryId: this.getType2(ele.categoryId)
? this.getType2(ele.categoryId)
: 1, //左侧树点击的id
rootCategoryId: this.getType1(ele.rootCategoryId)
? this.getType1(ele.rootCategoryId)
: 1, //左侧树点击的数据的最顶层id
codeRuleId: this.getType3(ele.codeRuleId)
? this.getType3(ele.codeRuleId)
: 1, //类别编码名称
categoryId: this.getType2(ele.categoryId) ?
this.getType2(ele.categoryId) : 1, //左侧树点击的id
rootCategoryId: this.getType1(ele.rootCategoryId) ?
this.getType1(ele.rootCategoryId) : 1, //左侧树点击的数据的最顶层id
codeRuleId: this.getType3(ele.codeRuleId) ?
this.getType3(ele.codeRuleId) : 1, //类别编码名称
codeRuleType: ele.codeRuleType ? Number(ele.codeRuleType) : 1, //类别codeType
};
if (
......@@ -825,12 +847,10 @@ export default {
tempData.forEach((ele) => {
let obj = {
routingHeaderId: Number(this.getRoutingHeaderId(ele.routingHeaderId)),
routingDetailId: ele.routingDetailId
? Number(ele.routingDetailId)
: null,
routingDetailNo: ele.routingDetailNo
? Number(ele.routingDetailNo)
: null,
routingDetailId: ele.routingDetailId ?
Number(ele.routingDetailId) : null,
routingDetailNo: ele.routingDetailNo ?
Number(ele.routingDetailNo) : null,
routingDetailName: ele.routingDetailName ? ele.routingDetailName : "",
routingStepId: 0,
quantity: ele.quantity ? Number(ele.quantity) : 0,
......@@ -842,9 +862,8 @@ export default {
specifications: ele.specifications ? ele.specifications : "",
xhgg: ele.xhgg ? ele.xhgg : "",
texture: ele.texture ? ele.texture : "",
procurementStandards: ele.procurementStandards
? ele.procurementStandards
: "",
procurementStandards: ele.procurementStandards ?
ele.procurementStandards : "",
qualityGrade: ele.qualityGrade ? ele.qualityGrade : "",
state: null,
extend: "",
......@@ -985,6 +1004,7 @@ export default {
<style lang="less">
@import "../../assets/css/custom.less";
.table-contentProcess {
position: relative;
height: 100%;
......@@ -1023,6 +1043,7 @@ export default {
display: flex;
line-height: 50px;
background: @right-header-bg;
.table-search {
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