From 97187b246b94dd58cb585ebaed7e8644d2f00119 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期一, 03 四月 2023 00:26:04 +0800
Subject: [PATCH] update 调整代码格式

---
 src/views/system/config/index.vue |  280 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 140 insertions(+), 140 deletions(-)

diff --git a/src/views/system/config/index.vue b/src/views/system/config/index.vue
index f461ecd..2f3efe0 100644
--- a/src/views/system/config/index.vue
+++ b/src/views/system/config/index.vue
@@ -1,143 +1,3 @@
-<script setup name="Config" lang="ts">
-import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config";
-import { ConfigForm, ConfigQuery, ConfigVO } from "@/api/system/config/types";
-import { ComponentInternalInstance } from "vue";
-import { DateModelType } from 'element-plus';
-
-const { proxy } = getCurrentInstance() as ComponentInternalInstance;
-const { sys_yes_no } = toRefs<any>(proxy?.useDict("sys_yes_no"));
-
-const configList = ref<ConfigVO[]>([]);
-const loading = ref(true);
-const showSearch = ref(true);
-const ids = ref<Array<number | string>>([]);
-const single = ref(true);
-const multiple = ref(true);
-const total = ref(0);
-const dateRange = ref<[DateModelType, DateModelType]>(['', '']);
-
-const queryFormRef = ref(ElForm);
-const configFormRef = ref(ElForm);
-const dialog = reactive<DialogOption>({
-  visible: false,
-  title: ''
-});
-const initFormData: ConfigForm = {
-  configId: undefined,
-  configName: '',
-  configKey: '',
-  configValue: '',
-  configType: "Y",
-  remark: ''
-}
-const data = reactive<PageData<ConfigForm, ConfigQuery>>({
-  form: {...initFormData},
-  queryParams: {
-    pageNum: 1,
-    pageSize: 10,
-    configName: '',
-    configKey: '',
-    configType: '',
-  },
-  rules: {
-    configName: [{ required: true, message: "鍙傛暟鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }],
-    configKey: [{ required: true, message: "鍙傛暟閿悕涓嶈兘涓虹┖", trigger: "blur" }],
-    configValue: [{ required: true, message: "鍙傛暟閿�间笉鑳戒负绌�", trigger: "blur" }]
-  }
-});
-
-const { queryParams, form, rules } = toRefs(data);
-
-/** 鏌ヨ鍙傛暟鍒楄〃 */
-const getList = async () => {
-  loading.value = true;
-  const res = await listConfig(proxy?.addDateRange(queryParams.value, dateRange.value));
-  configList.value = res.rows;
-  total.value = res.total;
-  loading.value = false;
-}
-/** 鍙栨秷鎸夐挳 */
-const cancel = () => {
-  reset();
-  dialog.visible = false;
-}
-/** 琛ㄥ崟閲嶇疆 */
-const reset = () => {
-  form.value = {...initFormData};
-  configFormRef.value.resetFields();
-}
-/** 鎼滅储鎸夐挳鎿嶄綔 */
-const handleQuery = () => {
-  queryParams.value.pageNum = 1;
-  getList();
-}
-/** 閲嶇疆鎸夐挳鎿嶄綔 */
-const resetQuery = () => {
-  dateRange.value = ['', ''];
-  queryFormRef.value.resetFields();
-  handleQuery();
-}
-/** 澶氶�夋閫変腑鏁版嵁 */
-const handleSelectionChange = (selection: ConfigVO[]) => {
-  ids.value = selection.map(item => item.configId);
-  single.value = selection.length != 1;
-  multiple.value = !selection.length;
-}
-/** 鏂板鎸夐挳鎿嶄綔 */
-const handleAdd = () => {
-  dialog.visible = true;
-  dialog.title = "娣诲姞鍙傛暟";
-  nextTick(() => {
-    reset();
-  })
-}
-/** 淇敼鎸夐挳鎿嶄綔 */
-const handleUpdate = (row?: ConfigVO) => {
-  dialog.visible = true;
-  dialog.title = "淇敼鍙傛暟";
-  const configId = row?.configId || ids.value[0];
-  nextTick(async () => {
-    reset();
-    const res = await getConfig(configId);
-    form.value = res.data;
-  })
-}
-/** 鎻愪氦鎸夐挳 */
-const submitForm = () => {
-  configFormRef.value.validate(async (valid: boolean) => {
-    if (valid) {
-      form.value.configId ? await updateConfig(form.value) : await addConfig(form.value);
-      proxy?.$modal.msgSuccess("鎿嶄綔鎴愬姛");
-      dialog.visible = false;
-      getList();
-    }
-  });
-}
-/** 鍒犻櫎鎸夐挳鎿嶄綔 */
-const handleDelete = async (row?: ConfigVO) => {
-  const configIds = row?.configId || ids.value;
-  await proxy?.$modal.confirm('鏄惁纭鍒犻櫎鍙傛暟缂栧彿涓�"' + configIds + '"鐨勬暟鎹」锛�');
-  await delConfig(configIds);
-  getList();
-  proxy?.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-}
-/** 瀵煎嚭鎸夐挳鎿嶄綔 */
-const handleExport = () => {
-  proxy?.download("system/config/export", {
-    ...queryParams.value
-  }, `config_${new Date().getTime()}.xlsx`);
-}
-/** 鍒锋柊缂撳瓨鎸夐挳鎿嶄綔 */
-const handleRefreshCache = async () => {
-  await refreshCache();
-  proxy?.$modal.msgSuccess("鍒锋柊缂撳瓨鎴愬姛");
-}
-
-onMounted(() => {
-  getList();
-})
-</script>
-
 <template>
   <div class="p-2">
     <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
@@ -259,3 +119,143 @@
     </el-dialog>
   </div>
 </template>
+
+<script setup name="Config" lang="ts">
+import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config";
+import { ConfigForm, ConfigQuery, ConfigVO } from "@/api/system/config/types";
+import { ComponentInternalInstance } from "vue";
+import { DateModelType } from 'element-plus';
+
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const { sys_yes_no } = toRefs<any>(proxy?.useDict("sys_yes_no"));
+
+const configList = ref<ConfigVO[]>([]);
+const loading = ref(true);
+const showSearch = ref(true);
+const ids = ref<Array<number | string>>([]);
+const single = ref(true);
+const multiple = ref(true);
+const total = ref(0);
+const dateRange = ref<[DateModelType, DateModelType]>(['', '']);
+
+const queryFormRef = ref(ElForm);
+const configFormRef = ref(ElForm);
+const dialog = reactive<DialogOption>({
+    visible: false,
+    title: ''
+});
+const initFormData: ConfigForm = {
+    configId: undefined,
+    configName: '',
+    configKey: '',
+    configValue: '',
+    configType: "Y",
+    remark: ''
+}
+const data = reactive<PageData<ConfigForm, ConfigQuery>>({
+    form: {...initFormData},
+    queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        configName: '',
+        configKey: '',
+        configType: '',
+    },
+    rules: {
+        configName: [{ required: true, message: "鍙傛暟鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }],
+        configKey: [{ required: true, message: "鍙傛暟閿悕涓嶈兘涓虹┖", trigger: "blur" }],
+        configValue: [{ required: true, message: "鍙傛暟閿�间笉鑳戒负绌�", trigger: "blur" }]
+    }
+});
+
+const { queryParams, form, rules } = toRefs(data);
+
+/** 鏌ヨ鍙傛暟鍒楄〃 */
+const getList = async () => {
+    loading.value = true;
+    const res = await listConfig(proxy?.addDateRange(queryParams.value, dateRange.value));
+    configList.value = res.rows;
+    total.value = res.total;
+    loading.value = false;
+}
+/** 鍙栨秷鎸夐挳 */
+const cancel = () => {
+    reset();
+    dialog.visible = false;
+}
+/** 琛ㄥ崟閲嶇疆 */
+const reset = () => {
+    form.value = {...initFormData};
+    configFormRef.value.resetFields();
+}
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+    queryParams.value.pageNum = 1;
+    getList();
+}
+/** 閲嶇疆鎸夐挳鎿嶄綔 */
+const resetQuery = () => {
+    dateRange.value = ['', ''];
+    queryFormRef.value.resetFields();
+    handleQuery();
+}
+/** 澶氶�夋閫変腑鏁版嵁 */
+const handleSelectionChange = (selection: ConfigVO[]) => {
+    ids.value = selection.map(item => item.configId);
+    single.value = selection.length != 1;
+    multiple.value = !selection.length;
+}
+/** 鏂板鎸夐挳鎿嶄綔 */
+const handleAdd = () => {
+    dialog.visible = true;
+    dialog.title = "娣诲姞鍙傛暟";
+    nextTick(() => {
+        reset();
+    })
+}
+/** 淇敼鎸夐挳鎿嶄綔 */
+const handleUpdate = (row?: ConfigVO) => {
+    dialog.visible = true;
+    dialog.title = "淇敼鍙傛暟";
+    const configId = row?.configId || ids.value[0];
+    nextTick(async () => {
+        reset();
+        const res = await getConfig(configId);
+        form.value = res.data;
+    })
+}
+/** 鎻愪氦鎸夐挳 */
+const submitForm = () => {
+    configFormRef.value.validate(async (valid: boolean) => {
+        if (valid) {
+            form.value.configId ? await updateConfig(form.value) : await addConfig(form.value);
+            proxy?.$modal.msgSuccess("鎿嶄綔鎴愬姛");
+            dialog.visible = false;
+            getList();
+        }
+    });
+}
+/** 鍒犻櫎鎸夐挳鎿嶄綔 */
+const handleDelete = async (row?: ConfigVO) => {
+    const configIds = row?.configId || ids.value;
+    await proxy?.$modal.confirm('鏄惁纭鍒犻櫎鍙傛暟缂栧彿涓�"' + configIds + '"鐨勬暟鎹」锛�');
+    await delConfig(configIds);
+    getList();
+    proxy?.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+}
+/** 瀵煎嚭鎸夐挳鎿嶄綔 */
+const handleExport = () => {
+    proxy?.download("system/config/export", {
+        ...queryParams.value
+    }, `config_${new Date().getTime()}.xlsx`);
+}
+/** 鍒锋柊缂撳瓨鎸夐挳鎿嶄綔 */
+const handleRefreshCache = async () => {
+    await refreshCache();
+    proxy?.$modal.msgSuccess("鍒锋柊缂撳瓨鎴愬姛");
+}
+
+onMounted(() => {
+    getList();
+})
+</script>

--
Gitblit v1.9.3