ljr-cli 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/bin/commands/init.js +3 -1
  2. package/bin/commands/sync.js +120 -16
  3. package/bin/templates/vue2.7.16/README.md +15 -13
  4. package/bin/templates/vue2.7.16/public/index.html +5 -5
  5. package/bin/templates/vue3.5.25-2025.12.4/.vscode/settings.json +1 -0
  6. package/bin/templates/vue3.5.25-2025.12.4/README.md +28 -17
  7. package/bin/templates/vue3.5.25-2025.12.4/auto-imports.d.ts +229 -0
  8. package/bin/templates/vue3.5.25-2025.12.4/components.d.ts +49 -0
  9. package/bin/templates/vue3.5.25-2025.12.4/eslint.config.ts +1 -0
  10. package/bin/templates/vue3.5.25-2025.12.4/index.html +2 -2
  11. package/bin/templates/vue3.5.25-2025.12.4/package.json +3 -1
  12. package/bin/templates/vue3.5.25-2025.12.4/pnpm-lock.yaml +480 -11
  13. package/bin/templates/vue3.5.25-2025.12.4/src/assets/images/login_bg.jpg +0 -0
  14. package/bin/templates/vue3.5.25-2025.12.4/src/assets/images/login_bg_black.jpg +0 -0
  15. package/bin/templates/vue3.5.25-2025.12.4/src/assets/images/sc_login_icon.png +0 -0
  16. package/bin/templates/vue3.5.25-2025.12.4/src/boot/el-icon.ts +9 -0
  17. package/bin/templates/vue3.5.25-2025.12.4/src/boot/index.ts +2 -0
  18. package/bin/templates/vue3.5.25-2025.12.4/src/boot/pinia.ts +8 -3
  19. package/bin/templates/vue3.5.25-2025.12.4/src/boot/style.ts +2 -1
  20. package/bin/templates/vue3.5.25-2025.12.4/src/components/layout/header.ts +97 -0
  21. package/bin/templates/vue3.5.25-2025.12.4/src/components/layout/header.vue +37 -13
  22. package/bin/templates/vue3.5.25-2025.12.4/src/components/layout/left-right.vue +3 -7
  23. package/bin/templates/vue3.5.25-2025.12.4/src/components/layout/menu.ts +19 -0
  24. package/bin/templates/vue3.5.25-2025.12.4/src/components/layout/menu.vue +89 -5
  25. package/bin/templates/vue3.5.25-2025.12.4/src/components/layout/up-down.vue +24 -0
  26. package/bin/templates/vue3.5.25-2025.12.4/src/components/login/change-password.vue +111 -0
  27. package/bin/templates/vue3.5.25-2025.12.4/src/components/login/user-login.vue +61 -0
  28. package/bin/templates/vue3.5.25-2025.12.4/src/css/base.css +204 -0
  29. package/bin/templates/vue3.5.25-2025.12.4/src/css/global.css +1596 -0
  30. package/bin/templates/vue3.5.25-2025.12.4/src/css/index.css +3 -0
  31. package/bin/templates/vue3.5.25-2025.12.4/src/css/theme.css +61 -0
  32. package/bin/templates/vue3.5.25-2025.12.4/src/dialogs/device/index.ts +1 -0
  33. package/bin/templates/vue3.5.25-2025.12.4/src/dialogs/dialog.vue +66 -0
  34. package/bin/templates/vue3.5.25-2025.12.4/src/dialogs/helper.ts +90 -0
  35. package/bin/templates/vue3.5.25-2025.12.4/src/dialogs/index.ts +2 -0
  36. package/bin/templates/vue3.5.25-2025.12.4/src/dialogs/template.ts +41 -0
  37. package/bin/templates/vue3.5.25-2025.12.4/src/dialogs/template.vue +29 -0
  38. package/bin/templates/vue3.5.25-2025.12.4/src/dialogs/user-info/index.ts +31 -0
  39. package/bin/templates/vue3.5.25-2025.12.4/src/dialogs/user-info/layout.ts +47 -0
  40. package/bin/templates/vue3.5.25-2025.12.4/src/dialogs/user-info/layout.vue +51 -0
  41. package/bin/templates/vue3.5.25-2025.12.4/src/dialogs/user-info/notification.ts +27 -0
  42. package/bin/templates/vue3.5.25-2025.12.4/src/dialogs/user-info/notification.vue +29 -0
  43. package/bin/templates/vue3.5.25-2025.12.4/src/dialogs/user-info/permission.ts +22 -0
  44. package/bin/templates/vue3.5.25-2025.12.4/src/dialogs/user-info/permission.vue +23 -0
  45. package/bin/templates/vue3.5.25-2025.12.4/src/directive/rememberScrollPosition.ts +1 -1
  46. package/bin/templates/vue3.5.25-2025.12.4/src/enums/device.ts +42 -0
  47. package/bin/templates/vue3.5.25-2025.12.4/src/enums/index.ts +2 -0
  48. package/bin/templates/vue3.5.25-2025.12.4/src/enums/status.ts +23 -0
  49. package/bin/templates/vue3.5.25-2025.12.4/src/pages/index/permission/role.ts +40 -0
  50. package/bin/templates/vue3.5.25-2025.12.4/src/pages/index/permission/role.vue +39 -0
  51. package/bin/templates/vue3.5.25-2025.12.4/src/pages/index/permission/user.vue +10 -0
  52. package/bin/templates/vue3.5.25-2025.12.4/src/pages/index/template/base-info.vue +5 -0
  53. package/bin/templates/vue3.5.25-2025.12.4/src/pages/index/template/base-info2.vue +5 -0
  54. package/bin/templates/vue3.5.25-2025.12.4/src/pages/index/template/list.ts +40 -0
  55. package/bin/templates/vue3.5.25-2025.12.4/src/pages/index/template/list.vue +39 -0
  56. package/bin/templates/vue3.5.25-2025.12.4/src/pages/index/template/store.vue +89 -0
  57. package/bin/templates/vue3.5.25-2025.12.4/src/pages/index.vue +7 -2
  58. package/bin/templates/vue3.5.25-2025.12.4/src/pages/login.vue +34 -64
  59. package/bin/templates/vue3.5.25-2025.12.4/src/stores/account(/351/200/211/351/241/271/345/274/217api/345/206/231/346/263/225/347/244/272/344/276/213).ts +49 -0
  60. package/bin/templates/vue3.5.25-2025.12.4/src/stores/account.ts +46 -28
  61. package/bin/templates/vue3.5.25-2025.12.4/src/stores/dd.ts +85 -29
  62. package/bin/templates/vue3.5.25-2025.12.4/src/stores/layout.ts +99 -21
  63. package/bin/templates/vue3.5.25-2025.12.4/typed-router.d.ts +90 -0
  64. package/bin/templates/vue3.5.25-2025.12.4/uno.config.ts +53 -0
  65. package/bin/templates/vue3.5.25-2025.12.4/vite.config.ts +12 -1
  66. package/package.json +2 -2
  67. package/bin/templates/vue3.5.25-2025.12.4/src/stores//347/273/204/345/220/210/345/274/217pinia/345/206/231/346/263/225(/344/273/245account/344/270/272/344/276/213).ts +0 -28
  68. /package/bin/templates/vue3.5.25-2025.12.4/{public → src/assets}/favicon.svg +0 -0
