Commit 7d0d34cf authored by renjintao's avatar renjintao

FooterToolbar 操作按钮

parent e53c03e7
<template>
<div class="h100 table-content">
<div class="h100 table-content1">
<p class="mb10">
订单编号:{{mesCodes}}
<span class="ml20">产品名称:{{productNames}}</span>
<span class="ml20">生产数量:{{counts}}</span>
订单编号:{{mesCodes}}
<span class="ml20">产品名称:{{productNames}}</span>
<span class="ml20">生产数量:{{counts}}</span>
</p>
<div class="mb20" v-for="(item,i) in datas" :key="i">
<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"
>
<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 class="mb70" v-for="(item,i) in datas" :key="i">
<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">
<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>
<FooterToolbar v-show="footerToolbar" class="ftball">
<!--<div class="tip">已选{{selectItems.length}}项</div>-->
<Form :model="orderForm" :label-width="110" ref="formValidate" :rules="ruleValidate">
<FormItem label=" " prop="QuotationFinishDate">
<DatePicker
v-model="orderForm.QuotationFinishDate"
type="date"
style="color:black"
placeholder="请选择齐套日期"
@on-change="getTimeQuotationFD"
></DatePicker>
</FormItem>
</Form>
<Button type="primary" class="mr10 ml10" @click="application">申请配套</Button>
<Button @click="cancelBatch" v-show="false">取消</Button>
<FooterToolbar v-show="footerToolbar" class="ftball pt10">
<!--<div class="tip">已选{{selectItems.length}}项</div>-->
<Form :model="orderForm" :inline="true" :label-width="0" ref="formValidate" :rules="ruleValidate">
<FormItem prop="QuotationFinishDate">
<DatePicker v-model="orderForm.QuotationFinishDate" type="date" style="color:black" placeholder="请选择齐套日期" @on-change="getTimeQuotationFD"></DatePicker>
</FormItem>
<FormItem>
<Button type="primary" class="mr10 ml10" @click="application">申请配套</Button>
</FormItem>
<FormItem>
<Button @click="cancelBatch" v-show="false">取消</Button>
</FormItem>
</Form>
</FooterToolbar>
</div>
</div>
</template>
<script>
import Api from "./api";
export default {
name: "addAccessory",
data() {
return {
disabled: false,
deletelModal: false,
curId: 0,
editIndex: -1,
editNum: "",
cols: [
{
type: "selection",
width: 70,
align: "center",
name: "addAccessory",
data() {
return {
disabled: false,
deletelModal: false,
curId: 0,
editIndex: -1,
editNum: "",
cols: [{
type: "selection",
width: 70,
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----
}
});
},
{
key: "routingDetailNo",
title: this.l("routingDetailNo"),
align: "left",
getTimeQuotationFD(value) {
this.orderForm.QuotationFinishDate =
value != "" ? this.getFormatDateEnd(value) : value;
},
{
key: "routingDetailName",
title: this.l("routingDetailName"),
align: "left",
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;
},
{
key: "nameMaterial",
title: this.l("nameMaterial"),
align: "left",
p(s) {
return s < 10 ? "0" + s : s;
},
{
key: "materialNumber",
title: this.l("materialNumber"),
align: "left",
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);
});
}
},
{
key: "totalCount",
title: this.l("totalCount"),
align: "left",
selectList(items, row) {
this.curArr = 1;
this.cRow = row;
},
{
key: "count",
title: this.l("count"),
align: "right",
slot: "counts",
width: 120,
selectListAll(items) {
this.curArr = 2;
},
{
key: "remark",
title: this.l("remark"),
align: "left",
slot: "remarks",
selectListCancel(items, row) {
this.curArr = 3;
this.cRow = row;
},
],
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++;
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);
}
}
});
});
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) {
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 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;
});
});
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");
}
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);
}
});
});
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 = [];
let temd = this.$u.clone(this.datas);
temd.forEach((res) => {
this.$refs["table" + res.routingHeaderId][0].selectAll(false);
});
this.footerToolbar = false;
},
l(key) {
let vkey = "support_item" + "." + key;
return this.$t(vkey) || key;
},
cancelBatch() {
//取消选择
this.selectItems = [];
let temd = this.$u.clone(this.datas);
temd.forEach((res) => {
this.$refs["table" + res.routingHeaderId][0].selectAll(false);
});
this.footerToolbar = false;
},
l(key) {
let vkey = "support_item" + "." + key;
return this.$t(vkey) || key;
},
},
},
watch: {
eid(v) {
if (v != 0) {
this.load(v);
}
watch: {
eid(v) {
if (v != 0) {
this.load(v);
}
},
},
},
};
</script>
......@@ -12,7 +12,7 @@
</span>
</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>
<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">
......@@ -26,11 +26,11 @@
<FooterToolbar v-show="footerToolbar" class="ftball pt10">
<!--<div class="tip">已选{{selectItems.length}}项</div>-->
<Form :model="orderForm" :inline="true" :label-width="110" ref="formValidate" :rules="ruleValidate">
<FormItem label=" " prop="QuotationFinishDate">
<Form :model="orderForm" :inline="true" :label-width="0" ref="formValidate" :rules="ruleValidate">
<FormItem prop="QuotationFinishDate">
<DatePicker v-model="orderForm.QuotationFinishDate" type="date" style="color:black" placeholder="请选择齐套日期" @on-change="getTimeQuotationFD"></DatePicker>
</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>
</FooterToolbar>
......
......@@ -6,14 +6,15 @@
<span class="ml20">生产数量:{{entity.count}}</span>
<span class="ml20" v-show="false">物料状态:</span>
</p>
<div class="mb20 ml40 mr40" v-for="(item,i) in datas" :key="i">
<p class="fwBold">{{item.routingHeader}}------{{item.routingHeaderCode}}</p>
<Table border :columns="cols" :data="item.suport" :ref="'table'+item.routingHeaderId" class="tableCommon">
<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" />
</template>
</Table>
<div class="mb70">
<div class="mb20 ml40 mr40" v-for="(item,i) in datas" :key="i">
<p class="fwBold">{{item.routingHeader}}------{{item.routingHeaderCode}}</p>
<Table border :columns="cols" :data="item.suport" :ref="'table'+item.routingHeaderId" class="tableCommon">
<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" />
</template>
</Table>
</div>
</div>
<FooterToolbar v-show="footerToolbar">
<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