Commit f5568ee9 authored by renjintao's avatar renjintao

import

parent 367ceb3d
...@@ -21,10 +21,7 @@ ...@@ -21,10 +21,7 @@
</div> </div>
<div class="btns"> <div class="btns">
<slot name="buttons"></slot> <slot name="buttons"></slot>
<Button @click="openImportModal"> <Button @click="export2Excel" v-if="exportTitle.length>0">
导入
</Button>
<Button @click="export2Excel">
导出 导出
</Button> </Button>
<Button v-if="set&&type=='table'" @click="config=!config"> <Button v-if="set&&type=='table'" @click="config=!config">
...@@ -70,9 +67,7 @@ ...@@ -70,9 +67,7 @@
</li> </li>
</ul> </ul>
</Drawer> </Drawer>
<Modal v-model="ImportModal" title="导入" fullscreen footer-hide>
<ImportExcel v-if="ImportModal" @on-get-data="getData" :columns="columnsNow" />
</Modal>
<FooterToolbar v-if="batch" v-show="footerToolbar"> <FooterToolbar v-if="batch" v-show="footerToolbar">
<div class="tip">已选{{selectItems.length}}</div> <div class="tip">已选{{selectItems.length}}</div>
<slot name="batch"></slot> <slot name="batch"></slot>
...@@ -105,7 +100,6 @@ export default { ...@@ -105,7 +100,6 @@ export default {
userConfig: null, //用户页面配置信息。, userConfig: null, //用户页面配置信息。,
// userId: 1 // userId: 1
userId: this.$store.state.userInfo.userId, userId: this.$store.state.userInfo.userId,
ImportModal: false,
}; };
}, },
props: { props: {
...@@ -222,9 +216,9 @@ export default { ...@@ -222,9 +216,9 @@ export default {
type: Number, type: Number,
default: 40, default: 40,
}, },
title: { exportTitle: {
type: String, type: String,
default: "导出数据", default: "",
} }
}, },
created() { created() {
...@@ -476,17 +470,7 @@ export default { ...@@ -476,17 +470,7 @@ export default {
this.footerToolbar = false; this.footerToolbar = false;
this.$refs.table.selectAll(false); this.$refs.table.selectAll(false);
}, },
//导入功能
openImportModal() {
this.ImportModal = true
},
getData(val) {
// alert(JSON.stringify(val))
this.$emit("on-import-data", val)
},
closeImport() {
this.ImportModal = false
},
//导出excel //导出excel
export2Excel() { export2Excel() {
//当前显示数据 //当前显示数据
...@@ -531,7 +515,7 @@ export default { ...@@ -531,7 +515,7 @@ export default {
var tempCol = []; var tempCol = [];
var columnsCur = this.$u.clone(this.columnsNow); //导出列标题信息griddata this.$refs.grid.columnsCur var columnsCur = this.$u.clone(this.columnsNow); //导出列标题信息griddata this.$refs.grid.columnsCur
columnsCur.forEach((el) => { columnsCur.forEach((el) => {
if ((el.hide && !el.import) || (!el.hide && el.key != "action" && el.type != "selection")) { if ((el.hide && !el.import) || (!el.hide && el.key != "action" && el.type != "selection" && el.key != "ico")) {
if (el.code) { if (el.code) {
tempCol.push({ tempCol.push({
key: el.key, key: el.key,
...@@ -553,7 +537,7 @@ export default { ...@@ -553,7 +537,7 @@ export default {
}); });
let nowDate = this.$u.getNowTime(); //年月日时分秒yyyyMMddhhmmss let nowDate = this.$u.getNowTime(); //年月日时分秒yyyyMMddhhmmss
//获取导出数据结束 //获取导出数据结束
this.$u.outExcel(this.title + this.$u.outExcel(this.exportTitle +
"(" + nowDate + ")", "(" + nowDate + ")",
tHeader, tHeader,
filterVal, filterVal,
...@@ -561,7 +545,6 @@ export default { ...@@ -561,7 +545,6 @@ export default {
); );
}); });
}, },
//导入excel
}, },
computed: { computed: {
columnsNow() { columnsNow() {
......
<template> <template>
<div class="table-content"> <Modal v-model="ImportModal" title="导入" fullscreen footer-hide @on-cancel="cancelModal">
<div class="table-content">
<div class="table-tools"> <div class="table-tools">
<div class="table-search"> <div class="table-search">
<Form inline> <Form inline>
...@@ -55,7 +57,8 @@ ...@@ -55,7 +57,8 @@
<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>
</template> </template>
<script> <script>
...@@ -93,6 +96,8 @@ export default { ...@@ -93,6 +96,8 @@ export default {
titleInfo: '', titleInfo: '',
noDataText: '暂无数据', noDataText: '暂无数据',
imBtn: true, imBtn: true,
columnsIm: this.columns,
ImportModal: this.open
}; };
}, },
props: { props: {
...@@ -109,6 +114,10 @@ export default { ...@@ -109,6 +114,10 @@ export default {
type: Array, type: Array,
default: [], default: [],
}, },
open: {
type: Boolean,
default: false
}
}, },
created() { created() {
this.tdHeightExcel = window.innerHeight - 180; this.tdHeightExcel = window.innerHeight - 180;
...@@ -143,7 +152,7 @@ export default { ...@@ -143,7 +152,7 @@ export default {
title: '序号' title: '序号'
}) })
tempCol.forEach((ele, index) => { tempCol.forEach((ele, index) => {
if (ele.key == "action" || ele.type == "selection") { if (ele.key == "action" || ele.type == "selection" || ele.key == "ico") {
ele.hide = true; ele.hide = true;
} }
}); });
...@@ -298,7 +307,7 @@ export default { ...@@ -298,7 +307,7 @@ export default {
openInfoModal() { openInfoModal() {
if ((this.excelType == '0' && this.excelData.length > 0) || (this.excelType == '1' && this.$refs.comExcel.excelData.length > 0)) { if ((this.excelType == '0' && this.excelData.length > 0) || (this.excelType == '1' && this.$refs.comExcel.excelData.length > 0)) {
this.imBtn = true; this.imBtn = true;
this.loadColum(this.columns); this.loadColum(this.columnsIm);
this.titleInfo = "批量导入"; this.titleInfo = "批量导入";
this.infoModal = true this.infoModal = true
} else { } else {
...@@ -339,6 +348,9 @@ export default { ...@@ -339,6 +348,9 @@ export default {
this.btnIm = false this.btnIm = false
} }
}, },
cancelModal() {
this.$emit('on-cancel')
},
l(key) { l(key) {
key = "user" + "." + key; key = "user" + "." + key;
return this.$t(key); return this.$t(key);
...@@ -352,7 +364,11 @@ export default { ...@@ -352,7 +364,11 @@ export default {
} }
}); });
this.colsIm = this.$u.clone(this.columns); this.colsIm = this.$u.clone(this.columns);
this.columnsIm = this.$u.clone(this.columns)
}, },
open(v) {
this.ImportModal = v
}
}, },
}; };
</script> </script>
......
<template> <template>
<div class="h100"> <div class="h100">
<DataGrid :columns="columns" ref="grid" :action="action" title="导入中心"> <DataGrid :columns="columns" ref="grid" :action="action" exportTitle="导入中心">
<template slot="easySearch"> <template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline> <Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys"> <FormItem prop="keys">
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</div> </div>
<Content class="content" :class="!showMenu?'con_bord':''"> <Content class="content" :class="!showMenu?'con_bord':''">
<!--:data="dataT"--> <!--:data="dataT"-->
<DataGrid :action="action" :columns="columns" :conditions="easySearch" ref="grid" @on-selection-change="onSelect" :batch="true" :border="false" rowKey="id" title="订单管理" @on-import-data="onImportData"> <DataGrid :action="action" :columns="columns" :conditions="easySearch" ref="grid" @on-selection-change="onSelect" :batch="true" :border="false" rowKey="id" exportTitle="订单管理" @on-import-data="onImportData">
<template slot="easySearch"> <template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline> <Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys"> <FormItem prop="keys">
...@@ -1045,10 +1045,7 @@ export default { ...@@ -1045,10 +1045,7 @@ export default {
this.dataT = this.$u.clone(this.dataT); this.dataT = this.$u.clone(this.dataT);
}, },
//批量导入start //批量导入start
onImportData(val) {
alert(JSON.stringify(val))
this.$refs.grid.closeImport()
},
//批量导入end //批量导入end
} }
}; };
......
...@@ -44,5 +44,9 @@ export default { ...@@ -44,5 +44,9 @@ export default {
getmaterialdefinitionproperty(params){ getmaterialdefinitionproperty(params){
return Api.get(`${material}/custompropertydefinition/getmaterialdefinitionproperty`,params); return Api.get(`${material}/custompropertydefinition/getmaterialdefinitionproperty`,params);
}, },
//批量导入
import(params) {
return Api.post(`${resourceUrl}/resourceimportservice/import`, params);
},
} }
\ No newline at end of file
<template> <template>
<Layout class="full"> <Layout class="full">
<Sider hide-trigger v-if="showMenu" class="menu_side" width="300"> <Sider hide-trigger v-if="showMenu" class="menu_side" width="300">
<StoreTree @on-hide="onHide" @on-select="productSearch" /> <StoreTree @on-hide="onHide" @on-select="productSearch" />
</Sider> </Sider>
...@@ -9,25 +9,11 @@ ...@@ -9,25 +9,11 @@
</a> </a>
</div> </div>
<Content class="content" :class="!showMenu?'con_bord':''"> <Content class="content" :class="!showMenu?'con_bord':''">
<DataGrid <DataGrid :columns="columns" ref="grid" :action="action" :conditions="easySearch" :batch="true" :format="checkData" @all-change="allchange" @on-selection-change="onSelect" exportTitle="制造资源">
:columns="columns"
ref="grid"
:action="action"
:conditions="easySearch"
:batch="true"
:format="checkData"
@all-change="allchange"
@on-selection-change="onSelect"
>
<template slot="easySearch"> <template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline> <Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys"> <FormItem prop="keys">
<Input <Input clearable placeholder="请输入资源名称/资源编码/编码" v-model.trim="easySearch.keys.value" v-width="260" />
clearable
placeholder="请输入资源名称/资源编码/编码"
v-model.trim="easySearch.keys.value"
v-width="260"
/>
</FormItem> </FormItem>
<FormItem> <FormItem>
<Button type="primary" @click="search">查询</Button> <Button type="primary" @click="search">查询</Button>
...@@ -43,29 +29,20 @@ ...@@ -43,29 +29,20 @@
<Badge :count="this.$store.state.count" overflow-count="99" style="margin-right:5px;"> <Badge :count="this.$store.state.count" overflow-count="99" style="margin-right:5px;">
<Button icon="md-cart" @click="showCart">借出车</Button> <Button icon="md-cart" @click="showCart">借出车</Button>
</Badge> </Badge>
<Button @click="openModalIm">导入</Button>
</template> </template>
<template slot="batch"> <template slot="batch">
<Button type="primary" class="mr10 ml10" @click="addCart">加入借出车</Button> <Button type="primary" class="mr10 ml10" @click="addCart">加入借出车</Button>
</template> </template>
</DataGrid> </DataGrid>
<Modal v-model="modal" :title="title" width="1200" footer-hide :fullscreen="fscreeen"> <Modal v-model="modal" :title="title" width="1200" footer-hide :fullscreen="fscreeen">
<component <component :is="detail" :eid="curId" :rootName="rootName" :storeTitle="storeTitle" :materialType="materialType" :storeId="storeId" :mcode="mCode" :cartList="this.$u.clone(this.$store.state.cart)" @on-close="cancel" @on-ok="ok" @substr="substr" />
:is="detail"
:eid="curId"
:rootName="rootName"
:storeTitle="storeTitle"
:materialType="materialType"
:storeId="storeId"
:mcode="mCode"
:cartList="this.$u.clone(this.$store.state.cart)"
@on-close="cancel"
@on-ok="ok"
@substr="substr"
/>
</Modal> </Modal>
<ImportExcel ref="importExcel" :open="ModalIm" @on-get-data="getData" :columns="columnsNow" @on-cancel="ModalImCancel" />
</Content> </Content>
</Layout> </Layout>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
import Search from "./search"; import Search from "./search";
...@@ -84,7 +61,10 @@ export default { ...@@ -84,7 +61,10 @@ export default {
action: Api.index, action: Api.index,
showMenu: true, showMenu: true,
easySearch: { easySearch: {
keys: { op: "nameOfResource,code,resourceCode", value: null }, keys: {
op: "nameOfResource,code,resourceCode",
value: null
},
}, },
fscreeen: false, fscreeen: false,
modal: false, modal: false,
...@@ -96,8 +76,7 @@ export default { ...@@ -96,8 +76,7 @@ export default {
storeTitle: "", storeTitle: "",
materialType: "", materialType: "",
mCode: "", mCode: "",
columns: [ columns: [{
{
key: "selection", key: "selection",
type: "selection", type: "selection",
width: 50, width: 50,
...@@ -119,13 +98,17 @@ export default { ...@@ -119,13 +98,17 @@ export default {
high: true, high: true,
width: 60, width: 60,
render: (h, params) => { render: (h, params) => {
return h("div", { class: "action" }, [ return h("div", {
class: "action"
}, [
h(params.row.numberAvailable > 0 ? "op" : "", { h(params.row.numberAvailable > 0 ? "op" : "", {
attrs: { attrs: {
icon: "ios-cart-outline", icon: "ios-cart-outline",
type: "icon", type: "icon",
}, },
on: { click: () => this.addCart(params.row) }, on: {
click: () => this.addCart(params.row)
},
}), }),
]); ]);
}, },
...@@ -266,32 +249,35 @@ export default { ...@@ -266,32 +249,35 @@ export default {
title: "操作", title: "操作",
width: 190, width: 190,
align: "center", align: "center",
key: "action",
hide: false, hide: false,
render: (h, params) => { render: (h, params) => {
return h("div", { class: "action" }, [ return h("div", {
class: "action"
}, [
h( h(
"op", "op", {
{
attrs: { attrs: {
oprate: "delete", oprate: "delete",
title: "删除", title: "删除",
}, },
class: class: params.row.totalNum === params.row.numberAvailable ?
params.row.totalNum === params.row.numberAvailable "remove" : "disable",
? "remove" on: {
: "disable", click: () => this.remove(params.row)
on: { click: () => this.remove(params.row) }, },
}, },
"删除" "删除"
), ),
h( h(
"op", "op", {
{
attrs: { attrs: {
oprate: "detail", oprate: "detail",
title: "查看日志", title: "查看日志",
}, },
on: { click: () => this.logDetail(params.row.id) }, on: {
click: () => this.logDetail(params.row.id)
},
}, },
"查看日志" "查看日志"
), ),
...@@ -307,6 +293,8 @@ export default { ...@@ -307,6 +293,8 @@ export default {
cartList: [], cartList: [],
cartListCount: 0, cartListCount: 0,
selectRows: [], selectRows: [],
//导入
ModalIm: false,
}; };
}, },
created() { created() {
...@@ -321,7 +309,10 @@ export default { ...@@ -321,7 +309,10 @@ export default {
})(); })();
}; };
}, },
async fetch({ store, params }) { async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
computed: {}, computed: {},
...@@ -380,7 +371,10 @@ export default { ...@@ -380,7 +371,10 @@ export default {
newArr.forEach((item2, index, thisArr) => { newArr.forEach((item2, index, thisArr) => {
if (item.id == item2.id) { if (item.id == item2.id) {
hasPush = true; hasPush = true;
thisArr[index] = { ...item, ...item2 }; thisArr[index] = {
...item,
...item2
};
return; return;
} }
}); });
...@@ -489,7 +483,12 @@ export default { ...@@ -489,7 +483,12 @@ export default {
this.storeTitle = item.title; this.storeTitle = item.title;
this.rootName = rootName.join(" / "); this.rootName = rootName.join(" / ");
this.materialType = item.materialType; this.materialType = item.materialType;
let where = { storeId: { op: "In", value: ids } }; let where = {
storeId: {
op: "In",
value: ids
}
};
this.$refs.grid.reload(where); this.$refs.grid.reload(where);
}, },
setNum(row) { setNum(row) {
...@@ -499,6 +498,66 @@ export default { ...@@ -499,6 +498,66 @@ export default {
this.fscreeen = false; this.fscreeen = false;
this.modal = true; this.modal = true;
}, },
//批量导入start
//导入功能
openModalIm() {
this.ModalIm = true
},
ModalImCancel() {
this.ModalIm = false
},
getData(val) {
alert(JSON.stringify(val))
},
onImportData(val) {
//alert(JSON.stringify(val))
//this.$refs.grid.closeImport()
//this.$refs.grid.closeImport(url, coloums, format, ok);
this.$refs.importExcel.deelData(url, coloums, format, ok)
let tempData = this.$u.clone(val);
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,
//};
//if (ele.userName && ele.userName != '' && ele.cardNo && ele.cardNo != '' && ele.departmentId && ele.departmentId != '' && ele.phone && ele.phone != '') {
// tempList.push(obj);
// }
// });
tempList = tempData
if (tempList.length == 0) {
this.$Message.error("所有导入的数据均不合法!");
} else {
let parms = {
list: tempList,
};
alert(JSON.stringify(tempList))
//Api.import(parms).then((res) => {
//if (res.success) {
//this.$Message.success("成功批量导入用户管理成功模块 " + tempList.length + " 条数据");
//this.imBtn = false;
//this.$refs.grid.closeImport()
// } else {
// this.$Message.error("批量导入用户管理失败!");
//}
//});
}
},
//批量导入end
l(key) { l(key) {
let vkey = "resource" + "." + key; let vkey = "resource" + "." + key;
return this.$t(vkey) || key; return this.$t(vkey) || key;
...@@ -506,15 +565,19 @@ export default { ...@@ -506,15 +565,19 @@ export default {
}, },
}; };
</script> </script>
<style lang="less"> <style lang="less">
.full { .full {
margin-top: 0; margin-top: 0;
.content { .content {
margin-top: 10px; margin-top: 10px;
padding-top: 10px; padding-top: 10px;
.ivu-icon-ios-add:before { .ivu-icon-ios-add:before {
content: "\f341"; content: "\f341";
} }
.ivu-icon-ios-remove:before { .ivu-icon-ios-remove:before {
content: "\f33d"; content: "\f33d";
} }
......
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