From 24fd83dff534ff4d60e29b055f5694dae2a3ad01 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期日, 29 九月 2024 16:04:46 +0800
Subject: [PATCH] update

---
 src/views/ecg/devmanage/DeviceForm.vue |   30 +++++++++++++++++++++++++++---
 1 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/src/views/ecg/devmanage/DeviceForm.vue b/src/views/ecg/devmanage/DeviceForm.vue
index 90e165a..0efc91d 100644
--- a/src/views/ecg/devmanage/DeviceForm.vue
+++ b/src/views/ecg/devmanage/DeviceForm.vue
@@ -48,6 +48,18 @@
           />
         </el-select>
       </el-form-item>
+
+      <el-form-item v-if="formType !== 'create'" label="鐘舵��" prop="state">
+        <el-radio-group v-if="formType === 'devState'" v-model="formData.state">
+          <el-radio key="0" :label="0"> 绌洪棽涓� </el-radio>
+          <el-radio key="5" :label="5"> 宸查鍙� </el-radio>
+          <el-radio key="10" :label="10"> 宸茶鏈� </el-radio>
+          <el-radio key="20" :label="20"> 宸查仐澶� </el-radio>
+          <el-radio key="30" :label="30"> 缁翠慨涓� </el-radio>
+          <el-radio key="40" :label="40"> 宸叉姤搴� </el-radio>
+        </el-radio-group>
+        <span v-else>{{tranlateDevState(formData.state)}}</span>
+      </el-form-item>
     </el-form>
     <template #footer>
       <el-button @click="submitForm" type="primary" :disabled="formLoading">纭� 瀹�</el-button>
@@ -75,7 +87,8 @@
   devId: '',
   category: '',
   brand: '',
-  model: ''
+  model: '',
+  lost: 0,
 })
 const formRules = reactive({
 })
@@ -121,9 +134,12 @@
     if (formType.value === 'create') {
       await DeviceApi.createDevice(data)
       message.success(t('common.createSuccess'))
-    } else {
+    } else if (formType.value === 'update') {
       await DeviceApi.updateDevice(data)
       message.success(t('common.updateSuccess'))
+    } else {
+      await DeviceApi.updateDeviceState(data)
+      message.success(t('common.updateStateSuccess'))
     }
     dialogVisible.value = false
     // 鍙戦�佹搷浣滄垚鍔熺殑浜嬩欢
@@ -146,6 +162,7 @@
   formRef.value?.resetFields()
 }
 
+const categoryOptions = ref<DictDataType[]>([])
 const brandOptions = ref<OptionsVO[]>([])
 const modelOptions = ref<OptionsVO[]>([])
 
@@ -164,7 +181,14 @@
   formData.value.model = modelOptions.value.length === 0 ? "" : modelOptions.value[0].value
 }
 
-const categoryOptions = ref<DictDataType[]>([])
+const tranlateDevState = (state) => {
+  if (state === 0) return "绌洪棽";
+  else if (state=== 5) return "宸查鐢�";
+  else if (state=== 10) return "宸茶鏈�";
+  else if (state=== 20) return "宸查仐澶�";
+  else if (state=== 30) return "缁翠慨涓�";
+  else if (state=== 40) return "宸叉姤搴�";
+}
 
 onMounted( async () => {
   console.info("onMount DeviceForm...")

--
Gitblit v1.9.3