|
@@ -81,7 +81,7 @@
|
|
|
component: 'by-date-picker',
|
|
|
compConfig: {
|
|
|
format: 'yyyy-MM-dd hh:ss:mm',
|
|
|
- type: 'datetime'
|
|
|
+ type: 'datetime',
|
|
|
}
|
|
|
},
|
|
|
{
|
|
@@ -184,7 +184,7 @@
|
|
|
attr: {
|
|
|
size: 'mini',
|
|
|
type: 'number',
|
|
|
- defaultValue: '0',
|
|
|
+ defaultValue: 0,
|
|
|
},
|
|
|
}
|
|
|
},
|
|
@@ -357,7 +357,7 @@
|
|
|
}, {
|
|
|
name: '反提交',
|
|
|
event: {
|
|
|
- click: (item : any) => (this as any).doDelete2(item)
|
|
|
+ click: (item : any) => (this as any).returnSmt(item)
|
|
|
}
|
|
|
}]
|
|
|
}
|
|
@@ -821,63 +821,45 @@
|
|
|
this.getDataList()
|
|
|
}, 500)
|
|
|
}
|
|
|
- // 获取机构数据
|
|
|
- getSupplierModal(e : any) {
|
|
|
- console.log('获取机构数据 ==> ', e);
|
|
|
- this.supplierInfo = e;
|
|
|
- }
|
|
|
- // 监听表格数据变化
|
|
|
- onChangeRow(e : any) {
|
|
|
- e.realityPrice = e.number * e.unitPrice;
|
|
|
- e.totalPrice = e.realityPrice - e.prePrice;
|
|
|
- }
|
|
|
- // 确定商品新增
|
|
|
- confirmProduct(e : any) {
|
|
|
- let contents : any = [], goodsData = e, newArr : any = [], obj : any = {};
|
|
|
- goodsData = goodsData.map((item : any) => {
|
|
|
- item.materialName = item.skuTitle
|
|
|
- item.prePrice = 0
|
|
|
- // item.materialId = item.materialId
|
|
|
- item.unitPrice = item.price
|
|
|
- item.materialSku = item.id
|
|
|
- const { id, ...newData } = item
|
|
|
- // const { skuTitle, price, id, materialId, ...newData } = item
|
|
|
- return newData
|
|
|
- })
|
|
|
- this.tableData = this.tableData.concat(goodsData);
|
|
|
- newArr = this.tableData.reduce((prev : any, current : any) => {
|
|
|
- // console.log('prev ==> ', prev);
|
|
|
- // console.log('current ==> ', current);
|
|
|
- obj[current.materialSku] ? contents.push(current.materialName) : (obj[current.materialSku] = true && prev.push(current))
|
|
|
- return prev
|
|
|
- }, []);
|
|
|
- this.tableData = newArr;
|
|
|
- this.tableData.map((v : any, i : any) => {
|
|
|
- v.dataIndex = i
|
|
|
- });
|
|
|
- if (contents.length > 0) {
|
|
|
- this.$alert('商品 “' + contents + '” 已存在!', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- });
|
|
|
- };
|
|
|
- (this.$refs.bill as any).setBillTableValue(this.tableData, 0);// 设置第1张单据表格数据
|
|
|
- }
|
|
|
- // 提交
|
|
|
+ // 工具栏提交
|
|
|
onSmt(e : any) {
|
|
|
console.log('提交 ==>', e);
|
|
|
- (this as any).$refs.bill.$refs.billForm.validate().then(() => {
|
|
|
- let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
|
|
|
- if (this.tabType === 'all') {
|
|
|
- // api.saveList(query, 'supplyTaskOrder').then((res : any) => {
|
|
|
- // if (res.code === 200) {
|
|
|
- // this.$message.success('提交成功');
|
|
|
- // this.getDataList();
|
|
|
- // (this.$refs.bill as any).showTab = 'all';
|
|
|
- // (this.$refs.bill as any).setBillFormValue({});
|
|
|
- // } else this.failHandle(res)
|
|
|
- // })
|
|
|
+ let selectData = (this.$refs.bill as any).getTableSelectData(this.tabType); // 获取表格选中数据
|
|
|
+ if (selectData.length <= 0) return this.$message.warning('请选择提交数据');
|
|
|
+ if (selectData.length > 1) return this.$message.warning('只能提交一条数据');
|
|
|
+ this.$confirm('确定提交吗!', '注意', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ center: true
|
|
|
+ }).then(() => {
|
|
|
+ api.submitTo({ id: selectData[0].id }, 'supplyTaskOrder').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message.success('提交成功');
|
|
|
+ this.clickTab(this.tabType);
|
|
|
+ } else this.failHandle(res)
|
|
|
+ })
|
|
|
+ }).catch(() => this.$message.info('已取消提交'));
|
|
|
+ }
|
|
|
+ // 操作反提交
|
|
|
+ returnSmt(e : any) {
|
|
|
+ console.log('反提交 ==>', e);
|
|
|
+ this.$confirm('确定反提交吗!', '注意', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ center: true
|
|
|
+ }).then(() => {
|
|
|
+ // let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
|
|
|
+ if (this.tabType === 'smt') {
|
|
|
+ api.cancelSubmission({ id: e.id }, 'supplyTaskOrder').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message.success('反提交成功');
|
|
|
+ this.clickTab(this.tabType);
|
|
|
+ } else this.failHandle(res)
|
|
|
+ })
|
|
|
}
|
|
|
- })
|
|
|
+ }).catch(() => this.$message.info('已取消反提交'));
|
|
|
}
|
|
|
// 保存
|
|
|
onSave(e : any) {
|
|
@@ -891,9 +873,12 @@
|
|
|
// 子表数据
|
|
|
query.suborderList = this.tableData;
|
|
|
if (query.suborderList.length > 0) {
|
|
|
- query.suborderList.map((v : any) => {
|
|
|
- v.taskOrderId = query.id
|
|
|
- })
|
|
|
+ for (let v of query.suborderList) {
|
|
|
+ if (!v.number || v.number <= 0) return this.$message.warning('请输入正确物料数量');
|
|
|
+ if (!v.unitPrice || v.unitPrice <= 0) return this.$message.warning('请输入正确物料单价');
|
|
|
+ if (!v.prePrice || v.prePrice < 0) return this.$message.warning('请输入正确优惠金额');
|
|
|
+ v.taskOrderId = query.id;
|
|
|
+ }
|
|
|
};
|
|
|
// 表格删除
|
|
|
query.suborderList.map((v : any, i : any) => {
|
|
@@ -964,9 +949,27 @@
|
|
|
if (this.tabType === 'all' && e.submitState === 1) return this.setReadonly(e);
|
|
|
let data = e.suborderList
|
|
|
data.map((v : any, i : any) => {
|
|
|
- v.dataIndex = i
|
|
|
+ v.dataIndex = i;
|
|
|
+ if (!v.prePrice) v.prePrice = '0';
|
|
|
});
|
|
|
let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
|
|
|
+ if (billConfig.tableConfig[0].table.columns.at(-1).title != '操作') {
|
|
|
+ billConfig.tableConfig[0].table.columns.push({
|
|
|
+ width: 90,
|
|
|
+ title: '操作',
|
|
|
+ action: true,
|
|
|
+ plugins: [{
|
|
|
+ icon: 'el-icon-delete',
|
|
|
+ name: '删除',
|
|
|
+ audit: '',
|
|
|
+ event: {
|
|
|
+ click: (item : any) => {
|
|
|
+ (this as any).changeTable(item)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }]
|
|
|
+ })
|
|
|
+ };
|
|
|
billConfig.form.attr.readonly = false; // 设置只读
|
|
|
billConfig.tool.tools = { save: true, };
|
|
|
if (this.tabType === 'draftsBox' || e.submitState === 0) billConfig.tool.tools = { save: true, smt: true };
|
|
@@ -997,6 +1000,48 @@
|
|
|
(this.$refs.bill as any).showTab = 'bill';
|
|
|
|
|
|
}
|
|
|
+ // 获取机构数据
|
|
|
+ getSupplierModal(e : any) {
|
|
|
+ console.log('获取机构数据 ==> ', e);
|
|
|
+ this.supplierInfo = e;
|
|
|
+ }
|
|
|
+ // 监听表格数据变化
|
|
|
+ onChangeRow(e : any) {
|
|
|
+ e.realityPrice = e.number * e.unitPrice;
|
|
|
+ e.totalPrice = e.realityPrice - e.prePrice;
|
|
|
+ }
|
|
|
+ // 确定商品新增
|
|
|
+ confirmProduct(e : any) {
|
|
|
+ let contents : any = [], goodsData = e, newArr : any = [], obj : any = {};
|
|
|
+ goodsData = goodsData.map((item : any) => {
|
|
|
+ item.materialName = item.skuTitle
|
|
|
+ item.prePrice = 0
|
|
|
+ // item.materialId = item.materialId
|
|
|
+ item.unitPrice = item.price
|
|
|
+ item.materialSku = item.id
|
|
|
+ const { id, ...newData } = item
|
|
|
+ // const { skuTitle, price, id, materialId, ...newData } = item
|
|
|
+ return newData
|
|
|
+ })
|
|
|
+ this.tableData = this.tableData.concat(goodsData);
|
|
|
+ newArr = this.tableData.reduce((prev : any, current : any) => {
|
|
|
+ // console.log('prev ==> ', prev);
|
|
|
+ // console.log('current ==> ', current);
|
|
|
+ obj[current.materialSku] ? contents.push(current.materialName) : (obj[current.materialSku] = true && prev.push(current))
|
|
|
+ return prev
|
|
|
+ }, []);
|
|
|
+ this.tableData = newArr;
|
|
|
+ this.tableData.map((v : any, i : any) => {
|
|
|
+ v.dataIndex = i;
|
|
|
+ if (!v.prePrice) v.prePrice = '0';
|
|
|
+ });
|
|
|
+ if (contents.length > 0) {
|
|
|
+ this.$alert('商品 “' + contents + '” 已存在!', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ });
|
|
|
+ };
|
|
|
+ (this.$refs.bill as any).setBillTableValue(this.tableData, 0);// 设置第1张单据表格数据
|
|
|
+ }
|
|
|
// 派单
|
|
|
onDispatch(e : any) {
|
|
|
console.log('派单 ==>', e);
|