Parcourir la source

fix: 同步demo分支的一些问题

lvkun il y a 2 ans
Parent
commit
fe7bff92f8

+ 5 - 4
config/proxy.ts

@@ -6,22 +6,23 @@
 module.exports = {
   dev: {
     '/user': {
-      target: 'http://124.222.113.37:9999',
+      target: 'http://120.223.238.91:8888',
       changeOrigin: true,
       pathRewrite: { '^/user': '' }
     },
     '/cvss': {
-      target: 'http://124.222.113.37:8080',
+      target: 'http://120.223.238.91:6666',
       changeOrigin: true,
       pathRewrite: { '^/cvss': '' }
     },
     '/iot': {
-      target: 'http://124.222.113.37:8888',
+      target: 'http://120.223.238.91:8888',
       changeOrigin: true,
       pathRewrite: { '^/iot': '' }
     },
     '/datacenter': {
-      target: 'http://152.136.36.115:7777',
+      // target: 'http://152.136.36.115:7777',
+      target: 'hhttp://120.223.238.91',
       changeOrigin: true,
       pathRewrite: { '^/datacenter': '' }
     }

+ 6 - 6
src/api/cvs/operator.ts

@@ -24,16 +24,16 @@ export const getOperatorType = () => {
   })
 }
 
-export const getOperatorById = (aiId: string) => {
+export const getOperatorById = (id: string) => {
   return request<CVS.Operator>({
-    url: `/model/${aiId}`,
+    url: `/model/${id}`,
     method: 'GET'
   })
 }
 
-export const delOperatorById = (aiId: string) => {
+export const delOperatorById = (id: string) => {
   return request<string>({
-    url: `/model/${aiId}`,
+    url: `/model/${id}`,
     method: 'DELETE'
   })
 }
@@ -46,9 +46,9 @@ export const addOperator = (data: CVS.Operator) => {
   })
 }
 
