戴艳蓉 3 years ago
parent
commit
8107ee300e

+ 40 - 29
src/components/exam-form/main.vue

@@ -5,32 +5,33 @@
     :model="ruleForm"
     status-icon
     :rules="rulesThis"
-    label-width="100px"
+    :label-width="labelWidth || '100px'"
     class="demo-ruleForm"
     :size="size || 'medium'"
   >
     <el-row>
-      <el-col :span="12"
+      <el-col :span="11"
         ><el-form-item label="审核状态" prop="state">
-          <el-select
+          <el-radio-group
             v-model="ruleForm.state"
             placeholder="请选择审核状态"
             style="width: 100%"
             :size="size || 'medium'"
             @change="stateChange"
           >
-            <el-option
+            <el-radio
               v-for="item in stateList"
               :key="item.value"
-              :label="item.label"
-              :value="item.value"
+              :label="item.value"
+              >{{ item.label }}</el-radio
             >
-            </el-option>
-          </el-select>
+          </el-radio-group>
         </el-form-item>
-      </el-col>
-      <el-col :span="12" v-if="ruleForm.state === '0'">
-        <el-form-item label="驳回节点" prop="rebut">
+        <el-form-item
+          label="驳回节点"
+          v-if="ruleForm.state === '0' && isMust"
+          prop="rebut"
+        >
           <el-select
             v-model="ruleForm.rebut"
             placeholder="请选择驳回节点"
@@ -48,30 +49,40 @@
           </el-select>
         </el-form-item>
       </el-col>
+      <el-col :span="12">
+        <el-form-item
+          label="审核备注"
+          v-if="ruleForm.state === '0'"
+          prop="remark"
+        >
+          <el-input
+            type="textarea"
+            placeholder="请输入审核备注"
+            v-model="ruleForm.remark"
+            :disabled="disabled"
+            maxlength="250"
+            :autosize="{ minRows: 3, maxRows: 3 }"
+            show-word-limit
+          />
+        </el-form-item>
+        <el-form-item class="fr">
+          <el-button
+            v-if="!isDetail"
+            :size="'mini'"
+            type="primary"
+            @click="submitForm"
+            >保 存
+          </el-button>
+        </el-form-item>
+      </el-col>
     </el-row>
