|
@@ -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) {
|
|
|
|