From 9ab96bc476c2c64f2bb8bcbf098e0073d1e5d38b Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期五, 22 三月 2024 15:33:45 +0800
Subject: [PATCH] 指标管理

---
 src/views/sceneryInfo/index.vue |   64 ++++++++++++++++++++++++++------
 1 files changed, 52 insertions(+), 12 deletions(-)

diff --git a/src/views/sceneryInfo/index.vue b/src/views/sceneryInfo/index.vue
index 1adff03..faf0dc6 100644
--- a/src/views/sceneryInfo/index.vue
+++ b/src/views/sceneryInfo/index.vue
@@ -1,21 +1,14 @@
 <template>
   <div class="p-2">
-    <el-card shadow="never">
+    <el-card shadow="never" style="width: 40%">
       <template #header>
-        <el-row :gutter="10" class="mb8">
+        <el-row :gutter="20" class="mb8">
           <el-col :span="1.5">
-            <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['demo:sceneryInfo:add']">鏂板</el-button>
+            鏅尯閰嶇疆
           </el-col>
           <el-col :span="1.5">
-            <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['demo:sceneryInfo:edit']">淇敼</el-button>
+            <el-button size="small" type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['demo:sceneryInfo:add']">鏂板</el-button>
           </el-col>
-          <el-col :span="1.5">
-            <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['demo:sceneryInfo:remove']">鍒犻櫎</el-button>
-          </el-col>
-          <el-col :span="1.5">
-            <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['demo:sceneryInfo:export']">瀵煎嚭</el-button>
-          </el-col>
-          <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
         </el-row>
       </template>
 
@@ -44,6 +37,26 @@
           @pagination="getList"
       />
     </el-card>
+
+    <el-card shadow="never" style="width: 40%;margin-top: 20px">
+      <template #header>
+        <el-row :gutter="10" class="mb8">
+          鎸囨爣閰嶇疆
+        </el-row>
+      </template>
+      <el-form ref="indicatorInfoFormRef" :model="form" :rules="rules" label-width="80px">
+        <el-form-item :label="indicator.indicatorName" v-for="indicator in indicatorInfoList" :key="indicator.id">
+          <el-radio-group v-model="indicator.status">
+            <el-radio :label="2">鎺ュ彛鍙栧��</el-radio>
+            <el-radio :label="1">鑷畾涔�</el-radio>
+          </el-radio-group>
+        </el-form-item>
+      </el-form>
+      <div class="dialog-footer">
+        <el-button :loading="buttonLoading" type="primary" @click="submitForm2">淇� 瀛�</el-button>
+      </div>
+    </el-card>
+
     <!-- 娣诲姞鎴栦慨鏀规櫙鍖洪厤缃俊鎭璇濇 -->
     <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
       <el-form ref="sceneryInfoFormRef" :model="form" :rules="rules" label-width="80px">
@@ -67,7 +80,12 @@
 <script setup name="SceneryInfo" lang="ts">
 import { listSceneryInfo, getSceneryInfo, delSceneryInfo, addSceneryInfo, updateSceneryInfo } from '@/api/sceneryInfo';
 import { SceneryInfoVO, SceneryInfoQuery, SceneryInfoForm } from '@/api/sceneryInfo/types';
+import { listIndicatorInfo, updateIndicatorInfo } from '@/api/indicatorInfo';
+import { IndicatorInfoVO } from '@/api/indicatorInfo/types';
+import { ElButton, ElForm, ElFormItem, ElRadio, ElRadioGroup } from "element-plus";
+import { ref } from "vue";
 
+const indicatorInfoList = ref<IndicatorInfoVO[]>([]);
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 
 const sceneryInfoList = ref<SceneryInfoVO[]>([]);
@@ -125,10 +143,12 @@
 
 /** 鏌ヨ鏅尯閰嶇疆淇℃伅鍒楄〃 */
 const getList = async () => {
-  loading.value = true;
   const res = await listSceneryInfo(queryParams.value);
   sceneryInfoList.value = res.rows;
   total.value = res.total;
+
+  const res2 = await listIndicatorInfo(queryParams.value);
+  indicatorInfoList.value = res2.rows;
   loading.value = false;
 }
 
@@ -213,6 +233,26 @@
   }, `sceneryInfo_${new Date().getTime()}.xlsx`)
 }
 
+/** 鎸囨爣淇濆瓨鎸夐挳 */
+const submitForm2 = async () => {
+  try {
+    // 寰幆鎻愪氦姣忎釜鍗曠嫭鐨勫璞�
+    for (const indicator of indicatorInfoList.value) {
+      const object = {
+        id: indicator.id,
+        status: indicator.status
+      };
+      await updateIndicatorInfo(object);
+    }
+    await getList();
+    proxy?.$modal.msgSuccess("淇敼鎴愬姛");
+  } catch (error) {
+    console.error(error);
+  } finally {
+    buttonLoading.value = false;
+  }
+}
+
 onMounted(() => {
   getList();
 });

--
Gitblit v1.8.0