Browse Source

提交任务

master
parent
commit
ec48e6616d
  1. 1
      src/layout/Layout.vue
  2. 71
      src/store/modules/app.ts
  3. 98
      src/views/system/taglibrary/form.vue
  4. 35
      src/views/task/create.vue

1
src/layout/Layout.vue

@ -56,6 +56,7 @@ export default defineComponent({
) : undefined} ) : undefined}
{renderLayout()} {renderLayout()}
<Setting></Setting>
<Backtop></Backtop> <Backtop></Backtop>
</section> </section>

71
src/store/modules/app.ts

@ -47,7 +47,6 @@ export const useAppStore = defineStore('app', {
mobile: false, // 是否是移动端 mobile: false, // 是否是移动端
title: import.meta.env.VITE_APP_TITLE, // 标题 title: import.meta.env.VITE_APP_TITLE, // 标题
pageLoading: false, // 路由跳转loading pageLoading: false, // 路由跳转loading
breadcrumb: true, // 面包屑 breadcrumb: true, // 面包屑
breadcrumbIcon: true, // 面包屑图标 breadcrumbIcon: true, // 面包屑图标
collapse: false, // 折叠菜单 collapse: false, // 折叠菜单
@ -59,8 +58,8 @@ export const useAppStore = defineStore('app', {
locale: false, // 多语言图标 locale: false, // 多语言图标
message: true, // 消息图标 message: true, // 消息图标
tagsView: true, // 标签页 tagsView: true, // 标签页
tagsViewImmerse: false, // 标签页沉浸 tagsViewImmerse: true, // 标签页沉浸
tagsViewIcon: true, // 是否显示标签图标 tagsViewIcon: false, // 是否显示标签图标
logo: true, // logo logo: true, // logo
fixedHeader: true, // 固定toolheader fixedHeader: true, // 固定toolheader
footer: true, // 显示页脚 footer: true, // 显示页脚
@ -71,36 +70,52 @@ export const useAppStore = defineStore('app', {
// isDark: wsCache.get(CACHE_KEY.IS_DARK) || false, // 是否是暗黑模式 // isDark: wsCache.get(CACHE_KEY.IS_DARK) || false, // 是否是暗黑模式
isDark: false, // 是否是暗黑模式 isDark: false, // 是否是暗黑模式
currentSize: wsCache.get('default') || 'default', // 组件尺寸 currentSize: wsCache.get('default') || 'default', // 组件尺寸
theme: wsCache.get(CACHE_KEY.THEME) || { theme: {
// 主题色 elColorPrimary: '#009688',
elColorPrimary: '#409eff', leftMenuBorderColor: '#eee',
// 左侧菜单边框颜色 leftMenuBgColor: '#fff',
leftMenuBorderColor: 'inherit', leftMenuBgLightColor: '#fff',
// 左侧菜单背景颜色 leftMenuBgActiveColor: 'RGBA(0,150,136,0.1)',
leftMenuBgColor: '#409eff', leftMenuCollapseBgActiveColor: 'RGBA(0,150,136,0.1)',
// 左侧菜单浅色背景颜色 leftMenuTextColor: '#333',
leftMenuBgLightColor: '#0f2438', leftMenuTextActiveColor: 'var(--el-color-primary)',
// 左侧菜单选中背景颜色 logoTitleTextColor: 'inherit',
leftMenuBgActiveColor: 'var(--el-color-primary)', logoBorderColor: '#eee',
// 左侧菜单收起选中背景颜色
leftMenuCollapseBgActiveColor: 'var(--el-color-primary)',
// 左侧菜单字体颜色
leftMenuTextColor: '#bfcbd9',
// 左侧菜单选中字体颜色
leftMenuTextActiveColor: '#fff',
// logo字体颜色
logoTitleTextColor: '#fff',
// logo边框颜色
logoBorderColor: 'inherit',
// 头部背景颜色
topHeaderBgColor: '#fff', topHeaderBgColor: '#fff',
// 头部字体颜色
topHeaderTextColor: 'inherit', topHeaderTextColor: 'inherit',
// 头部悬停颜色
topHeaderHoverColor: '#f6f6f6', topHeaderHoverColor: '#f6f6f6',
// 头部边框颜色
topToolBorderColor: '#eee' topToolBorderColor: '#eee'
} }
// theme: wsCache.get(CACHE_KEY.THEME) || {
// // 主题色
// elColorPrimary: '#009688',
// // 左侧菜单边框颜色
// leftMenuBorderColor: '#eee',
// // 左侧菜单背景颜色
// leftMenuBgColor: '#fff',
// // 左侧菜单浅色背景颜色
// leftMenuBgLightColor: '#fff',
// // 左侧菜单选中背景颜色
// leftMenuBgActiveColor:"RGBA(0,150,136,0.1)",
// // 左侧菜单收起选中背景颜色
// leftMenuCollapseBgActiveColor: "RGBA(0,150,136,0.1)",
// // 左侧菜单字体颜色
// leftMenuTextColor: '#333',
// // 左侧菜单选中字体颜色
// leftMenuTextActiveColor: "var(--el-color-primary)",
// // logo字体颜色
// logoTitleTextColor: 'inherit',
// // logo边框颜色
// logoBorderColor: 'inherit',
// // 头部背景颜色
// topHeaderBgColor: '#fff',
// // 头部字体颜色
// topHeaderTextColor: 'inherit',
// // 头部悬停颜色
// topHeaderHoverColor: '#f6f6f6',
// // 头部边框颜色
// topToolBorderColor: '#eee'
// }
} }
}, },
getters: { getters: {

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

@ -7,36 +7,19 @@
label-width="100px" label-width="100px"
v-loading="formLoading" v-loading="formLoading"
> >
<el-form-item label="类型" prop="tagType"> <el-form-item label="父标签" prop="tagName">
<el-select v-model="formData.tagType" placeholder="请选择1、企业标签2、执法标签"> <el-tree-select
<el-option v-model="formData.parentId"
v-for="dict in getIntDictOptions(DICT_TYPE.TAG_TYPE)" :data="list"
:key="dict.value" check-strictly
:label="dict.label" :render-after-expand="false"
:value="dict.value" placeholder="请选择父标签"
/> node-key="id"
</el-select> :default-checked-keys="echoList"
</el-form-item> :props="{
label: 'tagName'
<el-form-item label="父标签的ID" prop="tagName"> }"
<el-select v-model="formData.parentId" placeholder="请选择标签" filterable clearable> />
<!-- 使用递归方法生成多层级选项 -->
<template v-for="option in list" :key="option.id">
<el-option
:label="option.tagName"
:value="option.id"
:style="{ paddingLeft: option.tag_level * 20 + 'px' }"
>
{{ option.tagName }}
</el-option>
<!-- 如果有子选项递归渲染 -->
<template v-for="child in option.children" :key="child.id">
<el-option :label="'-- ' + child.tagName" :value="child.id">
{{ '-- ' + child.tagName }}
</el-option>
</template>
</template>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="标签的名称" prop="tagName"> <el-form-item label="标签的名称" prop="tagName">
@ -55,57 +38,53 @@
</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, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getDictLabel } from '@/utils/dict'
/** 企业标签 表单 */ /** 企业标签 表单 */
defineOptions({ name: 'Form' }) defineOptions({ name: 'Form' })
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // 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({
tagId: undefined, tagId: undefined,
tagName: undefined, tagName: undefined,
parentId: undefined, parentId: null as any,
tagLevel: undefined, tagLevel: undefined,
tagType: undefined, tagType: null as any,
sort: undefined sort: undefined,
}) id: null as any
const formRules = reactive({
tagName: [{ required: true, message: '标签的名称不能为空', trigger: 'blur' }],
tagLevel: [{ required: true, message: '标签层级(一级、二级、三级)不能为空', trigger: 'blur' }]
}) })
const formRules = reactive({})
const formRef = ref() // Ref const formRef = ref() // Ref
const echoList = ref([])
/** 打开弹窗 */ /** 打开弹窗 */
const open = async (params) => { const open = async (params) => {
// console.log(params)
await levelList()
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
await levelList()
// //
if (params.id) { if (params.id) {
formLoading.value = true formData.value = await TagLibraryApi.getTagLibrary(params.id)
try { if (formData.value.parentId === 0) {
formData.value = await TagLibraryApi.getTagLibrary(params.id) formData.value.parentId = null
} finally {
formLoading.value = false
} }
} }
formData.value.tagType = params.tagType formData.value.tagType = Number(params.tagType)
formLoading.value = false
} }
const list: any = ref([]) const list: any = ref([])
const levelList = async () => { const levelList = async () => {
const data = await TagLibraryApi.getTagLibraryPage(formData.value.id) list.value = await TagLibraryApi.getTagLibraryPage(formData.value.id)
list.value = data
} }
defineExpose({ open }) // open defineExpose({ open }) // open
@ -137,12 +116,13 @@ const submitForm = async () => {
/** 重置表单 */ /** 重置表单 */
const resetForm = () => { const resetForm = () => {
formData.value = { formData.value = {
tagId: undefined, tagId: undefined,
tagName: undefined, tagName: undefined,
parentId: undefined, parentId: null as any,
tagLevel: undefined, tagLevel: undefined,
tagType: undefined, tagType: null as any,
sort: undefined sort: undefined,
id: null as any
} }
formRef.value?.resetFields() formRef.value?.resetFields()
} }

35
src/views/task/create.vue

@ -85,7 +85,7 @@
placeholder="请输入企业名称" placeholder="请输入企业名称"
clearable clearable
@keyup.enter="handleQuery" @keyup.enter="handleQuery"
class="!w-180px" class="!w-150px"
/> />
</el-form-item> </el-form-item>
<el-form-item label="" prop="type"> <el-form-item label="" prop="type">
@ -95,7 +95,7 @@
clearable clearable
@change="handleQuery" @change="handleQuery"
@clear="handleQuery" @clear="handleQuery"
class="!w-180px" class="!w-150px"
> >
<el-option <el-option
v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_TYPE)" v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_TYPE)"
@ -108,11 +108,11 @@
<el-form-item label="" prop="region"> <el-form-item label="" prop="region">
<el-select <el-select
v-model="enterprise.queryParams.region" v-model="enterprise.queryParams.region"
placeholder="请选择企业所属区域" placeholder="请选择所属区域"
clearable clearable
@clear="handleQuery" @clear="handleQuery"
@change="handleQuery" @change="handleQuery"
class="!w-180px" class="!w-150px"
> >
<el-option <el-option
v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA)" v-for="dict in getStrDictOptions(DICT_TYPE.ENTERPRISES_AREA)"
@ -218,6 +218,7 @@ import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
import { TagLibraryApi } from '@/api/system/taglibrary' 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'
defineOptions({ name: 'CreateTask' }) defineOptions({ name: 'CreateTask' })
@ -242,6 +243,9 @@ const formData = ref({
tags: [], tags: [],
enterprises: ref<any>([]) enterprises: ref<any>([])
}) })
const router=useRouter()
const route=useRoute()
const tagView=useTagsViewStore()
const message = useMessage() // const message = useMessage() //
const formRules = reactive({ const formRules = reactive({
title: [{ required: true, message: '任务标题不能为空', trigger: 'blur' }], title: [{ required: true, message: '任务标题不能为空', trigger: 'blur' }],
@ -309,10 +313,11 @@ async function getEnterPriseList() {
*/ */
async function selectAll() { async function selectAll() {
loading.value = true loading.value = true
const data = enterprise.value.queryParams const data = JSON.parse(JSON.stringify(enterprise.value.queryParams));
data.pageNo = -1 data.pageSize = -1
const res = await EnterprisesApi.getEnterprisesPage(enterprise.value.queryParams) delete data.pageNo
const arr = [...formData.value.enterprises, ...res.list] const { list } = await EnterprisesApi.getEnterprisesPage(data)
const arr = [...formData.value.enterprises, ...list]
formData.value.enterprises = uniqueFunc(arr, 'id') formData.value.enterprises = uniqueFunc(arr, 'id')
loading.value = false loading.value = false
} }
@ -322,9 +327,10 @@ async function selectAll() {
*/ */
async function cancelAll() { async function cancelAll() {
loading.value = true loading.value = true
const data = enterprise.value.queryParams const data = JSON.parse(JSON.stringify(enterprise.value.queryParams));
data.pageNo = -1 data.pageSize = -1
const { list } = await EnterprisesApi.getEnterprisesPage(enterprise.value.queryParams) delete data.pageNo
const { list } = await EnterprisesApi.getEnterprisesPage(data)
if (list) { if (list) {
formData.value.enterprises = formData.value.enterprises.filter((e) => { formData.value.enterprises = formData.value.enterprises.filter((e) => {
return !list.some((r) => e.id == r.id) return !list.some((r) => e.id == r.id)
@ -365,16 +371,17 @@ function uniqueFunc(arr, uniId) {
*/ */
async function submitForm() { async function submitForm() {
const validate = await unref(formRef).validate() const validate = await unref(formRef).validate()
console.log(validate, formData.value)
if (validate) { if (validate) {
const data = formData.value const data = JSON.parse(JSON.stringify(formData.value))
data.enterprises = formData.value.enterprises.map((i) => i.id) data.enterpriseIds = formData.value.enterprises.map((i) => i.id)
data.startDate = data.planTime[0] data.startDate = data.planTime[0]
data.endDate = data.planTime[1] data.endDate = data.planTime[1]
if (data.id) { if (data.id) {
} else { } else {
TaskInfoApi.createTaskInfo(data).then(() => { TaskInfoApi.createTaskInfo(data).then(() => {
message.success('操作成功') message.success('操作成功')
tagView.delView(route)
router.go(-1)
}) })
} }
} }

Loading…
Cancel
Save