Sfoglia il codice sorgente

Merge branch 'live' into edit

戴艳蓉 3 anni fa
parent
commit
094a58aaa4

+ 2 - 2
src/App.vue

@@ -16,8 +16,8 @@ export default {
     };
   },
   async created() {
-    const res = await asyncRequest.list({type_code:"WSM8b49211013191450"});
-    console.log(res);
+    // const res = await asyncRequest.list({type_code:"WSM8b49211013191450"});
+    // console.log(res);
     // if (res && res.code === 0 && res.data) {
     //   this.tableData = res.data.list;
     //   this.pageInfo.total = Number(res.data.count);

+ 7 - 0
src/apis/components/serach-good-modal.js

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

+ 1 - 1
src/apis/service/sellOut/consultOrder/index.js

@@ -9,7 +9,7 @@ export default {
   // 分页查询
   list: (data, params) => http(api + "Consultlist", data, "post", params),
   // 详情
-  detail: (data, params) => http(api + "detail", data, "post", params),
+  detail: (data, params) => http(api + "Consultinfo", data, "post", params),
   // 更新
   update: (data, params) => http(api + "update", data, "post", params),
   // 修改状态

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

@@ -0,0 +1,82 @@
+export default [
+  {
+    prop: "good_code",
+    label: "商品编码",
+    width: "150",
+  },
+  {
+    prop: "good_name",
+    label: "商品名称",
+    "min-width": "120",
+  },
+
+  {
+    prop: "gys_code",
+    label: "供应商编码",
+    width: "145",
+  },
+  {
+    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: "brand",
+    label: "品牌",
+    "width": "70",
+  },
+
+  // {
+  //   prop: "classArr",
+  //   label: "商品类别",
+  // },
+  {
+    prop: "color",
+    label: "商品颜色",
+    width: "70",
+  },
+  {
+    prop: "material",
+    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-good-modal/index.js

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

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

@@ -0,0 +1,245 @@
+<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="{}">
+          <div style="width: 100%">
+            <el-row style="padding: 0 0 0 80px">
+              <el-col :span="24">
+                <el-col :span="4" style="width: 120px">
+                  <el-select
+                    :size="searchSize"
+                    v-model="parmValue.status"
+                    filterable
+                    clearable
+                    placeholder="账号状态"
+                    style="width: 100%"
+                    @change="
+                      pageInfo.curr = 1;
+                      parmValue.page = 1;
+                      searchList();
+                    "
+                  >
+                    <el-option
+                      v-for="item in statusList"
+                      :key="'status' + item.code"
+                      :label="item.name"
+                      :value="item.code"
+                    />
+                  </el-select>
+                </el-col>
+                <el-col :span="4" style="width: 150px; padding: 0 0 0 10px">
+                  <el-input
+                    :size="searchSize"
+                    v-model="parmValue.name"
+                    :maxlength="40"
+                    placeholder="业务员姓名"
+                  />
+                </el-col>
+                <el-col :span="4" style="width: 160px; padding: 0 0 0 10px">
+                  <el-input
+                    :size="searchSize"
+                    v-model="parmValue.username"
+                    :maxlength="40"
+                    placeholder="手机号"
+                  />
+                </el-col>
+                <el-col :span="4" style="width: 54px">
+                  <el-button
+                    :size="searchSize"
+                    type="primary"
+                    class="fr"
+                    icon="el-icon-search"
+                    @click="searchList"
+                /></el-col>
+                <el-col :span="4" style="width: 66px">
+                  <el-button
+                    type="warning"
+                    class="fr"
+                    :size="searchSize"
+                    @click="restSearch"
+                  >
+                    重置
+                  </el-button>
+                </el-col>
+                <el-col :span="3" style="width: 66px; float: right">
+                  <el-button
+                    :size="searchSize"
+                    type="primary"
+                    style="float: right; margin-left: 5px"
+                    @click="searchList"
+                  >
+                    刷新
+                  </el-button>
+                </el-col>
+              </el-col>
+            </el-row>
+          </div>
+        </template>
+      </ex-table>
+    </el-card>
+  </el-dialog>
+</template>
+
+<script>
+import asyncRequest from "@/apis/components/serach-good-modal";
+import resToken from "@/mixins/resToken";
+import mixinPage from "@/mixins/elPaginationHandle";
+import setNum from "@/mixins/setNum";
+import statusList from "@/assets/js/statusList";
+import { mapGetters } from "vuex";
+import columns from "./columns";
+export default {
+  name: "searchGoodModal",
+  mixins: [resToken, mixinPage, setNum],
+  computed: {
+    ...mapGetters(["tablebtnSize", "searchSize", "size"]),
+  },
+  props: ["showModel", "supplierNo", "wsmcode"],
+
+  /**
+   * 属性集合
+   * @param {String}        size             : 组件大小            非必填
+   * @param {Array}         value            : 选中值              必填
+   * @param {String}        placeholder      : 提示信息            非必填
+   * @param {Boolean}       isDetail          : 是否是详情逻辑       必填
+   * @param {Boolean}       disabled         : 是否禁用            必填
+   * @param {Boolean}       multiple         : 是否多选            必填
+   * @param {Boolean}       checkStrictly    : 是否选择任意一项     必填
+   *
+   */
+  /**
+   * 事件集合
+   * @searchChange             : 选中值变化调用   抛出选中数据
+   */
+  data() {
+    return {
+      title: "",
+      statusList: statusList,
+      loading: true,
+      showModel: false,
+      isDetail: false,
+      modelId: 0,
+      parmValue: {
+        type_code: "", // 商品属性code
+        supplierNo: "", // 供应商code
+        good_code: "", // 商品编码
+        good_name: "", // 商品名称
+        wsmcode: "", //仓库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) {
+      console.log(val);
+      this.showModelThis = val;
+      if (val) {
+        this.searchList();
+      }
+    },
+    showModelThis(val) {
+      if (!val) {
+        this.$emit("cancel");
+      }
+    },
+  },
+
+  methods: {
+    async selectChange(e) {
+      this.$emit("searchChange", e);
+    },
+    restSearch() {
+      this.parmValue = {
+        type_code: "", // 商品属性code
+        supplierNo: "", // 供应商code
+        good_code: "", // 商品编码
+        good_name: "", // 商品名称
+        wsmcode: "", //仓库code
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+      };
+      this.searchList();
+    },
+    async searchList() {
+      this.loading = true;
+      const res = await asyncRequest.list(this.parmValue);
+      if (res && res.code === 0 && res.data) {
+        this.tableData = res.data.list;
+        // this.tableData.map((v) => {
+        //   // v.sale_price = this.setNum(v.sale_price);
+        //   // v.sale_fee = this.setNum(v.sale_fee);
+        //   // // v.num =
+        //   // //pa (v.sale_price);
+        //   return v;
+        // });
+        //
+        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;
+    },
+  },
+};
+</script>
+
+<style>
+</style>

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


+ 31 - 16
src/components/search-stock/main.vue

@@ -8,8 +8,8 @@
     reserve-keyword
     :size="size || 'medium'"
     style="width: 100%"
-     :placeholder="placeholder||''"
-    :disabled="disabled"
+    :placeholder="placeholder || ''"
+    :disabled="disabled || (isRelation && companyCode === '')"
     :remote-method="remoteMethod"
     :loading="selectLoading"
     @change="selectChange"
@@ -30,14 +30,25 @@ import resToken from "@/mixins/resToken";
 export default {
   name: "SearchStock",
   mixins: [resToken],
-  props: ["size", "value", "placeholder", "isDetail", "disabled", "names"],
+  props: [
+    "size",
+    "value",
+    "placeholder",
+    "isDetail",
+    "disabled",
+    "isRelation",
+    "companyCode",
+    "names",
+  ],
   /**
    * 属性集合
    * @param {String}        size             : 组件大小            非必填
    * @param {Array}         value            : 选中值              必填
    * @param {String}        placeholder      : 提示信息            非必填
-   * @param {Boolean}       ssDetail          : 是否是详情逻辑       必填
+   * @param {Boolean}       ssDetail         : 是否是详情逻辑       必填
    * @param {Boolean}       disabled         : 是否禁用            必填
+   * @param {Boolean}       isRelation       : 是否关联公司        必填
+   * @param {String}        companyCode      : 关联公司code        必填
    * @param {String}        names            : 选中值label         展示详情必填
    */
   /**
@@ -49,14 +60,23 @@ export default {
       options: [],
       selectLoading: false,
       searchName: "",
+      formValue: {
+        page: 1,
+        size: 100,
+        supplierNo: "",
+        wsm_code: "",
+        start: "",
+        end: "",
+        mobile: "",
+        contactor: "",
+      },
     };
   },
   watch: {
-    names: function (val, old) {
-      console.log(val, old);
-      this.searchName = val;
-      if (this.isDetail && this.searchName) {
-        this.remoteMethod(this.searchName);
+    companyCode: function (val, old) {
+      console.log(val);
+      if (this.isRelation && val !== "") {
+        this.remoteMethod(val);
       }
     },
   },
@@ -86,13 +106,8 @@ export default {
       this.selectLoading = true;
       if (query !== "") {
         this.options = [];
-        let formValue = {
-          page: 1,
-          size: 100,
-          stock: query,
-        };
-
-        let res = await asyncRequest.list(formValue);
+        this.formValue.supplierNo = query;
+        let res = await asyncRequest.list(this.formValue);
         if (res && res.code === 0 && res.data) {
           const { list } = res.data;
           this.options = list;

+ 33 - 0
src/styles/index.scss

@@ -502,4 +502,37 @@ aside {
 
 .el-table .success-row {
   background: #f0f9eb !important;
+}
+
+.consultOrder {
+  .modal-form-style {
+    #demo-ruleForm.el-form {
+      .el-row {
+        border-left: 1px solid #ebeef5 !important;
+        border-bottom: 1px solid #ebeef5 !important;
+        .el-col {
+          border-top: 1px solid #ebeef5 !important;
+          border-right: 1px solid #ebeef5 !important;
+          .el-form-item {
+            margin: 0 !important;
+          
+            // >.el-form-item__label {
+            //   border-right: 1px solid #ebeef5 !important;
+            // }
+          }
+            label.el-form-item__label {
+              background: #fafafa !important;
+              font-weight: 400!important;
+              color: #909399!important;
+              border-right: 1px solid #ebeef5 !important;
+            }
+            .el-form-item__content{
+              padding:0 0 0 12px!important;
+              color: #606266!important;
+            }
+           
+        }
+      }
+    }
+  }
 }

+ 39 - 457
src/views/sellOut/consultOrder/addEdit.vue

@@ -13,289 +13,41 @@
     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">
-          <el-form
-            ref="ruleForm"
-            :model="ruleForm"
-            status-icon
-            :rules="rulesThis"
-            label-width="100px"
-            class="demo-ruleForm"
-          >
-            <div style="padding: 0 0 12px 0">
-              <el-divider content-position="center">仓库信息</el-divider>
-            </div>
-
-            <el-row>
-              <el-col :span="12"
-                ><el-form-item
-                  label="所属公司"
-                  prop="supplierNo"
-                  style="width: 100%"
-                >
-                  <search-supplier
-                    :value="ruleForm.supplierNo"
-                    :names="supplier_name"
-                    :is-detail="id !== 'add'"
-                    :disabled="isDetail"
-                    :placeholder="'请输入公司名称'"
-                    @searchChange="supplierChange"
-                  />
-                </el-form-item>
-              </el-col>
-              <el-col :span="12">
-                <el-form-item label="仓库名称" prop="name">
-                  <el-input
-                    placeholder="请输入仓库名称"
-                    filterable
-                    :disabled="isDetail"
-                    maxlength="20"
-                    clearable
-                    v-model="ruleForm.name"
-                  >
-                  </el-input>
-                </el-form-item>
-              </el-col>
-            </el-row>
-
-            <el-row>
-              <el-col :span="12">
-                <el-form-item
-                  label="负责人"
-                  prop="contactor"
-                  style="width: 100%"
-                >
-                  <search-account
-                    :size="searchSize"
-                    :value="ruleForm.contactor"
-                    :placeholder="'请输入负责人'"
-                    :is-detail="id !== 'add'"
-                    :disabled="isDetail"
-                    :names="accountNames"
-                    @searchChange="accountChange"
-                  /> </el-form-item
-              ></el-col>
-              <el-col :span="12">
-                <el-form-item label="负责人电话" prop="mobile">
-                  <el-input
-                    placeholder="请输入联系人电话"
-                    v-model="ruleForm.mobile"
-                    maxlength="11"
-                    clearable
-                    :disabled="isDetail"
-                  >
-                  </el-input> </el-form-item
-              ></el-col>
-            </el-row>
-            <el-row>
-              <el-col :span="12">
-                <el-form-item label="省/市/区" prop="addr_code">
-                  <select-area
-                    :placeholder="'请选择省/市/区'"
-                    :value="ruleForm.addr_code"
-                    :is-detail="id !== 'add'"
-                    :disabled="isDetail"
-                    @selectChange="selectAreaAddr_code"
-                  />
-                </el-form-item>
-              </el-col>
-              <el-col :span="12">
-                <el-form-item label="详细地址" prop="addr">
-                  <el-input
-                    placeholder="请输入详细地址"
-                    v-model="ruleForm.addr"
-                    maxlength="100"
-                    clearable
-                    :disabled="isDetail"
-                  >
-                  </el-input>
-                </el-form-item>
-              </el-col>
-            </el-row>
-            <div style="padding: 0 0 12px 0">
-              <el-divider content-position="center">收发货信息</el-divider>
-            </div>
-            <el-row>
-              <el-col :span="12">
-                <el-form-item label="联系人" prop="wsm_name">
-                  <el-input
-                    placeholder="请填写联系人"
-                    maxlength="20"
-                    :disabled="isDetail"
-                    v-model="ruleForm.wsm_name"
-                    clearable
-                  >
-                  </el-input> </el-form-item
-              ></el-col>
-              <el-col :span="12">
-                <el-form-item label="电话" prop="wsm_mobile">
-                  <el-input
-                    placeholder="请输入联系人电话"
-                    v-model="ruleForm.wsm_mobile"
-                    maxlength="11"
-                    :disabled="isDetail"
-                    clearable
-                  >
-                  </el-input> </el-form-item
-              ></el-col>
-            </el-row>
-
-            <el-row>
-              <el-col :span="12">
-                <el-form-item label="省/市/区" prop="addrs_code">
-                  <select-area
-                    :is-detail="id !== 'add'"
-                    :disabled="isDetail"
-                    :value="ruleForm.addrs_code"
-                    :placeholder="'请选择省/市/区'"
-                    @selectChange="selectAreaAddrs_code"
-                  /> </el-form-item
-              ></el-col>
-              <el-col :span="12">
-                <el-form-item label="详细地址" prop="wsm_addr">
-                  <el-input
-                    placeholder="请输入详细地址"
-                    maxlength="100"
-                    :disabled="isDetail"
-                    v-model="ruleForm.wsm_addr"
-                    clearable
-                  >
-                  </el-input> </el-form-item
-              ></el-col>
-            </el-row>
-          </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 style="margin-top: -20px" class="modal-form-style">
+      <el-form
+        ref="ruleForm"
+        :model="ruleForm"
+        status-icon
+        :rules="rulesThis"
+        label-width="110px"
+        id="demo-ruleForm"
+      >
+        <el-row v-if="ruleForm !== null">
+          <el-col v-for="item in columns" :key="item.prop" :span="item.col">
+            <el-form-item :label="item.label + ':'">
+              <div>{{ ruleForm[item.prop] }}{{ item.unit }}</div>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
     </el-card>
   </el-dialog>
 </template>
    <script>
 import asyncRequest from "@/apis/service/sellOut/consultOrder";
 import resToken from "@/mixins/resToken";
+import setNum from "@/mixins/setNum";
+import columns from "./columnsForm";
 export default {
-  name: "storeSet",
+  name: "consultOrder",
   props: ["showModel", "id", "isDetail"],
-  mixins: [resToken],
+  mixins: [resToken, setNum],
   data() {
     return {
-      supplier_name: "",
-      accountNames:"",
       loading: false,
-      title: "添加仓库",
       showModelThis: this.showModel,
-      ruleForm: {
-        name: "", // 仓库名称
-        supplierNo: [], //供应商编码
-        // wsmtype: "", //仓库类型 目前随便填
-        addr_code: [], //仓库省市区
-        addr: "", //仓库详细地址
-        contactor: [], //仓库联系人
-        mobile: "", //仓库联系方式
-        // position: "", //联系人职位  目前随便填
-        // wsm_type: "", //目前随便填
-
-        wsm_name: "", //收发货联系人
-        wsm_mobile: "", //收发货联系方式
-        wsm_addr: "", //收发货地址详细
-        addrs_code: [], //收发货省市区
-      },
-      rulesThis: this.rules,
-      rules: {
-        name: [
-          { required: true, message: "请输入仓库名称", trigger: "blur" },
-          {
-            min: 1,
-            max: 20,
-            message: "长度在 1 到 20 个字符",
-            trigger: "blur",
-          },
-        ],
-        supplierNo: [
-          {
-            type: "array",
-            required: true,
-            message: "请选择供应商公司",
-            trigger: "change",
-          },
-        ],
-        addr_code: [
-          {
-            type: "array",
-            required: true,
-            message: "请选择仓库所在省/市/区",
-            trigger: "change",
-          },
-        ],
-        addr: [
-          { required: true, message: "请输入仓库详细地址", trigger: "blur" },
-          {
-            min: 1,
-            max: 100,
-            message: "长度在 1 到 100 个字符",
-            trigger: "blur",
-          },
-        ],
-
-        contactor: [
-          {
-            required: true,
-            type: "array",
-            message: "请选择仓库负责人",
-            trigger: "change",
-          },
-        ],
-
-        mobile: [
-          {
-            required: true,
-            // validator: validatemobile,
-            trigger: "blur",
-          },
-        ],
-        wsm_name: [
-          { required: true, message: "请输入收发货联系人", trigger: "blur" },
-          {
-            min: 1,
-            max: 20,
-            message: "长度在 1 到 20 个字符",
-            trigger: "blur",
-          },
-        ],
-        wsm_mobile: [
-          {
-            required: true,
-            // validator: validatewsmmobile,
-            trigger: "blur",
-          },
-        ],
-        addrs_code: [
-          {
-            type: "array",
-            required: true,
-            message: "请选择收发货所在省/市/区",
-            trigger: "change",
-          },
-        ],
-        wsm_addr: [
-          { required: true, message: "请输入收发货详细地址", trigger: "blur" },
-          {
-            min: 1,
-            max: 100,
-            message: "长度在 1 到 100 个字符",
-            trigger: "blur",
-          },
-        ],
-      },
+      columns: columns,
+      ruleForm: null,
     };
   },
   watch: {
@@ -315,95 +67,27 @@ export default {
     closeModel() {
       console.log("closeModel!!");
     },
-    //供应商公司选择
-    supplierChange(e) {
-      if (e && e.id) {
-        this.ruleForm.supplierNo = [e.code]; //供应商编码
-      } else {
-        this.ruleForm.supplierNo = [];
-      }
-      this.$refs.ruleForm.validateField("supplierNo");
-    },
-    //仓库省市区
-    selectAreaAddr_code(e) {
-      this.ruleForm.addr_code = e;
-      this.$refs.ruleForm.validateField("addr_code");
-    },
-    //收发货省市区
-    selectAreaAddrs_code(e) {
-      this.ruleForm.addrs_code = e;
-      this.$refs.ruleForm.validateField("addrs_code");
-    },
-    //负责人选择
-    accountChange(e) {
-      if (e && e.id) {
-        this.ruleForm.contactor = [e.id];
-      } else {
-        this.ruleForm.contactor = [];
-      }
-      this.$refs.ruleForm.validateField("contactor");
-    },
     async initForm() {
-      this.supplier_name = "";
       this.loading = true;
-      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();
-        await this.initData();
-      }
+      await this.resetForm();
+      await this.initData();
       this.loading = false;
     },
     async initData() {
       const res = await asyncRequest.detail({ id: this.id });
       if (res && res.code === 0 && res.data) {
-        const {
-          addr,
-          addr_code,
-          addrs_code,
-          contactor,
-          contactor_name,
-          mobile,
-          name,
-          supplierNo,
-          supplier_name,
-          wsm_addr,
-          wsm_code,
-          wsm_mobile,
-          wsm_name,
-        } = res.data;
-
-        this.supplier_name = supplier_name;
-        this.accountNames = contactor_name
-        this.ruleForm = {
-          name: name, // 仓库名称
-          supplierNo: [supplierNo], //供应商编码
-          // wsmtype: "", //仓库类型 目前随便填
-          addr_code: this.getCode(addr_code), //仓库省市区
-          addr: addr, //仓库详细地址
-          contactor: contactor ? [contactor] : [], //仓库联系人
-          mobile: mobile, //仓库联系方式
-          // position: "", //联系人职位  目前随便填
-          // wsm_type: "", //目前随便填
-
-          wsm_name: wsm_name, //收发货联系人
-          wsm_mobile: wsm_mobile, //收发货联系方式
-          wsm_addr: wsm_addr, //收发货地址详细
-          addrs_code: this.getCode(addrs_code), //收发货省市区
-        };
-        console.log(this.ruleForm);
-
-        // this.ruleForm = res.data;
-        // this.ruleForm.role_id = this.ruleForm.role;
+        this.ruleForm = res.data;
+        this.ruleForm.mark_fee = this.setNum(this.ruleForm.mark_fee);
+        this.ruleForm.cert_fee = this.setNum(this.ruleForm.cert_fee);
+        this.ruleForm.package_fee = this.setNum(this.ruleForm.package_fee);
+        this.ruleForm.open_fee = this.setNum(this.ruleForm.open_fee);
+        this.ruleForm.cost_fee = this.setNum(this.ruleForm.cost_fee);
+        this.ruleForm.delivery_fee = this.setNum(this.ruleForm.delivery_fee);
+        this.ruleForm.sale_craft = this.setNum(this.ruleForm.sale_craft);
+        this.ruleForm.total_fee = this.setNum(this.ruleForm.total_fee);
+        this.ruleForm.sale_price = this.setNum(this.ruleForm.sale_price);
+        this.ruleForm.sale_fee = this.setNum(this.ruleForm.sale_fee);
+        this.ruleForm.bare_fee = this.setNum(this.ruleForm.bare_fee);
       } else if (res && res.code >= 100 && res.code <= 104) {
         await this.logout();
       } else {
@@ -416,112 +100,10 @@ export default {
         if (this.$refs.ruleForm) {
           this.$refs.ruleForm.resetFields();
           this.$refs.ruleForm.clearValidate();
-          this.supplier_name = "";
-          this.accountNames = "";
-          this.ruleForm = {
-            name: "测试测试", // 仓库名称
-            supplierNo: [], //供应商编码
-            // wsmtype: "", //仓库类型 目前随便填
-            addr_code: [], //仓库省市区
-            addr: "测试地址测试地址", //仓库详细地址
-            contactor: [], //仓库联系人
-            mobile: "1989898977", //仓库联系方式
-            // position: "", //联系人职位  目前随便填
-            // wsm_type: "", //目前随便填
-
-            wsm_name: "张三", //收发货联系人
-            wsm_mobile: "19888888888", //收发货联系方式
-            wsm_addr: "测试1", //收发货地址详细
-            addrs_code: [], //收发货省市区
-          };
-        }
-      });
-    },
-    setCode(list) {
-      let model = {
-        provice_code: list[0],
-        city_code: list[1],
-        area_code: list[2],
-      };
-      return model;
-    },
-    getCode(obj) {
-      let arr = [];
-      arr.push(obj.provice_code);
-      arr.push(obj.city_code);
-      arr.push(obj.area_code);
-      return arr;
-    },
-    getId(list) {
-      let arr = JSON.parse(JSON.stringify(list));
-      return arr.join(",");
-    },
-    async submitForm() {
-      await this.$refs.ruleForm.validate(async (valid) => {
-        if (valid) {
-          this.loading = true;
-          const {
-            name,
-            supplierNo,
-            addr_code,
-            addr,
-            contactor,
-            mobile,
-            wsm_name,
-            wsm_mobile,
-            wsm_addr,
-            addrs_code,
-          } = JSON.parse(JSON.stringify(this.ruleForm));
-          const model = {
-            id: this.id,
-            name,
-            supplierNo: this.getId(supplierNo),
-            addr_code: this.setCode(addr_code),
-            addr,
-            contactor: this.getId(contactor),
-            mobile,
-            wsm_name,
-            wsm_mobile,
-            wsm_addr,
-            addrs_code: this.setCode(addrs_code),
-            position: "1", //暂时随便填
-            wsm_type: "1", //后台暂时不用
-            wsmtype: "1", //后台暂时不用
-          };
-          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;
+          this.ruleForm = null;
         }
       });
     },
   },
 };
-</script>
-
-   <style lang="scss" scoped>
-.storeSet {
-}
-</style>
-   
+</script>

+ 314 - 0
src/views/sellOut/consultOrder/columnsForm.js

@@ -0,0 +1,314 @@
+export default [
+    // {
+    //     prop: "name",
+    //     label: "数据标题",
+    //     col: "8",
+    // },
+    {
+        prop: "sequenceNo",
+        label: "单据号",
+        col: "8",
+    },
+    {
+        prop: "cpzxNo",
+        label: "产品咨询单号",
+        col: "8",
+    },
+    {
+        prop: "salesman",
+        label: "申请人",
+        col: "8",
+    },
+    {
+        prop: "saler",
+        label: "采购人员",
+        col: "8",
+    },
+
+    {
+        prop: "brank",
+        label: "品牌",
+        col: "8",
+    },
+
+    {
+        prop: "cat_f",
+        label: "一级分类",
+        col: "8",
+    },
+    {
+        prop: "cat_s",
+        label: "二级分类",
+        col: "8",
+    },
+
+    {
+        prop: "wsm_type",
+        label: "库房性质",
+        col: "8",
+    },
+    {
+        prop: "model",
+        label: "型号",
+        col: "8",
+    },
+    {
+        prop: "khNo",
+        label: "客户编码",
+        col: "8",
+    },
+    {
+        prop: "khname",
+        label: "客户名称", 
+        col: "16",
+    },
+    {
+        prop: "cpNo",
+        label: "产品编码",
+        col: "8",
+    },
+    {
+        prop: "cpName",
+        label: "产品名称",
+        col: "16",
+    },
+
+
+    {
+        prop: "material",
+        label: "材质",
+        col: "8",
+    },
+    {
+        prop: "color",
+        label: "颜色",
+        col: "8",
+    },
+    {
+        prop: "unit",
+        label: "单位",
+        col: "8",
+    },
+    {
+        prop: "zxNo",
+        label: "咨询单号",
+        col: "8",
+    },
+    {
+        prop: "zxtime",
+        label: "咨询日期",
+        col: "8",
+    },
+    {
+        prop: "zxtype",
+        label: "咨询类型",
+        col: "8",
+    },
+    {
+        prop: "specs",
+        label: "规格",
+        col: "8",
+    },
+    {
+        prop: "desc",
+        label: "工艺说明",
+        col: "8",
+    },
+    {
+        prop: "metals",
+        label: "贵金属种类",
+        col: "8",
+    },
+    {
+        prop: "is_diff",
+        label: "是否有公差",
+        col: "8",
+    },
+    {
+        prop: "delivery_day",
+        label: "物流时间",
+        unit: "天",
+        col: "8",
+    },
+    {
+        prop: "work_day",
+        label: "产品工期",
+        unit: "天",
+        col: "8",
+    },
+    {
+        prop: "expiry_day",
+        label: "信息有效期",
+        unit: "天",
+        col: "8",
+    },
+    // {
+    //     prop: "min_num",
+    //     label: "最低一次一地起订量",
+    //     col: "8",
+    // },
+    // {
+    //     prop: "delivery_way",
+    //     label: "发货方式",
+    //     col: "8",
+    // },
+    {
+        prop: "mark_fee",
+        label: "加标费",
+        col: "8",
+    },
+    {
+        prop: "cert_fee",
+        label: "证书费",
+        col: "8",
+    },
+    {
+        prop: "package_fee",
+        label: "包装费",
+        col: "8",
+    },
+    {
+        prop: "open_fee",
+        label: "开模费",
+        col: "8",
+    },
+
+    {
+        prop: "cost_fee",
+        label: "成本工艺费",
+        col: "8",
+    },
+    {
+        prop: "delivery_fee",
+        label: "物流费",
+        col: "8",
+    },
+    // {
+    //     prop: "bare_fee",
+    //     label: "产品裸价",
+    //     col: "8",
+    // },
+    {
+        prop: "total_fee",
+        label: "成本合计",
+        col: "8",
+    },
+    // {
+    //     prop: "gold_price",
+    //     label: "当日进价",
+    //     col: "8",
+    // },
+
+    {
+        prop: "weight",
+        label: "商品重量",
+        unit: "g",
+        col: "8",
+    },
+
+    {
+        prop: "pay_way",
+        label: "付款方式",
+        col: "8",
+    },
+    {
+        prop: "tax",
+        label: "税点",
+        col: "8",
+    },
+
+    // {
+    //     prop: "addr",
+    //     label: "产品所在地",
+    //     col: "8",
+    // },
+
+    {
+        prop: "sale_craft",
+        label: "销售工艺费",
+        col: "8",
+    },
+
+    {
+        prop: "sale_price",
+        label: "采购定价",
+        col: "8",
+    },
+
+    // {
+    //     prop: "cgremark",
+    //     label: "采购备注",
+    //     col: "8",
+    // },
+
+    {
+        prop: "num",
+        label: "需求数量",
+        col: "8",
+    },
+    {
+        prop: "sale_fee",
+        label: "最终销售单价",
+        col: "8",
+    },
+    // {
+    //     prop: "cfNo",
+    //     label: "采反单号",
+    //     col: "8",
+    // },
+    // {
+    //     prop: "cfDate",
+    //     label: "采反日期",
+    //     col: "8",
+    // },
+
+
+    // {
+    //     prop: "proname",
+    //     label: "项目名称",
+    //     col: "8",
+    // },
+    // {
+    //     prop: "scheme_name",
+    //     label: "方案名称",
+    //     col: "8",
+    // },
+
+
+    // {
+    //     prop: "sale_remark",
+    //     label: "采购备注",
+    //     col: "8",
+    // },
+
+    // {
+    //     prop: "gysNo",
+    //     label: "供应商编码",
+    //     col: "8",
+    // },
+    // {
+    //     prop: "gysname",
+    //     label: "供应商名称",
+    //     col: "8",
+    // },
+    // {
+    //     prop: "status",
+    //     label: "状态",
+    //     col: "8",
+    // },
+    // {
+    //     prop: "is_del",
+    //     label: "是否删除",
+    //     col: "8",
+    // },
+    // {
+    //     prop: "addtime",
+    //     label: "添加时间",
+    //     col: "8",
+    // },
+    // {
+    //     prop: "updatetime",
+    //     label: "更新时间",
+    //     col: "8",
+    // },
+]

+ 0 - 362
src/views/stock/check/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/stock/check";
-   import resToken from "@/mixins/resToken";
-   import {
-    isnumber,
-    isMobile,
-    validEmail,
-    isAlphanumeric,
-    isChinese,
-    isEmoticon,
-    validAlphabets,
-  } from "@/utils/validate";
-   export default {
-    name: 'check',
-    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>
-   .check {
-    
-   }
-   </style>
-   

+ 67 - 0
src/views/stock/check/addModel.vue

@@ -0,0 +1,67 @@
+<template>
+  <el-dialog
+    title="新建盘点"
+    :center="true"
+    align="left"
+    top="15vh"
+    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">
+      <add-edit v-if="showModelThis" :id="id" />
+    </el-card>
+  </el-dialog>
+</template>
+   <script>
+import addEdit from "./components/addEdit.vue";
+export default {
+  name: "addModel",
+  props: ["showModel", "id"],
+  components: {
+    addEdit,
+  },
+  data() {
+    return {
+      formId: "",
+      loading: false,
+      showModelThis: this.showModel,
+    };
+  },
+  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.formId = this.id;
+      this.loading = false;
+    },
+  },
+};
+</script>
+
+   <style lang="scss" scoped>
+.check {
+}
+</style>
+   

+ 325 - 0
src/views/stock/check/components/addEdit.vue

@@ -0,0 +1,325 @@
+<template>
+  <el-form
+    :model="ruleForm"
+    status-icon
+    :rules="rulesThis"
+    ref="ruleForm"
+    label-width="80px"
+    class="demo-ruleForm"
+  >
+    <el-row>
+      <el-col :span="12">
+        <el-form-item label="盘点公司" prop="wsm_supplier">
+          <search-supplier
+            :value="ruleForm.wsm_supplier"
+            :placeholder="'请选择盘点公司'"
+            @searchChange="supplierChange"
+          />
+        </el-form-item>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item label="盘点仓库" prop="wsm_code">
+          <search-stock
+            :value="ruleForm.wsm_code"
+            :isDetail="true"
+            :placeholder="'请选择盘点仓库'"
+            :isRelation="true"
+            :companyCode="companyCode"
+            :names="''"
+            @searchChange="stockChange"
+          />
+        </el-form-item>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item label="盘点类型" prop="type">
+          <el-select
+            v-model="ruleForm.type"
+            placeholder="请选择盘点类型"
+            style="width: 100%"
+          >
+            <el-option
+              v-for="item in typeList"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+      </el-col>
+      <el-col :span="24" v-if="ruleForm.type !== '1'">
+        <el-form-item label="盘点商品" size="'mini'" prop="good_type_code">
+          <el-table
+            :data="ruleForm.good_type_code"
+            border
+            :size="'mini'"
+            max-height="400"
+            style="width: 100%"
+          >
+            <el-table-column
+              v-for="item in columns"
+              :key="item.prop"
+              :prop="item.prop"
+              :label="item.label"
+            >
+            </el-table-column>
+            <el-table-column align="right">
+              <template slot="header" slot-scope="scope">
+                <el-button
+                  @click="cliacasss()"
+                  :size="'mini'"
+                  type="primary"
+                  style="float: right; margin-left: 5px"
+                  >添加商品
+                </el-button>
+              </template>
+              <template slot-scope="scope">
+                <el-tooltip effect="dark" content="删除" placement="top">
+                  <i
+                    class="el-icon-delete tb-icon"
+                    @click="deleteById(scope.$index)"
+                  ></i>
+                </el-tooltip>
+              </template>
+            </el-table-column>
+          </el-table>
+
+          <search-good-modal :show-model="showGoodsModel" />
+        </el-form-item>
+      </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-form>
+</template>
+   <script>
+import asyncRequest from "@/apis/service/stock/check";
+import resToken from "@/mixins/resToken";
+import {
+  isnumber,
+  isMobile,
+  validEmail,
+  isAlphanumeric,
+  isChinese,
+  isEmoticon,
+  validAlphabets,
+} from "@/utils/validate";
+import stockSearch from "../../allotFlow/components/stockSearch.vue";
+export default {
+  components: { stockSearch },
+  name: "addEdit",
+  props: ["showModel", "id"],
+  mixins: [resToken],
+  data() {
+    return {
+      companyCode: "",
+      loading: false,
+      showGoodsModel: false,
+      typeList: [
+        {
+          value: "1",
+          label: "全盘",
+        },
+        {
+          value: "2",
+          label: "抽盘",
+        },
+      ],
+      showModelThis: this.showModel,
+      columns: [
+        {
+          prop: "code",
+          label: "商品编码",
+        },
+        {
+          prop: "code1",
+          label: "商品编码1",
+        },
+        {
+          prop: "code2",
+          label: "商品编码2",
+        },
+        {
+          prop: "code3",
+          label: "商品编码3",
+        },
+      ],
+      ruleForm: {
+        wsm_supplier: [], //供应商
+        wsm_code: [], // 盘点仓库
+        type: "1", // 盘点类型
+        good_type_code: [], //商品列表
+      },
+      rulesThis: this.rules,
+      rules: {
+        wsm_supplier: [
+          {
+            type: "array",
+            required: true,
+            message: "请选择盘点公司",
+            trigger: "change",
+          },
+        ],
+        wsm_code: [
+          {
+            type: "array",
+            required: true,
+            message: "请选择盘点仓库",
+            trigger: "change",
+          },
+        ],
+        type: [
+          {
+            required: true,
+            message: "请选择盘点类型",
+            trigger: "change",
+          },
+        ],
+
+        good_type_code: [
+          {
+            type: "array",
+            required: true,
+            message: "请选择盘点商品",
+            trigger: "change",
+          },
+        ],
+      },
+    };
+  },
+  created() {
+    this.initForm();
+  },
+  methods: {
+    closeModel() {
+      console.log("closeModel!!");
+    },
+    cliacasss() {
+      this.showGoodsModel = true;
+      console.log(this.showGoodsModel);
+    },
+    //供应商选择
+    supplierChange(e) {
+      if (e && e.id) {
+        this.ruleForm.wsm_supplier = [e.code];
+        this.companyCode = e.code;
+      } else {
+        this.ruleForm.wsm_supplier = [];
+        this.companyCode = "";
+      }
+      this.$refs.ruleForm.validateField("wsm_supplier");
+    },
+    //仓库选择
+    stockChange(e) {
+      if (e && e.id) {
+        this.ruleForm.wsm_code = [e.code];
+      } else {
+        this.ruleForm.wsm_code = [];
+      }
+      this.$refs.ruleForm.validateField("wsm_code");
+    },
+    deleteById(index) {},
+    async initForm() {
+      console.log(this.id);
+      this.loading = true;
+      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 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() {
+      // 重置
+      await this.$nextTick(() => {
+        if (this.$refs.ruleForm) {
+          this.$refs.ruleForm.resetFields();
+          this.$refs.ruleForm.clearValidate();
+
+          this.ruleForm = {
+            wsm_supplier: [], // 盘点公司
+            wsm_code: [], // 盘点仓库
+            type: "1", // 真实姓名
+            good_type_code: [], //商品列表
+          };
+        }
+      });
+    },
+
+    async submitForm() {
+      await this.$refs.ruleForm.validate(async (valid) => {
+        if (valid) {
+          this.loading = true;
+          const { wsm_code, type, good_type_code } = JSON.parse(
+            JSON.stringify(this.ruleForm)
+          );
+          const model = {
+            id: this.id,
+            wsm_code: wsm_code || [], // 盘点仓库
+            type: type || "", // 盘点类型
+            good_type_code: good_type_code || "", //商品列表
+          };
+          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>
+.check {
+}
+</style>
+   

+ 18 - 10
src/views/stock/check/index.vue

@@ -73,10 +73,7 @@
                     icon="el-icon-search"
                     @click="searchList"
                 /></el-col>
-                <el-col
-                  :span="4"
-                  style="width: 66px"
-                >
+                <el-col :span="4" style="width: 66px">
                   <el-button
                     type="warning"
                     class="fr"
@@ -86,17 +83,28 @@
                     重置
                   </el-button>
                 </el-col>
+                <el-col :span="3" style="width: 66px; float: right">
+                  <el-button
+                    :size="searchSize"
+                    type="primary"
+                    style="float: right; margin-left: 5px"
+                    @click="searchList"
+                  >
+                    刷新
+                  </el-button>
+                </el-col>
                 <el-col
                   :span="3"
                   style="width: 66px; float: right"
+                  v-if="powers.some((item) => item == '003')"
                 >
                   <el-button
+                    @click="openModal('add', false, {})"
                     :size="searchSize"
-                    type="primary"
+                    type="success"
                     style="float: right; margin-left: 5px"
-                    @click="searchList"
                   >
-                    刷新
+                    添加
                   </el-button>
                 </el-col>
               </el-col>
@@ -176,7 +184,7 @@
           </el-tooltip>
         </template>
       </ex-table>
-      <add-edit
+      <add-model
         :id="modelId"
         :sitem="sitem"
         :show-model="showModel"
@@ -195,14 +203,14 @@ import mixinPage from "@/mixins/elPaginationHandle";
 import resToken from "@/mixins/resToken";
 import statusList from "@/assets/js/statusList";
 import asyncRequest from "@/apis/service/stock/check";
-import addEdit from "./addEdit";
+import addModel from "./addModel";
 import { mapGetters } from "vuex";
 
 export default {
   name: "check",
   mixins: [mixinPage, resToken],
   components: {
-    addEdit,
+    addModel,
   },
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),