Browse Source

Merge remote-tracking branch 'origin/master'

master
DX 2 weeks ago
parent
commit
2dbda63961
  1. 6
      src/api/system/taglibrary/index.ts
  2. 2
      src/components/ContentWrap/src/ContentWrap.vue
  3. 20
      src/components/Dialog/src/Dialog.vue
  4. 20
      src/components/Editor/src/Editor.vue
  5. 27
      src/styles/variables.scss
  6. 10
      src/utils/formatTime.ts
  7. 40
      src/views/system/policy/PolicyForm.vue
  8. 94
      src/views/system/policy/index.vue
  9. 77
      src/views/system/taglibrary/form.vue
  10. 135
      src/views/system/taglibrary/index.vue
  11. 32
      src/views/task/create.vue

6
src/api/system/taglibrary/index.ts

@ -52,4 +52,10 @@ export const TagLibraryApi = {
exportTagLibrary: async (params) => { exportTagLibrary: async (params) => {
return await request.download({ url: `/system/tag-library/export-excel`, params }) return await request.download({ url: `/system/tag-library/export-excel`, params })
}, },
/**
*
*/
getTagList: async (params: any) => {
return await request.get({ url: `/system/tag-library/pageInfo`, params })
}
} }

2
src/components/ContentWrap/src/ContentWrap.vue

@ -11,7 +11,7 @@ const prefixCls = getPrefixCls('content-wrap')
defineProps({ defineProps({
title: propTypes.string.def(''), title: propTypes.string.def(''),
message: propTypes.string.def(''), message: propTypes.string.def(''),
bodyStyle: propTypes.object.def({ padding: '10px' }) bodyStyle: propTypes.object.def({ padding: '40px' })
}) })
</script> </script>

20
src/components/Dialog/src/Dialog.vue

