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 @@ ...@@ -21,6 +21,9 @@
</div> </div>
<div class="btns"> <div class="btns">
<slot name="buttons"></slot> <slot name="buttons"></slot>
<Button @click="export2Excel" v-if="exportTitle.length>0">
导出
</Button>
<Button v-if="set&&type=='table'" @click="config=!config"> <Button v-if="set&&type=='table'" @click="config=!config">
<Icon type="md-build" title="列设置" /> <Icon type="md-build" title="列设置" />
</Button> </Button>
...@@ -64,6 +67,7 @@ ...@@ -64,6 +67,7 @@
</li> </li>
</ul> </ul>
</Drawer> </Drawer>
<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>
...@@ -212,6 +216,10 @@ export default { ...@@ -212,6 +216,10 @@ export default {
type: Number, type: Number,
default: 40, default: 40,
}, },
exportTitle: {
type: String,
default: "",
}
}, },
created() { created() {
this.columns.forEach((u) => { this.columns.forEach((u) => {
...@@ -462,6 +470,81 @@ export default { ...@@ -462,6 +470,81 @@ export default {
this.footerToolbar = false; this.footerToolbar = false;
this.$refs.table.selectAll(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: { computed: {
columnsNow() { 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> <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"> <a class="op" :class="css" @click="handler">
<slot> <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> <span v-else="type=='text'" v-text="text"></span>
</slot> </slot>
</a> </a>
</Tooltip> </Tooltip>
<a class="op" v-else :class="css" @click="handler"> <a class="op" v-else :class="css" @click="handler">
<slot> <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> <span v-else="type=='text'" v-text="text"></span>
</slot> </slot>
</a> </a>
</template> </template>
<script> <script>
export default { export default {
name: "op", name: "op",
props: { props: {
icon: { icon: {
type: String type: String
}, },
oprate: { oprate: {
type: String type: String
}, },
type: { type: {
type: String, type: String,
default: "text" default: "text"
},
title: {
type: String,
},
msg: {
type: String,
default: "确认要删除吗?"
},
color: {
type: String
}
}, },
title: { data() {
type: String, return {
text: "",
css: "detail"
};
}, },
msg: { created() {
type: String, var oprates = {
default: "确认要删除吗?" detail: "查看",
} edit: "编辑",
}, add: "添加",
data() { delete: "删除",
return { remove: "删除"
text: "", };
css: "detail"
};
},
created() {
var oprates = {
detail: "查看",
edit: "编辑",
add: "添加",
delete: "删除",
remove: "删除"
};
if (oprates[this.oprate]) { if (oprates[this.oprate]) {
this.text = oprates[this.oprate]; this.text = oprates[this.oprate];
this.css = this.oprate; this.css = this.oprate;
} else if (this.oprate) { } else if (this.oprate) {
this.css = this.oprate; this.css = this.oprate;
} else if (this.type == "icon") { } else if (this.type == "icon") {
this.css = "icon"; this.css = "icon";
} }
}, },
methods: { methods: {
handler() { handler() {
if (this.oprate == "delete"||this.oprate == "remove") { if (this.oprate == "delete" || this.oprate == "remove") {
this.$Modal.confirm({ this.$Modal.confirm({
title: this.title, title: this.title,
content: "<p>" + this.msg + "</p>", content: "<p>" + this.msg + "</p>",
onOk: () => { onOk: () => {
this.$emit("click", event); this.$emit("click", event);
} }
}); });
} else { } else {
this.$emit("click", event); this.$emit("click", event);
} }
}
} }
}
}; };
</script> </script>
<style lang="less"> <style lang="less">
a.op { a.op {
display: inline; display: inline;
margin: 0 3px; margin: 0 3px;
} }
</style> </style>
\ No newline at end of file
...@@ -11753,7 +11753,7 @@ ...@@ -11753,7 +11753,7 @@
"dependencies": { "dependencies": {
"source-map": { "source-map": {
"version": "0.6.1", "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=", "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=",
"dev": true, "dev": true,
"optional": true "optional": true
......
<template> <template>
<div class="h100"> <div class="h100">
<DataGrid :columns="columns" ref="grid" :action="action"> <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">
......
...@@ -84,6 +84,7 @@ ...@@ -84,6 +84,7 @@
</Modal> </Modal>
</div> </div>
</template> </template>
<script> <script>
import MasterData from "./masterData.vue"; import MasterData from "./masterData.vue";
...@@ -126,17 +127,14 @@ export default { ...@@ -126,17 +127,14 @@ export default {
}, },
methods: { methods: {
clickItem(val) { clickItem(val) {
console.log(val);
this.nodeInfo.codeRuleId = val; this.nodeInfo.codeRuleId = val;
this.model8 = val; this.model8 = val;
this.cityList.forEach((e) => { this.cityList.forEach((e) => {
if (val == e.id) { if (val == e.id) {
this.downName = e.name; this.downName = e.name;
this.nodeInfo.codeRuleType = e.type; this.nodeInfo.codeRuleType = e.type;
} }
}); });
this.model8 = val;
this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType); this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType);
}, },
listSlecet() { listSlecet() {
...@@ -214,7 +212,10 @@ export default { ...@@ -214,7 +212,10 @@ export default {
onOk: () => { onOk: () => {
Api.delete(this.nodeInfo.id).then((r) => { Api.delete(this.nodeInfo.id).then((r) => {
if (r.success) { if (r.success) {
this.loadTree(this.nodeInfo.codeRuleId); this.loadTree(
this.nodeInfo.codeRuleId,
this.nodeInfo.codeRuleType
);
this.$Message.success("删除成功"); this.$Message.success("删除成功");
} }
}); });
...@@ -281,13 +282,17 @@ export default { ...@@ -281,13 +282,17 @@ export default {
// this.$refs.dataTable.dataColumns = tableData; // this.$refs.dataTable.dataColumns = tableData;
// } // }
}, },
loadTree(id) { loadTree(id, codeRuleType) {
let data = { let data = {
conditions: [ conditions: [
{ fieldName: "codeRuleId", fieldValue: id, conditionalType: "Equal" }, {
fieldName: "codeRuleId",
fieldValue: id,
conditionalType: "Equal",
},
{ {
fieldName: "codeRuleType", fieldName: "codeRuleType",
fieldValue: this.nodeInfo.codeRuleType, fieldValue: codeRuleType,
conditionalType: "Equal", conditionalType: "Equal",
}, },
], ],
...@@ -322,6 +327,7 @@ export default { ...@@ -322,6 +327,7 @@ export default {
ids.push(b.id); ids.push(b.id);
if (b.children) { if (b.children) {
addId(b.children); addId(b.children);
function addId(data) { function addId(data) {
data.map((u) => { data.map((u) => {
ids.push(u.id); ids.push(u.id);
...@@ -345,6 +351,7 @@ export default { ...@@ -345,6 +351,7 @@ export default {
let expand = this.expand; let expand = this.expand;
let result = []; let result = [];
search(this.keys, items); search(this.keys, items);
function search(keys, data) { function search(keys, data) {
data.map((u) => { data.map((u) => {
if (keys.length < u.title) { if (keys.length < u.title) {
...@@ -365,7 +372,8 @@ export default { ...@@ -365,7 +372,8 @@ export default {
}, },
}; };
</script> </script>
<style lang="less" >
<style lang="less">
.classification { .classification {
font-family: Microsoft YaHei; font-family: Microsoft YaHei;
...@@ -381,6 +389,7 @@ export default { ...@@ -381,6 +389,7 @@ export default {
background: #eee; background: #eee;
padding-left: 10px; padding-left: 10px;
} }
.p-list { .p-list {
h3 { h3 {
height: 50px; height: 50px;
...@@ -393,22 +402,26 @@ export default { ...@@ -393,22 +402,26 @@ export default {
opacity: 1; opacity: 1;
padding-left: 10px; padding-left: 10px;
} }
.search { .search {
height: 50px; height: 50px;
padding: 5px 10px; padding: 5px 10px;
} }
.fg { .fg {
flex: none; flex: none;
height: 100%; height: 100%;
overflow: auto; overflow: auto;
padding-left: 10px; padding-left: 10px;
} }
.tree { .tree {
height: calc(100vh - 215px); height: calc(100vh - 215px);
overflow: auto; overflow: auto;
} }
} }
} }
.show_menu { .show_menu {
width: 30px; width: 30px;
height: 30px; height: 30px;
...@@ -416,6 +429,7 @@ export default { ...@@ -416,6 +429,7 @@ export default {
top: 100px; top: 100px;
left: 0; left: 0;
z-index: 9; z-index: 9;
.menu_play { .menu_play {
width: 30px; width: 30px;
height: 30px; height: 30px;
...@@ -428,11 +442,13 @@ export default { ...@@ -428,11 +442,13 @@ export default {
background: #ffffff; background: #ffffff;
box-shadow: #ccc 2px 2px 4px 1px; box-shadow: #ccc 2px 2px 4px 1px;
} }
.menu_play:hover { .menu_play:hover {
background-color: #2d8cf0; background-color: #2d8cf0;
color: white; color: white;
} }
} }
.ivu-layout-content { .ivu-layout-content {
// margin-left: 5px; // margin-left: 5px;
background: rgba(255, 255, 255, 1); background: rgba(255, 255, 255, 1);
...@@ -443,4 +459,4 @@ export default { ...@@ -443,4 +459,4 @@ export default {
overflow-y: hidden; overflow-y: hidden;
} }
} }
</style> </style>
\ No newline at end of file
<template> <template>
<div class="master-data"> <div class="master-data">
<!-- <Table border :columns="columns" :data="dataColumns" :height="tableHeight"></Table> --> <!-- <Table border :columns="columns" :data="dataColumns" :height="tableHeight"></Table> -->
<DataGrid <DataGrid :columns="columns" ref="grid" :conditions="easySearch" :action="action" :high="false" :height="tableHeight">
:columns="columns" <template slot="easySearch">
ref="grid" <Form ref="formInline" :model="easySearch" inline>
:conditions="easySearch" <FormItem prop="keys">
:action="action" <Input placeholder="请输入编码/名称" v-width="200" v-model="easySearch.keys.value" clearable />
:high="false" </FormItem>
:height="tableHeight" <FormItem>
> <Button type="primary" @click="search">查询</Button>
<template slot="easySearch"> </FormItem>
<Form ref="formInline" :model="easySearch" inline> </Form>
<FormItem prop="keys"> </template>
<Input placeholder="请输入编码/名称" v-width="200" v-model="easySearch.keys.value" clearable />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
</DataGrid> </DataGrid>
</div> </div>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
export default { export default {
name: "masterData", name: "masterData",
props: ["root"], props: ["root"],
data() { data() {
return { return {
action: Api.index, action: Api.index,
tableHeight: "", tableHeight: "",
dataColumns: [], dataColumns: [],
easySearch: { easySearch: {
keys: { op: "code,name", value: null }, keys: {
id: { op: "In", value: "" } op: "code,name",
}, value: null
columns: [ },
// { id: {
// key: "index", op: "In",
// title: "#", value: ""
// align: "left", }
// width: 60 },
// }, columns: [
{ // {
key: "code", // key: "index",
title: "编码", // title: "#",
align: "left" // align: "left",
}, // width: 60
{ // },
key: "name",
title: "名称",
align: "left"
},
{
key: "status",
title: "状态",
align: "left",
code: "materail.category.status"
},
{
key: "description",
title: "描述",
align: "left"
},
{
title: "操作",
key: "action",
width: 260,
align: "left",
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{ {
attrs: { oprate: "edit" }, key: "code",
on: { click: () => this.edit(params.row) } title: "编码",
align: "left"
}, },
"编辑"
),
h(
"op",
{ {
attrs: { oprate: "delete" }, key: "name",
on: { click: () => this.remove(params.row.id) } title: "名称",
align: "left"
}, },
"删除" {
) key: "status",
]); title: "状态",
} align: "left",
} code: "materail.category.status"
] },
};
}, {
async fetch({ store, params }) { key: "description",
await store.dispatch("loadDictionary"); // 加载数据字典 title: "描述",
}, align: "left"
created() { },
this.tableHeight = window.innerHeight - 220; {
}, title: "操作",
mounted() { key: "action",
window.onresize = () => { width: 260,
///浏览器窗口大小变化 align: "left",
return (() => { render: (h, params) => {
window.screenHeight = window.innerHeight; return h("div", {
class: "action"
}, [
h(
"op", {
attrs: {
oprate: "edit"
},
on: {
click: () => this.edit(params.row)
}
},
"编辑"
),
h(
"op", {
attrs: {
oprate: "delete"
},
on: {
click: () => this.remove(params.row.id)
}
},
"删除"
)
]);
}
}
]
};
},
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
this.tableHeight = window.innerHeight - 220; this.tableHeight = window.innerHeight - 220;
})();
};
},
methods: {
search() {
// alert(JSON.stringify(this.easySearch));
console.log(this.easySearch);
this.$refs.grid.reload(this.easySearch);
}, },
edit(row) { mounted() {
this.$emit("on-edit", row); window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.tableHeight = window.innerHeight - 220;
})();
};
}, },
remove(id) { methods: {
Api.delete(id).then(r => { search() {
if (r.success) { // alert(JSON.stringify(this.easySearch));
this.$refs.grid.reload(this.easySearch); console.log(this.easySearch);
this.$Message.success("删除成功"); this.$refs.grid.reload(this.easySearch);
},
edit(row) {
this.$emit("on-edit", row);
},
remove(id) {
Api.delete(id).then(r => {
if (r.success) {
this.$refs.grid.reload(this.easySearch);
this.$Message.success("删除成功");
}
});
} }
}); },
} watch: {
}, root: {
watch: { handler(newName, oldName) {
root: { if (newName.id) {
handler(newName, oldName) { this.easySearch.id.value = newName.ids;
if (newName.id) { this.$refs.grid.reload(this.easySearch);
this.easySearch.id.value = newName.ids; } else {
this.$refs.grid.reload(this.easySearch); this.easySearch.id.value = "-1";
} else { }
this.easySearch.id.value = "-1"; },
immediate: true,
deep: true
} }
},
immediate: true,
deep: true
} }
}
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.spare-parts { .spare-parts {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
</style> </style>
\ No newline at end of file
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
</Layout> </Layout>
</div> </div>
</template> </template>
<script> <script>
import MasterData from "./masterData.vue"; import MasterData from "./masterData.vue";
...@@ -74,6 +75,7 @@ export default { ...@@ -74,6 +75,7 @@ export default {
nodeInfo: { nodeInfo: {
categoryId: 0, categoryId: 0,
rootCategoryId: 0, rootCategoryId: 0,
rootCategoryName: "",
ids: [], ids: [],
addChange: true, addChange: true,
codeRuleId: 0, codeRuleId: 0,
...@@ -86,7 +88,9 @@ export default { ...@@ -86,7 +88,9 @@ export default {
detail: null, detail: null,
showMenu: true, showMenu: true,
dataList: [], dataList: [],
codeRuleId: "",
rootCategoryId: null,
categoryId: null,
}; };
}, },
async fetch({ store, params }) { async fetch({ store, params }) {
...@@ -98,16 +102,14 @@ export default { ...@@ -98,16 +102,14 @@ export default {
}, },
methods: { methods: {
clickItem(val) { clickItem(val) {
this.codeRuleId = val;
this.nodeInfo.codeRuleId = val; this.nodeInfo.codeRuleId = val;
this.model8 = val; this.model8 = val;
this.cityList.forEach((e) => { this.cityList.forEach((e) => {
if (val == e.id) { if (val == e.id) {
this.downName = e.name; 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() { listSlecet() {
let data = { let data = {
...@@ -164,14 +166,17 @@ export default { ...@@ -164,14 +166,17 @@ export default {
); );
}, },
handleSelect(root, data) { handleSelect(root, data) {
let pid = null; //定义最顶级id let pid = -1; //定义最顶级id
let upId = data.upId; var pname = "";
var upId = data.upId;
let roots = root; let roots = root;
function addId(roots, upId) { function addId(roots, upId) {
roots.map((u) => { roots.map((u) => {
if (u.node.id == upId) { if (u.node.id == upId) {
if (u.node.upId == 0) { if (u.node.upId == 0) {
pid = u.node.id; pid = u.node.id;
pname = u.node.name;
} else { } else {
upId = u.node.upId; upId = u.node.upId;
addId(roots, upId); addId(roots, upId);
...@@ -179,18 +184,26 @@ export default { ...@@ -179,18 +184,26 @@ export default {
} }
}); });
} }
addId(roots, upId); addId(roots, upId);
this.nodeInfo.categoryId = data.id; this.nodeInfo.categoryId = data.id;
if (pid == null) { this.nodeInfo.rootCategoryName = data.name;
if (pid == -1) {
this.nodeInfo.rootCategoryId = data.id; this.nodeInfo.rootCategoryId = data.id;
this.nodeInfo.rootCategoryName = data.name;
} else { } else {
this.nodeInfo.rootCategoryId = pid; this.nodeInfo.rootCategoryId = pid;
this.nodeInfo.rootCategoryName = pname;
} }
}, },
loadTree(id, codeRuleType) { loadTree(id, codeRuleType) {
let data = { let data = {
conditions: [ conditions: [
{ fieldName: "codeRuleId", fieldValue: id, conditionalType: "Equal" }, {
fieldName: "codeRuleId",
fieldValue: id,
conditionalType: "Equal",
},
{ {
fieldName: "codeRuleType", fieldName: "codeRuleType",
fieldValue: codeRuleType, fieldValue: codeRuleType,
...@@ -231,6 +244,7 @@ export default { ...@@ -231,6 +244,7 @@ export default {
ids.push(b.value); ids.push(b.value);
if (b.children) { if (b.children) {
addId(b.children); addId(b.children);
function addId(data) { function addId(data) {
data.map((u) => { data.map((u) => {
ids.push(u.value); ids.push(u.value);
...@@ -252,6 +266,7 @@ export default { ...@@ -252,6 +266,7 @@ export default {
let expand = this.expand; let expand = this.expand;
let result = []; let result = [];
search(this.keys, items); search(this.keys, items);
function search(keys, data) { function search(keys, data) {
data.map((u) => { data.map((u) => {
if (keys.length < u.title) { if (keys.length < u.title) {
...@@ -272,7 +287,8 @@ export default { ...@@ -272,7 +287,8 @@ export default {
}, },
}; };
</script> </script>
<style lang="less" >
<style lang="less">
.classification { .classification {
font-family: Microsoft YaHei; font-family: Microsoft YaHei;
...@@ -288,6 +304,7 @@ export default { ...@@ -288,6 +304,7 @@ export default {
background: #eee; background: #eee;
padding-left: 10px; padding-left: 10px;
} }
.p-list { .p-list {
h3 { h3 {
height: 50px; height: 50px;
...@@ -300,22 +317,26 @@ export default { ...@@ -300,22 +317,26 @@ export default {
opacity: 1; opacity: 1;
padding-left: 10px; padding-left: 10px;
} }
.search { .search {
height: 50px; height: 50px;
padding: 5px 10px; padding: 5px 10px;
} }
.fg { .fg {
flex: none; flex: none;
height: 100%; height: 100%;
overflow: auto; overflow: auto;
padding-left: 10px; padding-left: 10px;
} }
.tree { .tree {
height: calc(100vh - 215px); height: calc(100vh - 215px);
overflow: auto; overflow: auto;
} }
} }
} }
.show_menu { .show_menu {
width: 30px; width: 30px;
height: 30px; height: 30px;
...@@ -323,6 +344,7 @@ export default { ...@@ -323,6 +344,7 @@ export default {
top: 100px; top: 100px;
left: 0; left: 0;
z-index: 9; z-index: 9;
.menu_play { .menu_play {
width: 30px; width: 30px;
height: 30px; height: 30px;
...@@ -335,11 +357,13 @@ export default { ...@@ -335,11 +357,13 @@ export default {
background: #ffffff; background: #ffffff;
box-shadow: #ccc 2px 2px 4px 1px; box-shadow: #ccc 2px 2px 4px 1px;
} }
.menu_play:hover { .menu_play:hover {
background-color: #2d8cf0; background-color: #2d8cf0;
color: white; color: white;
} }
} }
.ivu-layout-content { .ivu-layout-content {
// margin-left: 5px; // margin-left: 5px;
background: rgba(255, 255, 255, 1); background: rgba(255, 255, 255, 1);
...@@ -350,4 +374,4 @@ export default { ...@@ -350,4 +374,4 @@ export default {
overflow-y: hidden; overflow-y: hidden;
} }
} }
</style> </style>
\ No newline at end of file
<template> <template>
<div class="master-data"> <div class="master-data">
<DataGrid <DataGrid :columns="cols" ref="grid" :conditions="easySearch" :action="action" :initsearch="sets" :high="false" :format="formatFun" :height="tableHeight" @on-selection-change="onSelect" :exportTitle="exportTitle">
:columns="cols" <template slot="easySearch">
ref="grid" <Form ref="formInline" :model="easySearch" inline>
:conditions="easySearch" <FormItem prop="keys">
:action="action" <Input placeholder="请输入编码/名称/状态" v-width="200" v-model="easySearch.keys.value" clearable />
:initsearch="sets" </FormItem>
:high="false" <FormItem>
:format="formatFun" <Button type="primary" @click="search">查询</Button>
:height="tableHeight" </FormItem>
@on-selection-change="onSelect" </Form>
> </template>
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input
placeholder="请输入编码/名称/状态"
v-width="200"
v-model="easySearch.keys.value"
clearable
/>
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
<template slot="buttons"> <template slot="buttons">
<Button type="primary" @click="add">新增</Button> <Button type="primary" @click="add">新增</Button>
</template> <Button @click="openModalIm">导入</Button>
<template slot="batch"> </template>
<Button type="primary" @click="modalSchedule">批量送审</Button> <template slot="batch">
</template> <Button type="primary" @click="modalSchedule">批量送审</Button>
</template>
</DataGrid> </DataGrid>
<Modal <Modal v-model="modal" :title="title" width="1000" footer-hide :mask-closable="false" :fullscreen="fullscreen">
v-model="modal" <component :is="detail" :eid="curId" :rootCategoryId="rootCategoryId" :rowsTable="rowsTable" :nodeInfo="nodeInfo" @on-close="cancel" @on-cancel="cancel" @on-ok="ok" ref="chlidren" />
: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> </Modal>
</div> <ImportExcel ref="importExcel" @on-get-data="getData" :columns="cols" :open="ModalIm" @on-cancel="ModalImCancel" @on-ok="ok" />
</div>
</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: "masterData", name: "masterData",
components: { components: {
// Search // Search
}, },
props: ["nodeInfo"], props: ["nodeInfo"],
data() { data() {
return { return {
action: Api.index, action: Api.index,
tableHeight: "", tableHeight: "",
modal: false, modal: false,
title: "新增", title: "新增",
curId: 0, curId: 0,
rootCategoryId: 0, rootCategoryId: 0,
selectRows: [], selectRows: [],
rowsTable: [], rowsTable: [],
fullscreen: false, fullscreen: false,
detail: null, detail: null,
sets: v => { sets: v => {
v.categoryId = this.nodeInfo.categoryId; v.categoryId = this.nodeInfo.categoryId;
v.rootCategoryId = this.nodeInfo.rootCategoryId; v.rootCategoryId = this.nodeInfo.rootCategoryId;
}, },
easySearch: { easySearch: {
keys: { op: "code,name", value: null }, keys: {
categoryId: { op: "code,name",
op: "In", value: null
value: this.nodeInfo.ids },
} categoryId: {
}, op: "In",
columns: [ value: this.nodeInfo.ids
{
type: "selection",
width: 70,
align: "center"
},
{
key: "code",
title: "编码",
align: "left",
render: (h, params) => {
return h(
"a",
{
props: {},
on: {
click: () => this.details(params.row)
} }
}, },
!params.row.code ? "未分配" : params.row.code columns: [{
); type: "selection",
} width: 70,
}, align: "center"
{ },
key: "name",
title: "名称",
align: "left"
},
{
key: "status",
title: "状态",
align: "left",
render: (h, params) => {
return h("state", {
props: {
code: "material.main.status",
type: "text",
value: params.row.status + ""
}
});
}
},
{
key: "version",
title: "版本",
align: "left",
code: "material.main.version"
},
{
key: "drawing",
title: "图号",
align: "left"
},
{
key: "creationTime",
title: "创建时间",
hide: true,
align: "left",
type: "date"
},
{
key: "creatorUserId",
title: "创建人",
hide: true,
align: "left",
type: "user"
},
{
title: "操作",
key: "action",
width: 150,
align: "left",
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{ {
attrs: { oprate: "edit" }, key: "code",
on: { click: () => this.edit(params.row) } title: "编码",
align: "left",
render: (h, params) => {
return h(
"a", {
props: {},
on: {
click: () => this.details(params.row)
}
},
!params.row.code || params.row.code == 0 ? "未分配" : params.row.code
);
}
}, },
"编辑"
),
h(
"op",
{ {
attrs: { oprate: "delete" }, key: "name",
on: { click: () => this.remove(params.row.id) } title: "名称",
align: "left"
}, },
params.row.status == 3 ? "" : "删除"
),
h(
"op",
{ {
attrs: { oprate: "edit" }, key: "status",
on: { click: () => this.send(params.row) } title: "状态",
align: "center",
code: "material.main.status",
}, },
(params.row.status == 0 || params.row.status == 1) && {
this.status == 0 key: "version",
? "送审" title: "版本",
: "" align: "left",
) code: "material.main.version"
]); },
} {
} key: "drawing",
], //基础咧 title: "图号",
cols: [], // align: "left"
status: null },
}; {
}, key: "creationTime",
async fetch({ store, params }) { title: "创建时间",
await store.dispatch("loadDictionary"); // 加载数据字典 hide: true,
}, align: "left",
created() { type: "date"
this.tableHeight = window.innerHeight - 220; },
if (this.nodeInfo.rootCategoryId == 0) { {
this.cols = this.columns; key: "creatorUserId",
} else { title: "创建人",
this.initCols(); hide: true,
} align: "left",
Api.getbyid({ type: "user"
id: "b6303ddc-8b5e-40a3-a51b-294657d1d913" },
}).then(r => { {
this.status = r.result.status; //status为0的话为启用,有送审,为1的话,流程是禁用的,没有送审按钮 title: "操作",
this.nodeInfo.status = this.status; key: "action",
}); width: 150,
}, align: "left",
mounted() { render: (h, params) => {
window.onresize = () => { return h("div", {
///浏览器窗口大小变化 class: "action"
return (() => { }, [
window.screenHeight = window.innerHeight; h(
"op", {
attrs: {
oprate: "edit"
},
on: {
click: () => this.edit(params.row)
}
},
"编辑"
),
h(
"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)
}
},
(params.row.status == 0 || params.row.status == 1) &&
this.status == 0 ?
"送审" :
""
)
]);
}
}
], //基础咧
cols: [], //
status: null,
ModalIm: false,
addCol: [],
exportTitle: '物料管理',
};
},
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
this.tableHeight = window.innerHeight - 220; this.tableHeight = window.innerHeight - 220;
})();
}; if (this.nodeInfo.rootCategoryId == 0) {
}, this.cols = this.columns;
methods: {
//格式化原始数据
formatFun(data) {
data.map(e => {
if (e.status == 0) {
e._disabled = false;
} else { } else {
e._disabled = true; this.initCols();
} }
}); Api.getbyid({
return data; id: "b6303ddc-8b5e-40a3-a51b-294657d1d913"
}, }).then(r => {
onSelect(a, b) { this.status = r.result.status; //status为0的话为启用,有送审,为1的话,流程是禁用的,没有送审按钮
// console.log(a); this.nodeInfo.status = this.status;
// console.log(b); });
//批量选择
this.rootCategoryId = a[0].rootCategoryId;
this.selectRows = a;
}, },
modalSchedule() { mounted() {
this.fullscreen = true; window.onresize = () => {
this.rowsTable = this.selectRows; ///浏览器窗口大小变化
this.title = "物料送审"; return (() => {
this.curId = 0; window.screenHeight = window.innerHeight;
this.detail = () => import("./submit"); this.tableHeight = window.innerHeight - 220;
this.modal = true; })();
};
}, },
search() { methods: {
this.$refs.grid.reload(this.easySearch); //格式化原始数据
}, formatFun(data) {
initCols(delay) { data.map(e => {
let conditions = [ if (e.status == 0) {
{ e._disabled = false;
conditionalType: "Equal", } else {
fieldName: "categoryId", e._disabled = true;
fieldValue: this.nodeInfo.rootCategoryId }
} });
]; return data;
},
onSelect(a, b) {
// console.log(a);
// console.log(b);
//批量选择
this.rootCategoryId = a[0].rootCategoryId;
this.selectRows = a;
},
modalSchedule() {
this.fullscreen = true;
this.rowsTable = this.selectRows;
this.title = "物料送审";
this.curId = 0;
this.detail = () => import("./submit");
this.modal = true;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
initCols(delay) {
let conditions = [{
conditionalType: "Equal",
fieldName: "categoryId",
fieldValue: this.nodeInfo.rootCategoryId
}];
Api.listTable({
conditions: conditions,
sortBy: "id",
isDesc: false
}).then(r => {
if (r.result) {
var items = r.result.filter(u => {
return (
!this.columns.some(p => {
return p.key == u.field;
}) && u.dataType != 5
);
});
this.addCol = items;
this.cols = this.$u.clone(this.columns);
let extra = items.map(u => {
console.log(u);
var col = {
key: u.field,
title: u.title
};
if (u.dataType == 3) {
col.code = u.note;
}
if (u.dataType == 4) {
col.type = "date";
}
if (u.unitName && (u.dataType == 1 || u.dataType == 2)) {
var units = this.$store.getters.dictionaryByKey(
"material.main.unitName"
);
Api.listTable({ let item = units.filter(p => {
conditions: conditions, return p.code == u.unitName;
sortBy: "id", });
isDesc: false // console.log(units, item);
}).then(r => { col.title += "(" + item[0].name + ")";
if (r.result) { }
var items = r.result.filter(u => { return col;
return ( });
!this.columns.some(p => { this.cols = this.cols.concat(extra);
return p.key == u.field; var action = this.cols.splice(this.columns.length - 1, 1);
}) && u.dataType != 5 this.cols.push(this.columns[this.columns.length - 1]);
); if (delay) {
}); delay();
this.cols = this.$u.clone(this.columns); }
let extra = items.map(u => { // console.log(this.cols)
console.log(u); }
var col = { });
key: u.field, this.exportTitle = "物料管理-" + this.nodeInfo.rootCategoryName;
title: u.title },
}; add() {
if (u.dataType == 3) { if (this.nodeInfo.categoryId) {
col.code = u.note; if (this.nodeInfo.addChange == true) {
this.fullscreen = false;
this.curId = 0;
this.title = "新增";
this.detail = () => import("./add");
this.modal = true;
} else {
this.$Message.error("请在设置的分类层级数下添加物料");
}
} else {
this.$Message.error("请先选择分类");
} }
if (u.dataType == 4) { },
col.type = "date"; edit(row) {
this.fullscreen = false;
this.curId = row.id;
this.title = "编辑";
this.detail = () => import("./edit");
this.modal = true;
},
remove(id) {
Api.delete(id).then(r => {
if (r.success) {
this.$refs.grid.reload(this.easySearch);
this.$Message.success("删除成功");
}
});
},
details(row) {
this.fullscreen = true;
this.curId = row.id;
this.rootCategoryId = row.rootCategoryId;
this.title = "详情";
this.detail = () => import("./details");
this.rowsTable = [];
this.modal = true;
},
send(row) {
this.fullscreen = true;
this.curId = row.id;
this.rootCategoryId = row.rootCategoryId;
this.title = "物料送审";
this.detail = () => import("./submit");
this.rowsTable = [];
this.modal = true;
},
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("请先选择分类");
} }
if (u.unitName && (u.dataType == 1 || u.dataType == 2)) {
var units = this.$store.getters.dictionaryByKey(
"material.main.unitName"
);
let item = units.filter(p => { },
return p.code == u.unitName; ModalImCancel() {
}); this.ModalIm = false
// console.log(units, item); },
col.title += "(" + item[0].name + ")"; getData(val) {
} let url = `${material}/materialimportservice/import`;
return col; this.$refs.importExcel.deelData(url, this.cols, this.formatMethod(val))
}); },
this.cols = this.cols.concat(extra); //根据页面二次处理数据
var action = this.cols.splice(this.columns.length - 1, 1); formatMethod(val) {
this.cols.push(this.columns[this.columns.length - 1]); let tempData = this.$u.clone(val);
if (delay) { let tempList = [];
delay(); tempData.forEach((ele) => {
} let obj = {
// console.log(this.cols) name: ele.name ? ele.name : '',
} version: ele.version ? Number(ele.version) : '',
}); drawing: ele.drawing ? ele.drawing : '',
}, description: ele.description ? ele.description : "",
add() { code: 0,
if (this.nodeInfo.categoryId) { status: this.nodeInfo.status == 1 ? 3 : 0,
if (this.nodeInfo.addChange == true) { codeRuleId: this.nodeInfo.codeRuleId,
this.fullscreen = false; categoryId: this.nodeInfo.categoryId, //左侧树点击的id
this.curId = 0; customProperties: {},
this.title = "新增"; rootCategoryId: this.nodeInfo.rootCategoryId, //左侧树点击的数据的最顶层id
this.detail = () => import("./add"); };
this.modal = true; this.addCol.forEach(el => {
} else { obj[el.field] = ele[el.field]
this.$Message.error("请在设置的分类层级数下添加物料"); })
} if (ele.name && ele.name != '') {
} else { obj.ico = false
this.$Message.error("请先选择分类"); } else {
} obj.ico = true
}, }
edit(row) { tempList.push(obj);
this.fullscreen = false;
this.curId = row.id; });
this.title = "编辑"; return tempList
this.detail = () => import("./edit");
this.modal = true; },
}, //批量导入end
remove(id) {
Api.delete(id).then(r => {
if (r.success) {
this.$refs.grid.reload(this.easySearch);
this.$Message.success("删除成功");
}
});
},
details(row) {
this.fullscreen = true;
this.curId = row.id;
this.rootCategoryId = row.rootCategoryId;
this.title = "详情";
this.detail = () => import("./details");
this.rowsTable = [];
this.modal = true;
},
send(row) {
this.fullscreen = true;
this.curId = row.id;
this.rootCategoryId = row.rootCategoryId;
this.title = "物料送审";
this.detail = () => import("./submit");
this.rowsTable = [];
this.modal = true;
},
ok() {
this.$refs.grid.reload(this.easySearch);
this.modal = false;
this.curId = 0;
}, },
cancel() { watch: {
this.curId = 0; nodeInfo: {
this.modal = false; handler(newName, oldName) {
} // console.log("ovo", newName, oldName);
}, if (newName.rootCategoryId) {
watch: { this.initCols(() => {
nodeInfo: { if (newName.categoryId) {
handler(newName, oldName) { this.easySearch.categoryId.value = newName.ids;
// console.log("ovo", newName, oldName); this.$refs.grid.reload(this.easySearch);
if (newName.rootCategoryId) { }
this.initCols(() => { });
if (newName.categoryId) { }
this.easySearch.categoryId.value = newName.ids; if (!newName.categoryId) {
this.$refs.grid.reload(this.easySearch); this.easySearch.categoryId.value = "-1";
} }
}); },
} immediate: true,
if (!newName.categoryId) { deep: true
this.easySearch.categoryId.value = "-1";
} }
},
immediate: true,
deep: true
} }
}
}; };
</script> </script>
<style lang="less" >
<style lang="less">
.master-data { .master-data {
.ivu-footer-toolbar-right { .ivu-footer-toolbar-right {
margin-right: 72% !important; margin-right: 72% !important;
} }
} }
</style> </style>
\ No newline at end of file
<template> <template>
<Layout class="full"> <Layout class="full">
<!-- <Sider hide-trigger :style="{background: '#fff'}" width="260"> <!-- <Sider hide-trigger :style="{background: '#fff'}" width="260">
<div class="zh-tree" :style="{height:treeHeight+'px'}"> <div class="zh-tree" :style="{height:treeHeight+'px'}">
<h3 class="zh-title">产品结构</h3> <h3 class="zh-title">产品结构</h3>
...@@ -15,104 +15,83 @@ ...@@ -15,104 +15,83 @@
</div> </div>
</Sider>--> </Sider>-->
<Sider hide-trigger v-if="showMenu" class="menu_side" width="300"> <Sider hide-trigger v-if="showMenu" class="menu_side" width="300">
<ProductTree @on-hide="onHide" @on-select="productSearch" /> <ProductTree @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':''">
<!--:data="dataT"--> <!--:data="dataT"-->
<DataGrid <DataGrid :action="action" :columns="columns" :conditions="easySearch" ref="grid" @on-selection-change="onSelect" :batch="true" :border="false" rowKey="id" exportTitle="订单管理" @on-import-data="onImportData">
:action="action" <template slot="easySearch">
:columns="columns" <Form ref="formInline" :model="easySearch" inline>
:conditions="easySearch" <FormItem prop="keys">
ref="grid" <Input placeholder="请输入订单编号/产品名称" v-model="easySearch.keys.value" v-width="300" />
@on-selection-change="onSelect" </FormItem>
:batch="true" <FormItem>
:border="false" <Button type="primary" @click="search">查询</Button>
rowKey="id" </FormItem>
> </Form>
<template slot="easySearch"> </template>
<Form ref="formInline" :model="easySearch" inline> <template slot="searchForm">
<FormItem prop="keys"> <Search />
<Input placeholder="请输入订单编号/产品名称" v-model="easySearch.keys.value" v-width="300" /> </template>
</FormItem> <template slot="buttons">
<FormItem> <Button type="primary" @click="addModal=true">创建</Button>
<Button type="primary" @click="search">查询</Button> </template>
</FormItem> <template slot="batch">
</Form> <Button type="primary" class="mr10 ml10" @click="openSendViewModal" v-if="this.wfstatu==1">订单送审</Button>
</template> <Button type="primary" class="mr10 ml10" @click="openSendModal">订单派发</Button>
<template slot="searchForm"> <Button type="primary" class="mr10 ml10" @click="removeList">批量删除</Button>
<Search /> </template>
</template> </DataGrid>
<template slot="buttons"> <Modal v-model="addModal" title="新增" footer-hide width="1200">
<Button type="primary" @click="addModal=true">创建</Button> <Add @on-close="cancel" @on-ok="addOk" />
</template> </Modal>
<template slot="batch"> <Modal v-model="editModal" title="编辑" footer-hide width="1200">
<Button <Edit :row="rowData" @on-close="cancel" @on-ok="addOk" />
type="primary" </Modal>
class="mr10 ml10" <Modal v-model="detailModal" title="订单详情" width="900">
@click="openSendViewModal" <Detail :row="rowData" />
v-if="this.wfstatu==1" </Modal>
>订单送审</Button> <Modal v-model="splitModal" title="订单分解" width="1200">
<Button type="primary" class="mr10 ml10" @click="openSendModal">订单派发</Button> <Split :row="rowData" ref="orderSplit" />
<Button type="primary" class="mr10 ml10" @click="removeList">批量删除</Button> <div slot="footer">
</template> <Button @click="splitModal = false">取消</Button>
</DataGrid> <Button type="primary" @click="orderSplitOk">确定分解</Button>
<Modal v-model="addModal" title="新增" footer-hide width="1200"> </div>
<Add @on-close="cancel" @on-ok="addOk" /> </Modal>
</Modal> <Modal v-model="sendViewModal" title="订单送审" width="1200">
<Modal v-model="editModal" title="编辑" footer-hide width="1200"> <SendView :row="rowDataArry" ref="orderSendView" />
<Edit :row="rowData" @on-close="cancel" @on-ok="addOk" /> <div slot="footer">
</Modal> <Button @click="sendViewModal = false">取消</Button>
<Modal v-model="detailModal" title="订单详情" width="900"> <Button type="primary" @click="sendViewOk">确定送审</Button>
<Detail :row="rowData" /> </div>
</Modal> </Modal>
<Modal v-model="splitModal" title="订单分解" width="1200"> <Modal v-model="sendModal" title="订单派发" width="1200">
<Split :row="rowData" ref="orderSplit" /> <Send :row="rowDataArry" ref="orderSend" />
<div slot="footer"> <div slot="footer">
<Button @click="splitModal = false">取消</Button> <Button @click="sendModal = false">取消</Button>
<Button type="primary" @click="orderSplitOk">确定分解</Button> <Button type="primary" @click="sendOk">确定派发</Button>
</div> </div>
</Modal> </Modal>
<Modal v-model="sendViewModal" title="订单送审" width="1200"> <Modal v-model="deletelModal" title="删除" @on-ok="removeOk" @on-cancel="cancel">
<SendView :row="rowDataArry" ref="orderSendView" /> <p>确定删除 订单:{{delMsg}} ?</p>
<div slot="footer"> </Modal>
<Button @click="sendViewModal = false">取消</Button> <!-- 信息提示 -->
<Button type="primary" @click="sendViewOk">确定送审</Button> <Modal v-model="ModalInfo" title="信息提示" width="600" :mask-closable="false" :scrollable="true" ok-text="确定" cancel-text="取消">
</div> {{ metCodesStrTxt }}
</Modal> <div slot="footer">
<Modal v-model="sendModal" title="订单派发" width="1200"> <Button @click="ModalInfo = false">取消</Button>
<Send :row="rowDataArry" ref="orderSend" /> <Button type="primary" @click="modalInfoOk">确定</Button>
<div slot="footer"> </div>
<Button @click="sendModal = false">取消</Button> </Modal>
<Button type="primary" @click="sendOk">确定派发</Button>
</div>
</Modal>
<Modal v-model="deletelModal" title="删除" @on-ok="removeOk" @on-cancel="cancel">
<p>确定删除 订单:{{delMsg}} ?</p>
</Modal>
<!-- 信息提示 -->
<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>
<Button type="primary" @click="modalInfoOk">确定</Button>
</div>
</Modal>
</Content> </Content>
</Layout> </Layout>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
import Add from "./add"; import Add from "./add";
...@@ -124,931 +103,968 @@ import Send from "./send"; ...@@ -124,931 +103,968 @@ import Send from "./send";
import SendView from "./sendView"; import SendView from "./sendView";
import ProductTree from "@/components/page/productTree.vue"; import ProductTree from "@/components/page/productTree.vue";
export default { export default {
name: "list", name: "list",
components: { components: {
Add, Add,
Edit, Edit,
Detail, Detail,
Search, Search,
Split, Split,
Send, Send,
SendView, SendView,
ProductTree ProductTree
}, },
data() { data() {
return { return {
action: Api.index, action: Api.index,
showMenu: true, showMenu: true,
easySearch: { easySearch: {
keys: { keys: {
op: "mesCode,productName", op: "mesCode,productName",
value: null, value: null,
default: true default: true
}, },
productId: { op: "In", value: "" } productId: {
}, op: "In",
addModal: false, value: ""
editModal: false,
detailModal: false,
deletelModal: false,
splitModal: false,
ModalInfo: false,
sendModal: false,
sendViewModal: false,
curId: 0,
id: "id",
columns: [
{
key: "selection",
type: "selection",
width: 50,
align: "center"
},
{
key: "id",
title: this.l("id"),
hide: true
},
{
key: "mesCode",
title: this.l("mesCode"),
align: "left",
width: 240,
easy: true,
high: true,
tree: true,
render: (h, params) => {
let name = params.row.mesCode;
let isUpId = params.row.upId;
let isDivideMark = params.row.divideMark;
let rowChildren = params.row.children;
return h(
"div",
{
style: {
cursor: "pointer",
display: "inline",
marginLeft: isDivideMark == 0 && isUpId == 0 ? "20px" : "0px"
} }
}, },
params.row.mesCode addModal: false,
); editModal: false,
} detailModal: false,
deletelModal: false,
splitModal: false,
ModalInfo: false,
sendModal: false,
sendViewModal: false,
curId: 0,
id: "id",
columns: [{
key: "selection",
type: "selection",
width: 50,
align: "center"
},
{
key: "id",
title: this.l("id"),
hide: true
},
{
key: "mesCode",
title: this.l("mesCode"),
align: "left",
width: 240,
easy: true,
high: true,
tree: true,
render: (h, params) => {
let name = params.row.mesCode;
let isUpId = params.row.upId;
let isDivideMark = params.row.divideMark;
let rowChildren = params.row.children;
return h(
"div", {
style: {
cursor: "pointer",
display: "inline",
marginLeft: isDivideMark == 0 && isUpId == 0 ? "20px" : "0px"
}
},
params.row.mesCode
);
}
},
{
key: "taskType",
title: this.l("taskType"),
align: "center",
high: true,
code: "plan.order.taskType",
width: 100
},
{
key: "quantity",
title: this.l("quantity"),
align: "right",
high: true,
width: 80
},
{
key: "taskRequire",
title: this.l("taskRequire"),
align: "left",
easy: true,
high: true,
hide: true
},
{
key: "status",
title: this.l("status"),
align: "center",
high: true,
code: "plan.order.status",
width: 100
},
{
key: "productCode",
title: this.l("productCode"),
align: "left",
easy: true,
high: true,
hide: true
},
{
key: "productName",
title: this.l("productName"),
align: "left",
easy: true,
high: true
},
{
key: "drawnNumber",
title: this.l("drawnNumber"),
align: "left",
easy: true,
high: true
},
{
key: "batchNumber",
title: this.l("batchNumber"),
align: "left",
easy: true,
high: true
},
{
key: "projectNumber",
title: this.l("projectNumber"),
align: "left",
easy: true,
high: true
},
{
key: "urgencyLevel",
title: this.l("urgencyLevel"),
align: "center",
high: true,
code: "plan.order.urgencyLevel",
width: 100
},
{
key: "productingPreparationPeople",
title: this.l("productingPreparationPeople"),
align: "left",
high: true,
hide: true,
type: 'workShopName'
},
{
key: "productingPreparationFinishDate",
title: this.l("productingPreparationFinishDate"),
align: "left",
high: true,
hide: true
},
{
key: "quotationPeople",
title: this.l("quotationPeople"),
align: "left",
high: true,
hide: true,
type: "user"
},
{
key: "quotationFinishDate",
title: this.l("quotationFinishDate"),
align: "left",
high: true,
hide: true
},
{
key: "demandStartDate",
title: this.l("demandStartDate"),
align: "left",
high: true,
hide: true,
type: "date"
},
{
key: "demandFinishDate",
title: this.l("demandFinishDate"),
align: "left",
high: true,
hide: true,
type: "date"
},
{
key: "creatorUserId",
title: this.$t("creatorUserId"),
align: "left",
high: true,
type: "user"
},
{
key: "creationTime",
title: this.$t("creationTime"),
align: "center",
high: true,
width: 180
},
{
key: "lastModifierUserId",
title: this.$t("lastModifierUserId"),
hide: true,
align: "left",
high: true,
type: "user"
},
{
key: "lastModificationTime",
title: this.$t("lastModificationTime"),
hide: true,
align: "center",
high: true,
width: 180
},
{
title: "操作",
key: "action",
width: 180,
align: "left",
render: (h, params) => {
return h("div", {
class: "action"
}, [
h(
"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 ?
(
(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 == 3 &&
params.row.id == params.row.rootId &&
params.row.divideMark != 0) ||
params.row.id != params.row.rootId ||
params.row.status != 3 ?
"display:none" :
"")
},
"编辑"
),
h(
"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 == 3 &&
params.row.id == params.row.rootId &&
params.row.divideMark != 0) ||
params.row.id != params.row.rootId ||
params.row.status != 3 ?
"display:none" :
"")
},
"删除"
),
h(
"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.divideMark != 0 &&
params.row.id == params.row.rootId) ||
params.row.status != 3 ||
params.row.quantity <= 1 ?
"display:none" :
"")
},
"分解"
)
]);
}
}
],
treeData: [],
treeInputSearch: "",
ocolumn: [],
treeHeight: "",
tableHeight: "",
ids: [],
orderSearchForm: {
productId: "", //产品id
productName: "", //产品名称
taskType: "", //任务类型
quantity: null, //数量
taskRequire: "", //任务接点要求
demandStartDate: "", //开始时间
demandFinishDate: "", //完成时间
remark: "", //备注
projectNumber: "", //项目号
batchNumber: "", //批次号
urgencyLevel: null //紧急程度
},
list: [],
//data测试数据
dataT: [],
dataTemp: [],
data1: [],
selectdata: [],
//以下为手写死数据集:
orderCatList: [], //订单类型下拉
outerCodeList: [], //型号外部代码下拉
missionCodeList: [], //任务号下拉
stageList: [], //阶段下拉
materailList: [], //材料下拉
routingAccessList: [], //工艺方法下拉
drawNumberList: [], //图号下拉
docNameList: [], //文档名称下拉
ownerGustList: [], //甲方客户下拉
mainDeptList: [], //厂内主体部门下拉
taskTypeList: [], //任务类型
statusList: [], //状态类型
rowData: {}, //编辑、查看的当前行数据
rowDataArry: [],
ModalInfoStaut: "",
sendList: [],
metCodesStrTxt: "",
actIds: [], //批量处理时ids
actMescodes: [],
delNum: 0, //判断是否可以进行修改
arrayIds: [], //选择列表后的ids
delMsg: "", //删除提示信息
dataListRetrunNew: {
schemaId: "123327da-42b3-41f6-b785-cf933f137a95", //订单送审的schemaId
idList: [], //订单id List
codeList: [], //订单编号List
operatorIdList: [] //操作员id
}, //确定后返回数据
wfstatu: 1 //流程是否启用1 禁用 0启用
};
},
created() {
this.treeHeight = window.innerHeight - 150;
},
mounted() {
this.initTree();
let params = {
id: "123327da-42b3-41f6-b785-cf933f137a95"
};
this.$api.get(`${workflowUrl}/schema/getbyid`, params).then(res => {
if (res.success) {
let wfStatus = res.result.status;
if (wfStatus == 0) {
this.wfstatu = 1;
} else {
this.wfstatu = 3;
}
}
});
//this.dataformat();//data传数据转为tree类型
this.tableHeight = window.innerHeight - 220;
//this.$refs.CustomTable.getTableHeight(this.tableHeight);
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.treeHeight = window.screenHeight - 150;
this.tableHeight = window.screenHeight - 220;
//this.$refs.CustomTable.getTableHeight(this.tableHeight);
})();
};
},
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
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) {
newNodeList.push(nodeLists[i]);
} else if (nodeLists[i].children.length > 0) {
searchTree(nodeLists[i].children, value);
}
}
}
if (text != "") {
searchTree(nodeList, text);
} else {
return nodeList;
}
return newNodeList;
}
},
methods: {
addOk() {
this.$refs.grid.load();
this.addModal = false;
this.detailModal = false;
this.editModal = false;
this.curId = 0;
}, },
{ search() {
key: "taskType", this.easySearch.keys.value = this.easySearch.keys.value.trim();
title: this.l("taskType"), this.$refs.grid.reload(this.easySearch);
align: "center",
high: true,
code: "plan.order.taskType",
width: 100
}, },
{ detail(row) {
key: "quantity", this.detailModal = true;
title: this.l("quantity"), this.rowData = row;
align: "right",
high: true,
width: 80
}, },
{ edit(row) {
key: "taskRequire", this.editModal = true;
title: this.l("taskRequire"), this.rowData = row;
align: "left",
easy: true,
high: true,
hide: true
}, },
{ split(row) {
key: "status", if (row.quantity > 1) {
title: this.l("status"), this.splitModal = true;
align: "center", this.rowData = row;
high: true, } else {
code: "plan.order.status", this.$Message.error("数量为1,不能进行分解");
width: 100 }
}, },
{ onHide() {
key: "productCode", // this.$Message.info("收起左侧树")
title: this.l("productCode"), this.showMenu = false;
align: "left",
easy: true,
high: true,
hide: true
}, },
{ showMenuFn() {
key: "productName", //this.$Message.info("展开左侧树")
title: this.l("productName"), this.showMenu = true;
align: "left",
easy: true,
high: true
}, },
{ productSearch(id, item, productIds, ids) {
key: "drawnNumber", let where = {
title: this.l("drawnNumber"), bomId: {
align: "left", op: "In",
easy: true, value: ids
high: true }
};
this.$refs.grid.reload(where);
}, },
{ //确定分解
key: "batchNumber", orderSplitOk() {
title: this.l("batchNumber"), let returnDatalist = this.$refs.orderSplit.returnDataList();
align: "left", let orderQuantity = returnDatalist.quantity;
easy: true, let orderListQuantity = 0;
high: true let quantyStatu = false; //子订单计划数是否为0或空
let dateStatu = false; //子订单开始完成时间是否为空
if (returnDatalist.items.length > 0) {
returnDatalist.items.forEach(data => {
orderListQuantity = orderListQuantity + parseFloat(data.quantity);
if (parseFloat(data.quantity) == 0 || data.quantity == "") {
quantyStatu = true;
}
if (data.demandDate[0] == "" || data.demandDate[1] == "") {
dateStatu = true;
}
});
if (dateStatu) {
this.$Message.error("子订单开始完成时间不能为空,请重新输入时间!");
return false;
}
if (quantyStatu) {
this.$Message.error("子订单计划数量不能为0,请重新输入计划数量!");
} else if (returnDatalist.quantity != orderListQuantity) {
this.$Message.error(
"计划总数量与订单数量不一致,请重新输入计划数量!"
);
} else {
this.ModalInfo = true;
this.ModalInfoStaut = "split";
this.dataListRetrun = returnDatalist;
this.metCodesStrTxt = "确定分解订单 " + returnDatalist.mesCode + "?";
}
} else {
this.$Message.error("请确定计划数量!");
}
}, },
{ modalInfoOk() {
key: "projectNumber", let itemsTemp = [];
title: this.l("projectNumber"), this.dataListRetrun.items.forEach(ele => {
align: "left", let objTemp = {};
easy: true, objTemp.mesCode = ele.mesCode;
high: true objTemp.quantity = Number(ele.quantity);
objTemp.demandStartDate = ele.demandStartDate + " 00:00:01";
objTemp.demandFinishDate = ele.demandFinishDate + " 23:59:59";
itemsTemp.push(objTemp);
});
let params = {
id: this.dataListRetrun.id,
items: itemsTemp
};
Api.mesorderdivide(params).then(res => {
if (res.result) {
this.$Message.success("订单分解成功!");
this.$refs.grid.load();
} else {
this.$Message.error("订单分解失败!");
}
});
this.splitModal = false;
this.ModalInfo = false;
}, },
{ //打开送审modal
key: "urgencyLevel", openSendViewModal() {
title: this.l("urgencyLevel"), this.actIds = [];
align: "center", this.delNum = 0;
high: true, if (this.rowDataArry.length > 0) {
code: "plan.order.urgencyLevel", this.rowDataArry.forEach(data => {
width: 100 this.actIds.push(data.id);
if (data.status != 1) {
//判断非新建状态的订单
this.delNum += 1;
}
});
setTimeout(() => {
if (this.delNum > 0) {
this.$Message.error("所选的订单中有不可送审的订单!");
this.actIds = [];
this.sendViewModal = false;
} else {
this.sendViewModal = true;
}
}, 400);
} else {
this.$Message.error("请选择订单");
}
},
//确定送审
sendViewOk() {
this.dataListRetrunNew.idList = [];
this.dataListRetrunNew.codeList = [];
this.dataListRetrunNew.operatorIdList = [];
this.rowDataArry.forEach(item => {
this.dataListRetrunNew.idList.push(item.id);
this.dataListRetrunNew.codeList.push(item.mesCode);
});
let ues = this.$refs.userProcess;
this.dataListRetrunNew.operatorIdList = this.$refs.orderSendView.getUsers();
//返回审批数据
//alert(JSON.stringify(this.dataListRetrunNew));
this.$http.order.batchstart(this.dataListRetrunNew).then(res => {
if (res.success) {
this.$Message.success("订单送审成功!");
this.$refs.grid.load();
} else {
this.$Message.error("订单送审失败!");
}
});
}, },
{ //打开派发
key: "productingPreparationPeople", openSendModal() {
title: this.l("productingPreparationPeople"), this.actIds = [];
align: "left", this.delNum = 0;
high: true, if (this.rowDataArry.length > 0) {
hide: true, this.rowDataArry.forEach(data => {
type:'workShopName' this.actIds.push(data.id);
if (data.status != 3) {
//判断非新建状态的订单
this.delNum += 1;
}
});
setTimeout(() => {
if (this.delNum > 0) {
this.$Message.error("所选的订单中有不可派发的订单!");
this.actIds = [];
this.sendModal = false;
} else {
this.sendModal = true;
}
}, 400);
} else {
this.$Message.error("请选择订单");
}
}, },
{ //确定派发
key: "productingPreparationFinishDate", sendOk() {
title: this.l("productingPreparationFinishDate"), this.$refs.orderSend.$refs["formValidate"].validate(valid => {
align: "left", if (valid) {
high: true, let ids = this.arrayIds;
hide: true let objInfoTem = this.$refs.orderSend.returnData();
let parms = [];
ids.forEach(e => {
let objInfo = this.$u.clone(objInfoTem);
objInfo.id = e;
parms.push(objInfo);
});
Api.mesorderdistribute(parms)
.then(r => {
if (r.success) {
if (r.result) {
this.$refs.grid.load();
this.sendModal = false;
this.$Message.success("派发成功");
} else {
this.sendModal = false;
this.$Message.error("派发失败");
}
} else {
this.sendModal = false;
this.$Message.error("派发失败");
}
})
.catch(err => {
this.sendModal = false;
this.$Message.error("操作失败");
});
}
});
}, },
{ //单条删除
key: "quotationPeople", remove(row) {
title: this.l("quotationPeople"), let metCodesSingle = []; //没有子订单的订单
align: "left", let metCodesFather = []; //有子订单的原始订单
high: true, this.delMsg = "";
hide: true, this.delNum = 0;
type: "user" this.actIds = [];
this.$refs.grid.cancelFooterToolbar();
this.actIds.push(row.id);
if (row.id != row.rootId) {
this.sondeletecheck(row.rootId);
metCodesFather.push(row.rootCode);
} else {
metCodesSingle.push(row.mesCode);
}
setTimeout(() => {
if (this.delNum > 0) {
this.$Message.error("删除的原始订单中有非新建状态的子订单!");
this.actIds = [];
return false;
} else {
let metCodesSingleStr = JSON.stringify(metCodesSingle)
.replace("[", "")
.replace("]", "")
.replace(/\"/g, "");
let metCodesFatherStr = JSON.stringify(metCodesFather)
.replace("[", "")
.replace("]", "")
.replace(/\"/g, "");
if (row.id == row.rootId) {
this.delMsg = metCodesSingleStr;
} else {
this.delMsg = metCodesFatherStr + " 的子订单";
}
this.deletelModal = true;
}
}, 400);
}, },
{ //批量删除
key: "quotationFinishDate", removeList() {
title: this.l("quotationFinishDate"), let metCodesSingle = []; //没有子订单的订单
align: "left", let metCodesFather = []; //有子订单的原始订单
high: true, this.actIds = [];
hide: true this.delNum = 0;
if (this.rowDataArry.length > 0) {
this.rowDataArry.forEach(data => {
this.actIds.push(data.id);
if (data.status != 1) {
//判断非新建状态的订单
this.delNum += 1;
} else if (data.id != data.rootId) {
//判断子订单是否可以删除
this.sondeletecheck(data.rootId);
if (data.id != data.rootId && data.status == 1) {
metCodesFather.push(data.rootCode);
}
} else {
if (data.id == data.rootId && data.status == 1) {
metCodesSingle.push(data.mesCode);
}
}
});
setTimeout(() => {
if (this.delNum > 0) {
this.$Message.error("所选的订单中有不可删除的订单!");
this.actIds = [];
this.deletelModal = false;
} else {
this.delMsg = "";
let metCodesFatherNew = Array.from(new Set(metCodesFather));
let metCodesSingleStr = JSON.stringify(metCodesSingle)
.replace("[", "")
.replace("]", "")
.replace(/\"/g, "");
let metCodesFatherStr = JSON.stringify(metCodesFatherNew)
.replace("[", "")
.replace("]", "")
.replace(/\"/g, "");
if (metCodesSingle.length > 0 && metCodesFather.length == 0) {
this.delMsg = metCodesSingleStr;
} else if (
metCodesSingle.length == 0 &&
metCodesFather.length > 0
) {
this.delMsg = metCodesFatherStr + " 的子订单";
} else if (metCodesSingle.length > 0 && metCodesFather.length > 0) {
this.delMsg =
metCodesSingleStr +
" 以及 订单:" +
metCodesFatherStr +
" 的子订单";
}
this.deletelModal = true;
}
}, 400);
} else {
this.$Message.error("请选择订单");
}
}, },
{ //删除前判断子订单是否能删除
key: "demandStartDate", sondeletecheck(code) {
title: this.l("demandStartDate"), let param = {
align: "left", id: code
high: true, };
hide: true, Api.sondeletecheck(param).then(res => {
type: "date" if (res.result == 1) {
this.delNum += 0;
} else {
this.delNum += 1;
}
});
}, },
{ //删除前判断子订单
key: "demandFinishDate", sondeletecheck1(code) {
title: this.l("demandFinishDate"), let param = {
align: "left", id: code
high: true, };
hide: true, let delStaut = 0;
type: "date" Api.sondeletecheck(param).then(res => {
if (res.result == 1) {
//可以删除
delStaut = 0;
} else {
delStaut = 1;
}
});
return delStaut;
}, },
{ //删除确定
key: "creatorUserId", removeOk() {
title: this.$t("creatorUserId"), let params = {
align: "left", ids: this.actIds
high: true, };
type: "user" Api.mesorderdelete(params)
.then(r => {
if (r.success) {
if (r.result) {
this.$refs.grid.load();
this.deletelModal = false;
this.$Message.success("删除成功");
} else {
this.deletelModal = false;
this.$Message.error("删除失败");
}
} else {
this.deletelModal = false;
this.$Message.error("删除失败");
}
})
.catch(err => {
this.deletelModal = false;
this.$Message.error("操作失败");
});
}, },
{ removeCancel() {
key: "creationTime", this.deletelModal = false;
title: this.$t("creationTime"),
align: "center",
high: true,
width: 180
}, },
{ cancel() {
key: "lastModifierUserId", this.curId = 0;
title: this.$t("lastModifierUserId"), this.addModal = false;
hide: true, this.detailModal = false;
align: "left", this.editModal = false;
high: true, this.deletedlModal = false;
type: "user"
}, },
{ l(key) {
key: "lastModificationTime", let vkey = "mes_plan" + "." + key;
title: this.$t("lastModificationTime"), return this.$t(vkey) || key;
hide: true,
align: "center",
high: true,
width: 180
}, },
{ //new tree start
title: "操作", initTree() {
key: "action", var sumData = [];
width: 180, this.$http.order.getallselecttree().then(res => {
align: "left", //alert(JSON.stringify(res))
render: (h, params) => { if (res.result) {
return h("div", { class: "action" }, [ for (var i = 0; i < res.result.length; i++) {
h( sumData = sumData.concat(res.result[i]);
"op", }
{ this.treeData = sumData;
attrs: { oprate: "detail" }, this.data1 = JSON.parse(JSON.stringify(sumData));
on: { click: () => this.detail(params.row) }
},
"查看"
),
h(
"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 == 3 &&
params.row.id == params.row.rootId &&
params.row.divideMark != 0) ||
params.row.id != params.row.rootId ||
params.row.status != 3
? "display:none"
: "")
},
"编辑"
),
h(
"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 == 3 &&
params.row.id == params.row.rootId &&
params.row.divideMark != 0) ||
params.row.id != params.row.rootId ||
params.row.status != 3
? "display:none"
: "")
},
"删除"
),
h(
"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.divideMark != 0 &&
params.row.id == params.row.rootId) ||
params.row.status != 3 ||
params.row.quantity <= 1
? "display:none"
: "")
},
"分解"
)
]);
}
}
],
treeData: [],
treeInputSearch: "",
ocolumn: [],
treeHeight: "",
tableHeight: "",
ids: [],
orderSearchForm: {
productId: "", //产品id
productName: "", //产品名称
taskType: "", //任务类型
quantity: null, //数量
taskRequire: "", //任务接点要求
demandStartDate: "", //开始时间
demandFinishDate: "", //完成时间
remark: "", //备注
projectNumber: "", //项目号
batchNumber: "", //批次号
urgencyLevel: null //紧急程度
},
list: [],
//data测试数据
dataT: [],
dataTemp: [],
data1: [],
selectdata: [],
//以下为手写死数据集:
orderCatList: [], //订单类型下拉
outerCodeList: [], //型号外部代码下拉
missionCodeList: [], //任务号下拉
stageList: [], //阶段下拉
materailList: [], //材料下拉
routingAccessList: [], //工艺方法下拉
drawNumberList: [], //图号下拉
docNameList: [], //文档名称下拉
ownerGustList: [], //甲方客户下拉
mainDeptList: [], //厂内主体部门下拉
taskTypeList: [], //任务类型
statusList: [], //状态类型
rowData: {}, //编辑、查看的当前行数据
rowDataArry: [],
ModalInfoStaut: "",
sendList: [],
metCodesStrTxt: "",
actIds: [], //批量处理时ids
actMescodes: [],
delNum: 0, //判断是否可以进行修改
arrayIds: [], //选择列表后的ids
delMsg: "", //删除提示信息
dataListRetrunNew: {
schemaId: "123327da-42b3-41f6-b785-cf933f137a95", //订单送审的schemaId
idList: [], //订单id List
codeList: [], //订单编号List
operatorIdList: [] //操作员id
}, //确定后返回数据
wfstatu: 1 //流程是否启用1 禁用 0启用
};
},
created() {
this.treeHeight = window.innerHeight - 150;
},
mounted() {
this.initTree();
let params = {
id: "123327da-42b3-41f6-b785-cf933f137a95"
};
this.$api.get(`${workflowUrl}/schema/getbyid`, params).then(res => {
if (res.success) {
let wfStatus = res.result.status;
if (wfStatus == 0) {
this.wfstatu = 1;
} else {
this.wfstatu = 3;
}
}
});
//this.dataformat();//data传数据转为tree类型
this.tableHeight = window.innerHeight - 220;
//this.$refs.CustomTable.getTableHeight(this.tableHeight);
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.treeHeight = window.screenHeight - 150;
this.tableHeight = window.screenHeight - 220;
//this.$refs.CustomTable.getTableHeight(this.tableHeight);
})();
};
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
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) {
newNodeList.push(nodeLists[i]);
} else if (nodeLists[i].children.length > 0) {
searchTree(nodeLists[i].children, value);
}
}
}
if (text != "") {
searchTree(nodeList, text);
} else {
return nodeList;
}
return newNodeList;
}
},
methods: {
addOk() {
this.$refs.grid.load();
this.addModal = false;
this.detailModal = false;
this.editModal = false;
this.curId = 0;
},
search() {
this.easySearch.keys.value = this.easySearch.keys.value.trim();
this.$refs.grid.reload(this.easySearch);
},
detail(row) {
this.detailModal = true;
this.rowData = row;
},
edit(row) {
this.editModal = true;
this.rowData = row;
},
split(row) {
if (row.quantity > 1) {
this.splitModal = true;
this.rowData = row;
} else {
this.$Message.error("数量为1,不能进行分解");
}
},
onHide() {
// this.$Message.info("收起左侧树")
this.showMenu = false;
},
showMenuFn() {
//this.$Message.info("展开左侧树")
this.showMenu = true;
},
productSearch(id, item, productIds, ids) {
let where = { bomId: { op: "In", value: ids } };
this.$refs.grid.reload(where);
},
//确定分解
orderSplitOk() {
let returnDatalist = this.$refs.orderSplit.returnDataList();
let orderQuantity = returnDatalist.quantity;
let orderListQuantity = 0;
let quantyStatu = false; //子订单计划数是否为0或空
let dateStatu = false; //子订单开始完成时间是否为空
if (returnDatalist.items.length > 0) {
returnDatalist.items.forEach(data => {
orderListQuantity = orderListQuantity + parseFloat(data.quantity);
if (parseFloat(data.quantity) == 0 || data.quantity == "") {
quantyStatu = true;
}
if (data.demandDate[0] == "" || data.demandDate[1] == "") {
dateStatu = true;
}
});
if (dateStatu) {
this.$Message.error("子订单开始完成时间不能为空,请重新输入时间!");
return false;
}
if (quantyStatu) {
this.$Message.error("子订单计划数量不能为0,请重新输入计划数量!");
} else if (returnDatalist.quantity != orderListQuantity) {
this.$Message.error(
"计划总数量与订单数量不一致,请重新输入计划数量!"
);
} else {
this.ModalInfo = true;
this.ModalInfoStaut = "split";
this.dataListRetrun = returnDatalist;
this.metCodesStrTxt = "确定分解订单 " + returnDatalist.mesCode + "?";
}
} else {
this.$Message.error("请确定计划数量!");
}
},
modalInfoOk() {
let itemsTemp = [];
this.dataListRetrun.items.forEach(ele => {
let objTemp = {};
objTemp.mesCode = ele.mesCode;
objTemp.quantity = Number(ele.quantity);
objTemp.demandStartDate = ele.demandStartDate + " 00:00:01";
objTemp.demandFinishDate = ele.demandFinishDate + " 23:59:59";
itemsTemp.push(objTemp);
});
let params = {
id: this.dataListRetrun.id,
items: itemsTemp
};
Api.mesorderdivide(params).then(res => {
if (res.result) {
this.$Message.success("订单分解成功!");
this.$refs.grid.load();
} else {
this.$Message.error("订单分解失败!");
}
});
this.splitModal = false;
this.ModalInfo = false;
},
//打开送审modal
openSendViewModal() {
this.actIds = [];
this.delNum = 0;
if (this.rowDataArry.length > 0) {
this.rowDataArry.forEach(data => {
this.actIds.push(data.id);
if (data.status != 1) {
//判断非新建状态的订单
this.delNum += 1;
}
});
setTimeout(() => {
if (this.delNum > 0) {
this.$Message.error("所选的订单中有不可送审的订单!");
this.actIds = [];
this.sendViewModal = false;
} else {
this.sendViewModal = true;
}
}, 400);
} else {
this.$Message.error("请选择订单");
}
},
//确定送审
sendViewOk() {
this.dataListRetrunNew.idList = [];
this.dataListRetrunNew.codeList = [];
this.dataListRetrunNew.operatorIdList = [];
this.rowDataArry.forEach(item => {
this.dataListRetrunNew.idList.push(item.id);
this.dataListRetrunNew.codeList.push(item.mesCode);
});
let ues = this.$refs.userProcess;
this.dataListRetrunNew.operatorIdList = this.$refs.orderSendView.getUsers();
//返回审批数据
//alert(JSON.stringify(this.dataListRetrunNew));
this.$http.order.batchstart(this.dataListRetrunNew).then(res => {
if (res.success) {
this.$Message.success("订单送审成功!");
this.$refs.grid.load();
} else {
this.$Message.error("订单送审失败!");
}
});
},
//打开派发
openSendModal() {
this.actIds = [];
this.delNum = 0;
if (this.rowDataArry.length > 0) {
this.rowDataArry.forEach(data => {
this.actIds.push(data.id);
if (data.status != 3) {
//判断非新建状态的订单
this.delNum += 1;
}
});
setTimeout(() => {
if (this.delNum > 0) {
this.$Message.error("所选的订单中有不可派发的订单!");
this.actIds = [];
this.sendModal = false;
} else {
this.sendModal = true;
}
}, 400);
} else {
this.$Message.error("请选择订单");
}
},
//确定派发
sendOk() {
this.$refs.orderSend.$refs["formValidate"].validate(valid => {
if (valid) {
let ids = this.arrayIds;
let objInfoTem = this.$refs.orderSend.returnData();
let parms = [];
ids.forEach(e => {
let objInfo = this.$u.clone(objInfoTem);
objInfo.id = e;
parms.push(objInfo);
});
Api.mesorderdistribute(parms)
.then(r => {
if (r.success) {
if (r.result) {
this.$refs.grid.load();
this.sendModal = false;
this.$Message.success("派发成功");
} else { } else {
this.sendModal = false; this.$Message.error("加载产品树失败!");
this.$Message.error("派发失败");
} }
} else {
this.sendModal = false;
this.$Message.error("派发失败");
}
})
.catch(err => {
this.sendModal = false;
this.$Message.error("操作失败");
}); });
} },
}); selectTreeNode(value) {
}, if (value.length > 0) {
//单条删除 this.ids = [];
remove(row) { this.getAllIds(value);
let metCodesSingle = []; //没有子订单的订单 if (this.ids.length > 0) {
let metCodesFather = []; //有子订单的原始订单 this.orderSearchForm.productId = this.ids;
this.delMsg = ""; } else {
this.delNum = 0; this.orderSearchForm.productId = [];
this.actIds = []; }
this.$refs.grid.cancelFooterToolbar(); this.easySearch.productId.value = this.orderSearchForm.productId;
this.actIds.push(row.id); this.$refs.grid.easySearch();
if (row.id != row.rootId) {
this.sondeletecheck(row.rootId);
metCodesFather.push(row.rootCode);
} else {
metCodesSingle.push(row.mesCode);
}
setTimeout(() => {
if (this.delNum > 0) {
this.$Message.error("删除的原始订单中有非新建状态的子订单!");
this.actIds = [];
return false;
} else {
let metCodesSingleStr = JSON.stringify(metCodesSingle)
.replace("[", "")
.replace("]", "")
.replace(/\"/g, "");
let metCodesFatherStr = JSON.stringify(metCodesFather)
.replace("[", "")
.replace("]", "")
.replace(/\"/g, "");
if (row.id == row.rootId) {
this.delMsg = metCodesSingleStr;
} else {
this.delMsg = metCodesFatherStr + " 的子订单";
}
this.deletelModal = true;
}
}, 400);
},
//批量删除
removeList() {
let metCodesSingle = []; //没有子订单的订单
let metCodesFather = []; //有子订单的原始订单
this.actIds = [];
this.delNum = 0;
if (this.rowDataArry.length > 0) {
this.rowDataArry.forEach(data => {
this.actIds.push(data.id);
if (data.status != 1) {
//判断非新建状态的订单
this.delNum += 1;
} else if (data.id != data.rootId) {
//判断子订单是否可以删除
this.sondeletecheck(data.rootId);
if (data.id != data.rootId && data.status == 1) {
metCodesFather.push(data.rootCode);
}
} else {
if (data.id == data.rootId && data.status == 1) {
metCodesSingle.push(data.mesCode);
}
}
});
setTimeout(() => {
if (this.delNum > 0) {
this.$Message.error("所选的订单中有不可删除的订单!");
this.actIds = [];
this.deletelModal = false;
} else {
this.delMsg = "";
let metCodesFatherNew = Array.from(new Set(metCodesFather));
let metCodesSingleStr = JSON.stringify(metCodesSingle)
.replace("[", "")
.replace("]", "")
.replace(/\"/g, "");
let metCodesFatherStr = JSON.stringify(metCodesFatherNew)
.replace("[", "")
.replace("]", "")
.replace(/\"/g, "");
if (metCodesSingle.length > 0 && metCodesFather.length == 0) {
this.delMsg = metCodesSingleStr;
} else if (
metCodesSingle.length == 0 &&
metCodesFather.length > 0
) {
this.delMsg = metCodesFatherStr + " 的子订单";
} else if (metCodesSingle.length > 0 && metCodesFather.length > 0) {
this.delMsg =
metCodesSingleStr +
" 以及 订单:" +
metCodesFatherStr +
" 的子订单";
}
this.deletelModal = true;
}
}, 400);
} else {
this.$Message.error("请选择订单");
}
},
//删除前判断子订单是否能删除
sondeletecheck(code) {
let param = { id: code };
Api.sondeletecheck(param).then(res => {
if (res.result == 1) {
this.delNum += 0;
} else {
this.delNum += 1;
}
});
},
//删除前判断子订单
sondeletecheck1(code) {
let param = { id: code };
let delStaut = 0;
Api.sondeletecheck(param).then(res => {
if (res.result == 1) {
//可以删除
delStaut = 0;
} else {
delStaut = 1;
}
});
return delStaut;
},
//删除确定
removeOk() {
let params = { ids: this.actIds };
Api.mesorderdelete(params)
.then(r => {
if (r.success) {
if (r.result) {
this.$refs.grid.load();
this.deletelModal = false;
this.$Message.success("删除成功");
} else { } else {
this.deletelModal = false; this.easySearch.productId.value = [];
this.$Message.error("删除失败"); this.$refs.grid.easySearch();
} }
} else { },
this.deletelModal = false; //得到此树节点下所有是产品的productId
this.$Message.error("删除失败"); getAllIds(trees) {
} trees.forEach((data, index) => {
}) var that = this;
.catch(err => { if (data.isProduct) {
this.deletelModal = false; this.ids.push(data.productId);
this.$Message.error("操作失败"); }
}); if (data.children.length > 0) {
}, this.getAllIds(data.children);
removeCancel() { }
this.deletelModal = false; });
}, },
cancel() { handleSelect(data) {
this.curId = 0; if (data.length > 0) {
this.addModal = false; this.selectdata = [];
this.detailModal = false; this.selectdata = data;
this.editModal = false; this.list = [];
this.deletedlModal = false; this.list.push({
}, label: data[0].title,
l(key) { value: data[0].id
let vkey = "mes_plan" + "." + key; });
return this.$t(vkey) || key; //this.formValidate.classType=data[0].id;
}, if (data[0].isProduct == "1") {
//new tree start this.orderSearchForm.productName = data[0].id;
initTree() { this.orderSearchForm.productId = data[0].productId;
var sumData = []; } else {
this.$http.order.getallselecttree().then(res => { this.$Message.error("此节点不是产品,请选择产品节点!");
//alert(JSON.stringify(res)) }
if (res.result) {
for (var i = 0; i < res.result.length; i++) {
sumData = sumData.concat(res.result[i]);
}
this.treeData = sumData;
this.data1 = JSON.parse(JSON.stringify(sumData));
} else {
this.$Message.error("加载产品树失败!");
}
});
},
selectTreeNode(value) {
if (value.length > 0) {
this.ids = [];
this.getAllIds(value);
if (this.ids.length > 0) {
this.orderSearchForm.productId = this.ids;
} else {
this.orderSearchForm.productId = [];
}
this.easySearch.productId.value = this.orderSearchForm.productId;
this.$refs.grid.easySearch();
} else {
this.easySearch.productId.value = [];
this.$refs.grid.easySearch();
}
},
//得到此树节点下所有是产品的productId
getAllIds(trees) {
trees.forEach((data, index) => {
var that = this;
if (data.isProduct) {
this.ids.push(data.productId);
}
if (data.children.length > 0) {
this.getAllIds(data.children);
}
});
},
handleSelect(data) {
if (data.length > 0) {
this.selectdata = [];
this.selectdata = data;
this.list = [];
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;
this.orderSearchForm.productId = data[0].productId;
} else {
this.$Message.error("此节点不是产品,请选择产品节点!");
}
}
},
renderContent(h, { root, node, data }) {
//渲染树的样式
return h(
"span",
{
style: {
color: data.isProduct != "1" ? "#249E91" : "#333", //根据选中状态设置样式
cursor: "pointer"
},
on: {
click: () => {
let arrTree = [];
arrTree.push(data);
this.handleSelect(arrTree); //手动选择树节点
} }
}
}, },
data.title renderContent(h, {
); root,
}, node,
//new tree end data
//list start }) {
onSelect(a, b) { //渲染树的样式
//alert(JSON.stringify(a)); return h(
//批量选择 "span", {
let selectRows = a; style: {
this.arrayIds = []; color: data.isProduct != "1" ? "#249E91" : "#333", //根据选中状态设置样式
this.rowDataArry = a; cursor: "pointer"
selectRows.forEach(e => { },
this.arrayIds.push(e.id); on: {
}); click: () => {
}, let arrTree = [];
//list end arrTree.push(data);
//将数组数据转为tree this.handleSelect(arrTree); //手动选择树节点
dataformat() { }
this.dataT = this.$u.toTree( }
this.dataTemp, },
0, data.title
u => { );
if (u.divideMark == 1) {
u._disabled = true;
}
u._showChildren = true;
}, },
"rootId" //new tree end
); //list start
this.dataT = this.$u.clone(this.dataT); onSelect(a, b) {
//alert(JSON.stringify(a));
//批量选择
let selectRows = a;
this.arrayIds = [];
this.rowDataArry = a;
selectRows.forEach(e => {
this.arrayIds.push(e.id);
});
},
//list end
//将数组数据转为tree
dataformat() {
this.dataT = this.$u.toTree(
this.dataTemp,
0,
u => {
if (u.divideMark == 1) {
u._disabled = true;
}
u._showChildren = true;
},
"rootId"
);
this.dataT = this.$u.clone(this.dataT);
},
//批量导入start
//批量导入end
} }
}
}; };
</script> </script>
<style lang="less"> <style lang="less">
.full { .full {
margin-top: 0; margin-top: 0;
.content {
margin-top: 10px; .content {
.ivu-icon-ios-add:before { margin-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
...@@ -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" @on-get-data="getData" :columns="columns" :open="ModalIm" @on-cancel="ModalImCancel" @on-ok="ok" />
<!-- <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: "resourceCode",
title: this.l("resourceId"),
align: "left",
easy: true,
},
{
key: "nameOfResource",
title: this.l("nameOfResource"),
align: "left",
easy: true,
tooltip: true,
},
{
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: "ico", // key: "specifications",
title: " ", // title: this.l("specifications"),
align: "center", // align: "left",
easy: true, // easy: true,
high: true, // high: true,
width: 60, // },
render: (h, params) => { {
return h("div", { class: "action" }, [ key: "totalNum",
h(params.row.numberAvailable > 0 ? "op" : "", { title: this.l("totalNum"),
attrs: { align: "right",
icon: "ios-cart-outline", easy: true,
type: "icon", },
{
key: "numberAvailable",
title: this.l("numberAvailable"),
align: "right",
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,
}, },
on: { click: () => this.addCart(params.row) }, {
}), 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: "center",
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)
},
},
"查看日志"
),
]);
},
},
],
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) {
key: "nameOfResource", this.selectRows = [];
title: this.l("nameOfResource"), this.selectRows = item;
align: "left", },
easy: true,
tooltip: true, //加入借出车
addCart(arr) {
this.cartListCount = this.$store.state.count;
this.cartList = this.$store.state.cart;
// 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: [], let url = `${resourceUrl}/resourceimportservice/import`;
ocolumn: [], this.$refs.importExcel.deelData(url, this.columns, this.formatMethod(val))
treeHeight: "", },
ids: [], //根据页面二次处理数据
list: [], formatMethod(val) {
cartList: [], let tempData = this.$u.clone(val);
cartListCount: 0, let tempList = [];
selectRows: [], tempData.forEach((ele) => {
}; let obj = {
}, nameOfResource: ele.nameOfResource ? ele.nameOfResource : '',
created() { resourceCode: ele.resourceCode ? ele.resourceCode : '',
this.treeHeight = window.innerHeight - 150; code: ele.code ? ele.code : '',
}, totalNum: ele.totalNum ? ele.nameOfResource : 0,
mounted() { storeTitle: ele.storeTitle ? ele.storeTitle : '',
window.onresize = () => { storeId: ele.storeId ? ele.nameOfResource : null,
///浏览器窗口大小变化 state: 1,
return (() => { numberAvailable: ele.numberAvailable ? ele.nameOfResource : 0,
window.screenHeight = window.innerHeight; json: {}
this.treeHeight = window.screenHeight - 150; };
})(); if (ele.nameOfResource && ele.nameOfResource != '' && ele.code && ele.code != '' && ele.resourceCode && ele.resourceCode != '') {
}; obj.ico = false
}, } else {
async fetch({ store, params }) { obj.ico = true
await store.dispatch("loadDictionary"); // 加载数据字典 }
}, tempList.push(obj);
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 = [];
this.selectRows = item;
},
onSelect(item) {
this.selectRows = [];
this.selectRows = item;
},
//加入借出车 });
addCart(arr) { return tempList
this.cartListCount = this.$store.state.count;
this.cartList = this.$store.state.cart;
// 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;
}
},
//移除借出车
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) => { //批量导入end
if (r.success) { l(key) {
this.$refs.grid.load(); let vkey = "resource" + "." + key;
this.$Message.success("删除成功"); return this.$t(vkey) || key;
} },
});
},
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
...@@ -61,6 +61,7 @@ import DTSearch from '@/components/page/dtSearch.vue' ...@@ -61,6 +61,7 @@ import DTSearch from '@/components/page/dtSearch.vue'
import InputTime from '@/components/page/inputTime.vue' import InputTime from '@/components/page/inputTime.vue'
import OutputTime from '@/components/page/outputTime.vue' import OutputTime from '@/components/page/outputTime.vue'
import ViewerImg from '@/components/page/viewer.vue' import ViewerImg from '@/components/page/viewer.vue'
import ImportExcel from '@/components/page/import/process.vue'
// import FormMaking from 'form-making' // import FormMaking from 'form-making'
// import 'form-making/dist/FormMaking.css' // import 'form-making/dist/FormMaking.css'
...@@ -127,6 +128,7 @@ Vue.component("OutputTime", OutputTime) ...@@ -127,6 +128,7 @@ Vue.component("OutputTime", OutputTime)
Vue.component("ViewerImg", ViewerImg) Vue.component("ViewerImg", ViewerImg)
Vue.component("StoreTree", StoreTree) Vue.component("StoreTree", StoreTree)
Vue.component("StoreSelect", StoreSelect) Vue.component("StoreSelect", StoreSelect)
Vue.component("ImportExcel",ImportExcel)
......
...@@ -27,7 +27,7 @@ export default ({ ...@@ -27,7 +27,7 @@ export default ({
next({ next({
name: 'login', name: 'login',
query: { 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) ...@@ -27,7 +27,7 @@ window.apsUrl = `http://${systemApi.aps}:10111/api/services/app`;//aps排产(61)
window.technologyUrl =`http://${address}:10000/technology/`;//新工艺规程接口 window.technologyUrl =`http://${address}:10000/technology/`;//新工艺规程接口
window.iconImg = `/imgicon/`; window.iconImg = `/imgicon/`;
window.mncImg = `/images/mnc/`;//mnc图片 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.Platform = `http://${address}:10000/platform`; //计划管理10131
/* window.systemUrl = `http://${address}:10020/api/services/app`; //System-api 系统管理(基础数据) /* window.systemUrl = `http://${address}:10020/api/services/app`; //System-api 系统管理(基础数据)
......
...@@ -40,7 +40,7 @@ export const actions = { ...@@ -40,7 +40,7 @@ export const actions = {
if (res.result) { if (res.result) {
util.cookies.set('uuid', res.result.userId); 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); util.cookies.set('token', res.result.accessToken);
sessionStorage.setItem('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