Browse Source

采购单导出 设置无需对账状态

戴艳蓉 3 years ago
parent
commit
0b0058b22a

+ 2 - 0
src/apis/service/purchase/porder/index.js

@@ -12,4 +12,6 @@ export default {
   inv: (data, params) => http(api + 'paymentcgdinv', data, 'post', params),
   // 财务信息列表
   exam: (data, params) => http(api + 'paymentcgdexam', data, 'post', params),
+  // 财务信息列表
+  paymentunpay: (data, params) => http(api + 'paymentunpay', data, 'post', params),
 }

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

@@ -48,5 +48,6 @@ const btnList = [
   { code: "047", name: "批量导入开票信息" },
   { code: "048", name: "财务核销发票" },
   { code: "049", name: "台账导出" },
+  { code: "050", name: "批量设置采购单无需对账状态" },
 ];
 export default btnList;

+ 237 - 87
src/views/purchase/porder/index.vue

@@ -24,7 +24,7 @@
       <template #table-header="{ selection }">
         <div style="width: 100%">
           <el-row style="padding: 0 0 10px 80px">
-            <el-col :span="8" style="width: 440px">
+            <el-col :span="8" style="width: 470px">
               <el-select
                 v-model="code"
                 multiple
@@ -47,27 +47,7 @@
                 />
               </el-select>
             </el-col>
-            <el-col :span="8" style="width: 160px; padding: 0 0 0 10px">
-              <el-select
-                v-model="parmValue.inv_status"
-                clearable
-                :size="searchSize"
-                placeholder="回票信息状态"
-                @change="
-                  pageInfo.curr = 1;
-                  parmValue.page = 1;
-                  searchList();
-                "
-              >
-                <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
-                >
-                </el-option>
-              </el-select>
-            </el-col>
+
             <el-col
               :span="3"
               style="width: 140px; float: right"
@@ -97,7 +77,7 @@
               </el-button>
             </el-col>
           </el-row>
-          <el-row :gutter="10">
+          <el-row style="padding: 0 0 10px 0">
             <el-col :span="8" style="width: 120px">
               <el-select
                 v-model="parmValue.send_status"
@@ -119,7 +99,7 @@
                 </el-option>
               </el-select>
             </el-col>
-            <el-col :span="8" style="width: 120px">
+            <el-col :span="8" style="width: 130px; padding-left: 10px">
               <el-select
                 v-model="parmValue.payinfo"
                 clearable
@@ -140,7 +120,7 @@
                 </el-option>
               </el-select>
             </el-col>
-            <el-col :span="8" style="width: 120px">
+            <el-col :span="8" style="width: 130px; padding-left: 10px">
               <el-select
                 v-model="parmValue.invinfo"
                 clearable
@@ -161,7 +141,7 @@
                 </el-option>
               </el-select>
             </el-col>
-            <el-col :span="8" style="width: 120px">
+            <el-col :span="8" style="width: 130px; padding-left: 10px">
               <el-select
                 v-model="parmValue.th_status"
                 clearable
@@ -182,7 +162,44 @@
                 </el-option>
               </el-select>
             </el-col>
-            <el-col :span="5" style="width: 350px">
+            <el-col :span="8" style="width: 160px; padding: 0 0 0 10px">
+              <el-select
+                v-model="parmValue.inv_status"
+                clearable
+                :size="searchSize"
+                placeholder="回票信息状态"
+                @change="
+                  pageInfo.curr = 1;
+                  parmValue.page = 1;
+                  searchList();
+                "
+              >
+                <el-option
+                  v-for="item in options"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
+                >
+                </el-option>
+              </el-select>
+            </el-col>
+            <el-col
+              :span="3"
+              style="width: 140px; float: right"
+              v-if="powers.some((item) => item == '042')"
+            >
+              <el-button
+                :size="searchSize"
+                type="primary"
+                style="float: right"
+                @click="statusConfirm(selection)"
+              >
+                批量设置采购单无需对账状态
+              </el-button>
+            </el-col>
+          </el-row>
+          <el-row :gutter="10">
+            <el-col :span="5" style="width: 390px">
               <el-input
                 clearable
                 style="width: 100%"
@@ -210,6 +227,17 @@
                 ></el-button>
               </el-input>
             </el-col>