-export const updateOperatorName = (aiId: string, aiName: string) => {
+export const updateOperatorName = (id: string, aiName: string) => {
   return request<string>({
-    url: `/model/aiName?aiId=${aiId}&aiName=${aiName}`,
+    url: `/model/aiName?aiId=${id}&aiName=${aiName}`,
     method: 'PUT'
   })
 }

+ 1 - 1
src/api/iot/device.ts

@@ -251,7 +251,7 @@ export const getDeviceByGroup = (params: IOT.API.DEVICE.GroupQueryParams) => {
 
 export const removeDeviceByGroup = (id: string) => {
   return request<IOT.API.DEVICE.Device[]>({
-    url: '/device/group/' + id,
+    url: '/deviceGroup/' + id,
     method: 'DELETE'
   })
 }

+ 4 - 3
src/components/TableProV2/index.tsx

@@ -51,7 +51,7 @@ const TablePro = defineComponent({
 
     const paginationRef = ref({
       current: 1,
-      pageSize: pageSize,
+      pageSize: pageSize.value,
       total: 0
     })
 
@@ -79,6 +79,7 @@ const TablePro = defineComponent({
     const onChangePage = (page: number, pageSize: number) => {
       paginationRef.value.current = page
       paginationRef.value.pageSize = pageSize
+      reload()
     }
 
     const pureVisible = ref(true)
@@ -102,7 +103,7 @@ const TablePro = defineComponent({
 
     const opraMeun = (
       <Menu>
-        <Menu.Item key={0} onClick={() => ctx.emit('add')} > 新增 </Menu.Item>
+           { hiddenMeunKeys.value.includes('add') ? null : <Menu.Item key={0} onClick={() => ctx.emit('add')} > 新增 </Menu.Item> }
         <Menu.Item key={1} onClick={() => pure()} > 放大 </Menu.Item>
       </Menu>
     )
@@ -142,7 +143,7 @@ const TablePro = defineComponent({
                 </DropdownButton>
                 <DropdownButton
                     trigger={['click', 'hover']}
-                    overlay={ hiddenMeunKeys.value.length !== 1 ? opraMeun : null}
+                    overlay={ hiddenMeunKeys.value.length !== 2 ? opraMeun : null}
                   >
                     <div onClick={() => reload()} >刷新 </div>
                 </DropdownButton>

+ 6 - 6
src/controller/cvs/operatorController.ts

@@ -12,8 +12,8 @@ export class OperatorController {
     return data
   }
 
-  static async byId (aiId: string) {
-    const { data } = await getOperatorById(aiId)
+  static async byId (id: string) {
+    const { data } = await getOperatorById(id)
     return data
   }
 
@@ -22,8 +22,8 @@ export class OperatorController {
     return data
   }
 
-  static async del (aiId: string) {
-    const { msg, code } = await delOperatorById(aiId)
+  static async del (id: string) {
+    const { msg, code } = await delOperatorById(id)
     code === 200 ? message.success('删除成功') : message.error(msg)
   }
 
@@ -32,8 +32,8 @@ export class OperatorController {
     code === 200 ? message.success('新增成功') : message.error(msg)
   }
 
-  static async upadteName (aiId: string, aiName: string) {
-    const { code, msg } = await updateOperatorName(aiId, aiName)
+  static async upadteName (id: string, aiName: string) {
+    const { code, msg } = await updateOperatorName(id, aiName)
     code === 200 ? message.success('修改成功') : message.error(msg)
   }
 

+ 4 - 4
src/pages/Iot/dashboard/deviceAccess/index.vue

@@ -123,21 +123,21 @@ const dataSource = ref([])
 
 const getStatisList = async () => {
   ModelController.count().then(r => {
-    // sourceList[0].value = r.data.TOTAL
+    sourceList[0].value = r.data.TOTAL
   })
 
   DeviceContriller.count().then(r => {
-    // sourceList[3].value = r.data.TOTAL
+    sourceList[3].value = r.data.TOTAL
     sourceList[4].value = r.data.CONNECT
     sourceList[5].value = r.data.INIT
   })
 
   RuleController.forwardCount().then(r => {
-    // sourceList[1].value = r.data.TOTAL
+    sourceList[1].value = r.data.TOTAL
   })
 
   RuleController.linkCount().then(r => {
-    // sourceList[2].value = r.data.TOTAL
+    sourceList[2].value = r.data.TOTAL
   })
 }
 

+ 1 - 0
src/pages/Iot/dataServer/openApi.vue

@@ -194,6 +194,7 @@ const ok = async () => {
   } else {
     await DataController.postAppId({ appId: state.appId })
     state.visible = false
+    state.appId = ''
   }
 }
 

+ 2 - 0
src/pages/Iot/device/group.vue

@@ -471,6 +471,7 @@ const ok = async () => {
       await DeviceContriller.postDeviceGroup(groupState)
       state.groupModalVisible = false
       await getDeviceGroup()
+      resetFields({})
     })
   } else {
     if (state.selectTree.hasChildren) {
@@ -479,6 +480,7 @@ const ok = async () => {
       console.log('删除设备群组')
       state.groupModalVisible = false
       await DeviceContriller.removeDeviceGroup(state.treeActiveKey)
+      resetFields({})
     }
   }
 }

+ 1 - 0
src/pages/Iot/device/index.vue

@@ -303,6 +303,7 @@ const openModal = (opraState: 'add' | 'update', record:Partial<IOT.API.DEVICE.De
   state.visible = true
   state.opraState = opraState
   getModelList()
+  resetFieldsDevice({})
 }
 
 const getDevicePage = async () => {

+ 1 - 1
src/pages/Iot/model/models.vue

@@ -172,7 +172,7 @@ const ok = () => {
     await ModelController.postModelTemplate(modelRef)
     state.visible = false
     getModelsPage()
-  })
+  }).catch(e => e)
 }
 
 const getModel = async () => {

+ 5 - 3
src/pages/Iot/task/manage.vue

@@ -295,8 +295,10 @@ const selectDeviceRef = ref('')
 watch(
   () => modalRef.taskConfig.modelId,
   () => {
-    getCmdList()
-    getAttrList()
+    if (modalRef.taskConfig.modelId) {
+      getCmdList()
+      getAttrList()
+    }
   }
 )
 
@@ -354,7 +356,7 @@ const ok = () => {
 
     state.visible = false
     getTaskPage()
-  })
+  }).catch(e => e)
 }
 
 const delTask = async (id: string) => {

+ 1 - 0
src/pages/cvs/dataServer/dataServer.vue

@@ -42,6 +42,7 @@
                     :columns="serviceMap?.columns"
                     @add="openModal"
                     ref="tableProDom"
+                    :hiddenMeunKeys="['add']"
                 >
                     <template #search >
                         <a-space>

+ 1 - 0
src/pages/cvs/nodes/index.vue

@@ -5,6 +5,7 @@
     :serviceParams="{serverType}"
     :columns="columns"
     ref="tableProDom"
+    :hiddenMeunKeys="['add']"
   >
     <template #search >
       <a-space>

+ 13 - 5
src/pages/cvs/operator/manage.vue

@@ -18,7 +18,14 @@
                           <a-space>
                             <a @click="updateName(record)" >更改名称</a>
                             <a @click="pushVersion(record)" >新增版本</a>
-                            <a @click="delOperator(record)" >删除</a>
+                            <a-popconfirm
+                              title="确实要删除吗?"
+                              ok-text="确定"
+                              cancel-text="取消"
+                              @confirm="delOperator(record)"
+                            >
+                            <a >删除</a>
+                          </a-popconfirm>
                           </a-space>
                         </template>
                     </template>
@@ -125,14 +132,14 @@ const { resetFields, validate, validateInfos } = useForm(operatorState, {
 
 const submit = () => {
   validate().then(async () => {
-    state.modalType === 'add' ? await OperatorController.add(operatorState) : await OperatorController.upadteName(operatorState.aiId, operatorState.aiName)
+    state.modalType === 'add' ? await OperatorController.add(operatorState) : await OperatorController.upadteName(operatorState.id! as unknown as string, operatorState.aiName)
     closeModal()
     tableProDom.value.reload()
   }).catch(() => {})
 }
 
 const delOperator = async (record) => {
-  await OperatorController.del(record.aiId)
+  await OperatorController.del(record.id)
   tableProDom.value.reload()
 }
 
@@ -147,6 +154,7 @@ const closeModal = () => {
 const openModal = () => {
   state.visible = true
   state.modalType = 'add'
+  resetFields({})
 }
 
 const getOperatorType = async () => {
@@ -154,14 +162,14 @@ const getOperatorType = async () => {
 }
 
 const updateName = async (record) => {
-  const data = await OperatorController.byId(record.aiId)
+  const data = await OperatorController.byId(record.id)
   resetFields(data)
   state.modalType = 'update'
   state.visible = true
 }
 
 const pushVersion = (record) => {
-  router.push({ path: '/cvs/operator/version', query: { aiId: record.aiId } })
+  router.push({ path: '/cvs/operator/version', query: { aiId: record.id } })
 }
 
 onMounted(() => {

+ 1 - 0
src/pages/cvs/project/index.vue

@@ -5,6 +5,7 @@
     :serviceParams="{projectName}"
     :columns="columns"
     ref="tableProDom"
+    :hiddenMeunKeys="['add']"
   >
     <template #search >
       <a-space>

+ 4 - 1
src/pages/cvs/video/device.vue

@@ -525,7 +525,10 @@ const onChangeSpace = (spaceId: string) => {
 
 const closeModal = () => state.visible = false
 
-const openModal = () => state.visible = true
+const openModal = () => {
+  resetFields({})
+  state.visible = true
+}
 
 const getSpaceList = async () => {
   state.spaceList = await SpaceController.list()