|
@@ -9,7 +9,6 @@
|
|
|
style="width: 100%"
|
|
|
class="demo-ruleForm"
|
|
|
>
|
|
|
- <p>sitem:{{ status }}</p>
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="退货总数量" prop="return_num">
|
|
@@ -19,12 +18,13 @@
|
|
|
placeholder="退货总数量"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="可销售数量" prop="normal">
|
|
|
<el-input
|
|
|
- :disabled="status != '1' && status != '0'"
|
|
|
+ :disabled="
|
|
|
+ !(status === '0' && powers.some((item) => item == '047'))
|
|
|
+ "
|
|
|
v-model="ruleForm.normal"
|
|
|
placeholder="可销售数量"
|
|
|
></el-input>
|
|
@@ -33,7 +33,9 @@
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="其他备注" prop="remark">
|
|
|
<el-input
|
|
|
- :disabled="status != '1' && status != '0'"
|
|
|
+ :disabled="
|
|
|
+ !(status === '0' && powers.some((item) => item == '047'))
|
|
|
+ "
|
|
|
type="textarea"
|
|
|
maxlength="250"
|
|
|
show-word-limit
|
|
@@ -44,200 +46,90 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
|
- <el-form-item label="异常情况记录">
|
|
|
- <!-- <span>异常情况记录</span> -->
|
|
|
- <!-- <AnomalousRecord :sitem="sitem"></AnomalousRecord> -->
|
|
|
- <el-row>
|
|
|
- <el-col :span="24">
|
|
|
- <el-form
|
|
|
- :model="ruleForm"
|
|
|
- :rules="tableFormThis"
|
|
|
- ref="ruleForm"
|
|
|
- :size="'mini'"
|
|
|
- class="demo-tableForm product_go"
|
|
|
+ <el-form-item label="异常情况记录" :size="'mini'">
|
|
|
+ <el-form
|
|
|
+ :model="ruleForm"
|
|
|
+ :rules="tableFormThis"
|
|
|
+ ref="ruleForm"
|
|
|
+ :size="'mini'"
|
|
|
+ class="demo-tableForm product_go"
|
|
|
+ >
|
|
|
+ <el-table
|
|
|
+ :data="ruleForm.product_go"
|
|
|
+ border
|
|
|
+ :size="'mini'"
|
|
|
+ row-key="key"
|
|
|
+ >
|
|
|
+ <el-table-column label="异常数量" prop="error_num" />
|
|
|
+ <el-table-column label="异常原因" prop="error_code_name" />
|
|
|
+ <el-table-column label="异常备注" prop="error_remark" />
|
|
|
+ <el-table-column
|
|
|
+ fixed="right"
|
|
|
+ label="操作"
|
|
|
+ width="80"
|
|
|
+ v-if="status === '0' && powers.some((item) => item == '047')"
|
|
|
>
|
|
|
- <!-- {{ tableForm.product_go }} -->
|
|
|
-
|
|
|
- <!-- {{ options }} -->
|
|
|
- <el-table
|
|
|
- :data="ruleForm.product_go"
|
|
|
- border
|
|
|
- :size="'mini'"
|
|
|
- row-key="key"
|
|
|
- >
|
|
|
- <el-table-column label="异常数量">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-form-item
|
|
|
- :style="!scope.row.edit ? 'margin:0' : ''"
|
|
|
- :prop="
|
|
|
- 'product_go.' + scope.$index + '.anomalous_numbers'
|
|
|
- "
|
|
|
- :rules="{
|
|
|
- required: true,
|
|
|
- message: '异常数量不能为空',
|
|
|
- trigger: 'blur',
|
|
|
- }"
|
|
|
- >
|
|
|
- <el-input
|
|
|
- :disabled="!scope.row.edit"
|
|
|
- v-model="scope.row.anomalous_numbers"
|
|
|
- placeholder="请输入异常数量"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="异常原因">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-form-item
|
|
|
- :style="!scope.row.edit ? 'margin:0' : ''"
|
|
|
- :prop="
|
|
|
- 'product_go.' + scope.$index + '.anomalous_reason'
|
|
|
- "
|
|
|
- >
|
|
|
- <el-select
|
|
|
- style="width: 100%"
|
|
|
- :disabled="!scope.row.edit"
|
|
|
- v-model="scope.row.anomalous_reason_code"
|
|
|
- placeholder="异常原因"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- :disabled="item.status == 0"
|
|
|
- v-for="item in options"
|
|
|
- :key="item.id"
|
|
|
- :label="item.result"
|
|
|
- :value="item.result_code"
|
|
|
- >
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="异常备注">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-form-item
|
|
|
- :style="!scope.row.edit ? 'margin:0' : ''"
|
|
|
- :prop="
|
|
|
- 'product_go.' + scope.$index + '.anomalous_remark'
|
|
|
- "
|
|
|
- :rules="{
|
|
|
- required: true,
|
|
|
- message: '异常备注不能为空',
|
|
|
- trigger: 'blur',
|
|
|
- }"
|
|
|
- >
|
|
|
- <el-input
|
|
|
- placeholder="异常备注"
|
|
|
- :disabled="!scope.row.edit"
|
|
|
- v-model="scope.row.anomalous_remark"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column fixed="right" label="操作" width="80">
|
|
|
- <template slot="header" slot-scope="scope">
|
|
|
- <span>操作</span>
|
|
|
- <el-tooltip
|
|
|
- class="fr"
|
|
|
- style="margin: 3px 0 0 0"
|
|
|
- effect="dark"
|
|
|
- content="添加"
|
|
|
- placement="top"
|
|
|
- >
|
|
|
- <i
|
|
|
- v-if="status == '1' || status == '0'"
|
|
|
- class="el-icon-circle-plus-outline tb-icon"
|
|
|
- style="color: #63cbe7"
|
|
|
- @click="openModal('add', '028')"
|
|
|
- ></i>
|
|
|
- </el-tooltip>
|
|
|
- </template>
|
|
|
- <template
|
|
|
- slot-scope="scope"
|
|
|
- v-if="status == '1' || status == '0'"
|
|
|
- >
|
|
|
- <el-tooltip
|
|
|
- effect="dark"
|
|
|
- content="编辑"
|
|
|
- v-if="!scope.row.edit"
|
|
|
- placement="top"
|
|
|
- >
|
|
|
- <i
|
|
|
- class="el-icon-edit tb-icon"
|
|
|
- @click="editRow(scope.$index)"
|
|
|
- ></i>
|
|
|
- </el-tooltip>
|
|
|
- <el-tooltip
|
|
|
- effect="dark"
|
|
|
- content="保存"
|
|
|
- v-if="scope.row.edit"
|
|
|
- placement="top"
|
|
|
- >
|
|
|
- <i
|
|
|
- class="el-icon-circle-check tb-icon"
|
|
|
- @click="checkRow(scope.$index)"
|
|
|
- ></i>
|
|
|
- </el-tooltip>
|
|
|
+ <template slot="header" slot-scope="scope">
|
|
|
+ <!-- v-if="status == '1' || status == '0'" -->
|
|
|
+ <span>操作</span>
|
|
|
+ <el-tooltip
|
|
|
+ class="fr"
|
|
|
+ style="margin: 3px 0 0 0"
|
|
|
+ effect="dark"
|
|
|
+ content="添加"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
+ <i
|
|
|
+ class="el-icon-circle-plus-outline tb-icon"
|
|
|
+ style="color: #63cbe7"
|
|
|
+ @click="openModal(-1)"
|
|
|
+ ></i>
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
+ <!-- v-if="status == '1' || status == '0'" -->
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tooltip
|
|
|
+ effect="dark"
|
|
|
+ content="编辑"
|
|
|
+ v-if="!scope.row.edit"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
+ <i
|
|
|
+ class="el-icon-edit tb-icon"
|
|
|
+ @click="openModal(scope.$index)"
|
|
|
+ ></i>
|
|
|
+ </el-tooltip>
|
|
|
|
|
|
- <el-tooltip effect="dark" content="删除" placement="top">
|
|
|
- <i
|
|
|
- class="el-icon-delete-solid tb-icon"
|
|
|
- @click="deleteRow(scope.$index)"
|
|
|
- ></i>
|
|
|
- </el-tooltip>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </el-form>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
+ <el-tooltip
|
|
|
+ v-if="scope.row.edit"
|
|
|
+ effect="dark"
|
|
|
+ content="重置"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
+ <i
|
|
|
+ class="el-icon-delete tb-icon"
|
|
|
+ @click="deleteRow(scope.$index, ruleForm.product_go)"
|
|
|
+ ></i>
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-form>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- </el-row>
|
|
|
-
|
|
|
- <el-row>
|
|
|
- <el-col :span="24" style="text-align: right; margin: 10px 0 20px 0">
|
|
|
- <el-button
|
|
|
- v-if="status == '0' || status == '1'"
|
|
|
- type="primary"
|
|
|
- class="fr"
|
|
|
- :size="'mini'"
|
|
|
- @click="submitForm"
|
|
|
+ <el-col
|
|
|
+ :span="24"
|
|
|
+ style="text-align: right; margin: -5px 0 20px 0"
|
|
|
+ v-if="status === '0' && powers.some((item) => item == '047')"
|
|
|
+ >
|
|
|
+ <el-button type="primary" class="fr" :size="'mini'" @click="submitForm"
|
|
|
>保 存
|
|
|
</el-button>
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- @click="statusConfirm('1', '发起审核流程')"
|
|
|
- v-if="status === '0' && powers.some((item) => item == '012')"
|
|
|
- >发起审核流程
|
|
|
- </el-button>
|
|
|
- <el-button
|
|
|
- @click="statusConfirm('0', '取消审核流程')"
|
|
|
- plain
|
|
|
- v-if="status === '1' && powers.some((item) => item == '014')"
|
|
|
- >取消审核流程</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- @click="statusConfirm('-1', '作废该条信息')"
|
|
|
- type="danger"
|
|
|
- plain
|
|
|
- v-if="
|
|
|
- (status === '0' || status === '1') &&
|
|
|
- powers.some((item) => item == '015')
|
|
|
- "
|
|
|
- >作废该条信息</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- @click="statusConfirm('2', '通过审核')"
|
|
|
- type="primary"
|
|
|
- v-if="status === '1' && powers.some((item) => item == '016')"
|
|
|
- >通过审核</el-button
|
|
|
- >
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <add-edit
|
|
|
- :id="modelId"
|
|
|
- :sitem="sitem"
|
|
|
+ <abnormal-condition-modal
|
|
|
+ :index="index"
|
|
|
+ :sitem="s_item"
|
|
|
:show-model="showModel"
|
|
|
@refresh="handleValue"
|
|
|
@cancel="showModel = false"
|
|
@@ -247,14 +139,13 @@
|
|
|
<script>
|
|
|
import asyncRequest from "@/apis/service/sellOut/returnOrder";
|
|
|
import resToken from "@/mixins/resToken";
|
|
|
-import { isnumber } from "@/utils/validate.js";
|
|
|
-import addEdit from "./addEdit.vue";
|
|
|
+import { isnumber } from "@/utils/validate";
|
|
|
+import abnormalConditionModal from "@/components/abnormal-condition-modal";
|
|
|
export default {
|
|
|
- name: "returnRecord",
|
|
|
+ name: "zxAfterSaleOrderDetail",
|
|
|
props: ["id", "showModelThis", "newTime", "sitem"],
|
|
|
mixins: [resToken],
|
|
|
- components: { addEdit },
|
|
|
- // props: ["sitem"],
|
|
|
+ components: { abnormalConditionModal },
|
|
|
data() {
|
|
|
const validatenumbers = (rule, value, callback) => {
|
|
|
if (value === "") {
|
|
@@ -268,21 +159,21 @@ export default {
|
|
|
}
|
|
|
};
|
|
|
return {
|
|
|
- newArr: [], //存储异常记录列表项
|
|
|
arr: [],
|
|
|
+ s_item: null,
|
|
|
sitemGetNumber: "", //详情总收货量
|
|
|
isShow: false, //用于情况1
|
|
|
returnNO: "", //退货编号
|
|
|
ruleForm: {
|
|
|
- return_num: "", //
|
|
|
+ return_num: "", //收货总数量
|
|
|
normal: "", //可销售数量
|
|
|
remark: "", //其他备注
|
|
|
product_go: [], //表格参数
|
|
|
},
|
|
|
+
|
|
|
btn_code: "",
|
|
|
- modelId: "",
|
|
|
+ index: "",
|
|
|
options: [],
|
|
|
- voList: [],
|
|
|
edit: false, //默认不能提交
|
|
|
totalNumber: 0, //全局保存数量
|
|
|
loading: false,
|
|
@@ -298,7 +189,7 @@ export default {
|
|
|
trigger: "blur",
|
|
|
validator: validatenumbers,
|
|
|
},
|
|
|
- ],
|
|
|
+ ],
|
|
|
normal: [
|
|
|
{
|
|
|
required: true,
|
|
@@ -320,7 +211,7 @@ export default {
|
|
|
powers() {
|
|
|
let tran =
|
|
|
this.$store.getters.btnList.find(
|
|
|
- (item) => item.menu_route == "returnRecord"
|
|
|
+ (item) => item.menu_route == "zxAfterSaleOrderDetail"
|
|
|
) || {};
|
|
|
if (tran && tran.action && tran.action.length > 0) {
|
|
|
return tran.action;
|
|
@@ -330,15 +221,10 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
|
|
|
- mounted() {
|
|
|
- this.initForm();
|
|
|
- },
|
|
|
+ // mounted() {
|
|
|
+ // this.initForm();
|
|
|
+ // },
|
|
|
watch: {
|
|
|
- id: function (val) {
|
|
|
- if (val) {
|
|
|
- this.initForm();
|
|
|
- }
|
|
|
- },
|
|
|
newTime: function (val) {
|
|
|
if (val) {
|
|
|
this.initForm();
|
|
@@ -346,11 +232,6 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
- // 关闭弹窗,直接隐藏表单
|
|
|
- // async closeAddEdit() {
|
|
|
- // this.$emit("closeModel", false); //抛出一个事件,关闭弹窗
|
|
|
- //
|
|
|
- // },
|
|
|
async initForm() {
|
|
|
this.loading = true;
|
|
|
this.rulesThis = this.rules;
|
|
@@ -367,25 +248,21 @@ export default {
|
|
|
this.$refs.ruleForm.clearValidate();
|
|
|
this.status = "";
|
|
|
this.arr = [];
|
|
|
- this.newArr = [];
|
|
|
- let { child, status, received_num, normal_num, remark, return_num } =
|
|
|
- this.sitem;
|
|
|
+ let { child, status, normal_num, remark, return_num } = this.sitem;
|
|
|
this.status = status;
|
|
|
- this.newArr = child;
|
|
|
- child.forEach((ele) => {
|
|
|
- let obj = {
|
|
|
- is_del: "0",
|
|
|
- anomalous_numbers: ele.error_num,
|
|
|
- anomalous_reason_code: ele.error_code,
|
|
|
- anomalous_remark: ele.error_remark,
|
|
|
- id: ele.id,
|
|
|
- edit: false,
|
|
|
- };
|
|
|
- this.arr.push(obj);
|
|
|
- });
|
|
|
+ if (child) {
|
|
|
+ this.arr =
|
|
|
+ child && child.length > 0
|
|
|
+ ? JSON.parse(JSON.stringify(child))
|
|
|
+ : [];
|
|
|
+ this.arr.forEach((v) => {
|
|
|
+ v.is_del = "0";
|
|
|
+ v.error_code_name = v.error_msg;
|
|
|
+ });
|
|
|
+ }
|
|
|
this.ruleForm = {
|
|
|
- return_num: return_num,
|
|
|
- normal: normal_num, //可销售数量
|
|
|
+ return_num: return_num || "",
|
|
|
+ normal: normal_num || "", //可销售数量
|
|
|
remark: remark, //其他备注
|
|
|
product_go: this.arr, //表格参数this.arr
|
|
|
};
|
|
@@ -397,39 +274,24 @@ export default {
|
|
|
await this.$refs.ruleForm.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
this.loading = true;
|
|
|
- const { product_go } = this.ruleForm;
|
|
|
- let isok = true;
|
|
|
- product_go.forEach((v) => {
|
|
|
- if (v.edit) {
|
|
|
- isok = false;
|
|
|
- }
|
|
|
- });
|
|
|
- if (!isok) {
|
|
|
- this.$message.warning("请保存异常情况记录表格!");
|
|
|
- this.loading = false;
|
|
|
- return;
|
|
|
+
|
|
|
+ let model = JSON.parse(JSON.stringify(this.ruleForm));
|
|
|
+ let list = JSON.parse(JSON.stringify(this.arr));
|
|
|
+ let { return_num, normal, product_go, remark } = model;
|
|
|
+ let errorT = 0;
|
|
|
+ if (product_go && product_go.length > 0) {
|
|
|
+ product_go.forEach((v) => {
|
|
|
+ errorT += parseInt(v.error_num);
|
|
|
+ });
|
|
|
}
|
|
|
- const { normal } = this.ruleForm;
|
|
|
- const { return_num } = this.sitem;
|
|
|
- let a = 0;
|
|
|
- product_go.forEach((x) => {
|
|
|
- a += Number(x.anomalous_numbers);
|
|
|
- });
|
|
|
|
|
|
- if (Number(return_num) !== Number(normal) + a) {
|
|
|
- this.$message.warning("可销售数量+异常总数量不等于总退回数量!");
|
|
|
+ if (parseInt(normal) + errorT !== parseInt(return_num)) {
|
|
|
+ this.$message.warning("可销售数量+异常总数量不等于退货总数量!");
|
|
|
this.loading = false;
|
|
|
return;
|
|
|
}
|
|
|
- let allList = [];
|
|
|
- let model = JSON.parse(JSON.stringify(this.ruleForm));
|
|
|
- delete model["product_go"];
|
|
|
- model.errorlist = [];
|
|
|
- model.thNo = this.sitem.thNo;
|
|
|
-
|
|
|
- let list = JSON.parse(JSON.stringify(this.newArr));
|
|
|
product_go.forEach((x) => {
|
|
|
- let index = this.newArr.findIndex((y) => y.id === x.id);
|
|
|
+ let index = list.findIndex((y) => x.id === y.id);
|
|
|
if (index !== -1) {
|
|
|
list.splice(index, 1);
|
|
|
}
|
|
@@ -437,20 +299,14 @@ export default {
|
|
|
list.forEach((v) => {
|
|
|
v.is_del = "1";
|
|
|
});
|
|
|
- allList.push(...product_go);
|
|
|
- allList.push(...list);
|
|
|
+ let item = {
|
|
|
+ thNo: this.sitem.thNo,
|
|
|
+ normal,
|
|
|
+ remark,
|
|
|
+ errorlist: [].concat(product_go).concat(list),
|
|
|
+ };
|
|
|
|
|
|
- allList.map((ele) => {
|
|
|
- let obj = {
|
|
|
- id: ele.id,
|
|
|
- is_del: ele.is_del,
|
|
|
- error_num: ele.anomalous_numbers || "",
|
|
|
- error_code: ele.anomalous_reason_code || "",
|
|
|
- error_remark: ele.anomalous_remark || "",
|
|
|
- };
|
|
|
- model.errorlist.push(obj);
|
|
|
- });
|
|
|
- const res = await asyncRequest.returnCheck(model); //退货验货接口
|
|
|
+ const res = await asyncRequest.returnCheck(item);
|
|
|
this.loading = false;
|
|
|
if (res && res.code === 0) {
|
|
|
this.$notify.success({
|
|
@@ -472,7 +328,7 @@ export default {
|
|
|
page: 1,
|
|
|
size: 100,
|
|
|
type: "1",
|
|
|
- status: "3",
|
|
|
+ // status: "3",
|
|
|
});
|
|
|
if (res && res.code === 0 && res.data) {
|
|
|
const { list } = res.data;
|
|
@@ -483,87 +339,38 @@ export default {
|
|
|
this.$message.warning(res.message);
|
|
|
}
|
|
|
},
|
|
|
- //保存某一行
|
|
|
- checkRow(rowIndex) {
|
|
|
- const { anomalous_numbers, anomalous_reason_code, anomalous_remark } =
|
|
|
- this.ruleForm.product_go[rowIndex];
|
|
|
- if (anomalous_numbers == "" && anomalous_remark == "") {
|
|
|
- this.$message.warning("异常数量和异常备注不能为空!");
|
|
|
- return;
|
|
|
- }
|
|
|
- if (!isnumber(anomalous_numbers)) {
|
|
|
- this.$message.warning("异常数量必须为整数!");
|
|
|
- return;
|
|
|
- }
|
|
|
- if (
|
|
|
- +anomalous_numbers + +this.ruleForm.normal !==
|
|
|
- +this.ruleForm.return_num
|
|
|
- ) {
|
|
|
- this.$message.warning("当前可销售数量+异常数量不等于总退货数量!");
|
|
|
- return;
|
|
|
- }
|
|
|
|
|
|
- if (anomalous_numbers == 0) {
|
|
|
- this.$message.info("异常数量为零,不用选择异常原因!");
|
|
|
- this.ruleForm.product_go[rowIndex].edit = false;
|
|
|
- return;
|
|
|
- }
|
|
|
- if (anomalous_reason_code == "") {
|
|
|
- this.$message.warning("请选择异常原因!");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- this.ruleForm.product_go[rowIndex].edit = false;
|
|
|
- },
|
|
|
- //编辑某一行
|
|
|
- editRow(rowIndex) {
|
|
|
- let index = this.ruleForm.product_go.findIndex((v) => v.edit);
|
|
|
- if (index !== -1) {
|
|
|
- this.$message.warning("请完成其他行的编辑!");
|
|
|
- return;
|
|
|
- } else {
|
|
|
- this.ruleForm.product_go[rowIndex].edit = true;
|
|
|
+ // 删除行操作
|
|
|
+ deleteRow(index, rows) {
|
|
|
+ if (this.id !== "add" && rows[index].id) {
|
|
|
+ this.delList.push(rows[index]);
|
|
|
}
|
|
|
+ rows.splice(index, 1);
|
|
|
+ this.$refs.ruleForm.validateField("product_go");
|
|
|
},
|
|
|
- deleteRow(rowIndex) {
|
|
|
- this.ruleForm.product_go.shift(rowIndex);
|
|
|
- },
|
|
|
- //重置行内参数
|
|
|
- resetRow(rowIndex) {
|
|
|
- this.ruleForm.product_go[rowIndex].anomalous_numbers = "";
|
|
|
- this.ruleForm.product_go[rowIndex].anomalous_reason_code = "";
|
|
|
- this.ruleForm.product_go[rowIndex].anomalous_remark = "";
|
|
|
- },
|
|
|
- //
|
|
|
- openModal(code, btn_code) {
|
|
|
- this.btn_code = btn_code;
|
|
|
- this.modelId = code;
|
|
|
+ openModal(index) {
|
|
|
+ this.s_item =
|
|
|
+ index === -1
|
|
|
+ ? {}
|
|
|
+ : JSON.parse(JSON.stringify(this.ruleForm.product_go[index]));
|
|
|
+ this.index = index;
|
|
|
this.showModel = true;
|
|
|
},
|
|
|
// 获取弹窗的值
|
|
|
handleValue(e) {
|
|
|
- if (e) {
|
|
|
- const { numbers, reason, remark, name } = e;
|
|
|
- let v = {
|
|
|
- anomalous_numbers: numbers || "",
|
|
|
- anomalous_reason: name || "",
|
|
|
- anomalous_reason_code: reason || "", //异常原因code
|
|
|
- anomalous_remark: remark || "",
|
|
|
- };
|
|
|
- let list = JSON.parse(JSON.stringify(this.voList));
|
|
|
- list.forEach((v) => {
|
|
|
- v.edit = false;
|
|
|
- this.ruleForm.product_go.push(v);
|
|
|
- });
|
|
|
- this.voList = [];
|
|
|
- this.voList.push(v);
|
|
|
+ const { index, item } = e;
|
|
|
+ if (index === -1) {
|
|
|
+ this.ruleForm.product_go.push(JSON.parse(JSON.stringify(item)));
|
|
|
+ } else {
|
|
|
+ const { error_num, error_code, error_remark, error_code_name, id } =
|
|
|
+ JSON.parse(JSON.stringify(item));
|
|
|
+ this.ruleForm.product_go[index].id = id;
|
|
|
+ this.ruleForm.product_go[index].error_num = error_num;
|
|
|
+ this.ruleForm.product_go[index].error_code = error_code;
|
|
|
+ this.ruleForm.product_go[index].error_remark = error_remark;
|
|
|
+ this.ruleForm.product_go[index].error_code_name = error_code_name;
|
|
|
}
|
|
|
- let list = JSON.parse(JSON.stringify(this.voList));
|
|
|
- list.forEach((v) => {
|
|
|
- v.edit = false;
|
|
|
- this.ruleForm.product_go.push(v);
|
|
|
- });
|
|
|
- this.voList = [];
|
|
|
+ this.$refs.ruleForm.validateField("product_go");
|
|
|
},
|
|
|
},
|
|
|
};
|