Browse Source

创建任务页面优化

master
DX 3 weeks ago
parent
commit
d29da8b98a
  1. 1
      src/config/axios/service.ts
  2. 1
      src/utils/dict.ts
  3. 134
      src/views/task/create copy.vue
  4. 6
      src/views/task/createEnterprise.vue

1
src/config/axios/service.ts

@ -12,6 +12,7 @@ import { deleteUserCache } from '@/hooks/web/useCache'
const tenantEnable = import.meta.env.VITE_APP_TENANT_ENABLE
const { result_code, base_url, request_timeout } = config
// 需要忽略的提示。忽略后,自动 Promise.reject('error')
const ignoreMsgs = [
'无效的刷新令牌', // 刷新令牌被删除时,不用提示

1
src/utils/dict.ts

@ -144,6 +144,7 @@ export enum DICT_TYPE {
TASK_EXEC_TIME = 'task_exec_time',
TASK_STATE = 'task_state',
INSPECTIONS_STATUS = 'Inspections_status',
AIR_COLLECTION_TYPE = 'air_collection_type',
// ========== INFRA 模块 ==========
INFRA_BOOLEAN_STRING = 'infra_boolean_string',
INFRA_JOB_STATUS = 'infra_job_status',

134
src/views/task/create copy.vue

@ -14,8 +14,8 @@
format="YYYY年MM月DD日"
range-separator="至"
size="large"
start-placeholder="选择任务计划开始时间"
end-placeholder="选择任务计划结束时间"
start-placeholder="选择开始时间"
end-placeholder="选择结束时间"
value-format="YYYY-MM-DD"
/>
</el-form-item>
@ -24,23 +24,22 @@
type="textarea"
v-model="formData.description"
:autosize="{
minRows: 4
minRows: 5
}"
placeholder="请输入描述"
/>
</el-form-item>
<el-form-item label="任务类型" prop="taskType">
<el-tree-select
v-model="formData.taskType"
:data="tagList"
:props="defaultProps"
check-strictly
node-key="id"
size="large"
placeholder="请选择任务类型"
/>
<el-select v-model="formData.taskTopType" placeholder="请选择任务优先级" size="large" @change="selectChild">
<el-option
v-for="dict in taskTagTopList"
:key="dict.id"
:label="dict.tagName"
:value="dict.id"
/>
</el-select>
</el-form-item>
<el-form-item label="执行周期" prop="execCycle" v-if="formData.taskType == 2">
<!-- <el-form-item label="执行周期" prop="execCycle" v-if="formData.taskType == 2">
<el-select v-model="formData.execCycle" placeholder="请选择执行周期">
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.TASK_EXEC_TIME)"
@ -49,14 +48,14 @@
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-form-item> -->
<el-form-item label="类型选项" prop="priority">
<el-select v-model="formData.priority" placeholder="请选择任务优先级" size="large">
<el-select v-model="formData.taskType" placeholder="请选择任务选项" >
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.TASK_PRIORITY)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
v-for="dict in tagChildList"
:key="dict.id"
:label="dict.tagName"
:value="dict.id"
/>
</el-select>
</el-form-item>
@ -149,10 +148,10 @@
/>
</el-form-item>
<el-form-item class="form-item">
<el-button @click="handleQuery">
<Icon icon="ep:search" class="mr-5px" /> 搜索
<el-button type="primary" plain>
<Icon icon="ep:search" class="mr-5px" /> 查询
</el-button>
<el-button @click="resetQuery" class="mr-10px">
<el-button @click="resetQuery" class="mr-10px" type="primary" plain>
<Icon icon="ep:refresh" class="mr-5px" /> 重置
</el-button>
</el-form-item>
@ -175,10 +174,7 @@
}"
>
<template #empty>
<div class="no-data">
<el-image src="/src/assets/imgs/no_data.png" style="width: 120px" />
<p>暂无数据</p>
</div>
<el-empty description="暂无数据" />
</template>
<el-table-column type="selection" width="30" />
<el-table-column property="enterprisesName" label="企业名称" min-width="100" />
@ -264,8 +260,8 @@
</section>
<div class="footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="submitForm">返回列表</el-button>
<el-button type="primary" @click="submitForm" size="large">创建任务</el-button>
<el-button @click="submitForm" size="large">返回列表</el-button>
<el-button
type="primary"
@click="submitForm"
@ -324,13 +320,13 @@ const formCreateRef = ref()
const message = useMessage() //
const formRules = reactive({
title: [{ required: true, message: '任务标题不能为空', trigger: 'blur' }],
taskType: [
{
required: true,
message: '任务类型不能为空',
trigger: 'change'
}
],
// taskType: [
// {
// required: true,
// message: '',
// trigger: 'change'
// }
// ],
planTime: [{ required: true, message: '时间周期不能为空', trigger: 'blur' }]
})
const { query } = useRoute()
@ -545,45 +541,73 @@ async function submitForm() {
const validate = await unref(formRef).validate()
if (validate) {
const data = JSON.parse(JSON.stringify(formData.value))
enterprise.value.list
//1
data.status = 1
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 (enterprise.value.list.length == 0) {
message.success('温馨提示:请您选择执法对象')
} else {
if (data.status < 2) {
data.startDate = data.planTime[0]
data.endDate = data.planTime[1]
data.enterpriseIds = enterprise.value.list.map(i=>i.id)
console.log('data', data)
// if (data.id) {
// TaskInfoApi.updateTaskInfo(data).then(() => {
// message.success('')
// tagView.delView(route)
// router.go(-1)
// })
// } else {
// TaskInfoApi.createTaskInfo(data).then(() => {
// message.success('')
// tagView.delView(route)
// router.go(-1)
// })
// }
if (data.id) {
TaskInfoApi.updateTaskInfo(data).then(() => {
message.success('操作成功')
tagView.delView(route)
router.go(-1)
})
} else {
TaskInfoApi.createTaskInfo(data).then(() => {
message.success('操作成功')
tagView.delView(route)
router.go(-1)
})
}
} else {
message.success('温馨提示:该任务已经执行,无法再进行修改')
}
}
}
}
// async function taskTopType() {
// const data = TagLibraryApi.getTagLibraryPage()
// }
//
const taskTagTopList:any = ref([])
//
const tagChildList:any = ref([])
async function taskTopQuery() {
const params = {
tagType: 2
}
const data = await TagLibraryApi.getTagLibraryPage(params)
taskTagTopList.value = data
}
async function init() {
//
const userData = await getSimpleUserZGList()
userList.value = userData
//
taskTopQuery()
if (query.id) {
TaskInfoApi.getTaskInfo(query.id).then((res) => {
formData.value = res
@ -594,6 +618,12 @@ async function init() {
}
}
const selectChild = (value: any) => {
const data = taskTagTopList.value.find(item=>item.id == value)
console.log('daratata', data.children)
tagChildList.value = data.children
}
function getList(data) {
enterprise.value.list.push(...data)
//
@ -634,6 +664,8 @@ onMounted(() => {
.descClass {
grid-row: span 2;
flex: 1 0 0;
align-self: stretch;
}
@ -762,7 +794,7 @@ onMounted(() => {
.form-container {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 24px;
gap: 20px;
margin-bottom: 20px;
}

6
src/views/task/createEnterprise.vue

@ -80,10 +80,10 @@
</el-form-item>
<el-form-item class="form-item">
<el-button @click="handleQuery">
<el-button @click="handleQuery" type="primary" plain>
<Icon icon="ep:search" class="mr-5px" /> 搜索
</el-button>
<el-button @click="resetQuery" class="mr-10px">
<el-button @click="resetQuery" class="mr-10px" type="primary" plain>
<Icon icon="ep:refresh" class="mr-5px" /> 重置
</el-button>
</el-form-item>
@ -220,7 +220,7 @@ const queryParams = ref({
})
//
const visible = ref(true) //
const visible = ref(false) //
// ... ...
//
const handleClose = () => {

Loading…
Cancel
Save