From d44f7522b09f8bff0a3ee4e95c4e6499a23ca296 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期二, 21 十一月 2023 15:03:14 +0800
Subject: [PATCH] 批量编辑对话框

---
 Source/UBCS-WEB/src/components/Master/MasterTransfer.vue    |    2 
 Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue |   31 ++++++---
 Source/UBCS-WEB/src/components/BatchImport/index.vue        |   79 +++++++++++++++++++++-----
 Source/UBCS-WEB/src/views/MasterData/items.vue              |    8 ++
 Source/UBCS-WEB/vue.config.js                               |    4 
 Source/UBCS-WEB/src/components/Master/MasterTree.vue        |    1 
 6 files changed, 95 insertions(+), 30 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/BatchImport/index.vue b/Source/UBCS-WEB/src/components/BatchImport/index.vue
index 765863f..02d31db 100644
--- a/Source/UBCS-WEB/src/components/BatchImport/index.vue
+++ b/Source/UBCS-WEB/src/components/BatchImport/index.vue
@@ -14,7 +14,7 @@
     </ul>
     <div
       class="radio_box"
-      v-show="currentTypeObj[type]['upParams'] === 'classifyAttr'"
+      v-show="currentTypeObj[type]['upParams'] === 'classifyAttr' && this.type !== 'bulkEdit'"
     >
       <span>鍒嗙被鐨勮矾寰勪娇鐢ㄧ殑灞炴��:</span>
       <el-radio-group v-model="classifyAttr">
@@ -65,8 +65,14 @@
         size="small"
         @click="downloadTemplateFun"
         :loading="downloadLoading"
-        >涓嬭浇瀵煎叆妯℃澘</el-button
-      >
+        v-if="type !== 'bulkEdit'"
+        >涓嬭浇瀵煎叆妯℃澘</el-button>
+      <el-button type="primary"
+                 size="small"
+                 :loading="downloadLoading"
+                 @click="downloadTemplateFun"
+                 v-if="type === 'bulkEdit'"
+                >涓嬭浇缂栬緫妯℃澘</el-button>
       <el-button size="small" @click="dialogVisible = false">鍏抽棴</el-button>
     </template>
     <ShowImportData
@@ -93,6 +99,8 @@
   downloadBatchImportApplyTemplate,
   downloadBatchApplyCodeTemplate,
 } from "../../api/batchImport/index";
+import {exportCode} from '@/api/GetItem'
+import func from "@/util/func";
 import FormTemplate from "../FormTemplate/FormTemplate.vue";
 import { getToken } from "@/util/auth";
 import codeApply from "@/mixins/codeApply.js";
@@ -116,6 +124,14 @@
     type: {
       type: String,
       default: "",
+    },
+    tableHeadFindData:{
+      type:Array,
+      default:[]
+    },
+    selectRow:{
+      type:Array,
+      default:[]
     },
     resetTable: Function
   },
