houyaf 3 лет назад
Родитель
Сommit
c9d418c5cb

+ 47 - 0
src/components/ArtCatSelector/index.vue

@@ -0,0 +1,47 @@
+<script lang="ts" setup name="ArtCatSelector">
+import { getArtCatByList } from '@/api/system/artCatApi'
+const props = withDefaults(defineProps<{
+  modelValue: number
+}>(), {
+  modelValue: 0,
+})
+const emit = defineEmits(['update:modelValue'])
+interface ArtCat {
+  artCatId: number
+  artCatTitle: string
+}
+const artCatId = computed({
+  get: () => {
+    return props.modelValue
+  },
+  set: (val) => {
+    emit('update:modelValue', val)
+  },
+})
+const state = reactive({
+  loading: false,
+  dataList: [] as ArtCat[],
+})
+
+const getData = async () => {
+  state.loading = true
+  const { data } = await getArtCatByList({})
+  state.loading = false
+  state.dataList = data
+}
+onMounted(() => {
+  getData ()
+})
+</script>
+
+<template>
+  <el-select v-model="artCatId" v-loading="state.loading" style="width: 100%" filterable placeholder="请选择分类" value-key="artCatId">
+    <el-option key="0" label="请选择" :value="0" disabled />
+    <el-option
+      v-for="item in state.dataList"
+      :key="item.artCatId"
+      :label="item.artCatTitle"
+      :value="item.artCatId"
+    />
+  </el-select>
+</template>

+ 1 - 1
src/router/modules/system.ts

