qa-regulatory-gwj-app/pages/safety-environmental-inspec.../initiate/detail.vue

1028 lines
39 KiB
Vue
Raw Normal View History

2023-11-07 10:08:37 +08:00
<template>
<view class="content">
<view class="card">
<u-cell-group :border="false">
<u-cell>
<view slot="title" class="title required">检查题目</view>
<view slot="value">
<u-radio-group v-model="form.inspectionSubject" placement="row" :disabled="disabled">
2023-11-07 10:08:37 +08:00
<u-radio label="安全" name="安全"></u-radio>
<u-radio label="环保" name="环保" class="ml-10"></u-radio>
<u-radio label="综合" name="综合" class="ml-10"></u-radio>
</u-radio-group>
</view>
</u-cell>
<u-cell>
<view slot="title" class="title required">被检查单位</view>
<view slot="value">
2024-10-10 10:14:31 +08:00
<text @click="showTree('tkitree')">
{{ disabled ? form.inspectedCorpName : form.inspectedDepartmentName || '请选择' }}
2024-10-10 10:14:31 +08:00
</text>
2023-11-07 10:08:37 +08:00
<tki-tree ref="tkitree" :range="inspectedDepartmentTreeList" rangeKey="name" selectParent
@confirm="confirmTree($event,'inspectedSiteuserColumns')"/>
</view>
</u-cell>
<u-cell v-show="form.inspectedDepartmentName">
2023-11-07 10:08:37 +08:00
<view slot="title" class="title required">被检查单位现场负责人</view>
<view slot="value">
2024-10-10 10:14:31 +08:00
<text @click="disabled ? null : inspectedSiteuserShow = true">{{
form.inspectedUserName || '请选择'
2024-10-10 10:14:31 +08:00
}}
</text>
2023-11-07 10:08:37 +08:00
<u-picker :show="inspectedSiteuserShow" :columns="inspectedSiteuserColumns" keyName="NAME"
@cancel="inspectedSiteuserShow = false"
@confirm="inspectedSiteuserConfirmPicker"></u-picker>
</view>
</u-cell>
<u-cell>
<view slot="title" class="title required">检查场所</view>
<view slot="value">
<u--input v-model="form.inspectionPlace" border="none" placeholder="请输入检查场所" inputAlign="right"
2023-11-07 10:08:37 +08:00
:disabled="disabled"></u--input>
</view>
</u-cell>
<u-cell>
<view slot="title" class="title required">检查类型</view>
<view slot="value">
<text @click="showTree('tkitree1')">{{ form.inspectionTypeName || '' }}</text>
2023-11-07 10:08:37 +08:00
<tki-tree ref="tkitree1" :range="inspectionTypeTreeList" rangeKey="name" selectParent children-name="nodes"
@confirm="confirmTree($event,'inspectionTypeTreeList')"/>
</view>
</u-cell>
<u-cell>
<view slot="title" class="title required">检查开始时间</view>
<view slot="value">
2024-10-10 10:14:31 +08:00
<text @click="disabled ? null : inspectionTimeStartShow = true">{{
form.inspectionTimeStart || '请选择'
2024-10-10 10:14:31 +08:00
}}
</text>
<u-datetime-picker :show="inspectionTimeStartShow" :value="form.inspectionTimeStart"
2023-11-07 10:08:37 +08:00
@cancel="inspectionTimeStartShow = false"
@confirm="inspectionTimeStartConfirm"></u-datetime-picker>
</view>
</u-cell>
<u-cell>
<view slot="title" class="title required">检查结束时间</view>
<view slot="value">
2024-10-10 10:14:31 +08:00
<text @click="disabled ? null : inspectionTimeEndShow = true">{{
form.inspectionTimeEnd || '请选择'
2024-10-10 10:14:31 +08:00
}}
</text>
<u-datetime-picker :show="inspectionTimeEndShow" :value="form.inspectionTimeEnd"
2023-11-07 10:08:37 +08:00
@cancel="inspectionTimeEndShow = false"
@confirm="inspectionTimeEndConfirm"></u-datetime-picker>
</view>
</u-cell>
<u-cell v-if="disabled">
<view slot="title" class="title required">记录填写时间</view>
<view slot="value">
<text>{{ form.creattime }}</text>
2023-11-07 10:08:37 +08:00
</view>
</u-cell>
<u-cell>
<view slot="title" class="title">检查情况</view>
<view slot="value">
2024-10-10 10:14:31 +08:00
<u-button type="primary" text="添加" size="mini" @click="addSituation"
2023-11-07 10:08:37 +08:00
v-if="!disabled"></u-button>
</view>
</u-cell>
2024-10-10 10:14:31 +08:00
<u-cell>
<view slot="label">
<view class="pr mt-10 textarea-box" v-for="(item,index) in form.situations" :key="item.id">
<u--textarea v-model="item.situation" placeholder="请输入检查情况" :disabled="disabled"></u--textarea>
2024-10-10 10:14:31 +08:00
<u-badge value="X" type="error" :offset="[-9,-10]" absolute
@click.native="removeSituation(item,index)" v-if="!disabled"></u-badge>
</view>
2023-11-07 10:08:37 +08:00
</view>
</u-cell>
<u-cell>
<view slot="title" class="title">检查人员</view>
<view slot="value">
2024-10-10 10:14:31 +08:00
<u-button type="primary" text="添加" size="mini" @click="addInspector"
2023-11-07 10:08:37 +08:00
v-if="!disabled"></u-button>
</view>
</u-cell>
2024-10-10 10:14:31 +08:00
<view class="title-none">
<u-cell>
<view slot="value" style="width: 100%">
<view class="pr mt-10" v-for="(item,index) in form.inspectionUsers" :key="item.id">
2024-10-10 10:14:31 +08:00
<u-cell-group :border="false" class="border">
<view class="title-show">
<u-cell>
<view slot="title">{{ index + 1 }}.检查人员单位</view>
<view slot="value">
<text @click="showTree('tkitreeInspector' + index,'arr')">
{{ item.inspectionDepartmentName || '请选择' }}
2024-10-10 10:14:31 +08:00
</text>
<tki-tree :ref="'tkitreeInspector' + index" :range="inspectedDepartmentTreeList"
2024-10-10 10:14:31 +08:00
rangeKey="name"
selectParent @confirm="confirmTree($event,'inspectionUsers',index)"/>
2024-10-10 10:14:31 +08:00
</view>
</u-cell>
2023-11-07 10:08:37 +08:00
</view>
2024-10-10 10:14:31 +08:00
<view class="title-show">
<u-cell :border="false" v-show="item.inspectionDepartmentName">
2024-10-10 10:14:31 +08:00
<view slot="title">{{ index + 1 }}.检查人员</view>
<view slot="value">
<text @click="inspectionUserShowPicker(index)">{{
item.inspectionUserName || '请选择'
2024-10-10 10:14:31 +08:00
}}
</text>
<u-picker :show="item.inspectionUserShow" :columns="[inspectionUsers[0][index]]" keyName="NAME"
2024-10-10 10:14:31 +08:00
@cancel="item.inspectionUserShow = false"
@confirm="inspectionUserConfirmPicker($event,index)"></u-picker>
</view>
</u-cell>
2023-11-07 10:08:37 +08:00
</view>
2024-10-10 10:14:31 +08:00
</u-cell-group>
<u-badge value="X" type="error" :offset="[-9,-10]" absolute
@click.native="removeInspector(item,index)" v-if="!disabled"></u-badge>
</view>
2023-11-07 10:08:37 +08:00
</view>
2024-10-10 10:14:31 +08:00
</u-cell>
</view>
2023-11-07 10:08:37 +08:00
<u-cell>
<view slot="title" class="title">发现问题</view>
<view slot="value">
2024-10-10 10:14:31 +08:00
<u-button type="primary" text="添加" size="mini" @click="addHidden"
2023-11-07 10:08:37 +08:00
v-if="!disabled"></u-button>
</view>
</u-cell>
2024-10-10 10:14:31 +08:00
<view class="title-none">
<u-cell>
2025-01-10 17:19:55 +08:00
<view slot="value" style="flex: 1">
2024-10-10 10:14:31 +08:00
<uni-table border stripe emptyText="暂无更多数据">
<uni-tr>
<uni-th align="center">序号</uni-th>
<uni-th align="center">隐患部位</uni-th>
<uni-th align="center">隐患描述</uni-th>
<uni-th align="center">操作</uni-th>
</uni-tr>
<uni-tr v-for="(item,index) in form.hiddenList" :key="item.hiddenId == null ? index : item.hiddenId">
2024-10-10 10:14:31 +08:00
<uni-td>{{ index + 1 }}</uni-td>
<uni-td>{{ item.hiddenPartStr ? item.hiddenPartStr : item.hiddenPart }}</uni-td>
<uni-td>{{ item.hiddendescr }}</uni-td>
2024-10-10 10:14:31 +08:00
<uni-td>
<view class="flex-between">
2025-01-10 17:46:20 +08:00
<u-icon name="eye-fill" @tap="showHidden(item, index)"></u-icon>
2024-10-10 10:14:31 +08:00
<view class="ml-10">
<u-icon name="trash-fill" @tap="removeHidden(item, index)"
2025-01-10 17:19:55 +08:00
v-if="!disabled"/>
2024-10-10 10:14:31 +08:00
</view>
</view>
</uni-td>
</uni-tr>
</uni-table>
2023-11-07 10:08:37 +08:00
</view>
</u-cell>
2024-10-10 10:14:31 +08:00
</view>
<template v-for="item in form.inspectionUsers" v-if="!type||!(type==='add' || type==='edit')">
<u-cell v-show="item.inspectionUserOpinion">
2024-10-10 10:14:31 +08:00
<template #title>
<view class="title">检查人意见</view>
</template>
<template #label>
<view class="mt-10 textarea-box">
<u--textarea v-model="item.inspectionUserOpinion" disabled
2024-10-10 10:14:31 +08:00
placeholder="请输入检查人意见"></u--textarea>
</view>
</template>
</u-cell>
<u-cell v-show="item.inspectionUserSignImg">
2023-11-07 10:08:37 +08:00
<view slot="title" class="title">签字</view>
2024-10-10 10:14:31 +08:00
<view slot="label" class="mt-10">
<u--image :showLoading="true" :src="$store.state.filePath + item.inspectionUserSignImg"
2023-11-07 10:08:37 +08:00
width="100%" height="80px" mode="scaleToFill"
@click="previewImage($store.state.filePath + item.inspectionUserSignImg)">
</u--image>
2023-11-07 10:08:37 +08:00
</view>
</u-cell>
</template>
<template v-if="!type||!(type==='add' || type==='edit')">
<u-cell v-show="form.inspectedSiteuserSignImg">
2023-11-07 10:08:37 +08:00
<view slot="title" class="title">被检查人意见</view>
</u-cell>
<u-cell v-show="form.inspectedSiteuserSignImg">
2023-11-07 10:08:37 +08:00
<view slot="title" class="title">签字</view>
2024-10-10 10:14:31 +08:00
<view slot="label" class="mt-10">
<u--image :showLoading="true" :src="$store.state.filePath + form.inspectedSiteuserSignImg"
2023-11-07 10:08:37 +08:00
width="100%" height="80px" mode="scaleToFill"
@click="previewImage($store.state.filePath + form.inspectedSiteuserSignImg)"></u--image>
2023-11-07 10:08:37 +08:00
</view>
</u-cell>
</template>
<template v-if="type&&(type==='add' || type==='edit')">
2024-10-10 10:14:31 +08:00
<u-cell>
2023-11-07 10:08:37 +08:00
<view slot="title" class="title">检查人意见</view>
2024-10-10 10:14:31 +08:00
<view slot="label" class="mt-10 textarea-box">
<u--textarea v-model="form.inspectionUserOpinion" placeholder="请输入检查人意见"></u--textarea>
2023-11-07 10:08:37 +08:00
</view>
</u-cell>
<u-cell v-if="form.inspectionUserOpinion">
2023-11-07 10:08:37 +08:00
<view slot="title" class="title flex-between">
签字
2024-08-28 16:29:32 +08:00
<view>
2024-10-10 10:14:31 +08:00
<u-button type="primary" text="手写添加" size="mini" @click="signShow = true"></u-button>
2024-08-28 16:29:32 +08:00
</view>
2023-11-07 10:08:37 +08:00
</view>
2024-10-10 10:14:31 +08:00
<view slot="label" class="mt-10">
2024-08-28 16:29:32 +08:00
<sign v-if="signShow" :signShow.sync="signShow" @confirm="signConfirm"></sign>
</view>
</u-cell>
<u-cell v-if="form.inspectionUserSignImg">
<view slot="value" class="mt-10 flex-1" v-show="form.inspectionUserSignImg">
<u--image v-show="form.inspectionUserSignImg" :showLoading="true" :src="form.inspectionUserSignImg"
2023-11-07 10:08:37 +08:00
width="100%" height="80px" mode="scaleToFill"
@click="previewImage(form.inspectionUserSignImg)">
</u--image>
2023-11-07 10:08:37 +08:00
</view>
</u-cell>
</template>
2024-10-10 10:14:31 +08:00
<u-cell :border="false">
<view slot="label">
2023-11-07 10:08:37 +08:00
<u-button type="primary" text="提交" @click="$u.debounce(fnSubmit, 1000,true)" v-if="!disabled"></u-button>
</view>
</u-cell>
</u-cell-group>
</view>
2024-10-16 09:25:19 +08:00
<u-popup :key="popupShow" :show="popupShow" @close="popupShow = false" mode="right" :closeOnClickOverlay="false"
2023-11-07 10:08:37 +08:00
:customStyle="{width:'85vw',overflowY:'auto'}">
<view class="card">
<u-cell-group :border="false">
2024-10-10 10:14:31 +08:00
<u-cell>
2023-11-07 10:08:37 +08:00
<view slot="title" class="title required">隐患照片</view>
2024-10-10 10:14:31 +08:00
<view slot="label" class="mt-10">
2023-11-07 10:08:37 +08:00
<u-upload
:disabled="popupDisabled"
:deletable="!popupDisabled"
uploadIcon="plus"
:fileList="hiddenForm.hiddenImgs"
@afterRead="afterRead"
@delete="deletePic"
multiple
:maxCount="popupDisabled?hiddenForm.hiddenImgs.length:4"
></u-upload>
</view>
</u-cell>
2024-10-10 10:14:31 +08:00
<u-cell v-if="!(popupDisabled && hiddenForm.hiddenVideos.length ===0)">
2023-11-07 10:08:37 +08:00
<view slot="title" class="title flex-between">
隐患视频
2024-10-10 10:14:31 +08:00
<u-icon v-if="hiddenForm.hiddenVideos.length !== 0 && hiddenForm.hiddenVideos[0].url"
name="play-circle-fill" size="30" @click="previewVideo(hiddenForm.hiddenVideos[0].url)"></u-icon>
2023-11-07 10:08:37 +08:00
</view>
2024-10-10 10:14:31 +08:00
<view slot="label" class="mt-10">
2023-11-07 10:08:37 +08:00
<u-upload
:disabled="popupDisabled"
:deletable="!popupDisabled"
accept="video"
uploadIcon="plus"
:fileList="hiddenForm.hiddenVideos"
@afterRead="afterRead1"
@delete="deletePic1"
multiple
:maxCount="1"
></u-upload>
<u-modal :show="modalShow" title="视频播放" confirmText="关闭" @confirm="modalShow = false">
<view>
<video v-if="modalShow" :src="videoUrl" :autoplay="true"></video>
</view>
</u-modal>
</view>
</u-cell>
2024-10-10 10:14:31 +08:00
<u-cell>
2023-11-07 10:08:37 +08:00
<view slot="title" class="title required">隐患描述</view>
2024-10-10 10:14:31 +08:00
<view slot="label" class="mt-10 textarea-box">
<u--textarea v-model="hiddenForm.hiddendescr" placeholder="请输入隐患描述"
2023-11-07 10:08:37 +08:00
:disabled="popupDisabled"></u--textarea>
</view>
</u-cell>
<u-cell>
<view slot="title" class="title">隐患部位</view>
<view slot="value">
2024-10-10 10:14:31 +08:00
<text @click="showTree('tkitree2')">
{{ hiddenForm.hiddenPartStr ? hiddenForm.hiddenPartStr : hiddenForm.hiddenPart || '请选择' }}
2024-10-10 10:14:31 +08:00
</text>
2023-11-07 10:08:37 +08:00
<tki-tree ref="tkitree2" :range="hiddenRegionTreeList" rangeKey="name" selectParent children-name="nodes"
@confirm="confirmTree($event,'hiddenRegionTreeList')"/>
</view>
</u-cell>
<u-cell>
<view slot="title" class="title required">隐患级别</view>
<view slot="value">
<text @click="showTree('tkitree3')">{{ hiddenForm.hiddenlevelName || '' }}</text>
2023-11-07 10:08:37 +08:00
<tki-tree ref="tkitree3" :range="hiddenLevelTreeList" rangeKey="name" selectParent children-name="nodes"
@confirm="confirmTree($event,'hiddenLevelTreeList')"/>
</view>
</u-cell>
<u-cell>
<view slot="title" class="title required">隐患类型</view>
<view slot="value">
<text @click="showTree('tkitree4')">{{ hiddenForm.hiddenTypeName || '' }}</text>
2023-11-07 10:08:37 +08:00
<tki-tree ref="tkitree4" :range="hiddenTypeTreeList" rangeKey="name" children-name="nodes"
@confirm="confirmTree($event,'hiddenTypeTreeList')"/>
</view>
</u-cell>
<u-cell>
<view slot="title" class="title required">是否是相关方</view>
<view slot="value">
<u-radio-group v-model="hiddenForm.isrelevant" placement="row" :disabled="disabled">
2023-11-07 10:08:37 +08:00
<u-radio label="是" name="1" class="ml-10"></u-radio>
<u-radio label="否" name="2" class="ml-10"></u-radio>
</u-radio-group>
</view>
</u-cell>
<u-cell>
<view slot="title" class="title required">隐患发现时间</view>
<view slot="value">
2024-10-10 10:14:31 +08:00
<text @click="popupDisabled ? null : discoveryTimeShow = true">{{
hiddenForm.discoverytime || '请选择'
2024-10-10 10:14:31 +08:00
}}
</text>
<u-datetime-picker :show="discoveryTimeShow" :value="hiddenForm.discoverytime" :minDate="Number(1970)"
2023-11-07 10:08:37 +08:00
@cancel="discoveryTimeShow = false"
@confirm="discoveryTimeConfirm"></u-datetime-picker>
</view>
</u-cell>
2024-10-10 10:14:31 +08:00
<u-cell>
2023-11-07 10:08:37 +08:00
<view slot="title" class="title flex-between">
隐患上报位置
2024-10-16 09:25:19 +08:00
<view>
<u-button type="primary" text="定位" size="mini" @click="showMapModal"
v-if="!popupDisabled"></u-button>
</view>
2023-11-07 10:08:37 +08:00
</view>
<view slot="label" class="mt-10" v-if="hiddenForm.longitude && hiddenForm.latitude">
<view>经度:{{ hiddenForm.longitude }}</view>
<view>纬度:{{ hiddenForm.latitude }}</view>
2023-11-07 10:08:37 +08:00
</view>
</u-cell>
2024-10-10 10:14:31 +08:00
<u-cell>
2023-11-07 10:08:37 +08:00
<view slot="title" class="title">隐患位置描述</view>
2024-10-10 10:14:31 +08:00
<view slot="label" class="mt-10 textarea-box">
<u--textarea v-model="hiddenForm.positiondesc" placeholder="请输入隐患位置描述"
2023-11-07 10:08:37 +08:00
:disabled="popupDisabled"></u--textarea>
</view>
</u-cell>
<u-cell>
<view slot="title" class="title required">隐患发现人</view>
<view slot="value">
<text @click="popupDisabled ? null : creatorShow = true">{{ hiddenForm.CREATOR_NAME || '请选择' }}</text>
<u-picker :show="creatorShow" :columns="creatorList" keyName="NAME"
@cancel="creatorShow = false"
@confirm="creatorConfirmPicker"></u-picker>
</view>
</u-cell>
2024-10-10 10:14:31 +08:00
<u-cell :border="false">
<view slot="label" class="flex-between">
<view class="flex1">
<u-button type="info" text="取消" @click="popupClose"></u-button>
</view>
<view class="flex1 ml-10">
<u-button type="primary" text="保存" @click="popupSave"
v-if="!popupDisabled"></u-button>
</view>
2023-11-07 10:08:37 +08:00
</view>
</u-cell>
</u-cell-group>
</view>
</u-popup>
</view>
</template>
<script>
import {
getDeptUser,
getHiddenRegion,
getHiddenType,
getInspectedDepartment,
getInspectionDepartment,
getInspectionType,
getInspectors,
getSafetyenvironmentalGoEdit,
setImgFilesAdd,
2024-10-10 10:14:31 +08:00
setSafetyenvironmentalAdd, setSafetyenvironmentalAdd_plus,
setSafetyenvironmentalEdit, setSafetyenvironmentalEdit_plus,
setVideoAdd
} from "@/api";
2023-11-07 10:08:37 +08:00
export default {
data() {
return {
form: {
inspectionSubject: '',
inspectedDepartmentName: '',
inspectedCorpName: '',
inspectedDepartmentId: '',
inspectedUserName: '',
inspectedSiteuserId: '',
inspectionPlace: '',
inspectionTypeName: '',
inspectionTimeStart: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
inspectionTimeEnd: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
situations: [{id: Math.random(), inspectionSituationId: '', situation: ''}],
inspectionUsers: [{
2023-11-07 10:08:37 +08:00
id: Math.random(),
inspectionUserShow: false,
inspectionInspectorId: '',
inspectionDepartmentId: '',
inspectionDepartmentName: '',
inspectionUserId: '',
inspectionUserName: ''
2023-11-07 10:08:37 +08:00
}],
hiddenList: [],
creattime: '',
inspectionUserOpinion: '',
inspectionUserSignImg: ''
2023-11-07 10:08:37 +08:00
},
rules: {
'inspectionSubject': {required: true, message: '请选择检查题目'},
'inspectedDepartmentName': {required: true, message: '请选择被检查单位'},
'inspectedUserName': {required: true, message: '请选择被检查单位现场负责人'},
'inspectionPlace': {required: true, message: '请输入检查场所'},
'inspectionTypeName': {required: true, message: '请选择检查类型'},
'inspectionTimeStart': {required: true, message: '请选择检查开始时间'},
'inspectionTimeEnd': {required: true, message: '请选择检查结束时间'},
2023-11-07 10:08:37 +08:00
},
inspectedDepartmentTreeList: [],
inspectionDepartmentTreeList: [],
inspectionTypeTreeList: [],
inspectedSiteuserShow: false,
inspectionTimeStartShow: false,
inspectionTimeEndShow: false,
inspectedSiteuserColumns: [
[]
],
inspectionUsers: [[]],
inspectionId: '',
2023-11-07 10:08:37 +08:00
vector: '',
disabled: false,
delSituations: [],
delInspectors: [],
popupShow: false,
popupDisabled: false,
hiddenForm: {
id: Math.random(),
isrelevant: '2',//是否相关方
2023-11-07 10:08:37 +08:00
hiddenImgs: [],
hiddenVideos: [],
hiddendescr: '',
hiddenPartStr: '',
hiddenPart: '',
hiddenlevelName: '',
hiddenlevel: '',
hiddenTypeName: '',
hiddenType: '',
discoverytime: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
longitude: '',
latitude: '',
2023-11-07 10:08:37 +08:00
CREATOR_NAME: '',
CREATOR: '',
positiondesc: '',
source: '4',
corpinfoId: '',
2023-11-07 10:08:37 +08:00
HIDDENFINDDEPT: ''
},
hiddenFormRules: {
'hiddenImgs': {required: true, message: '请上传隐患照片'},
'hiddendescr': {required: true, message: '请输入隐患描述'},
'hiddenlevelName': {required: true, message: '请选择隐患级别'},
'hiddenTypeName': {required: true, message: '请选择隐患类型'},
'discoverytime': {required: true, message: '请选择隐患发现时间'},
2023-11-07 10:08:37 +08:00
'CREATOR_NAME': {required: true, message: '请选择隐患发现人'},
},
hiddenRegionTreeList: [],
hiddenLevelTreeList: [
{id: 'hiddenLevel1004', name: '轻微隐患'},
{id: 'hiddenLevel1002', name: '一般隐患'},
],
hiddenTypeTreeList: [],
creatorList: [],
delHiddens: [],
delHiddenFiles: [],
discoveryTimeShow: false,
creatorShow: false,
modalShow: false,
videoUrl: '',
signShow: false,
type: ''
}
},
async onLoad(event) {
this.inspectionId = event.inspectionId
2023-11-07 10:08:37 +08:00
this.vector = event.vector
this.disabled = !(event.type === 'add' || event.type === 'edit');
if (this.inspectionId) {
2023-11-07 10:08:37 +08:00
await this.fnGetSafetyenvironmentalGoEdit()
}
this.type = event.type
2024-10-10 10:14:31 +08:00
if (event.type === 'add' || event.type === 'edit') {
2023-11-07 10:08:37 +08:00
await this.fnGetInspectedDepartment()
await this.fnGetInspectionDepartment()
await this.fnGetHiddenRegion()
await this.fnGetHiddenType()
await this.fnGetInspectionType()
}
},
computed: {
userInfo() {
return this.$store.getters.getUserInfo
}
},
methods: {
async fnGetInspectedDepartment() {
2025-01-10 17:46:20 +08:00
let resData = await getInspectedDepartment({'CORPINFO_ID': ''});
2023-11-07 10:08:37 +08:00
this.inspectedDepartmentTreeList = JSON.parse(resData.zTreeNodes);
},
async fnGetInspectionDepartment() {
let resData = await getInspectionDepartment();
this.inspectionDepartmentTreeList = JSON.parse(resData.zTreeNodes);
},
async fnGetHiddenRegion(id) {
2024-10-10 10:14:31 +08:00
if (!id) {
id = {parentId: '0', DEPARTMENT_ID: this.form.inspectedDepartmentId}
2023-11-07 10:08:37 +08:00
}
let { data } = await getHiddenRegion(id);
this.hiddenRegionTreeList = data;
2023-11-07 10:08:37 +08:00
},
async fnGetHiddenType() {
let resData = await getHiddenType();
this.hiddenTypeTreeList = JSON.parse(resData.zTreeNodes);
},
async fnGetInspectionType() {
let resData = await getInspectionType();
this.inspectionTypeTreeList = JSON.parse(resData.zTreeNodes);
},
async fnGetDeptUser(detpId) {
let resData = await getDeptUser({'DEPARTMENT_ID': detpId});
return resData.userList;
},
async fnGetInspectors(detpId) {
let resData = await getInspectors({'DEPARTMENT_ID': detpId});
return resData.userList;
},
async fnGetSafetyenvironmentalGoEdit() {
const { data } = await getSafetyenvironmentalGoEdit({ id: this.inspectionId });
this.form.situations = data.situations.map((item) => {
return {
situation: item,
id: Math.random(),
};
});
this.form = data;
2023-11-07 10:08:37 +08:00
},
showTree(ref, type) {
if (this.popupDisabled) return;
if (this.disabled) return;
if (type === 'arr') this.$refs[ref][0]._show();
else this.$refs[ref]._show()
},
confirmTree(e, list, index) {
if (list === 'inspectedSiteuserColumns') {
this.form.inspectedDepartmentId = e[0].id
this.form.inspectedDepartmentName = e[0].name
this.form.inspectedUserName = ''
this.form.inspectedSiteuserId = ''
2024-10-10 10:14:31 +08:00
this.fnGetHiddenRegion({parentId: '0', DEPARTMENT_ID: e[0].id})
2023-11-07 10:08:37 +08:00
this.fnGetDeptUser(e[0].id).then(res => {
this.$set(this.inspectedSiteuserColumns, 0, res)
})
}
if (list === 'inspectionTypeTreeList') {
this.form.inspectionType = e[0].id
this.form.inspectionTypeName = e[0].name
2023-11-07 10:08:37 +08:00
}
if (list === 'inspectionUsers') {
this.form.inspectionUsers[index].inspectionDepartmentId = e[0].id
this.form.inspectionUsers[index].inspectionDepartmentName = e[0].name
this.form.inspectionUsers[index].inspectionUserName = ''
this.form.inspectionUsers[index].inspectionUserId = ''
2023-11-07 10:08:37 +08:00
this.fnGetInspectors(e[0].id).then(res => {
this.$set(this.inspectionUsers[0], index, res)
2023-11-07 10:08:37 +08:00
})
}
if (list === 'hiddenRegionTreeList') {
this.hiddenForm.hiddenPart = e[0].id
this.hiddenForm.hiddenPartStr = e[0].name
2023-11-07 10:08:37 +08:00
}
if (list === 'hiddenLevelTreeList') {
this.hiddenForm.HIDDENLEVEL = e[0].id
this.hiddenForm.hiddenlevelName = e[0].name
2023-11-07 10:08:37 +08:00
}
if (list === 'hiddenTypeTreeList') {
this.hiddenForm.HIDDENTYPE = e[0].id
this.hiddenForm.hiddenTypeName = e[0].name
2023-11-07 10:08:37 +08:00
}
},
inspectedSiteuserConfirmPicker(e) {
this.form.inspectedUserName = e.value[0].NAME
this.form.inspectedSiteuserId = e.value[0].USER_ID
2023-11-07 10:08:37 +08:00
this.inspectedSiteuserShow = false;
},
inspectionTimeStartConfirm(e) {
this.form.inspectionTimeStart = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM')
2023-11-07 10:08:37 +08:00
this.inspectionTimeStartShow = false;
},
inspectionTimeEndConfirm(e) {
this.form.inspectionTimeEnd = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM')
2023-11-07 10:08:37 +08:00
this.inspectionTimeEndShow = false;
},
addSituation() {
this.form.situations.push({id: Math.random(), inspectionSituationId: '', situation: ''})
2023-11-07 10:08:37 +08:00
},
removeSituation(item, index) {
uni.showModal({
title: '提示',
cancelText: '确认',
confirmText: '取消',
content: '确定删除检查情况吗?',
success: (res) => {
if (res.cancel) {
this.form.situations.splice(index, 1)
if (item.inspectionSituationId) {
this.delSituations.push(item.inspectionSituationId)
2023-11-07 10:08:37 +08:00
}
}
}
});
},
addInspector() {
this.form.inspectionUsers.push(
2024-10-10 10:14:31 +08:00
{
2023-11-07 10:08:37 +08:00
id: Math.random(),
inspectionUserShow: false,
inspectionInspectorId: '',
inspectionDepartmentId: '',
inspectionDepartmentName: '',
inspectionUserId: '',
inspectionUserName: ''
2024-10-10 10:14:31 +08:00
}
2023-11-07 10:08:37 +08:00
)
},
removeInspector(item, index) {
uni.showModal({
title: '提示',
cancelText: '确认',
confirmText: '取消',
content: '确定移除检查人员吗?',
success: (res) => {
if (res.cancel) {
this.form.inspectionUsers.splice(index, 1);
if (item.inspectionInspectorId) {
this.delInspectors.push(item.inspectionInspectorId)
2023-11-07 10:08:37 +08:00
}
}
}
});
},
inspectionUserShowPicker(index) {
if (this.disabled) return;
this.form.inspectionUsers[index].inspectionUserShow = true
2023-11-07 10:08:37 +08:00
},
inspectionUserConfirmPicker(e, index) {
this.form.inspectionUsers[index].inspectionUserId = e.value[0].USER_ID
this.form.inspectionUsers[index].inspectionUserName = e.value[0].NAME
this.form.inspectionUsers[index].inspectionUserShow = false
2023-11-07 10:08:37 +08:00
},
async fnSubmit() {
for (const key in this.rules) {
2024-10-10 10:14:31 +08:00
if (!this.form[key]) {
2023-11-07 10:08:37 +08:00
uni.showToast({
title: this.rules[key].message,
icon: "none"
})
return;
}
}
for (let i = 0; i < this.form.situations.length; i++) {
if (!this.form.situations[i].situation) {
2023-11-07 10:08:37 +08:00
uni.showToast({
title: `请填写第${i + 1}项检查情况`,
icon: 'none'
})
return
}
}
for (let i = 0; i < this.form.inspectionUsers.length; i++) {
if (!this.form.inspectionUsers[i].inspectionUserName) {
2023-11-07 10:08:37 +08:00
uni.showToast({
title: `请选择第${i + 1}项检查人员`,
icon: 'none'
})
return
}
}
if (this.form.inspectionUserOpinion) {
if (!this.form.inspectionUserSignImg) {
2023-11-07 10:08:37 +08:00
uni.showToast({
title: `您还未签字`,
icon: 'none'
})
return
}
}
let vector = 0
for (let x in this.form.inspectionUsers) {
2023-11-07 10:08:37 +08:00
vector = 0
for (let y in this.form.inspectionUsers) {
if (this.form.inspectionUsers[y].inspectionUserId === this.form.inspectionUsers[x].inspectionUserId) vector++
2023-11-07 10:08:37 +08:00
}
2024-10-10 10:14:31 +08:00
if (vector > 1) {
2023-11-07 10:08:37 +08:00
uni.showToast({
title: '检查人重复!请检查数据',
icon: "none"
})
return
}
}
let index = this.form.inspectionUsers.findIndex(item => {
return item.inspectionUserId === this.userInfo.USER_ID
2024-10-10 10:14:31 +08:00
})
2023-11-07 10:08:37 +08:00
if (index < 0) {
this.form.inspectionUsers.push(
2023-11-07 10:08:37 +08:00
{
inspectionInspectorId: '', //检查人员主键
inspectionDepartmentId: this.userInfo.DEPARTMENT_ID, //检查人员部门ID
inspectionDepartmentName: this.userInfo.DEPARTMENT_NAME,
inspectionUserId: this.userInfo.USER_ID, //检查人员ID
inspectionUserName: this.userInfo.NAME
2023-11-07 10:08:37 +08:00
}
)
}
let hiddenIds;
if (this.form.inspectionUserSignImg) {
let params = {
filePath: this.form.inspectionUserSignImg,
name: 'file',
2023-11-07 10:08:37 +08:00
formData: {
inspectionId: this.inspectionId,
inspectionSubject: this.form.inspectionSubject,
inspectedDepartmentId: this.form.inspectedDepartmentId,
inspectedSiteuserId: this.form.inspectedSiteuserId,
inspectionPlace: this.form.inspectionPlace,
inspectionUserOpinion: this.form.inspectionUserOpinion,
inspectionType: this.form.inspectionType,
inspectionTimeStart: this.form.inspectionTimeStart,
inspectionTimeEnd: this.form.inspectionTimeEnd,
inspectionUsers: this.form.inspectionUsers,
situation: this.form.situations.map((item) => item.situation),
hiddenList: this.form.hiddenList.map((item) => ({
...item,
hiddenImgs: null,
hiddenVideos: null,
})),
inspectionStatus: '1',
deleteHiddenIds: this.delHiddens,
}
2023-11-07 10:08:37 +08:00
}
const { data } = this.inspectionId ? await setSafetyenvironmentalEdit_plus(params) : await setSafetyenvironmentalAdd_plus(params);
hiddenIds = data;
2024-10-10 10:14:31 +08:00
} else {
2023-11-07 10:08:37 +08:00
let params = {
inspectionId: this.inspectionId,
inspectionSubject: this.form.inspectionSubject,
inspectedDepartmentId: this.form.inspectedDepartmentId,
inspectedSiteuserId: this.form.inspectedSiteuserId,
inspectionPlace: this.form.inspectionPlace,
inspectionUserOpinion: this.form.inspectionUserOpinion,
inspectionType: this.form.inspectionType,
inspectionTimeStart: this.form.inspectionTimeStart,
inspectionTimeEnd: this.form.inspectionTimeEnd,
inspectionUsers: this.form.inspectionUsers,
situation: this.form.situations.map((item) => item.situation),
hiddenList: this.form.hiddenList.map((item) => ({
...item,
hiddenImgs: null,
hiddenVideos: null,
})),
inspectionStatus: '1',
deleteHiddenIds: this.delHiddens,
2023-11-07 10:08:37 +08:00
}
const { data } = this.inspectionId ? await setSafetyenvironmentalEdit(params) : await setSafetyenvironmentalAdd(params);
hiddenIds = data;
2023-11-07 10:08:37 +08:00
}
let PromiseArr = []
for (let i = 0; i < hiddenIds.length; i++) {
2023-11-07 10:08:37 +08:00
for (let j = 0; j < this.form.hiddenList[i].hiddenImgs.length; j++) {
let imgFiles = []
imgFiles.push({
uri: this.form.hiddenList[i].hiddenImgs[j].url,
FFILE: this.form.hiddenList[i].hiddenImgs[j].url,
})
PromiseArr.push(this.fnSetImgFilesAdd(imgFiles, hiddenIds[i]))
2023-11-07 10:08:37 +08:00
}
for (let j = 0; j < this.form.hiddenList[i].hiddenVideos.length; j++) {
PromiseArr.push(this.fnSetVideoAdd(this.form.hiddenList[i].hiddenVideos[j].url, hiddenIds[i]))
2023-11-07 10:08:37 +08:00
}
}
Promise.all(PromiseArr).then(() => {
uni.showToast({
title: this.inspectionId ? '修改成功' : '添加成功',
2023-11-07 10:08:37 +08:00
})
2024-10-10 10:14:31 +08:00
if (this.vector !== 'list') {
2023-11-07 10:08:37 +08:00
uni.$u.route({
type: 'navigateBack'
})
2024-10-10 10:14:31 +08:00
} else {
2023-11-07 10:08:37 +08:00
uni.$u.route({
type: 'navigateBack',
2024-10-10 10:14:31 +08:00
delta: 2
2023-11-07 10:08:37 +08:00
})
}
}).catch((e) => {
uni.showToast({
title: '添加失败!',
icon: 'error',
duration: 2000
});
})
},
async fnSetImgFilesAdd(imgFiles, FOREIGN_KEY) {
if (imgFiles[0].uri.indexOf('qgqy.qhdsafety.com') > 0) {
return await function () {
console.log('ok')
}
}
return await setImgFilesAdd({
files: imgFiles,
2023-11-07 10:08:37 +08:00
formData: {
FOREIGN_KEY,
TYPE: '3'
2023-11-07 10:08:37 +08:00
},
loading: false
2023-11-07 10:08:37 +08:00
})
},
async fnSetVideoAdd(filePath, FOREIGN_KEY) {
if (filePath && filePath.indexOf('qgqy.qhdsafety.com') > 0) {
return await function () {
console.log('ok')
}
}
return await setVideoAdd({
filePath,
name: 'FFILE',
2023-11-07 10:08:37 +08:00
formData: {
FOREIGN_KEY,
TYPE: 102,
CORPINFO_ID: this.userInfo.CORPINFO_ID,
2023-11-07 10:08:37 +08:00
},
2024-10-10 10:14:31 +08:00
loading: false
2023-11-07 10:08:37 +08:00
})
},
addHidden() {
this.clearHiddenForm()
this.creatorList = [[{NAME: this.userInfo.NAME, USER_ID: this.userInfo.USER_ID}]]
this.form.inspectionUsers.forEach(item => {
let index = this.creatorList[0].findIndex(items => items.USER_ID === item.inspectionUserId)
2023-11-07 10:08:37 +08:00
if (index < 0) {
this.creatorList[0].push({
USER_ID: item.inspectionUserId,
NAME: item.inspectionUserName,
DEPARTMENT_ID: item.inspectionDepartmentId
2023-11-07 10:08:37 +08:00
})
}
})
this.popupShow = true
this.popupDisabled = false
},
showHidden(item) {
this.clearHiddenForm()
this.creatorList = [[]]
this.form.inspectionUsers.forEach(item => {
2024-10-10 10:14:31 +08:00
this.creatorList[0].push({
USER_ID: item.inspectionUserId,
NAME: item.inspectionUserName,
DEPARTMENT_ID: item.inspectionDepartmentId
2024-10-10 10:14:31 +08:00
})
2023-11-07 10:08:37 +08:00
})
this.hiddenForm = item
this.popupShow = true
this.popupDisabled = true
},
clearHiddenForm() {
this.hiddenForm = {
id: Math.random(),
isrelevant: '2',//隐患类型
2023-11-07 10:08:37 +08:00
hiddenImgs: [],
hiddenVideos: [],
hiddendescr: '',
hiddenPartStr: '',
hiddenPart: '',
hiddenlevelName: '',
hiddenlevel: '',
hiddenTypeName: '',
hiddenType: '',
discoverytime: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
longitude: '',
latitude: '',
2023-11-07 10:08:37 +08:00
CREATOR_NAME: '',
CREATOR: '',
positiondesc: '',
source: '4'
2023-11-07 10:08:37 +08:00
}
},
removeHidden(item, index) {
uni.showModal({
title: '提示',
cancelText: '确认',
confirmText: '取消',
content: '确定移除发现问题吗?',
success: (res) => {
if (res.cancel) {
this.form.hiddenList.splice(index, 1);
if (item.hiddenId) {
this.delHiddens.push(item.hiddenId)
2023-11-07 10:08:37 +08:00
}
}
}
});
},
afterRead(event) {
this.hiddenForm.hiddenImgs = [...this.hiddenForm.hiddenImgs, ...event.file]
},
deletePic(event) {
if (this.hiddenForm.hiddenImgs[event.index].IMGFILES_ID) {
this.delHiddenFiles.push(this.hiddenForm.hiddenImgs[event.index].FILEPATH)
}
this.hiddenForm.hiddenImgs = this.hiddenForm.hiddenImgs.filter(item => item.url !== event.file.url)
},
afterRead1(event) {
this.hiddenForm.hiddenVideos = [...this.hiddenForm.hiddenVideos, ...event.file]
},
deletePic1(event) {
this.hiddenForm.hiddenVideos = this.hiddenForm.hiddenVideos.filter(item => item.url !== event.file.url)
},
discoveryTimeConfirm(e) {
this.hiddenForm.discoverytime = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM')
2023-11-07 10:08:37 +08:00
this.discoveryTimeShow = false;
},
showMapModal() {
let _this = this
uni.navigateTo({
url: '/pages/map/map',
events: {
acceptDataFromOpenedPage: function (e) {
_this.hiddenForm.longitude = e.data.longitue;
_this.hiddenForm.latitude = e.data.latitude;
2023-11-07 10:08:37 +08:00
}
},
2024-10-10 10:14:31 +08:00
success: function (res) {
res.eventChannel.emit('acceptDataFromOpenerPage', {data: {title: '安全环保检查发起'}})
2023-11-07 10:08:37 +08:00
}
})
},
creatorConfirmPicker(e) {
this.hiddenForm.CREATOR = e.value[0].USER_ID
this.hiddenForm.CREATOR_NAME = e.value[0].NAME
this.hiddenForm.HIDDENFINDDEPT = e.value[0].DEPARTMENT_ID
this.creatorShow = false;
},
popupClose() {
this.popupShow = false
},
popupSave() {
for (const key in this.hiddenFormRules) {
2024-10-10 10:14:31 +08:00
if (!this.hiddenForm[key]) {
2023-11-07 10:08:37 +08:00
uni.showToast({
title: this.hiddenFormRules[key].message,
icon: "none"
})
return;
}
}
this.hiddenForm.SOURCE = 4
this.form.hiddenList.push(this.hiddenForm)
this.popupClose()
},
previewImage(current) {
2024-10-10 10:14:31 +08:00
if (false) {
2023-11-07 10:08:37 +08:00
uni.previewImage({
urls: [current],
current
});
}
},
2024-10-10 10:14:31 +08:00
previewVideo(videoUrl) {
2023-11-07 10:08:37 +08:00
this.modalShow = true;
this.videoUrl = videoUrl;
},
2024-10-10 10:14:31 +08:00
signConfirm({path}) {
this.form.inspectionUserSignImg = path
2023-11-07 10:08:37 +08:00
},
},
}
</script>
2024-08-28 16:29:32 +08:00
<style scoped>
.flex-1 {
flex: 1;
}
2024-10-10 10:14:31 +08:00
2024-08-29 08:35:29 +08:00
.title {
2025-01-10 17:46:20 +08:00
min-width: 170rpx;
2024-08-29 08:35:29 +08:00
}
2024-10-10 10:14:31 +08:00
2024-08-29 08:35:29 +08:00
.textarea-box {
width: 100%;
}
2023-11-07 10:08:37 +08:00
</style>