Browse Source

Merge branch 'live' into edit

戴艳蓉 3 years ago
parent
commit
8df4f62eda

+ 15 - 0
src/apis/service/stock/allot/detail.js

@@ -0,0 +1,15 @@
+// 物业管理员
+import http from "@/apis/axios";
+const api = "admin/";
+export default {
+  // 新建程
+  add: (data, params) => http(api + "allotcreate", data, "post", params),
+  // 删除
+  delete: (data, params) => http(api + "allotdelect", data, "post", params),
+  // 详情
+  detail: (data, params) => http(api + "allotinfo", data, "post", params),
+  // 编辑
+  update: (data, params) => http(api + "allotedit", data, "post", params),
+  // 状态
+  status: (data, params) => http(api + "allotstatus", data, "post", params),
+};

+ 1 - 10
src/apis/service/stock/allot/index.js

@@ -2,17 +2,8 @@
 import http from "@/apis/axios";
 const api = "admin/";
 export default {
-  // 新建调拨流程
-  add: (data, params) => http(api + "allotcreate", data, "post", params),
-  // 调拨删除
-  delete: (data, params) => http(api + "allotdelect", data, "post", params),
   // 调拨列表
   list: (data, params) => http(api + "allotlist", data, "post", params),
-  // 调拨详情
-  detail: (data, params) => http(api + "allotinfo", data, "post", params),
-  // 调拨流程编辑
-  update: (data, params) => http(api + "allotedit", data, "post", params),
-  // 修改状态
-  status: (data, params) => http(api + "accountstatus", data, "post", params),
+
 };
    

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

@@ -15,5 +15,8 @@ const btnList = [
   { code: "014", name: "取消流程" },
   { code: "015", name: "作废数据" },
   { code: "016", name: "离职交接审核" },
+  { code: "017", name: "盘点结果上传" },
+  { code: "018", name: "盘点结果审核" },
+  { code: "019", name: "盘点商品导出" },
 ];
 export default btnList;

+ 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,

+ 28 - 36
src/views/stock/allot/components/addForm.vue

@@ -162,12 +162,13 @@
       </el-form>
     </el-col>
     <el-col :span="24" style="text-align: right">
-      <el-button type="primary" @click="submitForm" v-if="!isDetail"
+      <el-button
+        type="primary"
+        :size="'mini'"
+        @click="submitForm"
+        v-if="!isDetail"
         >保 存
       </el-button>
-      <el-button @click="closeModel">{{
-        isDetail ? "关 闭" : "取 消"
-      }}</el-button>
     </el-col>
     <el-col :span="24">
       <search-stock-good-modal
@@ -180,7 +181,7 @@
   </el-row>
 </template>
    <script>
