Commit 66fdd543 authored by 仇晓婷's avatar 仇晓婷

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

parents 90f57519 0c4ad817
......@@ -21,6 +21,9 @@
</div>
<div class="btns">
<slot name="buttons"></slot>
<Button @click="export2Excel" v-if="exportTitle.length>0">
导出
</Button>
<Button v-if="set&&type=='table'" @click="config=!config">
<Icon type="md-build" title="列设置" />
</Button>
......@@ -64,6 +67,7 @@
</li>
</ul>
</Drawer>
<FooterToolbar v-if="batch" v-show="footerToolbar">
<div class="tip">已选{{selectItems.length}}</div>
<slot name="batch"></slot>
......@@ -212,6 +216,10 @@ export default {
type: Number,
default: 40,
},
exportTitle: {
type: String,
default: "",
}
},
created() {
this.columns.forEach((u) => {
......@@ -462,6 +470,81 @@ export default {
this.footerToolbar = false;
this.$refs.table.selectAll(false);
},
//导出excel
export2Excel() {
//当前显示数据
var where = [];
var conditions = this.conditions;
if (conditions) {
Object.keys(conditions).forEach((u) => {
let v = conditions[u].value;
let op = conditions[u].op;
if (!this.$u.isNull(v)) {
if (op == "Range") {
let times = [];
v.map((u) => {
if (!this.$u.isNull(u)) {
times.push(this.$u.toTime(u));
}
});
v = times.join(",");
} else if (op.indexOf("In") > -1) {
v = v.join(",");
}
if (!this.$u.isNull(v)) {
where.push({
fieldName: u,
fieldValue: v,
conditionalType: op,
});
}
}
});
}
let searchs = {
pageIndex: 1,
conditions: where,
pageSize: 1000
}
this.$api.post(this.action, searchs).then((r) => {
let list = []
list = r.result.items;
const tHeader = []; // 设置Excel的表格第一行的标题
const filterVal = []; //list里对象的属性
var tempCol = [];
var columnsCur = this.$u.clone(this.columnsNow); //导出列标题信息griddata this.$refs.grid.columnsCur
columnsCur.forEach((el) => {
if ((el.hide && !el.import) || (!el.hide && el.key != "action" && el.type != "selection" && el.key != "ico")) {
if (el.code) {
tempCol.push({
key: el.key,
code: el.code
}); //临时存放code数据字典的字段及对应的数据字典code
}
tHeader.push(el.title);
filterVal.push(el.key);
}
});
list.forEach((e) => {
//给导出数据增加数据字典对应的name
tempCol.forEach((ele) => {
e[ele.key] = this.$u.dirName(
this.$store.getters.dictionaryByKey(ele.code),
e[ele.key]
);
});
});
let nowDate = this.$u.getNowTime(); //年月日时分秒yyyyMMddhhmmss
//获取导出数据结束
this.$u.outExcel(this.exportTitle +
"(" + nowDate + ")",
tHeader,
filterVal,
list
);
});
},
},
computed: {
columnsNow() {
......
import Api from '@/plugins/request'
import { getJSON } from 'js-cookie';
export default {
index: `${systemUrl}/importcenter/paged`,
paged(params) {
return Api.post(`${systemUrl}/importcenter/paged`, params);
},
get(params) {
return Api.get(`${systemUrl}/importcenter/get`, params);
},
create(params) {
return Api.post(`${systemUrl}/importcenter/create`, params);
},
update(params) {
return Api.post(`${systemUrl}/importcenter/update`, params);
},
delete(id) {
return Api.delete(`${systemUrl}/importcenter/delete`, {
params: {
id: id
}
});
},
deletes(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>
<div class="h100">
<Tabs type="card" width="100">
<TabPane label="excel数据">
<TablePaste hide-table :input-props="inputProps" @on-success="handleSuccess" @on-error="handleError" />
</TabPane>
<TabPane label="预览">
<Table :border="true" :columns="columnsImport" :data="excelData" :height="tableHeight" ref="tableExcel" class="tableCommon"></Table>
</TabPane>
</Tabs>
</div>
</template>
<script>
import Api from "./api";
export default {
name: "detailExcel",
data() {
return {
entity: {},
downUrl: fileUrlDown,
fileUrlPath: "",
excelRows: 100,
tableHeight: '',
inputProps: {
rows: 10,
placeholder: "请从Excel复制一段表格数据,粘贴在这里",
},
columnsImport: [],
excelData: []
};
},
props: {
eid: Number,
},
created() {
this.excelRows = parseInt((window.innerHeight - 231) / 21) + 1;
this.inputProps.rows = this.excelRows
this.tableHeight = window.innerHeight - 200
},
mounted() {
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.excelRows = parseInt((window.screenHeight - 231) / 21) + 1;
this.inputProps.rows = this.excelRows
this.tableHeight = window.innerHeight - 200
})();
};
},
methods: {
handleClose() {
this.$emit("on-close");
},
downFile(path) {
//alert(path)
let truePath = 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 + path;
window.open(this.fileUrlPath, "_blank");
}
}
},
//粘贴excel成功
handleSuccess(tableData) {
//初始化数据
this.excelData = [];
this.columnsImport = [];
//处理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.columnsImport.unshift({
type: 'index',
width: 80,
align: 'right',
title: '序号'
})
this.excelData = arrData;
this.$emit("on-datalength", this.excelData.length)
},
//粘贴excel失败
handleError(tableData, errorIndex) {
//console.log(tableData, errorIndex);
this.$Message.error("表格数据有误");
},
//粘贴excel相关end
},
watch: {
eid(v) {
if (v > 0) {
this.load(v);
}
},
},
};
</script>
<template>
<Modal v-model="ImportModal" title="导入" fullscreen footer-hide @on-cancel="cancelModal">
<div class="table-content">
<div class="table-tools">
<div class="table-search">
<Form inline>
<FormItem>
<div style="height:34px;overflow: hidden;padding:0;width:120px">
<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 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>
<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>
</Modal>
</template>
<script>
import XLSX from "xlsx";
import {
Switch
} from "view-design";
export default {
name: "Edit",
data() {
return {
tabVal: 0,
infoModal: false,
entity: {},
downUrl: fileUrlDown,
fileUrlPath: "",
disabled: false,
detailExcel: null,
tableImport: true,
tdHeightExcel: "",
excelData: [],
excelDataBack: [], //临时存储原始数据
formatList: ["xlsx"],
columnsImport: [],
departArr: [], //部门list
sheetNames: [], //excel的表明
workBook: {},
openDatas: [],
dataType: 0,
//new
colsIm: [],
dataIm: [],
excelType: '0',
btnIm: true,
titleInfo: '',
noDataText: '暂无数据',
imBtn: true,
columnsIm: this.columns,
ImportModal: this.open,
batchImportUrl: '',
};
},
props: {
eid: Number,
data: {
// 当作table使用,直接显示数据
type: Array,
default: function () {
return [];
},
},
columns: {
//要显示的字段
type: Array,
default: [],
},
open: {
type: Boolean,
default: false
}
},
created() {
this.tdHeightExcel = window.innerHeight - 180;
//导出对列表头进行预加载start
this.$api.get(`${systemUrl}/Department/GetDepartments`).then((r) => {
this.departArr = r.result.items;
});
//导出对列表头进行预加载end
},
mounted() {
//if (this.eid > 0) {
// this.load(this.eid);
//}
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.tdHeightExcel = window.screenHeight - 180;
})();
};
},
methods: {
//重新处理colum
loadColum(columns) {
let tempCol = this.$u.clone(columns);
tempCol.forEach((ele, index) => {
if (ele.key == "action" || ele.type == "selection" || ele.key == "ico") {
ele.hide = true;
}
});
this.colsIm = tempCol;
this.colsIm.unshift({
type: 'index',
width: 80,
align: 'right',
title: '序号'
}, {
key: "ico",
title: " ",
align: "center",
width: 60,
render: (h, params) => {
return h("div", {
class: ""
}, [
h(params.row.ico ? "op" : "", {
attrs: {
icon: "ios-alert",
type: "icon",
title: "数据不合法",
color: "#ff9900"
}
}),
]);
},
})
//处理原始数据和表头进行对应
let temCol = this.$u.clone(this.colsIm); //原始数据表头
let temColPage = this.$u.clone(columns); //需要显示的页面的表头
//let temData = this.$u.clone(this.excelDataBack); //原始数据
let temData = []; //原始数据
if (this.excelType == "0") {
temData = this.$u.clone(this.excelDataBack)
} else {
temData = this.$u.clone(this.$refs.comExcel.excelData)
}
let arrTitleUse = []; ////使用数据字典的字段
temColPage.forEach((elCode) => {
if (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);
});
//对列表里的部门及数据字典项进行处理
useData.forEach(eles => {
//如果导入文件没有departmentid,但存在departmentTitle的话,通过title获取id
if (
eles.departmentTitle &&
eles.departmentTitle != "" &&
(!eles.departmentId || eles.departmentId == "")
) {
this.departArr.forEach((e) => {
if (eles.departmentTitle && eles.departmentTitle == e.name) {
eles.departmentId = e.id;
}
});
} else if (
//如果导入文件没有departmentTitle,但存在departmentid的话,通过id获取departmentTitle
eles.departmentId &&
eles.departmentId + "" != "" &&
(!eles.departmentTitle || eles.departmentTitle == "")
) {
this.departArr.forEach((e) => {
if (eles.departmentId && eles.departmentId == e.id) {
eles.departmentTitle = e.name;
}
});
}
arrTitleUse.forEach((elem) => {
if (eles[elem.key] && eles[elem.key] != "" && eles[elem.key] != null) {
//如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值
eles[elem.key] = this.$u.dirCode(
this.$store.getters.dictionaryByKey(elem.code),
eles[elem.key]
);
}
});
})
this.dataIm = useData;
let tempData = this.$u.clone(this.dataIm);
this.$emit("on-get-data", tempData)
},
//导入excel文件
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.btnIm = false;
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 = [];
headersNow.push({
type: 'index',
width: 80,
align: 'right',
title: '序号'
})
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.excelDataBack = result;
this.changeExcel(0)
},
//切换sheet表重新加载
sheetClick(val) {
this.tabVal = val
this.dealSheet(val);
},
handleClose() {
this.$emit("on-close");
},
cancelExcel() {
this.excelData = [];
this.excelDataBack = [];
this.$refs.uploadfile.clearFiles();
let parms = {
status: 1,
id: this.eid
}
//导入中心列表数据状态更新
this.$emit("on-close");
},
//打开导入数据格式化后的窗口
openInfoModal() {
if ((this.excelType == '0' && this.excelData.length > 0) || (this.excelType == '1' && this.$refs.comExcel.excelData.length > 0)) {
this.imBtn = true;
this.loadColum(this.columnsIm);
this.titleInfo = "批量导入";
this.infoModal = true;
} else {
this.imBtn = false;
this.$Message.error("没有可导入的数据!")
}
},
//确定导入按钮操作
importOk() {
let imData = [];
let imDataError = []
this.dataIm.forEach(ele => {
if (!ele.ico) {
imData.push(ele)
} else {
imDataError.push(ele)
}
})
this.$api.post(this.batchImportUrl, {
list: imData
}).then((r) => {
if (r.success) {
this.$Message.success("批量导入成功" + imData.length + "条数据")
this.dataIm = imDataError
this.$emit("on-ok")
} else {
this.$Message.error("批量导入失败")
}
}).catch(err => {
this.$Message.error("数据异常!");
});;
},
//切换列表和excel按钮
changeExcel(val) {
if (val == 1) {
this.tableImport = false
this.detailExcel = () => import("./detailExcel");
this.excelType = '1';
this.btnIm = true
} else {
this.detailExcel = null;
this.tableImport = true;
this.excelType = '0';
if (this.excelData.length > 0) {
this.btnIm = false
} else {
this.btnIm = true
}
}
},
datalength(val) {
if (val > 0) {
this.btnIm = false
}
},
cancelModal() {
this.$emit('on-cancel')
},
//主页面里第二次处理数据
deelData(url, columns, formatList) {
this.dataIm = formatList
this.batchImportUrl = url
},
l(key) {
key = "user" + "." + key;
return this.$t(key);
},
},
watch: {
"columns"() {
this.columns.forEach((u) => {
if (!u.hide) {
u.hide = false;
}
});
this.colsIm = this.$u.clone(this.columns);
this.columnsIm = this.$u.clone(this.columns)
},
open(v) {
this.ImportModal = v
}
},
};
</script>
<style lang="less">
.table-content {
position: relative;
height: 100%;
display: flex;
flex-direction: column;
.tip {
display: inline;
}
form {
display: inline-block;
.ivu-form-item {
margin: 0;
vertical-align: middle;
}
}
.table-main {
width: 100%;
text-align: left;
padding: 0;
display: block;
overflow-y: auto;
flex-grow: 1;
tr td .ivu-table-cell {
padding: 0 5px;
}
overflow-x: hidden;
}
.table-tools {
display: flex;
line-height: 50px;
.table-search {
flex-grow: 1;
}
.btns {
min-width: 200px;
text-align: right;
}
}
.table-footer {
line-height: 45px;
background: #f5f5f5;
}
.ivu-footer-toolbar {
text-align: left;
background: #f5f5f5;
.ivu-footer-toolbar-right {
float: left;
}
}
}
</style>
<template>
<Tooltip trigger="hover" v-if="title" :content="title" placement="top-end">
<Tooltip trigger="hover" v-if="title" :content="title" placement="top-end">
<a class="op" :class="css" @click="handler">
<slot>
<Icon v-if="type=='icon'" :type="icon" />
<Icon v-if="type=='icon'" :type="icon" :color="color" />
<span v-else="type=='text'" v-text="text"></span>
</slot>
</a>
</Tooltip>
<a class="op" v-else :class="css" @click="handler">
</Tooltip>
<a class="op" v-else :class="css" @click="handler">
<slot>
<Icon v-if="type=='icon'" :type="icon" />
<Icon v-if="type=='icon'" :type="icon" :color="color" />
<span v-else="type=='text'" v-text="text"></span>
</slot>
</a>
</a>
</template>
<script>
export default {
name: "op",
......@@ -34,6 +35,9 @@ export default {
msg: {
type: String,
default: "确认要删除吗?"
},
color: {
type: String
}
},
data() {
......@@ -62,7 +66,7 @@ export default {
},
methods: {
handler() {
if (this.oprate == "delete"||this.oprate == "remove") {
if (this.oprate == "delete" || this.oprate == "remove") {
this.$Modal.confirm({
title: this.title,
content: "<p>" + this.msg + "</p>",
......@@ -77,6 +81,7 @@ export default {
}
};
</script>
<style lang="less">
a.op {
display: inline;
......
......@@ -11753,7 +11753,7 @@
"dependencies": {
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npm.taobao.org/source-map/download/source-map-0.6.1.tgz",
"resolved": "http://r.cnpmjs.org/source-map/download/source-map-0.6.1.tgz",
"integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=",
"dev": true,
"optional": true
......
<template>
<div class="h100">
<DataGrid :columns="columns" ref="grid" :action="action">
<DataGrid :columns="columns" ref="grid" :action="action" exportTitle="导入中心">
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
......
......@@ -84,6 +84,7 @@
</Modal>
</div>
</template>
<script>
import MasterData from "./masterData.vue";
......@@ -126,17 +127,14 @@ export default {
},
methods: {
clickItem(val) {
console.log(val);
this.nodeInfo.codeRuleId = val;
this.model8 = val;
this.cityList.forEach((e) => {
if (val == e.id) {
this.downName = e.name;
this.nodeInfo.codeRuleType = e.type;
}
});
this.model8 = val;
this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType);
},
listSlecet() {
......@@ -214,7 +212,10 @@ export default {
onOk: () => {
Api.delete(this.nodeInfo.id).then((r) => {
if (r.success) {
this.loadTree(this.nodeInfo.codeRuleId);
this.loadTree(
this.nodeInfo.codeRuleId,
this.nodeInfo.codeRuleType
);
this.$Message.success("删除成功");
}
});
......@@ -281,13 +282,17 @@ export default {
// this.$refs.dataTable.dataColumns = tableData;
// }
},
loadTree(id) {
loadTree(id, codeRuleType) {
let data = {
conditions: [
{ fieldName: "codeRuleId", fieldValue: id, conditionalType: "Equal" },
{
fieldName: "codeRuleId",
fieldValue: id,
conditionalType: "Equal",
},
{
fieldName: "codeRuleType",
fieldValue: this.nodeInfo.codeRuleType,
fieldValue: codeRuleType,
conditionalType: "Equal",
},
],
......@@ -322,6 +327,7 @@ export default {
ids.push(b.id);
if (b.children) {
addId(b.children);
function addId(data) {
data.map((u) => {
ids.push(u.id);
......@@ -345,6 +351,7 @@ export default {
let expand = this.expand;
let result = [];
search(this.keys, items);
function search(keys, data) {
data.map((u) => {
if (keys.length < u.title) {
......@@ -365,7 +372,8 @@ export default {
},
};
</script>
<style lang="less" >
<style lang="less">
.classification {
font-family: Microsoft YaHei;
......@@ -381,6 +389,7 @@ export default {
background: #eee;
padding-left: 10px;
}
.p-list {
h3 {
height: 50px;
......@@ -393,22 +402,26 @@ export default {
opacity: 1;
padding-left: 10px;
}
.search {
height: 50px;
padding: 5px 10px;
}
.fg {
flex: none;
height: 100%;
overflow: auto;
padding-left: 10px;
}
.tree {
height: calc(100vh - 215px);
overflow: auto;
}
}
}
.show_menu {
width: 30px;
height: 30px;
......@@ -416,6 +429,7 @@ export default {
top: 100px;
left: 0;
z-index: 9;
.menu_play {
width: 30px;
height: 30px;
......@@ -428,11 +442,13 @@ export default {
background: #ffffff;
box-shadow: #ccc 2px 2px 4px 1px;
}
.menu_play:hover {
background-color: #2d8cf0;
color: white;
}
}
.ivu-layout-content {
// margin-left: 5px;
background: rgba(255, 255, 255, 1);
......
<template>
<div class="master-data">
<div class="master-data">
<!-- <Table border :columns="columns" :data="dataColumns" :height="tableHeight"></Table> -->
<DataGrid
:columns="columns"
ref="grid"
:conditions="easySearch"
:action="action"
:high="false"
:height="tableHeight"
>
<DataGrid :columns="columns" ref="grid" :conditions="easySearch" :action="action" :high="false" :height="tableHeight">
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
......@@ -20,8 +13,9 @@
</Form>
</template>
</DataGrid>
</div>
</div>
</template>
<script>
import Api from "./api";
export default {
......@@ -33,8 +27,14 @@ export default {
tableHeight: "",
dataColumns: [],
easySearch: {
keys: { op: "code,name", value: null },
id: { op: "In", value: "" }
keys: {
op: "code,name",
value: null
},
id: {
op: "In",
value: ""
}
},
columns: [
// {
......@@ -71,20 +71,28 @@ export default {
width: 260,
align: "left",
render: (h, params) => {
return h("div", { class: "action" }, [
return h("div", {
class: "action"
}, [
h(
"op",
{
attrs: { oprate: "edit" },
on: { click: () => this.edit(params.row) }
"op", {
attrs: {
oprate: "edit"
},
on: {
click: () => this.edit(params.row)
}
},
"编辑"
),
h(
"op",
{
attrs: { oprate: "delete" },
on: { click: () => this.remove(params.row.id) }
"op", {
attrs: {
oprate: "delete"
},
on: {
click: () => this.remove(params.row.id)
}
},
"删除"
)
......@@ -94,7 +102,10 @@ export default {
]
};
},
async fetch({ store, params }) {
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
......@@ -143,6 +154,7 @@ export default {
}
};
</script>
<style lang="less" scoped>
.spare-parts {
width: 100%;
......
......@@ -54,6 +54,7 @@
</Layout>
</div>
</template>
<script>
import MasterData from "./masterData.vue";
......@@ -74,6 +75,7 @@ export default {
nodeInfo: {
categoryId: 0,
rootCategoryId: 0,
rootCategoryName: "",
ids: [],
addChange: true,
codeRuleId: 0,
......@@ -86,7 +88,9 @@ export default {
detail: null,
showMenu: true,
dataList: [],
codeRuleId: "",
rootCategoryId: null,
categoryId: null,
};
},
async fetch({ store, params }) {
......@@ -98,16 +102,14 @@ export default {
},
methods: {
clickItem(val) {
this.codeRuleId = val;
this.nodeInfo.codeRuleId = val;
this.model8 = val;
this.cityList.forEach((e) => {
if (val == e.id) {
this.downName = e.name;
this.nodeInfo.codeRuleType = e.type;
}
});
this.loadTree(this.codeRuleId, this.nodeInfo.codeRuleType);
this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType);
},
listSlecet() {
let data = {
......@@ -164,14 +166,17 @@ export default {
);
},
handleSelect(root, data) {
let pid = null; //定义最顶级id
let upId = data.upId;
let pid = -1; //定义最顶级id
var pname = "";
var upId = data.upId;
let roots = root;
function addId(roots, upId) {
roots.map((u) => {
if (u.node.id == upId) {
if (u.node.upId == 0) {
pid = u.node.id;
pname = u.node.name;
} else {
upId = u.node.upId;
addId(roots, upId);
......@@ -179,18 +184,26 @@ export default {
}
});
}
addId(roots, upId);
this.nodeInfo.categoryId = data.id;
if (pid == null) {
this.nodeInfo.rootCategoryName = data.name;
if (pid == -1) {
this.nodeInfo.rootCategoryId = data.id;
this.nodeInfo.rootCategoryName = data.name;
} else {
this.nodeInfo.rootCategoryId = pid;
this.nodeInfo.rootCategoryName = pname;
}
},
loadTree(id, codeRuleType) {
let data = {
conditions: [
{ fieldName: "codeRuleId", fieldValue: id, conditionalType: "Equal" },
{
fieldName: "codeRuleId",
fieldValue: id,
conditionalType: "Equal",
},
{
fieldName: "codeRuleType",
fieldValue: codeRuleType,
......@@ -231,6 +244,7 @@ export default {
ids.push(b.value);
if (b.children) {
addId(b.children);
function addId(data) {
data.map((u) => {
ids.push(u.value);
......@@ -252,6 +266,7 @@ export default {
let expand = this.expand;
let result = [];
search(this.keys, items);
function search(keys, data) {
data.map((u) => {
if (keys.length < u.title) {
......@@ -272,7 +287,8 @@ export default {
},
};
</script>
<style lang="less" >
<style lang="less">
.classification {
font-family: Microsoft YaHei;
......@@ -288,6 +304,7 @@ export default {
background: #eee;
padding-left: 10px;
}
.p-list {
h3 {
height: 50px;
......@@ -300,22 +317,26 @@ export default {
opacity: 1;
padding-left: 10px;
}
.search {
height: 50px;
padding: 5px 10px;
}
.fg {
flex: none;
height: 100%;
overflow: auto;
padding-left: 10px;
}
.tree {
height: calc(100vh - 215px);
overflow: auto;
}
}
}
.show_menu {
width: 30px;
height: 30px;
......@@ -323,6 +344,7 @@ export default {
top: 100px;
left: 0;
z-index: 9;
.menu_play {
width: 30px;
height: 30px;
......@@ -335,11 +357,13 @@ export default {
background: #ffffff;
box-shadow: #ccc 2px 2px 4px 1px;
}
.menu_play:hover {
background-color: #2d8cf0;
color: white;
}
}
.ivu-layout-content {
// margin-left: 5px;
background: rgba(255, 255, 255, 1);
......
<template>
<div class="master-data">
<DataGrid
:columns="cols"
ref="grid"
:conditions="easySearch"
:action="action"
:initsearch="sets"
:high="false"
:format="formatFun"
:height="tableHeight"
@on-selection-change="onSelect"
>
<div class="master-data">
<DataGrid :columns="cols" ref="grid" :conditions="easySearch" :action="action" :initsearch="sets" :high="false" :format="formatFun" :height="tableHeight" @on-selection-change="onSelect" :exportTitle="exportTitle">
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input
placeholder="请输入编码/名称/状态"
v-width="200"
v-model="easySearch.keys.value"
clearable
/>
<Input placeholder="请输入编码/名称/状态" v-width="200" v-model="easySearch.keys.value" clearable />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
......@@ -29,33 +14,19 @@
<template slot="buttons">
<Button type="primary" @click="add">新增</Button>
<Button @click="openModalIm">导入</Button>
</template>
<template slot="batch">
<Button type="primary" @click="modalSchedule">批量送审</Button>
</template>
</DataGrid>
<Modal
v-model="modal"
:title="title"
width="1000"
footer-hide
:mask-closable="false"
:fullscreen="fullscreen"
>
<component
:is="detail"
:eid="curId"
:rootCategoryId="rootCategoryId"
:rowsTable="rowsTable"
:nodeInfo="nodeInfo"
@on-close="cancel"
@on-cancel="cancel"
@on-ok="ok"
ref="chlidren"
/>
<Modal v-model="modal" :title="title" width="1000" footer-hide :mask-closable="false" :fullscreen="fullscreen">
<component :is="detail" :eid="curId" :rootCategoryId="rootCategoryId" :rowsTable="rowsTable" :nodeInfo="nodeInfo" @on-close="cancel" @on-cancel="cancel" @on-ok="ok" ref="chlidren" />
</Modal>
</div>
<ImportExcel ref="importExcel" @on-get-data="getData" :columns="cols" :open="ModalIm" @on-cancel="ModalImCancel" @on-ok="ok" />
</div>
</template>
<script>
import Api from "./api";
// import Search from "./search";
......@@ -82,14 +53,16 @@ export default {
v.rootCategoryId = this.nodeInfo.rootCategoryId;
},
easySearch: {
keys: { op: "code,name", value: null },
keys: {
op: "code,name",
value: null
},
categoryId: {
op: "In",
value: this.nodeInfo.ids
}
},
columns: [
{
columns: [{
type: "selection",
width: 70,
align: "center"
......@@ -100,14 +73,13 @@ export default {
align: "left",
render: (h, params) => {
return h(
"a",
{
"a", {
props: {},
on: {
click: () => this.details(params.row)
}
},
!params.row.code ? "未分配" : params.row.code
!params.row.code || params.row.code == 0 ? "未分配" : params.row.code
);
}
},
......@@ -119,16 +91,8 @@ export default {
{
key: "status",
title: "状态",
align: "left",
render: (h, params) => {
return h("state", {
props: {
align: "center",
code: "material.main.status",
type: "text",
value: params.row.status + ""
}
});
}
},
{
key: "version",
......@@ -161,47 +125,65 @@ export default {
width: 150,
align: "left",
render: (h, params) => {
return h("div", { class: "action" }, [
return h("div", {
class: "action"
}, [
h(
"op",
{
attrs: { oprate: "edit" },
on: { click: () => this.edit(params.row) }
"op", {
attrs: {
oprate: "edit"
},
on: {
click: () => this.edit(params.row)
}
},
"编辑"
),
h(
"op",
{
attrs: { oprate: "delete" },
on: { click: () => this.remove(params.row.id) }
"op", {
attrs: {
oprate: "delete"
},
on: {
click: () => this.remove(params.row.id)
}
},
params.row.status == 3 ? "" : "删除"
),
h(
"op",
{
attrs: { oprate: "edit" },
on: { click: () => this.send(params.row) }
"op", {
attrs: {
oprate: "edit"
},
on: {
click: () => this.send(params.row)
}
},
(params.row.status == 0 || params.row.status == 1) &&
this.status == 0
? "送审"
: ""
this.status == 0 ?
"送审" :
""
)
]);
}
}
], //基础咧
cols: [], //
status: null
status: null,
ModalIm: false,
addCol: [],
exportTitle: '物料管理',
};
},
async fetch({ store, params }) {
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
this.tableHeight = window.innerHeight - 220;
if (this.nodeInfo.rootCategoryId == 0) {
this.cols = this.columns;
} else {
......@@ -254,13 +236,11 @@ export default {
this.$refs.grid.reload(this.easySearch);
},
initCols(delay) {
let conditions = [
{
let conditions = [{
conditionalType: "Equal",
fieldName: "categoryId",
fieldValue: this.nodeInfo.rootCategoryId
}
];
}];
Api.listTable({
conditions: conditions,
......@@ -275,6 +255,7 @@ export default {
}) && u.dataType != 5
);
});
this.addCol = items;
this.cols = this.$u.clone(this.columns);
let extra = items.map(u => {
console.log(u);
......@@ -310,6 +291,7 @@ export default {
// console.log(this.cols)
}
});
this.exportTitle = "物料管理-" + this.nodeInfo.rootCategoryName;
},
add() {
if (this.nodeInfo.categoryId) {
......@@ -362,12 +344,62 @@ export default {
ok() {
this.$refs.grid.reload(this.easySearch);
this.modal = false;
this.ModalIm = false;
this.curId = 0;
},
cancel() {
this.curId = 0;
this.modal = false;
},
//批量导入start
//导入功能
openModalIm() {
if (this.nodeInfo.categoryId) {
this.ModalIm = true
} else {
this.$Message.error("请先选择分类");
}
},
ModalImCancel() {
this.ModalIm = false
},
getData(val) {
let url = `${material}/materialimportservice/import`;
this.$refs.importExcel.deelData(url, this.cols, this.formatMethod(val))
},
//根据页面二次处理数据
formatMethod(val) {
let tempData = this.$u.clone(val);
let tempList = [];
tempData.forEach((ele) => {
let obj = {
name: ele.name ? ele.name : '',
version: ele.version ? Number(ele.version) : '',
drawing: ele.drawing ? ele.drawing : '',
description: ele.description ? ele.description : "",
code: 0,
status: this.nodeInfo.status == 1 ? 3 : 0,
codeRuleId: this.nodeInfo.codeRuleId,
categoryId: this.nodeInfo.categoryId, //左侧树点击的id
customProperties: {},
rootCategoryId: this.nodeInfo.rootCategoryId, //左侧树点击的数据的最顶层id
};
this.addCol.forEach(el => {
obj[el.field] = ele[el.field]
})
if (ele.name && ele.name != '') {
obj.ico = false
} else {
obj.ico = true
}
tempList.push(obj);
});
return tempList
},
//批量导入end
},
watch: {
nodeInfo: {
......@@ -391,7 +423,8 @@ export default {
}
};
</script>
<style lang="less" >
<style lang="less">
.master-data {
.ivu-footer-toolbar-right {
margin-right: 72% !important;
......
<template>
<Layout class="full">
<Layout class="full">
<!-- <Sider hide-trigger :style="{background: '#fff'}" width="260">
<div class="zh-tree" :style="{height:treeHeight+'px'}">
<h3 class="zh-title">产品结构</h3>
......@@ -24,16 +24,7 @@
</div>
<Content class="content" :class="!showMenu?'con_bord':''">
<!--:data="dataT"-->
<DataGrid
:action="action"
:columns="columns"
:conditions="easySearch"
ref="grid"
@on-selection-change="onSelect"
:batch="true"
:border="false"
rowKey="id"
>
<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">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
......@@ -51,12 +42,7 @@
<Button type="primary" @click="addModal=true">创建</Button>
</template>
<template slot="batch">
<Button
type="primary"
class="mr10 ml10"
@click="openSendViewModal"
v-if="this.wfstatu==1"
>订单送审</Button>
<Button type="primary" class="mr10 ml10" @click="openSendViewModal" v-if="this.wfstatu==1">订单送审</Button>
<Button type="primary" class="mr10 ml10" @click="openSendModal">订单派发</Button>
<Button type="primary" class="mr10 ml10" @click="removeList">批量删除</Button>
</template>
......@@ -95,15 +81,7 @@
<p>确定删除 订单:{{delMsg}} ?</p>
</Modal>
<!-- 信息提示 -->
<Modal
v-model="ModalInfo"
title="信息提示"
width="600"
:mask-closable="false"
:scrollable="true"
ok-text="确定"
cancel-text="取消"
>
<Modal v-model="ModalInfo" title="信息提示" width="600" :mask-closable="false" :scrollable="true" ok-text="确定" cancel-text="取消">
{{ metCodesStrTxt }}
<div slot="footer">
<Button @click="ModalInfo = false">取消</Button>
......@@ -111,8 +89,9 @@
</div>
</Modal>
</Content>
</Layout>
</Layout>
</template>
<script>
import Api from "./api";
import Add from "./add";
......@@ -145,7 +124,10 @@ export default {
value: null,
default: true
},
productId: { op: "In", value: "" }
productId: {
op: "In",
value: ""
}
},
addModal: false,
editModal: false,
......@@ -157,8 +139,7 @@ export default {
sendViewModal: false,
curId: 0,
id: "id",
columns: [
{
columns: [{
key: "selection",
type: "selection",
width: 50,
......@@ -183,8 +164,7 @@ export default {
let isDivideMark = params.row.divideMark;
let rowChildren = params.row.children;
return h(
"div",
{
"div", {
style: {
cursor: "pointer",
display: "inline",
......@@ -276,7 +256,7 @@ export default {
align: "left",
high: true,
hide: true,
type:'workShopName'
type: 'workShopName'
},
{
key: "productingPreparationFinishDate",
......@@ -352,88 +332,96 @@ export default {
width: 180,
align: "left",
render: (h, params) => {
return h("div", { class: "action" }, [
return h("div", {
class: "action"
}, [
h(
"op",
{
attrs: { oprate: "detail" },
on: { click: () => this.detail(params.row) }
"op", {
attrs: {
oprate: "detail"
},
on: {
click: () => this.detail(params.row)
}
},
"查看"
),
h(
"op",
{
attrs: { oprate: "edit" },
on: { click: () => this.edit(params.row) },
style:
this.wfstatu == 1
? (
"op", {
attrs: {
oprate: "edit"
},
on: {
click: () => this.edit(params.row)
},
style: this.wfstatu == 1 ?
(
(params.row.status == 1 &&
params.row.id == params.row.rootId &&
params.row.divideMark != 0) ||
params.row.id != params.row.rootId ||
params.row.status != 1
? "display:none"
: "")
: (
params.row.status != 1 ?
"display:none" :
"") : (
(params.row.status == 3 &&
params.row.id == params.row.rootId &&
params.row.divideMark != 0) ||
params.row.id != params.row.rootId ||
params.row.status != 3
? "display:none"
: "")
params.row.status != 3 ?
"display:none" :
"")
},
"编辑"
),
h(
"op",
{
attrs: { oprate: "remove" },
on: { click: () => this.remove(params.row) },
style:
this.wfstatu == 1
? (
"op", {
attrs: {
oprate: "remove"
},
on: {
click: () => this.remove(params.row)
},
style: this.wfstatu == 1 ?
(
(params.row.status == 1 &&
params.row.id == params.row.rootId &&
params.row.divideMark != 0) ||
params.row.id != params.row.rootId ||
params.row.status != 1
? "display:none"
: "")
: (
params.row.status != 1 ?
"display:none" :
"") : (
(params.row.status == 3 &&
params.row.id == params.row.rootId &&
params.row.divideMark != 0) ||
params.row.id != params.row.rootId ||
params.row.status != 3
? "display:none"
: "")
params.row.status != 3 ?
"display:none" :
"")
},
"删除"
),
h(
"op",
{
attrs: { oprate: "detail" },
on: { click: () => this.split(params.row) },
style:
this.wfstatu == 1
? (
"op", {
attrs: {
oprate: "detail"
},
on: {
click: () => this.split(params.row)
},
style: this.wfstatu == 1 ?
(
(params.row.divideMark != 0 &&
params.row.id == params.row.rootId) ||
params.row.status != 1 ||
params.row.quantity <= 1
? "display:none"
: "")
: (
params.row.quantity <= 1 ?
"display:none" :
"") : (
(params.row.divideMark != 0 &&
params.row.id == params.row.rootId) ||
params.row.status != 3 ||
params.row.quantity <= 1
? "display:none"
: "")
params.row.quantity <= 1 ?
"display:none" :
"")
},
"分解"
)
......@@ -530,15 +518,19 @@ export default {
})();
};
},
async fetch({ store, params }) {
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
await store.dispatch('loadDepartments');//加载部门
await store.dispatch('loadDepartments'); //加载部门
},
computed: {
searchList() {
let nodeList = this.treeData;
var text = this.treeInputSearch;
var newNodeList = [];
function searchTree(nodeLists, value) {
for (let i = 0; i < nodeLists.length; i++) {
if (nodeLists[i].title.indexOf(value) != -1) {
......@@ -593,7 +585,12 @@ export default {
this.showMenu = true;
},
productSearch(id, item, productIds, ids) {
let where = { bomId: { op: "In", value: ids } };
let where = {
bomId: {
op: "In",
value: ids
}
};
this.$refs.grid.reload(where);
},
//确定分解
......@@ -867,7 +864,9 @@ export default {
},
//删除前判断子订单是否能删除
sondeletecheck(code) {
let param = { id: code };
let param = {
id: code
};
Api.sondeletecheck(param).then(res => {
if (res.result == 1) {
this.delNum += 0;
......@@ -878,7 +877,9 @@ export default {
},
//删除前判断子订单
sondeletecheck1(code) {
let param = { id: code };
let param = {
id: code
};
let delStaut = 0;
Api.sondeletecheck(param).then(res => {
if (res.result == 1) {
......@@ -892,7 +893,9 @@ export default {
},
//删除确定
removeOk() {
let params = { ids: this.actIds };
let params = {
ids: this.actIds
};
Api.mesorderdelete(params)
.then(r => {
if (r.success) {
......@@ -977,7 +980,10 @@ export default {
this.selectdata = [];
this.selectdata = data;
this.list = [];
this.list.push({ label: data[0].title, value: data[0].id });
this.list.push({
label: data[0].title,
value: data[0].id
});
//this.formValidate.classType=data[0].id;
if (data[0].isProduct == "1") {
this.orderSearchForm.productName = data[0].id;
......@@ -987,11 +993,14 @@ export default {
}
}
},
renderContent(h, { root, node, data }) {
renderContent(h, {
root,
node,
data
}) {
//渲染树的样式
return h(
"span",
{
"span", {
style: {
color: data.isProduct != "1" ? "#249E91" : "#333", //根据选中状态设置样式
cursor: "pointer"
......@@ -1034,18 +1043,25 @@ export default {
"rootId"
);
this.dataT = this.$u.clone(this.dataT);
}
},
//批量导入start
//批量导入end
}
};
</script>
<style lang="less">
.full {
margin-top: 0;
.content {
margin-top: 10px;
.ivu-icon-ios-add:before {
content: "\f341";
}
.ivu-icon-ios-remove:before {
content: "\f33d";
}
......
......@@ -44,5 +44,9 @@ export default {
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>
<Layout class="full">
<Layout class="full">
<Sider hide-trigger v-if="showMenu" class="menu_side" width="300">
<StoreTree @on-hide="onHide" @on-select="productSearch" />
</Sider>
......@@ -9,25 +9,11 @@
</a>
</div>
<Content class="content" :class="!showMenu?'con_bord':''">
<DataGrid
:columns="columns"
ref="grid"
:action="action"
:conditions="easySearch"
:batch="true"
:format="checkData"
@all-change="allchange"
@on-selection-change="onSelect"
>
<DataGrid :columns="columns" ref="grid" :action="action" :conditions="easySearch" :batch="true" :format="checkData" @all-change="allchange" @on-selection-change="onSelect" exportTitle="制造资源">
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input
clearable
placeholder="请输入资源名称/资源编码/编码"
v-model.trim="easySearch.keys.value"
v-width="260"
/>
<Input clearable placeholder="请输入资源名称/资源编码/编码" v-model.trim="easySearch.keys.value" v-width="260" />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
......@@ -43,29 +29,20 @@
<Badge :count="this.$store.state.count" overflow-count="99" style="margin-right:5px;">
<Button icon="md-cart" @click="showCart">借出车</Button>
</Badge>
<Button @click="openModalIm">导入</Button>
</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"
/>
<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>
<ImportExcel ref="importExcel" @on-get-data="getData" :columns="columns" :open="ModalIm" @on-cancel="ModalImCancel" @on-ok="ok" />
</Content>
</Layout>
</Layout>
</template>
<script>
import Api from "./api";
import Search from "./search";
......@@ -84,7 +61,10 @@ export default {
action: Api.index,
showMenu: true,
easySearch: {
keys: { op: "nameOfResource,code,resourceCode", value: null },
keys: {
op: "nameOfResource,code,resourceCode",
value: null
},
},
fscreeen: false,
modal: false,
......@@ -96,8 +76,7 @@ export default {
storeTitle: "",
materialType: "",
mCode: "",
columns: [
{
columns: [{
key: "selection",
type: "selection",
width: 50,
......@@ -110,7 +89,6 @@ export default {
align: "left",
sortable: true,
},
{
key: "ico",
title: " ",
......@@ -119,18 +97,21 @@ export default {
high: true,
width: 60,
render: (h, params) => {
return h("div", { class: "action" }, [
return h("div", {
class: "action"
}, [
h(params.row.numberAvailable > 0 ? "op" : "", {
attrs: {
icon: "ios-cart-outline",
type: "icon",
},
on: { click: () => this.addCart(params.row) },
on: {
click: () => this.addCart(params.row)
},
}),
]);
},
},
{
key: "resourceCode",
title: this.l("resourceId"),
......@@ -204,13 +185,13 @@ export default {
{
key: "totalNum",
title: this.l("totalNum"),
align: "left",
align: "right",
easy: true,
},
{
key: "numberAvailable",
title: this.l("numberAvailable"),
align: "left",
align: "right",
easy: true,
},
{
......@@ -252,7 +233,7 @@ export default {
{
key: "state",
title: this.l("state"),
align: "left",
align: "center",
code: "mes_xingchi_resource.resource.state",
},
// {
......@@ -266,32 +247,35 @@ export default {
title: "操作",
width: 190,
align: "center",
key: "action",
hide: false,
render: (h, params) => {
return h("div", { class: "action" }, [
return h("div", {
class: "action"
}, [
h(
"op",
{
"op", {
attrs: {
oprate: "delete",
title: "删除",
},
class:
params.row.totalNum === params.row.numberAvailable
? "remove"
: "disable",
on: { click: () => this.remove(params.row) },
class: params.row.totalNum === params.row.numberAvailable ?
"remove" : "disable",
on: {
click: () => this.remove(params.row)
},
},
"删除"
),
h(
"op",
{
"op", {
attrs: {
oprate: "detail",
title: "查看日志",
},
on: { click: () => this.logDetail(params.row.id) },
on: {
click: () => this.logDetail(params.row.id)
},
},
"查看日志"
),
......@@ -307,6 +291,8 @@ export default {
cartList: [],
cartListCount: 0,
selectRows: [],
//导入
ModalIm: false,
};
},
created() {
......@@ -321,7 +307,10 @@ export default {
})();
};
},
async fetch({ store, params }) {
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
computed: {},
......@@ -380,7 +369,10 @@ export default {
newArr.forEach((item2, index, thisArr) => {
if (item.id == item2.id) {
hasPush = true;
thisArr[index] = { ...item, ...item2 };
thisArr[index] = {
...item,
...item2
};
return;
}
});
......@@ -489,7 +481,12 @@ export default {
this.storeTitle = item.title;
this.rootName = rootName.join(" / ");
this.materialType = item.materialType;
let where = { storeId: { op: "In", value: ids } };
let where = {
storeId: {
op: "In",
value: ids
}
};
this.$refs.grid.reload(where);
},
setNum(row) {
......@@ -499,6 +496,46 @@ export default {
this.fscreeen = false;
this.modal = true;
},
//批量导入start
//导入功能
openModalIm() {
this.ModalIm = true
},
ModalImCancel() {
this.ModalIm = false
},
getData(val) {
let url = `${resourceUrl}/resourceimportservice/import`;
this.$refs.importExcel.deelData(url, this.columns, this.formatMethod(val))
},
//根据页面二次处理数据
formatMethod(val) {
let tempData = this.$u.clone(val);
let tempList = [];
tempData.forEach((ele) => {
let obj = {
nameOfResource: ele.nameOfResource ? ele.nameOfResource : '',
resourceCode: ele.resourceCode ? ele.resourceCode : '',
code: ele.code ? ele.code : '',
totalNum: ele.totalNum ? ele.nameOfResource : 0,
storeTitle: ele.storeTitle ? ele.storeTitle : '',
storeId: ele.storeId ? ele.nameOfResource : null,
state: 1,
numberAvailable: ele.numberAvailable ? ele.nameOfResource : 0,
json: {}
};
if (ele.nameOfResource && ele.nameOfResource != '' && ele.code && ele.code != '' && ele.resourceCode && ele.resourceCode != '') {
obj.ico = false
} else {
obj.ico = true
}
tempList.push(obj);
});
return tempList
},
//批量导入end
l(key) {
let vkey = "resource" + "." + key;
return this.$t(vkey) || key;
......@@ -506,15 +543,19 @@ export default {
},
};
</script>
<style lang="less">
.full {
margin-top: 0;
.content {
margin-top: 10px;
padding-top: 10px;
.ivu-icon-ios-add:before {
content: "\f341";
}
.ivu-icon-ios-remove:before {
content: "\f33d";
}
......
......@@ -61,6 +61,7 @@ import DTSearch from '@/components/page/dtSearch.vue'
import InputTime from '@/components/page/inputTime.vue'
import OutputTime from '@/components/page/outputTime.vue'
import ViewerImg from '@/components/page/viewer.vue'
import ImportExcel from '@/components/page/import/process.vue'
// import FormMaking from 'form-making'
// import 'form-making/dist/FormMaking.css'
......@@ -127,6 +128,7 @@ Vue.component("OutputTime", OutputTime)
Vue.component("ViewerImg", ViewerImg)
Vue.component("StoreTree", StoreTree)
Vue.component("StoreSelect", StoreSelect)
Vue.component("ImportExcel",ImportExcel)
......
......@@ -27,7 +27,7 @@ export default ({
next({
name: 'login',
query: {
redirect: to.fullPath
redirect: "/account/login?tenant="+util.cookies.get('tenantCode')
}
});
}
......
......@@ -27,7 +27,7 @@ window.apsUrl = `http://${systemApi.aps}:10111/api/services/app`;//aps排产(61)
window.technologyUrl =`http://${address}:10000/technology/`;//新工艺规程接口
window.iconImg = `/imgicon/`;
window.mncImg = `/images/mnc/`;//mnc图片
window.material = `http://${address}:10000/material`; //物料管理
window.material = `http://${address}:10000/material`; //物料管理 10032
window.Platform = `http://${address}:10000/platform`; //计划管理10131
/* window.systemUrl = `http://${address}:10020/api/services/app`; //System-api 系统管理(基础数据)
......
......@@ -40,7 +40,7 @@ export const actions = {
if (res.result) {
util.cookies.set('uuid', res.result.userId);
util.cookies.set('tenantCode', res.result.tenantCode );
util.cookies.set('tenantCode', res.result.tenantCode||res.result.tanantCode);
util.cookies.set('token', res.result.accessToken);
sessionStorage.setItem('token', res.result.accessToken)
......
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