戴艳蓉 3 роки тому
батько
коміт
2764dd3dad

+ 4 - 0
src/apis/service/purchaseIn/purchaseOrder/detail.js

@@ -14,4 +14,8 @@ export default {
   status: (data, params) => http(api + "cgdstatus", data, "post", params),
   // 新建入库单
   orderinadd: (data, params) => http(api + "orderinadd", data, "post", params),
+  // 新建入库单详情
+  orderininfo: (data, params) => http(api + "orderininfo", data, "post", params),
+  // 异常原因列表
+  resultlist: (data, params) => http(api + "resultlist", data, "post", params),
 };

+ 6 - 0
src/assets/js/btnList.js

@@ -26,5 +26,11 @@ const btnList = [
   { code: "025", name: "反馈认同" },
   { code: "026", name: "同意发货" },
   { code: "027", name: "取消发货" },
+  { code: "028", name: "新建备货入库单" },
+  { code: "029", name: "备货入库验收" },
+  { code: "030", name: "备货入库验收审核" },
+  { code: "031", name: "入库审核" },
+  { code: "032", name: "退货物流" },
+  
 ];
 export default btnList;

+ 0 - 362
src/views/purchaseIn/purchaseOrder/addEdit.vue

@@ -1,362 +0,0 @@
-<template>
-  <el-dialog
-    :title="title"
-    :center="true"
-    align="left"
-    top="5vh"
-    width="1040px"
-    @close="closeModel"
-    :close-on-click-modal="false"
-    :visible.sync="showModelThis"
-    v-loading="loading"
-    element-loading-text="拼命加载中"
-    element-loading-spinner="el-icon-loading"
-    element-loading-background="rgba(0, 0, 0, 0.8)"
-  >
-    <el-card>
-      <el-row :gutter="10">
-        <el-col :span="24">
-          <el-form
-            :model="ruleForm"
-            status-icon
-            :rules="rulesThis"
-            ref="ruleForm"
-            label-width="110px"
-            class="demo-ruleForm"
-          >
-            <el-form-item
-              label="登录名"
-              prop="loginName"
-              v-if="id === 'add' || isDetail"
-            >
-              <el-input
-                v-model="ruleForm.loginName"
-                :disabled="isDetail"
-              ></el-input>
-            </el-form-item>
-            <el-form-item label="姓名" prop="fullName">
-              <el-input
-                v-model="ruleForm.fullName"
-                :disabled="isDetail"
-              ></el-input>
-            </el-form-item>
-            <el-form-item label="手机号" prop="tel">
-              <el-input v-model="ruleForm.tel" :disabled="isDetail"></el-input>
-            </el-form-item>
-            <el-form-item label="密码" prop="password" v-if="id === 'add'">
-              <el-input
-                type="password"
-                placeholder="密码"
-                :maxlength="20"
-                v-model="ruleForm.password"
-              ></el-input>
-            </el-form-item>
-            <el-form-item label="确认密码" prop="password2" v-if="id === 'add'">
-              <el-input
-                type="password"
-                placeholder="再次输入密码"
-                :maxlength="20"
-                v-model="ruleForm.password2"
-              ></el-input>
-            </el-form-item>
-          </el-form>
-        </el-col>
-        <el-col :span="24" style="text-align: right">
-          <el-button type="primary" @click="submitForm" v-if="!isDetail"
-            >保 存
-          </el-button>
-          <el-button @click="showModelThis = false">{{
-            isDetail ? "关 闭" : "取 消"
-          }}</el-button>
-        </el-col>
-      </el-row>
-    </el-card>
-  </el-dialog>
-</template>
-   <script>
-import asyncRequest from "@/apis/service/purchaseIn/purchaseOrder";
-import resToken from "@/mixins/resToken";
-import {
-  isnumber,
-  isMobile,
-  validEmail,
-  isAlphanumeric,
-  isChinese,
-  isEmoticon,
-  validAlphabets,
-} from "@/utils/validate";
-export default {
-  name: "purchaseOrder",
-  props: ["showModel", "id", "isDetail", "sitem"],
-  mixins: [resToken],
-  data() {
-    const validateusername = (rule, value, callback) => {
-      if (value === "") {
-        callback(new Error("账号不能为空!"));
-      } else {
-        if (value.length < 6 || value.length > 18) {
-          callback(new Error("账号规则为6~18位数字与字母组合!"));
-        } else {
-          if (isnumber(value)) {
-            callback(new Error("账号规则为6~18位数字与字母组合!"));
-          } else if (validAlphabets(value)) {
-            callback(new Error("账号规则为6~18位数字与字母组合!"));
-          } else if (!isAlphanumeric(value)) {
-            callback(new Error("账号规则为6~18位数字与字母组合!"));
-          } else {
-            callback();
-          }
-        }
-      }
-    };
-    const validatename = (rule, value, callback) => {
-      if (value === "") {
-        callback(new Error("真实姓名不能为空!"));
-      } else {
-        if (value.length < 2 || value.length > 12) {
-          callback(new Error("真实姓名规则为2~12位汉字!"));
-        } else {
-          if (!isChinese(value)) {
-            console.log(9999);
-            callback(new Error("真实姓名规则为2~12位汉字!"));
-          } else if (isEmoticon(value)) {
-            console.log(2345);
-            callback(new Error("真实姓名规则为2~12位汉字!"));
-          } else {
-            callback();
-          }
-        }
-      }
-    };
-    const validatemobile = (rule, value, callback) => {
-      if (value === "") {
-        callback(new Error("手机号不能为空!"));
-      } else {
-        if (!isMobile(value)) {
-          callback(new Error("手机号格式不正确!"));
-        } else {
-          callback();
-        }
-      }
-    };
-
-    const validateEmail = (rule, value, callback) => {
-      if (value === "") {
-        callback();
-      } else {
-        if (!validEmail(value)) {
-          callback(new Error("邮箱格式不正确!"));
-        } else {
-          callback();
-        }
-      }
-    };
-    return {
-      loading: false,
-      title: "添加账号",
-      showModelThis: this.showModel,
-      ruleForm: {
-        username: "", // 账号
-        name: "", // 真实姓名
-        mobile: "",
-        email: "",
-        role_id: "",
-        status: "1",
-        item: [],
-      },
-      rulesThis: this.rules,
-      rules: {
-        name: [
-          {
-            required: true,
-            validator: validatename,
-            trigger: "blur",
-          },
-        ],
-        username: [
-          {
-            required: true,
-            validator: validateusername,
-            trigger: "blur",
-          },
-        ],
-        mobile: [
-          {
-            required: true,
-            validator: validatemobile,
-            trigger: "blur",
-          },
-        ],
-        email: [
-          {
-            required: false,
-            validator: validateEmail,
-            trigger: "blur",
-          },
-        ],
-        role_id: [
-          {
-            required: true,
-            message: "请选择角色",
-            trigger: "change",
-          },
-        ],
-        item: [
-          {
-            type: "array",
-            required: true,
-            message: "请选择所在部门",
-            trigger: "change",
-          },
-        ],
-        status: [
-          {
-            required: true,
-            message: "请选择状态",
-            trigger: "change",
-          },
-        ],
-      },
-    };
-  },
-  watch: {
-    showModel: function (val) {
-      this.showModelThis = val;
-      if (val) {
-        this.initForm();
-      }
-    },
-    showModelThis(val) {
-      if (!val) {
-        this.$emit("cancel");
-      }
-    },
-  },
-  methods: {
-    closeModel() {
-      console.log("closeModel!!");
-    },
-    async initForm() {
-      this.loading = true;
-      // await this.getRole();
-      if (this.id === "add") {
-        this.title = "添加账号";
-        this.rulesThis = this.rules;
-        await this.resetForm();
-      } else {
-        if (this.isDetail) {
-          this.title = "账号详情";
-          this.rulesThis = {};
-        } else {
-          this.title = "修改账号";
-          this.rulesThis = this.rules;
-        }
-        await this.resetForm(this.sitem);
-        // await this.initData()
-      }
-      this.loading = false;
-    },
-    // async getRole() {
-    //   const model = {
-    //     status: "", // 状态
-    //     level: "", // 姓名
-    //     role_name: "",
-    //   };
-    //   const res = await asyncRequest.getRole(model);
-    //   if (res && res.code === 0 && res.data) {
-    //     this.roleList = res.data;
-    //     this.roleList.map((v1) => {
-    //       v1.id += "";
-    //       v1.status += "";
-    //       return v1;
-    //     });
-    //   }
-    // },
-    async initData() {
-      const res = await asyncRequest.detail({ id: this.id });
-      if (res && res.code === 0 && res.data) {
-        this.ruleForm = res.data;
-        this.ruleForm.role_id = this.ruleForm.role;
-      } else if (res && res.code >= 100 && res.code <= 104) {
-        await this.logout();
-      } else {
-        this.$message.warning(res.message);
-      }
-    },
-    async resetForm(sitem) {
-      // 重置
-      await this.$nextTick(() => {
-        if (this.$refs.ruleForm) {
-          this.$refs.ruleForm.resetFields();
-          this.$refs.ruleForm.clearValidate();
-          const { username, nickname, mobile, email, roleid, status, item } =
-            sitem;
-          this.ruleForm = {
-            username: username || "", // 账号
-            name: nickname || "", // 真实姓名
-            mobile: mobile || "",
-            email: email || "",
-            role_id: roleid || "",
-            status: status || "",
-            item: item || [],
-          };
-          if (this.id === "add" || this.isDetail) {
-            this.rules.username[0].required = false;
-          }
-        }
-      });
-    },
-
-    async submitForm() {
-      await this.$refs.ruleForm.validate(async (valid) => {
-        if (valid) {
-          this.loading = true;
-          const { username, name, mobile, email, role_id, status } = JSON.parse(
-            JSON.stringify(this.ruleForm)
-          );
-          const model = {
-            id: this.id,
-            username: username || "", // 账号
-            nickname: name || "", // 真实姓名
-            mobile: mobile || "",
-            email: email || "",
-            role: role_id || "",
-            status: status || "",
-          };
-          let res = {};
-          if (this.id === "add") {
-            delete model["id"];
-            res = await asyncRequest.add(model);
-          } else {
-            res = await asyncRequest.update(model);
-          }
-          this.loading = false;
-          if (res && res.code === 0) {
-            const title = this.id === "add" ? "添加成功" : "修改成功";
-            this.$notify.success({
-              title,
-              message: "",
-            });
-            this.showModelThis = false;
-            // 刷新
-            this.$emit("refresh");
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
-          } else {
-            this.$message.warning(res.message);
-          }
-        } else {
-          console.log("error submit!!");
-          return false;
-        }
-      });
-    },
-  },
-};
-</script>
-
-   <style lang="scss" scoped>
-.purchaseOrder {
-}
-</style>
-   

