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-tools"> <div class="table-content">
<div class="table-search">
<Form inline>
<FormItem>
<div style="height:34px;overflow: hidden;padding:0">
<Upload action :before-upload="beforeUpload" ref="uploadfile" :format="formatList">
<Button icon="ios-cloud-upload-outline">上传文件</Button>
</Upload>
</div>
</FormItem>
<FormItem>
<Button type="primary" @click="openInfoModal" :disabled="btnIm">导入</Button>
</FormItem>
</Form> <div class="table-tools">
<div class="table-search">
<Form inline>
<FormItem>
<div style="height:34px;overflow: hidden;padding:0">
<Upload action :before-upload="beforeUpload" ref="uploadfile" :format="formatList">
<Button icon="ios-cloud-upload-outline">上传文件</Button>
</Upload>
</div>
</FormItem>
<FormItem>
<Button type="primary" @click="openInfoModal" :disabled="btnIm">导入</Button>
</FormItem>
</Form>
</div>
<div class="btns">
<Form inline>
<FormItem>
<RadioGroup v-model="excelType" type="button" @on-change="changeExcel" size="small">
<Tooltip content="文件数据">
<Radio label="0">
<Icon type="ios-list-box-outline" />
</Radio>
</Tooltip>
<Tooltip content="粘贴Excel数据">
<Radio label="1">
<Icon type="ios-copy" />
</Radio>
</Tooltip>
</RadioGroup>
</FormItem>
</Form>
</div>
</div> </div>
<div class="btns"> <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>
<component :is="detailExcel" ref="comExcel" @on-datalength="datalength" />
</div>
<FooterToolbar v-if="sheetNames.length>1&&tableImport">
<Form inline> <Form inline>
<FormItem> <FormItem>
<RadioGroup v-model="excelType" type="button" @on-change="changeExcel" size="small"> <Tabs :animated="false" :value="0" @on-click="sheetClick">
<Tooltip content="文件数据"> <TabPane :label="item" v-for="(item,index) in sheetNames" :key="index"></TabPane>
<Radio label="0"> </Tabs>
<Icon type="ios-list-box-outline" />
</Radio>
</Tooltip>
<Tooltip content="粘贴Excel数据">
<Radio label="1">
<Icon type="ios-copy" />
</Radio>
</Tooltip>
</RadioGroup>
</FormItem> </FormItem>
</Form> </Form>
</div> </FooterToolbar>
<Modal v-model="infoModal" :title="titleInfo" fullscreen>
<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>
<div class="table-main" ref="main"> </Modal>
<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">
<Form inline>
<FormItem>
<Tabs :animated="false" :value="0" @on-click="sheetClick">
<TabPane :label="item" v-for="(item,index) in sheetNames" :key="index"></TabPane>
</Tabs>
</FormItem>
</Form>
</FooterToolbar>
<Modal v-model="infoModal" :title="titleInfo" fullscreen>
<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>
</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>
<div v-if="!showMenu" class="show_menu"> <div v-if="!showMenu" class="show_menu">
<a class="menu_play fr" @click="showMenuFn" title="展开"> <a class="menu_play fr" @click="showMenuFn" title="展开">
<Icon type="ios-arrow-forward" size="24" /> <Icon type="ios-arrow-forward" size="24" />
</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" <template slot="easySearch">
ref="grid" <Form ref="formInline" :model="easySearch" inline>
:action="action" <FormItem prop="keys">
:conditions="easySearch" <Input clearable placeholder="请输入资源名称/资源编码/编码" v-model.trim="easySearch.keys.value" v-width="260" />
:batch="true" </FormItem>
:format="checkData" <FormItem>
@all-change="allchange" <Button type="primary" @click="search">查询</Button>
@on-selection-change="onSelect" </FormItem>
> <FormItem>
<template slot="easySearch"> <a href="#" @click="lendingRecord" class="ml20">借出记录</a>
<Form ref="formInline" :model="easySearch" inline> </FormItem>
<FormItem prop="keys"> </Form>
<Input </template>
clearable <template slot="buttons">
placeholder="请输入资源名称/资源编码/编码" <Button type="primary" @click="add">入库</Button>
v-model.trim="easySearch.keys.value" <!-- <Button type="primary" @click="returnModel=true">归还</Button> -->
v-width="260" <Badge :count="this.$store.state.count" overflow-count="99" style="margin-right:5px;">
/> <Button icon="md-cart" @click="showCart">借出车</Button>
</FormItem> </Badge>
<FormItem> <Button @click="openModalIm">导入</Button>
<Button type="primary" @click="search">查询</Button> </template>
</FormItem> <template slot="batch">
<FormItem> <Button type="primary" class="mr10 ml10" @click="addCart">加入借出车</Button>
<a href="#" @click="lendingRecord" class="ml20">借出记录</a> </template>
</FormItem> </DataGrid>
</Form> <Modal v-model="modal" :title="title" width="1200" footer-hide :fullscreen="fscreeen">
</template> <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" />
<template slot="buttons"> </Modal>
<Button type="primary" @click="add">入库</Button> <ImportExcel ref="importExcel" :open="ModalIm" @on-get-data="getData" :columns="columnsNow" @on-cancel="ModalImCancel" />
<!-- <Button type="primary" @click="returnModel=true">归还</Button> -->
<Badge :count="this.$store.state.count" overflow-count="99" style="margin-right:5px;">
<Button icon="md-cart" @click="showCart">借出车</Button>
</Badge>
</template>
<template slot="batch">
<Button type="primary" class="mr10 ml10" @click="addCart">加入借出车</Button>
</template>
</DataGrid>
<Modal v-model="modal" :title="title" width="1200" footer-hide :fullscreen="fscreeen">
<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"
/>
</Modal>
</Content> </Content>
</Layout> </Layout>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
import Search from "./search"; import Search from "./search";
export default { export default {
name: "list", name: "list",
components: { components: {
Search, Search,
}, },
// head: { // head: {
// title: "库存表", // title: "库存表",
// author: "henq", // author: "henq",
// description: "stock 7/13/2020 11:48:09 AM", // description: "stock 7/13/2020 11:48:09 AM",
// }, // },
data() { data() {
return { return {
action: Api.index, action: Api.index,
showMenu: true, showMenu: true,
easySearch: { easySearch: {
keys: { op: "nameOfResource,code,resourceCode", value: null }, keys: {
}, op: "nameOfResource,code,resourceCode",
fscreeen: false, value: null
modal: false, },
title: "新增", },
detail: null, fscreeen: false,
curId: 0, modal: false,
storeId: null, title: "新增",
rootName: "", detail: null,
storeTitle: "", curId: 0,
materialType: "", storeId: null,
mCode: "", rootName: "",
columns: [ storeTitle: "",
{ materialType: "",
key: "selection", mCode: "",
type: "selection", columns: [{
width: 50, key: "selection",
align: "center", type: "selection",
}, width: 50,
{ align: "center",
key: "id", },
title: this.l("id"), {
hide: true, key: "id",
align: "left", title: this.l("id"),
sortable: true, hide: true,
}, align: "left",
sortable: true,
},
{
key: "ico",
title: " ",
align: "center",
easy: true,
high: true,
width: 60,
render: (h, params) => {
return h("div", {
class: "action"
}, [
h(params.row.numberAvailable > 0 ? "op" : "", {
attrs: {
icon: "ios-cart-outline",
type: "icon",
},
on: {
click: () => this.addCart(params.row)
},
}),
]);
},
},
{ {
key: "ico", key: "resourceCode",
title: " ", title: this.l("resourceId"),
align: "center", align: "left",
easy: true, easy: true,
high: true, },
width: 60, {
render: (h, params) => { key: "nameOfResource",
return h("div", { class: "action" }, [ title: this.l("nameOfResource"),
h(params.row.numberAvailable > 0 ? "op" : "", { align: "left",
attrs: { easy: true,
icon: "ios-cart-outline", tooltip: true,
type: "icon", },
{
key: "code",
title: "编码",
align: "left",
},
// {
// key: "creationTime",
// title: this.l("creationTime"),
// sortable: true,
// hide: true,
// align: "left",
// },
{
key: "creatorUserId",
title: this.l("creatorUserId"),
hide: false,
type: "user",
align: "left",
},
{
key: "lastModificationTime",
title: this.l("lastModificationTime"),
hide: true,
align: "left",
},
{
key: "lastModifierUserId",
title: this.l("lastModifierUserId"),
hide: true,
align: "left",
},
{
key: "isDeleted",
title: this.l("isDeleted"),
hide: true,
align: "left",
},
{
key: "deletionTime",
title: this.l("deletionTime"),
hide: true,
align: "left",
},
{
key: "deleterUserId",
title: this.l("deleterUserId"),
hide: true,
align: "left",
},
// {
// key: "specifications",
// title: this.l("specifications"),
// align: "left",
// easy: true,
// high: true,
// },
{
key: "totalNum",
title: this.l("totalNum"),
align: "left",
easy: true,
},
{
key: "numberAvailable",
title: this.l("numberAvailable"),
align: "left",
easy: true,
},
{
key: "measuringUnit",
title: this.l("measuringUnit"),
align: "left",
easy: true,
high: true,
hide: true,
},
{
key: "qualityCharacteristics",
title: this.l("qualityCharacteristics"),
align: "left",
easy: true,
high: true,
hide: true,
},
{
key: "batchNo",
title: this.l("batchNo"),
align: "left",
easy: true,
high: true,
hide: true,
},
{
key: "storeId",
title: this.l("storeId"),
align: "left",
high: true,
hide: true,
},
{
key: "storeTitle",
title: this.l("storeTitle"),
align: "left",
},
{
key: "state",
title: this.l("state"),
align: "left",
code: "mes_xingchi_resource.resource.state",
},
// {
// key: "resourceType",
// title: this.l("resourceType"),
// align: "left",
// high: true,
// code: "mes_xingchi_resource.resource.resource_type",
// },
{
title: "操作",
width: 190,
align: "center",
key: "action",
hide: false,
render: (h, params) => {
return h("div", {
class: "action"
}, [
h(
"op", {
attrs: {
oprate: "delete",
title: "删除",
},
class: params.row.totalNum === params.row.numberAvailable ?
"remove" : "disable",
on: {
click: () => this.remove(params.row)
},
},
"删除"
),
h(
"op", {
attrs: {
oprate: "detail",
title: "查看日志",
},
on: {
click: () => this.logDetail(params.row.id)
},
},
"查看日志"
),
]);
},
}, },
on: { click: () => this.addCart(params.row) }, ],
}), treeData: [],
]); ocolumn: [],
}, treeHeight: "",
ids: [],
list: [],
cartList: [],
cartListCount: 0,
selectRows: [],
//导入
ModalIm: false,
};
},
created() {
this.treeHeight = window.innerHeight - 150;
},
mounted() {
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.treeHeight = window.screenHeight - 150;
})();
};
},
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
computed: {},
methods: {
checkData(items) {
// console.warn("items", items);
return items.map((u) => {
u._disabled = u.numberAvailable <= 0;
u._checked = false;
return u;
});
}, },
{ allchange(item) {
key: "resourceCode", this.selectRows = [];
title: this.l("resourceId"), this.selectRows = item;
align: "left", },
easy: true, onSelect(item) {
this.selectRows = [];
this.selectRows = item;
}, },
{
key: "nameOfResource", //加入借出车
title: this.l("nameOfResource"), addCart(arr) {
align: "left", this.cartListCount = this.$store.state.count;
easy: true, this.cartList = this.$store.state.cart;
tooltip: true, // console.log(this.cartListCount);
// console.log(this.cartList);
// console.log(this.selectRows);
if (arr.id) {
let id = arr.id;
if (arr.numberAvailable > 0) {
const index = this.$store.state.cart.findIndex(function (item) {
return item.id === id;
});
// console.log(index);
if (index == -1) {
arr.numberAvailable1 = arr.numberAvailable; //用于最大借出数量
this.cartList.push(arr);
this.cartListCount += 1;
this.$store.commit("setCart", this.cartList);
this.$store.commit("setCartCount", this.cartListCount);
this.$Message.success("加入借出车成功");
} else {
this.$Message.error("已加入借出车");
}
} else {
this.$Message.error("资源无库存");
}
} else {
// this.$Message.success("已加入借出车,请在借出车查看");
let arr = this.selectRows.concat(this.cartList); //两个数组对象合并
let newArr = []; //盛放去重后数据的新数组
arr.forEach(function (item) {
let hasPush = false;
newArr.forEach((item2, index, thisArr) => {
if (item.id == item2.id) {
hasPush = true;
thisArr[index] = {
...item,
...item2
};
return;
}
});
!hasPush && newArr.push(item);
});
this.cartList = newArr;
this.cartListCount = newArr.length;
this.$store.commit("setCart", this.cartList);
this.$store.commit("setCartCount", this.cartListCount);
this.$refs.grid.load();
this.$refs.grid.footerToolbar = false;
}
}, },
{ //移除借出车
key: "code", substr(value, index) {
title: "编码", // console.log(value);
align: "left", // console.log(index);
if (index > -1) {
this.cartListCount -= value;
this.cartList.splice(index, 1);
if (value == 0 || this.cartList.length == 0) {
this.cartListCount = 0;
}
this.$store.commit("setCart", this.cartList);
this.$store.commit("setCartCount", this.cartListCount);
} else {
this.cartListCount = 0;
this.cartList = [];
this.$store.commit("setCart", this.cartList);
this.$store.commit("setCartCount", this.cartListCount);
}
// console.log(this.$store.state.count);
// console.log(this.$store.state.cart);
}, },
// { showCart() {
// key: "creationTime", if (this.$store.state.count > 0) {
// title: this.l("creationTime"), this.title = "借出车";
// sortable: true, this.detail = () => import("./cart");
// hide: true, this.fscreeen = false;
// align: "left", this.modal = true;
// }, } else {
{ this.$Message.error("请将资源加入借出车");
key: "creatorUserId", }
title: this.l("creatorUserId"),
hide: false,
type: "user",
align: "left",
}, },
{ lendingRecord() {
key: "lastModificationTime", // window.open("/resource/resource/record", "_blank");
title: this.l("lastModificationTime"), this.$router.push("/resource/resource/record");
hide: true,
align: "left",
}, },
{ ok() {
key: "lastModifierUserId", this.$refs.grid.load();
title: this.l("lastModifierUserId"), this.modal = false;
hide: true, this.fscreeen = false;
align: "left", this.cartList = [];
// this.curId = 0;
}, },
{ search() {
key: "isDeleted", this.$refs.grid.reload(this.easySearch);
title: this.l("isDeleted"),
hide: true,
align: "left",
}, },
{ add() {
key: "deletionTime", if (this.curId) {
title: this.l("deletionTime"), this.title = "新增";
hide: true, this.detail = () => import("./add");
align: "left", this.fscreeen = false;
this.modal = true;
} else {
this.$Message.error("请先选择库房库位");
}
}, },
{ copy(id) {
key: "deleterUserId", this.curId = id;
title: this.l("deleterUserId"), this.title = "克隆";
hide: true, this.detail = () => import("./add");
align: "left", this.modal = true;
}, },
// { remove(id) {
// key: "specifications", Api.delete(id).then((r) => {
// title: this.l("specifications"), if (r.success) {
// align: "left", this.$refs.grid.load();
// easy: true, this.$Message.success("删除成功");
// high: true, }
// }, });
{
key: "totalNum",
title: this.l("totalNum"),
align: "left",
easy: true,
}, },
{ logDetail(id) {
key: "numberAvailable", this.curId = id;
title: this.l("numberAvailable"), this.title = "查看日志";
align: "left", this.detail = () => import("./log");
easy: true, this.fscreeen = false;
this.modal = true;
}, },
{ cancel() {
key: "measuringUnit", this.curId = 0;
title: this.l("measuringUnit"), this.modal = false;
align: "left",
easy: true,
high: true,
hide: true,
}, },
{ onHide() {
key: "qualityCharacteristics", // this.$Message.info("收起左侧树")
title: this.l("qualityCharacteristics"), this.showMenu = false;
align: "left",
easy: true,
high: true,
hide: true,
}, },
{ showMenuFn() {
key: "batchNo", //this.$Message.info("展开左侧树")
title: this.l("batchNo"), this.showMenu = true;
align: "left",
easy: true,
high: true,
hide: true,
}, },
{ productSearch(item, ids, rootName) {
key: "storeId", // console.log(item);
title: this.l("storeId"), this.curId = item.id;
align: "left", this.storeTitle = item.title;
high: true, this.rootName = rootName.join(" / ");
hide: true, this.materialType = item.materialType;
let where = {
storeId: {
op: "In",
value: ids
}
};
this.$refs.grid.reload(where);
}, },
{ setNum(row) {
key: "storeTitle", this.curId = row.id;
title: this.l("storeTitle"), this.title = "预警";
align: "left", // this.detail = () => import("./setNum");
this.fscreeen = false;
this.modal = true;
}, },
{ //批量导入start
key: "state", //导入功能
title: this.l("state"), openModalIm() {
align: "left", this.ModalIm = true
code: "mes_xingchi_resource.resource.state",
}, },
// { ModalImCancel() {
// key: "resourceType", this.ModalIm = false
// title: this.l("resourceType"),
// align: "left",
// high: true,
// code: "mes_xingchi_resource.resource.resource_type",
// },
{
title: "操作",
width: 190,
align: "center",
hide: false,
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{
attrs: {
oprate: "delete",
title: "删除",
},
class:
params.row.totalNum === params.row.numberAvailable
? "remove"
: "disable",
on: { click: () => this.remove(params.row) },
},
"删除"
),
h(
"op",
{
attrs: {
oprate: "detail",
title: "查看日志",
},
on: { click: () => this.logDetail(params.row.id) },
},
"查看日志"
),
]);
},
}, },
], getData(val) {
treeData: [], alert(JSON.stringify(val))
ocolumn: [],
treeHeight: "",
ids: [],
list: [],
cartList: [],
cartListCount: 0,
selectRows: [],
};
},
created() {
this.treeHeight = window.innerHeight - 150;
},
mounted() {
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.treeHeight = window.screenHeight - 150;
})();
};
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
computed: {},
methods: {
checkData(items) {
// console.warn("items", items);
return items.map((u) => {
u._disabled = u.numberAvailable <= 0;
u._checked = false;
return u;
});
},
allchange(item) { },
this.selectRows = []; onImportData(val) {
this.selectRows = item; //alert(JSON.stringify(val))
}, //this.$refs.grid.closeImport()
onSelect(item) { //this.$refs.grid.closeImport(url, coloums, format, ok);
this.selectRows = []; this.$refs.importExcel.deelData(url, coloums, format, ok)
this.selectRows = item; 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);
// }
//加入借出车 // });
addCart(arr) { tempList = tempData
this.cartListCount = this.$store.state.count; if (tempList.length == 0) {
this.cartList = this.$store.state.cart; this.$Message.error("所有导入的数据均不合法!");
// console.log(this.cartListCount); } else {
// console.log(this.cartList); let parms = {
// console.log(this.selectRows); list: tempList,
if (arr.id) { };
let id = arr.id; alert(JSON.stringify(tempList))
if (arr.numberAvailable > 0) { //Api.import(parms).then((res) => {
const index = this.$store.state.cart.findIndex(function (item) { //if (res.success) {
return item.id === id; //this.$Message.success("成功批量导入用户管理成功模块 " + tempList.length + " 条数据");
}); //this.imBtn = false;
// console.log(index); //this.$refs.grid.closeImport()
if (index == -1) { // } else {
arr.numberAvailable1 = arr.numberAvailable; //用于最大借出数量 // this.$Message.error("批量导入用户管理失败!");
this.cartList.push(arr); //}
this.cartListCount += 1; //});
this.$store.commit("setCart", this.cartList);
this.$store.commit("setCartCount", this.cartListCount);
this.$Message.success("加入借出车成功");
} else {
this.$Message.error("已加入借出车");
}
} else {
this.$Message.error("资源无库存");
}
} else {
// this.$Message.success("已加入借出车,请在借出车查看");
let arr = this.selectRows.concat(this.cartList); //两个数组对象合并
let newArr = []; //盛放去重后数据的新数组
arr.forEach(function (item) {
let hasPush = false;
newArr.forEach((item2, index, thisArr) => {
if (item.id == item2.id) {
hasPush = true;
thisArr[index] = { ...item, ...item2 };
return;
} }
}); },
!hasPush && newArr.push(item); //批量导入end
}); l(key) {
this.cartList = newArr; let vkey = "resource" + "." + key;
this.cartListCount = newArr.length; return this.$t(vkey) || key;
this.$store.commit("setCart", this.cartList); },
this.$store.commit("setCartCount", this.cartListCount);
this.$refs.grid.load();
this.$refs.grid.footerToolbar = false;
}
},
//移除借出车
substr(value, index) {
// console.log(value);
// console.log(index);
if (index > -1) {
this.cartListCount -= value;
this.cartList.splice(index, 1);
if (value == 0 || this.cartList.length == 0) {
this.cartListCount = 0;
}
this.$store.commit("setCart", this.cartList);
this.$store.commit("setCartCount", this.cartListCount);
} else {
this.cartListCount = 0;
this.cartList = [];
this.$store.commit("setCart", this.cartList);
this.$store.commit("setCartCount", this.cartListCount);
}
// console.log(this.$store.state.count);
// console.log(this.$store.state.cart);
},
showCart() {
if (this.$store.state.count > 0) {
this.title = "借出车";
this.detail = () => import("./cart");
this.fscreeen = false;
this.modal = true;
} else {
this.$Message.error("请将资源加入借出车");
}
},
lendingRecord() {
// window.open("/resource/resource/record", "_blank");
this.$router.push("/resource/resource/record");
},
ok() {
this.$refs.grid.load();
this.modal = false;
this.fscreeen = false;
this.cartList = [];
// this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
add() {
if (this.curId) {
this.title = "新增";
this.detail = () => import("./add");
this.fscreeen = false;
this.modal = true;
} else {
this.$Message.error("请先选择库房库位");
}
},
copy(id) {
this.curId = id;
this.title = "克隆";
this.detail = () => import("./add");
this.modal = true;
},
remove(id) {
Api.delete(id).then((r) => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success("删除成功");
}
});
},
logDetail(id) {
this.curId = id;
this.title = "查看日志";
this.detail = () => import("./log");
this.fscreeen = false;
this.modal = true;
},
cancel() {
this.curId = 0;
this.modal = false;
},
onHide() {
// this.$Message.info("收起左侧树")
this.showMenu = false;
},
showMenuFn() {
//this.$Message.info("展开左侧树")
this.showMenu = true;
},
productSearch(item, ids, rootName) {
// console.log(item);
this.curId = item.id;
this.storeTitle = item.title;
this.rootName = rootName.join(" / ");
this.materialType = item.materialType;
let where = { storeId: { op: "In", value: ids } };
this.$refs.grid.reload(where);
},
setNum(row) {
this.curId = row.id;
this.title = "预警";
// this.detail = () => import("./setNum");
this.fscreeen = false;
this.modal = true;
},
l(key) {
let vkey = "resource" + "." + key;
return this.$t(vkey) || key;
}, },
},
}; };
</script> </script>
<style lang="less"> <style lang="less">
.full { .full {
margin-top: 0; margin-top: 0;
.content {
margin-top: 10px; .content {
padding-top: 10px; margin-top: 10px;
.ivu-icon-ios-add:before { padding-top: 10px;
content: "\f341";
} .ivu-icon-ios-add:before {
.ivu-icon-ios-remove:before { content: "\f341";
content: "\f33d"; }
.ivu-icon-ios-remove:before {
content: "\f33d";
}
} }
}
} }
</style> </style>
\ No newline at end of file
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