-import asyncRequest from "@/apis/service/stock/allot";
+import asyncRequest from "@/apis/service/stock/allot/detail";
 import resToken from "@/mixins/resToken";
 export default {
   name: "allot",
@@ -189,6 +190,7 @@ export default {
   data() {
     return {
       showGoodsModel: false,
+      status: "",
       // id: "",
       supplier_code: "",
       stock_in_code: "",
@@ -396,40 +398,17 @@ export default {
 
     async initForm() {
       this.loading = true;
-      // await this.getRole();
-      console.log(this.id);
       if (this.id === "add") {
-        this.rulesThis = this.rules;
-        await this.resetForm();
-      } else {
-        this.rulesThis = this.rules;
-        await this.resetForm();
-        await this.initData();
+        this.status = "";
       }
+      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 { item, wsm_in, wsm_out, wsm_in_name, wsm_out_name } = res.data;
-        this.supplier_code = wsm_out;
-        this.stock_in_code = wsm_in;
-        this.supplier_name = wsm_out_name;
-        this.supplier_in_name = wsm_in_name;
-        this.ruleForm = {
-          supplier_code: [], //出库供应商code
-          stock_code: [wsm_out], //出库仓库code
-          supplier_in_code: [], //入库供应商code
-          stock_in_code: [wsm_in], //入库仓库code
-          product_go: item, //出库商品
-        };
-        this.ruleForm.product_go.map((v) => {
-          v.usable_stock = v.usable_num;
-          v.type_code = v.good_type_code;
-          v.edit=f
-          return v;
-        });
       } else if (res && res.code >= 100 && res.code <= 104) {
         await this.logout();
       } else {
@@ -442,13 +421,26 @@ export default {
         if (this.$refs.ruleForm) {
           this.$refs.ruleForm.resetFields();
           this.$refs.ruleForm.clearValidate();
+          const { item, wsm_in, wsm_out, wsm_in_name, wsm_out_name, status } =
+            this.sitem;
+          this.supplier_code = wsm_out || "";
+          this.stock_in_code = wsm_in || "";
+          this.supplier_name = wsm_out_name || "";
+          this.supplier_in_name = wsm_in_name || "";
+          this.status = status;
           this.ruleForm = {
-            supplier_code: [], //出库供应商code
-            stock_code: [], //出库仓库code
-            supplier_in_code: [], //入库供应商code
-            stock_in_code: [], //入库仓库code
-            product_go: [], //出库商品
+            supplier_code: [] || [], //出库供应商code
+            stock_code: [wsm_out] || [], //出库仓库code
+            supplier_in_code: [] || [], //入库供应商code
+            stock_in_code: [wsm_in] || [], //入库仓库code
+            product_go: item||[], //出库商品
           };
+          this.ruleForm.product_go.map((v) => {
+            v.usable_stock = v.usable_num;
+            v.type_code = v.good_type_code;
+            v.edit = false
+            return v;
+          });
         }
       });
     },

+ 129 - 50
src/views/stock/allot/detail.vue

@@ -4,10 +4,49 @@
       style="width: 100%"
       v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
     >
+      {{ status }},{{ powers }}
+      <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-form
-        v-if="$route.query.id"
-        :id="$route.query.id"
-        @closeModel="closeModel"
+        :newTime="newTime"
+        v-if="newTime !== ''"
+        :sitem="sitem"
+        :id="queryId"
       />
       <!-- 详情 -->
 
@@ -26,14 +65,6 @@
         v-if="$route.query.id"
         :myType="type"
       ></CheckStock> -->
-      <add-edit
-        :id="modelId"
-        :sitem="sitem"
-        :show-model="showModel"
-        :is-detail="isDetail"
-        @refresh="searchList"
-        @cancel="showModel = false"
-      />
     </div>
     <div v-else>
       <no-auth></no-auth>
@@ -43,6 +74,7 @@
    <script>
 import mixinPage from "@/mixins/elPaginationHandle";
 import resToken from "@/mixins/resToken";
+import asyncRequest from "@/apis/service/stock/allot/detail";
 import { mapGetters } from "vuex";
 import addForm from "./components/addForm"; //新建申请页面
 // import GoStock from "./components/goStock-audit.vue"; //出库方发货
@@ -77,57 +109,104 @@ export default {
   },
   data() {
     return {
-      company: "",
-      type: 1, //假数据,用于表示后台的操作流程节点
-      /**
-       * type=1,那么表示当前是新建申请流程,只显示新建申请组件。newApply
-       * type=2,入库方审核流程   inStock-audit
-       * type=3,出库方发货流程   goStock-audit
-       * type=4,入库方验货流程   inStock-check
-       * type=5,验货审核流程     checkStock
-       *
-       */
+      activeNames: [],
+      sitem: null,
+      status: "",
+      newTime: "",
       loading: true,
-      showModel: false,
-      isDetail: false,
-      modelId: 0,
-      //入参
-      parmValue: {
-        //page: 1,  页码
-        //size: 15,  每页显示条数
-      },
+      queryId: "",
     };
   },
   mounted() {
-    this.searchList();
+    this.status = "";
+    this.queryId = this.$route.query.id;
+    this.initData();
   },
-
   methods: {
     handClick(value) {
       console.log("执行子组件事件", value);
       this.company = value;
     },
-    restSearch() {
-      //重置入参
-      this.parmValue = {
-        page: 1, // 页码
-        size: 10, // 每页显示条数
+    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("取消");
+        });
+    },
+    getNewTime() {
+      this.newTime = new Date().valueOf();
+    },
+
+    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.$message.warning(res.message);
+      }
+    },
+
+    async setStatus(status, message, remark) {
+      let model = {
+        id: this.queryId,
+        remark: remark || "",
+        status: status,
       };
-      this.searchList();
+      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);
+      }
     },