@@ -47,7 +47,7 @@ const routes: RouteRecordRaw[] = [
     name: 'system_role',
     meta: {
       title: '角色管理',
-      icon: 'ep:pointer',
+      icon: 'ep:female',
     },
     children: [
       {

+ 1 - 0
src/types/components.d.ts

@@ -10,6 +10,7 @@ export {}
 declare module '@vue/runtime-core' {
   export interface GlobalComponents {
     AppCatSelector: typeof import('./../components/AppCatSelector/index.vue')['default']
+    ArtCatSelector: typeof import('./../components/ArtCatSelector/index.vue')['default']
     Auth: typeof import('./../components/Auth/index.vue')['default']
     AuthAll: typeof import('./../components/AuthAll/index.vue')['default']
     AvatarUpload: typeof import('./../components/AvatarUpload/index.vue')['default']

+ 1 - 1
src/views/api/api/index.vue

@@ -21,7 +21,7 @@ const onItemSelect = (bizId: number, objectId: number) => {
     <div class="page-main">
       <LayoutContainer left-side-width="250px" hide-left-side-toggle>
         <template #leftSide>
-          <LeftBizObjectTreeComponent ref="bizObjectTreeRef" @onItemSelect="onItemSelect" />
+          <LeftBizObjectTreeComponent ref="bizObjectTreeRef" @on-item-select="onItemSelect" />
         </template>
 
         <ApiListComponent ref="apiListRef" />

+ 20 - 6
src/views/article/components/Art.vue

@@ -17,6 +17,7 @@ const tabbar = useTabbar()
 
 const state = reactive({
   title: '',
+  content: '',
   dialogVisible: false,
   loading: false,
   formData: {
@@ -38,6 +39,7 @@ const state = reactive({
 
 const getData = async () => {
   state.loading = true
+  resetFormData()
   const { data } = await getArtById(state.search.artId)
   state.loading = false
   state.formData = data
@@ -46,11 +48,13 @@ const getData = async () => {
 if (route.name === 'article_add') {
   state.actionType = 1
   state.title = '发布文章'
+  state.content = ''
   state.formData.artCatId = parseInt(route.params.artCatId.toString())
 }
 else {
   state.actionType = 2
   state.title = '编辑文章'
+  state.content = ''
   state.search.artId = parseInt(route.params.artId.toString())
   getData()
 }
@@ -96,13 +100,13 @@ function onSubmit() {
         const { msg } = await createArt(state.formData)
         ElMessage.success(msg)
         state.dialogVisible = false
-        emit('success')
+        // emit('success')
       }
       else {
         const { msg } = await updateArt(state.formData)
         ElMessage.success(msg)
         state.dialogVisible = false
-        emit('success')
+        // emit('success')
       }
     }
   })
@@ -121,7 +125,7 @@ function goBack() {
 
 <template>
   <div class="absolute-container">
-    <page-header :title="state.title">
+    <page-header :title="state.title" :content="state.content">
       <el-button size="default" round @click="goBack">
         <template #icon>
           <el-icon>
@@ -135,10 +139,10 @@ function goBack() {
       <el-form ref="formRef" :model="state.formData" :rules="formRules as unknown" label-width="120px" label-suffix=":">
         <el-row :gutter="1">
           <el-col :xs="23" :sm="17" :md="17" :lg="17" :xl="17">
-            <div>
+            <div class="art-title">
               <el-input v-model="state.formData.artTitle" placeholder="请输入标题" />
             </div>
-            <div>
+            <div class="art-content">
               <editor v-model="state.formData.artContent" />
             </div>
           </el-col>
@@ -167,9 +171,19 @@ function goBack() {
       <el-button type="primary" size="large" @click="onSubmit">
         保存
       </el-button>
-      <el-button size="large" @click="onCancel">
+      <el-button size="large" @click="goBack">
         取消
       </el-button>
     </fixed-action-bar>
   </div>
 </template>
+
+<style lang="scss" scoped>
+.art-title {
+  margin-bottom: 10px;
+}
+
+.art-content {
+  margin-bottom: 10px;
+}
+</style>

+ 5 - 5
src/views/article/components/ArtList.vue

@@ -21,7 +21,7 @@ const state = reactive({
 })
 
 // 获取数据
-const getArtData = async () => {
+const getData = async () => {
   if (state.search.artCatId > 0) {
     state.loading = true
     const { data } = await getArtByPage(state.search)
@@ -35,7 +35,7 @@ const artTableRef = ref()
 
 // 查询
 const onSearch = () => {
-  getArtData()
+  getData()
 }
 
 // 新增
@@ -86,14 +86,14 @@ const onArtDelete = (row: any) => {
   ElMessageBox.confirm(`确认删除「${artTitle}」吗?`, '确认信息').then(async () => {
     const { msg } = await deleteArtById(artId)
     ElMessage.success(msg)
-    await getArtData()
+    await getData()
   })
 }
 
 defineExpose({
   loadData(artCatId: number) {
     state.search.artCatId = artCatId
-    getArtData()
+    getData()
   },
 })
 </script>
@@ -154,7 +154,7 @@ defineExpose({
         </template>
       </el-table-column>
 
-      <el-table-column label="操作" width="150" align="center" fixed="right">
+      <el-table-column label="操作" width="200" align="center" fixed="right">
         <template #default="scope">
           <div>
             <el-button type="primary" size="small" plain @click="onArtView(scope.row)">

+ 1 - 1
src/views/article/index.vue

@@ -20,7 +20,7 @@ const onItemSelect = (artCatId: number) => {
     <div class="page-main">
       <LayoutContainer left-side-width="250px" hide-left-side-toggle>
         <template #leftSide>
-          <LeftCatTreeComponent ref="artCatTreeRef" @onItemSelect="onItemSelect" />
+          <LeftCatTreeComponent ref="artCatTreeRef" @on-item-select="onItemSelect" />
         </template>
 
         <ArtListComponent ref="artListRef" />

+ 5 - 1
src/views/workflow/def/components/WfActivityDefList.vue

@@ -80,7 +80,11 @@ defineExpose({
         </el-button>
 
         <el-button type="primary" @click="onActivityDefAdd">
-          新增
+          <template #icon>
+            <el-icon>
+              <svg-icon name="i-ep:plus" />
+            </el-icon>
+          </template>
         </el-button>
       </template>
     </tool-bar>

+ 1 - 1
src/views/workflow/def/index.vue

@@ -21,7 +21,7 @@ const onItemSelect = (wfDefId: number) => {
     <div class="page-main">
       <LayoutContainer left-side-width="250px" hide-left-side-toggle>
         <template #leftSide>
-          <WfDefListComponent ref="wfDefListRef" @onItemSelect="onItemSelect" />
+          <WfDefListComponent ref="wfDefListRef" @on-item-select="onItemSelect" />
         </template>
 
         <WfActivityDefListComponent ref="activityDefListRef" />