@@ -0,0 +1,3 @@
1
+ @import "./theme.css";
2
+ @import "./base.css";
3
+ @import "./global.css";
@@ -0,0 +1,61 @@
1
+ /* 主题变量 */
2
+ :root {
3
+ /* 主色 */
4
+ --c-primary-color: #0d99ff;
5
+ --c-primary-color7: #0077d9;
6
+ --c-primary-color6: #0d99ff;
7
+ --c-primary-color5: #39abff;
8
+ --c-primary-color4: #65bdff;
9
+ --c-primary-color3: #91cffe;
10
+ --c-primary-color2: #bde1fe;
11
+ --c-primary-color1: #e9f3fe;
12
+ /* 成功色 */
13
+ --c-success-color: #00b42a;
14
+ --c-success-color7: #008f26;
15
+ --c-success-color6: #00b42a;
16
+ --c-success-color5: #1fc240;
17
+ --c-success-color4: #42cf5a;
18
+ --c-success-color3: #69db78;
19
+ --c-success-color2: #95e89d;
20
+ --c-success-color1: #dcf5de;
21
+ /* 警告色 */
22
+ --c-warning-color: #ff7d00;
23
+ --c-warning-color7: #d96200;
24
+ --c-warning-color6: #ff7d00;
25
+ --c-warning-color5: #ff9729;
26
+ --c-warning-color4: #ffb152;
27
+ --c-warning-color3: #ffc87a;
28
+ --c-warning-color2: #ffdca3;
29
+ --c-warning-color1: #fff6e6;
30
+ /* 危险色 */
31
+ --c-danger-color: #f53f3f;
32
+ --c-danger-color7: #cf2b31;
33
+ --c-danger-color6: #f53f3f;
34
+ --c-danger-color5: #ff706b;
35
+ --c-danger-color4: #ff9b94;
36
+ --c-danger-color3: #ffc3bd;
37
+ --c-danger-color2: #ffe9e6;
38
+ --c-danger-color1: #fff2f0;
39
+ /* 灰色 */
40
+ --c-gray-color6: #4a4b4d;
41
+ --c-gray-color5: #67696b;
42
+ --c-gray-color4: #86888b;
43
+ --c-gray-color3: #9d9fa3;
44
+ --c-gray-color2: #c3c6ca;
45
+ --c-gray-color1: #ebedf0;
46
+ /* 字体色 */
47
+ --c-text-color1: #333;
48
+ --c-text-color2: #666;
49
+ --c-text-color3: #999;
50
+ --c-text-color4: #fff;
51
+ /* 背景色 */
52
+ --c-bg-color1: #ffffff;
53
+ /* 阴影色 */
54
+ --c-shadow-color1: #e5dcdc;
55
+ }
56
+ /* 黑暗主题 */
57
+ .dark:root {
58
+ /* 等有需要再把上面的:root全部覆盖一遍 */
59
+ /* 主色 */
60
+ --c-primary-color1: red;
61
+ }
@@ -0,0 +1 @@
1
+ // 格式跟 user-info 一致
@@ -0,0 +1,66 @@
1
+ <script setup lang="ts">
2
+ import type { DialogProps } from "./helper"
3
+
4
+ const modelValue = defineModel<boolean>({ default: false })
5
+
6
+ const props = withDefaults(
7
+ // 声明类型
8
+ defineProps<DialogProps>(),
9
+ // 默认值
10
+ {
11
+ showOk: true,
12
+ okText: "确认",
13
+ showClose: true,
14
+ closeText: "关闭",
15
+ },
16
+ )
17
+
18
+ const emit = defineEmits<{
19
+ /** 确认按钮的回调 */
20
+ (e: "ok"): void
21
+
22
+ /** Dialog 打开的回调 */
23
+ (e: "open"): void
24
+
25
+ /** Dialog 打开动画结束时的回调 */
26
+ (e: "opened"): void
27
+
28
+ /** Dialog 关闭的回调 */
29
+ (e: "close"): void
30
+
31
+ /** Dialog 关闭动画结束时的回调 */
32
+ (e: "closed"): void
33
+
34
+ /** 输入焦点聚焦在 Dialog 内容时的回调 */
35
+ (e: "open-auto-focus"): void
36
+
37
+ /** 输入焦点从 Dialog 内容失焦时的回调 */
38
+ (e: "close-auto-focus"): void
39
+ }>()
40
+ </script>
41
+
42
+ <template>
43
+ <el-dialog
44
+ v-model="modelValue"
45
+ :title="props.title"
46
+ :width="props.width"
47
+ @open="(...args) => $emit('open', ...args)"
48
+ @opened="(...args) => $emit('opened', ...args)"
49
+ @close="(...args) => $emit('close', ...args)"
50
+ @closed="(...args) => $emit('closed', ...args)"
51
+ @open-auto-focus="(...args) => $emit('open-auto-focus', ...args)"
52
+ @close-auto-focus="(...args) => $emit('close-auto-focus', ...args)"
53
+ >
54
+ <slot></slot>
55
+ <template #footer>
56
+ <div class="dialog-footer">
57
+ <el-button v-if="props.showClose && props.closeText" :loading="props.loading" @click="modelValue = false">
58
+ {{ props.closeText }}
59
+ </el-button>
60
+ <el-button v-if="props.showOk && props.okText" :loading="props.loading" type="primary" @click="$emit('ok')">
61
+ {{ props.okText }}
62
+ </el-button>
63
+ </div>
64
+ </template>
65
+ </el-dialog>
66
+ </template>
@@ -0,0 +1,90 @@
1
+ import type { App, Component } from "vue"
2
+ import { h, mergeProps, createApp } from "vue"
3
+
4
+ /** 弹窗props类型 */
5
+ export interface DialogProps {
6
+ /** 是否显示 Dialog(v-model) */
7
+ modelValue?: boolean
8
+
9
+ /** 标题 */
10
+ title?: string
11
+
12
+ /** 对话框的宽度,默认值为 50% */
13
+ width?: number | string
14
+
15
+ /** 是否显示加载中 */
16
+ loading?: boolean
17
+
18
+ /** 显示确定按钮 */
19
+ showOk?: boolean
20
+
21
+ /** 确定按钮文本 */
22
+ okText?: string
23
+
24
+ /** 显示关闭按钮 */
25
+ showClose?: boolean
26
+
27
+ /** 关闭按钮文本 */
28
+ closeText?: string
29
+ }
30
+
31
+ /**
32
+ * 打开自定义弹窗
33
+ * @param component 组件
34
+ * @param props 参数
35
+ * @returns 返回promise,then为弹窗关闭
36
+ */
37
+ export function openDialog<P = Record<string, unknown> & Partial<DialogProps>>(component: Component, props?: P) {
38
+ /** 所有响应式的props */
39
+ const allProps = reactive({
40
+ modelValue: true,
41
+ ...props,
42
+ })
43
+
44
+ /** 关闭弹窗方法 */
45
+ const close = () => {
46
+ allProps.modelValue = false
47
+ }
48
+
49
+ /** 弹窗要渲染的元素 */
50
+ let div: HTMLDivElement | undefined = document.createElement("div")
51
+
52
+ // 渲染到哪个父级
53
+ const parent =
54
+ window.top?.document.body ??
55
+ window.top?.document.getElementById("app") ??
56
+ document.body ??
57
+ document.getElementById("app")
58
+ parent.appendChild(div)
59
+
60
+ let app: App | undefined = createApp({
61
+ setup: () => {
62
+ const node = () =>
63
+ h(
64
+ component,
65
+ mergeProps(allProps, {
66
+ "onUpdate:modelValue": (bool: boolean) => {
67
+ allProps.modelValue = bool
68
+ },
69
+ onClose: () => {
70
+ close()
71
+ },
72
+ onClosed: () => {
73
+ app?.unmount()
74
+ div?.remove()
75
+ app = undefined
76
+ div = undefined
77
+ },
78
+ }),
79
+ )
80
+
81
+ return () => h(node)
82
+ },
83
+ })
84
+
85
+ app.mount(div)
86
+
87
+ return {
88
+ close,
89
+ }
90
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./device/index"
2
+ export * from "./user-info/index"
@@ -0,0 +1,41 @@
1
+ import type { ModelRef } from "vue"
2
+
3
+ export function useTemplate(modelValue: ModelRef<boolean>) {
4
+ const loading = ref(false)
5
+ interface TableRow {
6
+ id: string
7
+ name: string
8
+ }
9
+
10
+ const tableData = ref<TableRow[]>([
11
+ { id: "1", name: "模版1" },
12
+ { id: "2", name: "模版2" },
13
+ { id: "3", name: "模版3" },
14
+ { id: "4", name: "模版4" },
15
+ { id: "5", name: "模版5" },
16
+ ])
17
+
18
+ function onOk() {
19
+ console.log("ok=====>")
20
+ loading.value = true
21
+ setTimeout(() => {
22
+ loading.value = false
23
+ modelValue.value = false
24
+ }, 2000)
25
+ }
26
+
27
+ function edit(row: TableRow) {
28
+ console.log("row=====>", row)
29
+ }
30
+
31
+ function del(row: TableRow) {
32
+ console.log("row=====>", row)
33
+ }
34
+ return {
35
+ loading,
36
+ tableData,
37
+ onOk,
38
+ edit,
39
+ del,
40
+ }
41
+ }
@@ -0,0 +1,29 @@
1
+ <script lang="ts" setup>
2
+ import myDialog from "@/dialogs/dialog.vue"
3
+ import { useTemplate } from "./template"
4
+
5
+ const props = withDefaults(
6
+ defineProps<{
7
+ fatherData?: object
8
+ }>(),
9
+ {},
10
+ )
11
+
12
+ const modelValue = defineModel<boolean>({ default: false })
13
+ const { loading, tableData, onOk, edit, del } = useTemplate(modelValue)
14
+ </script>
15
+
16
+ <template>
17
+ <my-dialog v-model="modelValue" title="模版列表(复制用的,勿删)" width="800" :loading="loading" @ok="onOk">
18
+ <el-table :data="tableData" border>
19
+ <el-table-column property="id" label="id" width="100" />
20
+ <el-table-column property="name" label="模版" />
21
+ <el-table-column fixed="right" label="操作" width="160">
22
+ <template #default="{ row }">
23
+ <el-button type="primary" size="small" @click="edit(row)"> 编辑 </el-button>
24
+ <el-button type="danger" size="small" @click="del(row)"> 删除</el-button>
25
+ </template>
26
+ </el-table-column>
27
+ </el-table>
28
+ </my-dialog>
29
+ </template>
@@ -0,0 +1,31 @@
1
+ import { openDialog } from "../helper"
2
+
3
+ /** 通知 */
4
+ import type Notification from "./notification.vue"
5
+ export type NotificationInstance = InstanceType<typeof Notification>
6
+ export function openNotification(props: NotificationInstance["$props"]) {
7
+ return openDialog(
8
+ defineAsyncComponent(() => import("./notification.vue")),
9
+ props,
10
+ )
11
+ }
12
+
13
+ /** 权限 */
14
+ import type Permission from "./permission.vue"
15
+ export type PermissionInstance = InstanceType<typeof Permission>
16
+ export function openPermission(props?: PermissionInstance["$props"]) {
17
+ return openDialog(
18
+ defineAsyncComponent(() => import("./permission.vue")),
19
+ props,
20
+ )
21
+ }
22
+
23
+ /** 布局 */
24
+ import type Layout from "./layout.vue"
25
+ export type LayoutInstance = InstanceType<typeof Layout>
26
+ export function openLayout(props?: LayoutInstance["$props"]) {
27
+ return openDialog(
28
+ defineAsyncComponent(() => import("./layout.vue")),
29
+ props,
30
+ )
31
+ }
@@ -0,0 +1,47 @@
1
+ import { useLayoutStore } from "@/stores"
2
+
3
+ export function useLayout() {
4
+ const loading = ref(false)
5
+ const layoutStore = useLayoutStore()
6
+ const form = ref({
7
+ layout: layoutStore.layout,
8
+ showHeader: layoutStore.showHeader,
9
+ showMenu: layoutStore.showMenu,
10
+ onlyShowContent: layoutStore.onlyShowContent,
11
+ showLogo: layoutStore.showLogo,
12
+ })
13
+
14
+ watch(
15
+ () => layoutStore.showHeader,
16
+ (newValue) => {
17
+ form.value.showHeader = newValue
18
+ },
19
+ )
20
+ watch(
21
+ () => layoutStore.showMenu,
22
+ (newValue) => {
23
+ form.value.showMenu = newValue
24
+ },
25
+ )
26
+ watch(
27
+ () => layoutStore.onlyShowContent,
28
+ (newValue) => {
29
+ form.value.onlyShowContent = newValue
30
+ },
31
+ )
32
+
33
+ function onOk() {
34
+ console.log("布局=====>", layoutStore.layout)
35
+ console.log("显示头部=====>", layoutStore.showHeader)
36
+ console.log("显示菜单=====>", layoutStore.showMenu)
37
+ console.log("仅显示内容=====>", layoutStore.onlyShowContent)
38
+ console.log("显示logo=====>", layoutStore.showLogo)
39
+ }
40
+
41
+ return {
42
+ loading,
43
+ form,
44
+ onOk,
45
+ layoutStore,
46
+ }
47
+ }
@@ -0,0 +1,51 @@
1
+ <script lang="ts" setup>
2
+ import myDialog from "@/dialogs/dialog.vue"
3
+ import { useLayout } from "./layout"
4
+
5
+ const props = withDefaults(
6
+ defineProps<{
7
+ fatherData?: object
8
+ }>(),
9
+ {},
10
+ )
11
+
12
+ const modelValue = defineModel<boolean>({ default: false })
13
+ const { layoutStore, form, onOk } = useLayout()
14
+ </script>
15
+
16
+ <template>
17
+ <my-dialog v-model="modelValue" title="布局设置" width="400" :show-close="false" ok-text="打印Store仓库" @ok="onOk">
18
+ <el-form :model="form" label-width="100">
19
+ <el-form-item label="布局">
20
+ <el-select v-model="form.layout" placeholder="选择布局" @change="layoutStore.setLayout($event)">
21
+ <el-option label="上下布局" value="up-down" />
22
+ <el-option label="左右布局" value="left-right" />
23
+ </el-select>
24
+ </el-form-item>
25
+ <el-form-item label="显示头部">
26
+ <div class="flex">
27
+ <el-switch v-model="form.showHeader" @change="layoutStore.changeShowHeader()" />
28
+ <div class="ml-4">快捷键:{{ layoutStore.showHeaderShortcutKey }}</div>
29
+ </div>
30
+ </el-form-item>
31
+ <el-form-item label="显示菜单">
32
+ <div class="flex">
33
+ <el-switch v-model="form.showMenu" @change="layoutStore.changeShowMenu()" />
34
+ <div class="ml-4">快捷键:{{ layoutStore.showMenuShortcutKey }}</div>
35
+ </div>
36
+ </el-form-item>
37
+ <el-form-item label="仅显示内容">
38
+ <div class="flex">
39
+ <el-switch v-model="form.onlyShowContent" @change="layoutStore.changeOnlyShowContent()" />
40
+ <div class="ml-4">快捷键:{{ layoutStore.onlyShowContentShortcutKey }}</div>
41
+ </div>
42
+ </el-form-item>
43
+ <el-form-item label="显示logo">
44
+ <div class="flex">
45
+ <el-switch v-model="form.showLogo" @change="layoutStore.changeShowLogo()" />
46
+ <div class="ml-4">暂无实现</div>
47
+ </div>
48
+ </el-form-item>
49
+ </el-form>
50
+ </my-dialog>
51
+ </template>
@@ -0,0 +1,27 @@
1
+ import type { ModelRef } from "vue"
2
+
3
+ export function useNotification(modelValue: ModelRef<boolean>) {
4
+ const loading = ref(false)
5
+ const tableData = ref([
6
+ { id: "1", name: "通知1" },
7
+ { id: "2", name: "通知2" },
8
+ { id: "3", name: "通知3" },
9
+ { id: "4", name: "通知4" },
10
+ { id: "5", name: "通知5" },
11
+ ])
12
+
13
+ function onOk() {
14
+ console.log("ok=====>")
15
+ loading.value = true
16
+ setTimeout(() => {
17
+ loading.value = false
18
+ modelValue.value = false
19
+ }, 2000)
20
+ }
21
+
22
+ return {
23
+ loading,
24
+ tableData,
25
+ onOk,
26
+ }
27
+ }
@@ -0,0 +1,29 @@
1
+ <script lang="ts" setup>
2
+ import myDialog from "@/dialogs/dialog.vue"
3
+ import { useNotification } from "./notification"
4
+
5
+ const props = withDefaults(
6
+ defineProps<{
7
+ fatherData?: object
8
+ }>(),
9
+ {},
10
+ )
11
+
12
+ const modelValue = defineModel<boolean>({ default: false })
13
+ const { loading, tableData, onOk } = useNotification(modelValue)
14
+ </script>
15
+
16
+ <template>
17
+ <my-dialog v-model="modelValue" title="通知列表" width="800" :loading="loading" @ok="onOk">
18
+ <el-table :data="tableData" border>
19
+ <el-table-column property="id" label="id" width="100" />
20
+ <el-table-column property="name" label="名称" />
21
+ <el-table-column fixed="right" label="操作" width="160">
22
+ <template #default>
23
+ <el-button type="primary" size="small"> 详情 </el-button>
24
+ <el-button type="primary" size="small"> 标为已读</el-button>
25
+ </template>
26
+ </el-table-column>
27
+ </el-table>
28
+ </my-dialog>
29
+ </template>
@@ -0,0 +1,22 @@
1
+ import type { ModelRef } from "vue"
2
+
3
+ export function usePermission(modelValue: ModelRef<boolean>) {
4
+ const loading = ref(false)
5
+ const tableData = ref([
6
+ { id: "1", name: "-1" },
7
+ { id: "2", name: "hasCreate" },
8
+ { id: "3", name: "hasDelete" },
9
+ { id: "4", name: "hasEdit" },
10
+ { id: "5", name: "hasView" },
11
+ ])
12
+
13
+ function onOk() {
14
+ modelValue.value = false
15
+ }
16
+
17
+ return {
18
+ loading,
19
+ tableData,
20
+ onOk,
21
+ }
22
+ }
@@ -0,0 +1,23 @@
1
+ <script lang="ts" setup>
2
+ import myDialog from "@/dialogs/dialog.vue"
3
+ import { usePermission } from "./permission"
4
+
5
+ const props = withDefaults(
6
+ defineProps<{
7
+ fatherData?: object
8
+ }>(),
9
+ {},
10
+ )
11
+
12
+ const modelValue = defineModel<boolean>({ default: false })
13
+ const { loading, tableData, onOk } = usePermission(modelValue)
14
+ </script>
15
+
16
+ <template>
17
+ <my-dialog v-model="modelValue" title="权限列表" width="500" :loading="loading" @ok="onOk">
18
+ <el-table :data="tableData" border>
19
+ <el-table-column property="id" label="id" width="100" />
20
+ <el-table-column property="name" label="名称" />
21
+ </el-table>
22
+ </my-dialog>
23
+ </template>
@@ -11,7 +11,7 @@ export default {
11
11
  update(el: HTMLElement) {
12
12
  // 如果有保存的滚动位置,则恢复它
13
13
  if (el.dataset.scrollTop) {
14
- el.scrollTop = parseInt(el.dataset.scrollTop, 10)
14
+ el.scrollTop = Number.parseInt(el.dataset.scrollTop, 10)
15
15
  }
16
16
  },
17
17
  }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * 设备类型
3
+ * - SB 1:设备
4
+ * - CL 2:车辆
5
+ * - LQ 3:冷气
6
+ * - XHP 4:循环品
7
+ * - QTSB 5:其他设备
8
+ * - WL 6:物料
9
+ * - QT 7:其他
10
+ */
11
+ export enum DeviceType {
12
+ SB = 1,
13
+ CL = 2,
14
+ LQ = 3,
15
+ XHP = 4,
16
+ QTSB = 5,
17
+ WL = 6,
18
+ QT = 7,
19
+ }
20
+
21
+ /**
22
+ * 设备类型名称
23
+ */
24
+ export const DeviceTypeName: Record<DeviceType, string> = {
25
+ [DeviceType.SB]: "设备",
26
+ [DeviceType.CL]: "车辆",
27
+ [DeviceType.LQ]: "冷气",
28
+ [DeviceType.XHP]: "循环品",
29
+ [DeviceType.QTSB]: "其他设备",
30
+ [DeviceType.WL]: "物料",
31
+ [DeviceType.QT]: "其他",
32
+ }
33
+
34
+ /**
35
+ * 工令类型
36
+ * - CY 0:长约
37
+ * - GA 1:个案
38
+ */
39
+ export enum GlType {
40
+ CY = 0,
41
+ GA = 1,
42
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./device"
2
+ export * from "./status"
@@ -0,0 +1,23 @@
1
+ /**
2
+ * 状态
3
+ * - DGS 1:待公示
4
+ * - GSSH 2:公示审核
5
+ * - DTB 3:待提报
6
+ * - DTBT 4:待提报(退)
7
+ * - TBSHB 5:提报审核
8
+ * - YTB 6:已提报
9
+ * - BGSH 7:变更审核
10
+ * - YTBBG 8:已提报(变更)
11
+ * - DTBBG 9:待提报(变更)
12
+ */
13
+ export enum Status {
14
+ DGS = 1,
15
+ GSSH = 2,
16
+ DTB = 3,
17
+ DTBT = 4,
18
+ TBSH = 5,
19
+ YTB = 6,
20
+ BGSH = 7,
21
+ YTBBG = 8,
22
+ DTBBG = 9,
23
+ }
@@ -0,0 +1,40 @@
1
+ export function useRole() {
2
+ const formData = reactive({
3
+ user: "",
4
+ region: "",
5
+ date: "",
6
+ })
7
+
8
+ const tableData = ref([
9
+ {
10
+ date: "2016-05-03",
11
+ name: "Tom",
12
+ address: "No. 189, Grove St, Los Angeles",
13
+ },
14
+ {
15
+ date: "2016-05-02",
16
+ name: "Tom",
17
+ address: "No. 189, Grove St, Los Angeles",
18
+ },
19
+ {
20
+ date: "2016-05-04",
21
+ name: "Tom",
22
+ address: "No. 189, Grove St, Los Angeles",
23
+ },
24
+ {
25
+ date: "2016-05-01",
26
+ name: "Tom",
27
+ address: "No. 189, Grove St, Los Angeles",
28
+ },
29
+ ])
30
+
31
+ const onSubmit = () => {
32
+ console.log("submit!")
33
+ }
34
+
35
+ return {
36
+ formData,
37
+ tableData,
38
+ onSubmit,
39
+ }
40
+ }