@@ -146,7 +162,7 @@
       return this.currentTypeObj[this.type]["action"];
     },
     upParams() {
-      if (this.type === "historyImport" || this.type === "batchApplyCode") {
+      if (this.type === "historyImport" || this.type === "batchApplyCode" || this.type === "bulkEdit") {
         return {
           codeClassifyOid: this.codeClassifyOid,
           classifyAttr: this.classifyAttr,
@@ -169,6 +185,7 @@
   },
   data() {
     return {
+      exportArrTwo: {},
       classifyAttr: "id",
       downloadLoading: false,
       showVisible: false,
@@ -184,6 +201,17 @@
             "2.浼佷笟缂栫爜锛岄泦鍥㈢爜鍜岀姸鎬侀兘闇�瑕佸鍏�",
             "3.姣忔浠呰兘鏈�澶氬鍏�5000鏉℃暟鎹�(鍙�氳繃nacos杩涜閰嶇疆锛屾帹鑽�5000/娆″鍏�)锛屽鏋滃嚭閿欎細杩斿洖閿欒鐨勬暟鎹拰鍘熷洜锛屼絾鏄纭暟鎹彲浠ョ户缁繚瀛�",
             "4.鍒嗙被鐨勮矾寰勯渶瑕佺敤#鍒嗛殧銆備粎濉啓褰撳墠閫夌殑鍒嗙被鏍戜笂鐨勪笅绾у垎绫荤殑璺緞锛屽鏋滃綋鍓嶅垎绫诲凡缁忔槸鍙跺瓙鑺傜偣锛屽垯涓嶅~鍐�",
+          ],
+          action: "/api/ubcs-code/mdmEngineController/batchImportHistoryData",
+          downloadTemplateFun: downloadHistoryImportTemplate,
+          upParams: "classifyAttr",
+        },
+        bulkEdit:{
+          title: "鎵归噺缂栬緫瀵煎叆",
+          tipList: [
+            "1.鏍囬甯︿簲瑙掓槦鐨勮〃绀哄叧閿睘鎬э紝甯︽槦鍙疯〃绀哄繀杈撻」",
+            "2.姣忔浠呰兘鏈�澶氬鍏�5000鏉℃暟鎹�(鍙�氳繃nacos杩涜閰嶇疆锛屾帹鑽�5000/娆″鍏�)锛屽鏋滃嚭閿欎細杩斿洖閿欒鐨勬暟鎹拰鍘熷洜锛屼絾鏄纭暟鎹彲浠ョ户缁繚瀛�",
+            "3.璇锋寜鐓т笅杞界殑缂栬緫妯℃澘鎵�浣跨敤鐨勯厤缃繘琛屽叿浣撻厤缃�"
           ],
           action: "/api/ubcs-code/mdmEngineController/batchImportHistoryData",
           downloadTemplateFun: downloadHistoryImportTemplate,
@@ -239,17 +267,38 @@
     },
     // 涓嬭浇瀵煎叆妯℃澘
     downloadTemplateFun() {
-      this.downloadLoading = true;
-      this.downloadTemplateApi({
-        codeClassifyOid: this.codeClassifyOid,
-      })
-        .then((res) => {
-          this.$utilFunc.downloadFileByBlob(res.data, this.title + "妯℃澘.xls");
-          this.downloadLoading = false;
-        })
-        .catch(() => {
-          this.downloadLoading = false;
-        });
+       if(this.type !== 'bulkEdit'){
+         this.downloadLoading = true;
+         this.downloadTemplateApi({
+           codeClassifyOid: this.codeClassifyOid,
+         })
+           .then((res) => {
+             this.$utilFunc.downloadFileByBlob(res.data, this.title + "妯℃澘.xls");
+             this.downloadLoading = false;
+           })
+           .catch(() => {
+             this.downloadLoading = false;
+           });
+         return;
+       }
+       if(this.type === 'bulkEdit'){
+         this.tableHeadFindData.map(item => item.prop)
+           .forEach((prop, index) => {
+             this.exportArrTwo[`attrIdIndexMap[${index}]`] = prop;
+           });
+         exportCode({
+           codeClassifyOid: this.codeClassifyOid,
+           'conditionMap[oid]': this.ids, ...this.exportArrTwo,
+           limit: -1
+         }).then(res => {
+           // console.log('res',res)
+           if (res) {
+             func.downloadFileByBlobHandler(res);
+             this.$message.success('涓嬭浇鎴愬姛锛岃鏌ョ湅锛�')
+           }
+         })
+         return;
+       }
     },
     onSuccess(res) {
       if (Object.keys(res.data).length === 0) {
diff --git a/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue b/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue
index 8d3d9df..7ddabc7 100644
--- a/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue
+++ b/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue
@@ -112,7 +112,7 @@
     },
     value: {
       handler(newval, oldval) {
-        //console.log('value', newval)
+        // console.log('value', newval)
       }
     }
   },
diff --git a/Source/UBCS-WEB/src/components/Master/MasterTree.vue b/Source/UBCS-WEB/src/components/Master/MasterTree.vue
index c1e383e..3948716 100644
--- a/Source/UBCS-WEB/src/components/Master/MasterTree.vue
+++ b/Source/UBCS-WEB/src/components/Master/MasterTree.vue
@@ -211,6 +211,7 @@
         this.TableRend(); // TableHeadRend() 鏂规硶瀹屾垚鍚庡啀鎵ц TableRend()
         this.$emit('nodeClick', this.templateOids)
         this.$emit("codeClassifyOid", this.nodeClickList.oid)
+        this.$emit("nodeClickList", this.nodeClickList)
       } catch (error) {
         // 澶勭悊閿欒
         this.$message.error(error)
diff --git a/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue b/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue
index cb2027c..e3dbe61 100644
--- a/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue
+++ b/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue
@@ -100,7 +100,7 @@
                               :visible.sync="editvisible"
                               type="edit" @submit="EditSumbit"></FormTemplateDialog>
           <!--          鎵归噺缂栬緫-->
-          <MasterEditBulk :visible.sync="bulkeditvisible" ></MasterEditBulk>
+<!--          <MasterEditBulk :visible.sync="bulkeditvisible" ></MasterEditBulk>-->
           <!--          鏁版嵁璇︽儏-->
           <FormTemplateDialog :codeClassifyOid="this.codeClassifyOid" :codeRuleOid="this.codeRuleOid"
                                :rowOid="this.LinkObject.oid" :templateOid="templateOid"
@@ -133,6 +133,10 @@
                           :tableData="tableData"
                           :tableHeadData="tableHeadFindData" :templateOid="templateOid"
                           :visible.sync="dialogPush"></MasterTransfer>
+          <!--        瀵煎叆-->
+          <BatchImport v-if="batchImportData.visible" v-bind="batchImportData" :resetTable="CrudRend"
+                       :visible.sync="batchImportData.visible" :tableHeadData="tableHeadFindData" :selectRow="selectRow">
+          </BatchImport>
           <!--          鐩镐技椤�-->
           <ResembleQueryDialog :codeClassifyOid="codeClassifyOid" :codeRuleOid="this.codeRuleOid" :rowOid="rowOid"
                                :templateOid="templateOid" :visible.sync="similarVisible"></ResembleQueryDialog>
@@ -144,12 +148,6 @@
             </el-pagination>
           </div>
         </div>
-      </div>
-      <div>
-<!--        瀵煎叆-->
-        <BatchImport v-if="batchImportData.visible" v-bind="batchImportData" :resetTable="CrudRend"
-                     :visible.sync="batchImportData.visible">
-        </BatchImport>
       </div>
       <div class="bottom">
         <el-collapse v-model="visibleNames" @change="handleCollapse">
@@ -241,7 +239,10 @@
     Treedata: {
       type: Array
     },
-
+    nodeClickList:{
+      type:Array,
+      default:[]
+    }
   },
   data() {
     return {
@@ -523,7 +524,7 @@
         //  鏍囧噯淇
         if (uniqueFlag === 'CODEAMEND') return this.codeAMENDHandler()
         //鎵归噺缂栬緫
-        if (uniqueFlag === 'bulkEdit') return this.bulkEditHandler()
+        if (uniqueFlag === 'bulkEdit') return this.bulkEditHandler("bulkEdit")
       });
     },
     //鏍囧噯鐢宠
@@ -550,7 +551,12 @@
       }
     },
     //鎵归噺缂栬緫