+ 94 - 247
src/views/purchaseIn/purchaseOrder/components/Inspection-table.vue

@@ -1,20 +1,16 @@
 <template>
   <el-row class="addForm">
-    <el-col :span="24" style="text-align: right; padding: 10px 0 0 0">
-      <el-button type="primary" :size="'mini'" @click="addForm"
+    <el-col
+      :span="24"
+      v-if="
+        (status === '1' && powers.some((item) => item == '028')) ||
+        (status === '2' && powers.some((item) => item == '028'))
+      "
+      style="text-align: right; padding: 10px 0 0 0"
+    >
+      <el-button type="primary" :size="'mini'" @click="openModal('add', '028')"
         >新建
       </el-button>
-
-      <!-- <el-button
-        type="primary"
-        :size="'mini'"
-        @click="submitForm"
-        v-if="
-          (status == '3' && powers.some((item) => item == '022')) ||
-          (status == '4' && powers.some((item) => item == '023'))
-        "
-        >保 存
-      </el-button> -->
     </el-col>
     <el-col :span="24">
       <el-form
@@ -35,119 +31,92 @@
               :prop="item.prop"
               show-overflow-tooltip
               :label="item.label"
-              v-if="
-                item.type === 'text' && item.show && item.prop !== 'error_code'
-              "
               :width="item.width"
               :min-width="item.minWidth"
               :key="item.prop + index"
             />
-            <el-table-column
-              :prop="item.prop"
-              :label="item.label"
-              v-else-if="
-                item.type === 'text' && item.show && item.prop === 'error_code'
-              "
-              :width="item.width"
-              :min-width="item.minWidth"
-              :key="item.prop + index"
-            >
-              <template slot-scope="scope">
-                <span class="spscope">{{ scope.row.error_code_name }}</span>
-              </template>
-            </el-table-column>
-            <el-table-column
-              :prop="item.prop"
-              :label="item.label"
-              v-else-if="item.type !== 'text' && item.show"
-              :width="item.width"
-              :min-width="item.minWidth"
-              :key="item.prop + index"
-            >
-              <template slot-scope="scope">
-                <el-form-item
-                  :prop="'product_go.' + scope.$index + '.' + item.prop"
-                  :rules="scope.row.edit ? tableFormThis[item.prop] : {}"
-                  :size="'mini'"
-                >
-                  <el-input
-                    v-if="scope.row.edit === true && item.type === 'input'"
-                    :size="'mini'"
-                    maxlength="250"
-                    clearable
-                    v-model="scope.row[item.prop]"
-                  />
-                  <el-select
-                    v-model="scope.row[item.prop]"
-                    v-if="scope.row.edit === true && item.type === 'select'"
-                    style="width: 100%"
-                    clearable
-                    placeholder="异常原因"
-                    @change="elSelectChange($event, scope.$index)"
-                  >
-                    <el-option
-                      v-for="item in options"
-                      :key="item.result_code"
-                      :label="item.result"
-                      :value="item.result_code"
-                      :disabled="item.status === '0'"
-                    >
-                    </el-option>
-                  </el-select>
-                  <span v-if="!scope.row.edit" class="spscope">{{
-                    item.type === "select"
-                      ? scope.row.error_code_name
-                      : scope.row[item.prop]
-                  }}</span>
-                </el-form-item>
-              </template>
-            </el-table-column>
           </template>
-          <!-- v-if="
-              (status == '3' && powers.some((item) => item == '022')) ||
-              (status == '4' && powers.some((item) => item == '023'))
-            " -->
+
           <el-table-column fixed="right" label="操作" width="80">
             <template slot-scope="scope">
               <el-tooltip
+                v-if="powers.some((item) => item == '007')"
                 effect="dark"
-                content="编辑"
-                v-if="!scope.row.edit"
+                content="详情"
                 placement="top"
               >
                 <i
-                  class="el-icon-edit tb-icon"
-                  @click="editRow(scope.$index)"
+                  class="el-icon-view tb-icon"
+                  @click="openModal(scope.row.wsm_in_code, '007')"
                 ></i>
               </el-tooltip>
