Browse Source

创建人按钮控制

Karsa 1 year ago
parent
commit
a01a2ada80
2 changed files with 26 additions and 10 deletions
  1. 9 0
      src/api/modules/sheetApi.js
  2. 17 10
      src/views/datasheet_manage/customAnalysis/list.vue

+ 9 - 0
src/api/modules/sheetApi.js

@@ -341,5 +341,14 @@ export const sheetAnalysisInterface = {
 	 */
 	sheetRefresh: params => {
 		return http.get('/custom_analysis/edb/refresh',params)
+	},
+
+	/**
+	 * 检查是否有同名表格
+	 * @param {*} params  ExcelName
+	 * @returns 
+	 */
+	checkSheetRepeat: params => {
+		return http.get('/custom_analysis/excel_by_name',params)
 	}
 }

+ 17 - 10
src/views/datasheet_manage/customAnalysis/list.vue

@@ -162,24 +162,24 @@
               {{ sheetDetailInfo.ExcelName }}
               <i class="el-icon-edit"/>
             </span>
-            <ul class="action-ul">
-              <li class="editsty" @click="HandleToPath" v-if="isSheetBtnShow('createedb')">生成指标</li>
-              <li class="editsty" @click="refreshSheet" v-if="isSheetBtnShow('refresh')">刷新指标</li>
-              <li class="editsty" @click="saveHandle" v-if="isSheetBtnShow('save')">保存</li>
+            <ul class="action-ul" v-if="sheetDetailInfo.Button">
+              <li class="editsty" @click="HandleToPath" v-if="isSheetBtnShow('createedb')&&sheetDetailInfo.Button.OpEdbButton">生成指标</li>
+              <li class="editsty" @click="refreshSheet" v-if="isSheetBtnShow('refresh')&&sheetDetailInfo.Button.RefreshEdbButton">刷新指标</li>
+              <li class="editsty" @click="saveHandle" v-if="isSheetBtnShow('save')&&sheetDetailInfo.Button.OpButton">保存</li>
               <li
                 class="editsty"
                 @click="saveOtherHandle"
-                v-if="isSheetBtnShow('otherSave')"
+                v-if="isSheetBtnShow('otherSave')&&sheetDetailInfo.Button.CopyButton"
               >
                 另存为
               </li>
               <li class="editsty" @click="downloadExcel
-              (sheetDetailInfo)" v-if="isSheetBtnShow('download')">
+              (sheetDetailInfo)" v-if="isSheetBtnShow('download')&&sheetDetailInfo.Button.DownloadButton">
                 下载
               </li>
               <li
                 class="deletesty"
-                v-if="isSheetBtnShow('del')"
+                v-if="isSheetBtnShow('del')&&sheetDetailInfo.Button.DeleteButton"
                 @click="delSheetHandle({cell:sheetDetailInfo, type:'del'})"
               >
                 删除
@@ -187,7 +187,7 @@
             </ul>
           </div>
 
-          <dataLoading :loading="isSheetLoading"/>
+          <!-- <dataLoading :loading="isSheetLoading"/> -->
 
           <!-- 表格 -->
           <div class="sheet-wrap">
@@ -217,6 +217,8 @@
           ref="sheetListWrap"
         />
       </div>
+
+      <dataLoading :loading="isSheetLoading"/>
     </div>
 
     <!-- 分类弹窗 -->
@@ -712,7 +714,7 @@ export default {
           // index: _.Sort, //工作表索引
           order: _.Sort, //工作表的下标
           name: _.SheetName,
-          calcChain: JSON.parse(_.CalcChain),
+          calcChain: _.CalcChain?JSON.parse(_.CalcChain):{},
           config: JSON.parse(_.Config),
           celldata: this.sheetAllcellData[index],
         }))
@@ -791,12 +793,16 @@ export default {
     },
 
     //选择文件上传
-    fileSelected(){ 
+    async fileSelected(){ 
       let file = document.getElementById('file').files[0];
       if(file){
         if(!file.name.includes('.xlsx')) return this.$message.warning("上传失败,格式不符合xlsx");
         if(file.size > 1.1*1024*1024) return this.$message.warning("上传文件最大不能超过1M");
 
+
+        const res = await sheetInterface.sheetAnalysisInterface.checkSheetRepeat({ExcelName: file.name})
+        if(res.Data.IsFind) return this.$message.warning('已有同名文件,请上传新文件')
+
         this.$store.commit('sheet/SET_UPLOADFIlES',[file])
         this.$router.push({ path: '/addAnalysisSheet' });
       } 
@@ -857,6 +863,7 @@ $normal-font: 14px;
   }
   .data-sheet-main {
     display: flex;
+    position: relative;
 
     .main-left {
       width: 400px;