| | |
| | | > |
| | | <el-select |
| | | filterable |
| | | v-model="projectId" |
| | | v-model="planId" |
| | | placeholder="请选择检查计划" |
| | | class="flex1" |
| | | clearable |
| | | @change="handleSearch" |
| | | > |
| | | <el-option |
| | | v-for="item in [1, 2]" |
| | | :key="item" |
| | | :label="item" |
| | | :value="item" |
| | | v-for="item in planList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | |
| | | > |
| | | <el-select |
| | | filterable |
| | | v-model="projectId" |
| | | v-model="positionId" |
| | | placeholder="请选择岗位" |
| | | class="flex1" |
| | | clearable |
| | | @change="handleSearch" |
| | | > |
| | | <el-option |
| | | v-for="item in [1, 2]" |
| | | :key="item" |
| | | :label="item" |
| | | :value="item" |
| | | v-for="item in positionList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | |
| | | class="flex a-center j-between px--20 w--300 h--40 relative bgcolor1 picker" |
| | | > |
| | | <el-date-picker |
| | | v-model="dateTime" |
| | | v-model="startTime" |
| | | ref="datetime1" |
| | | type="datetime" |
| | | placeholder="" |
| | | @change="handleSearch" |
| | | > |
| | | </el-date-picker> |
| | | <div |
| | | class="absolute w100 h100 flex a-center c-fff fs--14 SHS" |
| | | style="width: calc(100% - 20px)" |
| | | v-if="dateTxt" |
| | | v-if="startTimeTxt" |
| | | > |
| | | {{ dateTxt }} |
| | | {{ startTimeTxt }} |
| | | </div> |
| | | <div |
| | | v-else |
| | | class="absolute w100 h100 flex a-center c-fff fs--14 SHSR" |
| | | > |
| | | 请选择日期 |
| | | 请选择开始时间 |
| | | </div> |
| | | <img |
| | | src="../../assets/img/home/Shape@2x (6).png" |
| | |
| | | class="flex a-center j-between px--20 w--300 h--40 relative bgcolor1 picker" |
| | | > |
| | | <el-date-picker |
| | | v-model="dateTime" |
| | | v-model="endTime" |
| | | ref="datetime2" |
| | | type="datetime" |
| | | placeholder="" |
| | | @change="handleSearch" |
| | | > |
| | | </el-date-picker> |
| | | <div |
| | | class="absolute w100 h100 flex a-center c-fff fs--14 SHS" |
| | | style="width: calc(100% - 20px)" |
| | | v-if="dateTxt" |
| | | v-if="endTimeTxt" |
| | | > |
| | | {{ dateTxt }} |
| | | {{ endTimeTxt }} |
| | | </div> |
| | | <div |
| | | v-else |
| | | class="absolute w100 h100 flex a-center c-fff fs--14 SHSR" |
| | | > |
| | | 请选择日期 |
| | | 请选择结束时间 |
| | | </div> |
| | | <img |
| | | src="../../assets/img/home/Shape@2x (6).png" |
| | |
| | | <div |
| | | class="flex a-center j-between w--300 pl--20 h--40 relative bgcolor1 searchBox" |
| | | > |
| | | <el-select |
| | | filterable |
| | | v-model="projectId" |
| | | <el-input |
| | | v-model="searchText" |
| | | placeholder="请输入搜索内容" |
| | | class="flex1" |
| | | clearable |
| | | @keyup.enter.native="handleSearch" |
| | | > |
| | | <el-option |
| | | v-for="item in [1, 2]" |
| | | :key="item" |
| | | :label="item" |
| | | :value="item" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | <div class="btn SHSR">搜索</div> |
| | | </el-input> |
| | | <div class="btn SHSR" @click="handleSearch">搜索</div> |
| | | </div> |
| | | </div> |
| | | <!-- 表格 --> |
| | | <CustomTable |
| | | :data="[ |
| | | { projectName: '项目777' }, |
| | | { projectName: '项目2' }, |
| | | { projectName: '项目4' }, |
| | | ]" |
| | | :data="tableData" |
| | | height="800" |
| | | style="border: 2px solid #3d7fff" |
| | | v-loading="loading" |
| | | > |
| | | <el-table-column label="计划名称" prop="projectName" /> |
| | | <el-table-column label="检查内容" prop="projectName" /> |
| | | <el-table-column label="岗位" prop="projectName" /> |
| | | <el-table-column label="问题备注" prop="projectName" /> |
| | | <el-table-column label="图片" prop="projectName"> |
| | | <template #default="{ row }" |
| | | ><div |
| | | <el-table-column label="计划名称" prop="planName" min-width="120" /> |
| | | <el-table-column label="检查内容" prop="checkContent" min-width="150" show-overflow-tooltip /> |
| | | <el-table-column label="岗位" prop="postName" min-width="100" /> |
| | | <el-table-column label="问题备注" prop="remark" min-width="150" show-overflow-tooltip /> |
| | | <el-table-column label="图片" min-width="80"> |
| | | <template #default="{ row }"> |
| | | <div |
| | | class="btnColor cursor-pointer" |
| | | :class="false && 'disableColor'" |
| | | @click="previewVisible = true" |
| | | :class="!row.img && 'disableColor'" |
| | | @click="row.img && previewImage(row)" |
| | | > |
| | | 1张 |
| | | {{ getImageCount(row.img) }}张 |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="检查时间" prop="projectName" /> |
| | | <el-table-column label="在岗情况" prop="projectName"> |
| | | <template #default="{ row, $index }"> |
| | | <el-table-column label="检查时间" prop="time" min-width="160" /> |
| | | <el-table-column label="在岗情况" min-width="120"> |
| | | <template #default="{ row }"> |
| | | <div class="flex a-center j-center"> |
| | | <div class="ripple"> |
| | | <div |
| | | class="ripple-wave wave-1" |
| | | :class="['bgColor33', 'bgColor66'][$index + 1]" |
| | | :class="stateMap[row.state] && stateMap[row.state].colorClass[0]" |
| | | ></div> |
| | | <div |
| | | class="ripple-wave wave-2" |
| | | :class="['bgColor44', 'bgColor77'][$index + 1]" |
| | | :class="stateMap[row.state] && stateMap[row.state].colorClass[1]" |
| | | ></div> |
| | | <div |
| | | class="ripple-wave wave-3" |
| | | :class="['bgColor55', 'bgColor88'][$index + 1]" |
| | | :class="stateMap[row.state] && stateMap[row.state].colorClass[2]" |
| | | ></div> |
| | | </div> |
| | | <div class="ml--6 SHSR">{{ $index }}</div> |
| | | <div class="ml--6 SHSR">{{ stateMap[row.state] ? stateMap[row.state].text : '-' }}</div> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作"> |
| | | <el-table-column label="操作" width="100"> |
| | | <template #default="{ row }"> |
| | | <el-button |
| | | @click="detailVisible = true" |
| | | @click="showDetail(row)" |
| | | type="text" |
| | | class="btnColor" |
| | | >详情</el-button |
| | |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | :current-page="currentPage" |
| | | :page-sizes="[100, 200, 300, 400]" |
| | | :page-size="10" |
| | | :total="400" |
| | | :page-sizes="[10, 20, 50, 100]" |
| | | :page-size="pageSize" |
| | | :total="total" |
| | | /> |
| | | </div> |
| | | <!-- 详情弹窗 --> |
| | | <CustomDialog title="项目详情" :visible.sync="detailVisible" width="1420px"> |
| | | <div class="oa" style="height: 700px"> |
| | | <CustomDialog title="人员在岗详情" :visible.sync="detailVisible" width="1420px"> |
| | | <div class="oa" style="height: 700px" v-loading="detailLoading"> |
| | | <div class="flex j-between gap--30 mt--30"> |
| | | <div class="flex1"> |
| | | <div class="SHSR fs--16 lh--16 mb--17 color1">计划名称:</div> |
| | | <div class="lh--60 px--19 c-fff SHSBold fs--18 w100 bgcolor8"> |
| | | 计划名称计划名称计划名称 |
| | | {{ detailData.planName || '-' }} |
| | | </div> |
| | | </div> |
| | | <div class="flex1"> |
| | | <div class="SHSR fs--16 lh--16 mb--17 color1">项目名称:</div> |
| | | <div class="lh--60 px--19 c-fff SHSBold fs--18 w100 bgcolor8"> |
| | | 计划名称计划名称计划名称 |
| | | {{ projectName || '-' }} |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | <div class="flex1"> |
| | | <div class="SHSR fs--16 lh--16 mb--17 color1">检查内容:</div> |
| | | <div class="lh--60 px--19 c-fff SHSBold fs--18 w100 bgcolor8"> |
| | | 计划名称计划名称计划名称 |
| | | {{ detailData.checkContent || '-' }} |
| | | </div> |
| | | </div> |
| | | <div class="flex1"> |
| | | <div class="SHSR fs--16 lh--16 mb--17 color1">岗位:</div> |
| | | <div class="lh--60 px--19 c-fff SHSBold fs--18 w100 bgcolor8"> |
| | | 计划名称计划名称计划名称 |
| | | {{ detailData.postName || '-' }} |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | <div class="flex1"> |
| | | <div class="SHSR fs--16 lh--16 mb--17 color1">问题备注:</div> |
| | | <div class="lh--60 px--19 c-fff SHSBold fs--18 w100 bgcolor8"> |
| | | 计划名称计划名称计划名称 |
| | | {{ detailData.remark || '-' }} |
| | | </div> |
| | | </div> |
| | | <div class="flex1"> |
| | | <div class="SHSR fs--16 lh--16 mb--17 color1">在岗情况:</div> |
| | | <div class="lh--60 px--19 c-fff SHSBold fs--18 w100 bgcolor8"> |
| | | 计划名称计划名称计划名称 |
| | | <div class="lh--60 px--19 c-fff SHSBold fs--18 w100 bgcolor8 flex a-center"> |
| | | <div class="ripple mr--10" v-if="detailData.state"> |
| | | <div |
| | | class="ripple-wave wave-1" |
| | | :class="stateMap[detailData.state] && stateMap[detailData.state].colorClass[0]" |
| | | ></div> |
| | | <div |
| | | class="ripple-wave wave-2" |
| | | :class="stateMap[detailData.state] && stateMap[detailData.state].colorClass[1]" |
| | | ></div> |
| | | <div |
| | | class="ripple-wave wave-3" |
| | | :class="stateMap[detailData.state] && stateMap[detailData.state].colorClass[2]" |
| | | ></div> |
| | | </div> |
| | | {{ stateMap[detailData.state] ? stateMap[detailData.state].text : '-' }} |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | <div class="flex1"> |
| | | <div class="SHSR fs--16 lh--16 mb--17 color1">检查时间:</div> |
| | | <div class="lh--60 px--19 c-fff SHSBold fs--18 w100 bgcolor8"> |
| | | 2020-12-12 |
| | | {{ detailData.time || '-' }} |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | <div class="SHSR fs--16 lh--16 mb--17 color1">图片:</div> |
| | | <div class="flex a-center oa gap--14"> |
| | | <img |
| | | v-for="item in 6" |
| | | :key="item" |
| | | src="../../assets/img/home/@3x@2x.png" |
| | | class="w--150 h--120" |
| | | v-for="(item, index) in detailData.img ? detailData.img.split(',').filter(i => i) : []" |
| | | :key="index" |
| | | :src="item" |
| | | class="w--150 h--120 cursor-pointer" |
| | | style="object-fit: cover; border-radius: 4px;" |
| | | @click="previewImage(detailData)" |
| | | /> |
| | | <div v-if="!detailData.img || !detailData.img.split(',').filter(i => i).length" class="c-fff SHSR">暂无图片</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | <!-- 图片预览 --> |
| | | <CustomPreview |
| | | :show="previewVisible" |
| | | :imgArr="[]" |
| | | :imgArr="previewImages" |
| | | @close="previewVisible = false" |
| | | /> |
| | | </div> |
| | |
| | | <script> |
| | | import HeaderBox from "../header/index.vue"; |
| | | import moment from "moment"; |
| | | import { getPositionList, getPlanList, getProjectOnDutyList, getProjectOnDutyDetail } from "./service"; |
| | | |
| | | export default { |
| | | components: { HeaderBox }, |
| | | props: {}, |
| | | data() { |
| | | return { |
| | | dateTime: null, |
| | | startTime: null, |
| | | endTime: null, |
| | | projectId: null, |
| | | projectName: null, |
| | | dateTxt: "", |
| | | startTimeTxt: "", |
| | | endTimeTxt: "", |
| | | currentPage: 1, |
| | | pageSize: 10, |
| | | total: 0, |
| | | detailVisible: false, |
| | | previewVisible: false, |
| | | // 下拉框数据 |
| | | planList: [], // 计划列表 |
| | | positionList: [], // 岗位列表 |
| | | planId: null, // 选中的计划ID |
| | | positionId: null, // 选中的岗位ID |
| | | searchText: "", // 搜索内容 |
| | | // 表格数据 |
| | | tableData: [], |
| | | loading: false, |
| | | // 详情数据 |
| | | detailData: {}, |
| | | detailLoading: false, |
| | | // 图片预览数据 |
| | | previewImages: [], |
| | | }; |
| | | }, |
| | | computed: {}, |
| | | computed: { |
| | | // 在岗情况映射 |
| | | stateMap() { |
| | | return { |
| | | 1: { text: "在岗", colorClass: ["bgColor33", "bgColor44", "bgColor55"] }, |
| | | 2: { text: "未在岗", colorClass: ["wave-1", "wave-2", "wave-3"] }, |
| | | 3: { text: "请假", colorClass: ["bgColor66", "bgColor77", "bgColor88"] }, |
| | | }; |
| | | }, |
| | | }, |
| | | watch: { |
| | | dateTime: { |
| | | handler(newVal, oldVal) { |
| | | startTime: { |
| | | handler(newVal) { |
| | | if (newVal) { |
| | | this.dateTxt = moment(newVal).format("YYYY年MM月DD日 HH:mm:ss"); |
| | | this.startTimeTxt = moment(newVal).format("YYYY年MM月DD日 HH:mm:ss"); |
| | | } else { |
| | | this.startTimeTxt = ""; |
| | | } |
| | | }, |
| | | immediate: true, |
| | | }, |
| | | endTime: { |
| | | handler(newVal) { |
| | | if (newVal) { |
| | | this.endTimeTxt = moment(newVal).format("YYYY年MM月DD日 HH:mm:ss"); |
| | | } else { |
| | | this.endTimeTxt = ""; |
| | | } |
| | | }, |
| | | immediate: true, |
| | |
| | | this.projectId = this.$route.query.projectId; |
| | | this.projectName = this.$route.query.projectName; |
| | | }, |
| | | mounted() {}, |
| | | mounted() { |
| | | this.initData(); |
| | | }, |
| | | methods: { |
| | | // 初始化数据 |
| | | async initData() { |
| | | await this.getPlanListData(); |
| | | await this.getPositionListData(); |
| | | await this.getTableData(); |
| | | }, |
| | | |
| | | // 获取计划下拉框数据 |
| | | async getPlanListData() { |
| | | try { |
| | | const res = await getPlanList(); |
| | | if (res) { |
| | | this.planList = res || []; |
| | | } |
| | | } catch (error) { |
| | | console.error("获取计划列表失败:", error); |
| | | } |
| | | }, |
| | | |
| | | // 获取岗位下拉框数据 |
| | | async getPositionListData() { |
| | | try { |
| | | const res = await getPositionList(); |
| | | if (res) { |
| | | this.positionList = res || []; |
| | | } |
| | | } catch (error) { |
| | | console.error("获取岗位列表失败:", error); |
| | | } |
| | | }, |
| | | |
| | | // 获取表格数据 |
| | | async getTableData() { |
| | | this.loading = true; |
| | | try { |
| | | const params = { |
| | | pageNum: this.currentPage, |
| | | pageSize: this.pageSize, |
| | | projectId: this.projectId, |
| | | }; |
| | | |
| | | // 添加可选参数 |
| | | if (this.planId) params.planId = this.planId; |
| | | if (this.positionId) params.positionId = this.positionId; |
| | | if (this.startTime) { |
| | | params.startTime = moment(this.startTime).format( |
| | | "YYYY-MM-DD HH:mm:ss" |
| | | ); |
| | | } |
| | | if (this.endTime) { |
| | | params.endTime = moment(this.endTime).format("YYYY-MM-DD HH:mm:ss"); |
| | | } |
| | | if (this.searchText) params.remark = this.searchText; |
| | | |
| | | const res = await getProjectOnDutyList(params); |
| | | if (res) { |
| | | this.tableData = res.records || res.list || []; |
| | | this.total = res.total || 0; |
| | | } |
| | | } catch (error) { |
| | | console.error("获取列表数据失败:", error); |
| | | this.$message.error("获取列表数据失败"); |
| | | } finally { |
| | | this.loading = false; |
| | | } |
| | | }, |
| | | |
| | | // 搜索 |
| | | handleSearch() { |
| | | this.currentPage = 1; |
| | | this.getTableData(); |
| | | }, |
| | | |
| | | // 分页大小改变 |
| | | handleSizeChange(val) { |
| | | console.log(`每页 ${val} 条`); |
| | | this.pageSize = val; |
| | | this.currentPage = 1; |
| | | this.getTableData(); |
| | | }, |
| | | |
| | | // 当前页改变 |
| | | handleCurrentChange(val) { |
| | | console.log(`当前页: ${val}`); |
| | | this.currentPage = val; |
| | | this.getTableData(); |
| | | }, |
| | | |
| | | // 点击日期选择器 |
| | | handleClick(type) { |
| | | this.$refs[`datetime${type}`].focus(); |
| | | }, |
| | | |
| | | // 查看详情 |
| | | async showDetail(row) { |
| | | if (!row.id) { |
| | | this.$message.warning("数据异常,无法查看详情"); |
| | | return; |
| | | } |
| | | |
| | | this.detailVisible = true; |
| | | this.detailLoading = true; |
| | | |
| | | try { |
| | | const res = await getProjectOnDutyDetail(row.id); |
| | | if (res) { |
| | | this.detailData = res; |
| | | } else { |
| | | this.$message.error("获取详情失败"); |
| | | } |
| | | } catch (error) { |
| | | console.error("获取详情失败:", error); |
| | | this.$message.error("获取详情失败"); |
| | | } finally { |
| | | this.detailLoading = false; |
| | | } |
| | | }, |
| | | |
| | | // 预览图片 |
| | | previewImage(row) { |
| | | if (row.img) { |
| | | // 如果img是字符串,可能是逗号分隔的多张图片 |
| | | this.previewImages = row.img.split(",").filter((item) => item); |
| | | this.previewVisible = true; |
| | | } else { |
| | | this.$message.warning("暂无图片"); |
| | | } |
| | | }, |
| | | |
| | | // 获取图片数量 |
| | | getImageCount(img) { |
| | | if (!img) return 0; |
| | | return img.split(",").filter((item) => item).length; |
| | | }, |
| | | |
| | | // 返回 |
| | | backFun() { |
| | | this.$router.go(-1); |
| | | }, |
| | |
| | | } |
| | | } |
| | | |
| | | .disableColor { |
| | | color: #666 !important; |
| | | cursor: not-allowed !important; |
| | | } |
| | | |
| | | .btnColor { |
| | | color: #00ebfc; |
| | | } |