-
               <el-tooltip
+                v-if="
+                  scope.row.status === '1' &&
+                  powers.some((item) => item == '029')
+                "
                 effect="dark"
-                content="保存"
-                v-if="scope.row.edit"
+                content="入库验收记录"
                 placement="top"
               >
                 <i
-                  class="el-icon-circle-check tb-icon"
-                  @click="checkRow(scope.$index)"
+                  class="el-icon-view tb-icon"
+                  @click="openModal(scope.row.wsm_in_code, '029')"
                 ></i>
               </el-tooltip>
 
-              <el-tooltip effect="dark" content="重置" placement="top">
+              <el-tooltip
+                v-if="
+                  scope.row.status === '2' &&
+                  powers.some((item) => item == '030')
+                "
+                effect="dark"
+                content="入库验收建议"
+                placement="top"
+              >
+                <i
+                  class="el-icon-view tb-icon"
+                  @click="openModal(scope.row.wsm_in_code, '030')"
+                ></i>
+              </el-tooltip>
+              <el-tooltip
+                v-if="
+                  scope.row.status === '3' &&
+                  powers.some((item) => item == '031')
+                "
+                effect="dark"
+                content="入库验收建议审核"
+                placement="top"
+              >
+                <i
+                  class="el-icon-view tb-icon"
+                  @click="openModal(scope.row.wsm_in_code, '031')"
+                ></i>
+              </el-tooltip>
+              <el-tooltip
+                v-if="
+                  scope.row.status === '5' &&
+                  powers.some((item) => item == '033')
+                "
+                effect="dark"
+                content="退货物流填写"
+                placement="top"
+              >
                 <i
-                  class="el-icon-refresh-left tb-icon"
-                  @click="resetRow(scope.$index)"
+                  class="el-icon-view tb-icon"
+                  @click="openModal(scope.row.wsm_in_code, '032')"
                 ></i>
               </el-tooltip>
             </template>
           </el-table-column>
         </el-table>
       </el-form>
-      <add-edit-table-model
+      <wsm-in-order-model
         :id="modelId"
         :show-model="showModel"
-        :sitem="detailSitem"
-        @refresh="searchList"
+        :btn_code="btn_code"
+        :modelSitem="modelSitem"
+        @refresh="(showModel = false), $emit('refresh')"
         @cancel="showModel = false"
       />
     </el-col>
@@ -156,19 +125,18 @@
    <script>
 import asyncRequest from "@/apis/service/stock/allot/detail";
 import resToken from "@/mixins/resToken";
-import { isnumber } from "@/utils/validate";
 import config from "./columns-table"; //表格列参数
