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",
...@@ -34,6 +35,9 @@ export default { ...@@ -34,6 +35,9 @@ export default {
msg: { msg: {
type: String, type: String,
default: "确认要删除吗?" default: "确认要删除吗?"
},
color: {
type: String
} }
}, },
data() { data() {
...@@ -62,7 +66,7 @@ export default { ...@@ -62,7 +66,7 @@ export default {
}, },
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>",
...@@ -77,6 +81,7 @@ export default { ...@@ -77,6 +81,7 @@ export default {
} }
}; };
</script> </script>
<style lang="less"> <style lang="less">
a.op { a.op {
display: inline; display: inline;
......
...@@ -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);
......
<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"
ref="grid"
:conditions="easySearch"
:action="action"
:high="false"
:height="tableHeight"
>
<template slot="easySearch"> <template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline> <Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys"> <FormItem prop="keys">
...@@ -20,8 +13,9 @@ ...@@ -20,8 +13,9 @@
</Form> </Form>
</template> </template>
</DataGrid> </DataGrid>
</div> </div>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
export default { export default {
...@@ -33,8 +27,14 @@ export default { ...@@ -33,8 +27,14 @@ export default {
tableHeight: "", tableHeight: "",
dataColumns: [], dataColumns: [],
easySearch: { easySearch: {
keys: { op: "code,name", value: null }, keys: {
id: { op: "In", value: "" } op: "code,name",
value: null
},
id: {
op: "In",
value: ""
}
}, },
columns: [ columns: [
// { // {
...@@ -71,20 +71,28 @@ export default { ...@@ -71,20 +71,28 @@ export default {
width: 260, width: 260,
align: "left", align: "left",
render: (h, params) => { render: (h, params) => {
return h("div", { class: "action" }, [ return h("div", {
class: "action"
}, [
h( h(
"op", "op", {
{ attrs: {
attrs: { oprate: "edit" }, oprate: "edit"
on: { click: () => this.edit(params.row) } },
on: {
click: () => this.edit(params.row)
}
}, },
"编辑" "编辑"
), ),
h( h(
"op", "op", {
{ attrs: {
attrs: { oprate: "delete" }, oprate: "delete"
on: { click: () => this.remove(params.row.id) } },
on: {
click: () => this.remove(params.row.id)
}
}, },
"删除" "删除"
) )
...@@ -94,7 +102,10 @@ export default { ...@@ -94,7 +102,10 @@ export default {
] ]
}; };
}, },
async fetch({ store, params }) { async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
created() { created() {
...@@ -143,6 +154,7 @@ export default { ...@@ -143,6 +154,7 @@ export default {
} }
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.spare-parts { .spare-parts {
width: 100%; width: 100%;
......
...@@ -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);
......
<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"
ref="grid"
:conditions="easySearch"
:action="action"
:initsearch="sets"
:high="false"
:format="formatFun"
:height="tableHeight"
@on-selection-change="onSelect"
>
<template slot="easySearch"> <template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline> <Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys"> <FormItem prop="keys">
<Input <Input placeholder="请输入编码/名称/状态" v-width="200" v-model="easySearch.keys.value" clearable />
placeholder="请输入编码/名称/状态"
v-width="200"
v-model="easySearch.keys.value"
clearable
/>
</FormItem> </FormItem>
<FormItem> <FormItem>
<Button type="primary" @click="search">查询</Button> <Button type="primary" @click="search">查询</Button>
...@@ -29,33 +14,19 @@ ...@@ -29,33 +14,19 @@
<template slot="buttons"> <template slot="buttons">
<Button type="primary" @click="add">新增</Button> <Button type="primary" @click="add">新增</Button>
<Button @click="openModalIm">导入</Button>
</template> </template>
<template slot="batch"> <template slot="batch">
<Button type="primary" @click="modalSchedule">批量送审</Button> <Button type="primary" @click="modalSchedule">批量送审</Button>
</template> </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";
...@@ -82,14 +53,16 @@ export default { ...@@ -82,14 +53,16 @@ export default {
v.rootCategoryId = this.nodeInfo.rootCategoryId; v.rootCategoryId = this.nodeInfo.rootCategoryId;
}, },
easySearch: { easySearch: {
keys: { op: "code,name", value: null }, keys: {
op: "code,name",
value: null
},
categoryId: { categoryId: {
op: "In", op: "In",
value: this.nodeInfo.ids value: this.nodeInfo.ids
} }
}, },
columns: [ columns: [{
{
type: "selection", type: "selection",
width: 70, width: 70,
align: "center" align: "center"
...@@ -100,14 +73,13 @@ export default { ...@@ -100,14 +73,13 @@ export default {
align: "left", align: "left",
render: (h, params) => { render: (h, params) => {
return h( return h(
"a", "a", {
{
props: {}, props: {},
on: { on: {
click: () => this.details(params.row) click: () => this.details(params.row)
} }
}, },
!params.row.code ? "未分配" : params.row.code !params.row.code || params.row.code == 0 ? "未分配" : params.row.code
); );
} }
}, },
...@@ -119,16 +91,8 @@ export default { ...@@ -119,16 +91,8 @@ export default {
{ {
key: "status", key: "status",
title: "状态", title: "状态",
align: "left", align: "center",
render: (h, params) => {
return h("state", {
props: {
code: "material.main.status", code: "material.main.status",
type: "text",
value: params.row.status + ""
}
});
}
}, },
{ {
key: "version", key: "version",
...@@ -161,47 +125,65 @@ export default { ...@@ -161,47 +125,65 @@ export default {
width: 150, width: 150,
align: "left", align: "left",
render: (h, params) => { render: (h, params) => {
return h("div", { class: "action" }, [ return h("div", {
class: "action"
}, [
h( h(
"op", "op", {
{ attrs: {
attrs: { oprate: "edit" }, oprate: "edit"
on: { click: () => this.edit(params.row) } },
on: {
click: () => this.edit(params.row)
}
}, },
"编辑" "编辑"
), ),
h( h(
"op", "op", {
{ attrs: {
attrs: { oprate: "delete" }, oprate: "delete"
on: { click: () => this.remove(params.row.id) } },
on: {
click: () => this.remove(params.row.id)
}
}, },
params.row.status == 3 ? "" : "删除" params.row.status == 3 ? "" : "删除"
), ),
h( h(
"op", "op", {
{ attrs: {
attrs: { oprate: "edit" }, oprate: "edit"
on: { click: () => this.send(params.row) } },
on: {
click: () => this.send(params.row)
}
}, },
(params.row.status == 0 || params.row.status == 1) && (params.row.status == 0 || params.row.status == 1) &&
this.status == 0 this.status == 0 ?
? "送审" "送审" :
: "" ""
) )
]); ]);
} }
} }
], //基础咧 ], //基础咧
cols: [], // cols: [], //
status: null status: null,
ModalIm: false,
addCol: [],
exportTitle: '物料管理',
}; };
}, },
async fetch({ store, params }) { async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
created() { created() {
this.tableHeight = window.innerHeight - 220; this.tableHeight = window.innerHeight - 220;
if (this.nodeInfo.rootCategoryId == 0) { if (this.nodeInfo.rootCategoryId == 0) {
this.cols = this.columns; this.cols = this.columns;
} else { } else {
...@@ -254,13 +236,11 @@ export default { ...@@ -254,13 +236,11 @@ export default {
this.$refs.grid.reload(this.easySearch); this.$refs.grid.reload(this.easySearch);
}, },
initCols(delay) { initCols(delay) {
let conditions = [ let conditions = [{
{
conditionalType: "Equal", conditionalType: "Equal",
fieldName: "categoryId", fieldName: "categoryId",
fieldValue: this.nodeInfo.rootCategoryId fieldValue: this.nodeInfo.rootCategoryId
} }];
];
Api.listTable({ Api.listTable({
conditions: conditions, conditions: conditions,
...@@ -275,6 +255,7 @@ export default { ...@@ -275,6 +255,7 @@ export default {
}) && u.dataType != 5 }) && u.dataType != 5
); );
}); });
this.addCol = items;
this.cols = this.$u.clone(this.columns); this.cols = this.$u.clone(this.columns);
let extra = items.map(u => { let extra = items.map(u => {
console.log(u); console.log(u);
...@@ -310,6 +291,7 @@ export default { ...@@ -310,6 +291,7 @@ export default {
// console.log(this.cols) // console.log(this.cols)
} }
}); });
this.exportTitle = "物料管理-" + this.nodeInfo.rootCategoryName;
}, },
add() { add() {
if (this.nodeInfo.categoryId) { if (this.nodeInfo.categoryId) {
...@@ -362,12 +344,62 @@ export default { ...@@ -362,12 +344,62 @@ export default {
ok() { ok() {
this.$refs.grid.reload(this.easySearch); this.$refs.grid.reload(this.easySearch);
this.modal = false; this.modal = false;
this.ModalIm = false;
this.curId = 0; this.curId = 0;
}, },
cancel() { cancel() {
this.curId = 0; this.curId = 0;
this.modal = false; this.modal = false;
},
//批量导入start
//导入功能
openModalIm() {
if (this.nodeInfo.categoryId) {
this.ModalIm = true
} else {
this.$Message.error("请先选择分类");
} }
},
ModalImCancel() {
this.ModalIm = false
},
getData(val) {
let url = `${material}/materialimportservice/import`;
this.$refs.importExcel.deelData(url, this.cols, this.formatMethod(val))
},
//根据页面二次处理数据
formatMethod(val) {
let tempData = this.$u.clone(val);
let tempList = [];
tempData.forEach((ele) => {
let obj = {
name: ele.name ? ele.name : '',
version: ele.version ? Number(ele.version) : '',
drawing: ele.drawing ? ele.drawing : '',
description: ele.description ? ele.description : "",
code: 0,
status: this.nodeInfo.status == 1 ? 3 : 0,
codeRuleId: this.nodeInfo.codeRuleId,
categoryId: this.nodeInfo.categoryId, //左侧树点击的id
customProperties: {},
rootCategoryId: this.nodeInfo.rootCategoryId, //左侧树点击的数据的最顶层id
};
this.addCol.forEach(el => {
obj[el.field] = ele[el.field]
})
if (ele.name && ele.name != '') {
obj.ico = false
} else {
obj.ico = true
}
tempList.push(obj);
});
return tempList
},
//批量导入end
}, },
watch: { watch: {
nodeInfo: { nodeInfo: {
...@@ -391,7 +423,8 @@ export default { ...@@ -391,7 +423,8 @@ export default {
} }
}; };
</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;
......
<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>
...@@ -24,16 +24,7 @@ ...@@ -24,16 +24,7 @@
</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"
:columns="columns"
:conditions="easySearch"
ref="grid"
@on-selection-change="onSelect"
:batch="true"
:border="false"
rowKey="id"
>
<template slot="easySearch"> <template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline> <Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys"> <FormItem prop="keys">
...@@ -51,12 +42,7 @@ ...@@ -51,12 +42,7 @@
<Button type="primary" @click="addModal=true">创建</Button> <Button type="primary" @click="addModal=true">创建</Button>
</template> </template>
<template slot="batch"> <template slot="batch">
<Button <Button type="primary" class="mr10 ml10" @click="openSendViewModal" v-if="this.wfstatu==1">订单送审</Button>
type="primary"
class="mr10 ml10"
@click="openSendViewModal"
v-if="this.wfstatu==1"
>订单送审</Button>
<Button type="primary" class="mr10 ml10" @click="openSendModal">订单派发</Button> <Button type="primary" class="mr10 ml10" @click="openSendModal">订单派发</Button>
<Button type="primary" class="mr10 ml10" @click="removeList">批量删除</Button> <Button type="primary" class="mr10 ml10" @click="removeList">批量删除</Button>
</template> </template>
...@@ -95,15 +81,7 @@ ...@@ -95,15 +81,7 @@
<p>确定删除 订单:{{delMsg}} ?</p> <p>确定删除 订单:{{delMsg}} ?</p>
</Modal> </Modal>
<!-- 信息提示 --> <!-- 信息提示 -->
<Modal <Modal v-model="ModalInfo" title="信息提示" width="600" :mask-closable="false" :scrollable="true" ok-text="确定" cancel-text="取消">
v-model="ModalInfo"
title="信息提示"
width="600"
:mask-closable="false"
:scrollable="true"
ok-text="确定"
cancel-text="取消"
>
{{ metCodesStrTxt }} {{ metCodesStrTxt }}
<div slot="footer"> <div slot="footer">
<Button @click="ModalInfo = false">取消</Button> <Button @click="ModalInfo = false">取消</Button>
...@@ -111,8 +89,9 @@ ...@@ -111,8 +89,9 @@
</div> </div>
</Modal> </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";
...@@ -145,7 +124,10 @@ export default { ...@@ -145,7 +124,10 @@ export default {
value: null, value: null,
default: true default: true
}, },
productId: { op: "In", value: "" } productId: {
op: "In",
value: ""
}
}, },
addModal: false, addModal: false,
editModal: false, editModal: false,
...@@ -157,8 +139,7 @@ export default { ...@@ -157,8 +139,7 @@ export default {
sendViewModal: false, sendViewModal: false,
curId: 0, curId: 0,
id: "id", id: "id",
columns: [ columns: [{
{
key: "selection", key: "selection",
type: "selection", type: "selection",
width: 50, width: 50,
...@@ -183,8 +164,7 @@ export default { ...@@ -183,8 +164,7 @@ export default {
let isDivideMark = params.row.divideMark; let isDivideMark = params.row.divideMark;
let rowChildren = params.row.children; let rowChildren = params.row.children;
return h( return h(
"div", "div", {
{
style: { style: {
cursor: "pointer", cursor: "pointer",
display: "inline", display: "inline",
...@@ -276,7 +256,7 @@ export default { ...@@ -276,7 +256,7 @@ export default {
align: "left", align: "left",
high: true, high: true,
hide: true, hide: true,
type:'workShopName' type: 'workShopName'
}, },
{ {
key: "productingPreparationFinishDate", key: "productingPreparationFinishDate",
...@@ -352,88 +332,96 @@ export default { ...@@ -352,88 +332,96 @@ export default {
width: 180, width: 180,
align: "left", align: "left",
render: (h, params) => { render: (h, params) => {
return h("div", { class: "action" }, [ return h("div", {
class: "action"
}, [
h( h(
"op", "op", {
{ attrs: {
attrs: { oprate: "detail" }, oprate: "detail"
on: { click: () => this.detail(params.row) } },
on: {
click: () => this.detail(params.row)
}
}, },
"查看" "查看"
), ),
h( h(
"op", "op", {
{ attrs: {
attrs: { oprate: "edit" }, oprate: "edit"
on: { click: () => this.edit(params.row) }, },
style: on: {
this.wfstatu == 1 click: () => this.edit(params.row)
? ( },
style: this.wfstatu == 1 ?
(
(params.row.status == 1 && (params.row.status == 1 &&
params.row.id == params.row.rootId && params.row.id == params.row.rootId &&
params.row.divideMark != 0) || params.row.divideMark != 0) ||
params.row.id != params.row.rootId || params.row.id != params.row.rootId ||
params.row.status != 1 params.row.status != 1 ?
? "display:none" "display:none" :
: "") "") : (
: (
(params.row.status == 3 && (params.row.status == 3 &&
params.row.id == params.row.rootId && params.row.id == params.row.rootId &&
params.row.divideMark != 0) || params.row.divideMark != 0) ||
params.row.id != params.row.rootId || params.row.id != params.row.rootId ||
params.row.status != 3 params.row.status != 3 ?
? "display:none" "display:none" :
: "") "")
}, },
"编辑" "编辑"
), ),
h( h(
"op", "op", {
{ attrs: {
attrs: { oprate: "remove" }, oprate: "remove"
on: { click: () => this.remove(params.row) }, },
style: on: {
this.wfstatu == 1 click: () => this.remove(params.row)
? ( },
style: this.wfstatu == 1 ?
(
(params.row.status == 1 && (params.row.status == 1 &&
params.row.id == params.row.rootId && params.row.id == params.row.rootId &&
params.row.divideMark != 0) || params.row.divideMark != 0) ||
params.row.id != params.row.rootId || params.row.id != params.row.rootId ||
params.row.status != 1 params.row.status != 1 ?
? "display:none" "display:none" :
: "") "") : (
: (
(params.row.status == 3 && (params.row.status == 3 &&
params.row.id == params.row.rootId && params.row.id == params.row.rootId &&
params.row.divideMark != 0) || params.row.divideMark != 0) ||
params.row.id != params.row.rootId || params.row.id != params.row.rootId ||
params.row.status != 3 params.row.status != 3 ?
? "display:none" "display:none" :
: "") "")
}, },
"删除" "删除"
), ),
h( h(
"op", "op", {
{ attrs: {
attrs: { oprate: "detail" }, oprate: "detail"
on: { click: () => this.split(params.row) }, },
style: on: {
this.wfstatu == 1 click: () => this.split(params.row)
? ( },
style: this.wfstatu == 1 ?
(
(params.row.divideMark != 0 && (params.row.divideMark != 0 &&
params.row.id == params.row.rootId) || params.row.id == params.row.rootId) ||
params.row.status != 1 || params.row.status != 1 ||
params.row.quantity <= 1 params.row.quantity <= 1 ?
? "display:none" "display:none" :
: "") "") : (
: (
(params.row.divideMark != 0 && (params.row.divideMark != 0 &&
params.row.id == params.row.rootId) || params.row.id == params.row.rootId) ||
params.row.status != 3 || params.row.status != 3 ||
params.row.quantity <= 1 params.row.quantity <= 1 ?
? "display:none" "display:none" :
: "") "")
}, },
"分解" "分解"
) )
...@@ -530,15 +518,19 @@ export default { ...@@ -530,15 +518,19 @@ export default {
})(); })();
}; };
}, },
async fetch({ store, params }) { async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
await store.dispatch('loadDepartments');//加载部门 await store.dispatch('loadDepartments'); //加载部门
}, },
computed: { computed: {
searchList() { searchList() {
let nodeList = this.treeData; let nodeList = this.treeData;
var text = this.treeInputSearch; var text = this.treeInputSearch;
var newNodeList = []; var newNodeList = [];
function searchTree(nodeLists, value) { function searchTree(nodeLists, value) {
for (let i = 0; i < nodeLists.length; i++) { for (let i = 0; i < nodeLists.length; i++) {
if (nodeLists[i].title.indexOf(value) != -1) { if (nodeLists[i].title.indexOf(value) != -1) {
...@@ -593,7 +585,12 @@ export default { ...@@ -593,7 +585,12 @@ export default {
this.showMenu = true; this.showMenu = true;
}, },
productSearch(id, item, productIds, ids) { productSearch(id, item, productIds, ids) {
let where = { bomId: { op: "In", value: ids } }; let where = {
bomId: {
op: "In",
value: ids
}
};
this.$refs.grid.reload(where); this.$refs.grid.reload(where);
}, },
//确定分解 //确定分解
...@@ -867,7 +864,9 @@ export default { ...@@ -867,7 +864,9 @@ export default {
}, },
//删除前判断子订单是否能删除 //删除前判断子订单是否能删除
sondeletecheck(code) { sondeletecheck(code) {
let param = { id: code }; let param = {
id: code
};
Api.sondeletecheck(param).then(res => { Api.sondeletecheck(param).then(res => {
if (res.result == 1) { if (res.result == 1) {
this.delNum += 0; this.delNum += 0;
...@@ -878,7 +877,9 @@ export default { ...@@ -878,7 +877,9 @@ export default {
}, },
//删除前判断子订单 //删除前判断子订单
sondeletecheck1(code) { sondeletecheck1(code) {
let param = { id: code }; let param = {
id: code
};
let delStaut = 0; let delStaut = 0;
Api.sondeletecheck(param).then(res => { Api.sondeletecheck(param).then(res => {
if (res.result == 1) { if (res.result == 1) {
...@@ -892,7 +893,9 @@ export default { ...@@ -892,7 +893,9 @@ export default {
}, },
//删除确定 //删除确定
removeOk() { removeOk() {
let params = { ids: this.actIds }; let params = {
ids: this.actIds
};
Api.mesorderdelete(params) Api.mesorderdelete(params)
.then(r => { .then(r => {
if (r.success) { if (r.success) {
...@@ -977,7 +980,10 @@ export default { ...@@ -977,7 +980,10 @@ export default {
this.selectdata = []; this.selectdata = [];
this.selectdata = data; this.selectdata = data;
this.list = []; this.list = [];
this.list.push({ label: data[0].title, value: data[0].id }); this.list.push({
label: data[0].title,
value: data[0].id
});
//this.formValidate.classType=data[0].id; //this.formValidate.classType=data[0].id;
if (data[0].isProduct == "1") { if (data[0].isProduct == "1") {
this.orderSearchForm.productName = data[0].id; this.orderSearchForm.productName = data[0].id;
...@@ -987,11 +993,14 @@ export default { ...@@ -987,11 +993,14 @@ export default {
} }
} }
}, },
renderContent(h, { root, node, data }) { renderContent(h, {
root,
node,
data
}) {
//渲染树的样式 //渲染树的样式
return h( return h(
"span", "span", {
{
style: { style: {
color: data.isProduct != "1" ? "#249E91" : "#333", //根据选中状态设置样式 color: data.isProduct != "1" ? "#249E91" : "#333", //根据选中状态设置样式
cursor: "pointer" cursor: "pointer"
...@@ -1034,18 +1043,25 @@ export default { ...@@ -1034,18 +1043,25 @@ export default {
"rootId" "rootId"
); );
this.dataT = this.$u.clone(this.dataT); 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 { .content {
margin-top: 10px; margin-top: 10px;
.ivu-icon-ios-add:before { .ivu-icon-ios-add:before {
content: "\f341"; content: "\f341";
} }
.ivu-icon-ios-remove:before { .ivu-icon-ios-remove:before {
content: "\f33d"; content: "\f33d";
} }
......
...@@ -44,5 +44,9 @@ export default { ...@@ -44,5 +44,9 @@ export default {
getmaterialdefinitionproperty(params){ getmaterialdefinitionproperty(params){
return Api.get(`${material}/custompropertydefinition/getmaterialdefinitionproperty`,params); return Api.get(`${material}/custompropertydefinition/getmaterialdefinitionproperty`,params);
}, },
//批量导入
import(params) {
return Api.post(`${resourceUrl}/resourceimportservice/import`, params);
},
} }
\ No newline at end of file
<template> <template>
<Layout class="full"> <Layout class="full">
<Sider hide-trigger v-if="showMenu" class="menu_side" width="300"> <Sider hide-trigger v-if="showMenu" class="menu_side" width="300">
<StoreTree @on-hide="onHide" @on-select="productSearch" /> <StoreTree @on-hide="onHide" @on-select="productSearch" />
</Sider> </Sider>
...@@ -9,25 +9,11 @@ ...@@ -9,25 +9,11 @@
</a> </a>
</div> </div>
<Content class="content" :class="!showMenu?'con_bord':''"> <Content class="content" :class="!showMenu?'con_bord':''">
<DataGrid <DataGrid :columns="columns" ref="grid" :action="action" :conditions="easySearch" :batch="true" :format="checkData" @all-change="allchange" @on-selection-change="onSelect" exportTitle="制造资源">
:columns="columns"
ref="grid"
:action="action"
:conditions="easySearch"
:batch="true"
:format="checkData"
@all-change="allchange"
@on-selection-change="onSelect"
>
<template slot="easySearch"> <template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline> <Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys"> <FormItem prop="keys">
<Input <Input clearable placeholder="请输入资源名称/资源编码/编码" v-model.trim="easySearch.keys.value" v-width="260" />
clearable
placeholder="请输入资源名称/资源编码/编码"
v-model.trim="easySearch.keys.value"
v-width="260"
/>
</FormItem> </FormItem>
<FormItem> <FormItem>
<Button type="primary" @click="search">查询</Button> <Button type="primary" @click="search">查询</Button>
...@@ -43,29 +29,20 @@ ...@@ -43,29 +29,20 @@
<Badge :count="this.$store.state.count" overflow-count="99" style="margin-right:5px;"> <Badge :count="this.$store.state.count" overflow-count="99" style="margin-right:5px;">
<Button icon="md-cart" @click="showCart">借出车</Button> <Button icon="md-cart" @click="showCart">借出车</Button>
</Badge> </Badge>
<Button @click="openModalIm">导入</Button>
</template> </template>
<template slot="batch"> <template slot="batch">
<Button type="primary" class="mr10 ml10" @click="addCart">加入借出车</Button> <Button type="primary" class="mr10 ml10" @click="addCart">加入借出车</Button>
</template> </template>
</DataGrid> </DataGrid>
<Modal v-model="modal" :title="title" width="1200" footer-hide :fullscreen="fscreeen"> <Modal v-model="modal" :title="title" width="1200" footer-hide :fullscreen="fscreeen">
<component <component :is="detail" :eid="curId" :rootName="rootName" :storeTitle="storeTitle" :materialType="materialType" :storeId="storeId" :mcode="mCode" :cartList="this.$u.clone(this.$store.state.cart)" @on-close="cancel" @on-ok="ok" @substr="substr" />
:is="detail"
:eid="curId"
:rootName="rootName"
:storeTitle="storeTitle"
:materialType="materialType"
:storeId="storeId"
:mcode="mCode"
:cartList="this.$u.clone(this.$store.state.cart)"
@on-close="cancel"
@on-ok="ok"
@substr="substr"
/>
</Modal> </Modal>
<ImportExcel ref="importExcel" @on-get-data="getData" :columns="columns" :open="ModalIm" @on-cancel="ModalImCancel" @on-ok="ok" />
</Content> </Content>
</Layout> </Layout>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
import Search from "./search"; import Search from "./search";
...@@ -84,7 +61,10 @@ export default { ...@@ -84,7 +61,10 @@ export default {
action: Api.index, action: Api.index,
showMenu: true, showMenu: true,
easySearch: { easySearch: {
keys: { op: "nameOfResource,code,resourceCode", value: null }, keys: {
op: "nameOfResource,code,resourceCode",
value: null
},
}, },
fscreeen: false, fscreeen: false,
modal: false, modal: false,
...@@ -96,8 +76,7 @@ export default { ...@@ -96,8 +76,7 @@ export default {
storeTitle: "", storeTitle: "",
materialType: "", materialType: "",
mCode: "", mCode: "",
columns: [ columns: [{
{
key: "selection", key: "selection",
type: "selection", type: "selection",
width: 50, width: 50,
...@@ -110,7 +89,6 @@ export default { ...@@ -110,7 +89,6 @@ export default {
align: "left", align: "left",
sortable: true, sortable: true,
}, },
{ {
key: "ico", key: "ico",
title: " ", title: " ",
...@@ -119,18 +97,21 @@ export default { ...@@ -119,18 +97,21 @@ export default {
high: true, high: true,
width: 60, width: 60,
render: (h, params) => { render: (h, params) => {
return h("div", { class: "action" }, [ return h("div", {
class: "action"
}, [
h(params.row.numberAvailable > 0 ? "op" : "", { h(params.row.numberAvailable > 0 ? "op" : "", {
attrs: { attrs: {
icon: "ios-cart-outline", icon: "ios-cart-outline",
type: "icon", type: "icon",
}, },
on: { click: () => this.addCart(params.row) }, on: {
click: () => this.addCart(params.row)
},
}), }),
]); ]);
}, },
}, },
{ {
key: "resourceCode", key: "resourceCode",
title: this.l("resourceId"), title: this.l("resourceId"),
...@@ -204,13 +185,13 @@ export default { ...@@ -204,13 +185,13 @@ export default {
{ {
key: "totalNum", key: "totalNum",
title: this.l("totalNum"), title: this.l("totalNum"),
align: "left", align: "right",
easy: true, easy: true,
}, },
{ {
key: "numberAvailable", key: "numberAvailable",
title: this.l("numberAvailable"), title: this.l("numberAvailable"),
align: "left", align: "right",
easy: true, easy: true,
}, },
{ {
...@@ -252,7 +233,7 @@ export default { ...@@ -252,7 +233,7 @@ export default {
{ {
key: "state", key: "state",
title: this.l("state"), title: this.l("state"),
align: "left", align: "center",
code: "mes_xingchi_resource.resource.state", code: "mes_xingchi_resource.resource.state",
}, },
// { // {
...@@ -266,32 +247,35 @@ export default { ...@@ -266,32 +247,35 @@ export default {
title: "操作", title: "操作",
width: 190, width: 190,
align: "center", align: "center",
key: "action",
hide: false, hide: false,
render: (h, params) => { render: (h, params) => {
return h("div", { class: "action" }, [ return h("div", {
class: "action"
}, [
h( h(
"op", "op", {
{
attrs: { attrs: {
oprate: "delete", oprate: "delete",
title: "删除", title: "删除",
}, },
class: class: params.row.totalNum === params.row.numberAvailable ?
params.row.totalNum === params.row.numberAvailable "remove" : "disable",
? "remove" on: {
: "disable", click: () => this.remove(params.row)
on: { click: () => this.remove(params.row) }, },
}, },
"删除" "删除"
), ),
h( h(
"op", "op", {
{
attrs: { attrs: {
oprate: "detail", oprate: "detail",
title: "查看日志", title: "查看日志",
}, },
on: { click: () => this.logDetail(params.row.id) }, on: {
click: () => this.logDetail(params.row.id)
},
}, },
"查看日志" "查看日志"
), ),
...@@ -307,6 +291,8 @@ export default { ...@@ -307,6 +291,8 @@ export default {
cartList: [], cartList: [],
cartListCount: 0, cartListCount: 0,
selectRows: [], selectRows: [],
//导入
ModalIm: false,
}; };
}, },
created() { created() {
...@@ -321,7 +307,10 @@ export default { ...@@ -321,7 +307,10 @@ export default {
})(); })();
}; };
}, },
async fetch({ store, params }) { async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
computed: {}, computed: {},
...@@ -380,7 +369,10 @@ export default { ...@@ -380,7 +369,10 @@ export default {
newArr.forEach((item2, index, thisArr) => { newArr.forEach((item2, index, thisArr) => {
if (item.id == item2.id) { if (item.id == item2.id) {
hasPush = true; hasPush = true;
thisArr[index] = { ...item, ...item2 }; thisArr[index] = {
...item,
...item2
};
return; return;
} }
}); });
...@@ -489,7 +481,12 @@ export default { ...@@ -489,7 +481,12 @@ export default {
this.storeTitle = item.title; this.storeTitle = item.title;
this.rootName = rootName.join(" / "); this.rootName = rootName.join(" / ");
this.materialType = item.materialType; this.materialType = item.materialType;
let where = { storeId: { op: "In", value: ids } }; let where = {
storeId: {
op: "In",
value: ids
}
};
this.$refs.grid.reload(where); this.$refs.grid.reload(where);
}, },
setNum(row) { setNum(row) {
...@@ -499,6 +496,46 @@ export default { ...@@ -499,6 +496,46 @@ export default {
this.fscreeen = false; this.fscreeen = false;
this.modal = true; this.modal = true;
}, },
//批量导入start
//导入功能
openModalIm() {
this.ModalIm = true
},
ModalImCancel() {
this.ModalIm = false
},
getData(val) {
let url = `${resourceUrl}/resourceimportservice/import`;
this.$refs.importExcel.deelData(url, this.columns, this.formatMethod(val))
},
//根据页面二次处理数据
formatMethod(val) {
let tempData = this.$u.clone(val);
let tempList = [];
tempData.forEach((ele) => {
let obj = {
nameOfResource: ele.nameOfResource ? ele.nameOfResource : '',
resourceCode: ele.resourceCode ? ele.resourceCode : '',
code: ele.code ? ele.code : '',
totalNum: ele.totalNum ? ele.nameOfResource : 0,
storeTitle: ele.storeTitle ? ele.storeTitle : '',
storeId: ele.storeId ? ele.nameOfResource : null,
state: 1,
numberAvailable: ele.numberAvailable ? ele.nameOfResource : 0,
json: {}
};
if (ele.nameOfResource && ele.nameOfResource != '' && ele.code && ele.code != '' && ele.resourceCode && ele.resourceCode != '') {
obj.ico = false
} else {
obj.ico = true
}
tempList.push(obj);
});
return tempList
},
//批量导入end
l(key) { l(key) {
let vkey = "resource" + "." + key; let vkey = "resource" + "." + key;
return this.$t(vkey) || key; return this.$t(vkey) || key;
...@@ -506,15 +543,19 @@ export default { ...@@ -506,15 +543,19 @@ export default {
}, },
}; };
</script> </script>
<style lang="less"> <style lang="less">
.full { .full {
margin-top: 0; margin-top: 0;
.content { .content {
margin-top: 10px; margin-top: 10px;
padding-top: 10px; padding-top: 10px;
.ivu-icon-ios-add:before { .ivu-icon-ios-add:before {
content: "\f341"; content: "\f341";
} }
.ivu-icon-ios-remove:before { .ivu-icon-ios-remove:before {
content: "\f33d"; content: "\f33d";
} }
......
...@@ -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