Commit 367ceb3d authored by renjintao's avatar renjintao

datagrid com

parent 5e178bdc
...@@ -21,6 +21,12 @@ ...@@ -21,6 +21,12 @@
</div> </div>
<div class="btns"> <div class="btns">
<slot name="buttons"></slot> <slot name="buttons"></slot>
<Button @click="openImportModal">
导入
</Button>
<Button @click="export2Excel">
导出
</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 +70,9 @@ ...@@ -64,6 +70,9 @@
</li> </li>
</ul> </ul>
</Drawer> </Drawer>
<Modal v-model="ImportModal" title="导入" fullscreen footer-hide>
<ImportExcel v-if="ImportModal" @on-get-data="getData" :columns="columnsNow" />
</Modal>
<FooterToolbar v-if="batch" v-show="footerToolbar"> <FooterToolbar v-if="batch" v-show="footerToolbar">
<div class="tip">已选{{selectItems.length}}</div> <div class="tip">已选{{selectItems.length}}</div>
<slot name="batch"></slot> <slot name="batch"></slot>
...@@ -96,6 +105,7 @@ export default { ...@@ -96,6 +105,7 @@ export default {
userConfig: null, //用户页面配置信息。, userConfig: null, //用户页面配置信息。,
// userId: 1 // userId: 1
userId: this.$store.state.userInfo.userId, userId: this.$store.state.userInfo.userId,
ImportModal: false,
}; };
}, },
props: { props: {
...@@ -212,6 +222,10 @@ export default { ...@@ -212,6 +222,10 @@ export default {
type: Number, type: Number,
default: 40, default: 40,
}, },
title: {
type: String,
default: "导出数据",
}
}, },
created() { created() {
this.columns.forEach((u) => { this.columns.forEach((u) => {
...@@ -462,6 +476,92 @@ export default { ...@@ -462,6 +476,92 @@ export default {
this.footerToolbar = false; this.footerToolbar = false;
this.$refs.table.selectAll(false); this.$refs.table.selectAll(false);
}, },
//导入功能
openImportModal() {
this.ImportModal = true
},
getData(val) {
// alert(JSON.stringify(val))
this.$emit("on-import-data", val)
},
closeImport() {
this.ImportModal = false
},
//导出excel
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")) {
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.title +
"(" + nowDate + ")",
tHeader,
filterVal,
list
);
});
},
//导入excel
}, },
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>
<div class="table-content">
<div class="table-tools">
<div class="table-search">
<Form inline>
<FormItem>
<div style="height:34px;overflow: hidden;padding:0">
<Upload action :before-upload="beforeUpload" ref="uploadfile" :format="formatList">
<Button icon="ios-cloud-upload-outline">上传文件</Button>
</Upload>
</div>
</FormItem>
<FormItem>
<Button type="primary" @click="openInfoModal" :disabled="btnIm">导入</Button>
</FormItem>
</Form>
</div>
<div class="btns">
<Form inline>
<FormItem>
<RadioGroup v-model="excelType" type="button" @on-change="changeExcel" size="small">
<Tooltip content="文件数据">
<Radio label="0">
<Icon type="ios-list-box-outline" />
</Radio>
</Tooltip>
<Tooltip content="粘贴Excel数据">
<Radio label="1">
<Icon type="ios-copy" />
</Radio>
</Tooltip>
</RadioGroup>
</FormItem>
</Form>
</div>
</div>
<div 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>
</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,
};
},
props: {
eid: Number,
data: {
// 当作table使用,直接显示数据
type: Array,
default: function () {
return [];
},
},
columns: {
//要显示的字段
type: Array,
default: [],
},
},
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.unshift({
type: 'index',
width: 80,
align: 'right',
title: '序号'
})
tempCol.forEach((ele, index) => {
if (ele.key == "action" || ele.type == "selection") {
ele.hide = true;
}
});
this.colsIm = tempCol;
//处理原始数据和表头进行对应
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;
},
//导入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.columns);
this.titleInfo = "批量导入";
this.infoModal = true
} else {
this.imBtn = false;
this.$Message.error("没有可导入的数据!")
}
},
//导入按钮操作
importOk() {
this.importUser();
},
//批量导入用户
importUser() {
let tempData = this.$u.clone(this.dataIm);
this.$emit("on-get-data", tempData)
},
//切换列表和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
}
},
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);
},
},
};
</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>
<div class="h100"> <div class="h100">
<DataGrid :columns="columns" ref="grid" :action="action"> <DataGrid :columns="columns" ref="grid" :action="action" title="导入中心">
<template slot="easySearch"> <template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline> <Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys"> <FormItem prop="keys">
......
<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" title="订单管理" @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,28 @@ export default { ...@@ -1034,18 +1043,28 @@ export default {
"rootId" "rootId"
); );
this.dataT = this.$u.clone(this.dataT); this.dataT = this.$u.clone(this.dataT);
} },
//批量导入start
onImportData(val) {
alert(JSON.stringify(val))
this.$refs.grid.closeImport()
},
//批量导入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";
} }
......
...@@ -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)
......
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