2025-08-05 18:18:30 +08:00
|
|
|
<template>
|
|
|
|
|
<!-- 基础页面 -->
|
|
|
|
|
<div class="app-container">
|
2025-09-13 17:57:48 +08:00
|
|
|
<el-form v-show="showSearch" :model="queryParams" ref="queryForm" size="small" inline @submit.native.prevent label-width="90px">
|
2025-10-11 11:19:20 +08:00
|
|
|
<el-form-item label="检验时间" prop="startTime">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="queryParams.startTime"
|
|
|
|
|
type="date"
|
|
|
|
|
placeholder="开始日期"
|
|
|
|
|
clearable
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
format="yyyy-MM-dd"
|
|
|
|
|
style="width: 130px"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="">-</el-form-item>
|
|
|
|
|
<el-form-item label="" prop="endTime">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="queryParams.endTime"
|
|
|
|
|
type="date"
|
|
|
|
|
placeholder="结束日期"
|
|
|
|
|
clearable
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
format="yyyy-MM-dd"
|
|
|
|
|
style="width: 130px"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
2025-09-19 14:57:33 +08:00
|
|
|
<el-form-item label="分公司" prop="impUnitName">
|
|
|
|
|
<el-select
|
2025-09-13 17:57:48 +08:00
|
|
|
v-model="queryParams.impUnitName"
|
2025-09-19 14:57:33 +08:00
|
|
|
placeholder="请选择分公司"
|
2025-08-05 18:18:30 +08:00
|
|
|
clearable
|
2025-09-19 14:57:33 +08:00
|
|
|
filterable
|
|
|
|
|
style="width: 240px"
|
|
|
|
|
@change="handleImpUnitChange"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in impUnitOptions"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
2025-08-05 18:18:30 +08:00
|
|
|
</el-form-item>
|
2025-09-13 17:57:48 +08:00
|
|
|
|
|
|
|
|
<el-form-item label="项目部" prop="departName">
|
2025-09-19 14:57:33 +08:00
|
|
|
<el-select
|
2025-09-13 17:57:48 +08:00
|
|
|
v-model="queryParams.departName"
|
2025-09-19 14:57:33 +08:00
|
|
|
placeholder="请选择项目部"
|
2025-09-13 17:57:48 +08:00
|
|
|
clearable
|
2025-09-19 14:57:33 +08:00
|
|
|
filterable
|
|
|
|
|
style="width: 240px"
|
|
|
|
|
@change="handleDepartChange"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in departOptions"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
2025-09-13 17:57:48 +08:00
|
|
|
</el-form-item>
|
|
|
|
|
|
2025-09-19 14:57:33 +08:00
|
|
|
|
2025-09-13 17:57:48 +08:00
|
|
|
<el-form-item label="工程" prop="proName">
|
2025-09-19 14:57:33 +08:00
|
|
|
<el-select
|
2025-09-13 17:57:48 +08:00
|
|
|
v-model="queryParams.proName"
|
2025-09-19 14:57:33 +08:00
|
|
|
placeholder="请选择工程"
|
2025-09-13 17:57:48 +08:00
|
|
|
clearable
|
2025-09-19 14:57:33 +08:00
|
|
|
filterable
|
|
|
|
|
style="width: 240px"
|
|
|
|
|
@change="getTeamListAndSubUnit"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in proOptions"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
2025-09-13 17:57:48 +08:00
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="分包单位" prop="subUnitName">
|
2025-09-19 14:57:33 +08:00
|
|
|
<el-select
|
2025-09-13 17:57:48 +08:00
|
|
|
v-model="queryParams.subUnitName"
|
2025-09-19 14:57:33 +08:00
|
|
|
placeholder="请选择分包单位"
|
2025-09-13 17:57:48 +08:00
|
|
|
clearable
|
2025-09-19 14:57:33 +08:00
|
|
|
filterable
|
|
|
|
|
style="width: 240px"
|
|
|
|
|
@change="getTeamList"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in subUnitOptions"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="班组名称" prop="teamName">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="queryParams.teamName"
|
|
|
|
|
placeholder="请选择班组"
|
|
|
|
|
clearable
|
|
|
|
|
filterable
|
|
|
|
|
style="width: 240px"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in teamOptions"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
2025-09-13 17:57:48 +08:00
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="物资状态" prop="status">
|
2025-08-05 18:18:30 +08:00
|
|
|
<el-select
|
|
|
|
|
v-model="queryParams.status"
|
|
|
|
|
placeholder="请选择状态"
|
|
|
|
|
clearable
|
2025-09-19 14:57:33 +08:00
|
|
|
style="width: 240px"
|
2025-08-05 18:18:30 +08:00
|
|
|
>
|
|
|
|
|
<el-option label="正常" value="0" />
|
|
|
|
|
<el-option label="1个月检测到期" value="2" />
|
|
|
|
|
<el-option label="3个月检测到期" value="1" />
|
|
|
|
|
<el-option label="已过期" value="3" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
2025-09-13 17:57:48 +08:00
|
|
|
|
2025-09-19 14:57:33 +08:00
|
|
|
<el-form-item label="物资名称" prop="typeName">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="queryParams.typeName"
|
|
|
|
|
placeholder="请选择物资名称"
|
2025-09-13 17:57:48 +08:00
|
|
|
clearable
|
2025-09-19 14:57:33 +08:00
|
|
|
filterable
|
|
|
|
|
style="width: 240px"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in materialNameList"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.label"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
2025-09-18 18:49:21 +08:00
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="关键字" prop="keyWord">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.keyWord"
|
|
|
|
|
placeholder="请输入关键字"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
|
style="width: 220px"
|
2025-09-13 17:57:48 +08:00
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
2025-08-05 18:18:30 +08:00
|
|
|
<!-- 表单按钮 -->
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
|
|
|
|
|
<el-button icon="el-icon-refresh" @click="handleReset">重置</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
2025-10-10 12:03:32 +08:00
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出数据</el-button>
|
|
|
|
|
</el-col>
|
2025-08-05 18:18:30 +08:00
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
2025-08-06 17:49:47 +08:00
|
|
|
<!-- 添加统计行 -->
|
|
|
|
|
<el-row type="flex" justify="end" :gutter="3" class="mb8 stat-row">
|
|
|
|
|
<el-col :span="3">
|
|
|
|
|
<div class="stat-item">已过期数量: <span class="status-expired">{{ expiredCount }}</span></div>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="3">
|
|
|
|
|
<div class="stat-item">临期1个月数量: <span class="status-one-month">{{ oneMonthCount }}</span></div>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="3">
|
|
|
|
|
<div class="stat-item">临期3个月数量: <span class="status-three-months">{{ threeMonthCount }}</span></div>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
2025-10-10 12:03:32 +08:00
|
|
|
<el-table :data="tableList" fit highlight-current-row style="width: 100%" :max-height="550">
|
2025-08-05 18:18:30 +08:00
|
|
|
<el-table-column
|
|
|
|
|
type="index"
|
|
|
|
|
width="55"
|
|
|
|
|
label="序号"
|
|
|
|
|
align="center"
|
|
|
|
|
:index="index => (queryParams.pageNum - 1) * queryParams.pageSize + index + 1"
|
|
|
|
|
/>
|
2025-09-13 17:57:48 +08:00
|
|
|
<el-table-column label="分公司" align="center" prop="impUnitName" :show-overflow-tooltip="true" />
|
|
|
|
|
<el-table-column label="项目部" align="center" prop="departName" :show-overflow-tooltip="true" />
|
2025-08-05 18:18:30 +08:00
|
|
|
<el-table-column label="工程名称" align="center" prop="proName" width="160" />
|
2025-09-13 17:57:48 +08:00
|
|
|
<el-table-column label="分包单位" align="center" prop="subUnitName" :show-overflow-tooltip="true" />
|
2025-08-05 18:18:30 +08:00
|
|
|
<el-table-column label="班组名称" align="center" prop="teamName" width="120" />
|
2025-10-10 12:03:32 +08:00
|
|
|
<el-table-column label="物资类型" align="center" prop="materialName" :show-overflow-tooltip="true" />
|
2025-09-13 17:57:48 +08:00
|
|
|
<el-table-column label="物资名称" align="center" prop="typeName" :show-overflow-tooltip="true" />
|
2025-08-05 18:18:30 +08:00
|
|
|
<el-table-column label="规格型号" align="center" prop="typeModelName" :show-overflow-tooltip="true" />
|
2025-10-10 12:03:32 +08:00
|
|
|
<el-table-column label="设备编号" align="center" prop="maCode" />
|
2025-08-05 18:18:30 +08:00
|
|
|
<el-table-column label="本次检验时间" align="center" prop="thisCheckTime" :show-overflow-tooltip="true" />
|
2025-10-10 12:03:32 +08:00
|
|
|
<el-table-column label="下次检验时间" align="center" prop="nextCheckTime" :show-overflow-tooltip="true" sortable width="125" />
|
|
|
|
|
<el-table-column label="二维码" align="center" prop="qrCode" :show-overflow-tooltip="true">
|
|
|
|
|
<template slot-scope="{ row }">
|
|
|
|
|
<span>
|
|
|
|
|
<el-button v-if="row.qrCode" type="text" size="mini" @click="handleSee(row)">查看</el-button>
|
|
|
|
|
<span v-else>未绑定</span>
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="状态" align="center">
|
2025-08-05 18:18:30 +08:00
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span :class="getStatusClass(scope.row.status)">{{ getStatusText(scope.row.status) }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2025-09-18 18:49:21 +08:00
|
|
|
<el-table-column label="检验报告" align="center" :show-overflow-tooltip="true">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span
|
|
|
|
|
style="color:#409EFF;cursor:pointer;"
|
|
|
|
|
@click="openReport(scope.row)"
|
|
|
|
|
>
|
|
|
|
|
{{ scope.row.reportCode }}
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
2025-08-05 18:18:30 +08:00
|
|
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
<!-- 分页 -->
|
|
|
|
|
<pagination
|
|
|
|
|
v-show="total > 0"
|
|
|
|
|
:total="total"
|
|
|
|
|
:page.sync="queryParams.pageNum"
|
|
|
|
|
:limit.sync="queryParams.pageSize"
|
|
|
|
|
@pagination="getList"
|
|
|
|
|
/>
|
|
|
|
|
|
2025-10-10 12:03:32 +08:00
|
|
|
<!-- 二维码 -->
|
|
|
|
|
<QRCodeView ref="qrCodeView" />
|
2025-08-05 18:18:30 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import TreeSelect from '@riophae/vue-treeselect'
|
|
|
|
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
2025-09-19 14:57:33 +08:00
|
|
|
import {getSafetyListApi,getSafeNumListApi,getAgreementIdApi,getImpUnitListApi, getDepartListByImpUnitApi, getProListByDepartApi,getTeamList, getSubUnitList } from '@/api/materialsStation'
|
2025-10-10 12:03:32 +08:00
|
|
|
import {getDeviceType} from "@/api/ma/device";
|
|
|
|
|
import QRCodeView from '@/components/QRCodeView'
|
|
|
|
|
import { formatTime } from '@/utils/bonus.js'
|
|
|
|
|
|
2025-08-05 18:18:30 +08:00
|
|
|
export default {
|
2025-10-10 12:03:32 +08:00
|
|
|
name: 'SafetyWarn',
|
|
|
|
|
components: { TreeSelect, QRCodeView },
|
2025-08-05 18:18:30 +08:00
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
showSearch: true,
|
|
|
|
|
queryParams: {
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
keyWord: '', // 关键字
|
2025-09-13 17:57:48 +08:00
|
|
|
status: '', // 规格型号
|
|
|
|
|
impUnitName: '', // 分公司
|
|
|
|
|
departName: '', // 项目部
|
|
|
|
|
proName: '', // 工程
|
|
|
|
|
subUnitName: '', // 分包单位
|
|
|
|
|
time: null, // 检验时间
|
|
|
|
|
teamName: '', // 班组名称
|
2025-09-19 14:57:33 +08:00
|
|
|
typeName: '', // 物资名称
|
2025-09-13 17:57:48 +08:00
|
|
|
startTime: '', // 开始时间
|
|
|
|
|
endTime: '' // 结束时间
|
2025-08-05 18:18:30 +08:00
|
|
|
},
|
|
|
|
|
total: 0, // 总条数
|
|
|
|
|
// 表格数据
|
2025-08-06 17:49:47 +08:00
|
|
|
tableList: [],
|
|
|
|
|
// 添加统计数据变量
|
|
|
|
|
expiredCount: 0,
|
|
|
|
|
oneMonthCount: 0,
|
2025-09-19 14:57:33 +08:00
|
|
|
threeMonthCount: 0,
|
|
|
|
|
impUnitOptions: [], // 分公司下拉
|
|
|
|
|
departOptions: [], // 项目部下拉
|
|
|
|
|
proOptions: [], // 工程下拉
|
|
|
|
|
subUnitOptions: [], // 分包单位下拉
|
|
|
|
|
materialNameList: [],
|
2025-10-10 12:03:32 +08:00
|
|
|
agreementIdList: []
|
2025-08-05 18:18:30 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
2025-09-19 14:57:33 +08:00
|
|
|
this.getImpUnitOptions()
|
|
|
|
|
this.handleImpUnitChange()
|
|
|
|
|
this.handleDepartChange()
|
|
|
|
|
this.getTeamList()
|
|
|
|
|
this.getSubUnitList()
|
|
|
|
|
this.getDeviceType()
|
2025-08-05 18:18:30 +08:00
|
|
|
this.getList()
|
2025-08-06 17:49:47 +08:00
|
|
|
this.getSafetyNum()
|
2025-08-05 18:18:30 +08:00
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
getStatusText(status) {
|
|
|
|
|
switch (status) {
|
|
|
|
|
case '0':
|
|
|
|
|
return '正常';
|
|
|
|
|
case '1':
|
|
|
|
|
return '3个月检测到期';
|
|
|
|
|
case '2':
|
|
|
|
|
return '1个月检测到期';
|
|
|
|
|
case '3':
|
|
|
|
|
return '已过期';
|
|
|
|
|
default:
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 根据状态值返回对应的 CSS 类名
|
|
|
|
|
getStatusClass(status) {
|
|
|
|
|
switch (status) {
|
|
|
|
|
case '0':
|
|
|
|
|
return 'status-normal';
|
|
|
|
|
case '1':
|
|
|
|
|
return 'status-three-months';
|
|
|
|
|
case '2':
|
|
|
|
|
return 'status-one-month';
|
|
|
|
|
case '3':
|
|
|
|
|
return 'status-expired';
|
|
|
|
|
default:
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2025-09-19 14:57:33 +08:00
|
|
|
getDeviceType() {
|
|
|
|
|
getDeviceType({ level: 3, skipPermission: 1 }).then(response => {
|
|
|
|
|
let matNameRes = response.data
|
|
|
|
|
this.materialNameList = matNameRes.map((item) => {
|
|
|
|
|
return {
|
|
|
|
|
label: item.typeName,
|
|
|
|
|
value: item.typeId
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/** 获取分公司下拉 */
|
|
|
|
|
async getImpUnitOptions() {
|
|
|
|
|
try {
|
|
|
|
|
const res = await getImpUnitListApi() // 调后台接口
|
|
|
|
|
this.impUnitOptions = res.data.map(item => ({
|
|
|
|
|
label: item.impUnitName, // 这里根据实际字段替换
|
|
|
|
|
value: item.impUnitName
|
|
|
|
|
}))
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('获取分公司下拉失败:', e)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/** 分公司选择变化,加载项目部 */
|
|
|
|
|
async handleImpUnitChange() {
|
|
|
|
|
this.queryParams.departName = null // 清空项目部已选
|
|
|
|
|
this.departOptions = [] // 清空原有下拉
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const params = {
|
|
|
|
|
impUnitName: this.queryParams.impUnitName, // 分公司名称
|
|
|
|
|
departName: this.queryParams.departName, // 项目部名称
|
|
|
|
|
proName: this.queryParams.proName,
|
|
|
|
|
teamName:this.queryParams.teamName,
|
|
|
|
|
subUnitName:this.queryParams.subUnitName,
|
|
|
|
|
}
|
|
|
|
|
const res = await getDepartListByImpUnitApi(params)
|
|
|
|
|
this.departOptions = res.data.map(item => ({
|
|
|
|
|
label: item.departName, // 项目部名称字段
|
|
|
|
|
value: item.departName
|
|
|
|
|
}))
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('获取项目部下拉失败:', e)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/** 项目部选择变化,加载工程 */
|
|
|
|
|
async handleDepartChange() {
|
|
|
|
|
this.queryParams.proName = null // 清空工程已选
|
|
|
|
|
this.proOptions = [] // 清空原有下拉
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// 同时传入分公司和项目部参数
|
|
|
|
|
const params = {
|
|
|
|
|
impUnitName: this.queryParams.impUnitName, // 分公司名称
|
|
|
|
|
departName: this.queryParams.departName, // 项目部名称
|
|
|
|
|
proName: this.queryParams.proName,
|
|
|
|
|
teamName:this.queryParams.teamName,
|
|
|
|
|
subUnitName:this.queryParams.subUnitName,
|
|
|
|
|
}
|
|
|
|
|
const res = await getProListByDepartApi(params)
|
|
|
|
|
this.proOptions = res.data.map(item => ({
|
|
|
|
|
label: item.proName, // 工程名称字段
|
|
|
|
|
value: item.proName
|
|
|
|
|
}))
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('获取工程下拉失败:', e)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/** 项目部选择变化,加载工程 */
|
|
|
|
|
async getTeamListAndSubUnit() {
|
|
|
|
|
this.queryParams.teamName = null // 清空工程已选
|
|
|
|
|
this.teamOptions = [] // 清空原有下拉
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// 同时传入分公司和项目部参数
|
|
|
|
|
const params = {
|
|
|
|
|
impUnitName: this.queryParams.impUnitName, // 分公司名称
|
|
|
|
|
departName: this.queryParams.departName, // 项目部名称
|
|
|
|
|
proName: this.queryParams.proName,
|
|
|
|
|
teamName:this.queryParams.teamName,
|
|
|
|
|
subUnitName:this.queryParams.subUnitName,
|
|
|
|
|
}
|
|
|
|
|
const res = await getTeamList(params)
|
|
|
|
|
this.teamOptions = res.data.map(item => ({
|
|
|
|
|
label: item.teamName, // 工程名称字段
|
|
|
|
|
value: item.teamName
|
|
|
|
|
}))
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('获取班组下拉失败:', e)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.queryParams.subUnitName = null // 清空工程已选
|
|
|
|
|
this.subUnitOptions = [] // 清空原有下拉
|
|
|
|
|
try {
|
|
|
|
|
// 同时传入分公司和项目部参数
|
|
|
|
|
const params = {
|
|
|
|
|
impUnitName: this.queryParams.impUnitName, // 分公司名称
|
|
|
|
|
departName: this.queryParams.departName, // 项目部名称
|
|
|
|
|
proName: this.queryParams.proName,
|
|
|
|
|
teamName:this.queryParams.teamName,
|
|
|
|
|
subUnitName:this.queryParams.subUnitName,
|
|
|
|
|
}
|
|
|
|
|
const res = await getSubUnitList(params)
|
|
|
|
|
this.subUnitOptions = res.data.map(item => ({
|
|
|
|
|
label: item.subUnitName,
|
|
|
|
|
value: item.subUnitName
|
|
|
|
|
}))
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('获取分包单位下拉失败:', e)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
async getTeamList() {
|
|
|
|
|
this.queryParams.teamName = null // 清空工程已选
|
|
|
|
|
this.teamOptions = [] // 清空原有下拉
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// 同时传入分公司和项目部参数
|
|
|
|
|
const params = {
|
|
|
|
|
impUnitName: this.queryParams.impUnitName, // 分公司名称
|
|
|
|
|
departName: this.queryParams.departName, // 项目部名称
|
|
|
|
|
proName: this.queryParams.proName,
|
|
|
|
|
teamName:this.queryParams.teamName,
|
|
|
|
|
subUnitName:this.queryParams.subUnitName,
|
|
|
|
|
}
|
|
|
|
|
const res = await getTeamList(params)
|
|
|
|
|
this.teamOptions = res.data.map(item => ({
|
|
|
|
|
label: item.teamName, // 工程名称字段
|
|
|
|
|
value: item.teamName
|
|
|
|
|
}))
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('获取班组下拉失败:', e)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
async getSubUnitList() {
|
|
|
|
|
this.queryParams.subUnitName = null // 清空工程已选
|
|
|
|
|
this.subUnitOptions = [] // 清空原有下拉
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// 同时传入分公司和项目部参数
|
|
|
|
|
const params = {
|
|
|
|
|
impUnitName: this.queryParams.impUnitName, // 分公司名称
|
|
|
|
|
departName: this.queryParams.departName, // 项目部名称
|
|
|
|
|
proName: this.queryParams.proName,
|
|
|
|
|
teamName:this.queryParams.teamName,
|
|
|
|
|
subUnitName:this.queryParams.subUnitName,
|
|
|
|
|
}
|
|
|
|
|
const res = await getSubUnitList(params)
|
|
|
|
|
this.subUnitOptions = res.data.map(item => ({
|
|
|
|
|
label: item.subUnitName,
|
|
|
|
|
value: item.subUnitName
|
|
|
|
|
}))
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('获取分包单位下拉失败:', e)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2025-08-05 18:18:30 +08:00
|
|
|
// 查询
|
2025-08-06 17:49:47 +08:00
|
|
|
async handleQuery() {
|
2025-08-05 18:18:30 +08:00
|
|
|
this.queryParams.pageNum = 1
|
2025-08-06 17:49:47 +08:00
|
|
|
await this.getList()
|
|
|
|
|
await this.getSafetyNum()
|
|
|
|
|
|
2025-08-05 18:18:30 +08:00
|
|
|
},
|
|
|
|
|
// 重置
|
2025-08-06 17:49:47 +08:00
|
|
|
async handleReset() {
|
2025-08-05 18:18:30 +08:00
|
|
|
this.queryParams.pageNum = 1
|
|
|
|
|
this.queryParams.pageSize = 10
|
|
|
|
|
this.$refs.queryForm.resetFields()
|
|
|
|
|
this.queryParams.keyWord = ''
|
|
|
|
|
this.queryParams.status = ''
|
2025-09-13 17:57:48 +08:00
|
|
|
this.queryParams.time = null
|
|
|
|
|
this.queryParams.startTime= ''
|
|
|
|
|
this.queryParams.endTime= ''
|
2025-09-19 14:57:33 +08:00
|
|
|
this.getImpUnitOptions()
|
|
|
|
|
this.handleImpUnitChange()
|
|
|
|
|
this.handleDepartChange()
|
2025-08-06 17:49:47 +08:00
|
|
|
await this.getList()
|
|
|
|
|
await this.getSafetyNum()
|
2025-08-05 18:18:30 +08:00
|
|
|
},
|
|
|
|
|
// 获取列表
|
|
|
|
|
async getList() {
|
|
|
|
|
console.log('列表-查询', this.queryParams)
|
|
|
|
|
const loading = this.$loading({ text: '加载中...' })
|
2025-10-10 12:03:32 +08:00
|
|
|
// this.queryParams.startTime = this.queryParams.time ? this.queryParams.time[0] : '';
|
|
|
|
|
// this.queryParams.endTime = this.queryParams.time? this.queryParams.time[1] : '';
|
2025-08-05 18:18:30 +08:00
|
|
|
try {
|
2025-08-06 17:49:47 +08:00
|
|
|
const resTemp = await getAgreementIdApi()
|
2025-10-10 12:03:32 +08:00
|
|
|
this.agreementIdList = resTemp.data
|
2025-08-06 17:49:47 +08:00
|
|
|
console.log("xxxxxhhhhhhhhhh",resTemp)
|
|
|
|
|
const params = { ...this.queryParams,agreementIdList:resTemp.data}
|
2025-08-05 18:18:30 +08:00
|
|
|
const res = await getSafetyListApi(params)
|
|
|
|
|
console.log('🚀 ~ 获取列表 ~ res:', res)
|
|
|
|
|
this.tableList = res.data.rows
|
|
|
|
|
this.total = res.data.total
|
|
|
|
|
loading.close()
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log('🚀 ~ 获取列表 ~ error:', error)
|
|
|
|
|
this.tableList = []
|
|
|
|
|
this.total = 0
|
|
|
|
|
loading.close()
|
|
|
|
|
}
|
|
|
|
|
},
|
2025-08-06 17:49:47 +08:00
|
|
|
// 获取列表
|
|
|
|
|
async getSafetyNum() {
|
2025-08-05 18:18:30 +08:00
|
|
|
|
2025-08-06 17:49:47 +08:00
|
|
|
try {
|
|
|
|
|
const resTemp = await getAgreementIdApi()
|
|
|
|
|
const params = { ...this.queryParams,agreementIdList:resTemp.data}
|
|
|
|
|
const res = await getSafeNumListApi(params)
|
|
|
|
|
console.log("yyyyyyy",res.data)
|
|
|
|
|
this.expiredCount = res.data.expiredNum
|
|
|
|
|
this.oneMonthCount = res.data.oneMonthNum
|
|
|
|
|
this.threeMonthCount = res.data.threeMonthNum
|
|
|
|
|
console.log("xxxxxxxx",res.data.expiredNum,this.expiredCount)
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log('🚀 ~ 获取列表 ~ error:', error)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
},
|
2025-09-18 18:49:21 +08:00
|
|
|
openReport(row) {
|
|
|
|
|
let reportUrl = row.reportUrl;
|
|
|
|
|
let pdfUrl = "";
|
|
|
|
|
if (/https?/i.test(reportUrl)) {
|
|
|
|
|
console.log("URL包含http/https");
|
|
|
|
|
pdfUrl = reportUrl;
|
|
|
|
|
} else {
|
|
|
|
|
console.log("URL不包含http/https");
|
|
|
|
|
pdfUrl = "http://sgwpdm.ah.sgcc.com.cn/iws/smw/filePath/" + reportUrl;
|
|
|
|
|
}
|
|
|
|
|
// 打开新窗口
|
|
|
|
|
window.open(pdfUrl, "_blank");
|
|
|
|
|
},
|
2025-10-10 12:03:32 +08:00
|
|
|
handleSee(row) {
|
|
|
|
|
this.$refs.qrCodeView.showQRCode(row.qrCode, row.maCode)
|
|
|
|
|
},
|
|
|
|
|
// 导出数据
|
|
|
|
|
handleExport() {
|
|
|
|
|
try {
|
|
|
|
|
let fileName = `安全工器具预警_${formatTime(new Date())}.xLsx`
|
|
|
|
|
let url = '/material/material_maMachine/exportSafeDetailsList'
|
|
|
|
|
const params = { ...this.queryParams, agreementIdList: this.agreementIdList }
|
|
|
|
|
console.log('🚀 ~ 导出 ~ params:', params)
|
|
|
|
|
this.download(url, params, fileName)
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log('导出数据失败', error)
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-08-05 18:18:30 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
// 定义不同状态的颜色样式
|
|
|
|
|
.status-normal {
|
|
|
|
|
color: #67C23A; // 绿色
|
|
|
|
|
}
|
|
|
|
|
.status-three-months {
|
|
|
|
|
color: #E6A23C; // 橙色
|
|
|
|
|
}
|
|
|
|
|
.status-one-month {
|
|
|
|
|
color: #F56C6C; // 红色
|
|
|
|
|
}
|
|
|
|
|
.status-expired {
|
|
|
|
|
color: #909399; // 灰色
|
|
|
|
|
}
|
2025-08-06 17:49:47 +08:00
|
|
|
// .stat-item {
|
|
|
|
|
// padding: 8px 16px;
|
|
|
|
|
// background-color: #f5f7fa;
|
|
|
|
|
// border-radius: 4px;
|
|
|
|
|
// display: inline-block;
|
|
|
|
|
// margin-right: 10px;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
.stat-row {
|
|
|
|
|
margin-bottom: 10px;
|
2025-09-18 18:49:21 +08:00
|
|
|
|
2025-08-06 17:49:47 +08:00
|
|
|
.stat-item {
|
|
|
|
|
background: #f5f7fa;
|
|
|
|
|
padding: 8px 16px;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
}
|
2025-09-18 18:49:21 +08:00
|
|
|
|
2025-08-06 17:49:47 +08:00
|
|
|
}
|
2025-09-18 18:49:21 +08:00
|
|
|
</style>
|