lucky %!s(int64=2) %!d(string=hai) anos
pai
achega
055f3c6b93

+ 2 - 0
src/apis/service/purchaseIn/purchaseOrder/index.js

@@ -35,4 +35,6 @@ export default {
   cgdeditgoldprice: (data, params) => http(api + "cgdeditgoldprice", data, "post", params),
    // 采返商品详情 订单生成前
    cove_detail: (data, params) => http(api + "getgoodzxinfobynotzixun", data, "post", params),
+   //导出
+   exportcgdlist: (data, params) => http(api + "exportcgdlist", data, "post", params),
 };

+ 5 - 0
src/views/purchaseIn/purchaseOrder/columns.js

@@ -5,6 +5,11 @@ const columns = [
   //   fixed: "left",
   //   _noset_: true,
   // },
+  {
+    type: "selection",
+    fixed: "left",
+    _noset_: true
+  },
   {
     prop: "cgdNo",
     label: "采购单编号",

+ 2 - 52
src/views/purchaseIn/purchaseOrder/detail.vue

@@ -16,10 +16,7 @@
           :showBtn="status === '1' && powers.some((item) => item == '082')"
         />
 
-        <!-- 暂时注释,下版需要导出 -->
-        <!-- <el-button type="primary" style="margin-left:30px;" @click="download">
-          下载<i class="el-icon-download el-icon--right"></i>
-        </el-button> -->
+       
       </div>
       <el-tabs v-model="activeTabs">
         <el-tab-pane label="业务详情" name="1">
@@ -310,54 +307,7 @@ export default {
   },
   methods: {
     
-    //导出文件 (需要修改)
-    download() {
-      if (!this.loading) {
-        this.loading = true;
-        // let httpType = `aplication/zip`;
-        let model = {};
-        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 url = window.URL.createObjectURL(
-                new Blob([res.data], {
-                  type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8",
-                })
-              );
-              let link = document.createElement("a");
-              link.style.display = "none";
-              link.href = url;
-              let excelName = "测试.xlsx";
-              link.setAttribute("download", excelName);
-              document.body.appendChild(link);
-              link.click();
-              link.remove();
-              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;
-          });
-      }
-    },
+    
     // editPriceIf(sitem){
     //   console.log(sitem.status,"aaaaaaaa")
     //     if(sitem.status == "0" ){

+ 87 - 1
src/views/purchaseIn/purchaseOrder/index.vue

@@ -22,6 +22,7 @@
           parmValue.page = 1;
           searchList();
         "
+        @selection="selection_change"
       >
         <template #table-header="{}">
           <div style="width: 100%">
@@ -157,6 +158,16 @@
                   重置
                 </el-button>
               </el-col>
+               <!-- 暂时注释,下版需要导出 -->
+               <el-col :span="4" style="width: 66px; float: right">
+               
+                <el-button type="primary" style="margin-left:30px;" @click="download" :size="searchSize"  class="fr">
+                    导出
+                </el-button>
+              </el-col>
+                
+        
+              
             </el-row>
           </div>
         </template>
@@ -212,7 +223,7 @@
    <script>
 import mixinPage from "@/mixins/elPaginationHandle";
 import resToken from "@/mixins/resToken";
-
+import urlConfig from "@/apis/url-config";
 import asyncRequest from "@/apis/service/purchaseIn/purchaseOrder";
 import { columns, order_type_options, statusOptions } from "./columns";
 import { mapGetters } from "vuex";
@@ -237,6 +248,8 @@ export default {
   },
   data() {
     return {
+      changeList: [],
+      fileUrl: urlConfig.baseURL,
       sitem: null,
       select: "1",
       input: "",
@@ -302,6 +315,79 @@ export default {
   },
 
   methods: {
+    //选中触发函数
+    selection_change(e) {
+      const { list } = e;
+      //选中的数组集合
+      this.changeList = list.length > 0 ? JSON.parse(JSON.stringify(list)) : [];
+    },
+    //导出文件 (需要修改)
+    async download() {
+      if(this.changeList.length<=0){
+        this.$message.warning("请选择有效数据")
+        return;
+      }
+      let model = {
+        cgdNos:[]
+      }
+      this.changeList.forEach(item => {
+        model.cgdNos.push(item.cgdNo)
+      });
+      
+      // const res = await asyncRequest.exportcgdlist(model)
+
+
+      if (!this.loading) {
+        this.loading = true;
+        // let httpType = `aplication/zip`;
+        let model = {};
+        axios({
+          method: "post",
+          url: this.fileUrl + "admin/exportcgdlist",
+          responseType: "blob",
+          data: model,
+          headers: {
+            'Content-Type': 'multipart/form-data',
+          },
+        })
+          .then((res) => {
+            // console.log(res)
+            // console.log(this.fileUrl)
+            // return;
+            if (res && res.status == 200 && res.data) {
+              let url = window.URL.createObjectURL(
+                new Blob([res.data], {
+                  // type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8",
+                  type: 'application/vnd.ms-excel'
+                })
+              );
+              let link = document.createElement("a");
+              link.style.display = "none";
+              link.href = url;
+              let excelName = "测试.xlsx";
+              link.setAttribute("download", excelName);
+              document.body.appendChild(link);
+              link.click();
+              link.remove();
+              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;
+          });
+      }
+    },
+
     restSearch() {
       this.sselect = "创建时间";
       this.select = "1";

+ 4 - 2
src/views/purchaseIn/workbench/components/baseForm.vue

@@ -800,7 +800,6 @@ accAdd(arg1,arg2,arg3,arg4,arg5,arg6,arg7){
 
     computedCost(){
       let goldPrice = this.newGoldPrice || this.askItem.gold_price
-      console.log(goldPrice,"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")
       this.$nextTick(()=>{
         this.r1 = this.accMul(this.ruleForm.noble_weight,goldPrice)
         this.r2 = this.accMul(this.ruleForm.cost_fee,this.ruleForm.noble_weight)
@@ -1137,8 +1136,11 @@ accAdd(arg1,arg2,arg3,arg4,arg5,arg6,arg7){
     //需修改,未改完
    async metal_idsearchChange(e) {
 
-      // console.log()
+      // console.log(e.id,"1111111111111111111111")
       if(!e.id){
+        // this.ruleForm.metal_id = this.askItem.gold_price;
+      // console.log(this.ruleForm.metal_id ,"1111111111111111111111")
+
         this.newGoldPrice = 0;
         return;
       }