-    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);
-      // } else if (res && res.code >= 100 && res.code <= 104) {
-      //   await this.logout();
-      // } else {
-      //   this.tableData = [];
-      //   this.pageInfo.total = 0;
-      // }
-      // this.loading = false;
+    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 = this.sitem.status;
+        this.activeNames = [this.status];
+        //;
+        this.getNewTime();
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.$message.warning(res.message);
+      }
+      this.loading = false;
     },
   },
 };

+ 43 - 40
src/views/stock/allot/index.vue

@@ -45,29 +45,6 @@
                     placeholder="调拨编号"
                   />
                 </el-col>
-                <!--搜索按钮 -->
-                <el-col :span="4" style="width: 54px; padding-left: 10px">
-                  <el-button
-                    style="width: 100%"
-                    type="primary"
-                    class="fr mr10"
-                    icon="el-icon-search"
-                    :size="searchSize"
-                    @click="searchList"
-                  >
-                  </el-button>
-                </el-col>
-                <el-col :span="4" style="width: 66px; padding-left: 10px">
-                  <el-button
-                    style="width: 100%"
-                    type="success"
-                    class="fr"
-                    :size="searchSize"
-                    @click="addSearch('add', false)"
-                  >
-                    新建
-                  </el-button>
-                </el-col>
 
                 <el-col :span="3" style="width: 66px; float: right">
                   <el-button
@@ -79,23 +56,11 @@
                     刷新
                   </el-button>
                 </el-col>
-
-                <el-col :span="4" style="width: 66px; padding-left: 10px">
-                  <el-button
-                    style="width: 100%"
-                    type="warning"
-                    class="mr5"
-                    :size="searchSize"
-                    @click="restSearch"
-                  >
-                    重置
-                  </el-button>
-                </el-col>
               </el-col>
             </el-row>
-            <el-row>
+            <el-row style="padding:10px 0 0 0;">
               <!-- 入库仓库 -->
-              <el-col :span="4" style="width: 220px; padding: 10px 0 0 0px">
+              <el-col :span="4" style="width: 220px; ">
                 <el-input
                   :size="searchSize"
                   v-model="parmValue.wsm_in"
@@ -104,14 +69,52 @@
                 />
               </el-col>
               <!-- 出库仓库 -->
-              <el-col :span="4" style="width: 230px; padding: 10px 0 0 10px">
+              <el-col :span="4" style="width: 230px; padding: 0 0 0 10px;">
                 <el-input
                   :size="searchSize"
                   v-model="parmValue.wsm_out"
                   :maxlength="40"
                   placeholder="出库仓库名称"
-                /> </el-col
-            ></el-row>
+                />
+              </el-col>
+              <!--搜索按钮 -->
+              <el-col :span="4" style="width: 54px; padding-left: 10px">
+                <el-button
+                  style="width: 100%"
+                  type="primary"
+                  class="fr mr10"
+                  icon="el-icon-search"
+                  :size="searchSize"
+                  @click="searchList"
+                >
+                </el-button>
+              </el-col>
+              <el-col :span="4" style="width: 66px; padding-left: 10px">
+                <el-button
+                  style="width: 100%"
+                  type="warning"
+                  class="mr5"
+                  :size="searchSize"
+                  @click="restSearch"
+                >
+                  重置
+                </el-button>
+              </el-col>
+              <el-col
+                :span="4"
+                style="width: 66px; padding-left: 10px; float: right"
+              >
+                <el-button
+                  style="width: 100%"
+                  type="success"
+                  class="fr"
+                  :size="searchSize"
+                  @click="addSearch('add', false)"
+                >
+                  新建
+                </el-button>
+              </el-col>
+            </el-row>
           </div>
         </template>
         <template #status="{ scope }">

