Commit 7d0d34cf authored by renjintao's avatar renjintao

FooterToolbar 操作按钮

parent e53c03e7
<template> <template>
<div class="h100 table-content"> <div class="h100 table-content1">
<p class="mb10"> <p class="mb10">
订单编号:{{mesCodes}} 订单编号:{{mesCodes}}
<span class="ml20">产品名称:{{productNames}}</span> <span class="ml20">产品名称:{{productNames}}</span>
<span class="ml20">生产数量:{{counts}}</span> <span class="ml20">生产数量:{{counts}}</span>
</p> </p>
<div class="mb20" v-for="(item,i) in datas" :key="i"> <div class="mb70" v-for="(item,i) in datas" :key="i">
<p class="fwBold">{{item.routingHeader}}------{{item.routingHeaderCode}}</p> <p class="fwBold">{{item.routingHeader}}------{{item.routingHeaderCode}}</p>
<Table <Table border :columns="cols" :data="item.suport" :ref="'table'+item.routingHeaderId" class="tableCommon" @on-selection-change="selectionChange(i)" @on-select-cancel="selectListCancel" @on-select-all-cancel="selectAllCancel" @on-select="selectList" @on-select-all="selectListAll">
border <template slot-scope="{ row, index }" slot="counts">
:columns="cols" <InputNumber :max="row.totalCount" :min="0" v-model="row.count" @on-change="inputChange1(i,row,index)" />
:data="item.suport" </template>
:ref="'table'+item.routingHeaderId" <template slot-scope="{ row, index }" slot="remarks">
class="tableCommon" <Input type="text" v-model="row.remark" @on-change="inputChange1(i,row,index)" />
@on-selection-change="selectionChange(i)" </template>
@on-select-cancel="selectListCancel" </Table>
@on-select-all-cancel="selectAllCancel"
@on-select="selectList"
@on-select-all="selectListAll"
>
<template slot-scope="{ row, index }" slot="counts">
<InputNumber
:max="row.totalCount"
:min="0"
v-model="row.count"
@on-change="inputChange1(i,row,index)"
/>
</template>
<template slot-scope="{ row, index }" slot="remarks">
<Input type="text" v-model="row.remark" @on-change="inputChange1(i,row,index)" />
</template>
</Table>
</div> </div>
<FooterToolbar v-show="footerToolbar" class="ftball"> <FooterToolbar v-show="footerToolbar" class="ftball pt10">
<!--<div class="tip">已选{{selectItems.length}}项</div>--> <!--<div class="tip">已选{{selectItems.length}}项</div>-->
<Form :model="orderForm" :label-width="110" ref="formValidate" :rules="ruleValidate"> <Form :model="orderForm" :inline="true" :label-width="0" ref="formValidate" :rules="ruleValidate">
<FormItem label=" " prop="QuotationFinishDate"> <FormItem prop="QuotationFinishDate">
<DatePicker <DatePicker v-model="orderForm.QuotationFinishDate" type="date" style="color:black" placeholder="请选择齐套日期" @on-change="getTimeQuotationFD"></DatePicker>
v-model="orderForm.QuotationFinishDate" </FormItem>
type="date" <FormItem>
style="color:black" <Button type="primary" class="mr10 ml10" @click="application">申请配套</Button>
placeholder="请选择齐套日期" </FormItem>
@on-change="getTimeQuotationFD" <FormItem>
></DatePicker> <Button @click="cancelBatch" v-show="false">取消</Button>
</FormItem> </FormItem>
</Form> </Form>
<Button type="primary" class="mr10 ml10" @click="application">申请配套</Button>
<Button @click="cancelBatch" v-show="false">取消</Button>
</FooterToolbar> </FooterToolbar>
</div> </div>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
export default { export default {
name: "addAccessory", name: "addAccessory",
data() { data() {
return { return {
disabled: false, disabled: false,
deletelModal: false, deletelModal: false,
curId: 0, curId: 0,
editIndex: -1, editIndex: -1,
editNum: "", editNum: "",
cols: [ cols: [{
{ type: "selection",
type: "selection", width: 70,
width: 70, align: "center",
align: "center", },
{
key: "routingDetailNo",
title: this.l("routingDetailNo"),
align: "left",
},
{
key: "routingDetailName",
title: this.l("routingDetailName"),
align: "left",
},
{
key: "nameMaterial",
title: this.l("nameMaterial"),
align: "left",
},
{
key: "materialNumber",
title: this.l("materialNumber"),
align: "left",
},
{
key: "totalCount",
title: this.l("totalCount"),
align: "left",
},
{
key: "count",
title: this.l("count"),
align: "right",
slot: "counts",
width: 120,
},
{
key: "remark",
title: this.l("remark"),
align: "left",
slot: "remarks",
},
],
orderForm: {
QuotationFinishDate: "",
},
datas: [],
selectItems: [],
footerToolbar: true,
orderId: this.eid,
mesCodes: this.mesCode,
productNames: this.productName,
drawnNumbers: this.drawnNumber,
counts: this.count,
curArr: 0, //标记当前操作工艺规程列表是否为空
ruleValidate: {
QuotationFinishDate: [{
required: true,
message: "_",
trigger: "change",
}, ],
},
tempList: [],
cRow: null,
cArr: [],
};
},
props: {
eid: Number,
mesCode: String,
productName: String,
drawnNumber: String,
count: Number,
},
mounted() {
this.load(this.eid);
},
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
load(v) {
Api.matchlist({
id: v
}).then((r) => {
if (r.success) {
r.result.forEach((e) => {
let i = 0;
e.suport.forEach((el) => {
el.count = el.totalCount;
el._checked = true;
el._index = i++;
});
});
this.datas = r.result;
//----测试多个工艺start----
// let temre = this.$u.clone(r.result);
// temre.forEach((ele) => {
// ele.routingHeaderId = 281;
// ele.suport.forEach((eles) => {
// eles.routingHeaderId = 281;
// eles.id = eles.id + 20;
// eles.nameMaterial = eles.nameMaterial + "tttt";
// });
// });
// this.datas = r.result.concat(temre);
//----测试多个工艺end----
}
});
}, },
{ getTimeQuotationFD(value) {
key: "routingDetailNo", this.orderForm.QuotationFinishDate =
title: this.l("routingDetailNo"), value != "" ? this.getFormatDateEnd(value) : value;
align: "left",
}, },
{ getFormatDateEnd(dates) {
key: "routingDetailName", const d = new Date(dates);
title: this.l("routingDetailName"), const resDate =
align: "left", d.getFullYear() +
"-" +
this.p(d.getMonth() + 1) +
"-" +
this.p(d.getDate()) +
" 23:59:59";
return resDate;
}, },
{ p(s) {
key: "nameMaterial", return s < 10 ? "0" + s : s;
title: this.l("nameMaterial"),
align: "left",
}, },
{ selectionChange(v) {
key: "materialNumber", if (this.curArr == 3) {
title: this.l("materialNumber"), //单条取消选择
align: "left", this.cRow._checked = false;
this.$set(this.datas[v].suport, this.cRow._index, this.cRow);
} else if (this.curArr == 1) {
//单条选择
this.cRow._checked = true;
this.$set(this.datas[v].suport, this.cRow._index, this.cRow);
} else if (this.curArr == 2) {
//多条选择
this.datas[v].suport.forEach((ele, index, array) => {
ele._checked = true;
this.$set(this.datas[v].suport, index, ele);
});
} else if (this.curArr == 4) {
//多条取消
this.datas[v].suport.forEach((ele, index, array) => {
ele._checked = false;
this.$set(this.datas[v].suport, index, ele);
});
}
}, },
{ selectList(items, row) {
key: "totalCount", this.curArr = 1;
title: this.l("totalCount"), this.cRow = row;
align: "left",
}, },
{ selectListAll(items) {
key: "count", this.curArr = 2;
title: this.l("count"),
align: "right",
slot: "counts",
width: 120,
}, },
{ selectListCancel(items, row) {
key: "remark", this.curArr = 3;
title: this.l("remark"), this.cRow = row;
align: "left",
slot: "remarks",
}, },
], selectAllCancel(items) {
orderForm: { this.curArr = 4;
QuotationFinishDate: "", },
}, delById(arr, id) {
datas: [], //取消删除某行数据
selectItems: [], arr.forEach((element) => {
footerToolbar: true, if (element.id == id) {
orderId: this.eid, if (arr.indexOf(element) > -1) {
mesCodes: this.mesCode, var i = arr.indexOf(element);
productNames: this.productName, arr.splice(i, 1);
drawnNumbers: this.drawnNumber, }
counts: this.count, }
curArr: 0, //标记当前操作工艺规程列表是否为空
ruleValidate: {
QuotationFinishDate: [
{
required: true,
message: "_",
trigger: "change",
},
],
},
tempList: [],
cRow: null,
cArr: [],
};
},
props: {
eid: Number,
mesCode: String,
productName: String,
drawnNumber: String,
count: Number,
},
mounted() {
this.load(this.eid);
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
load(v) {
Api.matchlist({ id: v }).then((r) => {
if (r.success) {
r.result.forEach((e) => {
let i = 0;
e.suport.forEach((el) => {
el.count = el.totalCount;
el._checked = true;
el._index = i++;
}); });
}); return arr;
this.datas = r.result; },
//----测试多个工艺start---- delSame(arr) {
// let temre = this.$u.clone(r.result); //数组根据id去重复
// temre.forEach((ele) => { var newArr = [];
// ele.routingHeaderId = 281; var arrId = [];
// ele.suport.forEach((eles) => { for (var item of arr) {
// eles.routingHeaderId = 281; if (arrId.indexOf(item["id"]) == -1) {
// eles.id = eles.id + 20; arrId.push(item["id"]);
// eles.nameMaterial = eles.nameMaterial + "tttt"; newArr.push(item);
// }); }
// }); }
// this.datas = r.result.concat(temre); return newArr;
//----测试多个工艺end---- },
} delByHeadId(arr, id) {
}); //根据工艺规程id进行去除过滤
}, let arrs = arr.filter((item, i) => {
getTimeQuotationFD(value) { return item.routingHeaderId != id;
this.orderForm.QuotationFinishDate =
value != "" ? this.getFormatDateEnd(value) : value;
},
getFormatDateEnd(dates) {
const d = new Date(dates);
const resDate =
d.getFullYear() +
"-" +
this.p(d.getMonth() + 1) +
"-" +
this.p(d.getDate()) +
" 23:59:59";
return resDate;
},
p(s) {
return s < 10 ? "0" + s : s;
},
selectionChange(v) {
if (this.curArr == 3) {
//单条取消选择
this.cRow._checked = false;
this.$set(this.datas[v].suport, this.cRow._index, this.cRow);
} else if (this.curArr == 1) {
//单条选择
this.cRow._checked = true;
this.$set(this.datas[v].suport, this.cRow._index, this.cRow);
} else if (this.curArr == 2) {
//多条选择
this.datas[v].suport.forEach((ele, index, array) => {
ele._checked = true;
this.$set(this.datas[v].suport, index, ele);
});
} else if (this.curArr == 4) {
//多条取消
this.datas[v].suport.forEach((ele, index, array) => {
ele._checked = false;
this.$set(this.datas[v].suport, index, ele);
});
}
},
selectList(items, row) {
this.curArr = 1;
this.cRow = row;
},
selectListAll(items) {
this.curArr = 2;
},
selectListCancel(items, row) {
this.curArr = 3;
this.cRow = row;
},
selectAllCancel(items) {
this.curArr = 4;
},
delById(arr, id) {
//取消删除某行数据
arr.forEach((element) => {
if (element.id == id) {
if (arr.indexOf(element) > -1) {
var i = arr.indexOf(element);
arr.splice(i, 1);
}
}
});
return arr;
},
delSame(arr) {
//数组根据id去重复
var newArr = [];
var arrId = [];
for (var item of arr) {
if (arrId.indexOf(item["id"]) == -1) {
arrId.push(item["id"]);
newArr.push(item);
}
}
return newArr;
},
delByHeadId(arr, id) {
//根据工艺规程id进行去除过滤
let arrs = arr.filter((item, i) => {
return item.routingHeaderId != id;
});
return arrs;
},
inputChange1(i, row, index) {
//输入数量
this.$set(this.datas[i].suport, index, row);
},
application() {
//申请配套操作
this.$refs["formValidate"].validate((valid) => {
if (valid) {
let temItems = [];
let temSelectItems = this.$u.clone(this.datas);
temSelectItems.forEach((e) => {
e.suport.forEach((ele) => {
if (ele._checked && ele.count > 0) {
let temObj = {
routingHeaderId: ele.routingHeaderId,
routingDeatilId: ele.routingDetailId,
routingDetailName: ele.routingDetailName,
routingDetailSeq: ele.routingDetailNo,
materialId: ele.materialId,
materialName: ele.nameMaterial,
materialNumber: ele.materialNumber,
needCount: ele.totalCount,
count: ele.count, //
remark: ele.remark ? ele.remark : "",
};
temItems.push(temObj);
}
}); });
}); return arrs;
let parms = { },
main: { inputChange1(i, row, index) {
orderId: this.orderId, //输入数量
orderCode:this.mesCode, this.$set(this.datas[i].suport, index, row);
productName: this.productNames, },
drawnNumber: this.drawnNumbers, application() {
count: this.counts, //申请配套操作
creator: this.$store.state.userInfo.userName, this.$refs["formValidate"].validate((valid) => {
finishDate: this.orderForm.QuotationFinishDate, if (valid) {
}, let temItems = [];
items: temItems, let temSelectItems = this.$u.clone(this.datas);
}; temSelectItems.forEach((e) => {
if (parms.items.length == 0) { e.suport.forEach((ele) => {
this.$Message.error("请输入申请数量"); if (ele._checked && ele.count > 0) {
} else { let temObj = {
Api.supportmainCreate(parms).then((res) => { routingHeaderId: ele.routingHeaderId,
if (res.success) { routingDeatilId: ele.routingDetailId,
this.$Message.success("申请成功"); routingDetailName: ele.routingDetailName,
//this.$emit("cancel"); routingDetailSeq: ele.routingDetailNo,
this.$emit("on-ok"); materialId: ele.materialId,
} materialName: ele.nameMaterial,
materialNumber: ele.materialNumber,
needCount: ele.totalCount,
count: ele.count, //
remark: ele.remark ? ele.remark : "",
};
temItems.push(temObj);
}
});
});
let parms = {
main: {
orderId: this.orderId,
orderCode: this.mesCode,
productName: this.productNames,
drawnNumber: this.drawnNumbers,
count: this.counts,
creator: this.$store.state.userInfo.userName,
finishDate: this.orderForm.QuotationFinishDate,
},
items: temItems,
};
if (parms.items.length == 0) {
this.$Message.error("请输入申请数量");
} else {
Api.supportmainCreate(parms).then((res) => {
if (res.success) {
this.$Message.success("申请成功");
//this.$emit("cancel");
this.$emit("on-ok");
}
});
}
}
}); });
} },
} cancelBatch() {
}); //取消选择
}, this.selectItems = [];
cancelBatch() { let temd = this.$u.clone(this.datas);
//取消选择 temd.forEach((res) => {
this.selectItems = []; this.$refs["table" + res.routingHeaderId][0].selectAll(false);
let temd = this.$u.clone(this.datas); });
temd.forEach((res) => { this.footerToolbar = false;
this.$refs["table" + res.routingHeaderId][0].selectAll(false); },
}); l(key) {
this.footerToolbar = false; let vkey = "support_item" + "." + key;
}, return this.$t(vkey) || key;
l(key) { },
let vkey = "support_item" + "." + key;
return this.$t(vkey) || key;
}, },
}, watch: {
watch: { eid(v) {
eid(v) { if (v != 0) {
if (v != 0) { this.load(v);
this.load(v); }
} },
}, },
},
}; };
</script> </script>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</span> </span>
</p> </p>
<div class="mb20" v-for="(item,i) in datas" :key="i"> <div class="mb70" v-for="(item,i) in datas" :key="i">
<p class="fwBold">{{item.routingHeader}}------{{item.routingHeaderCode}}</p> <p class="fwBold">{{item.routingHeader}}------{{item.routingHeaderCode}}</p>
<Table border :columns="cols" :data="item.suport" :ref="'table'+item.routingHeaderId" class="tableCommon" @on-selection-change="selectionChange(i)" @on-select-cancel="selectListCancel" @on-select-all-cancel="selectAllCancel" @on-select="selectList" @on-select-all="selectListAll"> <Table border :columns="cols" :data="item.suport" :ref="'table'+item.routingHeaderId" class="tableCommon" @on-selection-change="selectionChange(i)" @on-select-cancel="selectListCancel" @on-select-all-cancel="selectAllCancel" @on-select="selectList" @on-select-all="selectListAll">
<template slot-scope="{ row, index }" slot="counts"> <template slot-scope="{ row, index }" slot="counts">
...@@ -26,11 +26,11 @@ ...@@ -26,11 +26,11 @@
<FooterToolbar v-show="footerToolbar" class="ftball pt10"> <FooterToolbar v-show="footerToolbar" class="ftball pt10">
<!--<div class="tip">已选{{selectItems.length}}项</div>--> <!--<div class="tip">已选{{selectItems.length}}项</div>-->
<Form :model="orderForm" :inline="true" :label-width="110" ref="formValidate" :rules="ruleValidate"> <Form :model="orderForm" :inline="true" :label-width="0" ref="formValidate" :rules="ruleValidate">
<FormItem label=" " prop="QuotationFinishDate"> <FormItem prop="QuotationFinishDate">
<DatePicker v-model="orderForm.QuotationFinishDate" type="date" style="color:black" placeholder="请选择齐套日期" @on-change="getTimeQuotationFD"></DatePicker> <DatePicker v-model="orderForm.QuotationFinishDate" type="date" style="color:black" placeholder="请选择齐套日期" @on-change="getTimeQuotationFD"></DatePicker>
</FormItem> </FormItem>
<FormItem label=""><Button type="primary" class="mr10 ml10" @click="application">申请配套</Button></FormItem> <FormItem l><Button type="primary" class="mr10 ml10" @click="application">申请配套</Button></FormItem>
</Form> </Form>
</FooterToolbar> </FooterToolbar>
......
...@@ -6,14 +6,15 @@ ...@@ -6,14 +6,15 @@
<span class="ml20">生产数量:{{entity.count}}</span> <span class="ml20">生产数量:{{entity.count}}</span>
<span class="ml20" v-show="false">物料状态:</span> <span class="ml20" v-show="false">物料状态:</span>
</p> </p>
<div class="mb70">
<div class="mb20 ml40 mr40" v-for="(item,i) in datas" :key="i"> <div class="mb20 ml40 mr40" v-for="(item,i) in datas" :key="i">
<p class="fwBold">{{item.routingHeader}}------{{item.routingHeaderCode}}</p> <p class="fwBold">{{item.routingHeader}}------{{item.routingHeaderCode}}</p>
<Table border :columns="cols" :data="item.suport" :ref="'table'+item.routingHeaderId" class="tableCommon"> <Table border :columns="cols" :data="item.suport" :ref="'table'+item.routingHeaderId" class="tableCommon">
<template slot-scope="{ row, index }" slot="counts4"> <template slot-scope="{ row, index }" slot="counts4">
<InputNumber :max="row.outStockNumber-row.receiveNumber" :min="0" v-model="row.count4" @on-change="inputChange1(i,row,index)" :disabled="row._disabled" /> <InputNumber :max="row.outStockNumber-row.receiveNumber" :min="0" v-model="row.count4" @on-change="inputChange1(i,row,index)" :disabled="row._disabled" />
</template> </template>
</Table> </Table>
</div>
</div> </div>
<FooterToolbar v-show="footerToolbar"> <FooterToolbar v-show="footerToolbar">
<Button type="primary" class="mr10" @click="materialCreate">物料领用</Button> <Button type="primary" class="mr10" @click="materialCreate">物料领用</Button>
......
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