+            <el-col :span="3" style="width: 84px; float: right">
+              <el-button
+                type="primary"
+                icon="el-icon-download"
+                class="fr"
+                @click="batchExport(selection)"
+                :size="searchSize"
+                style="margin-left: 10px"
+                >导出</el-button
+              >
+            </el-col>
             <el-col :span="3" style="width: 66px; float: right">
               <el-button
                 v-if="powers.some((item) => item == '002')"
@@ -265,11 +293,6 @@
                 <span>{{ scope.row.goodUnit }}</span>
               </el-form-item>
             </el-col>
-            <!-- <el-col :span="4">
-              <el-form-item size="mini" label="单价">
-                <span>{{ scope.row.price }}</span>
-              </el-form-item>
-            </el-col> -->
             <el-col :span="4">
               <el-form-item size="mini" label="数量">
                 <span>{{ scope.row.orderNum }}</span>
@@ -290,16 +313,6 @@
                 <span>{{ scope.row.pay_price }}</span>
               </el-form-item>
             </el-col>
-            <el-col :span="4">
-              <el-form-item size="mini" label="已付款">
-                <span>{{ scope.row.pay_fee }}</span>
-              </el-form-item>
-            </el-col>
-            <el-col :span="4">
-              <el-form-item size="mini" label="待付款">
-                <span>{{ scope.row.wait_fee }}</span>
-              </el-form-item>
-            </el-col>
             <el-col :span="4">
               <el-form-item size="mini" label="税率">
                 <span>{{ scope.row.taxPoint }}</span>
@@ -489,6 +502,7 @@
 import asyncRequest from "@/apis/service/purchase/porder";
 import ExTable from "@/components/ExTableNew.vue";
 import mixinPage from "@/mixins/elPaginationHandle";
+import { switchingTime, formatJson } from "@/utils/publicMethods";
 import resToken from "@/mixins/resToken";
 import setEdit from "./setEdit";
 import { mapGetters } from "vuex";
@@ -533,6 +547,10 @@ export default {
           code: "3",
           name: "业务员名字",
         },
+        {
+          code: "4",
+          name: "商品编号",
+        },
       ],
       code: [],
       showModel1: false,