-    <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",
-  props: ["size", "statusList", "disabled", "isMust"],
+  props: ["size", "statusList", "disabled", "isMust", "labelWidth"],
   /**
    * 属性集合
    * @param {String}        size             : 组件大小             非必填
@@ -121,7 +132,7 @@ export default {
           },
         ],
         remark: [
-          { required: true, message: "请输入仓库详细地址", trigger: "blur" },
+          { required: true, message: "请输入审核备注", trigger: "blur" },
           {
             min: 1,
             max: 250,

+ 8 - 2
src/views/stock/check/addModel.vue

@@ -15,7 +15,13 @@
     append-to-body
   >
     <el-card style="margin-top: -20px">
-      <add-edit v-if="showModelThis" :id="id" @closeModel="closeModel" @refresh="refresh"/>
+      <add-edit
+        v-if="showModelThis"
+        :id="id"
+        @closeModel="closeModel"
+        :sitem="{}"
+        @refresh="refresh"
+      />
     </el-card>
   </el-dialog>
 </template>
@@ -45,7 +51,7 @@ export default {
     },
   },
   methods: {
-     closeModel() {
+    closeModel() {
       console.log("closeModel!!");
       this.showModelThis = false;
     },

+ 16 - 191
src/views/stock/check/components/addEdit.vue

@@ -72,42 +72,13 @@
           <el-button
             type="primary"
             @click="submitForm"
+            :size="'mini'"
             v-if="
               id === 'add' ||
               (status === '0' && powers.some((item) => item == '005'))
             "
             >保 存
           </el-button>
-          <el-button
-            type="primary"
-            plain
-            @click="statusConfirm('1', '发起审核流程')"
-            v-if="status === '0' && powers.some((item) => item == '012')"
-            >发起审核流程
-          </el-button>
-
-          <el-button
-            type="primary"
-            @click="statusConfirm('-2', '导出盘点商品')"
-            v-if="status === '1' && powers.some((item) => item == '014')"
-            >导出盘点商品
-          </el-button>
-          <el-button
-            @click="statusConfirm('0', '取消审核流程')"
-            plain
-            v-if="status === '1' && powers.some((item) => item == '014')"
-            >取消审核流程</el-button
-          >
-          <el-button
-            @click="statusConfirm('-1', '作废该条信息')"
-            type="danger"
-            plain
-            v-if="
-              (status === '0' || status === '1') &&
-              powers.some((item) => item == '015')
-            "
-            >作废该条信息</el-button
-          >
         </el-col>
       </el-row>
     </el-form>
@@ -121,12 +92,11 @@
    <script>
 import asyncRequest from "@/apis/service/stock/check/detail";
 import resToken from "@/mixins/resToken";
-import { getToken } from "@/utils/auth";
-import urlConfig from "@/apis/url-config";
+
 import columns from "./columns";
 export default {
   name: "addEdit",
-  props: ["id"],
+  props: ["id", "sitem", "newTime"],
   mixins: [resToken],
   computed: {
     powers() {
@@ -147,7 +117,6 @@ export default {
       companyCode: "",
       companyName: "",
       loading: false,
-      fileUrl: urlConfig.baseURL,
       showGoodsModel: false,
       typeList: [
         {
@@ -198,8 +167,7 @@ export default {
     this.initForm();
   },
   watch: {
-    id: function (val) {
-      // console.log(val);
+    newTime: function (val) {
       if (val) {
         this.initForm();
       }
@@ -209,109 +177,7 @@ export default {
     closeModel() {
       console.log("closeModel!!");
     },
-    async statusConfirm(status, message) {
-      await this.$confirm(`确定要${message}?`, {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      })
-        .then(async () => {
-          if (status === "-1") {
-            await this.deleteById(message);
-          } else if (status === "-2") {
-            await this.exportGood(message);
-          } else {
-            await this.setStatus(status, message);
-          }
-        })
-        .catch(() => {
-          console.log("取消");
-        });
-    },
-
-    async exportGood(message) {
-      if (!this.loading) {
-        // console.log(urlConfig);
-        this.loading = true;
-        axios({ 
-          method: "post",
-          url: this.fileUrl + "admin/checkexport",
-          responseType: "blob",
-          data: { id: this.id, token: getToken() },
-          headers: {
-            Accept:`aplication/zip`,
-          },
-        })
-          .then((res) => {
-            if (res && res.status == 200 && res.data) {
-              let blob = new Blob([res.data], {
-                type: `aplication/zip`,
-              });
-              let url = window.URL.createObjectURL(blob);
-              let aLink = document.createElement("a");
-              aLink.style.display = "none";
-              aLink.href = url;
-              aLink.setAttribute(
-                "download",
-                `${message}.zip`
-              );
-              document.body.appendChild(aLink);
-              aLink.click();
-              document.body.removeChild(aLink); //下载完成移除元素
-              window.URL.revokeObjectURL(url); //释放掉blob对象
 
-              this.$message.success(message + `信息导出成功!`);
-              setTimeout(() => {
-                this.loading = false;
-              }, 500);
-            } else {
-              this.$message.error(res.data.message);
-              setTimeout(() => {
-                this.loading = false;
-              }, 500);
-            }
-          })
-          .catch((error) => {
-            this.loading = false;
-          });
-      }
-    },
-    async deleteById(message) {
-      const res = await asyncRequest.delete({ id: this.id });
-      if (res && res.code === 0) {
-        this.$notify.success({
-          title: message + "成功!",
-          message: "",
-        });
-
-        this.routeGoto("check", {});
-      } else if (res && res.code >= 100 && res.code <= 104) {
-        await this.logout();
-      } else {
-        this.$message.warning(res.message);
-      }
-    },
-
-    async setStatus(status, message) {
-      let model = {
-        id: this.id,
-        remark: "",
-        status: status,
-      };
-      const res = await asyncRequest.status(model);
-      this.loading = false;
-      if (res && res.code === 0) {
-        this.$notify.success({
-          title: message + "成功!",
-          message: "",
-        });
-        this.initForm();
-      } else if (res && res.code >= 100 && res.code <= 104) {
-        await this.logout();
-      } else {
-        this.$message.warning(res.message);
-      }
-    },
     //供应商选择
     supplierChange(e) {
       if (e && e.id) {
@@ -338,45 +204,29 @@ export default {
       this.loading = true;
       if (this.id === "add") {
         this.status = "";
-        this.rulesThis = this.rules;
-        await this.resetForm();
-      } else {
-        this.rulesThis = this.rules;
-        await this.resetForm();
-        await this.initData();
       }
+      this.rulesThis = this.rules;
+      await this.resetForm();
       this.loading = false;
     },
-    async initData() {
-      const res = await asyncRequest.detail({ id: this.id });
-      if (res && res.code === 0 && res.data) {
-        const { status, type, wsm_code, code, name } = res.data;
-        this.status = status;
-        this.companyCode = code;
-        this.companyName = name;
-        this.ruleForm = {
-          wsm_code: [wsm_code],
-          type: type,
-          wsm_supplier: [this.companyCode],
-        };
-      } 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();
-
+          console.log(this.sitem);
+          const { status, type, wsm_code, code, name } = this.sitem;
+          this.status = status||"";
+          this.companyCode = code||"";
+          this.companyName = name||"";
           this.ruleForm = {
-            wsm_supplier: [], // 盘点公司
-            wsm_code: [], // 盘点仓库
-            type: "2", // 真实姓名
+            wsm_code: [wsm_code]||[],
+            type: type||"",
+            wsm_supplier: [this.companyCode]||[],
           };
+       
         }
       });
     },
@@ -424,31 +274,6 @@ export default {
         }
       });
     },
-    async setProcess(status) {
-      if (this.loading === false) {
-        this.loading = true;
-      }
-      let model = {
-        id: this.id,
-        status: status,
-      };
-
-      let res = await asyncRequest.update(model);
-      if (res && res.code === 0) {
-        const title =
-          status === "1" ? "发起审核流程成功!" : "取消审核流程成功!";
-        this.$notify.success({
-          title,
-          message: "",
-        });
-        this.initForm();
-      } else if (res && res.code >= 100 && res.code <= 104) {
-        await this.logout();
-      } else {
-        this.$message.warning(res.message);
-      }
-      this.loading = false;
-    },
   },
 };
 </script>

+ 3 - 2
src/views/stock/check/components/resultUplod.vue

@@ -22,12 +22,13 @@
     >
       <template #table-header="{}">
         <div style="width: 100%">
-          <el-row style="padding: 0 0 0 80px">
+          <el-row style="0">
             <el-col :span="24">
               <el-col :span="3" style="width: 66px; float: right">
                 <el-button
+                  v-if="tableData.length === 0"
                   @click="importshowModel = true"
-                  :size="searchSize"
+                  :size="'mini'"
                   type="success"
                   style="float: right; margin-left: 5px"
                 >

+ 2 - 2
src/views/stock/check/components/resultUplodModel.vue

@@ -39,10 +39,10 @@
           </el-table>
         </el-col>
         <el-col :span="24" style="text-align: right; margin: 15px 0 0 0">
-          <el-button v-if="!isDetail" type="primary" @click="submitForm"
+          <el-button v-if="!isDetail" :size="'mini'" type="primary" @click="submitForm"
             >保 存
           </el-button>
-          <el-button @click="showModelThis = false">{{
+          <el-button :size="'mini'" @click="showModelThis = false">{{
             isDetail ? "关 闭" : "取 消"
           }}</el-button>
         </el-col>

+ 179 - 194
src/views/stock/check/detail.vue

@@ -1,29 +1,77 @@
 <template>
-  <div class="checkDetail pagePadding">
+  <div class="checkDetail pagePadding" v-loading="loading">
     <div
       style="width: 100%"
       v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
     >
+      {{ status }}
+      <div class="tr" style="padding: 10px 0">
+        <span class="fl" style="padding: 3px 0 0 3px">盘点详情</span>
+        <el-button
+          type="primary"
+          plain
+          :size="'mini'"
+          @click="statusConfirm('1', '发起审核流程')"
+          v-if="status === '0' && powers.some((item) => item == '012')"
+          >发起审核流程
+        </el-button>
+
+        <el-button
+          type="primary"
+          :size="'mini'"
+          @click="statusConfirm('-2', '导出盘点商品')"
+          v-if="status === '1' && powers.some((item) => item == '014')"
+          >导出盘点商品
+        </el-button>
+        <el-button
+          @click="statusConfirm('0', '取消审核流程')"
+          plain
+          :size="'mini'"
+          v-if="status === '1' && powers.some((item) => item == '014')"
+          >取消审核流程</el-button
+        >
+        <el-button
+          @click="statusConfirm('-1', '作废该条信息')"
+          type="danger"
+          plain
+          :size="'mini'"
+          v-if="
+            (status === '0' || status === '1') &&
+            powers.some((item) => item == '015')
+          "
+          >作废该条信息</el-button
+        >
+      </div>
+
       <add-edit
-        style="width: 100%"
-        v-if="$route.query.id"
-        :id="$route.query.id"
-      />
-      <result-uplod
-        style="width: 100%"
-        v-if="$route.query.id"
-        :id="$route.query.id"
-      />
-      <exam-form
-        v-if="$route.query.id"
-        style="width: 100%"
-        :statusList="statusList"
-        :disabled="false"
-        :isMust="true"
-        @searchChange="examForm"
+        :newTime="newTime"
+        v-if="newTime !== ''"
+        :sitem="sitem"
+        :id="queryId"
       />
-      <button @click="addGood">添加商品</button>
-      <search-stock-good-modal :code="code" :showModel="showModel1" />
+
+      <el-collapse
+        v-if="status !== '' && status !== '0'"
+        v-model="activeNames"
+        @change="handleChange"
+      >
+        <el-collapse-item
+          v-if="status !== '' && status !== '0'"
+          title="盘点结果记录"
+          name="1"
+        >
+          <result-uplod :newTime="newTime" :id="queryId" />
+        </el-collapse-item>
+        <el-collapse-item v-if="status === '2'" title="盘点审核" name="2">
+          <exam-form
+            :statusList="statusList"
+            :newTime="newTime"
+            :disabled="false"
+            :isMust="false"
+            @searchChange="examForm"
+          />
+        </el-collapse-item>
+      </el-collapse>
     </div>
     <div v-else>
       <no-auth></no-auth>
@@ -33,10 +81,11 @@
    <script>
 import mixinPage from "@/mixins/elPaginationHandle";
 import resToken from "@/mixins/resToken";
-// import statusList from "@/assets/js/statusList";
 import asyncRequest from "@/apis/service/stock/check/detail";
 import addEdit from "./components/addEdit";
 import resultUplod from "./components/resultUplod";
+import { getToken } from "@/utils/auth";
+import urlConfig from "@/apis/url-config";
 import { mapGetters } from "vuex";
 
 export default {
@@ -62,208 +111,144 @@ export default {
   },
   data() {
     return {
-      code: "WSM9f0r211019102112",
-      showModel1: false,
+      activeNames: [],
       sitem: null,
-      // 状态
-      statusOptions: [
-        { id: "0", label: "禁用" },
-        { id: "1", label: "启用" },
-      ],
-      // statusList: statusList,
-      statusList: [
-        {
-          value: "1",
-          label: "label1",
-        },
-        {
-          value: "2",
-          label: "label2",
-        },
-        {
-          value: "3",
-          label: "label3",
-        },
-      ],
+      status: "",
+      newTime: "",
+      fileUrl: urlConfig.baseURL,
       loading: true,
-      showModel: false,
-      isDetail: false,
-      modelId: 0,
-      parmValue: {
-        name: "", // 业务员名字
-        username: "", // 账号
-        status: "", //
-        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: [
-        {
-          prop: "nickname",
-          label: "真实姓名",
-        },
-        {
-          prop: "role_name",
-          label: "角色名称",
-        },
-        {
-          prop: "mobile",
-          label: "联系电话",
-        },
-        {
-          prop: "email",
-          label: "邮箱",
-        },
-        {
-          prop: "status",
-          label: "状态",
-          _slot_: "status",
-          width: "80px",
-        },
-        {
-          prop: "addtime",
-          label: "创建时间",
-          sortable: true,
-        },
-        {
-          prop: "",
-          label: "操作",
-          fixed: "right",
-          _noset_: true,
-          _slot_: "operation",
-        },
-      ],
+      queryId: "",
     };
   },
   mounted() {
-    console.log(this.$route.query.id);
-
-    // this.searchList();
+    this.status = "";
+    this.queryId = this.$route.query.id;
+    this.initData();
   },
 
   methods: {
-    examForm(e) {
-      console.log(e);
-    },
-    addGood() {
-      this.showModel1 = true;
-      // console.log();
-    },
-    restSearch() {
-      // 表格 - 分页
-      this.pageInfo = {
-        size: 15,
-        curr: 1,
-        total: 0,
-      };
-      this.parmValue = {
-        name: "", // 业务员名字
-        username: "", // 账号
-        status: "", //
-        page: 1, // 页码
-        size: 15, // 每页显示条数
-      };
-      this.searchList();
-    },
-
-    openModal(id, isDetail, sitem) {
-      this.showModel = true;
-      this.modelId = id;
-      this.isDetail = isDetail;
-      this.sitem = sitem;
+    async initData() {
+      this.loading = true;
+      const res = await asyncRequest.detail({ id: this.queryId });
+      if (res && res.code === 0 && res.data) {
+        this.sitem = res.data;
+        this.status = "2";
+        this.activeNames = [this.status];
+        //this.sitem.status;
+        this.getNewTime();
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.$message.warning(res.message);
+      }
+      this.loading = false;
     },
-    async deleteById(id, status) {
-      await this.$confirm("确定要作废申请?", {
+    async statusConfirm(status, message) {
+      await this.$confirm(`确定要${message}?`, {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
       })
         .then(async () => {
-          const model = {
-            id: id,
-            status: status === "1" ? "0" : "1",
-          };
-          const res = await asyncRequest.status(model);
-          if (res && res.code === 0) {
-            this.$notify.success({
-              title: "删除成功",
-              message: "",
-            });
-
-            this.routeGoto("check", {});
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
+          if (status === "-1") {
+            await this.deleteById(message);
+          } else if (status === "-2") {
+            await this.exportGood(message);
           } else {
-            this.$message.warning(res.message);
+            await this.setStatus(status, message);
           }
         })
         .catch(() => {
           console.log("取消");
         });
     },
-    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.pageInfo.total = Number(res.data.count);
+    getNewTime() {
+      this.newTime = new Date().valueOf();
+    },
+    async exportGood(message) {
+      if (!this.loading) {
+        this.loading = true;
+        axios({
+          method: "post",
+          url: this.fileUrl + "admin/checkexport",
+          responseType: "blob",
+          data: { id: this.queryId, token: getToken() },
+          headers: {
+            Accept: `aplication/zip`,
+          },
+        })
+          .then((res) => {
+            if (res && res.status == 200 && res.data) {
+              let blob = new Blob([res.data], {
+                type: `aplication/zip`,
+              });
+              let url = window.URL.createObjectURL(blob);
+              let aLink = document.createElement("a");
+              aLink.style.display = "none";
+              aLink.href = url;
+              aLink.setAttribute("download", `${message}.zip`);
+              document.body.appendChild(aLink);
+              aLink.click();
+              document.body.removeChild(aLink); //下载完成移除元素
+              window.URL.revokeObjectURL(url); //释放掉blob对象
+
+              this.$message.success(message + `信息导出成功!`);
+              setTimeout(() => {
+                this.loading = false;
+              }, 500);
+            } else {
+              this.$message.error(res.data.message);
+              setTimeout(() => {
+                this.loading = false;
+              }, 500);
+            }
+          })
+          .catch((error) => {
+            this.loading = false;
+          });
+      }
+    },
+    async deleteById(message) {
+      const res = await asyncRequest.delete({ id: this.queryId });
+      if (res && res.code === 0) {
+        this.$notify.success({
+          title: message + "成功!",
+          message: "",
+        });
+
+        this.routeGoto("check", {});
       } else if (res && res.code >= 100 && res.code <= 104) {
         await this.logout();
       } else {
-        this.tableData = [];
-        this.pageInfo.total = 0;
+        this.$message.warning(res.message);
       }
-      this.loading = false;
     },
 
-    async statusConfirm(id, status) {
-      let str = status === "1" ? "禁用" : "启用";
-      await this.$confirm("确定要改为" + str + "?", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      })
-        .then(async () => {
-          this.loading = true;
-          const model = {
-            id: id,
-            status: status === "1" ? "0" : "1",
-          };
-          const res = await asyncRequest.status(model);
-          if (res && res.code === 0) {
-            this.loading = false;
-            this.$notify.success({
-              title: "状态修改成功!",
-              message: "",
-            });
-            await this.searchList();
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
-          } else {
-            this.$message.warning(res.message);
-          }
-        })
-        .catch(() => {
-          console.log("取消");
+    async setStatus(status, message, remark) {
+      let model = {
+        id: this.queryId,
+        remark: remark || "",
+        status: status,
+      };
+      const res = await asyncRequest.status(model);
+      this.loading = false;
+      if (res && res.code === 0) {
+        this.$notify.success({
+          title: message + "成功!",
+          message: "",
         });
+        this.initData();
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.$message.warning(res.message);
+      }
+    },
+    async examForm(e) {
+      if (!loading) {
+        let type = e.state === "1" ? "2" : "0";
+        await this.setStatus(type, message, e.remark);
+      }
     },
   },
 };