Commit 5c44c709 authored by 仇晓婷's avatar 仇晓婷

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

parents e194ed55 71b1eb0a
<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">
...@@ -41,39 +34,11 @@ ...@@ -41,39 +34,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"></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"
></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>
...@@ -82,14 +47,7 @@ ...@@ -82,14 +47,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">
...@@ -97,11 +55,7 @@ ...@@ -97,11 +55,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>
...@@ -115,7 +69,7 @@ ...@@ -115,7 +69,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>
...@@ -228,7 +182,11 @@ export default { ...@@ -228,7 +182,11 @@ export default {
type: Object, type: Object,
default: function () { default: function () {
return { return {
keys: { op: "name", value: "", default: true }, keys: {
op: "name",
value: "",
default: true
},
}; };
}, },
}, },
...@@ -344,8 +302,7 @@ export default { ...@@ -344,8 +302,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",
...@@ -566,13 +523,13 @@ export default { ...@@ -566,13 +523,13 @@ export default {
}, },
}, },
watch: { watch: {
"data.length"() { "data"() {
this.list = this.data; this.list = this.data;
}, },
height() { height() {
this.tableHeight = this.height; this.tableHeight = this.height;
}, },
"columns.length"() { "columns"() {
this.columns.forEach((u) => { this.columns.forEach((u) => {
if (!u.hide) { if (!u.hide) {
u.hide = false; u.hide = false;
...@@ -590,16 +547,20 @@ export default { ...@@ -590,16 +547,20 @@ export default {
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.tip { .tip {
display: inline; display: inline;
} }
form { form {
display: inline-block; display: inline-block;
.ivu-form-item { .ivu-form-item {
margin: 0; margin: 0;
vertical-align: middle; vertical-align: middle;
} }
} }
.table-main { .table-main {
width: 100%; width: 100%;
text-align: left; text-align: left;
...@@ -607,66 +568,83 @@ export default { ...@@ -607,66 +568,83 @@ export default {
display: block; display: block;
overflow-y: auto; overflow-y: auto;
flex-grow: 1; flex-grow: 1;
tr td .ivu-table-cell { tr td .ivu-table-cell {
padding: 0 5px; padding: 0 5px;
} }
overflow-x: hidden; overflow-x: hidden;
} }
.table-tools { .table-tools {
display: flex; display: flex;
line-height: 50px; line-height: 50px;
.table-search { .table-search {
flex-grow: 1; flex-grow: 1;
} }
.btns { .btns {
min-width: 200px; min-width: 200px;
text-align: right; text-align: right;
} }
} }
.table-footer { .table-footer {
line-height: 45px; line-height: 45px;
} }
.ivu-footer-toolbar { .ivu-footer-toolbar {
text-align: left; text-align: left;
background: rgba(0, 0, 0, 0.7); background: rgba(0, 0, 0, 0.7);
color: #fff; color: #fff;
} }
} }
.table-columns { .table-columns {
max-height: calc(100% - 50px); max-height: calc(100% - 50px);
overflow: auto; overflow: auto;
li { li {
list-style: none; list-style: none;
line-height: 40px; line-height: 40px;
cursor: move; cursor: move;
border-bottom: 1px dotted #249e91; border-bottom: 1px dotted #249e91;
color: #249e91; color: #249e91;
span { span {
cursor: pointer; cursor: pointer;
} }
.mr10 { .mr10 {
cursor: pointer; cursor: pointer;
} }
.move { .move {
float: right; float: right;
margin: 10px 10px 0 0; margin: 10px 10px 0 0;
cursor: move; cursor: move;
} }
.dis { .dis {
color: #aaa; color: #aaa;
} }
} }
} }
.searchBack { .searchBack {
display: inline; display: inline;
margin-left: 20px; margin-left: 20px;
button { button {
margin-left: 10px; margin-left: 10px;
} }
a { a {
margin-left: 20px; margin-left: 20px;
color: #2680eb; color: #2680eb;
} }
a:hover { a:hover {
color: #249e91; color: #249e91;
} }
......
...@@ -4688,7 +4688,7 @@ ...@@ -4688,7 +4688,7 @@
"dependencies": { "dependencies": {
"commander": { "commander": {
"version": "2.14.1", "version": "2.14.1",
"resolved": "http://r.cnpmjs.org/commander/download/commander-2.14.1.tgz", "resolved": "https://registry.npm.taobao.org/commander/download/commander-2.14.1.tgz?cache=0&sync_timestamp=1595168224685&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcommander%2Fdownload%2Fcommander-2.14.1.tgz",
"integrity": "sha1-IjUSPjevjKPGXfRbAm29NXsBuao=" "integrity": "sha1-IjUSPjevjKPGXfRbAm29NXsBuao="
} }
} }
...@@ -5216,7 +5216,7 @@ ...@@ -5216,7 +5216,7 @@
}, },
"crc-32": { "crc-32": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "http://r.cnpmjs.org/crc-32/download/crc-32-1.2.0.tgz", "resolved": "https://registry.npm.taobao.org/crc-32/download/crc-32-1.2.0.tgz",
"integrity": "sha1-yy224puIUI4y2d0OwWk+e0Ghggg=", "integrity": "sha1-yy224puIUI4y2d0OwWk+e0Ghggg=",
"requires": { "requires": {
"exit-on-epipe": "~1.0.1", "exit-on-epipe": "~1.0.1",
...@@ -6908,7 +6908,7 @@ ...@@ -6908,7 +6908,7 @@
}, },
"exit-on-epipe": { "exit-on-epipe": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "http://r.cnpmjs.org/exit-on-epipe/download/exit-on-epipe-1.0.1.tgz", "resolved": "https://registry.npm.taobao.org/exit-on-epipe/download/exit-on-epipe-1.0.1.tgz",
"integrity": "sha1-C92S6H1ShdJn2qgXHQ6wYVlolpI=" "integrity": "sha1-C92S6H1ShdJn2qgXHQ6wYVlolpI="
}, },
"expand-brackets": { "expand-brackets": {
...@@ -7555,7 +7555,7 @@ ...@@ -7555,7 +7555,7 @@
}, },
"frac": { "frac": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "http://r.cnpmjs.org/frac/download/frac-1.1.2.tgz", "resolved": "https://registry.npm.taobao.org/frac/download/frac-1.1.2.tgz",
"integrity": "sha1-PXT39keMiKG1AgMG10fcYxPHTQs=" "integrity": "sha1-PXT39keMiKG1AgMG10fcYxPHTQs="
}, },
"fragment-cache": { "fragment-cache": {
...@@ -14590,7 +14590,7 @@ ...@@ -14590,7 +14590,7 @@
}, },
"printj": { "printj": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "http://r.cnpmjs.org/printj/download/printj-1.1.2.tgz", "resolved": "https://registry.npm.taobao.org/printj/download/printj-1.1.2.tgz",
"integrity": "sha1-2Q3rKXWoufYA+zoclOP0xTx4oiI=" "integrity": "sha1-2Q3rKXWoufYA+zoclOP0xTx4oiI="
}, },
"private": { "private": {
...@@ -20051,7 +20051,7 @@ ...@@ -20051,7 +20051,7 @@
}, },
"script-loader": { "script-loader": {
"version": "0.7.2", "version": "0.7.2",
"resolved": "http://r.cnpmjs.org/script-loader/download/script-loader-0.7.2.tgz", "resolved": "https://registry.npm.taobao.org/script-loader/download/script-loader-0.7.2.tgz",
"integrity": "sha1-IBbbb4byX1z1baOJFdgzeLsWa6c=", "integrity": "sha1-IBbbb4byX1z1baOJFdgzeLsWa6c=",
"dev": true, "dev": true,
"requires": { "requires": {
...@@ -20638,7 +20638,7 @@ ...@@ -20638,7 +20638,7 @@
}, },
"ssf": { "ssf": {
"version": "0.10.3", "version": "0.10.3",
"resolved": "http://r.cnpmjs.org/ssf/download/ssf-0.10.3.tgz", "resolved": "https://registry.npm.taobao.org/ssf/download/ssf-0.10.3.tgz",
"integrity": "sha1-jq4fwpyQpVLnkhII+BiS1vd6yys=", "integrity": "sha1-jq4fwpyQpVLnkhII+BiS1vd6yys=",
"requires": { "requires": {
"frac": "~1.1.2" "frac": "~1.1.2"
...@@ -23294,7 +23294,7 @@ ...@@ -23294,7 +23294,7 @@
}, },
"wmf": { "wmf": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "http://r.cnpmjs.org/wmf/download/wmf-1.0.2.tgz", "resolved": "https://registry.npm.taobao.org/wmf/download/wmf-1.0.2.tgz",
"integrity": "sha1-fRnWIQcaCMK9xrfmiKnENSmMwto=" "integrity": "sha1-fRnWIQcaCMK9xrfmiKnENSmMwto="
}, },
"word-wrap": { "word-wrap": {
...@@ -23450,7 +23450,7 @@ ...@@ -23450,7 +23450,7 @@
}, },
"xlsx": { "xlsx": {
"version": "0.15.6", "version": "0.15.6",
"resolved": "http://r.cnpmjs.org/xlsx/download/xlsx-0.15.6.tgz", "resolved": "https://registry.npm.taobao.org/xlsx/download/xlsx-0.15.6.tgz?cache=0&sync_timestamp=1597272342311&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fxlsx%2Fdownload%2Fxlsx-0.15.6.tgz",
"integrity": "sha1-Rh+EHW2eoag3XizSRr8jrs4IodU=", "integrity": "sha1-Rh+EHW2eoag3XizSRr8jrs4IodU=",
"requires": { "requires": {
"adler-32": "~1.2.0", "adler-32": "~1.2.0",
...@@ -23465,7 +23465,7 @@ ...@@ -23465,7 +23465,7 @@
"dependencies": { "dependencies": {
"commander": { "commander": {
"version": "2.17.1", "version": "2.17.1",
"resolved": "http://r.cnpmjs.org/commander/download/commander-2.17.1.tgz", "resolved": "https://registry.npm.taobao.org/commander/download/commander-2.17.1.tgz?cache=0&sync_timestamp=1595168224685&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcommander%2Fdownload%2Fcommander-2.17.1.tgz",
"integrity": "sha1-vXerfebelCBc6sxy8XFtKfIKd78=" "integrity": "sha1-vXerfebelCBc6sxy8XFtKfIKd78="
} }
} }
......
<template> <template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90"> <Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row> <Row>
<Col :span="12"> <Col :span="12">
...@@ -22,9 +22,10 @@ ...@@ -22,9 +22,10 @@
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button> <Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button> <Button @click="handleClose" class="ml20">取消</Button>
</FormItem> </FormItem>
</Form> </Form>
</template> </template>
<script>
<script>
import Api from "./api"; import Api from "./api";
import InputExcel from "@/components/page/inputExcel.vue"; import InputExcel from "@/components/page/inputExcel.vue";
export default { export default {
...@@ -35,17 +36,25 @@ export default { ...@@ -35,17 +36,25 @@ export default {
data() { data() {
return { return {
disabled: false, disabled: false,
parms: "app=import&eid="+this.$u.guid()+"&name=excel", parms: "app=import&eid=" + this.$u.guid() + "&name=excel",
imgName: "", imgName: "",
entity: { entity: {
name: "", name: "",
file: "", file: "",
filePath:"", path: "",
remark: "", remark: "",
}, },
rules: { rules: {
name: [{ required: true, message: "必填", trigger: "blur" }], name: [{
file:[{ required: true, message: "请上传文件", trigger: "change" }] required: true,
message: "必填",
trigger: "blur"
}],
file: [{
required: true,
message: "请上传文件",
trigger: "change"
}]
}, },
}; };
}, },
...@@ -85,7 +94,9 @@ export default { ...@@ -85,7 +94,9 @@ export default {
this.$emit("on-close"); this.$emit("on-close");
}, },
load(v) { load(v) {
Api.get({ id: v }).then((r) => { Api.get({
id: v
}).then((r) => {
this.entity = r.result; this.entity = r.result;
this.entity.id = 0; this.entity.id = 0;
}); });
...@@ -103,8 +114,8 @@ export default { ...@@ -103,8 +114,8 @@ export default {
watch: { watch: {
imgName(newName, oldName) { imgName(newName, oldName) {
const imgPathsArr = JSON.parse(newName); const imgPathsArr = JSON.parse(newName);
this.entity.file=imgPathsArr[0].fileName this.entity.file = imgPathsArr[0].fileName
this.entity.filePath=imgPathsArr[0].filePath this.entity.path = imgPathsArr[0].filePath
}, },
v() { v() {
this.entity = this.$u.clone(this.v); this.entity = this.$u.clone(this.v);
......
import Api from '@/plugins/request' import Api from '@/plugins/request'
import { getJSON } from 'js-cookie';
export default { export default {
index: `${systemUrl}/importcenter/paged`, index: `${systemUrl}/importcenter/paged`,
paged(params) { paged(params) {
...@@ -22,5 +23,15 @@ export default { ...@@ -22,5 +23,15 @@ export default {
}, },
deletes(params) { deletes(params) {
return Api.post(`${systemUrl}/importcenter/batchdelete`, params); return Api.post(`${systemUrl}/importcenter/batchdelete`, params);
} },
openExcel(params) {//处理时打开以前上传的excel返回数据
return Api.post(`${systemUrl}/importcenter/open`, params);
},
importUser(params) {//用户管理导入
return Api.post(`${systemUrl}/userimportservice/import`, params);
},
updateimportstatus(params) {//用户管理导入
return Api.post(`${systemUrl}/importcenter/updateimportstatus`, params);
},
} }
<template> <template>
<div class="detail"> <div class="detail">
<Row> <Row>
<Filed :span="12" :name="l('name')">{{entity.name}}</Filed> <Filed :span="12" :name="l('name')">{{entity.name}}</Filed>
<Filed :span="12" :name="l('file')"><a @click="downFile(entity.filePath)">{{entity.file}}</a></Filed> <Filed :span="12" :name="l('file')">
<Filed :span="12" :name="l('status')">{{entity.status}}</Filed> <a @click="downFile(entity.path)">{{entity.file}}</a>
</Filed>
<Filed :span="12" :name="l('status')">
<state code="improt.im.status" :value="entity.status" type="text"></state>
</Filed>
<Filed :span="24" :name="l('remark')">{{entity.remark}}</Filed> <Filed :span="24" :name="l('remark')">{{entity.remark}}</Filed>
<Filed :span="12" :name="l('creationTime')">{{entity.creationTime}}</Filed> <Filed :span="12" :name="l('creationTime')">{{entity.creationTime}}</Filed>
<Filed :span="12" :name="l('creatorUserId')">{{entity.creatorUserId}}</Filed> <Filed :span="12" :name="l('creatorUserId')">
<User :value="entity.creatorUserId"></User>
</Filed>
<!--
<Filed :span="12" :name="l('lastModificationTime')">{{entity.lastModificationTime}}</Filed> <Filed :span="12" :name="l('lastModificationTime')">{{entity.lastModificationTime}}</Filed>
<Filed :span="12" :name="l('lastModifierUserId')">{{entity.lastModifierUserId}}</Filed> <Filed :span="12" :name="l('lastModifierUserId')">
{{entity.lastModifierUserId}}
<User :value="entity.lastModifierUserId"></User>
</Filed>
<Filed :span="12" :name="l('isDeleted')">{{entity.isDeleted}}</Filed> <Filed :span="12" :name="l('isDeleted')">{{entity.isDeleted}}</Filed>
<Filed :span="12" :name="l('deletionTime')">{{entity.deletionTime}}</Filed> <Filed :span="12" :name="l('deletionTime')">{{entity.deletionTime}}</Filed>
<Filed :span="12" :name="l('deleterUserId')">{{entity.deleterUserId}}</Filed> <Filed :span="12" :name="l('deleterUserId')">
{{entity.deleterUserId}}
<User :value="entity.deleterUserId"></User>
</Filed>
<Filed :span="12" :name="l('creator')">{{entity.creator}}</Filed> <Filed :span="12" :name="l('creator')">{{entity.creator}}</Filed>
<Filed :span="12" :name="l('lastModifier')">{{entity.lastModifier}}</Filed> <Filed :span="12" :name="l('lastModifier')">{{entity.lastModifier}}</Filed>
-->
</Row> </Row>
</div> </div>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
export default { export default {
...@@ -28,8 +42,16 @@ export default { ...@@ -28,8 +42,16 @@ export default {
downUrl: fileUrlDown, downUrl: fileUrlDown,
fileUrlPath: "", fileUrlPath: "",
rules: { rules: {
name: [{ required: true, message: "必填", trigger: "blur" }], name: [{
code: [{ required: true, message: "必填", trigger: "blur" }], required: true,
message: "必填",
trigger: "blur",
}, ],
code: [{
required: true,
message: "必填",
trigger: "blur",
}, ],
}, },
}; };
}, },
...@@ -43,7 +65,9 @@ export default { ...@@ -43,7 +65,9 @@ export default {
}, },
methods: { methods: {
load(v) { load(v) {
Api.get({ id: v }).then((r) => { Api.get({
id: v,
}).then((r) => {
this.entity = r.result; this.entity = r.result;
this.$emit("on-load"); this.$emit("on-load");
}); });
...@@ -52,8 +76,8 @@ export default { ...@@ -52,8 +76,8 @@ export default {
this.$emit("on-close"); this.$emit("on-close");
}, },
downFile(path) { downFile(path) {
alert(path) //alert(path)
let truePath = path.trim(); let truePath = path;
if (truePath.length > 2) { if (truePath.length > 2) {
if ( if (
truePath.substring(0, 7).toLowerCase() == "http://" || truePath.substring(0, 7).toLowerCase() == "http://" ||
......
<template> <template>
<div> <div class="h100">
<DataGrid :columns="columns" ref="grid" :action="action"> <DataGrid :columns="columns" ref="grid" :action="action">
<template slot="easySearch"> <template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline> <Form ref="formInline" :model="easySearch" inline>
...@@ -21,8 +21,9 @@ ...@@ -21,8 +21,9 @@
<Modal v-model="modal" :title="title" width="1200" :fullscreen="full" footer-hide> <Modal v-model="modal" :title="title" width="1200" :fullscreen="full" footer-hide>
<component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" /> <component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" />
</Modal> </Modal>
</div> </div>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
import Search from "./search"; import Search from "./search";
...@@ -32,7 +33,7 @@ export default { ...@@ -32,7 +33,7 @@ export default {
Search, Search,
}, },
head: { head: {
title: "导入中心记录", title: "导入中心",
author: "henq", author: "henq",
description: "import_center 8/20/2020 3:45:58 PM", description: "import_center 8/20/2020 3:45:58 PM",
}, },
...@@ -40,15 +41,17 @@ export default { ...@@ -40,15 +41,17 @@ export default {
return { return {
action: Api.index, action: Api.index,
easySearch: { easySearch: {
keys: { op: "name", value: null }, keys: {
op: "name",
value: null
},
}, },
modal: false, modal: false,
full:false, full: false,
title: "新增", title: "新增",
detail: null, detail: null,
curId: 0, curId: 0,
columns: [ columns: [{
{
key: "id", key: "id",
title: this.$t("id"), title: this.$t("id"),
hide: true, hide: true,
...@@ -73,7 +76,7 @@ export default { ...@@ -73,7 +76,7 @@ export default {
key: "creationTime", key: "creationTime",
title: this.l("creationTime"), title: this.l("creationTime"),
align: "center", align: "center",
width:"180", width: "180",
high: true, high: true,
}, },
{ {
...@@ -81,59 +84,65 @@ export default { ...@@ -81,59 +84,65 @@ export default {
title: this.l("creatorUserId"), title: this.l("creatorUserId"),
align: "left", align: "left",
high: true, high: true,
type:"user", type: "user",
width:"180", width: "180",
}, },
{ // {
key: "lastModificationTime", // key: "lastModificationTime",
title: this.l("lastModificationTime"), // title: this.l("lastModificationTime"),
align: "left", // align: "left",
high: true, // high: true,
hide: true, // hide: true,
}, // },
{ // {
key: "lastModifierUserId", // key: "lastModifierUserId",
title: this.l("lastModifierUserId"), // title: this.l("lastModifierUserId"),
align: "left", // align: "left",
high: true, // high: true,
hide: true, // hide: true,
}, // },
{ // {
key: "isDeleted", // key: "isDeleted",
title: this.l("isDeleted"), // title: this.l("isDeleted"),
align: "left", // align: "left",
high: true, // high: true,
hide: true, // hide: true,
}, // },
{ // {
key: "deletionTime", // key: "deletionTime",
title: this.l("deletionTime"), // title: this.l("deletionTime"),
align: "left", // align: "left",
high: true, // high: true,
hide: true, // hide: true,
}, // },
{ // {
key: "deleterUserId", // key: "deleterUserId",
title: this.l("deleterUserId"), // title: this.l("deleterUserId"),
align: "left", // align: "left",
high: true, // high: true,
hide: true, // hide: true,
}, // },
{ key: "creator", title: this.l("creator"), align: "left", high: true,hide: true, }, // {
{ // key: "creator",
key: "lastModifier", // title: this.l("creator"),
title: this.l("lastModifier"), // align: "left",
align: "left", // high: true,
high: true, // hide: true,
hide: true, // },
}, // {
// key: "lastModifier",
// title: this.l("lastModifier"),
// align: "left",
// high: true,
// hide: true,
// },
{ {
key: "status", key: "status",
title: this.l("status"), title: this.l("status"),
align: "center", align: "center",
high: true, high: true,
code: "mes.import_center.Status", code: "improt.im.status",
width:"150", width: "150",
}, },
{ {
title: "操作", title: "操作",
...@@ -141,28 +150,39 @@ export default { ...@@ -141,28 +150,39 @@ export default {
width: 140, width: 140,
align: "center", align: "center",
render: (h, params) => { render: (h, params) => {
return h("div", { class: "action" }, [ return h("div", {
class: "action"
}, [
h( h(
"op", "op", {
{ attrs: {
attrs: { oprate: "detail" }, oprate: "detail"
on: { click: () => this.view(params.row.id) }, },
on: {
click: () => this.view(params.row.id)
},
}, },
"查看" "查看"
), ),
h( h(
"op", "op", {
{ attrs: {
attrs: { oprate: "delete" }, oprate: "delete"
on: { click: () => this.remove(params.row.id) }, },
on: {
click: () => this.remove(params.row.id)
},
}, },
"删除" "删除"
), ),
h( h(
"op", "op", {
{ attrs: {
attrs: { oprate: "edit" }, oprate: "edit"
on: { click: () => this.process(params.row.id) }, },
on: {
click: () => this.process(params.row)
},
}, },
"处理" "处理"
), ),
...@@ -175,7 +195,10 @@ export default { ...@@ -175,7 +195,10 @@ export default {
mounted() { mounted() {
console.log(this); console.log(this);
}, },
async fetch({ store, params }) { async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
methods: { methods: {
...@@ -189,7 +212,7 @@ export default { ...@@ -189,7 +212,7 @@ export default {
}, },
add() { add() {
this.curId = 0; this.curId = 0;
this.full=false; this.full = false;
this.title = "新增"; this.title = "新增";
this.detail = () => import("./add"); this.detail = () => import("./add");
this.modal = true; this.modal = true;
...@@ -203,21 +226,21 @@ export default { ...@@ -203,21 +226,21 @@ export default {
view(id) { view(id) {
this.curId = id; this.curId = id;
this.title = "详情"; this.title = "详情";
this.full=false; this.full = false;
this.detail = () => import("./detail"); this.detail = () => import("./detail");
this.modal = true; this.modal = true;
}, },
edit(id) { edit(id) {
this.curId = id; this.curId = id;
this.title = "编辑"; this.title = "编辑";
this.full=false; this.full = false;
this.detail = () => import("./edit"); this.detail = () => import("./edit");
this.modal = true; this.modal = true;
}, },
process(id) { process(row) {
this.curId = id; this.curId = row.id;
this.title = "处理"; this.title = "处理文件:" + row.name;
this.full=true; this.full = true;
this.detail = () => import("./process"); this.detail = () => import("./process");
this.modal = true; this.modal = true;
}, },
...@@ -240,5 +263,6 @@ export default { ...@@ -240,5 +263,6 @@ export default {
}, },
}; };
</script> </script>
<style lang="less"> <style lang="less">
</style> </style>
<template> <template>
<div class="content"> <div class="content">
<DataGrid <TablePaste hide-table :input-props="inputProps" @on-success="handleSuccess" @on-error="handleError" v-show="showTablePaste" />
border <DataGrid border :height="tdHeightExcel" :columns="columnsImport" :data="excelData" :page="false" :set="false">
:height="tdHeightExcel"
:columns="columnsImport"
:data="excelData"
:page="false"
:set="false"
>
<template slot="easySearch"> <template slot="easySearch">
<Form inline> <Form inline>
<FormItem><dictionary code="plan.order.taskType" style="width:240px"></dictionary></FormItem> <FormItem>
<FormItem><Button type="primary" >预览</Button></FormItem> <span>导入到</span>
</FormItem>
<FormItem>
<dictionary code="import.im.page" style="width:160px" @on-change="pageChange" v-model="pageType"></dictionary>
</FormItem>
<FormItem>
<div class="tip mr20">{{excelData.length}}条数据</div>
</FormItem>
<FormItem>
<Button type="primary" @click="openInfoModal">导入</Button>
</FormItem>
</Form> </Form>
</template> </template>
<template slot="searchBack"> <template slot="buttons">
<Form inline>
<FormItem>
<Button @click="downFile">下载原始文件</Button>
</FormItem>
<FormItem>
<div style="height:34px;overflow: hidden;padding:0">
<Upload action :before-upload="beforeUpload" ref="uploadfile" :format="formatList"> <Upload action :before-upload="beforeUpload" ref="uploadfile" :format="formatList">
<Button icon="ios-cloud-upload-outline">重新上传</Button> <Button icon="ios-cloud-upload-outline" @click="resetParms">重新上传</Button>
</Upload> </Upload>
</div>
</FormItem>
<FormItem>
<Button @click="openPaste" :type="btnType" :ghost="ghostStatus">{{btnTxt}}</Button>
</FormItem>
<FormItem>
<Button @click="resetTable">还原到原始文件</Button>
</FormItem>
</Form>
</template> </template>
</DataGrid> </DataGrid>
<p class="tr pt10"> <FooterToolbar v-if="sheetNames.length>1">
<span v-if="excelData.length>0">共 {{excelData.length}} 条数据</span> <Form inline>
<Button @click="cancelExcel">取消</Button> <FormItem>
<Button type="primary">确定导入</Button> <Tabs :animated="false" :value="0" @on-click="sheetClick">
</p> <TabPane :label="item" v-for="(item,index) in sheetNames"></TabPane>
</div> </Tabs>
</FormItem>
</Form>
</FooterToolbar>
<Modal v-model="infoModal" title="提示信息" @on-ok="importOk">
<p>确定批量导入数据到<span class="red f16 fwBold ml10 mr10">用户管理</span>模块下?</p>
</Modal>
</div>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
import XLSX from "xlsx"; import XLSX from "xlsx";
import {
Switch
} from "view-design";
export default { export default {
name: "Edit", name: "Edit",
data() { data() {
return { return {
pageType: undefined,
tabVal: 0,
infoModal: false,
entity: {},
downUrl: fileUrlDown,
fileUrlPath: "",
disabled: false, disabled: false,
columns: [ columns0: [{
// {
// title: '序号',
// type: 'index',
// width: 80,
// align: 'center'
// },
{ key: "id", title: this.l("id"), hide: true, align: "left" },
{
key: "userName", key: "userName",
title: this.l("userName"), title: this.l("userName"),
align: "left", align: "left",
easy: true, easy: true,
high: true,
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{
attrs: { oprate: "detail" },
on: { click: () => this.detail(params.row.id) },
},
params.row.userName
),
]);
},
}, },
// {
// key: 'cardTypeId',
// title: this.l('cardTypeId'),
// align: 'left',
// high: true,
// hide: true
// },
{ {
key: "cardNo", key: "cardNo",
title: this.l("cardNo"), title: this.l("cardNo"),
...@@ -129,25 +135,29 @@ export default { ...@@ -129,25 +135,29 @@ export default {
high: true, high: true,
hide: true, hide: true,
render: (h, params) => { render: (h, params) => {
return h("div", { class: "action" }, [ return h(
"div", {
class: "action",
},
[
h( h(
"op", "op", {
{
attrs: { attrs: {
oprate: "detail", oprate: "detail",
class: class: params.row.roleTitles == null ||
params.row.roleTitles == null || params.row.roleTitles == "" ?
params.row.roleTitles == "" "empower" : "detail",
? "empower" },
: "detail", on: {
click: () => this.authorize(params.row.id),
}, },
on: { click: () => this.authorize(params.row.id) },
}, },
params.row.roleTitles == null || params.row.roleTitles == "" params.row.roleTitles == null || params.row.roleTitles == "" ?
? "授权" "授权" :
: params.row.roleTitles params.row.roleTitles
), ),
]); ]
);
}, },
}, },
{ {
...@@ -156,12 +166,6 @@ export default { ...@@ -156,12 +166,6 @@ export default {
hide: true, hide: true,
align: "left", align: "left",
}, },
// {
// key: 'userType',
// title: this.l('userType'),
// hide: true,
// align: 'left'
// },
{ {
key: "phone", key: "phone",
title: this.l("phone"), title: this.l("phone"),
...@@ -230,67 +234,101 @@ export default { ...@@ -230,67 +234,101 @@ export default {
align: "right", align: "right",
import: false, import: false,
render: (h, params) => { render: (h, params) => {
return h("div", { class: "action" }, [ return h(
"div", {
class: "action",
},
[
h( h(
"op", "op", {
{
attrs: { attrs: {
oprate: "detail", oprate: "detail",
class: "empower", class: "empower",
}, },
on: { click: () => this.syncAccount(params.row) }, on: {
click: () => this.syncAccount(params.row),
},
}, },
params.row.accountId == 0 ? "同步" : "" params.row.accountId == 0 ? "同步" : ""
), ),
h( h(
"op", "op", {
{ attrs: {
attrs: { oprate: "edit" }, oprate: "edit",
on: { click: () => this.edit(params.row.id) }, },
on: {
click: () => this.edit(params.row.id),
},
}, },
"编辑" "编辑"
), ),
h( h(
"op", "op", {
{ attrs: {
attrs: { oprate: "remove" }, oprate: "remove",
on: { click: () => this.remove(params.row) }, },
on: {
click: () => this.remove(params.row),
},
}, },
"删除" "删除"
), ),
h( h(
"op", "op", {
{
attrs: { attrs: {
oprate: "detail", oprate: "detail",
}, },
on: { click: () => this.openReset(params.row) }, on: {
click: () => this.openReset(params.row),
},
}, },
"重置密码" "重置密码"
), ),
]); ]
);
},
}, },
],
columns1: [{
key: "userName",
title: this.l("userName"),
align: "left",
},
{
key: "status",
title: this.l("status"),
align: "center",
code: "User.base.status",
}, },
], ],
tdHeightExcel: "",
excelData: [], excelData: [],
excelDataBack: [], //临时存储原始数据
formatList: ["xlsx"], formatList: ["xlsx"],
columnsImport: [], columnsImport: [],
departArr: [], //部门list departArr: [], //部门list
sheetNames: [], //excel的表明
workBook: {},
openDatas: [],
dataType: 0,
//粘贴excel内容start
btnType: "default",
ghostStatus: false,
btnTxt: "打开粘贴Excel",
showTablePaste: false,
inputProps: {
rows: 10,
placeholder: "请从Excel复制一段表格数据,粘贴在这里",
},
}; };
}, },
props: { props: {
eid: Number, eid: Number,
}, },
created() { created() {
this.tdHeightExcel = window.innerHeight - 240; this.tdHeightExcel = window.innerHeight - 180;
//导出对列表头进行预加载start //导出对列表头进行预加载start
let tempCol = this.$u.clone(this.columns);
tempCol.forEach((ele, index) => {
if (ele.key == "action") {
ele.hide = true;
}
});
this.columnsImport = tempCol;
this.$api.get(`${systemUrl}/Department/GetDepartments`).then((r) => { this.$api.get(`${systemUrl}/Department/GetDepartments`).then((r) => {
this.departArr = r.result.items; this.departArr = r.result.items;
}); });
...@@ -298,135 +336,374 @@ export default { ...@@ -298,135 +336,374 @@ export default {
//导出对列表头进行预加载end //导出对列表头进行预加载end
}, },
mounted() { mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
window.onresize = () => { window.onresize = () => {
///浏览器窗口大小变化 ///浏览器窗口大小变化
return (() => { return (() => {
window.screenHeight = window.innerHeight; window.screenHeight = window.innerHeight;
this.tdHeightExcel = window.innerHeight - 240; if (this.showTablePaste) {
this.tdHeightExcel = window.screenHeight - 180 - 220;
} else {
this.tdHeightExcel = window.screenHeight - 180;
}
})(); })();
}; };
}, },
methods: { methods: {
load(v) { load(v) {
Api.get({ id: v }).then((r) => { Api.get({
this.entity = r.result; id: v,
}).then((r) => {
this.entity = r.result || {};
}); });
}, this.dataType = 0;
handleSubmit() { this.sheetNames = [];
this.$refs.form.validate((v) => { this.excelData = [];
if (v) { this.excelDataBack = [];
this.disabled = true; Api.openExcel({
Api.update(this.entity) id: v,
.then((r) => { }).then((res) => {
this.disabled = false; if (res.success) {
if (r.success) { this.openDatas = res.result || [];
this.$Message.success("保存成功"); this.dealOpenTable(0);
this.$emit("on-ok"); //获取excel sheetname
} else { if (res.result.length > 0) {
this.$Message.error("保存失败"); res.result.forEach((el) => {
} this.sheetNames.push(el.title);
})
.catch((err) => {
this.disabled = false;
this.$Message.error("保存失败");
console.warn(err);
}); });
} }
});
},
//导入excel文件
async beforeUpload(file) {
this.excelData = [];
this.$refs.uploadfile.clearFiles(); //清除上一次上传文件列表
var tempColums = this.$u.clone(this.columnsImport);
const workbook = await this.$u.readXLSX(file);
const sheet2JSONOpts = {
defval: "", //给defval赋值为空的字符串
};
var csv = XLSX.utils.sheet_to_csv(
workbook.Sheets[workbook.SheetNames[0]],
sheet2JSONOpts
);
var lines = csv.split("\n"); //第一行标题
var headers = lines[0].split(",");
var arrTi = [];
//转换到colum后的list表头start
headers.forEach((elHead) => {
tempColums.forEach((elCol) => {
if (elHead == elCol.title) {
//elHead=elCol.key
arrTi.push(elCol.key);
} }
}); });
},
//加载原文件列表
dealOpenTable(val) {
this.excelData = this.openDatas[val].dataTable;
this.excelDataBack = this.openDatas[val].dataTable;
var tempCos = Object.keys(this.openDatas[val].dataTable[0]); //获取列表标题
this.columnsImport = [];
var headersNow = [];
tempCos.forEach((el) => {
let headObj = {};
headObj.title = el;
headObj.key = el;
headersNow.push(headObj);
}); });
headers = arrTi; this.columnsImport = headersNow;
//转换到colum后的list表头end },
var result = []; //重新处理colum
for (var i = 1; i < lines.length - 1; i++) { loadColum(columns) {
var obj = {}; let tempCol = this.$u.clone(columns);
var currentline = lines[i].split(","); tempCol.forEach((ele, index) => {
for (var j = 0; j < headers.length; j++) { if (ele.key == "action") {
obj[headers[j]] = currentline[j]; ele.hide = true;
}
result.push(obj);
} }
//对读取的excel文件数据进行处理 });
this.columnsImport = tempCol;
var arrTitleUse = []; //使用数据字典的字段 //处理原始数据和表头进行对应
tempColums.forEach((elCode) => { let temCol = this.$u.clone(this.columnsImport); //原始数据表头
let temColPage = this.$u.clone(columns); //需要显示的页面的表头
let temData = this.$u.clone(this.excelDataBack); //原始数据
let arrTitleUse = []; ////使用数据字典的字段
temColPage.forEach((elCode) => {
if (elCode.code) { if (elCode.code) {
arrTitleUse.push({ key: elCode.key, code: 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);
});
result.forEach((ele) => { //对列表里的数据字典项进行处理
useData.forEach(eles => {
//如果导入文件没有departmentid,但存在departmentTitle的话,通过title获取id //如果导入文件没有departmentid,但存在departmentTitle的话,通过title获取id
if ( if (
ele.departmentTitle && eles.departmentTitle &&
ele.departmentTitle != "" && eles.departmentTitle != "" &&
(!ele.departmentId || ele.departmentId == "") (!eles.departmentId || eles.departmentId == "")
) { ) {
this.departArr.forEach((e) => { this.departArr.forEach((e) => {
if (ele.departmentTitle && ele.departmentTitle == e.name) { if (eles.departmentTitle && eles.departmentTitle == e.name) {
ele.departmentId = e.id; eles.departmentId = e.id;
} }
}); });
} else if ( } else if (
//如果导入文件没有departmentTitle,但存在departmentid的话,通过id获取departmentTitle //如果导入文件没有departmentTitle,但存在departmentid的话,通过id获取departmentTitle
ele.departmentId && eles.departmentId &&
ele.departmentId + "" != "" && eles.departmentId + "" != "" &&
(!ele.departmentTitle || ele.departmentTitle == "") (!eles.departmentTitle || eles.departmentTitle == "")
) { ) {
this.departArr.forEach((e) => { this.departArr.forEach((e) => {
if (ele.departmentId && ele.departmentId == e.id) { if (eles.departmentId && eles.departmentId == e.id) {
ele.departmentTitle = e.name; eles.departmentTitle = e.name;
} }
}); });
} }
//对列表里的数据字典项进行处理
arrTitleUse.forEach((elem) => { arrTitleUse.forEach((elem) => {
if (ele[elem.key] && ele[elem.key] != "" && ele[elem.key] != null) { if (eles[elem.key] && eles[elem.key] != "" && eles[elem.key] != null) {
//如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值 //如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值
ele[elem.key] = this.$u.dirCode( eles[elem.key] = this.$u.dirCode(
this.$store.getters.dictionaryByKey(elem.code), this.$store.getters.dictionaryByKey(elem.code),
ele[elem.key] eles[elem.key]
); );
} }
}); });
})
this.excelData = useData;
},
//下载原excel文件
downFile() {
let truePath = this.entity.path;
if (truePath.length > 2) {
if (
truePath.substring(0, 7).toLowerCase() == "http://" ||
truePath.substring(0, 8).toLowerCase() == "https://"
) {
window.open(truePath, "_blank");
} else {
this.fileUrlPath = this.downUrl + this.entity.path;
window.open(this.fileUrlPath, "_blank");
}
}
},
//导入excel文件
//打开传时初始化
resetParms() {
this.pageType = undefined;
this.btnTxt = "打开粘贴Excel";
this.showTablePaste = false;
this.btnType = "default";
this.ghostStatus = false;
this.tdHeightExcel = window.innerHeight - 180;
},
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.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 = [];
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.excelData = result;
//console.log(workbook); this.excelDataBack = result;
return false; },
//切换sheet表重新加载
sheetClick(val) {
this.tabVal = val
if (this.dataType == 0) {
this.dealOpenTable(val);
} else {
this.dealSheet(val);
}
if (this.pageType != undefined) {
this.pageChange(this.pageType)
}
},
//选择导入的模块 0:用户管理
pageChange(val) {
switch (val) {
case 0:
this.loadColum(this.columns0);
break;
case 1:
this.loadColum(this.columns1);
break;
case undefined:
if (this.dataType == 0) {
this.load(this.eid);
} else {
this.dealSheet(this.tabVal);
}
break;
default:
this.loadColum(this.columns1);
}
}, },
handleClose() { handleClose() {
this.$emit("on-close"); this.$emit("on-close");
}, },
cancelExcel() { cancelExcel() {
this.excelData = []; this.excelData = [];
this.excelDataBack = [];
this.$refs.uploadfile.clearFiles(); this.$refs.uploadfile.clearFiles();
let parms = {
status: 1,
id: this.eid
}
//导入中心列表数据状态更新
Api.updateimportstatus(parms).then(res => {
if (res.success) {
this.$emit("on-ok");
}
})
this.$emit("on-close"); this.$emit("on-close");
}, },
//粘贴excel相关start
openPaste() {
if (this.btnTxt == "打开粘贴Excel") {
this.btnType = "primary";
this.ghostStatus = true;
this.showTablePaste = true;
this.btnTxt = "关闭粘贴Excel";
this.tdHeightExcel = window.innerHeight - 180 - 220;
} else {
this.btnType = "default";
this.ghostStatus = false;
this.showTablePaste = false;
this.btnTxt = "打开粘贴Excel";
this.tdHeightExcel = window.innerHeight - 180;
}
},
//粘贴excel成功
handleSuccess(tableData) {
//初始化数据
this.excelData = [];
this.excelDataBack = [];
this.columnsImport = [];
this.sheetNames = [];
this.pageType = undefined;
//处理colum和data
let tabColum = tableData.columns
let tabData = tableData.data
let arrData = []
tabData.forEach(ele => {
let objData = {}
tabColum.forEach(el => {
objData[el.title] = ele[el.key]
})
arrData.push(objData)
})
//处理title和key一致
tabColum.forEach(el => {
el.key = el.title
})
this.columnsImport = tabColum;
this.excelData = arrData;
this.excelDataBack = arrData;
},
//粘贴excel失败
handleError(tableData, errorIndex) {
//console.log(tableData, errorIndex);
this.$Message.error("表格数据有误");
},
//粘贴excel相关end
//重新加载excel
resetTable() {
this.pageType = undefined;
this.btnTxt = "打开粘贴Excel";
this.showTablePaste = false;
this.btnType = "default";
this.ghostStatus = false;
this.load(this.eid);
this.tdHeightExcel = window.innerHeight - 180;
},
openInfoModal() {
if (this.excelData.length > 0 && this.pageType != undefined) {
this.infoModal = true
} else {
if (this.excelData.length == 0) {
this.$Message.error("表【" + this.sheetNames[this.tabVal] + "】没有可导入的数据!")
} else if (this.pageType == undefined) {
this.$Message.error("请选择需要批量导入到的模块!")
}
}
},
//导入按钮操作
importOk() {
switch (this.pageType) {
case 0:
this.importUser();
break;
case 1:
this.loadColum(this.columns1);
break;
default:
this.loadColum(this.columns1);
}
},
//批量导入用户
importUser() {
let tempData = this.$u.clone(this.excelData);
let tempList = [];
tempData.forEach((ele) => {
let obj = {
userName: ele.userName,
cardNo: ele.cardNo,
gender: ele.gender,
birthday: ele.birthday,
degreeId: ele.degreeId,
departmentId: ele.departmentId,
status: ele.status,
phone: ele.phone,
email: ele.email,
licensedToWork: ele.licensedToWork,
positionId: ele.positionId,
titleId: ele.titleId,
departmentTitle: ele.departmentTitle,
};
tempList.push(obj);
});
let parms = {
list: tempList,
};
Api.importUser(parms).then((res) => {
if (res.success) {
this.$Message.success("批量导入用户管理成功!");
this.cancelExcel();
} else {
this.$Message.error("批量导入用户管理失败!");
}
});
},
l(key) { l(key) {
key = "user" + "." + key; key = "user" + "." + key;
return this.$t(key); return this.$t(key);
...@@ -441,3 +718,20 @@ export default { ...@@ -441,3 +718,20 @@ export default {
}, },
}; };
</script> </script>
<style lang="less">
.content {
.table-footer {
line-height: 45px;
background: #f5f5f5;
}
.ivu-footer-toolbar {
text-align: left;
.ivu-footer-toolbar-right {
float: left;
}
}
}
</style>
...@@ -24,17 +24,17 @@ ...@@ -24,17 +24,17 @@
<Col :span="12"> <Col :span="12">
<FormItem :label="l('levelNum')" prop="levelNum"> <FormItem :label="l('levelNum')" prop="levelNum">
<InputNumber v-model="entity.levelNum" disabled :max="10" :min="1"></InputNumber> <InputNumber v-model="entity.levelNum" :disabled="!(entity.isEdit)" :max="10" :min="1"></InputNumber>
</FormItem> </FormItem>
</Col> </Col>
<Col :span="12"> <Col :span="12">
<FormItem :label="l('codeLength')" prop="codeLength"> <FormItem :label="l('codeLength')" prop="codeLength">
<InputNumber v-model="entity.codeLength" disabled :max="5" :min="1"></InputNumber> <InputNumber v-model="entity.codeLength" :disabled="!(entity.isEdit)" :max="5" :min="1"></InputNumber>
</FormItem> </FormItem>
</Col> </Col>
<Col :span="12"> <Col :span="12">
<FormItem :label="l('materialCodeLength')" prop="materialCodeLength"> <FormItem :label="l('materialCodeLength')" prop="materialCodeLength">
<InputNumber v-model="entity.materialCodeLength" disabled :max="10" :min="1"></InputNumber> <InputNumber v-model="entity.materialCodeLength" :disabled="!(entity.isEdit)" :max="10" :min="1"></InputNumber>
</FormItem> </FormItem>
</Col> </Col>
<Col :span="24"> <Col :span="24">
......
{
"name": "admin",
"version": "1.0.0",
"description": "this is init project",
"author": "zhouyx",
"private": true
}
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