@@ -640,6 +658,7 @@ export default {
         send_status: "",
         payinfo: "",
         invinfo: "",
+        goodNo: "",
         th_status: "",
         page: 1, // 页码
         size: 15, // 每页显示条数
@@ -676,6 +695,11 @@ export default {
           label: "采购单编号",
           width: "145",
         },
+        {
+          prop: "goodNo",
+          label: "商品编号",
+          width: "125",
+        },
         {
           prop: "purchasePrice",
           label: "货款",
@@ -692,10 +716,7 @@ export default {
           label: "供货商",
           width: "180px",
         },
-        // {
-        //   prop: "contector",
-        //   label: "联系人",
-        // },
+
         {
           prop: "ownerName",
           label: "采购员",
@@ -761,16 +782,6 @@ export default {
           width: "180px",
         },
 
-        {
-          prop: "goodNo",
-          label: "商品编号",
-          width: "120px",
-        },
-        {
-          prop: "goodName",
-          label: "商品名称",
-          "min-width": "200px",
-        },
         {
           prop: "DownTime",
           label: "下单时间",
@@ -793,15 +804,56 @@ export default {
       this.pageInfo.curr = 1;
       this.parmValue.inv_company = "";
       this.parmValue.inv_status = "";
+      this.parmValue.goodNo = "";
       this.parmValue.send_status = "";
       this.parmValue.owner = "";
       await this.searchList();
     },
+
+    async statusConfirm(selection) {
+      if (selection && selection.length === 0) {
+        this.$message.error("请选择采购单!");
+        return;
+      }
+
+      await this.$confirm(`确定要将选中的采购单改为无需对账状态?`, {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          this.loading = true;
+          let id = "";
+          selection.forEach((v1, i1) => {
+            id += i1 === 0 ? v1.id : "," + v1.id;
+          });
+          const model = {
+            id: id,
+          };
+          const res = await asyncRequest.paymentunpay(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 searchList() {
       this.loading = true;
       this.parmValue.sequenceNo = this.selectK === "1" ? this.input : "";
       this.parmValue.inv_company = this.selectK === "2" ? this.input : "";
       this.parmValue.owner = this.selectK === "3" ? this.input : "";
+      this.parmValue.goodNo = this.selectK === "4" ? this.input : "";
       const res = await asyncRequest.list(this.parmValue);
       if (res && res.code === 0 && res.data) {
         this.tableData = res.data.list;
@@ -910,37 +962,6 @@ export default {
         return v1;
       });
     },
-    async statusConfirm(id, status) {
-      await this.$confirm(`确定要改为${status === "1" ? "禁用" : "启用"}?`, {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      })
-        .then(async () => {
-          this.loading = true;
-          const model = {
-            companyNo: 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.loading = false;
-            this.$message.warning(res.message);
-          }
-        })
-        .catch(() => {
-          console.log("取消");
-        });
-    },
     async remoteMethod(query) {
       this.selectLoading = true;
       if (query !== "") {
@@ -959,6 +980,135 @@ export default {
       }
       this.selectLoading = false;
     },
+    setlable(list, type) {
+      return (list.find((item) => item.value == type) || {}).label || "";
+    },
+    /**
+     *  批量导出
+     * @param {Array} selection 当前选择项
+     */
+    batchExport(selection) {
+      if (!this.loading) {
+        if (selection.length == 0) {
+          this.$message.warning("请至少选择一条数据!");
+          return;
+        }
+
+        this.loading = true;
+        let data = [].concat(...selection);
+        let list = [];
+        data.forEach((v1) => {
+          let model = Object.assign({}, v1);
+          model.send_info = this.setlable(this.send_status_list, v1.send_info);
+          model.th_info = this.setlable(this.th_status_list, v1.th_info);
+          model.payinfo = this.setlable(this.pay_status_list, v1.payinfo);
+          model.invinfo = this.setlable(this.inv_status_list, v1.invinfo);
+          model.inv_status = this.setlable(this.options, v1.inv_status);
+          list.push(model);
+        });
+        const xlsName = `采购单导出`;
+        import("@/vendor/Export2Excel").then((excel) => {
+          const tHeader = [
+            "采购单编号",
+            "货款",
+            "供应商编码",
+            "供应商名称",
+            "采购员",
+            "发货状态",
+            "退货状态",
+            "付款状态",
+            "已付金额",
+            "待付金额",
+            "回票状态",
+            "已回票金额",
+            "待回票金额",
+            "信息设置状态",
+            "回票编号",
+            "回票公司",
+            "下单时间",
+
+            "商品编号",
+            "商品名称",
+            "商品描述",
+            "单位",
+            "数量",
+            "含有工差",
+            "工期",
+            "成本合计",
+            "税率",
+            "成本裸价",
+            "加标费",
+            "包装费",
+            "证书费",
+            "开模费",
+            "物流费",
+            "工差",
+            "商品类型",
+            "商品品牌",
+            "商品型号",
+            "商品材质",
+            "商品颜色",
+            "金属种类",
+            "金属重量",
+            "金属价格",
+          ];
+          const filterVal = [
+            "cgdNO",
+            "purchasePrice",
+            "supplierNo",
+            "name",
+            "ownerName",
+            "send_info",
+            "th_info",
+            "payinfo",
+            "pay_fee",
+            "wait_fee",
+            "invinfo",
+            "inv_open_fee",
+            "inv_wait_fee",
+            "inv_status",
+            "inv_company",
+            "inv_company_name",
+            "DownTime",
+
+            "goodNo",
+            "goodName",
+            "goodDesc",
+            "goodUnit",
+            "orderNum",
+            "isDiff",
+            "workDay",
+            "pay_price",
+            "taxPoint",
+            "nakedPrice",
+            "markPrice",
+            "packPrice",
+            "certPrice",
+            "openPrice",
+            "postPrice",
+            "diff_fee",
+            "goodType",
+            "goodBank",
+            "goodModel",
+            "goodMaterial",
+            "goodColor",
+            "goodCat",
+            "weight",
+            "price",
+          ];
+          const data = formatJson(filterVal, list);
+          excel.export_json_to_excel({
+            header: tHeader,
+            data,
+            filename: `${xlsName}`,
+          });
+          this.$message.success("采购单导出成功!");
+          setTimeout(() => {
+            this.loading = false;
+          }, 500);
+        });
+      }
+    },
   },
 };
 </script>