Jelajahi Sumber

设备档案卡tab适配全局配置

luoaoxuan 1 tahun lalu
induk
melakukan
cb08299ec2
1 mengubah file dengan 18 tambahan dan 12 penghapusan
  1. 18 12
      src/views/component/device/deviceDialog.vue

+ 18 - 12
src/views/component/device/deviceDialog.vue

@@ -735,6 +735,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
+import { getSetting } from '@/utils/query'
 import dayjs from 'dayjs'
 import dayjs from 'dayjs'
 import ibpsUserSelector from '@/business/platform/org/selector'
 import ibpsUserSelector from '@/business/platform/org/selector'
 import { getequipmentCard, saveEquipmentCard } from '@/api/platform/device/device'
 import { getequipmentCard, saveEquipmentCard } from '@/api/platform/device/device'
@@ -780,6 +781,7 @@ export default {
                 { label: '停用、报废记录', name: 'seven', component: 'ScrappedRecord', isKeepAlive: true },
                 { label: '停用、报废记录', name: 'seven', component: 'ScrappedRecord', isKeepAlive: true },
                 { label: '性能验证记录', name: 'eight', component: 'PvRecord', isKeepAlive: true }
                 { label: '性能验证记录', name: 'eight', component: 'PvRecord', isKeepAlive: true }
             ],
             ],
+            tabList: {},
             filter: [{
             filter: [{
                 descVal: '1',
                 descVal: '1',
                 includeSub: true,
                 includeSub: true,
@@ -1008,8 +1010,12 @@ export default {
         }
         }
     },
     },
 
 
-    mounted () {
-        console.log(this.params)
+    async mounted () {
+        const tabList = await getSetting(this, 'device', 'tabList')
+        if (tabList) {
+            console.debug(tabList)
+            this.tabList = tabList
+        }
         this.init()
         this.init()
     },
     },
     methods: {
     methods: {
@@ -1221,22 +1227,22 @@ export default {
             this.loading = true
             this.loading = true
             this.isEdit = !!(this.params && this.params.id)
             this.isEdit = !!(this.params && this.params.id)
             this.isSheKou = this.deptList[0].positionId === '1166372468122714112' // 判断是否是蛇口医院
             this.isSheKou = this.deptList[0].positionId === '1166372468122714112' // 判断是否是蛇口医院
-            // 加载tab
-            const sql = `select tabs_option_ from t_ipcc where org_ = '${this.org}' limit 1`
-            const { variables: { data: optionData }} = await this.$common.request('sql', sql)
-            if (optionData.length > 0 && optionData?.[0]?.tabs_option_) {
-                const optionArr = optionData[0].tabs_option_.split(',')
-                const newTab = []
-                for (let i = 0; i < optionArr.length; i++) {
-                    const item = optionArr[i]
-                    const t = this.tabItems.find(j => j.label === item)
+
+            // 根据全局配置动态生成tab
+            const newTab = []
+            for (const key in this.tabList) {
+                if (Object.hasOwnProperty.call(this.tabList, key)) {
+                    const newLabel = this.tabList[key]
+                    const t = this.tabItems.find(i => i.label === key)
                     if (t) {
                     if (t) {
+                        t.label = newLabel
                         newTab.push(t)
                         newTab.push(t)
                     }
                     }
                 }
                 }
+            }
+            if (newTab.length > 0) {
                 this.tabItems = newTab
                 this.tabItems = newTab
             }
             }
-            console.log('tab', this.tabItems)
 
 
             if (this.isEdit) {
             if (this.isEdit) {
                 const { data } = await getequipmentCard({ id: this.params.id })
                 const { data } = await getequipmentCard({ id: this.params.id })