| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472 |
- <template>
- <el-row :gutter="20">
- <el-col :span="4" :xs="24">
- <ContentWrap class="h-1/1" style="border: 0">
- <DeptTree @node-click="handleDeptNodeClick" />
- </ContentWrap>
- </el-col>
- <el-col :span="20" :xs="24">
- <!-- 统计卡片 -->
- <el-row :gutter="18" class="mb-4">
- <el-col :span="4">
- <div style="background-color: #fff; border-radius: 10px">
- <div class="stat-card bg-blue-gradient">
- <Icon icon="ep:histogram" :size="40" />
- <div class="card-title">工单数量</div>
- <div class="card-value pt-5">{{
- deviceCount.finished + deviceCount.ignore + deviceCount.todo
- }}</div>
- </div>
- </div>
- </el-col>
- <el-col :span="4">
- <div style="background-color: #fff; border-radius: 10px">
- <div class="stat-card bg-green-gradient">
- <Icon icon="ep:finished" :size="40" />
- <div class="card-title">完成数量</div>
- <div class="card-value pt-5">{{ deviceCount.finished }}</div>
- </div>
- </div>
- </el-col>
- <el-col :span="4">
- <div style="background-color: #fff; border-radius: 10px">
- <div class="stat-card bg-orange-gradient">
- <Icon icon="ep:more-filled" :size="40" />
- <div class="card-title">未完成数量</div>
- <div class="card-value pt-5">{{ deviceCount.todo }}</div>
- </div>
- </div>
- </el-col>
- <el-col :span="4">
- <div style="background-color: #fff; border-radius: 10px">
- <div class="stat-card bg-green-gradient">
- <Icon icon="ep:hide" :size="40" />
- <div class="card-title">已忽略</div>
- <div class="card-value pt-5">{{ deviceCount.ignore }}</div>
- </div>
- </div>
- </el-col>
- <el-col :span="4">
- <div style="background-color: #fff; border-radius: 10px">
- <div class="stat-card bg-red-gradient">
- <Icon icon="ep:bell" :size="40" />
- <div class="card-title">异常设备数量</div>
- <div class="card-value pt-5">{{ exceptions?.exceptionNum || 0 }}</div>
- </div>
- </div>
- </el-col>
- <el-col :span="4">
- <div style="background-color: #fff; border-radius: 10px">
- <div class="stat-card bg-warn-gradient">
- <Icon icon="ep:info-filled" :size="40" />
- <div class="card-title">异常点数量</div>
- <div class="card-value pt-5">{{ exceptionPoint.value }}</div>
- </div>
- </div>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="24">
- <el-radio-group v-model="dateType" size="default" fill="#409eff">
- <el-radio-button label="年" value="year" />
- <el-radio-button label="月" value="month" />
- <el-radio-button label="日" value="day" />
- </el-radio-group>
- </el-col>
- </el-row>
- <!-- 列表 -->
- <ContentWrap style="border: 0; margin-top: 10px">
- <el-table
- v-loading="loading"
- :row-class-name="tableRowClassName"
- :data="list"
- :show-overflow-tooltip="true"
- @row-click="handleRowClick"
- height="48vh"
- >
- <el-table-column :label="t('iotDevice.serial')" width="70" align="center">
- <template #default="scope">
- {{ scope.$index + 1 }}
- </template>
- </el-table-column>
- <el-table-column
- :label="t('bomList.name')"
- align="center"
- prop="inspectOrderTitle"
- min-width="300"
- />
- <el-table-column label="项目" align="center" prop="project" min-width="110" />
- <el-table-column label="公司" align="center" prop="company" min-width="110" />
- <el-table-column
- :label="t('route.orderType')"
- align="center"
- prop="type"
- min-width="90"
- />
- <el-table-column
- :label="t('operationFill.status')"
- align="center"
- prop="status"
- min-width="95"
- >
- <template #default="scope">
- <dict-tag :type="DICT_TYPE.PMS_INSPECT_ORDER_STATUS" :value="scope.row.status" />
- </template>
- </el-table-column>
- <el-table-column label="设备明细" align="center" prop="deviceInfo" min-width="110" />
- <el-table-column
- :label="t('iotMaintain.PersonInCharge')"
- align="center"
- prop="chargeName"
- min-width="110"
- />
- <!--
- <el-table-column
- :label="t('inspect.generateTime')"
- align="center"
- prop="createTime"
- :formatter="dateFormatter"
- min-width="180px"
- />
- <el-table-column
- :label="t('inspect.executeTime')"
- align="center"
- prop="executeDate"
- :formatter="dateFormatter"
- min-width="180px"
- /> -->
- <el-table-column
- :label="t('iotMaintain.operation')"
- align="center"
- min-width="160px"
- fixed="right"
- >
- <template #default="scope">
- <el-button link type="primary" @click="openForm(scope.row.id)">
- 异常巡检点
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <!-- 分页 -->
- <Pagination
- :total="total"
- v-model:page="queryParams.pageNo"
- v-model:limit="queryParams.pageSize"
- @pagination="getList"
- />
- </ContentWrap>
- </el-col>
- </el-row>
- </template>
- <script setup lang="ts">
- import { IotInspectOrderApi, IotInspectOrderVO } from '@/api/pms/inspect/order'
- import { DICT_TYPE } from '@/utils/dict'
- import DeptTree from '@/views/system/user/DeptTree.vue'
- import { watch } from 'vue'
- const { push } = useRouter()
- const { params } = useRoute()
- /** 巡检工单 列表 */
- defineOptions({ name: 'IotInspectOrder' })
- const { t } = useI18n() // 国际化
- const loading = ref(true) // 列表的加载中
- const list = ref<IotInspectOrderVO[]>([]) // 列表的数据
- const deptId = params.deptId
- const createTime = params.createTime
- const total = ref(0) // 列表的总页数
- let dateType = ref('year')
- const queryParams = reactive({
- pageNo: 1,
- pageSize: 10,
- inspectOrderTitle: undefined,
- inspectOrderCode: undefined,
- status: undefined,
- remark: undefined,
- createTime: [],
- deptId: undefined,
- deviceIds: undefined
- })
- const queryFormRef = ref() // 搜索的表单
- let exceptions = ref(null)
- let exceptionPoint = ref([])
- let deviceCount = ref([])
- const handleDeptNodeClick = async (row) => {
- queryParams.deptId = row.id
- await getList()
- await getCounts()
- }
- const tableRowClassName = ({ row }) => {
- if (row.exceptionCount > 0) {
- return 'exception-row'
- }
- return ''
- }
- const handleRowClick = (row, column: any, event: Event) => {
- // 只有当行有异常时才允许点击跳转
- if (row.exceptionCount > 0) {
- // 阻止事件冒泡,避免与按钮点击冲突
- event.stopPropagation()
- push({
- name: 'IotInspectItemStat',
- query: { orderName: row.inspectOrderTitle }
- })
- }
- }
- /** 查询列表 */
- const getList = async () => {
- loading.value = true
- try {
- const data = await IotInspectOrderApi.getIotInspectOrderList(queryParams)
- list.value = data.list
- total.value = data.total
- } finally {
- loading.value = false
- }
- }
- watch(
- dateType,
- () => {
- const now = new Date()
- let startTime: Date
- let endTime: Date
- switch (dateType.value) {
- case 'year':
- // 当年:1月1日 00:00:00 到 12月31日 23:59:59
- startTime = new Date(now.getFullYear(), 0, 1, 0, 0, 0, 0)
- endTime = new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999)
- break
- case 'month':
- // 当月:月初 00:00:00 到 月末 23:59:59
- startTime = new Date(now.getFullYear(), now.getMonth(), 1, 0, 0, 0, 0)
- // 下个月的第0天就是当月的最后一天
- endTime = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999)
- break
- case 'day':
- // 当日:当天 00:00:00 到 23:59:59
- const year = now.getFullYear()
- const month = now.getMonth()
- const date = now.getDate()
- startTime = new Date(year, month, date, 0, 0, 0, 0)
- endTime = new Date(year, month, date, 23, 59, 59, 999)
- break
- default:
- startTime = new Date(now.getFullYear(), 0, 1, 0, 0, 0, 0)
- endTime = new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999)
- }
- // 使用本地时间格式化函数,避免时区转换问题
- const formatLocalDateTime = (date: Date): string => {
- const year = date.getFullYear()
- const month = String(date.getMonth() + 1).padStart(2, '0')
- const day = String(date.getDate()).padStart(2, '0')
- const hours = String(date.getHours()).padStart(2, '0')
- const minutes = String(date.getMinutes()).padStart(2, '0')
- const seconds = String(date.getSeconds()).padStart(2, '0')
- return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
- }
- // 设置查询参数 - 使用本地时间格式化
- queryParams.createTime = [formatLocalDateTime(startTime), formatLocalDateTime(endTime)]
- // 重新获取数据
- getList()
- getCounts()
- },
- {
- immediate: true
- }
- )
- /** 搜索按钮操作 */
- const handleQuery = () => {
- queryParams.pageNo = 1
- getList()
- }
- /** 重置按钮操作 */
- const resetQuery = () => {
- queryFormRef.value.resetFields()
- handleQuery()
- }
- const reasonFormRef = ref(null)
- const form = reactive({
- id: undefined,
- reason: ''
- })
- // 重置表单
- const resetForm = () => {
- reasonFormRef.value?.resetFields()
- }
- /** 添加/修改操作 */
- const formRef = ref()
- const openForm = (id?: number) => {
- push({ name: 'InspectOrderDetail', params: { id } })
- }
- async function getCounts() {
- exceptions.value = await IotInspectOrderApi.getIotInspectOrderExceptionDeviceCount({
- deptId: queryParams.deptId,
- createTime: queryParams.createTime
- })
- exceptionPoint.value = await IotInspectOrderApi.getIotInspectOrderExceptionPointCount({
- deptId: queryParams.deptId,
- createTime: queryParams.createTime
- })
- deviceCount.value = await IotInspectOrderApi.getInspectItemStatus({
- deptId: queryParams.deptId,
- createTime: queryParams.createTime
- })
- }
- /** 初始化 **/
- onMounted(() => {
- getCounts()
- if (params.status) {
- queryParams.status = params.status
- }
- if (deptId != null) {
- queryParams.deptId = deptId
- }
- if (createTime) {
- queryParams.createTime = createTime
- }
- getList()
- })
- </script>
- <style scoped>
- /* 添加异常行高亮样式 */
- :deep(.exception-row) {
- background-color: #f29a90 !important;
- }
- :deep(.exception-row:hover) {
- background-color: #fff0e0 !important;
- }
- .reason-confirm-container {
- margin: 20px;
- }
- /* 调整文本框样式 */
- :deep(.el-textarea__inner) {
- font-size: 14px;
- }
- /* 调整表单项间距 */
- :deep(.el-form-item) {
- margin-bottom: 15px;
- }
- .stat-card {
- padding: 20px;
- border-radius: 10px;
- color: white;
- text-align: center;
- font-size: 14px;
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
- transition:
- transform 0.3s ease,
- box-shadow 0.3s ease;
- backdrop-filter: blur(12px);
- height: 200px;
- }
- .stat-card::before {
- position: absolute;
- filter: blur(20px);
- z-index: -1;
- }
- .stat-card:hover {
- transform: translateY(-4px);
- box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
- }
- .card-title {
- margin: 8px 0;
- font-size: 16px;
- }
- .card-value {
- font-size: 28px;
- font-weight: bold;
- margin: 8px 0;
- }
- .card-trend {
- font-size: 12px;
- opacity: 0.9;
- }
- /* 毛玻璃渐变背景 —— 不再使用 background-image */
- .bg-blue-gradient {
- background: linear-gradient(135deg, rgba(77, 147, 255, 0.5), rgba(75, 132, 254));
- }
- .bg-green-gradient {
- background: linear-gradient(135deg, rgba(101, 226, 136, 0.1), #52d7a2);
- background-color: rgba(76, 175, 80, 0.1);
- }
- .bg-orange-gradient {
- background: linear-gradient(135deg, rgba(152, 82, 4, 0.5), rgba(255, 152, 4, 0.6));
- }
- .bg-red-gradient {
- background: linear-gradient(135deg, rgba(232, 65, 51), rgba(252, 242, 236));
- }
- .bg-warn-gradient {
- background: linear-gradient(135deg, rgba(255, 201, 103), rgba(243, 162, 152));
- }
- /* 确保内容不溢出 */
- :deep(.el-row) {
- flex-wrap: wrap;
- }
- .text-truncate {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- ::v-deep .el-table__header-wrapper {
- position: sticky !important;
- width: 100%;
- top: 0px;
- z-index: 2000;
- }
- </style>
|