+ 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 - 196
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,44 +204,26 @@ 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();
-
+          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 ? [wsm_code] : [],
+            type: type || "2",
+            wsm_supplier: this.companyCode ? [this.companyCode] : [],
           };
         }
       });
@@ -408,11 +256,8 @@ export default {
               title,
               message: "",
             });
-            // 刷新
-            if (this.id === "add") {
-              this.showModelThis = false;
-              this.$emit("refresh", false);
-            }
+            this.showModelThis = false;
+            this.$emit("refresh");
           } else if (res && res.code >= 100 && res.code <= 104) {
             await this.logout();
           } else {
@@ -424,31 +269,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>

+ 59 - 81
src/views/stock/check/components/resultUplod.vue

@@ -20,30 +20,31 @@
         searchList();
       "
     >
-      <template #table-header="{}">
+      <template
+        #table-header="{}"
+        v-if="
+          tableData.length === 0 &&
+          status == '1' &&
+          powers.some((item) => item == '017')
+        "
+      >
         <div style="width: 100%">
-          <el-row style="padding: 0 0 0 80px">
-            <el-col :span="24">
-              <el-col :span="3" style="width: 66px; float: right">
-                <el-button
-                  @click="importshowModel = true"
-                  :size="searchSize"
-                  type="success"
-                  style="float: right; margin-left: 5px"
-                >
-                  添加
-                </el-button>
-              </el-col>
-            </el-col>
-          </el-row>
+          <el-button
+            @click="importshowModel = true"
+            :size="'mini'"
+            type="success"
+            style="float: right"
+          >
+            添加
+          </el-button>
         </div>
       </template>
-      <template #status="{ scope }">
+      <template #is_profit="{ scope }">
         <el-tag
           :size="tablebtnSize"
-          :type="scope.row.status == '0' ? 'warning' : ''"
+          :type="scope.row.is_profit == '0' ? 'success' : 'warning'"
           v-text="
-            (statusOptions.find((item) => item.id == scope.row.status) || {})
+            (typeOptions.find((item) => item.id == scope.row.is_profit) || {})
               .label || '--'
           "
         ></el-tag>
@@ -58,41 +59,25 @@
           "
         ></el-tag>
       </template>
-      <template #operation="{ scope }">
-        <el-tooltip
-          v-if="powers.some((item) => item == '007')"
-          effect="dark"
-          content="详情"
-          placement="top"
-        >
-          <i
-            class="el-icon-view tb-icon"
-            @click="routeGoto('checkDetail', { id: scope.row.id })"
-          ></i>
-        </el-tooltip>
-      </template>
     </ex-table>
     <result-uplod-model
       :show-model="importshowModel"
       :id="id"
-      @refresh="
-        pageInfo.curr = 1;
-        parmValue.page = 1;
-        searchList();
-      "
+      @refresh="refresh"
       @cancel="importshowModel = false"
     />
   </div>
 </template>
    <script>
 import asyncRequest from "@/apis/service/stock/check/detail";
+import mixinPage from "@/mixins/elPaginationHandle";
 import resToken from "@/mixins/resToken";
 import resultUplodModel from "./resultUplodModel";
 import { mapGetters } from "vuex";
 export default {
   name: "addEdit",
-  props: ["id"],
-  mixins: [resToken],
+  props: ["id", "newTime", "sitem"],
+  mixins: [mixinPage, resToken],
   components: {
     resultUplodModel,
   },
@@ -112,16 +97,16 @@ export default {
   },
 
   watch: {
-    id: function (val) {
+    newTime: function (val) {
       if (val) {
-        this.initForm();
+        this.restSearch();
       }
     },
   },
   data() {
     return {
       importshowModel: false,
-      sitem: null,
+      status: "",
       // 节点状态
       statusOptions: [
         { id: "0", label: "待发起流程" },
@@ -132,8 +117,8 @@ export default {
       ],
       // 盘点类型
       typeOptions: [
-        { id: "1", label: "全盘" },
-        { id: "2", label: "抽盘" },
+        { id: "0", label: "盘盈" },
+        { id: "1", label: "盘亏" },
       ],
       loading: true,
       showModel: false,
@@ -154,7 +139,7 @@ export default {
       table: {
         stripe: true,
         border: true,
-        _defaultHeader_: ["setcol"],
+        // _defaultHeader_: ["setcol"],
       },
       // 表格 - 分页
       pageInfo: {
@@ -165,65 +150,54 @@ export default {
       // 表格 - 列参数
       columns: [
         {
-          prop: "check_code",
-          label: "盘点编号",
-          width: "155px",
+          prop: "good_type_code",
+          label: "商品属性编号",
+          "min-width": "130px",
         },
 
         {
-          prop: "wsm_code",
-          label: "仓库编码",
-          width: "170px",
+          prop: "good_name",
+          label: "商品名称",
+          "min-width": "200px",
         },
         {
-          prop: "name",
-          label: "仓库名称",
+          prop: "is_profit",
+          label: "盘盈/盘亏",
+          _slot_: "is_profit",
+          "min-width": "100px",
         },
-
         {
-          prop: "code",
-          label: "公司编码",
-          width: "140px",
+          prop: "origin_num",
+          label: "盘点前数量",
+          "min-width": "110px",
         },
+
         {
-          prop: "caname",
-          label: "公司名称",
+          prop: "check_num",
+          label: "盘点后数量",
+          "min-width": "110px",
         },
         {
-          prop: "status",
-          label: "盘点状态",
-          _slot_: "status",
-          width: "120px",
+          prop: "diff_num",
+          label: "差额数量",
+          "min-width": "100px",
         },
 
-        {
-          prop: "type",
-          label: "盘点类型",
-          _slot_: "type",
-          width: "70px",
-        },
         {
           prop: "addtime",
-          label: "创建时间",
-          width: "140px",
-        },
-        {
-          prop: "",
-          label: "操作",
-          fixed: "right",
-          _noset_: true,
-          width: "50px",
-          _slot_: "operation",
+          label: "结果上传时间",
+          width: "145px",
         },
       ],
     };
   },
   mounted() {
-    this.searchList();
+    this.restSearch();
   },
 
   methods: {
     restSearch() {
+      this.status = this.sitem.status;
       // 表格 - 分页
       this.pageInfo = {
         size: 15,
@@ -237,6 +211,12 @@ export default {
       };
       this.searchList();
     },
+    refresh() {
+      this.pageInfo.curr = 1;
+      this.parmValue.page = 1;
+      this.searchList();
+      this.$emit("refresh");
+    },
     async searchList() {
       this.loading = true;
       this.parmValue.id = this.id;
@@ -257,7 +237,5 @@ export default {
 </script>
 
    <style lang="scss" scoped>
-.check {
-}
 </style>
    

+ 28 - 22
src/views/stock/check/components/resultUplodModel.vue

@@ -39,10 +39,14 @@
           </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>
@@ -57,7 +61,7 @@ import resToken from "@/mixins/resToken";
 import asyncRequest from "@/apis/service/stock/check/detail";
 export default {
   name: "resultUplodModel",
-  props: ["showModel",'id'],
+  props: ["showModel", "id"],
   mixins: [resToken],
   data() {
     return {
@@ -175,25 +179,27 @@ export default {
       });
     },
     async submitForm() {
- 
-          if (!this.loading) {
-            this.loading = true;
-            let model = {
-              id: this.id,
-              data: this.tableData,
-            };
-            const res = await asyncRequest.checkimport(model);
-            if (res && res.code === 0) {
-              this.$notify.success({
-                title: "盘点数据提交成功!",
-                message: "",
-              });
-            } else if (res && res.code >= 100 && res.code <= 104) {
-              await this.logout();
-            } else {
-              this.$message.warning(res.message);
-            }
-          }
+      if (!this.loading) {
+        this.loading = true;
+        let model = {
+          id: this.id,
+          data: this.tableData,
+        };
+        const res = await asyncRequest.checkimport(model);
+        this.loading = false;
+        if (res && res.code === 0) {
+          this.$notify.success({
+            title: "盘点数据提交成功!",
+            message: "",
+          });
+          this.showModelThis = false;
+          this.$emit("refresh", false);
+        } else if (res && res.code >= 100 && res.code <= 104) {
+          await this.logout();
+        } else {
+          this.$message.warning(res.message);
+        }
+      }
     },
   },
 };

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

@@ -1,29 +1,94 @@
 <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')"
     >
+      <div class="tr" style="padding: 10px 0; height: 50px">
+        <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 == '019')"
+          >导出盘点商品
+        </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"
+        @refresh="initData()"
       />
-      <button @click="addGood">添加商品</button>
-      <search-stock-good-modal :code="code" :showModel="showModel1" />
+
+      <el-collapse
+        v-if="
+          status == '3' ||
+          (status == '1' && powers.some((item) => item == '017')) ||
+          (status == '2' && powers.some((item) => item == '018'))
+        "
+        v-model="activeNames"
+        @change="handleChange"
+      >
+        <el-collapse-item
+          v-if="
+            status == '3' ||
+            (status == '1' && powers.some((item) => item == '017')) ||
+            (status == '2' && powers.some((item) => item == '018'))
+          "
+          title="盘点结果记录"
+          name="1"
+        >
+          <result-uplod
+            :newTime="newTime"
+            :sitem="sitem"
+            :id="queryId"
+            @refresh="initData()"
+          />
+        </el-collapse-item>
+        <el-collapse-item
+          v-if="status == '2' && powers.some((item) => item == '018')"
+          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 +98,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 +128,194 @@ export default {
   },
   data() {
     return {
-      code: "WSM9f0r211019102112",
-      showModel1: false,
+      activeNames: ["0", "1", "2", "3", "4"],
       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 = this.sitem.status;
+        // this.activeNames = [this.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;
+        let httpType = `aplication/zip`;
+        let model = {
+          id: this.queryId,
+          token: getToken(),
+        };
+        axios({
+          method: "post",
+          url: urlConfig.baseURL + "admin/checkexport",
+          responseType: "blob",
+          data: model,
+          headers: {
+            Accept: httpType,
+          },
+        })
+          .then((res) => {
+            if (res && res.status == 200 && res.data) {
+              let blob = new Blob([res.data], {
+                type: httpType,
+              });
+              let url = window.URL.createObjectURL(blob);
+              let aLink = document.createElement("a");
+              aLink.style.display = "none";
+              aLink.href = url;
+              aLink.setAttribute("download", `提成数据报表.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) => {
+            console.log(error);
+            this.loading = false;
+          });
+      }
+      // if (!this.loading) {
+      //   this.loading = true;
+      //   let httpType = `aplication/zip`;
+      //   let model = {
+      //     id: this.queryId,
+      //     token: getToken(),
+      //   };
+      //   axios({
+      //     method: "post",
+      //     url: this.fileUrl + "admin/checkexport",
+      //     responseType: "blob",
+      //     data: model,
+      //     headers: {
+      //       Accept: httpType,
+      //     },
+      //   })
+      //     .then((res) => {
+      //       if (res && res.status == 200 && res.data) {
+      //         let blob = new Blob([res.data], {
+      //           type: httpType,
+      //         });
+      //         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(`信息导出失败!`);
+      //         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 (!this.loading) {
+        let type = e.state === "1" ? "3" : "1";
+        await this.setStatus(type, "盘点审核", e.remark);
+      }
     },
   },
 };