Browse Source

创建任务页面优化

master
DX 4 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 tenantEnable = import.meta.env.VITE_APP_TENANT_ENABLE
const { result_code, base_url, request_timeout } = config const { result_code, base_url, request_timeout } = config
// 需要忽略的提示。忽略后,自动 Promise.reject('error') // 需要忽略的提示。忽略后,自动 Promise.reject('error')
const ignoreMsgs = [ const ignoreMsgs = [
'无效的刷新令牌', // 刷新令牌被删除时,不用提示 '无效的刷新令牌', // 刷新令牌被删除时,不用提示

1
src/utils/dict.ts

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

134
src/views/task/create copy.vue

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

6
src/views/task/createEnterprise.vue

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

Loading…
Cancel
Save