瀏覽代碼

平衡表-静态表

jwyu 1 年之前
父節點
當前提交
8367b0e3b3

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

@@ -186,6 +186,21 @@ export const balanceSeasonChart=params=>{
 	return http.post('/datamanage/excel_info/balance/chartLegend/preview',params)
 }
 
+//平衡表获取版本列表
+export const balanceTableVersion=params=>{
+	return http.get('/datamanage/excel_info/balance/version',params)
+}
+
+//平衡表存为静态表
+export const balanceTableSaveStatic=params=>{
+	return http.post('/datamanage/excel_info/balance/static/add',params)
+}
+
+//平衡表静态表重命名
+export const balanceStaticTableRename=params=>{
+	return http.post('/datamanage/excel_info/balance/version/modify',params)
+}
+
 
 /* =====自定义表格====== */
 

+ 2 - 1
src/lang/modules/ETATables/En.js

@@ -176,6 +176,7 @@ export default {
   BalanceSheet:{
     version:'Version',
     active_table:'Active',
-    save_static_table:'Save as a static table'
+    save_static_table:'Save as a static table',
+    only_edit:'Editable',
   },
 };

+ 3 - 1
src/lang/modules/ETATables/Zh.js

@@ -188,6 +188,8 @@ export default {
   BalanceSheet:{
     version:'版本',
     active_table:'动态表',
-    save_static_table:'存为静态表'
+    save_static_table:'存为静态表',
+    only_edit:'只看可编辑',
+    
   },
 };

+ 119 - 29
src/views/datasheet_manage/balanceSheetEdit.vue

@@ -8,7 +8,7 @@
             :placeholder="$t('OnlineExcelPage.please_table_name_ipt')"
             style="width: 200px"
             clearable
-            :disabled="isView"
+            :disabled="isView||isStaticTable"
           >
           </el-input>
         </li>
@@ -26,7 +26,7 @@
             }"
             clearable
             :placeholder="$t('OnlineExcelPage.select_table_category')"
-            :disabled="isView"
+            :disabled="isView||isStaticTable"
           />
         </li>
         <li>
@@ -46,7 +46,7 @@
             }"
             clearable
             :placeholder="$t('OnlineExcelPage.Co_editor')"
-            :disabled="isView"
+            :disabled="isView||isStaticTable"
           />
         </li>
       </ul>
@@ -55,17 +55,33 @@
         <el-select
           v-model="sheetForm.version"
           style="width: 90px; margin-right: 5px"
+          @change="handleVersionChange"
         >
           <el-option
             v-for="item in versionOpts"
-            :key="item.key"
-            :label="item.label"
-            :value="item.key"
+            :key="item.ExcelInfoId"
+            :label="item.VersionName"
+            :value="item.ExcelInfoId"
           ></el-option>
         </el-select>
