Kaynağa Gözat

页面调整

lipenghui 4 ay önce
ebeveyn
işleme
c2307b2730

+ 1 - 2
src/api/pms/deviceattrmodel/index.ts

@@ -46,8 +46,7 @@ export const DeviceAttrModelApi = {
   // 获得设备属性
   getDeviceAttrModelListByDeviceCategoryId: async (params: any) => {
     return await request.get({
-      url: `/pms/iot-device-category-template-attrs/list-by-device-category-id`,
-      params
+      url: `/pms/iot-device-category-template-attrs/list-by-device-category-id?deviceCategoryId=`+params
     })
   },
 

+ 12 - 11
src/views/pms/device/IotDeviceForm.vue

@@ -341,7 +341,8 @@ import * as DeptApi from '@/api/system/dept'
 import * as ProductClassifyApi from '@/api/pms/productclassify'
 import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
 import { useTagsViewStore } from '@/store/modules/tagsView'
-import {getAttrTemplateByDeviceCategoryId} from "@/api/pms/devicetemplate";
+import {DeviceAttrModelApi} from "@/api/pms/deviceattrmodel";
+
 
 /** 设备台账 表单 */
 defineOptions({ name: 'IotDeviceForm' })
@@ -414,17 +415,17 @@ const list = ref([])
 
 const assetclasschange = () => {
   const assetClass = formData.value.assetClass
-  getAttrTemplateByDeviceCategoryId(assetClass).then(res => {
+  DeviceAttrModelApi.getDeviceAttrModelListByDeviceCategoryId(assetClass).then(res => {
     if (res){
-      if (res.attrs) {
-        res.attrs.forEach((item) => {
-          if (item.requiredFlag) {
-            const rule = {required: true, message: item.name+'不能为空', trigger: 'blur'}
-            item.rules.push(rule)
-          }
-        })
-        list.value = res.attrs
-      }
+      debugger
+      res.forEach((item) => {
+        if (item.requiredFlag) {
+          const rule = {required: true, message: item.name+'不能为空', trigger: 'blur'}
+          item.rules = []
+          item.rules.push(rule)
+        }
+      })
+      list.value = res
     } else {
       list.value = []
     }

+ 0 - 2
src/views/pms/device/index.vue

@@ -324,9 +324,7 @@ const { wsCache } = useCache()
 /** 初始化 **/
 onMounted(() => {
   const user = wsCache.get(CACHE_KEY.USER)
-  console.log(JSON.stringify(user))
   queryParams.deptId = user.user.deptId
-  debugger
   getList()
 })
 </script>

+ 3 - 3
src/views/system/tree/PmsTree.vue

@@ -233,9 +233,9 @@ watch(deptName, (val) => {
 //   document.removeEventListener('click', handleClickOutside)
 // })
 /** 初始化 */
-onMounted(async () => {
-  await getTreeInfo()
-})
+// onMounted(async () => {
+//   await getTreeInfo()
+// })
 </script>
 <style lang="scss" scoped>
 .custom-menu {

+ 5 - 1
src/views/system/tree/index.vue

@@ -115,6 +115,7 @@ import { IotInfoVO } from '@/api/pms/iotinfo'
 import { ref, onMounted, onUnmounted } from 'vue'
 
 import PmsTree from '@/views/system/tree/PmsTree.vue'
+import {CACHE_KEY, useCache} from "@/hooks/web/useCache";
 defineOptions({ name: 'IotTree' })
 
 const container = ref(null)
@@ -166,7 +167,8 @@ const queryParams = reactive({
   fileName: null,
   createTime: [],
   deviceId: null,
-  classId: null
+  classId: null,
+  deptId: undefined
 })
 // SPU 表单数据
 const formData = ref({
@@ -276,9 +278,11 @@ const resetQuery = () => {
   queryFormRef.value?.resetFields()
   handleQuery()
 }
+const { wsCache } = useCache()
 /** 初始化 */
 onMounted(async () => {
   // await getDetail()
+  queryParams.deptId = wsCache.get(CACHE_KEY.USER).user.deptId;
   await getList()
   // deviceId.value = params.id as unknown as number
 })