From f9c926251d45fb4930317c545d2d77b5f1a338a9 Mon Sep 17 00:00:00 2001
From: master <master@163.com>
Date: 星期二, 08 三月 2022 14:52:08 +0800
Subject: [PATCH] 添加设备分组页面以及功能

---
 src/cool/modules/deviceGroup/views/deviceGroup.vue |  134 +++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 130 insertions(+), 4 deletions(-)

diff --git a/src/cool/modules/deviceGroup/views/deviceGroup.vue b/src/cool/modules/deviceGroup/views/deviceGroup.vue
index 76812a8..13d8177 100644
--- a/src/cool/modules/deviceGroup/views/deviceGroup.vue
+++ b/src/cool/modules/deviceGroup/views/deviceGroup.vue
@@ -1,5 +1,131 @@
 <template>
-  <div>
-    <h1>璁惧鍒嗙粍椤甸潰</h1>
-  </div>
-</template>
\ No newline at end of file
+  <cl-crud :ref="setRefs('crud')"
+           @load="onLoad">
+    <el-row type="flex"
+            align="middle">
+      <!-- 鍒锋柊鎸夐挳 -->
+      <cl-refresh-btn />
+      <!-- 鏂板鎸夐挳 -->
+      <cl-add-btn />
+      <!-- 鍒犻櫎鎸夐挳 -->
+      <cl-multi-delete-btn />
+      <cl-flex1 />
+      <!-- 鍏抽敭瀛楁悳绱� -->
+      <cl-search-key />
+    </el-row>
+
+    <el-row>
+      <!-- 鏁版嵁琛ㄦ牸 -->
+      <cl-table :ref="setRefs('table')"
+                v-bind="table" />
+    </el-row>
+
+    <el-row type="flex">
+      <cl-flex1 />
+      <!-- 鍒嗛〉鎺т欢 -->
+      <cl-pagination />
+    </el-row>
+
+    <!-- 鏂板銆佺紪杈� -->
+    <cl-upsert :ref="setRefs('upsert')"
+               v-bind="upsert" />
+  </cl-crud>
+</template>
+
+<script lang="ts">
+import { defineComponent, reactive } from "vue";
+import { CrudLoad, Upsert, Table } from "@cool-vue/crud/types";
+import { useCool } from "/@/cool";
+
+export default defineComponent({
+	setup() {
+		const { refs, setRefs, service } = useCool();
+
+		// 鏂板銆佺紪杈戦厤缃�
+		const upsert = reactive<Upsert>({
+			items: [
+				{
+					label: "閫昏緫ID",
+					prop: "logic_id",
+					component: {
+						name: "el-input"
+					},
+					required: true
+				},
+				{
+					label: "閰嶇疆浜哄悕绉�",
+					prop: "configurator",
+					component: {
+						name: "el-input"
+					},
+					required: true
+				},
+				{
+					label: "澶囨敞",
+					prop: "remark",
+					component: {
+						name: "el-input"
+					}
+				},
+				{
+					label: "鐘舵��",
+					prop: "status",
+					component: {
+						name: "el-input"
+					}
+				}
+			]
+		});
+
+		// 琛ㄦ牸閰嶇疆
+		const table = reactive<Table>({
+			columns: [
+				{
+					type: "selection",
+					align: "center"
+				},
+				{
+					label: "搴忓彿",
+					prop: "id",
+					sortable: true //鏄惁鎺掑簭鍔熻兘
+				},
+				{
+					label: "閫昏緫ID",
+					prop: "logic_id"
+				},
+				{
+					label: "閰嶇疆浜哄悕绉�",
+					prop: "configurator"
+				},
+				{
+					label: "澶囨敞",
+					prop: "remark"
+				},
+				{
+					label: "鐘舵��",
+					prop: "status"
+				},
+				{
+					label: "鎿嶄綔",
+					type: "op"
+				}
+			]
+		});
+
+		// crud 鍔犺浇
+		function onLoad({ ctx, app }: CrudLoad) {
+			// 缁戝畾 service
+			ctx.service(service.deviceGroup.deviceGroup).done();
+			app.refresh();
+		}
+
+		return {
+			refs,
+			setRefs,
+			upsert,
+			table,
+			onLoad
+		};
+	}
+});
+</script>

--
Gitblit v1.9.1