Browse Source

页面优化

master
DX 2 weeks ago
parent
commit
6d5e9ba66b
  1. 5
      src/api/system/taglibrary/index.ts
  2. 2
      src/hooks/web/useMessage.ts
  3. 3
      src/utils/dict.ts
  4. 2
      src/views/airqualitycollection/index.vue
  5. 224
      src/views/task/create copy 2.vue
  6. 47
      src/views/task/createEnterprise2.vue

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

@ -18,6 +18,11 @@ export const TagLibraryApi = {
return await request.get({ url: `/system/tag-library/page`, params })
},
// 查询企业标签分页
childrenList: async (id: number) => {
return await request.get({ url: `/system/tag-library/childrenList?id=`+id })
},
// 查询企业标签详情
getTagLibrary: async (id: any) => {
return await request.get({ url: `/system/tag-library/get?id=` + id })

2
src/hooks/web/useMessage.ts

@ -67,7 +67,7 @@ export const useMessage = () => {
{
confirmButtonText: t('common.ok'),
cancelButtonText: t('common.cancel'),
type: 'warning'
// type: 'warning'
}
)
},

3
src/utils/dict.ts

@ -156,7 +156,8 @@ export enum DICT_TYPE {
INFRA_CODEGEN_SCENE = 'infra_codegen_scene',
INFRA_FILE_STORAGE = 'infra_file_storage',
INFRA_OPERATE_TYPE = 'infra_operate_type',
TASK_NOTICE_TIME = 'task_notice_time',
// ========== BPM 模块 ==========
BPM_MODEL_TYPE = 'bpm_model_type',
BPM_MODEL_FORM_TYPE = 'bpm_model_form_type',

2
src/views/airqualitycollection/index.vue

@ -92,7 +92,7 @@
<el-table-column label="NO(Hg/m3)" align="center" prop="no" />
<el-table-column label="NOx(Hg/m3)" align="center" prop="nOx" />
<el-table-column label="CO(mg/m3)" align="center" prop="co" />
<el-table-column label="0з(ug/m3)" align="center" prop="o3" />
<el-table-column label="Oз(ug/m3)" align="center" prop="o3" />
<!-- <el-table-column label="操作" align="center" min-width="120px">
<template #default="scope">
<el-button

224
src/views/task/create copy 2.vue

@ -9,18 +9,18 @@
<el-form-item label="任务标题" prop="title">
<el-input v-model="formData.title" placeholder="请输入任务标题" />
</el-form-item>
<el-form-item label="时间周期" prop="planTime">
<el-date-picker
v-model="formData.planTime"
type="daterange"
format="YYYY年MM月DD日"
range-separator="至"
size="large"
start-placeholder="选择开始时间"
end-placeholder="选择结束时间"
value-format="YYYY-MM-DD"
/>
<el-form-item label="任务类型" prop="taskType">
<el-select v-model="formData.taskType" placeholder="请选择任务类型" size="large">
<el-option
v-for="dict in tagChildList"
:key="dict.id"
:label="dict.tagName"
:value="dict.id"
/>
</el-select>
</el-form-item>
<el-form-item label="描述" prop="description" style="width: 100%; padding: 0; margin-top: 0px;" class="descClass">
<el-input
type="textarea"
@ -31,16 +31,21 @@
placeholder="请输入描述"
/>
</el-form-item>
<el-form-item label="任务类型" prop="taskTopType">
<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 label="时间周期" prop="planTime">
<el-date-picker
v-model="formData.planTime"
type="daterange"
format="YYYY年MM月DD日"
range-separator="至"
size="large"
start-placeholder="选择开始时间"
end-placeholder="选择结束时间"
value-format="YYYY-MM-DD"
/>
</el-form-item>
<!-- <el-form-item label="执行周期" prop="execCycle" v-if="formData.taskType == 2">
<el-select v-model="formData.execCycle" placeholder="请选择执行周期">
<el-option
@ -51,13 +56,13 @@
/>
</el-select>
</el-form-item> -->
<el-form-item label="类型选项" prop="taskType">
<el-select v-model="formData.taskType" placeholder="请选择任务选项" :disabled="isReadonly" >
<el-form-item label="通知时间" prop="execCycle">
<el-select v-model="formData.execCycle" placeholder="请选择任务选项" >
<el-option
v-for="dict in tagChildList"
:key="dict.id"
:label="dict.tagName"
:value="dict.id"
v-for="dict in getStrDictOptions(DICT_TYPE.TASK_NOTICE_TIME)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
@ -84,47 +89,27 @@
:value="dict.value"
/>
</el-select>
<el-select v-model="enterprise.queryParams.userId" placeholder="请选择执法人员" size="large" filterable clearable>
<el-option
v-for="dict in userList"
:key="dict.id"
:label="dict.deptName +'_'+ dict.realName"
:value="dict.id"
/>
</el-select>
</div>
<div>
<el-select
v-model="enterprise.queryParams.hy"
placeholder="请选择行业"
clearable
size="large"
>
<el-option
v-for="dict in hyList"
:key="dict.id"
:label="dict.tagName"
:value="dict.tagName"
/>
</el-select>
<el-input
v-model="enterprise.queryParams.enterprisesName"
placeholder="请输入企业名称" size="large"
/>
</div>
<div>
<el-select
v-model="enterprise.queryParams.st"
placeholder="请选择生态" size="large"
v-model="enterprise.queryParams.hy"
placeholder="请选择行业"
clearable
size="large"
>
<el-option
v-for="dict in stList"
v-for="dict in hyList"
:key="dict.id"
:label="dict.tagName"
:value="dict.tagName"
/>
</el-select>
<div class="btn">
<el-button type="primary" plain size="large" @click="handleQuery">
<Icon icon="ep:search" class="mr-5px" /> 查询
@ -133,20 +118,15 @@
<Icon icon="ep:refresh" class="mr-5px" /> 重置
</el-button>
</div>
</div>
<div>
<el-select
v-model="enterprise.queryParams.wr"
placeholder="请选择污染程度"
size="large"
clearable
>
<el-select v-model="enterprise.queryParams.userId" placeholder="请选择执法人员" size="large" filterable clearable>
<el-option
v-for="dict in wrList"
v-for="dict in userList"
:key="dict.id"
:label="dict.tagName"
:value="dict.tagName"
:label="dict.deptName +'_'+ dict.realName"
:value="dict.id"
/>
</el-select>
<div class="btn2">
@ -254,24 +234,20 @@
</div>
</div>
<div class="footer">
<el-button type="primary" @click="submitForm" size="large">发布任务</el-button>
<el-button @click="goBack" size="large">返回列表</el-button>
<el-button type="primary" @click="submitForm(false)" size="large">{{btnTitle}}</el-button>
<el-button
type="warning"
type="primary"
v-if="showButton"
@click="submitForm"
@click="submitForm(true)"
size="large"
v-hasPermi="['system:enterprise-inspections:audit']"
>审核通过</el-button
>
<el-button
type="danger"
@click="submitForm"
v-if="showButton"
size="large"
v-hasPermi="['system:enterprise-inspections:audit']"
>删除</el-button
>
<el-button type="danger" link v-if="formData.status == 0" @click="handleDeleteTask('delete')">删除任务?</el-button>
<el-button type="warning" link v-if="formData.status == 2" @click="handleDeleteTask('end')">结束任务?</el-button>
<el-button @click="goBack" size="large">返回列表</el-button>
</div>
</div>
@ -289,7 +265,7 @@ import { cloneDeep } from 'lodash-es';
import { getSimpleUserZGList } from '@/api/system/user'
defineOptions({ name: 'CreateTask'})
const formData = ref({
const formData:any = ref({
id: undefined,
title: undefined,
description: undefined,
@ -310,7 +286,6 @@ const formData = ref({
tags: [],
enterprises: [] as any
})
const isReadonly = ref(true)
const router = useRouter()
const route = useRoute()
const tagView = useTagsViewStore()
@ -318,10 +293,10 @@ const formCreateRef = ref()
const message = useMessage() //
const formRules = reactive({
title: [{ required: true, message: '任务标题不能为空', trigger: 'blur' }],
taskTopType: [
execCycle: [
{
required: true,
message: '任务类型不能为空',
message: '任务通知时间不能为空',
trigger: 'change'
}
],
@ -336,8 +311,6 @@ const formRules = reactive({
})
const { query } = useRoute()
const formRef = ref() // Ref`
const tagList = ref([])
const queryFormRef = ref() //
const enterprise:any = ref({
list: [] as any,
queryParams: reactive({
@ -359,6 +332,26 @@ const goBack = () => {
router.go(-1); // router.back()
};
const handleDeleteTask = async (type: string) => {
try {
if (type == 'delete') {
await message.delConfirm("是否确定删除任务!", "删除任务")
await TaskInfoApi.deleteTaskInfo(formData.value.id)
} else {
await message.delConfirm("是否确定结束任务", "结束任务")
formData.value.status = 3
await TaskInfoApi.updateTaskInfo(formData.value)
}
} finally {
}
}
//
@ -440,14 +433,10 @@ const isAllConditionsEmpty = computed(() => {
!params.enterprisesName &&
!params.qy &&
!params.hy &&
!params.st &&
!params.wr &&
!params.userId
);
});
/** 搜索按钮操作 */
const handleQuery = () => {
@ -464,7 +453,7 @@ const filterList = (list: EnterprisesVO[]) => {
if (isAllConditionsEmpty.value) return enterprise_copy.value.list; //
if (list.length > 0) {
const { enterprisesName, qy, hy, st, wr , userId } = enterprise.value.queryParams;
const { enterprisesName, qy, hy, userId } = enterprise.value.queryParams;
@ -472,19 +461,15 @@ const filterList = (list: EnterprisesVO[]) => {
if (item.tagList) {
//
const nameMatch = enterprisesName ?
item.enterprisesName?.toLowerCase().includes(enterprisesName.toLowerCase()) : true;
item.enterprisesName?.toLowerCase().includes(enterprisesName.toLowerCase()) : true;
//
const typeMatch = qy ? item.region == qy : true;
//
const hyMatch = hy ? item.tagList.includes(hy) : true
const stMatch = st ? item.tagList.includes(st) : true
const wrMatch = wr ? item.tagList.includes(wr) : true
const userIdMatch = userId ? item.userId == userId : true
return nameMatch && typeMatch && hyMatch && stMatch && wrMatch && userIdMatch;
return nameMatch && typeMatch && hyMatch && userIdMatch;
}
});
}
@ -533,10 +518,6 @@ const wrList:any = ref([])
stList.value = data[1].children
wrList.value = data[2].children
}
const defaultProps = {
label: 'tagName', // 使 'name'
children: 'children' // 使 'children'
}
/**
* 数组去重
@ -551,7 +532,26 @@ function uniqueFunc(arr, uniId) {
/**
* 提交表单
*/
async function submitForm() {
async function submitForm(isAudit) {
let title:any = ''
let content:any = ''
if (formData.value.id) {
if (isAudit) {
title = '审核任务'
content = '是否确定审核任务?'
} else{
title = '修改任务'
content = '是否确定修改任务?'
}
} else {
title = '发布任务'
content = '是否确定发布新的任务?'
}
await message.delConfirm(content, title)
const validate = await unref(formRef).validate()
if (validate) {
// id
@ -560,7 +560,7 @@ async function submitForm() {
enterprise.value.list
//1
data.status = 1
data.status = 0
if (enterprise.value.list.length == 0) {
message.success('温馨提示:请您选择执法对象')
@ -572,6 +572,9 @@ async function submitForm() {
data.enterpriseIds = enterprise.value.list.map(i=>i.id)
if (data.id) {
if (isAudit) {
data.status = 1
}
TaskInfoApi.updateTaskInfo(data).then(() => {
message.success('操作成功')
tagView.delView(route)
@ -591,22 +594,20 @@ async function submitForm() {
}
}
//
const taskTagTopList:any = ref([])
//
const tagChildList:any = ref([])
async function taskTopQuery() {
const params = {
tagType: 2
}
const data = await TagLibraryApi.getTagLibraryPage(params)
taskTagTopList.value = data
const data = await TagLibraryApi.childrenList(26)
tagChildList.value = data
}
const showButton = ref(false)
const btnTitle = ref('发布任务')
async function init() {
//
@ -617,7 +618,8 @@ async function init() {
taskTopQuery()
if (query.id) {
btnTitle.value = '修改任务'
showButton.value = true
const res= await TaskInfoApi.getTaskInfo(query.id)
@ -625,8 +627,12 @@ async function init() {
//
const tag = await TagLibraryApi.getTagLibrary(res.taskType)
formData.value.taskTopType = tag.parentId
selectChild(tag.parentId)
formData.value.taskType = tag.id
formData.value.taskType = tag.id
if (formData.value.execCycle) {
formData.value.execCycle = formData.value.execCycle.toString()
}
formData.value.planTime = [formData.value.startDate, formData.value.endDate]
formData.value.enterprises = res.enterpriseIdes
formData.value.tags = res.taskTagIdes.map((t) => t.tagId)
@ -639,11 +645,6 @@ async function init() {
}
}
const selectChild = (value: any) => {
const data = taskTagTopList.value.find(item=>item.id == value)
isReadonly.value = false
tagChildList.value = data.children
}
function getList(data) {
@ -661,6 +662,7 @@ enterprise.value.list = [...diff, ...enterprise.value.list];
getTagList()
onMounted(() => {
init()
})

47
src/views/task/createEnterprise2.vue

@ -46,28 +46,6 @@
</el-select>
</el-form-item>
<el-form-item label="" prop="st" class="form-item">
<el-select v-model="enterprise.queryParams.st" placeholder="请选择生态" clearable>
<el-option
v-for="dict in stList"
:key="dict.id"
:label="dict.tagName"
:value="dict.id"
/>
</el-select>
</el-form-item>
<el-form-item label="" prop="wr" class="form-item">
<el-select v-model="enterprise.queryParams.wr" placeholder="请选择污染程度" clearable>
<el-option
v-for="dict in wrList"
:key="dict.id"
:label="dict.tagName"
:value="dict.id"
/>
</el-select>
</el-form-item>
<el-form-item label="" prop="userId" class="form-item">
<el-select v-model="enterprise.queryParams.userId" placeholder="请选择执法人员" filterable clearable>
<el-option
@ -253,13 +231,8 @@ async function getEnterPriseList() {
console.log('enterprise.value.queryParams', enterprise.value.queryParams)
if (enterprise.value.queryParams.hy ||
enterprise.value.queryParams.st ||
enterprise.value.queryParams.wr
) {
if (enterprise.value.queryParams.hy ) {
enterprise.value.queryParams.tagList.push(enterprise.value.queryParams.hy)
enterprise.value.queryParams.tagList.push(enterprise.value.queryParams.st)
enterprise.value.queryParams.tagList.push(enterprise.value.queryParams.wr)
}
@ -267,15 +240,19 @@ async function getEnterPriseList() {
const data = await EnterprisesApi.getEnterpriseByUserId(enterprise.value.queryParams)
enterprise.value.list = data.list
enterprise.value.total = data.total
console.log('enterprise.value.list=>', enterprise.value.list)
} finally {
loading.value = false
enterprise.value.queryParams.tagList = []
}
}
//
const open = async () => {
// TODO:
visible.value = true
getEnterPriseList()
}
/** 搜索按钮操作 */
@ -293,20 +270,16 @@ const resetQuery = () => {
//
const hyList: any = ref([])
//
const stList: any = ref([])
//
const wrList: any = ref([])
//
const userList:any = ref()
async function init() {
try {
const codeList = 'codeList=hy&codeList=st&codeList=wr'
const codeList = 'codeList=hy'
const data = await TagLibraryApi.tagLibraryList(codeList)
hyList.value = data[0].children
stList.value = data[1].children
wrList.value = data[2].children
} finally {
}
@ -317,7 +290,7 @@ async function init() {
}
getEnterPriseList()
onMounted(() => {
init()
})
@ -343,7 +316,7 @@ defineExpose({ open })
position: relative;
.form-container {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-template-columns: repeat(3, 1fr);
gap: 24px;
margin-bottom: 20px;
}

Loading…
Cancel
Save