-        <el-button type="primary" @click="handleShowSaveStaticTable" v-if="!isView">{{
+        <!-- 存为静态表按钮 -->
+        <el-button type="primary" @click="handleShowSaveStaticTable" v-if="!isView&&!isStaticTable">{{
           $t("BalanceSheet.save_static_table")
         }}</el-button>
+        <!-- 静态表操作 -->
+        <span v-if="!isView&&isStaticTable">
+        <span
+          class="editsty"
+          @click="handleShowSaveStaticTable('rename')"
+          style="margin-right: 10px"
+          >{{$t('MyEtaPage.option_op_rename')}}</span
+        >
+        <span
+          class="deletesty"
+          @click="handleStaticTableDel"
+          >{{$t("Table.delete_btn")}}</span
+        >
+        </span>
         <div>
           <!-- {{ $t("OnlineExcelPage.table_explaination_text") }} -->
           <el-tooltip effect="dark">
@@ -86,25 +102,25 @@
         <!-- 预览页面操作按钮 -->
         <template v-if="isView">
           <!-- <div> -->
-            <span
+          <span
             class="editsty"
             @click="itemHandle(excelInfo, 'edit')"
             style="margin-right: 10px"
-            v-if="isSheetBtnShow('edit')&&excelInfo.Button.OpButton"
+            v-if="isSheetBtnShow('edit')&&excelInfo.Button&&excelInfo.Button.OpButton"
             >{{excelInfo.CanEdit?$t("ETable.Btn.edit_btn"):excelInfo.Editor+$t('OnlineExcelPage.editing_msg')}}</span
           >
           <span
             class="editsty"
             @click="itemHandle(excelInfo, 'refresh')"
             style="margin-right: 10px"
-            v-if="isSheetBtnShow('refresh')&&excelInfo.Button.RefreshButton"
+            v-if="isSheetBtnShow('refresh')&&excelInfo.Button&&excelInfo.Button.RefreshButton"
             >{{ $t("ETable.Btn.refresh_btn") }}</span
           >
           <span
             class="editsty"
             @click="itemHandle(excelInfo, 'save')"
             style="margin-right: 10px"
-            v-if="isSheetBtnShow('otherSave')&&excelInfo.Button.CopyButton"
+            v-if="isSheetBtnShow('otherSave')&&excelInfo.Button&&excelInfo.Button.CopyButton"
             >{{ $t("ETable.Btn.save_as") }}</span
           >
           <span
@@ -118,7 +134,7 @@
             class="deletesty"
             @click="itemHandle(excelInfo, 'del')"
             style="margin-right: 10px"
-            v-if="isSheetBtnShow('del')&&excelInfo.Button.DeleteButton"
+            v-if="isSheetBtnShow('del')&&excelInfo.Button&&excelInfo.Button.DeleteButton"
             >{{ $t("Table.delete_btn") }}</span
           >
           <!-- </div> -->
@@ -154,6 +170,7 @@
     <BalanceTable 
       ref="balanceTableRef"
       :disabled="isView"
+      :isStaticTable="isStaticTable"
     />
 
     <!-- 存为静态表弹窗 -->
@@ -161,7 +178,7 @@
       :visible.sync="showSaveStaticTable"
       :close-on-click-modal="false"
       :modal-append-to-body='false'
-      :title="$t('OnlineExcelPage.save_static_table')"
+      :title="isStaticTable?$t('MyEtaPage.option_op_rename'):$t('OnlineExcelPage.save_static_table')"
       @close="showSaveStaticTable=false"
       custom-class="dialog"
       center
@@ -267,6 +284,16 @@ export default {
       }));
       return options;
     },
