master
2022-03-08 f9c926251d45fb4930317c545d2d77b5f1a338a9
添加设备分组页面以及功能
5个文件已修改
8个文件已添加
348 ■■■■■ 已修改文件
src/cool/modules/device/views/device.vue 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/cool/modules/deviceGroup/views/deviceGroup.vue 132 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/cool/modules/immediateTask/views/immediateTask.vue 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/cool/modules/index.ts 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/cool/modules/taskSetting/components/index.ts 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/cool/modules/taskSetting/directives/index.ts 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/cool/modules/taskSetting/index.ts 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/cool/modules/taskSetting/pages/index.ts 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/cool/modules/taskSetting/service/index.ts 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/cool/modules/taskSetting/store/index.ts 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/cool/modules/taskSetting/views/index.ts 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/cool/modules/taskSetting/views/taskSetting.vue 115 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/service/request.ts 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/cool/modules/device/views/device.vue
@@ -138,8 +138,8 @@
                    label: "运行状态",
                    prop: "status",
                    filters: [
                        { text: "0", value: "已停止" },
                        { text: "1", value: "正在运行" }
                        { text: 0, value: 0 },
                        { text: 1, value: 1 }
                    ]
                    // filters:"[{ text: '家', value: '家' }, { text: '公司', value: '公司' }]"
                },
src/cool/modules/deviceGroup/views/deviceGroup.vue
@@ -1,5 +1,131 @@
<template>
  <div>
    <h1>设备分组页面</h1>
  </div>
  <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>
src/cool/modules/immediateTask/views/immediateTask.vue
@@ -1,5 +1,70 @@
<template>
  <div>
    即时任务
  </div>
  <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: []
        });
        // 表格配置
        const table = reactive<Table>({
            columns: []
        });
        // crud 加载
        function onLoad({ ctx, app }: CrudLoad) {
            // 绑定 service
            ctx.service(service.xx).done();
            app.refresh();
        }
        return {
            refs,
            setRefs,
            upsert,
            table,
            onLoad
        };
    }
});
</script>
src/cool/modules/index.ts
@@ -18,5 +18,7 @@
    }
  },
  "huaneng",
  "device"
  "device",
  "deviceGroup",
  "taskSetting"
];
src/cool/modules/taskSetting/components/index.ts
New file
@@ -0,0 +1 @@
export default {};
src/cool/modules/taskSetting/directives/index.ts
New file
@@ -0,0 +1 @@
export default {};
src/cool/modules/taskSetting/index.ts
New file
@@ -0,0 +1,15 @@
import components from "./components";
import directives from "./directives";
import service from "./service";
import store from "./store";
import pages from "./pages";
import views from "./views";
export default {
    components,
    directives,
    service,
    store,
    pages,
    views
};
src/cool/modules/taskSetting/pages/index.ts
New file
@@ -0,0 +1 @@
export default [];
src/cool/modules/taskSetting/service/index.ts
New file
@@ -0,0 +1 @@
export default {};
src/cool/modules/taskSetting/store/index.ts
New file
@@ -0,0 +1 @@
export default {};
src/cool/modules/taskSetting/views/index.ts
New file
@@ -0,0 +1 @@
export default [];
src/cool/modules/taskSetting/views/taskSetting.vue
New file
@@ -0,0 +1,115 @@
<template>
  <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: []
        });
        // 表格配置
        const table = reactive<Table>({
            columns: [
                {
                    label: "id",
                    prop: "id"
                },
                {
                    label: "设备分组ID",
                    prop: "group_id"
                },
                {
                    label: "任务类型",
                    prop: "task_type"
                },
                {
                    label: "周期任务",
                    prop: "crontab_rule"
                },
                {
                    label: "任务内容描述",
                    prop: "task_content"
                },
                {
                    label: "任务参数",
                    prop: "task_params"
                },
                {
                    label: "任务命令格式",
                    prop: "task_command"
                },
                {
                    label: "设置人",
                    prop: "operator"
                },
                {
                    label: "备注",
                    prop: "remark"
                },
                {
                    label: "状态",
                    prop: "status"
                },
                {
                    label: "操作",
                    type: "op"
                }
            ]
        });
        // crud 加载
        function onLoad({ ctx, app }: CrudLoad) {
            // 绑定 service
            ctx.service(service.taskSetting.taskSetting).done();
            app.refresh();
        }
        return {
            refs,
            setRefs,
            upsert,
            table,
            onLoad
        };
    }
});
</script>
src/service/request.ts
@@ -42,6 +42,7 @@
        // 请求信息
        if (isDev) {
      console.log("config:", config);
            console.group(config.url);
            console.log("method:", config.method);
            console.table("data:", config.method == "get" ? config.params : config.data);