@ -12,7 +12,7 @@ const props = defineProps({
width: propTypes.oneOfType([String, Number]).def('40%'), width: propTypes.oneOfType([String, Number]).def('40%'),
scroll: propTypes.bool.def(false), // maxHeight scroll: propTypes.bool.def(false), // maxHeight
maxHeight: propTypes.oneOfType([String, Number]).def('400px'), maxHeight: propTypes.oneOfType([String, Number]).def('400px'),
top: propTypes.string.def('15vh')
}) })
const getBindValue = computed(() => { const getBindValue = computed(() => {
@ -29,9 +29,7 @@ const getBindValue = computed(() => {
const isFullscreen = ref(false) const isFullscreen = ref(false)
const toggleFull = () => {
isFullscreen.value = !unref(isFullscreen)
}
const dialogHeight = ref(isNumber(props.maxHeight) ? `${props.maxHeight}px` : props.maxHeight) const dialogHeight = ref(isNumber(props.maxHeight) ? `${props.maxHeight}px` : props.maxHeight)
@ -62,13 +60,12 @@ const dialogStyle = computed(() => {
<ElDialog <ElDialog
v-bind="getBindValue" v-bind="getBindValue"
:close-on-click-modal="true" :close-on-click-modal="true"
:fullscreen="isFullscreen"
:width="width" :width="width"
destroy-on-close destroy-on-close
lock-scroll lock-scroll
draggable
class="com-dialog" class="com-dialog"
:show-close="false" :show-close="false"
:top="top"
> >
<template #header="{ close }"> <template #header="{ close }">
<div class="relative h-54px flex items-center justify-between pl-15px pr-15px"> <div class="relative h-54px flex items-center justify-between pl-15px pr-15px">
@ -78,14 +75,6 @@ const dialogStyle = computed(() => {
<div <div
class="absolute right-15px top-[50%] h-54px flex translate-y-[-50%] items-center justify-between" class="absolute right-15px top-[50%] h-54px flex translate-y-[-50%] items-center justify-between"
> >
<Icon
v-if="fullscreen"
class="is-hover mr-10px cursor-pointer"
:icon="isFullscreen ? 'radix-icons:exit-full-screen' : 'radix-icons:enter-full-screen'"
color="var(--el-color-info)"
hover-color="var(--el-color-primary)"
@click="toggleFull"
/>
<Icon <Icon
class="is-hover cursor-pointer" class="is-hover cursor-pointer"
icon="ep:close" icon="ep:close"
@ -122,15 +111,12 @@ const dialogStyle = computed(() => {
height: 54px; height: 54px;
padding: 0; padding: 0;
margin-right: 0 !important; margin-right: 0 !important;
border-bottom: 1px solid var(--el-border-color);
} }
&__body { &__body {
padding: 15px !important;
} }
&__footer { &__footer {
border-top: 1px solid var(--el-border-color);
} }
&__headerbtn { &__headerbtn {

20
src/components/Editor/src/Editor.vue

@ -91,7 +91,6 @@ const editorConfig = computed((): IEditorConfig => {
scroll: true, scroll: true,
MENU_CONF: { MENU_CONF: {
['uploadImage']: { ['uploadImage']: {
server: getUploadUrl(), server: getUploadUrl(),
// 2M // 2M
@ -229,13 +228,15 @@ defineExpose({
</script> </script>
<template> <template>
<div class="border-0 border-solid border-[var(--tags-view-border-color)] z-10"> <div
class="border-solid border-1 border-#dcdfe6 border-rounded-4px overflow-hidden z-10 pl-2px pr-2px"
>
<!-- 工具栏 --> <!-- 工具栏 -->
<Toolbar <Toolbar
v-if="getShowToolbar" v-if="getShowToolbar"
:editor="editorRef" :editor="editorRef"
:editorId="editorId" :editorId="editorId"
class="border-0 b-b-1 border-solid border-[var(--tags-view-border-color)]" class="border-0 b-b-1 border-solid border-#303133"
/> />
<!-- 编辑器 --> <!-- 编辑器 -->
<Editor <Editor
@ -245,8 +246,21 @@ defineExpose({
:style="editorStyle" :style="editorStyle"
@on-change="handleChange" @on-change="handleChange"
@on-created="handleCreated" @on-created="handleCreated"
class="scroll-block-none wgEdit"
/> />
</div> </div>
</template> </template>
<style src="@wangeditor/editor/dist/css/style.css"></style> <style src="@wangeditor/editor/dist/css/style.css"></style>
<style scoped>
.wgEdit >>> .w-e-scroll::-webkit-scrollbar {
width: 4px !important;
//height: 8px !important;
}
.wgEdit >>> .w-e-scroll::-webkit-scrollbar-thumb {
background-color: #dcdfe6 !important;
border-radius: 10px !important;
box-shadow: none !important;
}
</style>

27
src/styles/variables.scss

@ -2,3 +2,30 @@
$namespace: v; $namespace: v;
// el命名空间 // el命名空间
$elNamespace: el; $elNamespace: el;
.el-form--inline {
display: flex;
flex-flow: row wrap;
gap: 40px;
margin-bottom: 0;
.el-form-item {
margin-right: 0;
margin-bottom: 0;
.el-form-item__label {
width: fit-content;
}
}
}
.el-table {
border: 1px solid #ebeef5;
--el-table-header-bg-color: #f5f7fa;
.el-table__header {
color: #909399;
}
}
.el-pagination--large .btn-next, .el-pagination--large .btn-prev, .el-pagination--large .el-pager li{
height: fit-content;
line-height: normal;
}

10
src/utils/formatTime.ts

@ -1,4 +1,5 @@
import dayjs from 'dayjs' import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
import type { TableColumnCtx } from 'element-plus' import type { TableColumnCtx } from 'element-plus'
/** /**
@ -69,7 +70,7 @@ export function formatDate(date: Date, format?: string): string {
return '' return ''
} }
// 日期存在,则进行格式化 // 日期存在,则进行格式化
return date ? dayjs(date).format(format ?? 'YYYY-MM-DD HH:mm:ss') : '' return date ? dayjs(date).locale('zh-cn').format(format ?? 'YYYY-MM-DD HH:mm:ss') : ''
} }
/** /**
@ -198,7 +199,7 @@ export function formatPast2(ms: number): string {
* @param cellValue * @param cellValue
*/ */
export function dateFormatter(_row: any, _column: TableColumnCtx<any>, cellValue: any): string { export function dateFormatter(_row: any, _column: TableColumnCtx<any>, cellValue: any): string {
return cellValue ? formatDate(cellValue) : '' return cellValue ? formatDate(cellValue, 'YYYY年MM月DD日 A') : ''
} }
/** /**
@ -209,10 +210,9 @@ export function dateFormatter(_row: any, _column: TableColumnCtx<any>, cellValue
* @param cellValue * @param cellValue
*/ */
export function dateFormatter2(_row: any, _column: TableColumnCtx<any>, cellValue: any): string { export function dateFormatter2(_row: any, _column: TableColumnCtx<any>, cellValue: any): string {
return cellValue ? formatDate(cellValue, 'YYYY-MM-DD') : '' return cellValue ? formatDate(cellValue, 'YYYY年MM月DD日') : ''
} }
/** /**
* element plus Formatter 使 YYYY年MM月DD日 * element plus Formatter 使 YYYY年MM月DD日
* *
@ -224,8 +224,6 @@ export function dateFormatter3(_row: any, _column: TableColumnCtx<any>, cellValu
return cellValue ? formatDate(cellValue, 'YYYY年MM月DD日') : '' return cellValue ? formatDate(cellValue, 'YYYY年MM月DD日') : ''
} }
/** /**
* 时间为00:00:00 * 时间为00:00:00
* @param param * @param param

40
src/views/system/policy/PolicyForm.vue

@ -1,31 +1,41 @@
<template> <template>
<Dialog :title="dialogTitle" v-model="dialogVisible" width="80%" > <Dialog :title="dialogTitle" v-model="dialogVisible" width="65vw" top="5vh">
<el-form <el-form
ref="formRef" ref="formRef"
:model="formData" :model="formData"
:rules="formRules" :rules="formRules"
label-width="100px"
v-loading="formLoading" v-loading="formLoading"
class="policyForm"
> >
<el-form-item label="名称" prop="name"> <section class="flex flex-wrap gap-18px">
<el-form-item label="标题名称" prop="name" class="w-[calc(100%/2-10px)]">
<el-input v-model="formData.name" placeholder="请输入名称" /> <el-input v-model="formData.name" placeholder="请输入名称" />
</el-form-item> </el-form-item>
<el-form-item label="生效日期" prop="effectiveDate"> <el-form-item label="生效日期" prop="effectiveDate" class="w-[calc(100%/2-10px)]">
<el-date-picker <el-date-picker
v-model="formData.effectiveDate" v-model="formData.effectiveDate"
type="date" type="date"
placeholder="请选择生效日期" placeholder="请选择生效日期"
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
:default-value="new Date()" :default-value="new Date()"
class="!w100%"
/> />
</el-form-item> </el-form-item>
<el-form-item label="内容" prop="context"> <el-form-item label="内容详细" prop="context" class="w100%">
<Editor v-model="formData.context" height="350px" /> <Editor v-model="formData.context" height="350px" class="!w100%" />
</el-form-item> </el-form-item>
</section>
</el-form> </el-form>
<template #footer> <template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button> <el-popconfirm title="是否确定删除当前政策法规?" @confirm="deletePolicy" width="230">
<template #reference>
<el-button type="danger" v-if="formType == 'update'" link class="underline">
我要删除
</el-button>
</template>
</el-popconfirm>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
</template> </template>
</Dialog> </Dialog>
</template> </template>
@ -107,4 +117,20 @@ const resetForm = () => {
} }
formRef.value?.resetFields() formRef.value?.resetFields()
} }
const deletePolicy=()=>{
PolicyApi.deletePolicy(formData.value.id).then(()=>{
message.success(t('common.delSuccess'))
dialogVisible.value = false
emit('success')
})
}
</script> </script>
<style scoped lang="scss">
.policyForm {
::v-deep(.el-form-item--large) {
margin-bottom: 0;
}
}
</style>

94
src/views/system/policy/index.vue

@ -1,14 +1,9 @@
<template> <template>
<ContentWrap> <ContentWrap>
<section class="flex flex-col gap-20px">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form <el-form :model="queryParams" ref="queryFormRef" :inline="true" @submit.prevent>
class="-mb-15px" <el-form-item prop="name">
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<el-form-item label="名称" prop="name">
<el-input <el-input
v-model="queryParams.name" v-model="queryParams.name"
placeholder="请输入名称" placeholder="请输入名称"
@ -17,31 +12,21 @@
class="!w-240px" class="!w-240px"
/> />
</el-form-item> </el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker
v-model="queryParams.createTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-220px"
/>
</el-form-item>
<el-form-item> <el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> <el-button @click="handleQuery" type="primary" plain>
<Icon icon="ep:search" class="mr-5px" /> 查询
</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
</el-form-item>
<el-form-item class="ml-auto">
<el-button <el-button
type="primary" type="primary"
plain
@click="openForm('create')" @click="openForm('create')"
v-hasPermi="['system:policy:create']" v-hasPermi="['system:policy:create']"
> >
<Icon icon="ep:plus" class="mr-5px" /> 新增 <Icon icon="ep:circle-plus" class="mr-5px" /> 新增
</el-button> </el-button>
<el-button <el-button
type="success"
plain
@click="handleExport" @click="handleExport"
:loading="exportLoading" :loading="exportLoading"
v-hasPermi="['system:policy:export']" v-hasPermi="['system:policy:export']"
@ -50,23 +35,26 @@
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</ContentWrap> <el-table v-loading="loading" :data="list" :show-overflow-tooltip="true">
<el-table-column label="名称" prop="name" />
<!-- 列表 --> <el-table-column
<ContentWrap> label="生效日期"
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> prop="effectiveDate"
<!-- <el-table-column label="id" align="center" prop="id" /> --> :formatter="dateFormatter2"
<el-table-column label="名称" align="center" prop="name" /> width="320"
<el-table-column label="生效日期" align="center" prop="effectiveDate" :formatter="dateFormatter2" /> />
<el-table-column label="发布人" width="320">
<template #default="{ row }">
{{ `${row.createName} | ${row.createDeptName}` }}
</template>
</el-table-column>
<el-table-column <el-table-column
label="创建时间" label="创建时间"
align="center"
prop="createTime" prop="createTime"
:formatter="dateFormatter" :formatter="dateFormatter"
width="180px" width="320"
/> />
<el-table-column label="操作" align="center" min-width="120px"> <el-table-column label="操作选项" align="center" width="120px">
<template #default="scope"> <template #default="scope">
<el-button <el-button
link link
@ -76,32 +64,20 @@
> >
编辑 编辑
</el-button> </el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['system:policy:delete']"
>
删除
</el-button>
<el-button
link
type="primary"
@click="clickOpenDetail(scope.row.id)"
>
详情
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 分页 --> <!-- 分页 -->
<Pagination <el-pagination
:total="total" :total="total"
v-model:page="queryParams.pageNo" :show-page-size="false"
v-model:limit="queryParams.pageSize" layout="total, prev, pager, next"
@pagination="getList" v-model:current-page="queryParams.pageNo"
v-model:page-size="queryParams.pageSize"
@change="getList"
class="ml-auto"
/> />
</section>
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
@ -109,7 +85,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
import download from '@/utils/download' import download from '@/utils/download'
import { PolicyApi, PolicyVO } from '@/api/system/policy' import { PolicyApi, PolicyVO } from '@/api/system/policy'
import PolicyForm from './PolicyForm.vue' import PolicyForm from './PolicyForm.vue'
@ -127,7 +103,7 @@ const queryParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
name: undefined, name: undefined,
createTime: [], createTime: []
}) })
const queryFormRef = ref() // const queryFormRef = ref() //
const exportLoading = ref(false) // const exportLoading = ref(false) //
@ -145,7 +121,7 @@ const getList = async () => {
} }
const clickOpenDetail = (id: number) => { const clickOpenDetail = (id: number) => {
console.log(id); console.log(id)
window.open(`/policyDetail?id=${id}`, '_blank') window.open(`/policyDetail?id=${id}`, '_blank')
} }

77
src/views/system/taglibrary/form.vue

@ -7,31 +7,16 @@
label-width="100px" label-width="100px"
v-loading="formLoading" v-loading="formLoading"
> >
<el-form-item label="父标签" prop="tagName"> <el-form-item label="父级标签" prop="tagName">
<el-tree-select <el-select default-first-option v-model="formData.parentId" disabled>
v-model="formData.parentId" <el-option v-for="item in list" :key="item.id" :label="item.tagName" :value="item.id" />
:data="list" </el-select>
check-strictly
:render-after-expand="false"
placeholder="请选择父标签"
node-key="id"
:default-checked-keys="echoList"
:props="{
label: 'tagName'
}"
/>
</el-form-item> </el-form-item>
<el-form-item label="标签名称" prop="tagName">
<el-form-item label="标签的名称" prop="tagName">
<el-input v-model="formData.tagName" placeholder="请输入标签的名称" /> <el-input v-model="formData.tagName" placeholder="请输入标签的名称" />
</el-form-item> </el-form-item>
<el-form-item label="排列顺序" prop="sort">
<el-form-item label="助记码" prop="tagCode"> <el-input v-model.number="formData.sort" placeholder="请输入0~99数字" />
<el-input v-model="formData.tagCode" placeholder="助记码" />
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="formData.sort" placeholder="排序" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
@ -42,7 +27,6 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { TagLibraryApi, TagLibraryVO } from '@/api/system/taglibrary' import { TagLibraryApi, TagLibraryVO } from '@/api/system/taglibrary'
import { DICT_TYPE, getDictLabel } from '@/utils/dict'
/** 企业标签 表单 */ /** 企业标签 表单 */
defineOptions({ name: 'Form' }) defineOptions({ name: 'Form' })
@ -52,7 +36,7 @@ const message = useMessage() // 消息弹窗
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const dialogTitle = ref('') // const dialogTitle = ref('') //
const formLoading = ref(false) // 12 const formLoading = ref(false) // 12
const formData = ref({ const formData = ref<any>({
tagId: undefined, tagId: undefined,
tagName: undefined, tagName: undefined,
parentId: null as any, parentId: null as any,
@ -62,19 +46,32 @@ const formData = ref({
tagCode: undefined, tagCode: undefined,
id: null as any id: null as any
}) })
const formRules = reactive({}) const formRules = reactive({
sort: [
{
required: true,
message: '请输入排序',
trigger: 'blur'
},
{ type: 'number', message: '请输入数字' }
],
tagName: [
{
required: true,
message: '请输入标签名称',
trigger: 'blur'
}
]
})
const formRef = ref() // Ref const formRef = ref() // Ref
const echoList = ref([]) const list = ref<any>([])
/** 打开弹窗 */ /** 打开弹窗 */
const open = async (params) => { const open = async (params) => {
console.log(params)
dialogVisible.value = true dialogVisible.value = true
dialogTitle.value = params.id dialogTitle.value = params.id ? `修改标签` : `创建标签`
? `修改${getDictLabel(DICT_TYPE.TAG_TYPE, params.tagType)}`
: `创建${getDictLabel(DICT_TYPE.TAG_TYPE, params.tagType)}`
resetForm() resetForm()
formLoading.value = true formLoading.value = true
await levelList() await getParent(params.parentId)
// //
if (params.id) { if (params.id) {
formData.value = await TagLibraryApi.getTagLibrary(params.id) formData.value = await TagLibraryApi.getTagLibrary(params.id)
@ -83,15 +80,10 @@ const open = async (params) => {
} }
} }
formData.value.tagType = Number(params.tagType) formData.value.tagType = Number(params.tagType)
formData.value.parentId = Number(params.parentId)
formLoading.value = false formLoading.value = false
} }
const list: any = ref([])
const levelList = async () => {
list.value = await TagLibraryApi.getTagLibraryPage(formData.value.id)
}
defineExpose({ open }) // open defineExpose({ open }) // open
/** 提交表单 */ /** 提交表单 */
@ -118,16 +110,21 @@ const submitForm = async () => {
} }
} }
const getParent = async (id) => {
const res = await TagLibraryApi.getTagLibrary(id)
list.value = [res]
}
/** 重置表单 */ /** 重置表单 */
const resetForm = () => { const resetForm = () => {
formData.value = { formData.value = {
tagId: undefined, tagId: undefined,
tagName: undefined, tagName: undefined,
parentId: null as any, parentId: undefined,
tagLevel: undefined, tagLevel: undefined,
tagType: null as any, tagType: undefined,
sort: undefined, sort: undefined,
id: null as any id: undefined
} }
formRef.value?.resetFields() formRef.value?.resetFields()
} }

135
src/views/system/taglibrary/index.vue

@ -1,37 +1,27 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <section class="flex flex-col gap-20px">
<el-form <el-form
class="-mb-15px"
:model="queryParams" :model="queryParams"
ref="queryFormRef" ref="queryFormRef"
:inline="true" :inline="true"
label-width="68px" label-width="68px"
@submit.prevent
> >
<el-form-item label="名称" prop="tagName"> <el-form-item label="" prop="tagName">
<el-input <el-input
v-model="queryParams.tagName" v-model="queryParams.tagName"
placeholder="请输入标签的名称" placeholder="请输入标签的名称"
clearable clearable
@keyup.enter="handleQuery" @keyup.enter.prevent="handleQuery"
class="!w-240px" class="!w-240px"
/> />
</el-form-item> </el-form-item>
<el-form-item label="父标签" prop="parentTagId"> <el-form-item label="">
<el-input <el-button @click="handleQuery" type="primary" plain
v-model="queryParams.parentId" ><Icon icon="ep:search" class="mr-8px" /> 查询
placeholder="请输入父标签的ID"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
<el-button type="primary" plain @click="openForm()">
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button> </el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-8px" /> 重置</el-button>
<el-button <el-button
type="success" type="success"
plain plain
@ -39,61 +29,68 @@
:loading="exportLoading" :loading="exportLoading"
v-hasPermi="['system:tag-library:export']" v-hasPermi="['system:tag-library:export']"
> >
<Icon icon="ep:download" class="mr-5px" /> 导出 <Icon icon="ep:download" class="mr-8px" /> 导出
</el-button>
</el-form-item>
<el-form-item class="ml-auto">
<el-button type="primary" @click="openForm()">
<Icon icon="ep:circle-plus" class="mr-8px" /> 新增
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</ContentWrap> <el-table :data="list" size="large">
<el-table-column label="父级标签" prop="parentName" />
<!-- 列表 --> <el-table-column label="标签名称" prop="tagName" />
<ContentWrap> <el-table-column label="排列顺序" prop="sort" />
<el-tree <el-table-column label="操作选项" align="center" width="100">
:data="list" <template #default="{ row }">
node-key="id" <section
:props="treeProps" class="color-#409EFF cursor-pointer hover--font-bold"
highlight-current @click="openForm(row.id)"
default-expand-all
@node-click="handleNodeClick"
> >
<template #default="{ node, data }"> 编辑
<span>{{ node.label }}{{ data.tagName }}</span> </section>
<el-tag size="small" type="info">层级: {{ data.tagLevel }}</el-tag>
<!-- <el-tag size="small" :type="data.tag_type === 1 ? 'success' : 'warning'">
{{ data.tag_type === 1 ? '企业标签' : '执法标签' }}
</el-tag> -->
<el-button type="text" @click="openForm(data.id)"
><el-icon><EditPen /></el-icon
></el-button>
<el-button type="text" @click="handleDelete(data.id)"
><el-icon><DeleteFilled /></el-icon
></el-button>
</template> </template>
</el-tree> </el-table-column>
</el-table>
<el-pagination
:total="total"
:show-page-size="false"
layout="total, prev, pager, next"
v-model:current-page="queryParams.pageNo"
v-model:page-size="queryParams.pageSize"
class="ml-auto"
@change="getList"
/>
</section>
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 -->
<TagForm ref="tagFormRef" @success="getList" /> <TagForm ref="tagFormRef" @success="getList" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { TagLibraryApi, TagLibraryVO } from '@/api/system/taglibrary/index' import { TagLibraryApi, TagLibraryVO } from '@/api/system/taglibrary'
import TagForm from './form.vue' import TagForm from './form.vue'
type QueryParams = {
pageNo: number
pageSize: number
tagType: number
tagName: string
}
/** 企业标签 列表 */ /** 企业标签 列表 */
defineOptions({ name: 'TagLibrary' }) defineOptions({ name: 'TagLibrary' })
const message = useMessage() // const message = useMessage() //
const loading = ref(true) // const loading = ref(true) //
const list = ref<TagLibraryVO[]>([]) // const list = ref<TagLibraryVO[]>([]) //
const total = ref(0) // const total = ref(0) //
const queryParams = reactive({ const queryParams = reactive<QueryParams>({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
tagName: undefined, tagType: 0,
parentId: undefined, tagName: ''
tagLevel: undefined,
tagType: undefined,
createTime: []
}) })
const route = useRoute() const route = useRoute()
const queryFormRef = ref() // const queryFormRef = ref() //
@ -102,18 +99,14 @@ const exportLoading = ref(false) // 导出的加载中
const getList = async () => { const getList = async () => {
loading.value = true loading.value = true
try { try {
const data = await TagLibraryApi.getTagLibraryPage(queryParams) const res = await TagLibraryApi.getTagList(queryParams)
list.value = data list.value = res.list
total.value = res.total
} finally { } finally {
loading.value = false loading.value = false
} }
} }
const treeProps = ref({
label: 'tag_name', //
children: 'children' //
})
/** 搜索按钮操作 */ /** 搜索按钮操作 */
const handleQuery = () => { const handleQuery = () => {
queryParams.pageNo = 1 queryParams.pageNo = 1
@ -126,26 +119,14 @@ const resetQuery = () => {
handleQuery() handleQuery()
} }
const handleNodeClick = (node) => {
console.log('当前点击的标签:', node)
}
/** 添加/修改操作 */ /** 添加/修改操作 */
const tagFormRef = ref() const tagFormRef = ref()
const openForm = (id?: number) => { const openForm = (id?: number) => {
tagFormRef.value.open({ id, tagType: queryParams.tagType }) tagFormRef.value.open({
} id,
tagType: queryParams.tagType,
/** 删除按钮操作 */ parentId: queryParams.tagType == 1 ? 1 : 26
const handleDelete = async (id: number) => { })
try {
//
await message.delConfirm()
//
await TagLibraryApi.deleteTagLibrary(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
} }
/** 导出按钮操作 */ /** 导出按钮操作 */
@ -165,7 +146,9 @@ const handleExport = async () => {
/** 初始化 **/ /** 初始化 **/
onMounted(() => { onMounted(() => {
queryParams.tagType = route.fullPath.split('/').pop() queryParams.tagType = Number(route.fullPath.split('/').pop())
getList() getList()
}) })
</script> </script>
<style lang="scss" scoped></style>

32
src/views/task/create.vue

@ -203,7 +203,8 @@
<span> <span>
企业名称{{ item.enterprisesName }} 企业名称{{ item.enterprisesName }}
<section class="flex gap-5px"> <section class="flex gap-5px">
区域: <DictTag :type="DICT_TYPE.ENTERPRISES_AREA" :value="Number(item.region)" /> 区域:
<DictTag :type="DICT_TYPE.ENTERPRISES_AREA" :value="Number(item.region)" />
规模<DictTag :type="DICT_TYPE.ENTERPRISES_TYPE" :value="Number(item.type)" /> 规模<DictTag :type="DICT_TYPE.ENTERPRISES_TYPE" :value="Number(item.type)" />
</section> </section>
</span> </span>
@ -229,12 +230,17 @@
<ContentWrap> <ContentWrap>
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
<el-button <el-button
type="primary" @click="submitForm" v-hasPermi="['system:enterprise-inspections:audit']">审核通过</el-button> type="primary"
@click="submitForm"
v-hasPermi="['system:enterprise-inspections:audit']"
>审核通过</el-button
>
<el-button <el-button
type="danger" type="danger"
@click="submitForm" @click="submitForm"
v-hasPermi="['system:enterprise-inspections:audit']" v-hasPermi="['system:enterprise-inspections:audit']"
>删除</el-button> >删除</el-button
>
</ContentWrap> </ContentWrap>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -243,7 +249,7 @@ import { TagLibraryApi } from '@/api/system/taglibrary'
import { EnterprisesApi, EnterprisesVO } from '@/api/enterprises' import { EnterprisesApi, EnterprisesVO } from '@/api/enterprises'
import { TaskInfoApi } from '@/api/system/taskinfo' import { TaskInfoApi } from '@/api/system/taskinfo'
import { useTagsViewStore } from '@/store/modules/tagsView' import { useTagsViewStore } from '@/store/modules/tagsView'
import {defaultProps} from "@/utils/tree"; import { defaultProps } from '@/utils/tree'
defineOptions({ name: 'CreateTask' }) defineOptions({ name: 'CreateTask' })
const loading = ref(false) const loading = ref(false)
const formData = ref({ const formData = ref({
@ -318,8 +324,8 @@ function getTagList() {
} }
const defaultProps = { const defaultProps = {
label: 'tagName', // 使 'name' label: 'tagName', // 使 'name'
children: 'children', // 使 'children' children: 'children' // 使 'children'
}; }
/** /**
* 获取企业列表 * 获取企业列表
*/ */
@ -338,7 +344,7 @@ async function getEnterPriseList() {
*/ */
async function selectAll() { async function selectAll() {
loading.value = true loading.value = true
const data = JSON.parse(JSON.stringify(enterprise.value.queryParams)); const data = JSON.parse(JSON.stringify(enterprise.value.queryParams))
data.pageSize = -1 data.pageSize = -1
delete data.pageNo delete data.pageNo
const { list } = await EnterprisesApi.getEnterprisesPage(data) const { list } = await EnterprisesApi.getEnterprisesPage(data)
@ -351,7 +357,7 @@ async function selectAll() {
*/ */
async function cancelAll() { async function cancelAll() {
loading.value = true loading.value = true
const data = JSON.parse(JSON.stringify(enterprise.value.queryParams)); const data = JSON.parse(JSON.stringify(enterprise.value.queryParams))
data.pageSize = -1 data.pageSize = -1
delete data.pageNo delete data.pageNo
const { list } = await EnterprisesApi.getEnterprisesPage(data) const { list } = await EnterprisesApi.getEnterprisesPage(data)
@ -394,11 +400,11 @@ async function submitForm() {
if (validate) { if (validate) {
const data = JSON.parse(JSON.stringify(formData.value)) const data = JSON.parse(JSON.stringify(formData.value))
//1 //1
data.status=1; data.status = 1
console.log("任务类型:",formData.value.taskType) console.log('任务类型:', formData.value.taskType)
data.enterpriseIds = formData.value.enterprises.map((i) => i.id) data.enterpriseIds = formData.value.enterprises.map((i) => i.id)
if (data.enterpriseIds.length == 0) { if (data.enterpriseIds.length == 0) {
message.success("温馨提示:请您选择执法对象") message.success('温馨提示:请您选择执法对象')
} else { } else {
if (data.status < 2) { if (data.status < 2) {
data.startDate = data.planTime[0] data.startDate = data.planTime[0]
@ -424,11 +430,11 @@ async function submitForm() {
} }
function init() { function init() {
if (query.id) { if (query.id) {
TaskInfoApi.getTaskInfo(query.id).then(res=>{ TaskInfoApi.getTaskInfo(query.id).then((res) => {
formData.value = res formData.value = res
formData.value.planTime = [formData.value.startDate, formData.value.endDate] formData.value.planTime = [formData.value.startDate, formData.value.endDate]
formData.value.enterprises = res.enterpriseIdes formData.value.enterprises = res.enterpriseIdes
formData.value.tags=res.taskTagIdes.map(t=>t.tagId) formData.value.tags = res.taskTagIdes.map((t) => t.tagId)
}) })
} }
} }

Loading…
Cancel
Save