-import addEditTableModel from "./addEditTableModel.vue";
+import wsmInOrderModel from "./wsm-in-order-model.vue";
 export default {
   name: "allot",
   props: ["id", "sitem", "newTime"],
   mixins: [resToken],
-  components: { addEditTableModel },
+  components: { wsmInOrderModel },
   computed: {
     powers() {
       let tran =
         this.$store.getters.btnList.find(
-          (item) => item.menu_route == "allotDetail"
+          (item) => item.menu_route == "purchaseOrderDetail"
         ) || {};
       if (tran && tran.action && tran.action.length > 0) {
         return tran.action;
@@ -185,6 +153,8 @@ export default {
       options: [],
       status: "",
       loading: false,
+      modelSitem: null,
+      wsm_in_code: "",
       tableForm: {
         product_go: [], //出库商品
       },
@@ -205,102 +175,47 @@ export default {
   methods: {
     async initForm() {
       this.loading = true;
-      // this.columns = [];
-      await this.getresultlist();
+      this.modelSitem = null;
       await this.resetForm();
       this.loading = false;
     },
-    async getresultlist() {
-      const res = await asyncRequest.resultlist({
-        page: 1,
-        size: 100,
-        status: "",
-      });
-      if (res && res.code === 0 && res.data) {
-        const { list } = res.data;
-        this.options = list;
-      } else if (res && res.code >= 100 && res.code <= 104) {
-        await this.logout();
-      } else {
-        this.$message.warning(res.message);
-      }
-    },
     async resetForm() {
       // 重置
       await this.$nextTick(() => {
         if (this.$refs.tableForm) {
           this.$refs.tableForm.resetFields();
           this.$refs.tableForm.clearValidate();
-          const {  status } = this.sitem;
+          const { status, child } = this.sitem;
           this.status = status;
-          // let columnsList = JSON.parse(JSON.stringify(config.columns));
-          // columnsList.forEach((v1) => {
-          //   if (this.status == "5" || this.status == "4") {
-          //     v1.show = true;
-          //   }
-          //   if (this.status == "4" && v1.prop === "stock_num") {
-          //     v1.type = "input";
-          //     v1.width = "150px";
-          //   }
-          //   if (this.status == "3") {
-          //     if (v1.prop === "error_remark" || v1.prop === "error_num") {
-          //       v1.show = true;
-          //       v1.width = "150px";
-          //       v1.type = "input";
-          //     }
-          //     if (v1.prop === "error_code") {
-          //       v1.show = true;
-          //       v1.width = "150px";
-          //       v1.type = "select";
-          //     }
-          //   }
-          //   this.columns.push(v1);
-          // });
-          console.log(this.sitem.child);
-          this.tableForm.product_go = [];
-          // let list = JSON.parse(JSON.stringify(item));
-          // //  item || []; //出库商品
-          // list.forEach((v) => {
-          //   v.usable_stock = v.usable_num;
-          //   v.type_code = v.good_type_code;
-          //   v.error_num = v.error_num || "0";
-          //   v.error_code = v.error_code || "";
-          //   v.error_code_name = v.error_code_name || "";
-          //   v.error_remark = v.error_remark || "";
-          //   v.stock_num = v.stock_num || "0";
-          //   v.edit = false;
-          //   this.tableForm.product_go.push(v);
-          // });
+          this.tableForm.product_go = child || [];
         }
       });
     },
-    addForm() {
-      // let item = {
-      //   post_company: "",
-      //   post_code: "",
-      //   post_fee: "",
-      //   sendtime: "",
-      //   send_num: "",
-      //   status: "",
-      // };
-      // this.tableForm.product_go.push(item);
-      this.detailSitem = this.sitem;
-      this.modelId = this.id;
+    openModal(code, btn_code) {
+      this.btn_code = btn_code;
+      this.modelId = code;
+      const {
+        wsm_contactor,
+        wsm_mobile,
+        wsm_addr,
+        addr_code,
+        wsend_num,
+        cgdNo,
+        wsm_code,
+      } = this.sitem;
+      this.modelSitem = {
+        wsm_contactor,
+        wsm_mobile,
+        wsm_addr,
+        addr_code,
+        cgdNo,
+        wsm_code,
+        wsend_num,
+      };
       this.showModel = true;
     },
-
     async submitForm() {
-      let index = -1,
-        good = [];
-      this.tableForm.product_go.forEach((v, i) => {
-        if (v.edit && index === -1) {
-          index = i;
-        }
-      });
-      if (index !== -1) {
-        this.$message.warning("当前已有商品正在编辑!");
-        return;
-      }
+      let good = [];
       this.loading = true;
       good = this.getGoodList();
       const model = {
@@ -351,74 +266,6 @@ export default {
       });
       return resList;
     },
-    // 重置行操作
-    resetRow(index) {
-      if (this.status === "3") {
-        this.tableForm.product_go[index].error_num = "0";
-        this.tableForm.product_go[index].error_code = "";
-        this.tableForm.product_go[index].error_code_name = "";
-        this.tableForm.product_go[index].error_remark = "";
-      } else {
-        this.tableForm.product_go[index].stock_num = "0";
-      }
-    },
-    //异常原因筛选
-    elSelectChange(e, index) {
-      let oindex = this.options.findIndex((v) => v.result_code === e);
-      this.tableForm.product_go[index].error_code_name =
-        oindex !== -1 ? this.options[oindex].result : "";
-    },
-    //保存某一行
-    checkRow(rowIndex) {
-      const { allot_num, error_num, error_code, error_remark, stock_num } =
-        this.tableForm.product_go[rowIndex];
-      if (this.status === "3") {
-        if (!isnumber(error_num + "") || error_num === "") {
-          this.$message.warning("异常数量必须为整数!");
-          return;
-        }
-        if (parseInt(error_num + "") > parseInt(allot_num + "")) {
-          this.$message.warning("异常数量不大于调拨总数量!");
-          return;
-        }
-        if (parseInt(error_num + "") > 0 && error_code === "") {
-          this.$message.warning("请选择异常原因!");
-          return;
-        }
-        if (parseInt(error_num + "") > 0 && error_remark === "") {
-          this.$message.warning("请输入异常备注!");
-          return;
-        }
-        if (parseInt(error_num + "") === 0 && error_code !== "") {
-          this.$message.warning("异常数量为零,不用选择异常原因!");
-          return;
-        }
-        if (parseInt(error_num + "") === 0 && error_remark !== "") {
-          this.$message.warning("异常数量为零,不用填写异常备注!");
-          return;
-        }
-      } else {
-        if (!isnumber(stock_num + "" || stock_num === "")) {
-          this.$message.warning("入库数量必须为整数!");
-          return;
-        }
-        if (parseInt(stock_num + "") > parseInt(allot_num + "")) {
-          this.$message.warning("入库数量不大于调拨总数量!");
-          return;
-        }
-      }
-      this.tableForm.product_go[rowIndex].edit = false;
-    },
-    //编辑某一行
-    editRow(rowIndex) {
-      let index = this.tableForm.product_go.findIndex((v) => v.edit);
-      if (index !== -1) {
-        this.$message.warning("请完成其他行的编辑!");
-        return;
-      } else {
-        this.tableForm.product_go[rowIndex].edit = true;
-      }
-    },
   },
 };
 </script>

+ 0 - 315
src/views/purchaseIn/purchaseOrder/components/addEditTableModel.vue

@@ -1,315 +0,0 @@
-<template>
-  <el-dialog
-    v-loading="loading"
-    :title="title"
-    :center="true"
-    align="left"
-    top="10vh"
-    width="1040px"
-    :close-on-click-modal="false"
-    :visible.sync="showModelThis"
-    element-loading-text="拼命加载中"
-    element-loading-spinner="el-icon-loading"
-    element-loading-background="rgba(0, 0, 0, 0.8)"
-    @close="closeModel"
-  >
-    <el-card style="margin-top: -20px" class="account">
-      <el-row :gutter="10">
-        <el-col :span="24">
-          <el-form
-            :model="ruleForm"
-            :rules="rules"
-            status-icon
-            ref="ruleForm"
-            label-width="100px"
-            class="demo-ruleForm"
-          >
-            <el-row>
-              <el-col :span="24">
-                <el-divider>收货信息:</el-divider>
-              </el-col>
-              <el-col :span="12">
-                <el-form-item label="收货人" :size="'mini'">
-                  <el-input
-                    placeholder="收货人"
-                    disabled
-                    v-model="ruleForm.send_num"
-                    maxlength="100"
-                  >
-                  </el-input>
-                </el-form-item>
-              </el-col>
-              <el-col :span="12">
-                <el-form-item label="联系电话" :size="'mini'">
-                  <el-input
-                    placeholder="联系电话"
-                    disabled
-                    v-model="ruleForm.send_num"
-                    maxlength="100"
-                  >
-                  </el-input>
-                </el-form-item>
-              </el-col>
-              <el-col :span="24">
-                <el-form-item label="收货地址" :size="'mini'">
-                  <el-input
-                    placeholder="收货地址"
-                    disabled
-                    v-model="ruleForm.send_num"
-                    maxlength="100"
-                  >
-                  </el-input>
-                </el-form-item>
-              </el-col>
-              <el-col :span="24">
-                <el-divider>入库单信息:</el-divider>
-              </el-col>
-              <el-col :span="12">
-                <el-form-item label="未发货总量" prop="send_num">
-                  <el-input
-                    placeholder="未发货总量"
-                    disabled
-                    v-model="ruleForm.send_num"
-                    maxlength="100"
-                  >
-                  </el-input>
-                </el-form-item>
-              </el-col>
-              <el-col :span="12">
-                <el-form-item label="发货数量" prop="send_num">
-                  <el-input
-                    placeholder="发货数量"
-                    v-model="ruleForm.send_num"
-                    maxlength="100"
-                  >
-                  </el-input>
-                </el-form-item>
-              </el-col>
-              <el-col :span="12">
-                <el-form-item label="物流公司" prop="post_company">
-                  <el-input
-                    placeholder="物流公司"
-                    v-model="ruleForm.post_company"
-                    maxlength="100"
-                  >
-                  </el-input>
-                </el-form-item>
-              </el-col>
-              <el-col :span="12">
-                <el-form-item label="物流单号" prop="post_code">
-                  <el-input
-                    placeholder="物流单号"
-                    v-model="ruleForm.post_code"
-                    maxlength="100"
-                  />
-                </el-form-item>
-              </el-col>
-              <el-col :span="12">
-                <el-form-item label="物流费用" prop="post_fee">
-                  <el-input
-                    placeholder="物流费用"
-                    v-model="ruleForm.post_fee"
-                    maxlength="100"
-                  >
-                    <template slot="append">元</template>
-                  </el-input>
-                </el-form-item>
-              </el-col>
-              <el-col :span="12">
-                <el-form-item label="发货时间" prop="post_time">
-                  <el-date-picker
-                    :disabled="isDisabled"
-                    v-model="ruleForm.post_time"
-                    type="datetime"
-                    style="width: 100%"
-                    value-format="yyyy-MM-dd HH:mm:ss"
-                    placeholder="发货时间"
-                    :picker-options="pickerOptions"
-                    @change="selectTime"
-                  >
-                  </el-date-picker>
-                </el-form-item>
-              </el-col>
-
-              <el-col :span="24" style="text-align: right">
-                <el-button type="primary" @click="submitForm">保 存 </el-button>
-                <el-button @click="showModelThis = false">关 闭</el-button>
-              </el-col>
-            </el-row>
-          </el-form>
-        </el-col>
-      </el-row>
-    </el-card>
-  </el-dialog>
-</template>
-<script>
-import asyncRequest from "@/apis/service/purchaseIn/purchaseOrder/detail";
-import resToken from "@/mixins/resToken";
-import { isnumber, isnumber2 } from "@/utils/validate";
-export default {
-  name: "Account",
-  props: ["showModel", "id", "sitem"],
-  mixins: [resToken],
-  data() {
-    const validatePrice = (rule, value, callback) => {
-      if (value === "") {
-        callback(new Error("不能为空!"));
-      } else {
-        if (!isnumber2(value)) {
-          callback(new Error("仅支持整数或两位小数!"));
-        } else {
-          callback();
-        }
-      }
-    };
-    const validateWeight = (rule, value, callback) => {
-      if (value === "") {
-        callback(new Error("不能为空!"));
-      } else {
-        if (!isnumber(value)) {
-          callback(new Error("仅支持整数!"));
-        } else {
-          callback();
-        }
-      }
-    };
-      const validateCode = (rule, value, callback) => {
-      if (value === "") {
-        callback(new Error("不能为空!"));
-      } else {
-        if (!isnumber(value)) {
-          callback(new Error("仅支持整数!"));
-        } else {
-          callback();
-        }
-      }
-    };
-    
-    return {
-      loading: false,
-      title: "新建备货入库单",
-      showModelThis: this.showModel,
-      rulesThis: this.rules,
-      ruleForm: {
-        cgdNo: "",
-        wsm_code: "",
-        post_company: "",
-        post_code: "",
-        post_fee: "",
-        post_time: "",
-        send_num: "",
-        status: "1",
-      },
-      rules: {
-        send_num: {
-          required: true,
-          validator: validateWeight,
-          trigger: "blur",
-        },
-        post_company: {
-          required: true,
-          trigger: "blur",
-          message: "请输入物流公司",
-        },
-        post_code: {
-          required: true,
-          validator: validateCode,
-          trigger: "blur",
-        },
-        post_fee: {
-          required: true,
-          validator: validatePrice,
-          trigger: "blur",
-        },
-
-        post_time: {
-          required: true,
-          message: "请选择发货时间",
-          trigger: "change",
-        },
-      },
-    };
-  },
-  watch: {
-    showModel: function (val) {
-      this.showModelThis = val;
-      if (val) {
-        this.initForm();
-      }
-    },
-    showModelThis(val) {
-      if (!val) {
-        this.$emit("cancel");
-      }
-    },
-  },
-  methods: {
-    closeModel() {
-      console.log("closeModel!!");
-    },
-
-    async initForm() {
-      this.loading = true;
-      this.rulesThis = this.rules;
-      await this.resetForm();
-      this.loading = false;
-    },
-
-    //初始化表单
-    async resetForm() {
-      await this.$nextTick(() => {
-        if (this.$refs.ruleForm) {
-          this.$refs.ruleForm.resetFields();
-          this.$refs.ruleForm.clearValidate();
-          const { cgdNo, wsm_code } = this.sitem;
-          console.log(this.sitem);
-          this.ruleForm = {
-            cgdNo: cgdNo || "",
-            wsm_code: wsm_code || "",
-            post_company: "",
-            post_code: "",
-            post_fee: "",
-            post_time: "",
-            send_num: "",
-            status: "1",
-          };
-        }
-      });
-    },
-    // 保存更改
-    async submitForm() {
-      await this.$refs.ruleForm.validate(async (valid) => {
-        if (valid) {
-          this.loading = true;
-          const item = JSON.parse(JSON.stringify(this.ruleForm));
-
-          console.log(item);
-
-          const res = await asyncRequest.orderinadd(item);
-          this.loading = false;
-          if (res && res.code === 0) {
-            this.$notify.success({
-              title: "添加成功",
-              message: "",
-            });
-            this.showModelThis = false;
-            this.$emit("refresh"); //抛出事件给详情页。
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
-          } else {
-            this.$message.warning(res.message);
-          }
-        } else {
-          console.log("error submit!!");
-          return false;
-        }
-      });
-    },
-  },
-};
-</script>
-
-   <style lang="scss" scoped>
-.account {
-}
-</style>

+ 25 - 6
src/views/purchaseIn/purchaseOrder/components/purchaseBack.vue

@@ -1,6 +1,12 @@
 <template>
   <div>
-    <el-button type="primary" :size="'mini'" @click="addForm">修改 </el-button>
+    <el-button
+      type="primary"
+      :size="'mini'"
+      @click="addForm"
+      v-if="status === '0' && powers.some((item) => item == '007')"
+      >修改
+    </el-button>
     <el-row class="purchaseOrderDetail-addForm">
       <el-col
         :span="12"
@@ -27,18 +33,31 @@ import resToken from "@/mixins/resToken";
 import asyncRequest from "@/apis/service/purchaseIn/storeManage";
 
 import columns from "./columns";
-import addEditModel from './addEditModel.vue';
+import addEditModel from "./addEditModel.vue";
 export default {
   components: { addEditModel },
   name: "storeManage",
   props: ["id", "sitem", "newTime"],
   mixins: [resToken],
+  computed: {
+    powers() {
+      let tran =
+        this.$store.getters.btnList.find(
+          (item) => item.menu_route == "purchaseOrderDetail"
+        ) || {};
+      if (tran && tran.action && tran.action.length > 0) {
+        return tran.action;
+      } else {
+        return [];
+      }
+    },
+  },
   data() {
     return {
       columns: columns.purchaseBack,
       isDisabled: false,
       status: "",
-      detailSitem:null,
+      detailSitem: null,
       loading: false,
       modelId: "",
       sitem: null,
@@ -74,9 +93,9 @@ export default {
       this.loading = false;
     },
     addForm() {
-     this.detailSitem=this.sitem
-     this.modelId= this.id;
-     this.showModel=true
+      this.detailSitem = this.sitem;
+      this.modelId = this.id;
+      this.showModel = true;
     },
 
     // 获取详情

+ 5 - 3
src/views/purchaseIn/purchaseOrder/components/rules.js

@@ -7,10 +7,12 @@ const validatePrice = (rule, value, callback) => {
     if (value === "") {
         callback(new Error("不能为空!"));
     } else {
-        if (!isnumber2(value)) {
-            callback(new Error("仅支持整数或两位小数!"))
-        } else {
+        if (isnumber(value)) {
+            callback();
+        } else if (isnumber2(value)) {
             callback();
+        } else {
+            callback(new Error("仅支持整数或两位小数!"))
         }
     }
 };

+ 308 - 0
src/views/purchaseIn/purchaseOrder/components/wsm-in-order-addEdit-form.vue

@@ -0,0 +1,308 @@
+<template>
+  <el-form
+    v-loading="loading"
+    :model="ruleForm"
+    :rules="rules"
+    status-icon
+    ref="ruleForm"
+    label-width="100px"
+    class="demo-ruleForm"
+  >
+    <el-row>
+      <el-col :span="24">
+        <el-divider>收货信息:</el-divider>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item label="收货人" :size="'mini'">
+          <el-input
+            placeholder="收货人"
+            disabled
+            v-model="ruleForm.wsm_contactor"
+            maxlength="100"
+          >
+          </el-input>
+        </el-form-item>
+      </el-col>
+
+      <el-col :span="12">
+        <el-form-item label="联系电话" :size="'mini'">
+          <el-input
+            placeholder="联系电话"
+            disabled
+            v-model="ruleForm.wsm_mobile"
+            maxlength="100"
+          >
+          </el-input>
+        </el-form-item>
+      </el-col>
+      <el-col :span="24">
+        <el-form-item label="收货地址" :size="'mini'">
+          <el-input
+            placeholder="收货地址"
+            disabled
+            v-model="ruleForm.wsm_addr"
+            maxlength="100"
+          >
+          </el-input>
+        </el-form-item>
+      </el-col>
+      <el-col :span="24">
+        <el-divider>入库单信息:</el-divider>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item label="未发货总量">
+          <el-input
+            placeholder="未发货总量"
+            disabled
+            v-model="ruleForm.wsend_num"
+            maxlength="100"
+          >
+          </el-input>
+        </el-form-item>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item label="发货数量" prop="send_num">
+          <el-input
+            placeholder="发货数量"
+            :disabled="id !== 'add'"
+            v-model="ruleForm.send_num"
+            maxlength="100"
+          >
+          </el-input>
+        </el-form-item>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item label="物流公司" prop="post_company">
+          <el-input
+            placeholder="物流公司"
+            :disabled="id !== 'add'"
+            v-model="ruleForm.post_company"
+            maxlength="100"
+          >
+          </el-input>
+        </el-form-item>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item label="物流单号" prop="post_code">
+          <el-input
+            :disabled="id !== 'add'"
+            placeholder="物流单号"
+            v-model="ruleForm.post_code"
+            maxlength="100"
+          />
+        </el-form-item>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item label="物流费用" prop="post_fee">
+          <el-input
+            :disabled="id !== 'add'"
+            placeholder="物流费用"
+            v-model="ruleForm.post_fee"
+            maxlength="100"
+          >
+            <template slot="append">元</template>
+          </el-input>
+        </el-form-item>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item label="发货时间" prop="post_time">
+          <el-date-picker
+            :disabled="id !== 'add'"
+            v-model="ruleForm.post_time"
+            type="datetime"
+            style="width: 100%"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            placeholder="发货时间"
+            :picker-options="pickerOptions"
+            @change="selectTime"
+          >
+          </el-date-picker>
+        </el-form-item>
+      </el-col>
+
+      <el-col :span="24" style="text-align: right" v-if="id === 'add'">
+        <el-button type="primary" @click="submitForm">保 存 </el-button>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+<script>
+import asyncRequest from "@/apis/service/purchaseIn/purchaseOrder/detail";
+import resToken from "@/mixins/resToken";
+import { isnumber, isnumber2, isAlphanumeric } from "@/utils/validate";
+export default {
+  name: "wsmInOrderAdd",
+  props: ["id", "sitem", "newTime", "modelSitem"],
+  mixins: [resToken],
+  data() {
+    const validatePrice = (rule, value, callback) => {
+      if (value === "") {
+        callback(new Error("不能为空!"));
+      } else {
+        if (isnumber(value)) {
+          callback();
+        } else if (isnumber2(value)) {
+          callback();
+        } else {
+          callback(new Error("仅支持整数或两位小数!"));
+        }
+      }
+    };
+    const validateWeight = (rule, value, callback) => {
+      if (value === "") {
+        callback(new Error("不能为空!"));
+      } else {
+        if (!isnumber(value)) {
+          callback(new Error("仅支持整数!"));
+        } else {
+          callback();
+        }
+      }
+    };
+    const validateCode = (rule, value, callback) => {
+      if (value === "") {
+        callback(new Error("不能为空!"));
+      } else {
+        if (!isAlphanumeric(value)) {
+          callback(new Error("仅支持字母和数字!"));
+        } else {
+          callback();
+        }
+      }
+    };
+
+    return {
+      loading: true,
+      ruleForm: {
+        wsm_mobile: "",
+        wsm_contactor: "",
+        wsm_addr: "",
+        cgdNo: "",
+        wsm_code: "",
+        post_company: "",
+        post_code: "",
+        post_fee: "",
+        post_time: "",
+        send_num: "",
+        status: "1",
+      },
+      rules: {
+        send_num: {
+          required: true,
+          validator: validateWeight,
+          trigger: "blur",
+        },
+        post_company: {
+          required: true,
+          trigger: "blur",
+          message: "请输入物流公司",
+        },
+        post_code: {
+          required: true,
+          validator: validateCode,
+          trigger: "blur",
+        },
+        post_fee: {
+          required: true,
+          validator: validatePrice,
+          trigger: "blur",
+        },
+        post_time: {
+          required: true,
+          message: "请选择发货时间",
+          trigger: "change",
+        },
+      },
+    };
+  },
+  watch: {
+    newTime: function (val) {
+      if (val) {
+        this.initForm();
+      }
+    },
+  },
+  created() {
+    this.initForm();
+  },
+  methods: {
+    closeModel() {
+      console.log("closeModel!!");
+    },
+
+    async initForm() {
+      this.loading = true;
+      console.log(this.sitem);
+      await this.resetForm();
+      this.loading = false;
+    },
+
+    //初始化表单
+    async resetForm() {
+      await this.$nextTick(() => {
+        if (this.$refs.ruleForm) {
+          this.$refs.ruleForm.resetFields();
+          this.$refs.ruleForm.clearValidate();
+          const { post_company, post_code, post_fee, sendtime, send_num } =
+            this.sitem;
+          const {
+            wsm_mobile,
+            wsm_contactor,
+            wsm_addr,
+            wsend_num,
+            cgdNo,
+            wsm_code,
+          } = this.modelSitem;
+          this.ruleForm = {
+            wsm_mobile,
+            wsm_contactor,
+            wsm_addr,
+            wsend_num,
+            cgdNo: cgdNo || "",
+            wsm_code: wsm_code || "",
+            post_company: post_company || "",
+            post_code: post_code || "",
+            post_fee: post_fee || "",
+            post_time: sendtime || "",
+            send_num: send_num || "",
+            status: "1",
+          };
+        }
+      });
+    },
+    // 保存更改
+    async submitForm() {
+      await this.$refs.ruleForm.validate(async (valid) => {
+        if (valid) {
+          this.loading = true;
+          const item = JSON.parse(JSON.stringify(this.ruleForm));
+
+          console.log(item);
+
+          const res = await asyncRequest.orderinadd(item);
+          this.loading = false;
+          if (res && res.code === 0) {
+            this.$notify.success({
+              title: "添加成功",
+              message: "",
+            });
+            this.$emit("refresh"); //抛出事件给详情页。
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.$message.warning(res.message);
+          }
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
+    },
+  },
+};
+</script>
+
+   <style lang="scss" scoped>
+.account {
+}
+</style>

+ 124 - 0
src/views/purchaseIn/purchaseOrder/components/wsm-in-order-model.vue

@@ -0,0 +1,124 @@
+<template>
+  <el-dialog
+    :title="title"
+    :center="true"
+    align="left"
+    top="5vh"
+    width="1040px"
+    @close="closeModel"
+    :close-on-click-modal="false"
+    :visible.sync="showModelThis"
+    v-loading="loading"
+    element-loading-text="拼命加载中"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.8)"
+  >
+    <el-card style="margin-top: -20px">
+      <el-row :gutter="10">
+        <el-col :span="24">
+          <wsm-in-order-addEdit-form
+            v-if="newTime !== ''"
+            :id="id"
+            :newTime="newTime"
+            :modelSitem="modelSitem"
+            :sitem="sitem"
+            @refresh="(showModelThis = false), $emit('refresh')"
+          />
+          111
+          <wsm-in-order-record-form
+            v-if="newTime !== ''"
+            :id="id"
+            :newTime="newTime"
+            :modelSitem="modelSitem"
+            :sitem="sitem"
+            @refresh="(showModelThis = false), $emit('refresh')"
+          />
+        </el-col>
+      </el-row>
+    </el-card>
+  </el-dialog>
+</template>
+   <script>
+import asyncRequest from "@/apis/service/purchaseIn/purchaseOrder/detail";
+import resToken from "@/mixins/resToken";
+import wsmInOrderAddEditForm from "./wsm-in-order-addEdit-form";
+import wsmInOrderRecordForm from "./wsm-in-order-record-form";
+
+export default {
+  name: "purchaseOrder",
+  props: ["showModel", "id", "btn_code", "modelSitem"],
+  components: { wsmInOrderAddEditForm, wsmInOrderRecordForm },
+  mixins: [resToken],
+  data() {
+    return {
+      showModelThis: this.showModel,
+      loading: false,
+      title: "添加账号",
+      sitem: null,
+      newTime: "",
+    };
+  },
+  watch: {
+    showModel: function (val) {
+      this.showModelThis = val;
+      if (val) {
+        this.initForm();
+      }
+    },
+    showModelThis(val) {
+      if (!val) {
+        this.$emit("cancel");
+      }
+    },
+  },
+  methods: {
+    closeModel() {
+      console.log("closeModel!!");
+    },
+    async initForm() {
+      this.loading = true;
+      this.sitem = null;
+      // btn_code
+      switch (this.btn_code) {
+        case "028":
+          this.title = "新建备货入库单";
+          break;
+        case "007":
+          this.title = "备货入库单详情";
+          break;
+        default:
+          this.title = "新建备货入库单";
+      }
+      if (this.btn_code !== "028") {
+        await this.initData();
+      } else {
+        this.sitem = {};
+        this.getNewTime();
+      }
+
+      this.loading = false;
+    },
+
+    async initData() {
+      const res = await asyncRequest.orderininfo({ wsm_in_code: this.id });
+      if (res && res.code === 0 && res.data) {
+        this.sitem = res.data;
+        this.getNewTime();
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.$message.warning(res.message);
+      }
+    },
+    getNewTime() {
+      this.newTime = new Date().valueOf();
+    },
+  },
+};
+</script>
+
+   <style lang="scss" scoped>
+.purchaseOrder {
+}
+</style>
+   

+ 386 - 0
src/views/purchaseIn/purchaseOrder/components/wsm-in-order-record-form.vue

@@ -0,0 +1,386 @@
+<template>
+  <div v-loading="loading">
+    <el-row>
+      <el-col :span="24">
+        <el-form
+          :model="ruleForm"
+          :rules="rules"
+          status-icon
+          ref="ruleForm"
+          label-width="100px"
+          class="demo-ruleForm"
+        >
+          <el-row>
+            <el-col :span="12">
+              <el-form-item label="发货总数">
+                <el-input
+                  placeholder="发货总数"
+                  disabled
+                  v-model="ruleForm.order_num"
+                  maxlength="100"
+                >
+                </el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="正常数量" prop="order_num">
+                <el-input
+                  placeholder="无异常数量"
+                  :disabled="id !== 'add'"
+                  v-model="ruleForm.order_num"
+                  maxlength="100"
+                >
+                </el-input>
+              </el-form-item>
+            </el-col>
+
+            <!-- <el-col :span="24" style="text-align: right" v-if="id === 'add'">
+              <el-button type="primary" @click="submitForm">保 存 </el-button>
+            </el-col> -->
+          </el-row>
+        </el-form>
+      </el-col>
+      <el-col :span="24">
+        <el-button type="primary" @click="addError"> 新建 </el-button>
+        <el-form
+          :model="tableForm"
+          :rules="tableRules"
+          ref="tableForm"
+          class="demo-tableForm"
+        >
+          <el-table
+            :data="tableForm.error_list"
+            border
+            :size="'mini'"
+            row-key="key"
+          >
+            <template v-for="(item, index) in columns">
+              <el-table-column
+                :prop="item.prop"
+                show-overflow-tooltip
+                :label="item.label"
+                :width="item.width"
+                :min-width="item.minWidth"
+                :key="item.prop + index"
+              />
+            </template>
+            <!-- v-if="
+              (status == '3' && powers.some((item) => item == '022')) ||
+              (status == '4' && powers.some((item) => item == '023')) -->
+            <!-- " -->
+            <el-table-column fixed="right" label="操作" width="80">
+              <template slot-scope="scope">
+                <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>
+
+                <el-tooltip effect="dark" content="重置" placement="top">
+                  <i
+                    class="el-icon-refresh-left tb-icon"
+                    @click="resetRow(scope.$index)"
+                  ></i>
+                </el-tooltip>
+              </template>
+            </el-table-column>
+          </el-table>
+        </el-form>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+<script>
+import asyncRequest from "@/apis/service/purchaseIn/purchaseOrder/detail";
+import resToken from "@/mixins/resToken";
+import { isnumber } from "@/utils/validate";
+export default {
+  name: "wsmInOrderAdd",
+  props: ["id", "sitem", "newTime", "modelSitem"],
+  mixins: [resToken],
+  computed: {
+    powers() {
+      let tran =
+        this.$store.getters.btnList.find(
+          (item) => item.menu_route == "purchaseOrderDetail"
+        ) || {};
+      if (tran && tran.action && tran.action.length > 0) {
+        return tran.action;
+      } else {
+        return [];
+      }
+    },
+  },
+  data() {
+    const validateWeight = (rule, value, callback) => {
+      if (value === "") {
+        callback(new Error("不能为空!"));
+      } else {
+        if (!isnumber(value)) {
+          callback(new Error("仅支持整数!"));
+        } else {
+          callback();
+        }
+      }
+    };
+
+    return {
+      loading: true,
+      ruleForm: {
+        order_num: "",
+      },
+      rules: {
+        order_num: {
+          required: true,
+          validator: validateWeight,
+          trigger: "blur",
+        },
+      },
+      columns: [
+        {
+          prop: "num",
+          label: "异常数量",
+          minWidth: "145",
+          show: true,
+          type: "text",
+        },
+        {
+          prop: "error_code",
+          label: "异常原因",
+          minWidth: "145",
+          show: true,
+          type: "text",
+        },
+        {
+          prop: "error_img",
+          label: "异常图片",
+          minWidth: "145",
+          show: true,
+          type: "array",
+        },
+        {
+          prop: "remark",
+          label: "异常备注",
+          minWidth: "145",
+          show: true,
+          type: "text",
+        },
+      ],
+      tableForm: {
+        error_list: [],
+      },
+      tableRules: {},
+    };
+  },
+  watch: {
+    newTime: function (val) {
+      if (val) {
+        this.initForm();
+      }
+    },
+  },
+  created() {
+    this.initForm();
+  },
+  methods: {
+    closeModel() {
+      console.log("closeModel!!");
+    },
+
+    async initForm() {
+      this.loading = true;
+      console.log(this.sitem);
+      await this.getresultlist()
+      await this.resetForm();
+      this.loading = false;
+    },
+
+    //初始化表单
+    async resetForm() {
+      await this.$nextTick(() => {
+        if (this.$refs.ruleForm) {
+          this.$refs.ruleForm.resetFields();
+          this.$refs.ruleForm.clearValidate();
+          const { post_company, post_code, post_fee, sendtime, send_num } =
+            this.sitem;
+          const {
+            wsm_mobile,
+            order_num,
+            wsm_addr,
+            wsend_num,
+            cgdNo,
+            wsm_code,
+          } = this.modelSitem;
+          this.ruleForm = {
+            wsm_mobile,
+            order_num,
+            wsm_addr,
+            wsend_num,
+            cgdNo: cgdNo || "",
+            wsm_code: wsm_code || "",
+            post_company: post_company || "",
+            post_code: post_code || "",
+            post_fee: post_fee || "",
+            post_time: sendtime || "",
+            send_num: send_num || "",
+            status: "1",
+          };
+        }
+        if (this.$refs.tableForm) {
+          this.$refs.tableForm.resetFields();
+          this.$refs.tableForm.clearValidate();
+
+          const { checkinfo } = this.sitem;
+          this.tableForm = {
+            error_list: checkinfo || [],
+          };
+        }
+      });
+    },
+    addError() {
+      this.tableForm.error_list.push({
+        id: "1",
+        num: "2",
+        error_code: "008",
+        error_code_name: "21321",
+        error_img: "",
+        remark: "11",
+        edit: true,
+      });
+    },
+        async getresultlist() {
+      const res = await asyncRequest.resultlist({
+        page: 1,
+        size: 100,
+        type:"1",
+        status: "",
+      });
+      if (res && res.code === 0 && res.data) {
+        const { list } = res.data;
+        this.options = list;
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.$message.warning(res.message);
+      }
+    },
+        // 重置行操作
+    resetRow(index) {
+        this.tableForm.error_list[index].num= "0";
+        this.tableForm.error_list[index].error_code = "";
+        this.tableForm.error_list[index].error_code_name = "";
+        this.tableForm.error_list[index].error_img=[],
+        this.tableForm.error_list[index].remark = "";
+    
+    },
+    //异常原因筛选
+    elSelectChange(e, index) {
+      let oindex = this.options.findIndex((v) => v.result_code === e);
+      this.tableForm.error_list[index].error_code_name =
+        oindex !== -1 ? this.options[oindex].result : "";
+    },
+    //保存某一行
+    checkRow(rowIndex) {
+      const { allot_num, error_num, error_code, error_remark, stock_num } =
+        this.tableForm.error_list[rowIndex];
+      if (this.status === "3") {
+        if (!isnumber(error_num + "") || error_num === "") {
+          this.$message.warning("异常数量必须为整数!");
+          return;
+        }
+        if (parseInt(error_num + "") > parseInt(allot_num + "")) {
+          this.$message.warning("异常数量不大于调拨总数量!");
+          return;
+        }
+        if (parseInt(error_num + "") > 0 && error_code === "") {
+          this.$message.warning("请选择异常原因!");
+          return;
+        }
+        if (parseInt(error_num + "") > 0 && error_remark === "") {
+          this.$message.warning("请输入异常备注!");
+          return;
+        }
+        if (parseInt(error_num + "") === 0 && error_code !== "") {
+          this.$message.warning("异常数量为零,不用选择异常原因!");
+          return;
+        }
+        if (parseInt(error_num + "") === 0 && error_remark !== "") {
+          this.$message.warning("异常数量为零,不用填写异常备注!");
+          return;
+        }
+      } else {
+        if (!isnumber(stock_num + "" || stock_num === "")) {
+          this.$message.warning("入库数量必须为整数!");
+          return;
+        }
+        if (parseInt(stock_num + "") > parseInt(allot_num + "")) {
+          this.$message.warning("入库数量不大于调拨总数量!");
+          return;
+        }
+      }
+      this.tableForm.error_list[rowIndex].edit = false;
+    },
+    //编辑某一行
+    editRow(rowIndex) {
+      let index = this.tableForm.error_list.findIndex((v) => v.edit);
+      if (index !== -1) {
+        this.$message.warning("请完成其他行的编辑!");
+        return;
+      } else {
+        this.tableForm.error_list[rowIndex].edit = true;
+      }
+    },
+    // 保存更改
+    async submitForm() {
+      await this.$refs.ruleForm.validate(async (valid) => {
+        if (valid) {
+          this.loading = true;
+          const item = JSON.parse(JSON.stringify(this.ruleForm));
+
+          console.log(item);
+
+          const res = await asyncRequest.orderinadd(item);
+          this.loading = false;
+          if (res && res.code === 0) {
+            this.$notify.success({
+              title: "添加成功",
+              message: "",
+            });
+            this.$emit("refresh"); //抛出事件给详情页。
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.$message.warning(res.message);
+          }
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
+    },
+  },
+};
+</script>
+
+   <style lang="scss" scoped>
+.account {
+}
+</style>

+ 4 - 3
src/views/purchaseIn/purchaseOrder/detail.vue

@@ -11,7 +11,7 @@
           plain
           :size="'mini'"
           @click="statusConfirm('1', '开始发货')"
-          v-if="status === '1' && powers.some((item) => item == '026')"
+          v-if="status === '0' && powers.some((item) => item == '026')"
           >开始发货
         </el-button>
 
@@ -19,7 +19,7 @@
           @click="statusConfirm('0', '取消发货')"
           plain
           :size="'mini'"
-          v-if="status === '2' && powers.some((item) => item == '027')"
+          v-if="status === '1' && powers.some((item) => item == '027')"
           >取消发货</el-button
         >
         <!-- <el-button
@@ -42,7 +42,7 @@
         :id="queryId"
         @refresh="initData()"
       />
-      <div v-if="status === '0' && powers.some((item) => item == '005')">
+      <div>
         <purchase-back
           :newTime="newTime"
           v-if="newTime !== ''"
@@ -103,6 +103,7 @@ export default {
       finishStatus: "finish",
       activeNames: ["0", "1", "2", "3", "4", "5"],
       sitem: null,
+      
       status: "",
       newTime: "",
       loading: false,

+ 5 - 15
src/views/purchaseIn/storeManage/components/rules.js

@@ -7,12 +7,13 @@ const validatePrice = (rule, value, callback) => {
     if (value === "") {
         callback(new Error("不能为空"));
     } else {
-        if (!isnumber2(value)) {
-            callback(new Error("仅支持整数或两位小数"))
-        } else {
+        if (isnumber(value)) {
+            callback();
+        } else if (isnumber2(value)) {
             callback();
+        } else {
+            callback(new Error("仅支持整数或两位小数!"))
         }
-
     }
 };
 const validateWeight = (rule, value, callback) => {
@@ -35,7 +36,6 @@ export default {
     nake_fee: {
         required: true,
         validator: validatePrice,
-
         trigger: "blur",
     },
     supplierNo: {
@@ -43,7 +43,6 @@ export default {
         required: true,
         message: "采购供应商不能为空",
         trigger: "change",
-
     },
     num: {
         required: true,
@@ -58,55 +57,46 @@ export default {
     weight: {
         required: true,
         validator: validateWeight,
-
         trigger: "blur",
     },
     now_god_price: {
         required: true,
         validator: validatePrice,
-
         trigger: "blur",
     },
     teach_fee: {
         required: true,
         validator: validatePrice,
-
         trigger: "blur",
     },
     pakge_fee: {
         required: true,
         validator: validatePrice,
-
         trigger: "blur",
     },
     mark_fee: {
         required: true,
         validator: validatePrice,
-
         trigger: "blur",
     },
     cert_fee: {
         required: true,
         validator: validatePrice,
-
         trigger: "blur",
     },
     delivery_fee: {
         required: true,
         validator: validatePrice,
-
         trigger: "blur",
     },
     open_fee: {
         required: true,
         validator: validatePrice,
-
         trigger: "blur",
     },
     diff_weight: {
         required: true,
         validator: validateWeight,
-
         trigger: "blur",
     },
     diff_price: {

+ 1 - 0
src/views/stock/allot/components/Inspection-table.vue

@@ -203,6 +203,7 @@ export default {
       const res = await asyncRequest.resultlist({
         page: 1,
         size: 100,
+        type:"1",
         status: "",
       });
       if (res && res.code === 0 && res.data) {