-    bulkEditHandler(){
+    bulkEditHandler(type){
+      console.log(this.nodeClickList)
+      if(this.nodeClickList.children.length >= 1){
+        this.$message.warning('褰撳墠閫夋嫨鐨勫垎绫讳笉鏄彾瀛愯妭鐐癸紝涓嶅厑璁告壒閲忕紪杈戯紒')
+        return;
+      }
       if(this.selectRow.length <= 0){
         this.$message.warning('璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹紒')
         return;
@@ -558,7 +564,9 @@
       const Editing = this.selectRow.every(item => item.lcstatus === 'Editing');
 
       if (Editing) {
-        this.bulkeditvisible = true;
+        this.batchImportData.visible = true
+        this.batchImportData.type = type
+        this.batchImportData.codeClassifyOid = this.codeClassifyOid
       } else {
         this.$message.warning('閫夋嫨鐨勬暟鎹腑鏈夌紪鐮佺姸鎬佷笉鏄�滅紪杈戜腑鈥濓紝涓嶅彲缂栬緫锛�');
       }
@@ -576,6 +584,7 @@
         // const requestData = this.selectRow.forEach(item => {
         //   return { oids: item.oid, btmName: item.btmname };
         // });
+
         const oids = this.selectRow.map(item => item.oid).join(',');
         applyGroupCode({oids, btmName: this.selectRow[0].btmname}).then(res => {
           if (res.data.code == 200) {
diff --git a/Source/UBCS-WEB/src/views/MasterData/items.vue b/Source/UBCS-WEB/src/views/MasterData/items.vue
index 49816c3..f84b48b 100644
--- a/Source/UBCS-WEB/src/views/MasterData/items.vue
+++ b/Source/UBCS-WEB/src/views/MasterData/items.vue
@@ -15,6 +15,7 @@
           @tableHeadBttoms="tableHeadBttoms"
           @tableHeadDataFateher="tableHeadDatas"
           @tableHeadFindData="tableHeadFindDatas"
+          @nodeClickList="nodeClickLists"
           @total="totals"
         >
         </master-tree>
@@ -35,6 +36,7 @@
         :tableHeadFindData="tableHeadFindData"
         :templateOid="templateOid"
         :total="this.total"
+        :nodeClickList="this.nodeClickList"
         @currentPage="currentPages"
         @pageSize="pageSizes"
       >
@@ -67,12 +69,16 @@
       total: "",
       isLoading: false,
       tableHeadFindData: {},
-      TreeValue: ''
+      TreeValue: '',
+      nodeClickList:[]
     }
   },
   created() {
   },
   methods: {
+    nodeClickLists(val){
+      this.nodeClickList=val;
+    },
     TreeValueEmit(val) {
       this.TreeValue = val
     },
diff --git a/Source/UBCS-WEB/vue.config.js b/Source/UBCS-WEB/vue.config.js
index 264ceae..fcfbd7d 100644
--- a/Source/UBCS-WEB/vue.config.js
+++ b/Source/UBCS-WEB/vue.config.js
@@ -26,9 +26,9 @@
     proxy: {
       '/api': {
         //鏈湴鏈嶅姟鎺ュ彛鍦板潃
-        target: 'http://127.0.0.1:37000',
+        // target: 'http://127.0.0.1:37000',
         // target: 'http://192.168.1.51:37000',
-        // target: 'http://dev.vci-tech.com:37000',
+        target: 'http://dev.vci-tech.com:37000',
         //yxc
         // target: 'http:// 192.168.0.104:37000',
         // target: 'http://192.168.0.105:37000',

--
Gitblit v1.9.3