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

---
 /dev/null                         |  106 -----------------------------------
 src/views/sceneryInfo/index.vue   |   64 +++++++++++++++++----
 src/views/geographyData/index.vue |    8 +-
 3 files changed, 56 insertions(+), 122 deletions(-)

diff --git a/src/views/geographyData/index.vue b/src/views/geographyData/index.vue
index 2389b01..f47a7f8 100644
--- a/src/views/geographyData/index.vue
+++ b/src/views/geographyData/index.vue
@@ -14,7 +14,7 @@
       </div>
     </transition>
 
-    <el-card shadow="never">
+    <el-card shadow="never" style="width: 45%">
       <template #header>
         <el-row :gutter="10" class="mb8">
           <el-col :span="1.5">
@@ -35,11 +35,11 @@
 
       <el-table v-loading="loading" :data="geographyDataList" @selection-change="handleSelectionChange">
         <el-table-column type="selection" width="55" align="center" />
-        <el-table-column label="搴忓彿" align="center" type="index" width="50" />
+<!--        <el-table-column label="搴忓彿" align="center" type="index" width="50" />-->
         <el-table-column label="鍚嶇О" align="center" prop="name" />
         <el-table-column label="绫诲瀷" align="center" prop="type" />
         <el-table-column label="鎵�灞炶闀�" align="center" prop="townStreetName" />
-        <el-table-column label="鎻忚堪" align="center" prop="description" />
+<!--        <el-table-column label="鎻忚堪" align="center" prop="description" />-->
         <el-table-column label="鏍囪鐘舵��" align="center" prop="status">
           <template #default="scope">
             <span v-show="scope.row['status'] == 1">宸叉爣璁�</span>
@@ -340,4 +340,4 @@
 .el-input-width {
   width: 265px;
 }
-</style>
\ No newline at end of file
+</style>
diff --git a/src/views/indicatorInfo/index.vue b/src/views/indicatorInfo/index.vue
deleted file mode 100644
index 4f9becb..0000000
--- a/src/views/indicatorInfo/index.vue
+++ /dev/null
@@ -1,106 +0,0 @@
-<template>
-  <div class="p-2">
-    <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="submitForm">纭� 瀹�</el-button>
-    </div>
-  </div>
-</template>
-
-<script setup lang="ts">
-import { ref, reactive, onMounted, toRefs } from 'vue';
-import { listIndicatorInfo, updateIndicatorInfo } from '@/api/indicatorInfo';
-import { IndicatorInfoVO, IndicatorInfoForm } from '@/api/indicatorInfo/types';
-import { ElForm, ElFormItem, ElRadioGroup, ElRadio, ElButton } from 'element-plus';
-
-const { proxy } = getCurrentInstance() as ComponentInternalInstance;
-
-const indicatorInfoList = ref<IndicatorInfoVO[]>([]);
-const buttonLoading = ref(false);
-const loading = ref(true);
-const total = ref(0);
-
-const indicatorInfoFormRef = ref<ElFormInstance>();
-
-const initFormData: IndicatorInfoForm = {
-  id: undefined,
-  indicatorName: undefined,
-  status: undefined
-}
-const data = reactive({
-  form: {...initFormData},
-  queryParams: {
-    pageNum: 1,
-    pageSize: 10,
-    indicatorName: undefined,
-    createTime: undefined,
-    status: undefined,
-    params: {}
-  },
-  rules: {
-    id: [
-      { required: true, message: "缂栧彿涓嶈兘涓虹┖", trigger: "blur" }
-    ],
-    indicatorName: [
-      { required: true, message: "鎸囨爣鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }
-    ],
-    status: [
-      { required: true, message: "鐘舵�� 1鑷畾涔� 2鎸囨爣鍙栧�间笉鑳戒负绌�", trigger: "change" }
-    ]
-  }
-});
-
-const { queryParams, form, rules } = toRefs(data);
-
-/** 鏌ヨ鎸囨爣鍙栧�煎垪琛� */
-const getList = async () => {
-  loading.value = true;
-  try {
-    const res = await listIndicatorInfo(queryParams.value);
-    indicatorInfoList.value = res.rows;
-    total.value = res.total;
-  } catch (error) {
-    console.error(error);
-  } finally {
-    loading.value = false;
-  }
-}
-
-/** 鎻愪氦鎸夐挳 */
-const submitForm = async () => {
-  try {
-    // 寰幆鎻愪氦姣忎釜鍗曠嫭鐨勫璞�
-    for (const indicator of indicatorInfoList.value) {
-      const object = {
-        id: indicator.id,
-        status: indicator.status
-      };
-      console.log(object)
-      await updateIndicatorInfo(object);
-    }
-    await getList();
-    proxy?.$modal.msgSuccess("淇敼鎴愬姛");
-  } catch (error) {
-    console.error(error);
-  } finally {
-    buttonLoading.value = false;
-  }
-}
-
-onMounted(() => {
-  getList();
-});
-</script>
-
-<style scoped>
-.p-2 {
-  padding: 2rem;
-}
-</style>
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