|
@@ -212,7 +212,7 @@ export default {
|
|
|
this.judgeSaveCondition(async()=>{
|
|
|
try {
|
|
|
this.loading = true;
|
|
|
- const { code, msg } = await (this.handleIsRevise(this.params.status) ?
|
|
|
+ const { code, msg } = await (this.handleIsRevise() ?
|
|
|
orderApi.revision(this.params)
|
|
|
: orderApi.edit(this.params)
|
|
|
)
|
|
@@ -346,8 +346,9 @@ export default {
|
|
|
|
|
|
// 子表下拉框改变
|
|
|
handleTabSelectChange(type,row){
|
|
|
-
|
|
|
- if(type == 'priceType' && row.material && row.qty && row.qty != ""){
|
|
|
+
|
|
|
+ // && row.qty
|
|
|
+ if(type == 'priceType' && row.material && row.qty != ""){
|
|
|
|
|
|
row['whetherCompleteInquiry'] = false;
|
|
|
|
|
@@ -357,15 +358,36 @@ export default {
|
|
|
},
|
|
|
// 子表inputNumber
|
|
|
handleInputChange(row, type) {
|
|
|
+
|
|
|
+
|
|
|
// 物料数量变化----询价
|
|
|
- if (type == 'qty' && row.material) {
|
|
|
+ if (type == 'qty' && row.material ) {
|
|
|
|
|
|
- row['whetherCompleteInquiry'] = false;
|
|
|
+ if(this.params.status === '2'){
|
|
|
|
|
|
- row.qty && this.handleGetPrice();
|
|
|
+ // 修订
|
|
|
+ this.handleCalculateOrderAmount();
|
|
|
+
|
|
|
+ }else{
|
|
|
+
|
|
|
+ row['whetherCompleteInquiry'] = false;
|
|
|
+
|
|
|
+ row.qty && this.handleGetPrice();
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
+ // // 物料数量变化----询价
|
|
|
+ // if (type == 'qty' && row.material) {
|
|
|
+
|
|
|
+ // row['whetherCompleteInquiry'] = false;
|
|
|
+
|
|
|
+ // // row.qty && this.handleGetPrice();
|
|
|
+ // this.handleGetPrice();
|
|
|
+
|
|
|
+ // }
|
|
|
+
|
|
|
},
|
|
|
// 子表多选框改变
|
|
|
handleTabCheckbox(type,source){
|
|
@@ -382,8 +404,11 @@ export default {
|
|
|
// 询价 getPrice
|
|
|
async handleGetPrice() {
|
|
|
try {
|
|
|
- // let { puOrg, priceType, customer, assignSupplier, material, } = data;
|
|
|
- let { code, data } = await orderApi.getPrice({ ...this.params })
|
|
|
+ // action:insert(新增)、revise(修订)、update(编辑)
|
|
|
+ let { code, data } = await orderApi.getPrice({
|
|
|
+ ...this.params ,
|
|
|
+ action: this.handleIsRevise() ? 'revise':'update',
|
|
|
+ });
|
|
|
if (code == 200) {
|
|
|
this.params = data;
|
|
|
}
|
|
@@ -393,11 +418,38 @@ export default {
|
|
|
|
|
|
}
|
|
|
},
|
|
|
+ // 修订——计算金额
|
|
|
+ async handleCalculateOrderAmount(){
|
|
|
+
|
|
|
+ try {
|
|
|
+ let { code, data } = await orderApi.calculateOrderAmount({
|
|
|
+ ...this.params,
|
|
|
+ action: this.handleIsRevise() ? 'revise':'update',
|
|
|
+ });
|
|
|
+
|
|
|
+ code == 200 && (this.params = data);
|
|
|
+
|
|
|
+ } catch (error) {}
|
|
|
+ finally {}
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
// 判断修订还是编辑
|
|
|
- handleIsRevise(status) {
|
|
|
- return status == '2';
|
|
|
+ handleIsRevise() {
|
|
|
+ return this.params.status == '2';
|
|
|
+ },
|
|
|
+
|
|
|
+ // /handleIsRevise() ? scope.row[cColumn.key] : Infinity
|
|
|
+ getInputNumberMax(key,row){
|
|
|
+
|
|
|
+ if(key === 'qty'){
|
|
|
+
|
|
|
+ return this.handleIsRevise() ? row['originalQty'] : Infinity
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return Infinity;
|
|
|
},
|
|
|
-
|
|
|
},
|
|
|
created() {},
|
|
|
mounted() { },
|
|
@@ -433,7 +485,7 @@ export default {
|
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
|
">
|
|
|
- <h3>{{ handleIsRevise(params.status) ? '修订' : '编辑' }}</h3>
|
|
|
+ <h3>{{ handleIsRevise() ? '修订' : '编辑' }}</h3>
|
|
|
<div style="text-align: right">
|
|
|
<el-button :size="size" @click="handleCancel">取 消</el-button>
|
|
|
<el-button :size="size" type="danger" @click="handleSava">更 新</el-button>
|
|
@@ -479,7 +531,7 @@ export default {
|
|
|
<el-input-number v-if="column.inputType === 'InputNumber'"
|
|
|
v-model="params[column.key]"
|
|
|
:precision="column.precision"
|
|
|
- :max="handleIsRevise(params.status) ? params[column.key] : Infinity"
|
|
|
+ :max="handleIsRevise() ? params[column.key] : Infinity"
|
|
|
:controls-position="column.controlsPosition"
|
|
|
:placeholder="column.placeholder"
|
|
|
:clearable="column.clearable"
|
|
@@ -539,7 +591,7 @@ export default {
|
|
|
<file-upload-center v-if="column.inputType === 'Upload'"
|
|
|
v-model="params[column.key]"
|
|
|
:file-type="column.fileType"
|
|
|
- :disabled="handleIsRevise(params.status)"
|
|
|
+ :disabled="handleIsRevise()"
|
|
|
></file-upload-center>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -638,7 +690,7 @@ export default {
|
|
|
v-model="scope.row[cColumn.key]"
|
|
|
:precision="cColumn.precision"
|
|
|
:controls-position="cColumn.controlsPosition"
|
|
|
- :max="handleIsRevise(params.status) ? scope.row[cColumn.key] : Infinity"
|
|
|
+ :max="getInputNumberMax(cColumn.key, scope.row)"
|
|
|
@change="handleInputChange(scope.row, cColumn.key)"
|
|
|
:placeholder="cColumn.placeholder"
|
|
|
:clearable="cColumn.clearable"
|
|
@@ -657,7 +709,7 @@ export default {
|
|
|
<el-table-column fixed="right" label="操作" width="120">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
- v-if="params.source == '3' && !handleIsRevise(params.status)"
|
|
|
+ v-if="params.source == '3' && !handleIsRevise()"
|
|
|
@click.native.prevent="delTableRow(params[tabName], scope.$index)"
|
|
|
type="text"
|
|
|
size="small"
|
|
@@ -669,7 +721,7 @@ export default {
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
<el-row style="position: absolute; top: 20px; right: 20px">
|
|
|
- <el-button v-if="params.source == '3' && !handleIsRevise(params.status)" :size="size"
|
|
|
+ <el-button v-if="params.source == '3' && !handleIsRevise()" :size="size"
|
|
|
@click="addTableRow(params[tabName])">增行</el-button>
|
|
|
</el-row>
|
|
|
</el-card>
|