+    // 当前是否为静态表
+    isStaticTable(){
+      let flag=false
+      this.versionOpts.forEach(item=>{
+        if(item.ExcelInfoId===this.sheetForm.version&&item.BalanceType==1){
+          flag=true
+        }
+      })
+      return flag
+    },
     saveOtherFormRule(){
       return {
         name: [
@@ -289,20 +316,15 @@ export default {
         name: '',
         classify: '',
         user: '',
-        version: 0
+        version: Number(this.$route.query.id),
       },
       classifyArr: [],
       userList: [],//系统用户
       updateTime: moment().format('YYYY-MM-DD HH:mm:ss'),
-      versionOpts: [
-        {
-          label: this.$t('BalanceSheet.active_table'),
-          key: 0
-        }
-      ],
+      versionOpts: [],
 
       showSaveStaticTable:false,//存为静态表弹窗
-      staticTableName:'',
+      staticTableName:moment().format('YYYY-MM-DD'),
 
       /* 另存为 */
       isSaveOther: false,
@@ -318,6 +340,7 @@ export default {
     this.getSystemUserList()
     this.getChildTable()
     this.getDetail()
+    this.getVersionList()
   },
   beforeRouteLeave(to,from,next){
     console.log('退出编辑',from);
@@ -325,11 +348,22 @@ export default {
       this.markFinishStatus()
     }
     next()
-  },
-  beforeDestroy(){
-    
   },
   methods: {
+    // 获取版本列表
+    getVersionList(){
+      sheetInterface.balanceTableVersion({ExcelInfoId:this.sheetId}).then(res=>{
+        if(res.Ret===200){
+          const arr=res.Data.List||[]
+          this.versionOpts=arr
+        }
+      })
+    },
+
+    handleVersionChange(){
+      this.getChildTable()
+    },
+
     cancelSaveOther() {
       this.$refs.formRef.resetFields();
       this.saveOtherForm = {
@@ -356,23 +390,79 @@ export default {
       this.cancelSaveOther();
     },
 
-    handleShowSaveStaticTable(){
-      this.staticTableName=''
+    handleShowSaveStaticTable(type){
+      console.log(type);
+      if(type==='rename'){
+        this.versionOpts.forEach(item=>{
+          if(item.ExcelInfoId===this.sheetForm.version){
+            this.staticTableName=item.VersionName
+          }
+        })
+      }else{
+        this.staticTableName=this.$moment().format('YYYY-MM-DD')
+      }
       this.showSaveStaticTable=true
     },
-    // 创建静态表
+    // 创建/重命名静态表
     createdStaticTable(){
       if(!this.staticTableName){
         this.$message.warning(this.$t('OnlineExcelPage.save_static_table_tip'))
         return
       }
+      // 重命名
+      if(this.isStaticTable){
+        sheetInterface.balanceStaticTableRename({
+          ExcelInfoId:Number(this.sheetForm.version),
+          VersionName:this.staticTableName
+        }).then(res=>{
+          if(res.Ret===200){
+            this.getVersionList()
+            this.showSaveStaticTable=false
+          }
+        })
+        return
+      }
+
+      sheetInterface.balanceTableSaveStatic({
+        ExcelInfoId:Number(this.sheetForm.version),
+        VersionName:this.staticTableName
+      }).then(res=>{
+        if(res.Ret===200){
+          this.getVersionList()
+          this.sheetForm.version=res.Data.ExcelInfoId
+          this.getChildTable()
+          this.showSaveStaticTable=false
+        }
+      })
+    },
+
+    // 删除当前静态表
+    handleStaticTableDel(){
+      this.$confirm(this.$t('ETable.Msg.is_del_table_msg') , this.$t('Confirm.prompt') , {
+        confirmButtonText:  this.$t('Dialog.confirm_btn'),
+        cancelButtonText: this.$t('Dialog.cancel_btn'),
+        type: "warning",
+      }).then(()=>{
+        sheetInterface.classifyDel({
+          ExcelClassifyId:0,
+          ExcelInfoId:Number(this.sheetForm.version),
+          Source: 5
+        }).then(res=>{
+          if(res.Ret===200){
+            this.$message.success(res.Msg);
+            this.sheetForm.version=Number(this.sheetId)
+            this.getVersionList()
+            this.getChildTable()
+          }
+        })
+      }).catch(()=>{})
     },
 
     //获取所有子表数据
     async getChildTable(){
-      if(!this.sheetId) return
+      if(!this.sheetForm.version) return
       const res = await sheetInterface.getBalanceChildTable({
-				ParentId: Number(this.sheetId)
+				ParentId: Number(this.sheetForm.version)
 			})
       if(res.Ret !== 200)  return
       this.$refs.balanceTableRef.initSheetListData(res.Data.List||[]);

+ 5 - 1
src/views/datasheet_manage/components/BalanceSheetChartItem.vue

@@ -14,7 +14,7 @@
             <span>{{$t('Chart.Detail.source')}}:{{ JSON.parse(chartInfo.SourcesFrom).text}}</span>
             <div>
                 <!-- 加入我的图库 -->
-                <span class="btn-o" @click="handleAddMyChart">{{$t('Chart.chart_addmy_btn')}}</span>
+                <span class="btn-o" @click="handleAddMyChart" v-if="!isStaticTable">{{$t('Chart.chart_addmy_btn')}}</span>
                 <!-- 编辑 -->
                 <span class="btn-o" v-if="!disabled" @click="handleEditChart">{{$t('Chart.chart_edit_btn')}}</span>
                 <!-- 删除 -->
@@ -45,6 +45,10 @@ export default {
         disabled: { //是否只预览
             type: Boolean,
             default: false,
+        },
+        isStaticTable:{
+            type: Boolean,
+            default: false,
         }
     },
     mixins: [chartSetMixin],

+ 5 - 0
src/views/datasheet_manage/components/BalanceTable.vue

@@ -249,6 +249,7 @@
             <BalanceSheetChartItem 
               :chartData="item"
               :disabled="disabled"
+              :isStaticTable="isStaticTable"
               v-for="item in chartList" 
               :key="item.ChartInfo.ChartInfoId"
               @edit="handleEditChart"
@@ -410,6 +411,10 @@ export default {
     disabled: { //是否只预览
       type: Boolean,
       default: false,
+    },
+    isStaticTable:{//当前是否为静态表
+      type: Boolean,
+      default: false,
     }
   },
   components: {

+ 1 - 1
src/views/datasheet_manage/sheetList.vue

@@ -22,7 +22,7 @@
             v-model="isShowMe"
             style="margin-left:20px"
             @change="() => { getTreeData();getPublicList() }"
-          >{{$t('Chart.only_see_mine')}}</el-checkbox>
+          >{{sourceMap[$route.path]===5?$t('BalanceSheet.only_edit'):$t('Chart.only_see_mine')}}</el-checkbox>
 
         </div>
         <div class="search-cont">