戴艳蓉 3 years ago
parent
commit
3ef9c914e2

+ 6 - 0
src/apis/components/search-stock-good-modal.js

@@ -0,0 +1,6 @@
+import http from "@/apis/axios";
+const api = "admin/";
+export default {
+  // 列表
+  list: (data, params) => http(api + "checkflist", data, "post", params),
+};

+ 63 - 42
src/components/exam-form/main.vue

@@ -1,11 +1,13 @@
 <template>
   <el-form
+    v-loading="loading"
     ref="ruleForm"
     :model="ruleForm"
     status-icon
     :rules="rulesThis"
     label-width="100px"
     class="demo-ruleForm"
+    :size="size || 'medium'"
   >
     <el-row>
       <el-col :span="12"
@@ -14,6 +16,8 @@
             v-model="ruleForm.state"
             placeholder="请选择审核状态"
             style="width: 100%"
+            :size="size || 'medium'"
+            @change="stateChange"
           >
             <el-option
               v-for="item in stateList"
@@ -25,49 +29,56 @@
           </el-select>
         </el-form-item>
       </el-col>
-      <el-col :span="12">
-        <el-form-item label="驳回节点" prop="status">
+      <el-col :span="12" v-if="ruleForm.state === '0'">
+        <el-form-item label="驳回节点" prop="rebut">
           <el-select
-            v-model="ruleForm.status"
+            v-model="ruleForm.rebut"
             placeholder="请选择驳回节点"
             style="width: 100%"
+            :disabled="disabled"
           >
-            <template v-for="item in statusList">
-              <el-option
-                v-if="!item.hidden"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value"
-              >
-              </el-option>
-            </template>
+            <el-option
+              v-for="item in statusList"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+              :disabled="item.disabled"
+            >
+            </el-option>
           </el-select>
         </el-form-item>
       </el-col>
     </el-row>
-    <el-form-item label="审核备注" prop="contactor" style="width: 100%">
+    <el-form-item label="审核备注" prop="remark" style="width: 100%">
       <el-input
         type="textarea"
         placeholder="请输入审核备注"
         v-model="ruleForm.remark"
+        :disabled="disabled"
         maxlength="250"
         :autosize="{ minRows: 2, maxRows: 4 }"
         show-word-limit
       />
     </el-form-item>
