Pārlūkot izejas kodu

新增数据字典
优化表单提交刷新表格数据事件
优化当前页全屏关闭

zhontai 2 gadi atpakaļ
vecāks
revīzija
e33f561861

+ 0 - 3
src/globalProperties/index.ts

@@ -1,9 +1,6 @@
 import modal from './modal'
-import mitt from 'mitt'
 
 export default function installGlobalProperties(app: any) {
-  app.config.globalProperties.eventBus = mitt()
-
   // 模态框对象
   app.config.globalProperties.$modal = modal
 }

+ 2 - 2
src/layout/navBars/breadcrumb/closeFull.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="layout-navbars-close-full" v-if="isTagsViewCurrenFull">
-    <div class="layout-navbars-close-full-icon">
-      <SvgIcon name="ele-Close" :title="$t('message.tagsView.closeFullscreen')" @click="onCloseFullscreen" />
+    <div class="layout-navbars-close-full-icon" @click="onCloseFullscreen">
+      <SvgIcon name="ele-Close" :title="$t('message.tagsView.closeFullscreen')" />
     </div>
   </div>
 </template>

+ 20 - 0
src/types/mitt.d.ts

@@ -11,6 +11,16 @@
  * @method openShareTagsView 布局设置弹窗,开启 TagsView 共用
  * @method onTagsViewRefreshRouterView tagsview 刷新界面
  * @method onCurrentContextmenuClick tagsview 右键菜单每项点击时
