代码优化

This commit is contained in:
BianLzhaoMin 2026-01-23 16:32:23 +08:00
parent f0543680d8
commit 5fd2b135bb
9 changed files with 289 additions and 4 deletions

View File

@ -81,6 +81,8 @@
<el-table-column label="风速" prop="speed" align="center" />
<el-table-column label="噪声" prop="noise" align="center" />
<el-table-column label="空气质量" prop="kqzl" align="center" />
<el-table-column label="PM2.5" prop="pm1Data" align="center" />
<el-table-column label="PM10" prop="pm2Data" align="center" />
<el-table-column label="操作" align="center" width="140">
<template slot-scope="scope">
<el-button
@ -278,6 +280,20 @@
clearable
/>
</el-form-item>
<el-form-item label="PM2.5" prop="pm1Data">
<el-input
v-model="monitoringForm.pm1Data"
placeholder="请输入PM2.5"
clearable
/>
</el-form-item>
<el-form-item label="PM10" prop="pm2Data">
<el-input
v-model="monitoringForm.pm2Data"
placeholder="请输入PM10"
clearable
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -473,6 +489,72 @@
/>
</div>
</el-form-item>
<el-form-item label="PM2.5阈值" prop="pm1Range">
<div class="range-box">
<el-input-number
v-model="thresholdForm.pm1Min"
placeholder="最低值"
:precision="2"
:step="0.1"
style="width: 100%"
@change="
validateThresholdRange(
'pm1Min',
'pm1Max',
'pm1Range',
)
"
/>
<span class="range-split">-</span>
<el-input-number
v-model="thresholdForm.pm1Max"
placeholder="最高值"
:precision="2"
:step="0.1"
style="width: 100%"
@change="
validateThresholdRange(
'pm1Min',
'pm1Max',
'pm1Range',
)
"
/>
</div>
</el-form-item>
<el-form-item label="PM10阈值" prop="pm2Range">
<div class="range-box">
<el-input-number
v-model="thresholdForm.pm2Min"
placeholder="最低值"
:precision="2"
:step="0.1"
style="width: 100%"
@change="
validateThresholdRange(
'pm2Min',
'pm2Max',
'pm2Range',
)
"
/>
<span class="range-split">-</span>
<el-input-number
v-model="thresholdForm.pm2Max"
placeholder="最高值"
:precision="2"
:step="0.1"
style="width: 100%"
@change="
validateThresholdRange(
'pm2Min',
'pm2Max',
'pm2Range',
)
"
/>
</div>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -605,8 +687,24 @@ export default {
speed: '', //
noise: '', //
kqzl: '', //
pm1Data: '', // PM2.5
pm2Data: '', // PM10
},
monitoringRules: {
pm1Data: [
{
required: true,
message: '请输入PM10',
trigger: 'blur',
},
],
pm2Data: [
{
required: true,
message: '请输入PM2.5',
trigger: 'blur',
},
],
bidCode: [
{
required: true,
@ -673,6 +771,10 @@ export default {
noiseMax: null, //
kqzlMin: null, //
kqzlMax: null, //
pm1Min: null, // PM2.5
pm1Max: null, // PM2.5
pm2Min: null, // PM10
pm2Max: null, // PM10
},
thresholdRules: {},
@ -940,6 +1042,84 @@ export default {
trigger: ['blur', 'change'],
},
],
pm1Range: [
{
validator: (rule, value, callback) => {
const min = this.thresholdForm.pm1Min
const max = this.thresholdForm.pm1Max
if (
min === null ||
min === undefined ||
min === ''
) {
callback(new Error('PM2.5阈值的最小值不能为空'))
return
}
if (
max === null ||
max === undefined ||
max === ''
) {
callback(new Error('PM2.5阈值的最大值不能为空'))
return
}
const minNum = Number(min)
const maxNum = Number(max)
if (Number.isNaN(minNum) || Number.isNaN(maxNum)) {
callback(new Error('PM2.5阈值仅支持数字'))
return
}
if (minNum > maxNum) {
callback(
new Error(
'PM2.5阈值的最小值不能大于最大值',
),
)
return
}
callback()
},
trigger: ['blur', 'change'],
},
],
pm2Range: [
{
validator: (rule, value, callback) => {
const min = this.thresholdForm.pm2Min
const max = this.thresholdForm.pm2Max
if (
min === null ||
min === undefined ||
min === ''
) {
callback(new Error('PM10阈值的最小值不能为空'))
return
}
if (
max === null ||
max === undefined ||
max === ''
) {
callback(new Error('PM10阈值的最大值不能为空'))
return
}
const minNum = Number(min)
const maxNum = Number(max)
if (Number.isNaN(minNum) || Number.isNaN(maxNum)) {
callback(new Error('PM10阈值仅支持数字'))
return
}
if (minNum > maxNum) {
callback(
new Error('PM10阈值的最小值不能大于最大值'),
)
return
}
callback()
},
trigger: ['blur', 'change'],
},
],
}
},
@ -983,6 +1163,8 @@ export default {
speed: '',
noise: '',
kqzl: '',
pm1Data: '',
pm2Data: '',
}
this.$nextTick(() => {
if (this.$refs.monitoringFormRef) {
@ -1004,6 +1186,8 @@ export default {
speed: row.speed || '',
noise: row.noise || '',
kqzl: row.kqzl || '',
pm1Data: row.pm1Data || '',
pm2Data: row.pm2Data || '',
}
this.$nextTick(() => {
if (this.$refs.monitoringFormRef) {
@ -1153,6 +1337,14 @@ export default {
record.kqzlMin != null ? Number(record.kqzlMin) : null
this.thresholdForm.kqzlMax =
record.kqzlMax != null ? Number(record.kqzlMax) : null
this.thresholdForm.pm1Min =
record.pm1Min != null ? Number(record.pm1Min) : null
this.thresholdForm.pm1Max =
record.pm1Max != null ? Number(record.pm1Max) : null
this.thresholdForm.pm2Min =
record.pm2Min != null ? Number(record.pm2Min) : null
this.thresholdForm.pm2Max =
record.pm2Max != null ? Number(record.pm2Max) : null
} else {
//
this.thresholdId = ''
@ -1167,6 +1359,10 @@ export default {
noiseMax: null,
kqzlMin: null,
kqzlMax: null,
pm1Min: null,
pm1Max: null,
pm2Min: null,
pm2Max: null,
}
}
} catch (error) {
@ -1184,6 +1380,10 @@ export default {
noiseMax: null,
kqzlMin: null,
kqzlMax: null,
pm1Min: null,
pm1Max: null,
pm2Min: null,
pm2Max: null,
}
}
},
@ -1194,7 +1394,14 @@ export default {
if (!valid) return
this.thresholdSubmitting = true
try {
const payload = { ...this.thresholdForm }
// 线
const payload = {
...this.thresholdForm,
pm1Min: this.thresholdForm.pm1Min,
pm1Max: this.thresholdForm.pm1Max,
pm2Min: this.thresholdForm.pm2Min,
pm2Max: this.thresholdForm.pm2Max,
}
if (this.thresholdId) {
payload.id = this.thresholdId
}

View File

@ -35,6 +35,7 @@
width="60"
align="center"
/>
<el-table-column label="工程名称" prop="proName" align="center" />
<el-table-column label="提醒时间" prop="txTime" align="center" />
<el-table-column
label="提醒内容"
@ -164,6 +165,13 @@ export default {
content: '',
},
rules: {
bidCode: [
{
required: true,
message: '请选择工程名称',
trigger: 'change',
},
],
txTime: [
{
required: true,

View File

@ -404,6 +404,8 @@
>
<el-option label="已完成" value="已完成" />
<el-option label="未完成" value="未完成" />
<el-option label="进行中" value="未完成" />
<el-option label="延期" value="未完成" />
</el-select>
</el-form-item>
<el-form-item label="今日风险" prop="todayRisk">

View File

@ -27,13 +27,23 @@
<el-row>
<el-col :span="24">
<el-form-item label="工序类型" prop="gxType">
<el-input
<!-- <el-input
clearable
show-word-limit
:maxlength="50"
placeholder="请输入工程类型"
v-model.trim="addAndEditForm.gxType"
/>
/> -->
<el-select
clearable
style="width: 100%"
v-model="addAndEditForm.gxType"
placeholder="请选择工序"
>
<el-option label="土建" value="1" />
<el-option label="电器" value="2" />
</el-select>
</el-form-item>
</el-col>
</el-row>

View File

@ -64,6 +64,11 @@
</span>
</template>
<template v-else-if="column.prop === 'gxType'">
<span v-if="scope.row[column.prop] == 1"> 土建 </span>
<span v-else> 电器 </span>
</template>
<template v-else-if="column.prop === 'status'">
<span v-if="scope.row[column.prop] == 1"> 已完成 </span>
<span v-else> 未完成 </span>

View File

@ -136,6 +136,29 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="检测时间" prop="detectionTime">
<el-date-picker
type="datetime"
style="width: 100%"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择检测时间"
v-model="addAndEditForm.detectionTime"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否存在隐患" prop="puid">
<el-input
v-model.trim="addAndEditForm.puid"
placeholder="请输入隐患puid"
clearable
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="分析与改进" prop="analysis">
@ -190,6 +213,8 @@ export default {
isSafety: '否', //
analysis: '',
bidCode: '',
detectionTime: '',
puid: '',
},
addAndEditFormRules: {
bidCode: [
@ -255,6 +280,20 @@ export default {
trigger: 'blur',
},
],
detectionTime: [
{
required: true,
message: '请选择检测时间',
trigger: 'blur',
},
],
puid: [
{
required: true,
message: '请输入隐患puid',
trigger: 'blur',
},
],
},
projectList: [],
}
@ -453,6 +492,8 @@ export default {
isSafety,
analysis,
bidCode,
detectionTime,
puid,
} = newVal
this.addAndEditForm.bidCode = bidCode || ''
this.addAndEditForm.proName = proName || ''
@ -467,6 +508,8 @@ export default {
// 使
this.addAndEditForm.isSafety = isSafety || '否'
this.addAndEditForm.analysis = analysis || ''
this.addAndEditForm.detectionTime = detectionTime || ''
this.addAndEditForm.puid = puid || ''
//
this.$nextTick(() => {
this.checkSafetyStatus()

View File

@ -315,6 +315,7 @@ export default {
{ label: '作业地点', prop: 'workLocation' },
{ label: '监测点编号', prop: 'monitorCode' },
{ label: '监测点名称', prop: 'monitorName' },
{ label: '监测时间', prop: 'detectionTime' },
{ label: '温度', prop: 'wd' },
{ label: '湿度', prop: 'sd' },
{ label: '风速', prop: 'speed' },

View File

@ -212,7 +212,7 @@ export default {
workType: '',
name: '',
onTime: '',
onTime: new Date().toISOString().split('T')[0], //
},
}
},
@ -222,6 +222,12 @@ export default {
this.getResourceUseTeamList()
},
onHandleAddProject() {
//
if (!this.queryParams_1.onTime) {
this.$message.error('请选择到岗日期')
return
}
this.editId = null
this.getResourceUseNoDutyList()
this.addAndEditDialogVisible = true
@ -239,6 +245,7 @@ export default {
async getResourceUseNoDutyList() {
const res = await getResourceUseNoDutyListAPI({
teamId: this.detailsId,
onDutyTime: this.queryParams_1.onTime,
})
this.personList = res.data
},
@ -308,6 +315,7 @@ export default {
const res = await submitResourceUseOnDutyAPI({
ids: this.ids,
teamId: this.detailsId,
onDutyTime: this.queryParams_1.onTime,
})
if (res.code === 200) {
this.$message.success('提交成功')

View File

@ -786,6 +786,7 @@ export default {
this.reminderDialogTitle = '编辑'
this.reminderEditId = row.id
this.reminderForm = {
bidCode: row.bidCode || '',
txType: row.txType || '',
txTime: row.txTime || '',
content: row.content || '',