+    <el-form-item class="fr">
+      <el-button v-if="!isDetail" type="primary" @click="submitForm"
+        >保 存
+      </el-button>
+    </el-form-item>
   </el-form>
 </template>
 
 <script>
 export default {
   name: "exam-form",
-  // mixins: [resToken],
-  props: ["size", "statusList", "disabled"],
+  props: ["size", "statusList", "disabled", "isMust"],
   /**
    * 属性集合
-   * @param {String}        size             : 组件大小            非必填
-   * @param {Array}         statusList       : 驳回至备选项         必填
-   * @param {Boolean}       disabled         : 是否禁用            必填
+   * @param {String}        size             : 组件大小             非必填
+   * @param {Array}         statusList       : 驳回至备选项          必填
+   * @param {Boolean}       disabled         : 是否禁用              必填
+   * @param {Boolean}       isMust           : 是否需要展示驳回节点   必填
+   *
    *
    */
   /**
@@ -126,41 +137,51 @@ export default {
       if (this.isDetail !== val) {
         this.options = [];
         this.selectLoading = false;
-        this.getList();
       }
     },
   },
   created() {
-    this.options = [];
-    this.selectLoading = false;
-    this.getList();
+    this.initForm();
   },
   methods: {
-    async selectChange(e) {
-      this.$emit("searchChange", e);
+    async initForm() {
+      this.loading = true;
+      this.rulesThis = this.rules;
+      await this.resetForm();
+      this.stateChange();
+      this.loading = false;
     },
-    async getList() {
-      this.options = [];
-      const res = await asyncRequest.list({});
-      if (res && res.code === 0 && res.data) {
-        this.options = res.data;
-        this.recursion(this.options);
+    stateChange() {
+      if (this.ruleForm.state === "1") {
+        this.rulesThis.rebut[0].required = false;
+        this.rulesThis.remark[0].required = false;
       } else {
-        this.options = [];
+        this.rulesThis.rebut[0].required = true;
+        this.rulesThis.remark[0].required = true;
       }
     },
-    recursion(list) {
-      list.map((v) => {
-        if (v && Array.isArray(v.child)) {
-          v.value = v.id + "";
-          v.label = v.name;
-          if (v.child.length === 0) {
-            delete v["child"];
-          } else {
-            this.recursion(v.child);
-          }
+    async resetForm() {
+      // 重置
+      await this.$nextTick(() => {
+        if (this.$refs.ruleForm) {
+          this.$refs.ruleForm.resetFields();
+          this.$refs.ruleForm.clearValidate();
+          this.ruleForm = {
+            state: "1", // 通过or驳回
+            rebut: "", //驳回至
+            remark: "",
+          };
+        }
+      });
+    },
+    async submitForm() {
+      await this.$refs.ruleForm.validate(async (valid) => {
+        if (valid) {
+          this.$emit("searchChange", this.ruleForm);
+        } else {
+          console.log("error submit!!");
+          return false;
         }
-        return v;
       });
     },
   },

+ 84 - 0
src/components/search-stock-good-modal/columns.js

@@ -0,0 +1,84 @@
+export default [
+  { type: "selection", fixed: "left", _noset_: true },
+  {
+    prop: "good_code",
+    label: "商品编码",
+    width: "150",
+  },
+  {
+    prop: "good_name",
+    label: "商品名称",
+    "min-width": "120",
+  },
+
+  {
+    prop: "gys_code",
+    label: "供应商编码",
+    width: "142",
+  },
+  {
+    prop: "supplier_name",
+    label: "供货商",
+    "min-width": "160",
+  },
+  // {
+  //   prop: "cg_saler",
+  //   label: "采购员",
+  //   width: "60",
+  // },
+  // {
+  //   prop: "usable_stock",
+  //   label: "商品库存",
+  //   width: "70",
+  // },
+  {
+    prop: "unit",
+    label: "单位",
+    width: "45",
+  },
+  // {
+  //   prop: "bstatus",
+  //   label: "当前状态",
+  //   _slot_: "status",
+  //   width: "80px",
+  // },
+
+
+  // {
+  //   prop: "classArr",
+  //   label: "商品类别",
+  // },
+  {
+    prop: "color",
+    label: "商品颜色",
+    width: "70",
+  },
+  {
+    prop: "material",
+    label: "商品材质",
+    width: "70",
+  },
+  {
+    prop: "brand",
+    label: "品牌",
+    "width": "70",
+  },
+  // {
+  //   prop: "good_type",
+  //   label: "商品类型",
+  // },
+  // {后端有接口但是没有值。
+  //   prop: "specs",
+  //   label: "商品规格",
+  // },
+
+  // {
+  //   prop: "",
+  //   label: "操作",
+  //   width: "80px",
+  //   fixed: "right",
+  //   _noset_: true,
+  //   _slot_: "operation",
+  // },
+
+]

+ 2 - 0
src/components/search-stock-good-modal/index.js

@@ -0,0 +1,2 @@
+import Main from './main.vue'
+export default Main

+ 177 - 0
src/components/search-stock-good-modal/main.vue

@@ -0,0 +1,177 @@
+<template>
+  <el-dialog
+    :title="'仓库商品选择'"
+    :center="true"
+    align="left"
+    top="8vh"
+    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)"
+    append-to-body
+  >
+    <el-card style="margin-top: -20px" class="modal-form-style">
+      <ex-table
+        v-loading="loading"
+        :table="table"
+        :data="tableData"
+        :columns="columns"
+        :page="pageInfo"
+        :size="size"
+        @page-curr-change="handlePageChange"
+        @page-size-change="handleSizeChange"
+        @screen-reset="
+          pageInfo.curr = 1;
+          parmValue.page = 1;
+          searchList();
+        "
+        @screen-submit="
+          pageInfo.curr = 1;
+          parmValue.page = 1;
+          searchList();
+        "
+      >
+        <template #table-header="{ selection }">
+          <div style="width: 100%">
+            <el-row style="margin-top: -15px">
+              <el-col :span="3" style="width: 66px; float: right">
+                <el-button
+                  :size="searchSize"
+                  type="success"
+                  style="float: right; margin-left: 5px"
+                  @click="resultList(selection)"
+                >
+                  保存
+                </el-button>
+              </el-col>
+            </el-row>
+          </div>
+        </template>
+      </ex-table>
+    </el-card>
+  </el-dialog>
+</template>
+
+<script>
+import asyncRequest from "@/apis/components/search-stock-good-modal";
+import resToken from "@/mixins/resToken";
+import mixinPage from "@/mixins/elPaginationHandle";
+import { mapGetters } from "vuex";
+import columns from "./columns";
+export default {
+  name: "searchStockGoodModal",
+  mixins: [resToken, mixinPage],
+  computed: {
+    ...mapGetters(["tablebtnSize", "searchSize", "size"]),
+  },
+  props: ["showModel", "once", "code"],
+
+  /**
+   * 属性集合
+   * @param {Boolean}       showModel             : 是否弹出弹窗        必填
+   * @param {Boolean}       once                  : 是否只选一条        非必填
+   * @param {Boolean}       code                  : 仓库CODE           非必填
+   */
+  /**
+   * 事件集合
+   * @searchChange             : 选中值变化调用   抛出选中数据
+   */
+  data() {
+    return {
+      options: [],
+      selectLoading: false,
+      loading: true,
+      showModelThis: false,
+      parmValue: {
+        wsm_code: "", //仓库code
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+      },
+      tableData: [],
+      passwordModel: false,
+      passwordModelId: 0,
+      isPasswordDetail: false,
+      // 表格 - 数据
+      tableData: [],
+      // 表格 - 参数
+      table: {
+        stripe: true,
+        border: true,
+        // _defaultHeader_: ["setcol"],
+      },
+      // 表格 - 分页
+      pageInfo: {
+        size: 15,
+        curr: 1,
+        total: 0,
+      },
+      // 表格 - 列参数
+      columns: columns,
+    };
+  },
+  watch: {
+    showModel: function (val) {
+      this.showModelThis = val;
+      if (val) {
+        this.supplierCode = [];
+        this.searchList();
+      }
+    },
+    showModelThis(val) {
+      if (!val) {
+        this.$emit("cancel");
+      }
+    },
+  },
+
+  methods: {
+    closeModel() {
+      console.log("closeModel!!");
+    },
+    restSearch() {
+      this.parmValue = {
+        wsm_code: "", //仓库code
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+      };
+      // 表格 - 分页
+      this.pageInfo = {
+        size: 15,
+        curr: 1,
+        total: 0,
+      };
+      this.searchList();
+    },
+    async searchList() {
+      this.loading = true;
+      this.parmValue.wsm_code = this.code || "";
+      const res = await asyncRequest.list(this.parmValue);
+      if (res && res.code === 0 && res.data) {
+        this.tableData = res.data.list;
+        this.pageInfo.total = Number(res.data.count);
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.tableData = [];
+        this.pageInfo.total = 0;
+      }
+      this.loading = false;
+    },
+    async resultList(selection) {
+      if (selection && selection.length > 1 && this.once) {
+        this.$message.warning("只能选择一条商品信息!");
+        return;
+      }
+      this.showModelThis = false;
+      this.$emit("searchChange", selection);
+    },
+  },
+};
+</script>
+
+<style>
+</style>

