Browse Source

管理文件夹修改

duy 1 month ago
parent
commit
83ffd9a56b

+ 25 - 2
src/api/ruleManage/fileRule.js

@@ -31,7 +31,7 @@ export const edit = (data) => {
     return request({
         url: '/api/blade-business/PrivateStandard/edit',
         method: 'post',
-        data
+        data,
     });
 }
 
@@ -129,8 +129,31 @@ export const getConditionSet = (params) => {
 //查询关联元素
 export const getElementJoin = (params) => {
     return request({
-        url: '/api/blade-business//uStandardInfo/getElementJoin',
+        url: '/api/blade-business/uStandardInfo/getElementJoin',
+        method: 'get',
+        params
+    })
+}
+
+//效果预览
+//查询关联元素
+export const effectPreview = (params) => {
+    return request({
+        url: '/api/blade-business/uStandardInfo/effectPreview',
         method: 'get',
         params
     })
+}
+
+//新增数据
+export const updateTypeByTwo = (data) => {
+    return request({
+        url: '/api/blade-business/PrivateStandard/updateTypeByTwo',
+        method: 'post',
+    
+        data,
+         headers: {
+        'Content-Type': 'multipart/form-data'
+        },
+    });
 }

+ 12 - 8
src/views/codeRule/PreviewResult.vue

@@ -27,7 +27,7 @@
            <div class="title-container">
                     <span>技术指标</span>
             </div>
-        <div class="tech-content" v-for="item in jsList" :key="item.id" v-loading="preViewLoad">
+        <div class="tech-content" v-for="item in jsList" :key="item.id" >
           <div class="tech-item">
             <div class="tech-label">{{ item.name }}</div>
             <div class="tech-val">{{ item.symbolName }}</div>
@@ -66,7 +66,7 @@ export default {
   data() {
     return {
       visible: false,
-
+      jsList:[],
       selectedValues: [],
       preViewLoad:false,
     }
@@ -79,7 +79,8 @@ export default {
       show() {
         this.visible = true
          this.initializeSelectedValues();
-             this.getPreviewData('');
+          this.jsList = [];
+          
       },
        initializeSelectedValues() {
           // 根据 ypList 的长度初始化 selectedValues
@@ -90,13 +91,15 @@ export default {
          handleSelectChange(index, value) {
           this.selectedValues[index] = value;
             const ids = this.selectedValues.filter(val => val !== '').join(',');
+            
+            
             if (ids !== '') {
               this.getPreviewData(ids);
             }else{
-               this.getPreviewData('');
-           
+              this.jsList = [];
             }
 
+
          
         },
         getPreviewData(ids){
@@ -108,9 +111,10 @@ export default {
                   this.preViewLoad = false;
               if (res.data.code === 200) {
                 this.jsList = res.data.data;
-                this.$nextTick(() => {
-                   this.jsList = res.data.data;
-                });
+            
+              
+               
+                
 
               } else {
                   this.preViewLoad = false;

+ 172 - 37
src/views/codeRule/ruleManage.vue

@@ -341,9 +341,40 @@
             </template>
 
           </el-table-column>
+          <el-table-column property="name" label="文件名称" v-if="!isShowList" >
+            <template slot-scope="scope">
+              
+              <el-input v-model="scope.row.standardFile.fileName" placeholder="请输入内容"></el-input>
+              <el-button
+                type="text"
+                size="small"
+                style="color: rgb(219, 55, 55);"
+                @click="delFile(scope.row,scope.$index )"
+              >
+                <i class="el-icon-delete"></i> 删除
+    </el-button>
+            </template>
+
+          </el-table-column>
+          
           <el-table-column label="操作" width="200">
             <template slot-scope="scope">
+        
+       
+           
+              <el-upload
+              v-if="!isShowList"
+                class="upload-demo"
+                action="#"
+                 :on-change="file => handleFileUpload(file, scope.row, scope.$index)"
+                :before-upload="beforeUpload"
+                :show-file-list="false"
+                :auto-upload="false"
+              >
+                 <el-button size="small" type="text">文件上传</el-button>
+              </el-upload>
              
+         
               <el-button type="text" size="small" style="color: rgb(219, 55, 55);" @click="delManange(scope.$index,scope.row)">删除</el-button>
             </template>
 
@@ -417,7 +448,7 @@ import {getLazytree} from "@/api/manager/wbsprivate";
 import ConditionsSet from './ConditionsSet.vue'
 import LinkEle from "./LinkEle.vue";
 import PreviewResult from './PreviewResult.vue'
-import {getPage,edit,add,deleteItem,getById, addInfo,editInfo,getInfoPage,deleteItemInfo } from "@/api/ruleManage/fileRule.js";
+import {getPage,edit,add,deleteItem,getById, addInfo,editInfo,getInfoPage,deleteItemInfo,updateTypeByTwo } from "@/api/ruleManage/fileRule.js";
 import { getStore, setStore } from "@/util/store";
  import { getDictionary } from "@/api/system/dict";
   export default {
@@ -519,7 +550,11 @@ import { getStore, setStore } from "@/util/store";
         },
         fqOptions: [
         ],
-        conditionsSetVisible:false//条件设置弹窗是否显示
+        conditionsSetVisible:false,//条件设置弹窗是否显示
+        isUploadVisible:false,//上传文件弹窗是否显示
+        delIds:[],
+        delFileIds:[]
+
 
        
       };
@@ -940,56 +975,156 @@ import { getStore, setStore } from "@/util/store";
     
     // 管理文件夹
     manageFolder(){
+       this.delFileIds=[];
+       this.delIds=[];
+       
+
       this.manageVisible = true;
       if(!this.isShowList){
          this.manageData=JSON.parse(JSON.stringify(this.ruleItemOptionsDetail));
+         this.manageData.forEach(item=>{
+          item.filesCount=0;
+         })
       }else{
          this.manageData=JSON.parse(JSON.stringify(this.ruleItemOptions));
       }
      
     },
     delManange(index,row){
-           this.$confirm('删除后,数据将无法恢复,是否确认删除!', '提示', {
-            confirmButtonText: '确定',
-            cancelButtonText: '取消',
-            type: 'warning'
-          }).then(() => {
-          //  this.manageData.splice(index, 1);
-            deleteItem({id:row.id}).then((res) => {
-              if(res.data.code==200){
-                this.$message.success(res.data.msg);
-                this.getRuleItemOptions();
-                this.manageData.splice(index, 1);
-              }else{
-                this.$message.error(res.data.msg);
-              }
-            });
-          }).catch(() => {
-            this.$message.info('已取消删除');
-          })
+      
+          if(this.showList){
+                   this.$confirm('删除后,数据将无法恢复,是否确认删除!', '提示', {
+                  confirmButtonText: '确定',
+                  cancelButtonText: '取消',
+                  type: 'warning'
+                }).then(() => {
+                //  this.manageData.splice(index, 1);
+                  deleteItem({id:row.id}).then((res) => {
+                    if(res.data.code==200){
+                      this.$message.success(res.data.msg);
+                      this.getRuleItemOptions();
+                      this.manageData.splice(index, 1);
+                    }else{
+                      this.$message.error(res.data.msg);
+                    }
+                  });
+                }).catch(() => {
+                  this.$message.info('已取消删除');
+                })
+          }else{
+            //记录每次删除文件的id,记录到数组里面
+            this.delIds.push(row.id)
+              this.manageData.splice(index, 1);
+              row.filesCount = 0; // 设置文件大小
+
+
+
+          }
+    },
+    putFile(item,index){
+
+      this.isUploadVisible = true;
+    },
+    handleFileUpload(file,row,index) {
+    
+      
+      if(!file) return
+  
+      row.file=file.raw; // 获取原始文件对象
+      row.standardFile.fileName = file.name; // 设置文件名
+      row.filesCount = 1; // 设置文件大小
+
+
+
+      // 在这里处理文件上传逻辑
+    },
+    delFile(row,id){
+      console.log(row,'row');
+      const {standardFile}=row;
+    console.log(standardFile,'standardFile');
+    if(standardFile&&standardFile.id){
+      this.delFileIds.push(standardFile.id)
+     
+
+    }
+    row.filesCount = 0; // 设置文件大小
+
+     row.file=null; // 获取原始文件对象
+      row.standardFile.fileName = ''; // 设置文件名
+// 如果有文件ID,则执行删除操作
+
+
+      
     },
     manageSave(){
       this.manageLoad = true;
+ 
   
       const arr = this.manageData.map(item => ({ id: item.id, name: item.name,type:this.isShowList?1:2 }));
-      
-      edit(arr ).then((res) => {
-        if (res.data.code === 200) {
-          this.$message.success(res.data.msg);
-          this.manageVisible = false;
-          if(!this.isShowList){
-            this.getRuleDetail(this.ruleItem);
-            this.manageData = JSON.parse(JSON.stringify(this.ruleItemOptionsDetail));
-          }else{
-            this.getRuleItemOptions();
-              this.manageData = JSON.parse(JSON.stringify(this.ruleItemOptions));
-          }
-        } else {
-          this.$message.error(res.data.msg);
+      console.log(arr,'arr');
+      if(this.isShowList){
+               edit(arr ).then((res) => {
+                if (res.data.code === 200) {
+                  this.$message.success(res.data.msg);
+                  this.manageVisible = false;
+                  if(!this.isShowList){
+                    this.getRuleDetail(this.ruleItem);
+                    this.manageData = JSON.parse(JSON.stringify(this.ruleItemOptionsDetail));
+                  }else{
+                    this.getRuleItemOptions();
+                      this.manageData = JSON.parse(JSON.stringify(this.ruleItemOptions));
+                  }
+                } else {
+                  this.$message.error(res.data.msg);
+                }
+              }).finally(() => {
+                this.manageLoad = false;
+              });
+        }else{
+        let objData=this.manageData.map(item => ({ id: item.id, name: item.name,filesCount: item.filesCount,file:item.file }));
+        let filesArr=this.manageData.map(item => item.file);
+        const formData = new FormData();
+       console.log(objData,'objData');
+       
+        formData.append('data', new Blob([JSON.stringify(objData)], {
+              type: 'application/json'
+        }))
+        let ids=this.delIds
+        formData.append('delIds', new Blob([JSON.stringify(ids)], {
+              type: 'application/json'
+        }))
+        let delFileIds=this.delFileIds;
+          formData.append('delFileIds', new Blob([JSON.stringify(delFileIds)], {
+              type: 'application/json'
+        }))
+        if(filesArr.length>0){
+              for(let i=0;i<filesArr.length;i++){
+                formData.append('files', filesArr[i]);
+            }
+
         }
-      }).finally(() => {
-        this.manageLoad = false;
-      });
+        console.log(formData,'formData');
+        
+          updateTypeByTwo(formData ).then((res) => {
+                if (res.data.code === 200) {
+                  this.$message.success(res.data.msg);
+                  this.manageVisible = false;
+                  if(!this.isShowList){
+                    this.getRuleDetail(this.ruleItem);
+                    this.manageData = JSON.parse(JSON.stringify(this.ruleItemOptionsDetail));
+                  }else{
+                    this.getRuleItemOptions();
+                      this.manageData = JSON.parse(JSON.stringify(this.ruleItemOptions));
+                  }
+                } else {
+                  this.$message.error(res.data.msg);
+                }
+              }).finally(() => {
+                this.manageLoad = false;
+              });
+
+      }
+ 
     },
       handleEdit(item, index) {
   

+ 1 - 1
src/views/manager/projectinfo/codeSet.vue

@@ -65,7 +65,7 @@
             <el-input v-model="scope.row.data" placeholder="*自动获取各试验参数掩码" v-if="scope.row.rule===3" disabled></el-input>
             <el-input v-model="scope.row.data" placeholder="*自动获取当前年份" v-if="scope.row.rule===4" disabled></el-input>
              <el-input v-model="scope.row.data" placeholder="*自动获取当前月份" v-if="scope.row.rule===5" disabled></el-input>
-              <el-input-number v-model="scope.row.data"  label="输入子增长的起始值和位数" :controls="false"></el-input-number>
+              <el-input-number v-model="scope.row.data"  label="输入子增长的起始值和位数" :controls="false"  v-if="scope.row.rule===6" style="width: 100%;"></el-input-number>
            </div>
             <span v-else>{{ scope.row.data }}</span>
           </template>