<template> <!-- 质量整改 --> <div class="water-analysis-page"> <div class="top"> <el-form ref="ruleForm" inline :model="tableData" v-show="showSearch"> <el-form-item label="项目名称:" prop="projectName"> <el-input clearable style="width: 200px" v-model="tableData.projectName" placeholder="请输入项目名称"></el-input> </el-form-item> <el-form-item label="整改发起时间:" prop="timer"> <el-date-picker v-model="tableData.timer" type="daterange" unlink-panels style="width: 220px" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" value-format="YYYY-MM-DD" /> </el-form-item> <el-form-item label="限制整改时间:" prop="timer1"> <el-date-picker style="width: 220px" v-model="tableData.timer1" type="daterange" unlink-panels range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" value-format="YYYY-MM-DD" /> </el-form-item> <el-form-item label="流程步骤:"> <el-select v-model="tableData.status" placeholder="请选择流程步骤" clearable @change="selectChange"> <el-option v-for="dict in quality_rectification_status" :key="dict.value" :label="dict.label" :value="dict.value" /> </el-select> </el-form-item> <el-form-item label="提交人:" prop="submitUserName"> <!-- <el-input clearable v-model="tableData.submitUserName" style="width: 200px" placeholder="请输入提交人" ></el-input> --> <el-select clearable v-model="tableData.submitUserName" class="m-2" placeholder="请选择提交人" size="mini" style="width: 100%" filterable > <el-option v-for="item in personList" :key="item.userId" :label="item.nickName" :value="item.userName" /> </el-select> </el-form-item> <el-form-item> <el-button type="primary" icon="Search" @click="searchForm"> 查询</el-button> <el-button icon="Refresh" @click="resetQuery">重置</el-button> </el-form-item> </el-form> <el-row :gutter="10" class="mb8"> <el-col :span="1.5"> <!-- 角色:建设单位(buildUnit)可新增,海绵中心(spongeCenter) 处理 --> <el-button type="primary" plain icon="Plus" @click="onCheck('add')" v-if="userInfo.roles.includes('admin') || userInfo.roles.includes('buildUnit')" > 新增 </el-button> </el-col> <right-toolbar v-model:showSearch="showSearch" @queryTable="searchForm"></right-toolbar> </el-row> </div> <el-divider></el-divider> <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick" style="margin-top: -10px"> <el-tab-pane label="我的" name="main" v-if="userInfo.roles.includes('admin') || userInfo.roles.includes('buildUnit')"> </el-tab-pane> <el-tab-pane label="待办列表" name="todo" v-if="userInfo.roles.includes('admin') || userInfo.roles.includes('spongeCenter')"> </el-tab-pane> <el-tab-pane label="已办列表" name="done" v-if="userInfo.roles.includes('admin') || userInfo.roles.includes('spongeCenter')"> </el-tab-pane> <todoDon :key="todoDonKey" :todoList="todoList" :tableData="tableData" :getInfoList="getInfoList" ref="todoDonRef"> <template #pagination> <pagination v-show="(todoList.total || 0) > 0" :total="todoList.total || 0" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination=" getInfoList({ pageNum: queryParams.pageNum, pageSize: queryParams.pageSize, queryScope: todoList.queryScope, }) " /> </template> </todoDon> </el-tabs> <el-dialog v-model="visible" title="质量整改新增" :modal-append-to-body="false" :close-on-click-modal="false" width="90%" height="98%"> <tableDalgo v-if="visible" ref="tableDalgoRef" :typeList="typeList" @onModalClose="onModalClose"></tableDalgo> <template #footer> <div class="dialog-footer"> <el-button @click="open2" type="primary">保 存</el-button> <el-button @click="submitClict" type="success">提 交</el-button> <el-button @click="closed">关闭</el-button> </div> </template> </el-dialog> </div> <!-- 查看详情弹框 --> </template> <script setup> import tableDalgo from './qualityComponents/tableDalgo.vue'; import todoDon from './qualityComponents/todoDon.vue'; import { getInfo, getInfoMamin, userList } from '@/api/project/qualityRectification'; import useUserStore from '@/store/modules/user'; const { proxy } = getCurrentInstance(); const { quality_rectification_status } = proxy.useDict('quality_rectification_status'); const todoDonRef = ref(null); let typeList = ref({}); const showSearch = ref(true); const userInfo = useUserStore(); const activeName = ref(null); if (userInfo.roles.includes('spongeCenter')) { activeName.value = 'todo'; } else { activeName.value = 'main'; } let visible = ref(false); const todoDonKey = ref(0); const todoList = ref([]); const tableDalgoRef = ref(); const personList = ref([]); const queryParams = ref({ pageNum: 1, pageSize: 10, }); const userListM = async () => { let { data } = await userList(); personList.value = data; }; //动态组件 let tableData = ref({ pageNum: 1, pageSize: 10, queryScope: 'todo' }); //切换table const handleClick = ({ props: { name } }, event) => { tableData.value.queryScope = name; queryParams.value.pageNum = 1; getInfoList(tableData.value); }; function selectChange(v) { console.log('vvvv', v); } //搜索 const searchForm = () => { getInfoList(tableData.value); }; // 新增 const onCheck = v => { typeList.value.type = v; visible.value = true; nextTick(() => { tableDalgoRef.value.resect(); }); }; //关闭 function onModalClose() { visible.value = false; getInfoList(tableData.value); } function open2() { tableDalgoRef.value.submit(); } function closed() { tableDalgoRef.value.closed(); } const getInfoList = async prams => { if (prams.timer?.length > 0) { prams.abarbeitungSearchStartEndTime = prams.timer[1]; prams.abarbeitungSearchStartStartTime = prams.timer[0]; } else { prams.abarbeitungSearchStartEndTime = ''; prams.abarbeitungSearchStartStartTime = ''; } if (prams.timer1?.length > 0) { prams.abarbeitungSearchEndEndTime = prams.timer1[1]; prams.abarbeitungSearchEndStartTime = prams.timer1[0]; } else { prams.abarbeitungSearchEndEndTime = ''; prams.abarbeitungSearchEndStartTime = ''; } if (prams.queryScope == 'main') { let { data, total } = await getInfoMamin(prams); todoList.value = data; todoList.value.total = total; todoList.value.queryScope = prams.queryScope; } else { let { data, total } = await getInfo(prams); todoList.value = data; todoList.value.total = total; todoList.value.queryScope = prams.queryScope; } todoDonKey.value++; }; /** 重置按钮操作 */ function resetQuery() { tableData.value = { queryScope: tableData.value.queryScope, pageNum: 1, pageSize: 10, }; getInfoList(tableData.value); } //新增提交 function submitClict() { tableDalgoRef.value.submit(6); } onMounted(() => { getInfoList(tableData.value); userListM(); }); </script> <style lang="scss" scoped> .water-analysis-page { padding: 20px; .top { margin-bottom: 15px; } } .demo-tabs { background-color: transparent !important; } </style>