qa-regulatory-gwj-app/pages/key-project-management/safety-environmental-inspec.../detail.vue

817 lines
32 KiB
Vue
Raw Permalink 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.INSPECTION_CATEGORY" placement="row" :disabled="disabled">
<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">
<text @click="showTree('tkitree')">{{ form.UNITS_NAME || '' }}</text>
<tki-tree ref="tkitree" :range="inspectedDepartmentTreeList" rangeKey="UNITS_NAME" selectParent
@confirm="confirmTree($event,'inspectedSiteuserColumns')"/>
</view>
</u-cell>
<u-cell v-show="form.UNITS_NAME">
<view slot="title" class="title required">被检查单位现场负责人</view>
<view slot="value">
<text @click="disabled ? null : inspectedSiteuserShow = true">{{ form.PERSON_NAME || '请选择' }}</text>
<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.INSPECTION_PLACE" border="none" placeholder="请输入检查场所" inputAlign="right"
:disabled="disabled"></u--input>
</view>
</u-cell>
<u-cell>
<view slot="title" class="title required">检查类型</view>
<view slot="value">
<text @click="showTree('tkitree1')">{{ form.INSPECTION_TYPE_NAME || '' }}</text>
<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.INSPECTION_TIME_START || '请选择'
}}
</text>
2023-11-07 10:08:37 +08:00
<u-datetime-picker :show="inspectionTimeStartShow" :value="form.INSPECTION_TIME_START"
:minDate="Number(1970)"
@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.INSPECTION_TIME_END || '请选择'
}}
</text>
2023-11-07 10:08:37 +08:00
<u-datetime-picker :show="inspectionTimeEndShow" :value="form.INSPECTION_TIME_END"
:minDate="Number(1970)"
@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">
2024-10-10 10:14:31 +08:00
<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" style="width: 100%">
2023-11-07 10:08:37 +08:00
<view class="pr mt-10" v-for="(item,index) in form.situationList" :key="item.id">
<u--textarea v-model="item.SITUATION" placeholder="请输入检查情况" :disabled="disabled"></u--textarea>
<u-badge value="X" type="error" :offset="[-9,-10]" absolute
@click.native="removeSituation(item,index)" v-if="!disabled && index !== 0"></u-badge>
</view>
</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">
2024-10-16 09:25:19 +08:00
<!-- <view>{{ form.INSPECTION_USERS }}</view>-->
2024-10-10 10:14:31 +08:00
<u--textarea v-model="form.INSPECTION_USERS" placeholder="请输入检查人员"
:disabled="disabled"></u--textarea>
2023-11-07 10:08:37 +08:00
</view>
</u-cell>
<u-cell>
<view slot="title" class="title">发现问题</view>
<view slot="value">
<u-button type="primary" text="添加" size="mini" class="bth-mini" @click="addHidden"
v-if="!disabled"></u-button>
</view>
</u-cell>
<u-cell class="title-none">
2024-07-27 15:46:35 +08:00
<view slot="value" style="width: 100%">
2023-11-07 10:08:37 +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>
2024-08-29 08:35:29 +08:00
<uni-tr v-for="(item,index) in form.hiddenList" :key="item.id">
2023-11-07 10:08:37 +08:00
<uni-td>{{ index + 1 }}</uni-td>
<uni-td>{{ item.HIDDENPART }}</uni-td>
<uni-td>{{ item.HIDDENDESCR }}</uni-td>
<uni-td>
<view class="flex-between">
<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)"
v-if="!disabled"></u-icon>
</view>
2023-11-07 10:08:37 +08:00
</view>
</uni-td>
</uni-tr>
</uni-table>
</view>
</u-cell>
2024-10-10 10:14:31 +08:00
<u-cell v-if="disabled" v-show="form.PERSON_SIGN_IMG">
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.PERSON_SIGN_IMG" width="100%"
height="100px" mode="aspectFit"></u--image>
2023-11-07 10:08:37 +08:00
</view>
</u-cell>
<u-cell v-if="disabled" v-show="form.PERSON_SIGN_IMG">
<view slot="title" class="title">签字时间</view>
2024-10-10 10:14:31 +08:00
<view slot="value">{{ form.PERSON_SIGN_TIME }}</view>
2023-11-07 10:08:37 +08:00
</u-cell>
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="4"
></u-upload>
</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-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">
2023-11-07 10:08:37 +08:00
<u--textarea v-model="hiddenForm.HIDDENDESCR" placeholder="请输入隐患描述"
:disabled="popupDisabled"></u--textarea>
</view>
</u-cell>
<u-cell>
<view slot="title" class="title required">隐患部位</view>
<view slot="value">
<u--input v-model="hiddenForm.HIDDENPART" border="none" placeholder="请输入隐患部位" inputAlign="right"
:disabled="popupDisabled"></u--input>
</view>
</u-cell>
<u-cell>
<view slot="title" class="title required">隐患级别</view>
<view slot="value">
<text @click="showTree('tkitree3')">{{ hiddenForm.HIDDENLEVEL_NAME || '' }}</text>
<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.HIDDENTYPE_NAME || '' }}</text>
<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.RECTIFICATIONTYPE" placement="row" :disabled="popupDisabled">
2024-10-10 10:14:31 +08:00
<!-- <u-radio label="立即整改" name="1"></u-radio>-->
2023-11-07 10:08:37 +08:00
<u-radio label="限期整改" name="2" class="ml-10"></u-radio>
</u-radio-group>
</view>
</u-cell>
<u-cell v-if="hiddenForm.RECTIFICATIONTYPE === '2'">
<view slot="title" class="title required">整改期限</view>
<view slot="value">
2024-10-10 10:14:31 +08:00
<text @click="popupDisabled ? null : RECTIFICATIONDEADLINEShow = true">
{{ hiddenForm.RECTIFICATIONDEADLINE || '请选择' }}
</text>
2023-11-07 10:08:37 +08:00
<u-datetime-picker :show="RECTIFICATIONDEADLINEShow" :value="hiddenForm.RECTIFICATIONDEADLINE"
:minDate="Number(1970)"
@cancel="RECTIFICATIONDEADLINEShow = false"
@confirm="RECTIFICATIONDEADLINEConfirm"></u-datetime-picker>
</view>
</u-cell>
2024-10-10 10:14:31 +08:00
<u-cell v-if="hiddenForm.RECTIFICATIONTYPE === '1'">
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.zgImgs"
@afterRead="afterRead2"
@delete="deletePic2"
multiple
:maxCount="4"
></u-upload>
</view>
</u-cell>
2024-10-10 10:14:31 +08:00
<u-cell v-if="hiddenForm.RECTIFICATIONTYPE === '1'">
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--textarea v-model="hiddenForm.RECTIFYDESCR" placeholder="请输入整改描述"
:disabled="popupDisabled"></u--textarea>
</view>
</u-cell>
<u-cell>
<view slot="title" class="title required">整改部门</view>
<view slot="value">
<text @click="showTree('tkitree5')">{{ hiddenForm.RECTIFICATIONDEPT_NAME || '' }}</text>
<tki-tree ref="tkitree5" :range="rectificationDepartmentTreeList" rangeKey="UNITS_NAME" selectParent
@confirm="confirmTree($event,'rectificationSiteuserColumns')"/>
</view>
</u-cell>
<u-cell v-show="hiddenForm.RECTIFICATIONDEPT_NAME">
<view slot="title" class="title required">整改人</view>
<view slot="value">
2024-10-10 10:14:31 +08:00
<text @click="popupDisabled ? null : rectificationSiteuserShow = true">
{{ hiddenForm.RECTIFICATIONOR_NAME || '请选择' }}
</text>
2023-11-07 10:08:37 +08:00
<u-picker :show="rectificationSiteuserShow" :columns="rectificationSiteuserColumns" keyName="NAME"
@cancel="rectificationSiteuserShow = false"
@confirm="rectificationSiteuserConfirmPicker"></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" v-if="!popupDisabled">
<u-button type="primary" text="保存" @click="popupSave"></u-button>
</view>
2023-11-07 10:08:37 +08:00
</view>
</u-cell>
</u-cell-group>
</view>
</u-popup>
</view>
</template>
<script>
import {
getKeyProjectsListAllPersonnel,
getHiddenLevel,
getHiddenType,
getKeyProjectsListAllUnits,
getInspectionDepartment,
getInspectionType,
getInspectors,
setImgFilesAdd,
setKeyProjectsCheckAdd,
setVideoAdd,
getKeyProjectsCheckView,
getPERSONNELMANAGEMENTID
} from "../../../api";
export default {
data() {
return {
form: {
INSPECTION_CATEGORY: '',
UNITS_NAME: '',
2024-10-10 10:14:31 +08:00
INSPECTED_CORPINFO_ID_NAME: '',
2023-11-07 10:08:37 +08:00
UNITS_ID: '',
PERSON_NAME: '',
PERSONNELMANAGEMENT_ID: '',
INSPECTION_PLACE: '',
INSPECTION_TYPE_NAME: '',
INSPECTION_TYPE_OTHER: '',
INSPECTION_TIME_START: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
INSPECTION_TIME_END: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
situationList: [{id: Math.random(), INSPECTION_SITUATION_ID: '', SITUATION: ''}],
hiddenList: [],
2024-10-10 10:14:31 +08:00
CREATTIME: '',
2023-11-07 10:08:37 +08:00
},
rules: {
'INSPECTION_CATEGORY': {required: true, message: '请选择检查题目'},
'UNITS_NAME': {required: true, message: '请选择被检查单位'},
'PERSON_NAME': {required: true, message: '请选择被检查单位现场负责人'},
'INSPECTION_PLACE': {required: true, message: '请输入检查场所'},
'INSPECTION_TYPE_NAME': {required: true, message: '请选择检查类型'},
'INSPECTION_TIME_START': {required: true, message: '请选择检查开始时间'},
'INSPECTION_TIME_END': {required: true, message: '请选择检查结束时间'},
'INSPECTION_USERS': {required: true, message: '请输入检查人员'},
},
inspectedDepartmentTreeList: [],
rectificationDepartmentTreeList: [],
inspectionDepartmentTreeList: [],
inspectionTypeTreeList: [],
inspectedSiteuserShow: false,
inspectionTimeStartShow: false,
inspectionTimeEndShow: false,
inspectedSiteuserColumns: [
[]
],
KEYPROJECTCHECK_ID: '',
OUTSOURCED_ID: '',
disabled: false,
delSituations: [],
popupShow: false,
popupDisabled: false,
RECTIFICATIONDEADLINEShow: false,
hiddenForm: {
id: Math.random(),
hiddenImgs: [],
zgImgs: [],
hiddenVideos: [],
HIDDENDESCR: '',
HIDDENPART: '',
HIDDENLEVEL_NAME: '',
HIDDENLEVEL: '',
HIDDENTYPE_NAME: '',
HIDDENTYPE: '',
2024-10-10 10:14:31 +08:00
HIDDENTYPE2_NAME: '',
HIDDENTYPE2: '',
2023-11-07 10:08:37 +08:00
SOURCE: '4',
CORPINFO_ID: '',
HIDDENFINDDEPT: '',
RECTIFICATIONTYPE: '2',
2024-10-10 10:14:31 +08:00
RECTIFICATIONDEADLINE: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
RECTIFYDESCR: '',
RECTIFICATIONDEPT: '',
2023-11-07 10:08:37 +08:00
RECTIFICATIONDEPT_NAME: '',
2024-10-10 10:14:31 +08:00
RECTIFICATIONOR_NAME: '',
RECTIFICATIONOR: '',
2023-11-07 10:08:37 +08:00
},
hiddenFormRules: {
'hiddenImgs': {required: true, message: '请上传隐患照片'},
'HIDDENDESCR': {required: true, message: '请输入隐患描述'},
'HIDDENPART': {required: true, message: '请输入隐患部位'},
'HIDDENLEVEL_NAME': {required: true, message: '请选择隐患级别'},
'HIDDENTYPE_NAME': {required: true, message: '请选择隐患类型'},
// 'RECTIFICATIONDEADLINE': {required: true, message: '请选择整改期限'},
// 'RECTIFYDESCR': {required: true, message: '请输入整改描述'},
'RECTIFICATIONDEPT': {required: true, message: '请选择整改部门'},
'RECTIFICATIONOR': {required: true, message: '请选择整改人'},
},
hiddenLevelTreeList: [
{id: 'hiddenLevel1004', name: '轻微隐患'},
{id: 'hiddenLevel1002', name: '一般隐患'},
],
hiddenTypeTreeList: [],
creatorList: [],
delHiddens: [],
delHiddenFiles: [],
rectificationSiteuserColumns: [],
rectificationSiteuserShow: false,
creatorShow: false,
modalShow: false,
videoUrl: '',
}
},
async onLoad(event) {
this.KEYPROJECTCHECK_ID = event.KEYPROJECTCHECK_ID
this.OUTSOURCED_ID = event.OUTSOURCED_ID
2024-07-27 15:46:35 +08:00
2023-11-07 10:08:37 +08:00
this.disabled = !(event.type === 'add' || event.type === 'edit');
if (this.KEYPROJECTCHECK_ID) {
await this.fnGetKeyProjectsCheckView()
2024-10-10 10:14:31 +08:00
} else {
await this.getOutSource(this.OUTSOURCED_ID)
}
if (event.type === 'add' || event.type === 'edit') {
2023-11-07 10:08:37 +08:00
await this.fnGetKeyProjectsListAllUnits()
await this.fnGetInspectionDepartment()
await this.fnGetHiddenType()
// this.fnGetHiddenLevel()
await this.fnGetInspectionType()
}
},
computed: {
userInfo() {
return this.$store.getters.getUserInfo
}
},
methods: {
async fnGetKeyProjectsListAllUnits() {
2024-10-10 10:14:31 +08:00
let resData = await getKeyProjectsListAllUnits({OUTSOURCED_ID: this.OUTSOURCED_ID});
2023-11-07 10:08:37 +08:00
this.inspectedDepartmentTreeList = resData.varList;
this.form.UNITS_NAME = this.inspectedDepartmentTreeList[0].UNITS_NAME //默认相关方部门
this.form.UNITS_ID = this.inspectedDepartmentTreeList[0].UNITS_ID
this.fnGetKeyProjectsListAllPersonnel(this.inspectedDepartmentTreeList[0].UNITS_ID).then(res => {
this.$set(this.inspectedSiteuserColumns, 0, res)
})
this.rectificationDepartmentTreeList = resData.varList;
},
async fnGetInspectionDepartment() {
let resData = await getInspectionDepartment();
this.inspectionDepartmentTreeList = JSON.parse(resData.zTreeNodes);
},
async fnGetHiddenType() {
let resData = await getHiddenType();
this.hiddenTypeTreeList = JSON.parse(resData.zTreeNodes);
},
async fnGetHiddenLevel() {
let resData = await getHiddenLevel();
this.hiddenLevelTreeList = JSON.parse(resData.zTreeNodes);
},
async fnGetInspectionType() {
let resData = await getInspectionType();
this.inspectionTypeTreeList = JSON.parse(resData.zTreeNodes);
},
async fnGetKeyProjectsListAllPersonnel(detpId) {
let resData = await getKeyProjectsListAllPersonnel({'UNITS_ID': detpId});
return resData.varList;
},
async fnGetInspectors(detpId) {
let resData = await getInspectors({'DEPARTMENT_ID': detpId});
return resData.userList;
},
async fnGetKeyProjectsCheckView() {
let resData = await getKeyProjectsCheckView({KEYPROJECTCHECK_ID: this.KEYPROJECTCHECK_ID})
for (let i = 0; i < resData.pd.hiddenList.length; i++) {
2024-08-29 08:35:29 +08:00
resData.pd.hiddenList[i].id = resData.pd.hiddenList[i].HIDDEN_ID
2023-11-07 10:08:37 +08:00
for (let j = 0; j < resData.pd.hiddenList[i].hiddenImgs.length; j++) {
resData.pd.hiddenList[i].hiddenImgs[j].url = this.$store.state.filePath + resData.pd.hiddenList[i].hiddenImgs[j].FILEPATH
}
for (let j = 0; j < resData.pd.hiddenList[i].hiddenVideos.length; j++) {
resData.pd.hiddenList[i].hiddenVideos[j].url = this.$store.state.filePath + resData.pd.hiddenList[i].hiddenVideos[j].FILEPATH
}
for (let j = 0; j < resData.pd.hiddenList[i].zgImgs.length; j++) {
resData.pd.hiddenList[i].zgImgs[j].url = this.$store.state.filePath + resData.pd.hiddenList[i].zgImgs[j].FILEPATH
}
}
this.form = resData.pd
},
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.UNITS_ID = e[0].UNITS_ID
this.form.UNITS_NAME = e[0].UNITS_NAME
this.form.PERSON_NAME = ''
this.form.PERSONNELMANAGEMENT_ID = ''
this.fnGetKeyProjectsListAllPersonnel(e[0].UNITS_ID).then(res => {
this.$set(this.inspectedSiteuserColumns, 0, res)
})
}
if (list === 'inspectionTypeTreeList') {
this.form.INSPECTION_TYPE = e[0].id
this.form.INSPECTION_TYPE_NAME = e[0].name
}
if (list === 'hiddenLevelTreeList') {
this.hiddenForm.HIDDENLEVEL = e[0].id
this.hiddenForm.HIDDENLEVEL_NAME = e[0].name
}
if (list === 'hiddenTypeTreeList') {
this.hiddenForm.HIDDENTYPE = e[0].id
this.hiddenForm.HIDDENTYPE_NAME = e[0].name
2024-10-10 10:14:31 +08:00
// 获取根节点元素名
this.hiddenTypeTreeList.forEach((enode) => {
if (JSON.stringify(enode).includes(e[0].id) && JSON.stringify(enode).includes(e[0].name)) {
// CORPINFO_ID = this.$route.query.CORPINFO_ID,
this.hiddenForm.HIDDENTYPE2 = enode.id
this.hiddenForm.HIDDENTYPE2_NAME = enode.name
}
})
2023-11-07 10:08:37 +08:00
}
if (list === 'rectificationSiteuserColumns') {
this.hiddenForm.RECTIFICATIONDEPT = e[0].UNITS_ID
this.hiddenForm.RECTIFICATIONDEPT_NAME = e[0].UNITS_NAME
this.hiddenForm.RECTIFICATIONOR_NAME = ''
this.hiddenForm.RECTIFICATIONOR = ''
this.fnGetKeyProjectsListAllPersonnel(e[0].UNITS_ID).then(res => {
this.$set(this.rectificationSiteuserColumns, 0, res)
})
}
},
inspectedSiteuserConfirmPicker(e) {
this.form.PERSON_NAME = e.value[0].NAME
this.form.PERSONNELMANAGEMENT_ID = e.value[0].PERSONNELMANAGEMENT_ID
this.inspectedSiteuserShow = false;
},
rectificationSiteuserConfirmPicker(e) {
this.hiddenForm.RECTIFICATIONOR_NAME = e.value[0].NAME
this.hiddenForm.RECTIFICATIONOR = e.value[0].PERSONNELMANAGEMENT_ID
this.rectificationSiteuserShow = false;
},
inspectionTimeStartConfirm(e) {
this.form.INSPECTION_TIME_START = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM')
this.inspectionTimeStartShow = false;
},
inspectionTimeEndConfirm(e) {
this.form.INSPECTION_TIME_END = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM')
this.inspectionTimeEndShow = false;
},
RECTIFICATIONDEADLINEConfirm(e) {
this.hiddenForm.RECTIFICATIONDEADLINE = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM')
this.RECTIFICATIONDEADLINEShow = false;
},
addSituation() {
this.form.situationList.push({id: Math.random(), INSPECTION_SITUATION_ID: '', SITUATION: ''})
},
removeSituation(item, index) {
uni.showModal({
title: '提示',
cancelText: '确认',
confirmText: '取消',
content: '确定删除检查情况吗?',
success: (res) => {
if (res.cancel) {
this.form.situationList.splice(index, 1)
if (item.INSPECTION_SITUATION_ID) {
this.delSituations.push(item.INSPECTION_SITUATION_ID)
}
}
}
});
},
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.situationList.length; i++) {
if (!this.form.situationList[i].SITUATION) {
uni.showToast({
title: `请填写第${i + 1}项检查情况`,
icon: 'none'
})
return
}
}
uni.showLoading({
title: '加载中'
});
let resData = await setKeyProjectsCheckAdd({
...this.form,
INSPECTION_ORIGINATOR_ID: this.userInfo.USER_ID,
CREATOR: this.userInfo.USER_ID,
OPERATOR: this.userInfo.USER_ID,
2024-10-10 10:14:31 +08:00
OUTSOURCED_ID: this.OUTSOURCED_ID,
2023-11-07 10:08:37 +08:00
INSPECTION_STATUS: '0',
delSituations: this.delSituations.join(','),
delHiddens: this.delHiddens.join(','),
delHiddenFiles: this.delHiddenFiles.join(','),
SITUATIONJSON: JSON.stringify(this.form.situationList),
HIDDENJSON: JSON.stringify(this.form.hiddenList),
loading: false
})
let PromiseArr = []
for (let i = 0; i < resData.pd.hiddenList.length; i++) {
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,
})
2024-10-10 10:14:31 +08:00
PromiseArr.push(this.fnSetImgFilesAdd(imgFiles, resData.pd.hiddenList[i].HIDDEN_ID, '3'))
2023-11-07 10:08:37 +08:00
}
for (let j = 0; j < this.form.hiddenList[i].zgImgs.length; j++) {
let imgFiles = []
imgFiles.push({
uri: this.form.hiddenList[i].zgImgs[j].url,
FFILE: this.form.hiddenList[i].zgImgs[j].url,
})
2024-10-10 10:14:31 +08:00
PromiseArr.push(this.fnSetImgFilesAdd(imgFiles, resData.pd.hiddenList[i].HIDDEN_ID, '4'))
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, resData.pd.hiddenList[i].HIDDEN_ID))
}
}
Promise.all(PromiseArr).then(() => {
uni.hideLoading()
uni.showToast({
title: '添加成功',
})
uni.$u.route({
type: 'navigateBack'
})
}).catch(() => {
uni.showToast({
title: '添加失败!',
icon: 'error',
duration: 2000
});
})
},
2024-10-10 10:14:31 +08:00
async fnSetImgFilesAdd(imgFiles, FOREIGN_KEY, TYPE) {
2023-11-07 10:08:37 +08:00
return await setImgFilesAdd({
files: imgFiles,
formData: {
FOREIGN_KEY,
TYPE
},
2024-10-10 10:14:31 +08:00
loading: false
2023-11-07 10:08:37 +08:00
})
},
async fnSetVideoAdd(filePath, FOREIGN_KEY) {
return await setVideoAdd({
filePath,
name: 'FFILE',
formData: {
FOREIGN_KEY,
TYPE: 102,
CORPINFO_ID: this.userInfo.CORPINFO_ID,
// CORPINFO_ID: this.CORPINFO_ID,
2024-07-27 15:46:35 +08:00
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.hiddenForm.RECTIFICATIONDEPT = this.rectificationDepartmentTreeList[0].UNITS_ID
this.hiddenForm.RECTIFICATIONDEPT_NAME = this.rectificationDepartmentTreeList[0].UNITS_NAME //默认整改部门为相关方单位
2024-10-10 10:14:31 +08:00
this.hiddenForm.RECTIFICATIONOR = this.form.PERSONNELMANAGEMENT_ID;
this.hiddenForm.RECTIFICATIONOR_NAME = this.form.PERSON_NAME;
2023-11-07 10:08:37 +08:00
this.fnGetKeyProjectsListAllPersonnel(this.rectificationDepartmentTreeList[0].UNITS_ID).then(res => {
this.$set(this.rectificationSiteuserColumns, 0, res)
})
this.creatorList = [[{NAME: this.userInfo.NAME, USER_ID: this.userInfo.USER_ID}]]
this.popupShow = true
this.popupDisabled = false
},
showHidden(item) {
this.clearHiddenForm()
this.creatorList = [[]]
this.hiddenForm = item
this.popupShow = true
this.popupDisabled = true
},
clearHiddenForm() {
this.hiddenForm = {
id: Math.random(),
hiddenImgs: [],
zgImgs: [],
hiddenVideos: [],
HIDDENDESCR: '',
HIDDENPART: '',
HIDDENLEVEL_NAME: '',
HIDDENLEVEL: '',
HIDDENTYPE_NAME: '',
HIDDENTYPE: '',
SOURCE: '4',
CORPINFO_ID: '',
HIDDENFINDDEPT: '',
RECTIFICATIONTYPE: '2',
2024-10-10 10:14:31 +08:00
RECTIFICATIONDEADLINE: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
RECTIFICATIONDEPT: '',
RECTIFYDESCR: '',
RECTIFICATIONDEPT_NAME: '',
RECTIFICATIONOR_NAME: '',
RECTIFICATIONOR: '',
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.HIDDEN_ID) {
this.delHiddens.push(item.HIDDEN_ID)
}
}
}
});
},
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)
},
afterRead2(event) {
this.hiddenForm.zgImgs = [...this.hiddenForm.zgImgs, ...event.file]
},
deletePic2(event) {
this.hiddenForm.zgImgs = this.hiddenForm.zgImgs.filter(item => item.url !== event.file.url)
},
popupClose() {
this.popupShow = false
},
2024-10-10 10:14:31 +08:00
//获取重点工程信息 并初始化赋值
async getOutSource(ID) {
let resData = await getPERSONNELMANAGEMENTID({OUTSOURCED_ID: ID})
this.form.PERSONNELMANAGEMENT_ID = resData.pd.PERSONNELMANAGEMENT_ID;
this.form.PERSON_NAME = resData.pd.NAME;
},
2023-11-07 10:08:37 +08:00
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;
}
}
2024-10-10 10:14:31 +08:00
if (this.hiddenForm.RECTIFICATIONTYPE === '2') {
if (!this.hiddenForm.RECTIFICATIONDEADLINE) {
2023-11-07 10:08:37 +08:00
uni.showToast({
title: '请选择整改期限',
icon: "none"
})
return;
}
}
2024-10-10 10:14:31 +08:00
if (this.hiddenForm.RECTIFICATIONTYPE === '1') {
if (this.hiddenForm.zgImgs.length === 0) {
2023-11-07 10:08:37 +08:00
uni.showToast({
title: '请上传整改照片',
icon: "none"
})
return;
}
2024-10-10 10:14:31 +08:00
if (!this.hiddenForm.RECTIFYDESCR) {
2023-11-07 10:08:37 +08:00
uni.showToast({
title: '请输入整改描述',
icon: "none"
})
return;
}
}
this.hiddenForm.SOURCE = 4
this.form.hiddenList.push(this.hiddenForm)
this.popupClose()
},
2024-10-10 10:14:31 +08:00
previewVideo(videoUrl) {
2023-11-07 10:08:37 +08:00
this.modalShow = true;
this.videoUrl = videoUrl;
},
},
}
</script>
<style>
</style>