+ 0 - 0
src/components/search-stock-good-modal/仓库商品选择


+ 3 - 3
src/views/stock/check/components/addEdit.vue

@@ -289,10 +289,10 @@ export default {
     async initData() {
       const res = await asyncRequest.detail({ id: this.id });
       if (res && res.code === 0 && res.data) {
-        const { status, type, wsm_code,supplierNo,supplier_name } = res.data;
+        const { status, type, wsm_code,code,name } = res.data;
         this.status = status;
-        this.companyCode = supplierNo;
-        this.companyName = supplier_name;
+        this.companyCode = code;
+        this.companyName = name;
         this.ruleForm = {
           wsm_code: [wsm_code],
           type: type,

+ 36 - 3
src/views/stock/check/detail.vue

@@ -4,6 +4,17 @@
       v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
     >
       <add-edit :id="$route.query.id" />
+
+      <exam-form
+        :statusList="statusList"
+        :disabled="false"
+        :isMust="true"
+        @searchChange="examForm"
+      />
+      <button @click="addGood">
+        添加商品
+      </button>
+      <search-stock-good-modal :code="code" :showModel="showModel1" />
     </div>
     <div v-else>
       <no-auth></no-auth>
@@ -13,7 +24,7 @@
    <script>
 import mixinPage from "@/mixins/elPaginationHandle";
 import resToken from "@/mixins/resToken";
-import statusList from "@/assets/js/statusList";
+// import statusList from "@/assets/js/statusList";
 import asyncRequest from "@/apis/service/stock/check/detail";
 import addEdit from "./components/addEdit";
 import { mapGetters } from "vuex";
@@ -40,13 +51,29 @@ export default {
   },
   data() {
     return {
+      code:"WSM9f0r211019102112",
+      showModel1:false,
       sitem: null,
       // 状态
       statusOptions: [
         { id: "0", label: "禁用" },
         { id: "1", label: "启用" },
       ],
-      statusList: statusList,
+      // statusList: statusList,
+      statusList: [
+        {
+          value: "1",
+          label: "label1",
+        },
+        {
+          value: "2",
+          label: "label2",
+        },
+        {
+          value: "3",
+          label: "label3",
+        },
+      ],
       loading: true,
       showModel: false,
       isDetail: false,
@@ -122,6 +149,13 @@ export default {
   },
 
   methods: {
+    examForm(e) {
+      console.log(e);
+    },
+    addGood(){
+      this.showModel1=true
+      // console.log();
+    },
     restSearch() {
       // 表格 - 分页
       this.pageInfo = {
@@ -163,7 +197,6 @@ export default {
               message: "",
             });
 
-        
             this.routeGoto("check", {});
           } else if (res && res.code >= 100 && res.code <= 104) {
             await this.logout();