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}
{renderLayout()}
<Setting></Setting>
<Backtop></Backtop>
</section>

71
src/store/modules/app.ts

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

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

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

35
src/views/task/create.vue

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

Loading…
Cancel
Save