+ 
+ * @method refreshDictType 刷新字典类型
+ * @method refreshDict 刷新字典
+ * @method refreshOrg 刷新部门
+ * @method refreshApi 刷新接口
+ * @method refreshPermission 刷新权限
+ * @method refreshRole 刷新角色
+ * @method refreshTenant 刷新租户
+ * @method refreshUser 刷新用户
+ * @method refreshView 刷新视图
  */
 declare type MittType<T = any> = {
   openSetingsDrawer?: string
@@ -23,6 +33,16 @@ declare type MittType<T = any> = {
   openShareTagsView?: string
   onTagsViewRefreshRouterView?: T
   onCurrentContextmenuClick?: T
+
+  refreshDictType?: string
+  refreshDict?: string
+  refreshOrg?: string
+  refreshApi?: string
+  refreshPermission?: string
+  refreshRole?: string
+  refreshTenant?: string
+  refreshUser?: string
+  refreshView?: string
 }
 
 // mitt 参数类型定义

+ 3 - 4
src/views/admin/api/components/api-form.vue

@@ -62,9 +62,10 @@
 </template>
 
 <script lang="ts" setup>
-import { reactive, toRefs, getCurrentInstance, ref, PropType } from 'vue'
+import { reactive, toRefs, ref, PropType } from 'vue'
 import { ApiListOutput, ApiUpdateInput } from '/@/api/admin/data-contracts'
 import { Api as ApiApi } from '/@/api/admin/Api'
+import eventBus from '/@/utils/mitt'
 
 defineProps({
   title: {
@@ -77,8 +78,6 @@ defineProps({
   },
 })
 
-const { proxy } = getCurrentInstance() as any
-
 const formRef = ref()
 const state = reactive({
   showDialog: false,
@@ -129,7 +128,7 @@ const onSure = () => {
     state.sureLoading = false
 
     if (res?.success) {
-      proxy.eventBus.emit('refresh')
+      eventBus.emit('refreshApi')
       state.showDialog = false
     }
   })

+ 3 - 2
src/views/admin/api/index.vue

@@ -53,6 +53,7 @@ import { Api as ApiApi } from '/@/api/admin/Api'
 import { listToTree } from '/@/utils/tree'
 import ApiForm from './components/api-form.vue'
 import { cloneDeep } from 'lodash-es'
+import eventBus from '/@/utils/mitt'
 
 const { proxy } = getCurrentInstance() as any
 
@@ -70,13 +71,13 @@ const state = reactive({
 
 onMounted(() => {
   onQuery()
-  proxy.eventBus.on('refresh', async () => {
+  eventBus.on('refreshApi', async () => {
     onQuery()
   })
 })
 
 onUnmounted(() => {
-  proxy.eventBus.off('refresh')
+  eventBus.off('refreshApi')
 })
 
 const onQuery = async () => {

+ 118 - 0
src/views/admin/dictionary/components/dictionary-form.vue

@@ -0,0 +1,118 @@
+<template>
+  <div>
+    <el-dialog v-model="state.showDialog" destroy-on-close :title="title" draggable width="769px">
+      <el-form ref="formRef" :model="form" size="default" label-width="80px">
+        <el-row :gutter="35">
+          <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+            <el-form-item label="名称" prop="name" :rules="[{ required: true, message: '请输入企业名称', trigger: ['blur', 'change'] }]">
+              <el-input v-model="form.name" autocomplete="off" />
+            </el-form-item>
+          </el-col>
+          <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+            <el-form-item label="编码" prop="code" :rules="[{ required: true, message: '请输入企业编码', trigger: ['blur', 'change'] }]">
+              <el-input v-model="form.code" autocomplete="off" />
+            </el-form-item>
+          </el-col>
+          <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
+            <el-form-item label="启用">
+              <el-switch v-model="form.enabled" />
+            </el-form-item>
+          </el-col>
+          <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+            <el-form-item label="说明">
+              <el-input v-model="form.description" clearable type="textarea" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <template #footer>
+        <span class="dialog-footer">
+          <el-button @click="onCancel" size="default">取 消</el-button>
+          <el-button type="primary" @click="onSure" size="default" :loading="state.sureLoading">确 定</el-button>
+        </span>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script lang="ts" setup>
+import { reactive, toRefs, getCurrentInstance, ref } from 'vue'
+import { DictionaryAddInput, DictionaryUpdateInput } from '/@/api/admin/data-contracts'
+import { Dictionary as DictionaryApi } from '/@/api/admin/Dictionary'
+import eventBus from '/@/utils/mitt'
+
+defineProps({
+  title: {
+    type: String,
+    default: '',
+  },
+})
+
+const { proxy } = getCurrentInstance() as any
+
+const formRef = ref()
+const state = reactive({
+  showDialog: false,
+  sureLoading: false,
+  form: {} as DictionaryAddInput & DictionaryUpdateInput,
+})
+const { form } = toRefs(state)
+
+// 打开对话框
+const open = async (row: any = {}) => {
+  if (row.id > 0) {
+    const res = await new DictionaryApi().get({ id: row.id }, { loading: true }).catch(() => {
+      proxy.$modal.closeLoading()
+    })
+
+    if (res?.success) {
+      state.form = res.data as DictionaryAddInput & DictionaryUpdateInput
+    }
+  } else {
+    state.form = {} as DictionaryAddInput & DictionaryUpdateInput
+  }
+  state.showDialog = true
+}
+
+// 取消
+const onCancel = () => {
+  state.showDialog = false
+}
+
+// 确定
+const onSure = () => {
+  formRef.value.validate(async (valid: boolean) => {
+    if (!valid) return
+
+    state.sureLoading = true
+    let res = {} as any
+    if (state.form.id != undefined && state.form.id > 0) {
+      res = await new DictionaryApi().update(state.form, { showSuccessMessage: true }).catch(() => {
+        state.sureLoading = false
+      })
+    } else {
+      res = await new DictionaryApi().add(state.form, { showSuccessMessage: true }).catch(() => {
+        state.sureLoading = false
+      })
+    }
+    state.sureLoading = false
+
+    if (res?.success) {
+      eventBus.emit('refreshDict')
+      state.showDialog = false
+    }
+  })
+}
+
+defineExpose({
+  open,
+})
+</script>
+
+<script lang="ts">
+import { defineComponent } from 'vue'
+
+export default defineComponent({
+  name: 'admin/dictionary/form',
+})
+</script>

+ 118 - 0
src/views/admin/dictionary/components/dictionary-type-form.vue

@@ -0,0 +1,118 @@
+<template>
+  <div>
+    <el-dialog v-model="state.showDialog" destroy-on-close :title="title" draggable width="769px">
+      <el-form ref="formRef" :model="form" size="default" label-width="80px">
+        <el-row :gutter="35">
+          <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+            <el-form-item label="名称" prop="name" :rules="[{ required: true, message: '请输入企业名称', trigger: ['blur', 'change'] }]">
+              <el-input v-model="form.name" autocomplete="off" />
+            </el-form-item>
+          </el-col>
+          <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+            <el-form-item label="编码" prop="code" :rules="[{ required: true, message: '请输入企业编码', trigger: ['blur', 'change'] }]">
+              <el-input v-model="form.code" autocomplete="off" />
+            </el-form-item>
+          </el-col>
+          <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
+            <el-form-item label="启用">
+              <el-switch v-model="form.enabled" />
+            </el-form-item>
+          </el-col>
+          <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+            <el-form-item label="说明">
+              <el-input v-model="form.description" clearable type="textarea" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <template #footer>
+        <span class="dialog-footer">
+          <el-button @click="onCancel" size="default">取 消</el-button>
+          <el-button type="primary" @click="onSure" size="default" :loading="state.sureLoading">确 定</el-button>
+        </span>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script lang="ts" setup>
+import { reactive, toRefs, getCurrentInstance, ref } from 'vue'
+import { DictionaryTypeAddInput, DictionaryTypeUpdateInput } from '/@/api/admin/data-contracts'
+import { DictionaryType as DictionaryTypeApi } from '/@/api/admin/DictionaryType'
+import eventBus from '/@/utils/mitt'
+
+defineProps({
+  title: {
+    type: String,
+    default: '',
+  },
+})
+
+const { proxy } = getCurrentInstance() as any
+
+const formRef = ref()
+const state = reactive({
+  showDialog: false,
+  sureLoading: false,
+  form: {} as DictionaryTypeAddInput & DictionaryTypeUpdateInput,
+})
+const { form } = toRefs(state)
+
+// 打开对话框
+const open = async (row: any = {}) => {
+  if (row.id > 0) {
+    const res = await new DictionaryTypeApi().get({ id: row.id }, { loading: true }).catch(() => {
+      proxy.$modal.closeLoading()
+    })
+
+    if (res?.success) {
+      state.form = res.data as DictionaryTypeAddInput & DictionaryTypeUpdateInput
+    }
+  } else {
+    state.form = {} as DictionaryTypeAddInput & DictionaryTypeUpdateInput
+  }
+  state.showDialog = true
+}
+
+// 取消
+const onCancel = () => {
+  state.showDialog = false
+}
+
+// 确定
+const onSure = () => {
+  formRef.value.validate(async (valid: boolean) => {
+    if (!valid) return
+
+    state.sureLoading = true
+    let res = {} as any
+    if (state.form.id != undefined && state.form.id > 0) {
+      res = await new DictionaryTypeApi().update(state.form, { showSuccessMessage: true }).catch(() => {
+        state.sureLoading = false
+      })
+    } else {
+      res = await new DictionaryTypeApi().add(state.form, { showSuccessMessage: true }).catch(() => {
+        state.sureLoading = false
+      })
+    }
+    state.sureLoading = false
+
+    if (res?.success) {
+      eventBus.emit('refreshDictType')
+      state.showDialog = false
+    }
+  })
+}
+
+defineExpose({
+  open,
+})
+</script>
+
+<script lang="ts">
+import { defineComponent } from 'vue'
+
+export default defineComponent({
+  name: 'admin/dictionaryType/typeForm',
+})
+</script>

+ 140 - 0
src/views/admin/dictionary/dictionary-type.vue

@@ -0,0 +1,140 @@
+<template>
+  <el-card shadow="never" :body-style="{ paddingBottom: '0' }" style="margin-top: 8px">
+    <el-form :model="state.filterModel" :inline="true">
+      <el-form-item prop="name">
+        <el-input v-model="state.filterModel.name" placeholder="名称或编码" />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="ele-Search" @click="onQuery"> 查询 </el-button>
+        <el-button type="primary" icon="ele-Plus" @click="onAdd"> 新增 </el-button>
+      </el-form-item>
+    </el-form>
+  </el-card>
+
+  <el-card shadow="never" style="margin-top: 8px">
+    <el-table ref="tableRef" v-loading="state.loading" :data="state.dictionaryTypeListData" row-key="id" highlight-current-row style="width: 100%">
+      <el-table-column prop="name" label="名称" min-width="120" show-overflow-tooltip />
+      <el-table-column prop="code" label="编码" width="120" show-overflow-tooltip />
+      <el-table-column label="状态" width="80" align="center" show-overflow-tooltip>
+        <template #default="{ row }">
+          <el-tag type="success" v-if="row.enabled">启用</el-tag>
+          <el-tag type="danger" v-else>禁用</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" width="160" fixed="right" header-align="center" align="center">
+        <template #default="{ row }">
+          <el-button icon="ele-EditPen" size="small" text type="primary" @click="onEdit(row)">编辑</el-button>
+          <el-button icon="ele-Delete" size="small" text type="danger" @click="onDelete(row)">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <div class="my-flex my-flex-end" style="margin-top: 20px">
+      <el-pagination
+        v-model:currentPage="state.pageInput.currentPage"
+        v-model:page-size="state.pageInput.pageSize"
+        :total="state.total"
+        :page-sizes="[10, 20, 50, 100]"
+        small
+        background
+        @size-change="onSizeChange"
+        @current-change="onCurrentChange"
+        layout="total, sizes, prev, pager, next, jumper"
+      />
+    </div>
+  </el-card>
+
+  <dictionary-type-form ref="dictionaryTypeFormRef" :title="state.dictionaryTypeFormTitle"></dictionary-type-form>
+</template>
+
+<script lang="ts" setup>
+import { ref, reactive, onMounted, getCurrentInstance, onUnmounted, nextTick } from 'vue'
+import { DictionaryTypeListOutput, PageInputDictionaryTypeGetPageDto } from '/@/api/admin/data-contracts'
+import { DictionaryType as DictionaryTypeApi } from '/@/api/admin/DictionaryType'
+import DictionaryTypeForm from './components/dictionary-type-form.vue'
+import eventBus from '/@/utils/mitt'
+
+const { proxy } = getCurrentInstance() as any
+
+const tableRef = ref()
+const dictionaryTypeFormRef = ref()
+
+const state = reactive({
+  loading: false,
+  dictionaryTypeFormTitle: '',
+  filterModel: {
+    name: '',
+  },
+  total: 0,
+  pageInput: {
+    currentPage: 1,
+    pageSize: 20,
+    filter: {
+      name: null,
+    },
+  } as PageInputDictionaryTypeGetPageDto,
+  dictionaryTypeListData: [] as Array<DictionaryTypeListOutput>,
+})
+
+onMounted(() => {
+  onQuery()
+  eventBus.on('refreshDictType', onQuery)
+})
+
+onUnmounted(() => {
+  eventBus.off('refreshDictType', onQuery)
+})
+
+const onQuery = async () => {
+  state.loading = true
+  const res = await new DictionaryTypeApi().getPage(state.pageInput)
+
+  state.dictionaryTypeListData = res?.data?.list ?? []
+  state.total = res.data?.total ?? 0
+  if (state.dictionaryTypeListData.length > 0) {
+    nextTick(() => {
+      tableRef.value!.setCurrentRow(state.dictionaryTypeListData[0])
+    })
+  }
+  state.loading = false
+}
+
+const onAdd = () => {
+  state.dictionaryTypeFormTitle = '新增租户'
+  dictionaryTypeFormRef.value.open()
+}
+
+const onEdit = (row: DictionaryTypeListOutput) => {
+  state.dictionaryTypeFormTitle = '编辑租户'
+  dictionaryTypeFormRef.value.open(row)
+}
+
+const onDelete = (row: DictionaryTypeListOutput) => {
+  proxy.$modal
+    .confirmDelete(`确定要删除【${row.name}】?`)
+    .then(async () => {
+      await new DictionaryTypeApi().delete({ id: row.id }, { loading: true, showSuccessMessage: true })
+      onQuery()
+    })
+    .catch(() => {})
+}
+
+const onSizeChange = (val: number) => {
+  state.pageInput.pageSize = val
+  onQuery()
+}
+
+const onCurrentChange = (val: number) => {
+  state.pageInput.currentPage = val
+  onQuery()
+}
+</script>
+
+<script lang="ts">
+import { defineComponent } from 'vue'
+
+export default defineComponent({
+  name: 'admin/dictType',
+})
+</script>
+
+<style scoped lang="scss"></style>

+ 135 - 0
src/views/admin/dictionary/dictionary.vue

@@ -0,0 +1,135 @@
+<template>
+  <el-card shadow="never" :body-style="{ paddingBottom: '0' }" style="margin-top: 8px">
+    <el-form :model="state.filterModel" :inline="true">
+      <el-form-item prop="name">
+        <el-input v-model="state.filterModel.name" placeholder="名称或编码" />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="ele-Search" @click="onQuery"> 查询 </el-button>
+        <el-button type="primary" icon="ele-Plus" @click="onAdd"> 新增 </el-button>
+      </el-form-item>
+    </el-form>
+  </el-card>
+
+  <el-card shadow="never" style="margin-top: 8px">
+    <el-table v-loading="state.loading" :data="state.dictionaryListData" row-key="id" style="width: 100%">
+      <el-table-column prop="name" label="名称" min-width="120" show-overflow-tooltip />
+      <el-table-column prop="code" label="编码" width="80" show-overflow-tooltip />
+      <el-table-column prop="value" label="值" width="80" show-overflow-tooltip />
+      <el-table-column label="状态" width="80" align="center" show-overflow-tooltip>
+        <template #default="{ row }">
+          <el-tag type="success" v-if="row.enabled">启用</el-tag>
+          <el-tag type="danger" v-else>禁用</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" width="160" fixed="right" header-align="center" align="center">
+        <template #default="{ row }">
+          <el-button icon="ele-EditPen" size="small" text type="primary" @click="onEdit(row)">编辑</el-button>
+          <el-button icon="ele-Delete" size="small" text type="danger" @click="onDelete(row)">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <div class="my-flex my-flex-end" style="margin-top: 20px">
+      <el-pagination
+        v-model:currentPage="state.pageInput.currentPage"
+        v-model:page-size="state.pageInput.pageSize"
+        :total="state.total"
+        :page-sizes="[10, 20, 50, 100]"
+        small
+        background
+        @size-change="onSizeChange"
+        @current-change="onCurrentChange"
+        layout="total, sizes, prev, pager, next, jumper"
+      />
+    </div>
+  </el-card>
+
+  <dictionary-form ref="dictionaryFormRef" :title="state.dictionaryFormTitle"></dictionary-form>
+</template>
+
+<script lang="ts" setup>
+import { ref, reactive, onMounted, getCurrentInstance, onUnmounted } from 'vue'
+import { DictionaryListOutput, PageInputDictionaryGetPageDto } from '/@/api/admin/data-contracts'
+import { Dictionary as DictionaryApi } from '/@/api/admin/Dictionary'
+import DictionaryForm from './components/dictionary-form.vue'
+import eventBus from '/@/utils/mitt'
+
+const { proxy } = getCurrentInstance() as any
+
+const dictionaryFormRef = ref()
+
+const state = reactive({
+  loading: false,
+  dictionaryFormTitle: '',
+  filterModel: {
+    name: '',
+  },
+  total: 0,
+  pageInput: {
+    currentPage: 1,
+    pageSize: 20,
+    filter: {
+      name: null,
+    },
+  } as PageInputDictionaryGetPageDto,
+  dictionaryListData: [] as Array<DictionaryListOutput>,
+})
+
+onMounted(() => {
+  onQuery()
+  eventBus.on('refreshDict', onQuery)
+})
+
+onUnmounted(() => {
+  eventBus.off('refreshDict', onQuery)
+})
+
+const onQuery = async () => {
+  state.loading = true
+  const res = await new DictionaryApi().getPage(state.pageInput)
+
+  state.dictionaryListData = res?.data?.list ?? []
+  state.total = res.data?.total ?? 0
+  state.loading = false
+}
+
+const onAdd = () => {
+  state.dictionaryFormTitle = '新增租户'
+  dictionaryFormRef.value.open()
+}
+
+const onEdit = (row: DictionaryListOutput) => {
+  state.dictionaryFormTitle = '编辑租户'
+  dictionaryFormRef.value.open(row)
+}
+
+const onDelete = (row: DictionaryListOutput) => {
+  proxy.$modal
+    .confirmDelete(`确定要删除【${row.name}】?`)
+    .then(async () => {
+      await new DictionaryApi().delete({ id: row.id }, { loading: true, showSuccessMessage: true })
+      onQuery()
+    })
+    .catch(() => {})
+}
+
+const onSizeChange = (val: number) => {
+  state.pageInput.pageSize = val
+  onQuery()
+}
+
+const onCurrentChange = (val: number) => {
+  state.pageInput.currentPage = val
+  onQuery()
+}
+</script>
+
+<script lang="ts">
+import { defineComponent } from 'vue'
+
+export default defineComponent({
+  name: 'admin/dictType',
+})
+</script>
+
+<style scoped lang="scss"></style>

+ 27 - 0
src/views/admin/dictionary/index.vue

@@ -0,0 +1,27 @@
+<template>
+  <div style="padding: 0px 0px 8px 8px">
+    <el-row :gutter="8" style="width: 100%">
+      <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+        <dictionary-type></dictionary-type>
+      </el-col>
+      <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+        <dictionary></dictionary>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script lang="ts" setup>
+import DictionaryType from './dictionary-type.vue'
+import Dictionary from './dictionary.vue'
+</script>
+
+<script lang="ts">
+import { defineComponent } from 'vue'
+
+export default defineComponent({
+  name: 'admin/dict',
+})
+</script>
+
+<style scoped lang="scss"></style>

+ 0 - 102
src/views/admin/order/components/order-form.vue

@@ -1,102 +0,0 @@
-<template>
-  <div>
-    <el-dialog v-model="state.showDialog" destroy-on-close :title="title" :close-on-click-modal="false" draggable width="600px">
-      <el-form :model="form" ref="formRef" size="default" label-width="80px">
-        <el-row :gutter="35">
-          <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
-            <el-form-item label="" prop="" :rules="[]"> </el-form-item>
-          </el-col>
-        </el-row>
-      </el-form>
-      <template #footer>
-        <span class="dialog-footer">
-          <el-button @click="onCancel" size="default">取 消</el-button>
-          <el-button type="primary" @click="onSure" size="default" :loading="state.sureLoading">确 定</el-button>
-        </span>
-      </template>
-    </el-dialog>
-  </div>
-</template>
-
-<script lang="ts" setup>
-import { getCurrentInstance, ref, reactive, toRefs } from 'vue'
-
-defineProps({
-  title: {
-    type: String,
-    default: '',
-  },
-})
-
-const { proxy } = getCurrentInstance() as any
-
-const formRef = ref()
-
-const state = reactive({
-  showDialog: false,
-  sureLoading: false,
-  form: {} as any,
-})
-
-const { form } = toRefs(state)
-
-// 打开对话框
-const open = async (row: any = {}) => {
-  proxy.$modal.loading()
-
-  if (row.id > 0) {
-    const res = {} as any
-
-    if (res?.success) {
-      state.form = res.data as any
-    }
-  } else {
-    state.form = {} as any
-  }
-
-  proxy.$modal.closeLoading()
-  state.showDialog = true
-}
-
-// 取消
-const onCancel = () => {
-  state.showDialog = false
-}
-
-// 确定
-const onSure = () => {
-  formRef.value.validate(async (valid: boolean) => {
-    if (!valid) return
-
-    state.sureLoading = true
-    let res = {} as any
-
-    if (state.form.id != undefined && state.form.id > 0) {
-      res = {} as any
-    } else {
-      res = {} as any
-    }
-
-    state.sureLoading = false
-
-    if (res?.success) {
-      proxy.eventBus.emit('refresh')
-      state.showDialog = false
-    }
-  })
-}
-
-defineExpose({
-  open,
-})
-</script>
-
-<script lang="ts">
-import { defineComponent } from 'vue'
-
-export default defineComponent({
-  name: 'admin/order/form',
-})
-</script>
-
-<style lang="scss" scoped></style>

+ 0 - 175
src/views/admin/order/index.vue

@@ -1,175 +0,0 @@
-<template>
-  <div style="padding: 0px 0px 8px 8px">
-    <el-row :gutter="8" style="width: 100%">
-      <el-col :span="24" :xs="24">
-        <el-card shadow="never" :body-style="{ paddingBottom: '0' }" style="margin-top: 8px">
-          <el-form :inline="true">
-            <el-form-item label="创建时间">
-              <my-date-range ref="orderDateRangeRef"></my-date-range>
-            </el-form-item>
-            <el-form-item label="订单号">
-              <el-input v-model="state.filterModel.sn" placeholder="订单号"></el-input>
-            </el-form-item>
-            <el-form-item label="状态">
-              <el-select v-model="state.filterModel.status" :clearable="true">
-                <el-option v-for="item in state.statusList" :key="item.id" :label="item.name" :value="item.id" />
-              </el-select>
-            </el-form-item>
-            <el-form-item>
-              <el-button type="primary" icon="ele-Search" @click="onQuery"> 查询 </el-button>
-              <el-button type="primary" icon="ele-Plus" @click="onAdd"> 新增 </el-button>
-            </el-form-item>
-          </el-form>
-        </el-card>
-
-        <el-card shadow="never" style="margin-top: 8px">
-          <el-table :data="state.listData" style="width: 100%" v-loading="state.loading" row-key="id">
-            <el-table-column label="订单名称" prop="name" min-width="120" align="center"></el-table-column>
-            <el-table-column label="订单号" prop="sn" min-width="120" align="center"></el-table-column>
-            <el-table-column label="创建人" prop="createdUserName" min-width="120" align="center"></el-table-column>
-            <el-table-column label="创建时间" prop="createdTime" min-width="120" align="center"></el-table-column>
-            <el-table-column prop="" label="" min-width="120" show-overflow-tooltip />
-            <el-table-column label="操作" width="160" fixed="right" header-align="center" align="center">
-              <template #default="{ row }">
-                <el-button icon="ele-EditPen" size="small" text type="primary" @click="onEdit(row)">编辑</el-button>
-                <el-button icon="ele-Delete" size="small" text type="danger" @click="onDelete(row)">删除</el-button>
-              </template>
-            </el-table-column>
-          </el-table>
-          <div class="my-flex my-flex-end" style="margin-top: 20px">
-            <el-pagination
-              v-model:currentPage="state.pageInput.currentPage"
-              v-model:page-size="state.pageInput.pageSize"
-              :total="state.total"
-              :page-sizes="[10, 20, 50, 100]"
-              small
-              background
-              @size-change="onSizeChange"
-              @current-change="onCurrentChange"
-              layout="total, sizes, prev, pager, next, jumper"
-            />
-          </div>
-        </el-card>
-      </el-col>
-    </el-row>
-
-    <order-form ref="orderFormRef" :title="state.orderFormTitle"></order-form>
-  </div>
-</template>
-
-<script lang="ts" setup>
-import { getCurrentInstance, onMounted, onUnmounted, reactive, ref } from 'vue'
-import OrderForm from './components/order-form.vue'
-import MyDateRange from '/@/components/my-date-range/index.vue'
-
-const { proxy } = getCurrentInstance() as any
-
-const orderFormRef = ref()
-
-const orderDateRangeRef = ref()
-
-const state = reactive({
-  loading: false,
-  orderFormTitle: '',
-  statusList: [
-    {
-      id: 5,
-      name: '待付款',
-    },
-    {
-      id: 10,
-      name: '已付款',
-    },
-    {
-      id: 15,
-      name: '待生产',
-    },
-    {
-      id: 20,
-      name: '生产中',
-    },
-  ],
-  filterModel: {
-    sn: '',
-    status: null,
-  },
-  total: 0,
-  pageInput: {
-    currentPage: 1,
-    pageSize: 10,
-    filter: {
-      startDate: '',
-      endDate: '',
-      sn: '',
-    },
-  },
-  listData: [],
-})
-
-onMounted(() => {
-  onQuery()
-  proxy.eventBus.on('refresh', async () => {
-    onQuery()
-  })
-})
-
-onUnmounted(() => {
-  proxy.eventBus.off('refresh')
-})
-
-const onQuery = async () => {
-  state.loading = true
-
-  if (state.pageInput.filter) {
-    state.pageInput.filter.startDate = orderDateRangeRef.value.dateRange[0]
-    state.pageInput.filter.endDate = orderDateRangeRef.value.dateRange[1]
-    state.pageInput.filter.sn = state.filterModel.sn
-  }
-
-  const res = {} as any
-
-  state.listData = res?.data?.list ?? []
-  state.total = res?.data?.total ?? 0
-
-  state.loading = false
-}
-
-const onAdd = () => {
-  state.orderFormTitle = '新增'
-  orderFormRef.value.open()
-}
-
-const onEdit = (row: any) => {
-  state.orderFormTitle = '编辑'
-  orderFormRef.value.open(row)
-}
-
-const onDelete = (row: any) => {
-  proxy.$modal
-    .confirmDelete(`确定要删除?`)
-    .then(async () => {
-      onQuery()
-    })
-    .catch(() => {})
-}
-
-const onSizeChange = (val: number) => {
-  state.pageInput.pageSize = val
-  onQuery()
-}
-
-const onCurrentChange = (val: number) => {
-  state.pageInput.currentPage = val
-  onQuery()
-}
-</script>
-
-<script lang="ts">
-import { defineComponent } from 'vue'
-
-export default defineComponent({
-  name: 'admin/order',
-})
-</script>
-
-<style lang="scss" scoped></style>

+ 3 - 4
src/views/admin/org/components/org-form.vue

@@ -62,9 +62,10 @@
 </template>
 
 <script lang="ts" setup>
-import { reactive, toRefs, getCurrentInstance, ref, PropType } from 'vue'
+import { reactive, toRefs, ref, PropType } from 'vue'
 import { OrgListOutput, OrgUpdateInput } from '/@/api/admin/data-contracts'
 import { Org as OrgApi } from '/@/api/admin/Org'
+import eventBus from '/@/utils/mitt'
 
 defineProps({
   title: {
@@ -77,8 +78,6 @@ defineProps({
   },
 })
 
-const { proxy } = getCurrentInstance() as any
-
 const formRef = ref()
 const state = reactive({
   showDialog: false,
@@ -129,7 +128,7 @@ const onSure = () => {
     state.sureLoading = false
 
     if (res?.success) {
-      proxy.eventBus.emit('refresh')
+      eventBus.emit('refreshOrg')
       state.showDialog = false
     }
   })

+ 3 - 2
src/views/admin/org/index.vue

@@ -54,6 +54,7 @@ import { OrgListOutput } from '/@/api/admin/data-contracts'
 import { Org as OrgApi } from '/@/api/admin/Org'
 import { listToTree } from '/@/utils/tree'
 import OrgForm from './components/org-form.vue'
+import eventBus from '/@/utils/mitt'
 
 const { proxy } = getCurrentInstance() as any
 
@@ -70,13 +71,13 @@ const state = reactive({
 
 onMounted(() => {
   onQuery()
-  proxy.eventBus.on('refresh', async () => {
+  eventBus.on('refreshOrg', () => {
     onQuery()
   })
 })
 
 onUnmounted(() => {
-  proxy.eventBus.off('refresh')
+  eventBus.off('refreshOrg')
 })
 
 const onQuery = async () => {

+ 2 - 1
src/views/admin/permission/components/permission-dot-form.vue

@@ -91,6 +91,7 @@ import { PermissionListOutput, PermissionUpdateDotInput, ApiListOutput } from '/
 import { Permission as PermissionApi } from '/@/api/admin/Permission'
 import { Api as ApiApi } from '/@/api/admin/Api'
 import { listToTree } from '/@/utils/tree'
+import eventBus from '/@/utils/mitt'
 
 defineProps({
   title: {
@@ -173,7 +174,7 @@ const onSure = () => {
     state.sureLoading = false
 
     if (res?.success) {
-      proxy.eventBus.emit('refresh')
+      eventBus.emit('refreshPermission')
       state.showDialog = false
     }
   })

+ 2 - 1
src/views/admin/permission/components/permission-group-form.vue

@@ -108,6 +108,7 @@ import { Permission as PermissionApi } from '/@/api/admin/Permission'
 import { View as ViewApi } from '/@/api/admin/View'
 import { listToTree } from '/@/utils/tree'
 import MySelectIcon from '/@/components/my-select-icon/index.vue'
+import eventBus from '/@/utils/mitt'
 
 defineProps({
   title: {
@@ -185,7 +186,7 @@ const onSure = () => {
     state.sureLoading = false
 
     if (res?.success) {
-      proxy.eventBus.emit('refresh')
+      eventBus.emit('refreshPermission')
       state.showDialog = false
     }
   })

+ 2 - 1
src/views/admin/permission/components/permission-menu-form.vue

@@ -129,6 +129,7 @@ import { Permission as PermissionApi } from '/@/api/admin/Permission'
 import { View as ViewApi } from '/@/api/admin/View'
 import { listToTree } from '/@/utils/tree'
 import MySelectIcon from '/@/components/my-select-icon/index.vue'
+import eventBus from '/@/utils/mitt'
 
 defineProps({
   title: {
@@ -221,7 +222,7 @@ const onSure = () => {
     state.sureLoading = false
 
     if (res?.success) {
-      proxy.eventBus.emit('refresh')
+      eventBus.emit('refreshPermission')
       state.showDialog = false
     }
   })

+ 3 - 2
src/views/admin/permission/index.vue

@@ -102,6 +102,7 @@ import { cloneDeep } from 'lodash-es'
 import PermissionGroupForm from './components/permission-group-form.vue'
 import PermissionMenuForm from './components/permission-menu-form.vue'
 import PermissionDotForm from './components/permission-dot-form.vue'
+import eventBus from '/@/utils/mitt'
 
 const { proxy } = getCurrentInstance() as any
 
@@ -122,13 +123,13 @@ const state = reactive({
 
 onMounted(() => {
   onQuery()
-  proxy.eventBus.on('refresh', async () => {
+  eventBus.on('refreshPermission', async () => {
     onQuery()
   })
 })
 
 onUnmounted(() => {
-  proxy.eventBus.off('refresh')
+  eventBus.off('refreshPermission')
 })
 
 const onQuery = async () => {

+ 1 - 1
src/views/admin/personal/components/change-password-form.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <el-dialog v-model="state.showDialog" destroy-on-close :title="title" draggable width="375px">
+    <el-dialog v-model="state.showDialog" destroy-on-close :title="title" draggable width="475px">
       <el-form ref="formRef" :model="form" size="default" label-width="80px" label-position="left">
         <el-row :gutter="35">
           <el-col :span="24">

+ 3 - 4
src/views/admin/role/components/role-form.vue

@@ -52,10 +52,11 @@
 </template>
 
 <script lang="ts" setup>
-import { reactive, toRefs, getCurrentInstance, ref, PropType } from 'vue'
+import { reactive, toRefs, ref, PropType } from 'vue'
 import { RoleGetListOutput, RoleUpdateInput } from '/@/api/admin/data-contracts'
 import { Role as RoleApi } from '/@/api/admin/Role'
 import { cloneDeep } from 'lodash-es'
+import eventBus from '/@/utils/mitt'
 
 defineProps({
   title: {
@@ -68,8 +69,6 @@ defineProps({
   },
 })
 
-const { proxy } = getCurrentInstance() as any
-
 const formRef = ref()
 const state = reactive({
   showDialog: false,
@@ -117,7 +116,7 @@ const onSure = () => {
     state.sureLoading = false
 
     if (res?.success) {
-      proxy.eventBus.emit('refresh')
+      eventBus.emit('refreshRole')
       state.showDialog = false
     }
   })

+ 3 - 2
src/views/admin/role/index.vue

@@ -109,6 +109,7 @@ import SetRoleMenu from './components/set-role-menu.vue'
 import SetRoleDataScope from './components/set-role-data-scope.vue'
 import UserSelect from '/@/views/admin/user/components/user-select.vue'
 import MyDropdownMore from '/@/components/my-dropdown-more/index.vue'
+import eventBus from '/@/utils/mitt'
 
 const { proxy } = getCurrentInstance() as any
 
@@ -135,13 +136,13 @@ const state = reactive({
 
 onMounted(() => {
   onQuery()
-  proxy.eventBus.on('refresh', async () => {
+  eventBus.on('refreshRole', async () => {
     onQuery()
   })
 })
 
 onUnmounted(() => {
-  proxy.eventBus.off('refresh')
+  eventBus.off('refreshRole')
 })
 
 const onQuery = async () => {

+ 2 - 1
src/views/admin/tenant/components/tenant-form.vue

@@ -57,6 +57,7 @@ import { reactive, toRefs, getCurrentInstance, ref } from 'vue'
 import { TenantAddInput, TenantUpdateInput } from '/@/api/admin/data-contracts'
 import { Tenant as TenantApi } from '/@/api/admin/Tenant'
 import { testMobile, testEmail } from '/@/utils/test'
+import eventBus from '/@/utils/mitt'
 
 defineProps({
   title: {
@@ -115,7 +116,7 @@ const onSure = () => {
     state.sureLoading = false
 
     if (res?.success) {
-      proxy.eventBus.emit('refresh')
+      eventBus.emit('refreshTenant')
       state.showDialog = false
     }
   })

+ 3 - 2
src/views/admin/tenant/index.vue

@@ -60,6 +60,7 @@ import { Tenant as TenantApi } from '/@/api/admin/Tenant'
 import TenantForm from './components/tenant-form.vue'
 import MyDropdownMore from '/@/components/my-dropdown-more/index.vue'
 import SetTenantMenu from './components/set-tenant-menu.vue'
+import eventBus from '/@/utils/mitt'
 
 const { proxy } = getCurrentInstance() as any
 
@@ -85,13 +86,13 @@ const state = reactive({
 
 onMounted(() => {
   onQuery()
-  proxy.eventBus.on('refresh', async () => {
+  eventBus.on('refreshTenant', async () => {
     onQuery()
   })
 })
 
 onUnmounted(() => {
-  proxy.eventBus.off('refresh')
+  eventBus.off('refreshTenant')
 })
 
 const onQuery = async () => {

+ 2 - 1
src/views/admin/user/components/user-form.vue

@@ -109,6 +109,7 @@ import { listToTree, treeToList } from '/@/utils/tree'
 import { cloneDeep } from 'lodash-es'
 import { testMobile, testEmail } from '/@/utils/test'
 import MySelectUser from './my-select-user.vue'
+import eventBus from '/@/utils/mitt'
 
 defineProps({
   title: {
@@ -237,7 +238,7 @@ const onSure = () => {
     state.sureLoading = false
 
     if (res?.success) {
-      proxy.eventBus.emit('refresh')
+      eventBus.emit('refreshUser')
       state.showDialog = false
     }
   })

+ 3 - 2
src/views/admin/user/index.vue

@@ -74,6 +74,7 @@ import { User as UserApi } from '/@/api/admin/User'
 import UserForm from './components/user-form.vue'
 import OrgMenu from '/@/views/admin/org/components/org-menu.vue'
 import MyDropdownMore from '/@/components/my-dropdown-more/index.vue'
+import eventBus from '/@/utils/mitt'
 
 const { proxy } = getCurrentInstance() as any
 
@@ -97,13 +98,13 @@ const state = reactive({
 })
 
 onMounted(() => {
-  proxy.eventBus.on('refresh', async () => {
+  eventBus.on('refreshUser', async () => {
     onQuery()
   })
 })
 
 onUnmounted(() => {
-  proxy.eventBus.off('refresh')
+  eventBus.off('refreshUser')
 })
 
 const onQuery = async () => {

+ 3 - 3
src/views/admin/view/components/view-form.vue

@@ -66,9 +66,10 @@
 </template>
 
 <script lang="ts" setup>
-import { reactive, toRefs, getCurrentInstance, ref, PropType } from 'vue'
+import { reactive, toRefs, ref, PropType } from 'vue'
 import { ViewListOutput, ViewUpdateInput } from '/@/api/admin/data-contracts'
 import { View as ViewView } from '/@/api/admin/View'
+import eventBus from '/@/utils/mitt'
 
 defineProps({
   title: {
@@ -80,7 +81,6 @@ defineProps({
     default: () => [],
   },
 })
-const { proxy } = getCurrentInstance() as any
 
 const formRef = ref()
 const state = reactive({
@@ -134,7 +134,7 @@ const onSure = () => {
     state.sureLoading = false
 
     if (res?.success) {
-      proxy.eventBus.emit('refresh')
+      eventBus.emit('refreshView')
       state.showDialog = false
     }
   })

+ 3 - 2
src/views/admin/view/index.vue

@@ -56,6 +56,7 @@ import { View as ViewView } from '/@/api/admin/View'
 import { listToTree } from '/@/utils/tree'
 import { cloneDeep } from 'lodash-es'
 import ViewForm from './components/view-form.vue'
+import eventBus from '/@/utils/mitt'
 
 const viewFormRef = ref()
 const { proxy } = getCurrentInstance() as any
@@ -72,13 +73,13 @@ const state = reactive({
 
 onMounted(() => {
   onQuery()
-  proxy.eventBus.on('refresh', async () => {
+  eventBus.on('refreshView', async () => {
     onQuery()
   })
 })
 
 onUnmounted(() => {
-  proxy.eventBus.off('refresh')
+  eventBus.off('refreshView')
 })
 
 const onQuery = async () => {