|
@@ -389,62 +389,80 @@
|
|
|
sum-text="小计"
|
|
|
style="width: 100%"
|
|
|
>
|
|
|
- <el-table-column prop="productName" label="品名" width="180">
|
|
|
+ <el-table-column prop="productNo" label="品名" width="180">
|
|
|
<template slot-scope="scope">
|
|
|
<!-- <el-input
|
|
|
v-model="scope.row.productName"
|
|
|
size="small"
|
|
|
clearable
|
|
|
></el-input> -->
|
|
|
- <el-select
|
|
|
- v-model="scope.row.productNo"
|
|
|
- placeholder=""
|
|
|
- :filter-method="(val) => mySelectFilter(val, scope.row)"
|
|
|
- clearable
|
|
|
- filterable
|
|
|
- @change="
|
|
|
- handleProductChange(scope.row.productNo, scope.row)
|
|
|
- "
|
|
|
+ <el-form-item
|
|
|
+ :prop="'productNo-' + scope.$index"
|
|
|
+ :name="'productNo-' + scope.$index"
|
|
|
+ style="margin: 0px; padding: 0px"
|
|
|
>
|
|
|
- <el-option
|
|
|
- v-for="item in productionOptions"
|
|
|
- :key="item.productNo"
|
|
|
- :label="item.productName"
|
|
|
- :value="item.productNo"
|
|
|
+ <el-select
|
|
|
+ v-model="scope.row.productNo"
|
|
|
+ placeholder=""
|
|
|
+ :filter-method="(val) => mySelectFilter(val, scope.row)"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ @change="
|
|
|
+ handleProductChange(scope.row.productNo, scope.row)
|
|
|
+ "
|
|
|
>
|
|
|
- <span class="discribe" style="float: left">{{
|
|
|
- item.productName
|
|
|
- }}</span>
|
|
|
- <span
|
|
|
- style="float: right; color: #8492a6; font-size: 13px"
|
|
|
- >{{ item.productSpecifications }}</span
|
|
|
+ <el-option
|
|
|
+ v-for="item in productionOptions"
|
|
|
+ :key="item.productNo"
|
|
|
+ :label="item.productName"
|
|
|
+ :value="item.productNo"
|
|
|
>
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
+ <span class="discribe" style="float: left">{{
|
|
|
+ item.productName
|
|
|
+ }}</span>
|
|
|
+ <span
|
|
|
+ style="float: right; color: #8492a6; font-size: 13px"
|
|
|
+ >{{ item.productSpecifications }}</span
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="productType" label="类型">
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="productNumber" label="数量/kg">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input
|
|
|
- v-model="scope.row.productNumber"
|
|
|
- oninput="value=value.replace(/[^0-9.]/g,'')"
|
|
|
- size="small"
|
|
|
- clearable
|
|
|
- @change="computedPrice(scope.row)"
|
|
|
- ></el-input>
|
|
|
+ <el-form-item
|
|
|
+ :prop="'productNumber-' + scope.$index"
|
|
|
+ :name="'productNumber-' + scope.$index"
|
|
|
+ style="margin: 0px; padding: 0px"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.productNumber"
|
|
|
+ oninput="value=value.replace(/[^0-9.]/g,'')"
|
|
|
+ size="small"
|
|
|
+ clearable
|
|
|
+ @change="computedPrice(scope.row)"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="productUnitPrice" label="单价">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input
|
|
|
- v-model="scope.row.productUnitPrice"
|
|
|
- size="small"
|
|
|
- oninput="value=value.replace(/[^0-9.]/g,'')"
|
|
|
- @change="computedPrice(scope.row)"
|
|
|
- clearable
|
|
|
- ></el-input>
|
|
|
+ <el-form-item
|
|
|
+ :prop="'productUnitPrice-' + scope.$index"
|
|
|
+ :name="'productUnitPrice-' + scope.$index"
|
|
|
+ style="margin: 0px; padding: 0px"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.productUnitPrice"
|
|
|
+ size="small"
|
|
|
+ oninput="value=value.replace(/[^0-9.]/g,'')"
|
|
|
+ @change="computedPrice(scope.row)"
|
|
|
+ clearable
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="productAmounts" label="金额">
|
|
@@ -454,47 +472,59 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="sliceType" label="切片型号">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-select
|
|
|
- v-model="scope.row.sliceType"
|
|
|
- placeholder=""
|
|
|
- clearable
|
|
|
- filterable
|
|
|
- @change="sliceTypeChangeHandler(scope.row)"
|
|
|
+ <el-form-item
|
|
|
+ :prop="'sliceType-' + scope.$index"
|
|
|
+ :name="'sliceType-' + scope.$index"
|
|
|
+ style="margin: 0px; padding: 0px"
|
|
|
>
|
|
|
- <el-option
|
|
|
- v-for="item in sliceTypeOptions"
|
|
|
- :key="item.materielCode"
|
|
|
- :label="item.materielName"
|
|
|
- :value="item.materielCode"
|
|
|
+ <el-select
|
|
|
+ v-model="scope.row.sliceType"
|
|
|
+ placeholder=""
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ @change="sliceTypeChangeHandler(scope.row)"
|
|
|
>
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
+ <el-option
|
|
|
+ v-for="item in sliceTypeOptions"
|
|
|
+ :key="item.materielCode"
|
|
|
+ :label="item.materielName"
|
|
|
+ :value="item.materielCode"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="colourNumber" label="色号">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-select
|
|
|
- v-model="scope.row.colourNumber"
|
|
|
- placeholder=""
|
|
|
- clearable
|
|
|
- filterable
|
|
|
- @change="colourNumberChangeHandler(scope.row)"
|
|
|
+ <el-form-item
|
|
|
+ :prop="'colourNumber-' + scope.$index"
|
|
|
+ :name="'colourNumber-' + scope.$index"
|
|
|
+ style="margin: 0px; padding: 0px"
|
|
|
>
|
|
|
- <el-option
|
|
|
- v-for="item in colourNumberOptions"
|
|
|
- :key="item.materielCode"
|
|
|
- :label="item.materieEncoding + item.materieColorNumber"
|
|
|
- :value="item.materielCode"
|
|
|
+ <el-select
|
|
|
+ v-model="scope.row.colourNumber"
|
|
|
+ placeholder=""
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ @change="colourNumberChangeHandler(scope.row)"
|
|
|
>
|
|
|
- <span class="discribe" style="float: left">{{
|
|
|
- item.materieEncoding + item.materieColorNumber
|
|
|
- }}</span>
|
|
|
- <!-- <span
|
|
|
+ <el-option
|
|
|
+ v-for="item in colourNumberOptions"
|
|
|
+ :key="item.materielCode"
|
|
|
+ :label="item.materieEncoding + item.materieColorNumber"
|
|
|
+ :value="item.materielCode"
|
|
|
+ >
|
|
|
+ <span class="discribe" style="float: left">{{
|
|
|
+ item.materieEncoding + item.materieColorNumber
|
|
|
+ }}</span>
|
|
|
+ <!-- <span
|
|
|
style="float: right; color: #8492a6; font-size: 13px"
|
|
|
>{{ item.materielCode }}</span
|
|
|
> -->
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="remark" label="备注">
|
|
@@ -1114,13 +1144,19 @@ export default {
|
|
|
this.productionOptions = this.allProductionOptions.slice(0, 500);
|
|
|
return;
|
|
|
}
|
|
|
- row.productName = this.productionOptions.find(
|
|
|
- (item) => item.productNo == productNo
|
|
|
- )?.productName;
|
|
|
- row.productType = this.productionOptions.find(
|
|
|
+ let targetItem = this.allProductionOptions.find(
|
|
|
(item) => item.productNo == productNo
|
|
|
- )?.productType;
|
|
|
+ );
|
|
|
+ row.productName = targetItem?.productName;
|
|
|
+ row.productType = targetItem?.productType;
|
|
|
+ if (targetItem) {
|
|
|
+ targetItem = JSON.parse(JSON.stringify(targetItem));
|
|
|
+ }
|
|
|
+
|
|
|
this.productionOptions = this.allProductionOptions.slice(0, 500);
|
|
|
+ if (!this.productionOptions.find((item) => item.productNo == productNo)) {
|
|
|
+ this.productionOptions.unshift(targetItem);
|
|
|
+ }
|
|
|
},
|
|
|
// 订单类型改变回调
|
|
|
orderTypeChange(type) {
|
|
@@ -1214,6 +1250,7 @@ export default {
|
|
|
// 货品表格数据删除回调
|
|
|
deleteProduct(index) {
|
|
|
this.productionTableData.splice(index, 1);
|
|
|
+ this.initTableValidate();
|
|
|
},
|
|
|
// 货品表格数据新增回调
|
|
|
addProduct() {
|
|
@@ -1232,6 +1269,72 @@ export default {
|
|
|
colourNumber: "", //色号
|
|
|
remark: "", //备注
|
|
|
});
|
|
|
+ // 添加校验规则
|
|
|
+ this.initTableValidate();
|
|
|
+ },
|
|
|
+ // 自定义校验规则
|
|
|
+ validateTableField(rule, value, callback) {
|
|
|
+ console.log("校验规则", rule, value);
|
|
|
+ let { message, field } = rule;
|
|
|
+ let index = field.split("-")[1],
|
|
|
+ fieldName = field.split("-")[0];
|
|
|
+ console.log(
|
|
|
+ index,
|
|
|
+ fieldName,
|
|
|
+ this.productionTableData[Number(index)][fieldName]
|
|
|
+ );
|
|
|
+ if (!this.productionTableData[Number(index)][fieldName]) {
|
|
|
+ callback(new Error(message));
|
|
|
+ } else {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 初始化校验规则
|
|
|
+ initTableValidate() {
|
|
|
+ let length = this.productionTableData.length;
|
|
|
+ for (let i = 0; i < length; i++) {
|
|
|
+ this.rules["productNo-" + i] = [
|
|
|
+ {
|
|
|
+ // required: true,
|
|
|
+ message: "请选择货品",
|
|
|
+ trigger: "change",
|
|
|
+ validator: this.validateTableField,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ this.rules["productNumber-" + i] = [
|
|
|
+ {
|
|
|
+ // required: true,
|
|
|
+ message: "请输入数量",
|
|
|
+ trigger: "blur",
|
|
|
+ validator: this.validateTableField,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ this.rules["productUnitPrice-" + i] = [
|
|
|
+ {
|
|
|
+ // required: true,
|
|
|
+ message: "请输入单价",
|
|
|
+ trigger: "blur",
|
|
|
+ validator: this.validateTableField,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ this.rules["sliceType-" + i] = [
|
|
|
+ {
|
|
|
+ // required: true,
|
|
|
+ message: "请选择切片类型",
|
|
|
+ trigger: "change",
|
|
|
+ validator: this.validateTableField,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ this.rules["colourNumber-" + i] = [
|
|
|
+ {
|
|
|
+ // required: true,
|
|
|
+ message: "请选择色号",
|
|
|
+ trigger: "change",
|
|
|
+ validator: this.validateTableField,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ console.log(this.rules);
|
|
|
},
|
|
|
// 客户名称改变回调
|
|
|
customChangeHandler(val) {
|
|
@@ -1377,7 +1480,7 @@ export default {
|
|
|
btnType: "myEdit",
|
|
|
btnIcon: "",
|
|
|
btnShowCondition:
|
|
|
- '[{"fieldName":"sale_order.status","mark":"6","refValue":"1"}]',
|
|
|
+ '[{"fieldName":"sale_order.status","mark":"3","refValue":"2"},{"fieldName":"sale_order.status","mark":"3","refValue":"3"},{"fieldName":"sale_order.status","mark":"3","refValue":"4"},{"fieldName":"sale_order.status","mark":"3","refValue":"5"},{"fieldName":"sale_order.status","mark":"3","refValue":"6"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"},{"fieldName":"sale_order.status","mark":"3","refValue":"100"},{"fieldName":"sale_order.status","mark":"3","refValue":"101"}]',
|
|
|
btnHasPermi: "huaxian:xsglddgl:INSERT",
|
|
|
children: [],
|
|
|
},
|
|
@@ -1386,7 +1489,7 @@ export default {
|
|
|
btnType: "OutDetail",
|
|
|
btnIcon: "",
|
|
|
btnShowCondition:
|
|
|
- '[{"fieldName":"sale_order.status","mark":"3","refValue":"1"}]',
|
|
|
+ '[{"fieldName":"sale_order.status","mark":"3","refValue":"1"},{"fieldName":"sale_order.status","mark":"3","refValue":"7"},{"fieldName":"sale_order.status","mark":"3","refValue":"3"}]',
|
|
|
btnHasPermi: "huaxian:xsglddgl:INSERT",
|
|
|
children: [],
|
|
|
},
|
|
@@ -1395,7 +1498,7 @@ export default {
|
|
|
btnType: "printOutBound",
|
|
|
btnIcon: "",
|
|
|
btnShowCondition:
|
|
|
- '[{"fieldName":"sale_order.status","mark":"3","refValue":"1"},{"fieldName":"sale_order.status","mark":"3","refValue":"2"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"}]',
|
|
|
+ '[{"fieldName":"sale_order.status","mark":"3","refValue":"1"},{"fieldName":"sale_order.status","mark":"3","refValue":"2"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"},{"fieldName":"sale_order.status","mark":"3","refValue":"7"},{"fieldName":"sale_order.status","mark":"3","refValue":"3"}]',
|
|
|
btnHasPermi: "huaxian:xsglddgl:INSERT",
|
|
|
children: [],
|
|
|
},
|
|
@@ -1405,7 +1508,7 @@ export default {
|
|
|
btnIcon: "",
|
|
|
// btnShowCondition: "[]",
|
|
|
btnShowCondition:
|
|
|
- '[{"fieldName":"sale_order.status","mark":"3","refValue":"1"},{"fieldName":"sale_order.status","mark":"3","refValue":"2"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"}]',
|
|
|
+ '[{"fieldName":"sale_order.status","mark":"3","refValue":"1"},{"fieldName":"sale_order.status","mark":"3","refValue":"2"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"},{"fieldName":"sale_order.status","mark":"3","refValue":"7"},{"fieldName":"sale_order.status","mark":"3","refValue":"3"}]',
|
|
|
btnHasPermi: "huaxian:xsglddgl:INSERT",
|
|
|
children: [],
|
|
|
},
|
|
@@ -1580,14 +1683,13 @@ export default {
|
|
|
},
|
|
|
// 审计 提交编辑结果按钮回调
|
|
|
async editConfirm() {
|
|
|
+ // let tableValidate = this.validateTableData();
|
|
|
+ // if (!tableValidate.res) {
|
|
|
+ // this.$message.warning(tableValidate.msg);
|
|
|
+ // // return;
|
|
|
+ // }
|
|
|
this.$refs.formDataRef.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
- console.log(valid);
|
|
|
- let tableValidate = this.validateTableData();
|
|
|
- if (!tableValidate.res) {
|
|
|
- this.$message.warning(tableValidate.msg);
|
|
|
- return;
|
|
|
- }
|
|
|
let {
|
|
|
id,
|
|
|
//订单表数据
|
|
@@ -1800,6 +1902,8 @@ export default {
|
|
|
// Object.keys(saleValue).map((k) => {
|
|
|
// saleData.commMap[k] = saleValue[k];
|
|
|
// });
|
|
|
+ } else {
|
|
|
+ this.$message.error("请完善表单数据");
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -1863,6 +1967,7 @@ export default {
|
|
|
this.customChangeHandler(this.formData.saleCustomNo);
|
|
|
}
|
|
|
this.title = "编辑审计单";
|
|
|
+ this.initTableValidate();
|
|
|
this.open = true;
|
|
|
}
|
|
|
} catch (error) {
|
|
@@ -2969,6 +3074,10 @@ export default {
|
|
|
item.colourNumberLabel = this.colourNumberOptions.find(
|
|
|
(k) => k.materielCode == item.colourNumber
|
|
|
)?.materieColorNumber;
|
|
|
+ // item.materieEncoding + item.materieColorNumber
|
|
|
+ let materieEncoding = this.colourNumberOptions.find(
|
|
|
+ (k) => k.materielCode == item.colourNumber
|
|
|
+ )?.materieEncoding;
|
|
|
let productName = productData ? productData.productName : "";
|
|
|
let productType = productData ? productData.productType : "";
|
|
|
printStr += `<tr align="center">
|
|
@@ -2978,7 +3087,7 @@ export default {
|
|
|
<td>${item.productUnitPrice}</td>
|
|
|
<td>${item.productAmounts}</td>
|
|
|
<td>${item.sliceTypeLabel}</td>
|
|
|
- <td>${item.colourNumberLabel}</td>
|
|
|
+ <td>${materieEncoding + item.colourNumberLabel}</td>
|
|
|
<td>${item.remark}</td>
|
|
|
</tr>`;
|
|
|
}
|