12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295 |
- <template>
- <view class="uni-container uni-container-bg">
- <view class="example container" :style="'height: ' + (screenHeight - 75) + 'px'">
- <!-- 下拉框 -->
- <view class="u-page__tag-item" style="margin-bottom: 26upx;width: 700upx;border-bottom: 2px solid #55cbbf;">
- <u-form>
- <u-form-item prop="orgName" @click="
- showOrg = true;
- hideKeyboard();
- " label="单位选择:" labelWidth="120px">
- <u--input border="none" disabled v-model="formData.orgName" placeholder="请选择所属单位"></u--input>
- <u-icon slot="right" name="arrow-down" class="danwei"></u-icon>
- </u-form-item>
- </u-form>
- </view>
- <view class="tops" v-if="!getqrcode">
- <view style="display: flex;flex-direction: column;">
- <image :src="scan" class="tupian" @click="erWeiMa"></image>
- <view style="margin-top: 20rpx;">设施扫码</view>
- </view>
- <!-- #ifdef H5 -->
- <u-popup :show="qrScanShow" mode="center" @close="qrScanClose" @open="qrScanOpen" closeable
- :safeAreaInsetTop="true" zoom>
- <view class="qr-scan-containner">
- <view class="qr-scan-middle">
- <view class="qr-scan-title">
- 扫码
- </view>
- <qrcode-stream class="qr-scan-view" @decode="onDecode" />
- </view>
- </view>
- </u-popup>
- <!-- <view class="qrcode" v-if="qrcodeShow">
- <qrcode-stream @decode="onDecode" />
- </view> -->
- <!-- #endif -->
- <view>
- <image :src="Group" @click="
- showMCheck = true;
- hideKeyboard();
- " class="tiantupian"></image>
- <view style="margin-top: 20rpx;">手动添加</view>
- </view>
- </view>
- <view class="cont" v-if="!getqrcode">
- 主动检查记录
- </view>
- <view v-if="!getqrcode" class="main-content">
- <uni-card v-for="(item, index) in tableData" :key="index">
- <view class="titles"><text class="name-align-task">检查项:</text>{{item.inspName}}
- <u-icon v-if="item.isdenger==1" name="warning-fill" color="#ff5647" size="28"
- :customStyle="{marginTop:'20px',backgroundColor:'#fff'}"></u-icon>
- </view>
- <view><text class="name-align-task">检查结果:</text>{{item.handleResult}}</view>
- <view class="an-niu">
- <text><text class="name-align-task">检查时间:</text>{{item.inspectTime}}</text>
- <text @click="addClickDetail(item.id)" class="detail">查看详情</text>
- </view>
- </uni-card>
- </view>
- </view>
- <!-- 扫码弹出层 -->
- <u-popup :show="maShow" :round="10" @close="maShow=false">
- <view v-if="insTypeData!=''">
- <view class="springFarm" v-for="(item,index) in insTypeData" :key="index">
- <view class="show-title">设备名称:{{item.fpdName}}</view>
- <view class="show-title">设备序列号:{{item.fpdCode}}</view>
- <view>
- <view class="show-title">设备检查项:</view>
- </view>
- <view style="display: flex;flex-direction: column;">
- <view class="" v-if="item.inspectResultList!=''">
- <uni-grid :column="3" :showBorder="false">
- <uni-grid-item v-for="(items,indexs) in item.inspectResultList" :key="indexs">
- <view class="grid-item-box">
- <image :src="items.subValue==1?zhengchang:moren" class="tupians"
- @click="normalPopup(items,indexs,index)">
- </image>
- <text class="text">{{items.subLable}}</text>
- </view>
- </uni-grid-item>
- </uni-grid>
- </view>
- <!-- <view class="slot-contents" v-if="show2">
- <textarea v-model="dangerDescribe" placeholder="请输入隐患描述内容"></textarea>
- </view> -->
- </view>
- <!-- ----扫码选择隐患 -->
- <view class="slot-contents" v-if="show2">
- <textarea v-model="dangerDescribe" placeholder="请输入隐患描述内容"
- @click="popupChoiceDangerFpd('show2')"></textarea>
- <u-popup :show="showPopupDanger" :round="10" @close="showPopupDanger=false">
- <view style="width: 90vw;overflow-y: auto;margin-bottom: 80rpx;padding:10px">
- <text class="text-xl">选择隐患类型:</text>
- <view class="" class="person-forward">
- <u-checkbox-group v-for="(items, indexs) in choiceDanger" :key="indexs"
- placement="column" v-model="items.checkedListDanger"
- @change="checkboxChange3(items.name,$event)" activeColor="#4CB2B6"
- iconSize="red">
- <u-checkbox :customStyle="{marginBottom: '60rpx'}" :label="items.name"
- :name="items.name">
- </u-checkbox>
- </u-checkbox-group>
- </view>
- <view class="flex flex-direction-row "
- style="position: fixed;bottom: 10px;left: 50%;transform: translate(-50%);height: 100rpx;width: 80%">
- <u-button shape="circle" type="primary" color="#4CB2B6" text="确定"
- @click="checkboxConfirm3()" customStyle="margin-right:20px;padding:0 30px">
- </u-button>
- <u-button type="primary" plain color="#4CB2B6" text="取消" shape="circle"
- @click="checkboxCancel3()" customStyle="padding:0 30px">
- </u-button>
- </view>
- </view>
- </u-popup>
- </view>
- <!-- ----扫码选择隐患 -->
- <view class="show-title">
- <view class="">巡检拍照:<text style="color:#822e2e;"></text></view>
- <view class="">
- <image :src="photograph" @click="photoUpload(item)" class="tiantupian"></image>
- </view>
- <uni-load-more v-show="loading" status="loading" :content-text="contentText" />
- </view>
- <view class="uni-grid-wraps">
- <view style="position: relative;width: 180rpx;float: left;margin: 10rpx 15rpx 0 0rpx;"
- v-for="(items,indexs) in item.attUrl" :key="indexs">
- <image :src="items" style="width: 160rpx;height: 160rpx;border-radius: 30rpx;float: left;">
- <u-icon name="close" color="#4CB2B6" size="19" @click="closeImage(item,indexs,index)">
- </u-icon>
- </view>
- </view>
- <view style="width: 60%;position: absolute;left:150rpx;;bottom:60rpx;z-index: 9999;">
- <div class="btnList" v-if="show2">
- <u-button shape="circle" type="primary" color="#4CB2B6" text="立即处理"
- customStyle="margin-right:20%" @click="checkPopupConfirmNow">
- </u-button>
- <u-button v-if="show2" shape="circle" type="primary" color="#4CB2B6" text="生成隐患"
- @click="checkPopupYinHuan">
- </u-button>
- </div>
- <div class="btnList" v-if="!show2">
- <u-button shape="circle" type="primary" color="#4CB2B6" text="保存"
- customStyle="margin-right:20%" @click="checkPopupConfirm()">
- </u-button>
- <u-button shape="circle" type="primary" color="#4CB2B6" text="取消" @click="checkPopupCancel">
- </u-button>
- </div>
- </view>
- </view>
- </view>
- <view v-else>
- 暂无数据
- </view>
- </u-popup>
- <!-- 手动添加弹出层-->
- <u-popup :show="manualPopup" :round="10" @close="manualPopup=false">
- <view v-if="checkManualData!=[]">
- <view class="springFarm" v-for="(item,index) in checkManualData" :key="index">
- <view class="show-title">检查项名称:{{item.inspName}}</view>
- <view>
- <view class="show-title">设备检查项:</view>
- </view>
- <view style="display: flex;flex-direction: column;">
- <view class="" v-if="item.inspectSubDOList!=''">
- <uni-grid :column="3" :showBorder="false">
- <uni-grid-item v-for="(items,indexs) in item.inspectSubDOList" :key="indexs">
- <view class="grid-item-box">
- <image :src="items.isdenger==1?zhengchang:moren" class="tupians"
- @click="checkPopupManual(items,indexs,index)">
- </image>
- <text class="text">{{items.subLable}}</text>
- </view>
- </uni-grid-item>
- </uni-grid>
- </view>
- <!-- <view class="slot-contents" v-if="showManual">
- <textarea v-model="dangerDescribe" placeholder="请输入隐患描述内容"></textarea>
- </view> -->
- <!-- <view class="slot-contents" @click="descript(index)">
- <textarea class="slot-contents" v-model="remark" placeholder="请输入描述内容"></textarea>
- </view> -->
- </view>
- <!-- ----扫码选择隐患 -->
- <view class="slot-contents" v-if="showManual">
- <textarea v-model="dangerDescribe" placeholder="请输入隐患描述内容"
- @click="popupChoiceDangerFpd('Manual')"></textarea>
- <u-popup :show="showPopupDanger" :round="10" @close="showPopupDanger=false">
- <view style="width: 90vw;overflow-y: auto;margin-bottom: 80rpx;padding:10px">
- <text class="text-xl">选择隐患类型:</text>
- <view class="" class="person-forward">
- <u-checkbox-group v-for="(items, indexs) in choiceDanger" :key="indexs"
- placement="column" v-model="items.checkedListDanger"
- @change="checkboxChange3(items.name,$event)" activeColor="#4CB2B6"
- iconSize="red">
- <u-checkbox :customStyle="{marginBottom: '60rpx'}" :label="items.name"
- :name="items.name">
- </u-checkbox>
- </u-checkbox-group>
- </view>
- <view class="flex flex-direction-row "
- style="position: fixed;bottom: 10px;left: 50%;transform: translate(-50%);height: 100rpx;width: 80%">
- <u-button shape="circle" type="primary" color="#4CB2B6" text="确定"
- @click="checkboxConfirm3()" customStyle="margin-right:20px;padding:0 30px">
- </u-button>
- <u-button type="primary" plain color="#4CB2B6" text="取消" shape="circle"
- @click="checkboxCancel3()" customStyle="padding:0 30px">
- </u-button>
- </view>
- </view>
- </u-popup>
- </view>
- <!-- ----扫码选择隐患 -->
- <view class="show-title">
- <view class="">巡检拍照:<text style="color:#822e2e;"></text></view>
- <view class="">
- <image :src="photograph" @click="photoUpload(item)" class="tiantupian"></image> <!-- 加载中 -->
- </view>
- <uni-load-more v-show="loading" status="loading" :content-text="contentText" />
- </view>
- <view class="uni-grid-wraps">
- <view style="position: relative;width: 180rpx;float: left;margin: 10rpx 15rpx 0 0rpx;"
- v-for="(items,indexs) in item.attUrl" :key="indexs">
- <image :src="items" style="width: 160rpx;height: 160rpx;border-radius: 30rpx;float: left;">
- <u-icon name="close" color="#4CB2B6" size="19" @click="closeImage(item,indexs,index)">
- </u-icon>
- </view>
- </view>
- <view style="width: 60%;position: absolute;left:150rpx;;bottom:60rpx;z-index: 9999;">
- <div class="btnList" v-if="showManual">
- <u-button shape="circle" type="primary" color="#4CB2B6" text="立即处理"
- customStyle="margin-right:20%" @click="checkPopupConfirmNow">
- </u-button>
- <u-button v-if="showManual" shape="circle" type="primary" color="#4CB2B6" text="生成隐患"
- @click="checkPopupYinHuan">
- </u-button>
- </div>
- <div class="btnList" v-if="!showManual">
- <u-button shape="circle" type="primary" color="#4CB2B6" text="保存"
- customStyle="margin-right:20%" @click="checkPopupConfirm()">
- </u-button>
- <u-button shape="circle" type="primary" color="#4CB2B6" text="取消" @click="checkPopupCancel">
- </u-button>
- </div>
- </view>
- </view>
- </view>
- <view v-else>
- 暂无数据
- </view>
- </u-popup>
- <u-modal :show="show5" title="请输入处理结果" @confirm="descriptFpd" @cancel="show5 = false">
- <view class="slot-content jieguo">
- <textarea v-model="handleResult" placeholder="请输入" />
- </view>
- </u-modal>
- <u-action-sheet :show="showOrg" :actions="actions" title="请选择单位" @close="showOrg = false" @select="sexSelect">
- </u-action-sheet>
- <u-action-sheet :show="showMCheck" :actions="actionsManual" title="请选择检查项" @close="showMCheck = false">
- <view style="margin-bottom: 20rpx;">
- <view class="manual-hand">
- 手动输入设施编码:
- </view>
- <view class="manual-hand-item">
- <u--input placeholder="请输入设施编号" v-model="manualValue" class="manual-hand-input"></u--input>
- <u-button shape="circle" type="primary" color="#4CB2B6" text="确认"
- customStyle="width:120rpx;margin-left:2%" @click="manualHandConfirm()">
- </u-button>
- </view>
- </view>
- <hr>
- <view class="manual-hand">
- 选择检查项大类:
- </view>
- <view v-for="(item,index) in actionsManual" :key="index" @click="SelectMCheck(item)" class="manual">
- {{item.name}}
- </view>
- </u-action-sheet>
- </view>
- </template>
- <script>
- // #ifdef H5
- import {
- QrcodeStream
- } from 'vue-qrcode-reader'
- // #endif
- import {
- getInspect, //获取主动检查列表
- inspTypeList,
- createInspect, //创建主动检查
- getInspectInfo, //手动添加的检查项列表
- getFpd //根据编码获取设施信息
- } from "@/api/check_active";
- import loadImage from 'blueimp-load-image';
- import {
- getAccessToken
- } from '@/utils/auth'
- import config from '@/config'
- import store from "@/store"
- const baseUrl = config.baseUrl
- const baseUrlImg = config.baseUrlImg
- import {
- getOrgId //获取orgId
- } from '@/api/fire_device';
- import {
- shijianc
- } from '@/utils/common.js'
- //隐患弹框--
- import {
- DICT_TYPE,
- getDictDatas
- } from '@/utils/dict';
- //隐患弹框--
- let that = '';
- export default {
- components: {
- // #ifdef H5
- QrcodeStream
- // #endif
- },
- data() {
- return {
- contentText: {
- contentrefresh: '上传照片中',
- },
- screenHeight: this.$screenHeight,
- // ----扫码选择隐患
- showPopupDanger: false,
- choiceDanger: getDictDatas(DICT_TYPE.DANGER_TYPE),
- checkedPopupDanger: [], //
- // ----扫码选择隐患
- manualValue: '', //手动输入的设施编号
- manualPopup: false,
- scan: `${baseUrlImg}/checkActive/scan.png`,
- // 是否开启扫描
- qrScanShow: false,
- Group: `${baseUrlImg}/checkActive/Group2.png`,
- erWeiMaShu: '', //二维码内容对象
- tableData: [],
- loading: false,
- saveImplement: {
- attUrl: [],
- dangerDescribe: "", //隐患描述
- fpdId: "",
- fpdResultCreateReqVOList: [], //传的当前事件
- hisResultCreateReqVOList: [], //手动检查
- handleMethod: "", //处理方式
- handleResult: "", //处理结果描述
- handleTime: '',
- inspectTime: '',
- imgUrl1: "",
- imgUrl2: "",
- imgUrl3: "",
- orgId: 0,
- taskId: 0,
- broadId: 0,
- remark: "", //附加描述
- isdenger: 0,
- },
- maShow: false, //扫码后弹框是否展示
- manualCheck: false, //手动检查弹框是否显示
- actionsManual: [], //手动检查弹框数据
- ManualData: [], //手动检查弹框完整数据
- checkManualData: [], //手动检查选中的一条检查项数据
- showManual: false, //手动检查是否显示描述
- showMCheck: false,
- insTypeData: '', //扫二维码后出现的消防列表数据内容
- moren: `${baseUrlImg}/checkActive/moren.png`, //默认图片
- zhengchang: `${baseUrlImg}/checkActive/zhengchang.png`,
- show5: false,
- remark: '',
- photograph: `${baseUrlImg}/checkActive/photograph.png`,
- show2: false,
- handleResult: '',
- dangerDescribe: '',
- showOrg: false,
- actions: [],
- // 每页数据量
- pageSize: 10,
- // 当前页
- pageNo: 1,
- // 数据总量
- total: 0,
- formData: {
- orgName: '',
- orgId: ''
- },
- getqrcode: false,
- qrcodeShow: false, //h5端扫码是否显示
- }
- },
- watch: {
- loading: {
- handler(newLength, oldLength) {
- this.$modal.isLoadingModel(this.loading)
- },
- immediate: true
- }
- },
- onShow() {
- this.choiceDanger.map(i => {
- i.name = i.label;
- i.id = i.value;
- });
- this.tableData = []
- this.actions = []
- that = this;
- getOrgId({
- pageNo: this.pageNo,
- pageSize: this.pageSize,
- userId: this.$store.state.user.id
- }).then(response => {
- // 取到用户对应的单位名称与id
- response.data.map(v => {
- this.actions.push({
- id: v.dwid,
- name: v.orgName
- });
- });
- this.formData.orgName = response.data.length > 0 ? response.data[0].orgName : '' //默认
- this.formData.orgId = response.data.length > 0 ? response.data[0].dwid : ''
- });
- this.getData(1)
- this.getInspect()
- },
- methods: {
- // ----扫码选择隐患
- popupChoiceDangerFpd(type) {
- this.checkedPopupDanger = this.dangerDescribe.split(',')
- if (this.checkedPopupDanger.includes('其他')) {
- this.showPopupDanger = false
- } else {
- this.showPopupDanger = true
- this.$forceUpdate()
- }
- this.choiceDanger.map((i, indexs) => { //选中的回显
- i.checkedListDanger = []
- this.checkedPopupDanger.map(v => {
- if (i.name == v) {
- this.choiceDanger[indexs].checkedListDanger.push(v)
- }
- })
- })
- },
- checkboxConfirm3(index) {
- this.dangerDescribe = this.checkedPopupDanger.toString()
- this.showPopupDanger = false
- this.$forceUpdate()
- },
- checkboxCancel3(index) {
- this.showPopupDanger = false
- this.checkedPopupDanger = []
- this.$forceUpdate()
- },
- checkboxChange3(i, n) { //勾选的事件
- if (i && n.length != 0) {
- this.checkedPopupDanger.push(i)
- } else if (i && n.length == 0) {
- this.checkedPopupDanger = this.checkedPopupDanger.filter(item => item != i)
- }
- },
- // ----扫码选择隐患
- qrScanOpen() {},
- async getInspect() {
- const res = await getInspectInfo({pageNo:1,pageSize:100})
- this.ManualData = res.data.list
- this.actionsManual = res.data.list.filter(obj => obj.inspType !== 'fpd').map(obj => {
- return {
- id: obj.id,
- name: obj.inspName
- };
- })
- },
- closeImage(item, val, k) { //删除图片---5.25新加--未验证
- if (this.manualPopup) { //手动检查
- this.checkManualData[0].attUrl.splice(val, 1)
- } else { //扫码添加
- console.log(item, 'iii');
- if (item.fpdType) {
- this.insTypeData[k].attUrl.splice(val, 1)
- }
- // this.tableData[k].attUrl.splice(val, 1)
- }
- that.$forceUpdate();
- },
- sexSelect(e) { //单位
- this.formData.orgId = e.id;
- this.formData.orgName = e.name;
- this.tableData = []
- this.getData(1)
- },
- manualHandConfirm() { //手动输入编号确认
- console.log(this.manualValue, 'manualValue');
- var that = this
- getFpd({
- fpdCode: this.manualValue
- }).then(res => {
- if (res.data.list.length > 0) {
- inspTypeList({
- id: res.data.list[0].id,
- fpdCode: this.manualValue
- }).then(reponse => {
- that.showMCheck = false
- that.maShow = true
- that.show2 = false
- this.manualValue = ''
- that.insTypeData = reponse.data.records
- that.insTypeData.map(i => i.attUrl = [])
- })
- } else {
- this.$modal.msg('不存在该设备编码,请确认是否输入正确')
- }
- })
- },
- SelectMCheck(e) { //手动选择
- this.reselt()
- this.checkManualData = this.ManualData.filter(ManualDataItem => {
- return ManualDataItem.id == e.id
- })
- this.showMCheck = false
- this.manualPopup = true
- this.checkManualData.map(i => {
- i.inspectSubDOList.map(v => {
- v.isdenger = 0
- })
- i.isdenger = i.isdenger
- i.remark = ''
- i.attUrl = []
- i.handleMethod = ''
- i.handleResult = ''
- i.handleTime = ''
- i.inspectTime = ''
- })
- this.remark = ''
- console.log(this.checkManualData, 'checkManualData=========', this.ManualData);
- },
- checkPopupManual(items, indexs, index) { //手动选择
- this.checkManualData[0].inspectSubDOList.map(i => {
- console.log(i, 'itemtiiejteioti', items);
- if (i.id == items.id) {
- i.isdenger = i.isdenger === 1 ? 0 : 1;
- this.showManual = i.isdenger === 1 ? true : false;
- } else {
- i.isdenger = 0
- this.showManual = false
- }
- })
- this.$forceUpdate()
- console.log(this.checkManualData, '1111111111', this.showManual);
- },
- descript(index) { //隐患描述点击确认
- // this.show2 = false
- },
- getData(pageNo) {
- this.loading = true
- const id = this.$store.state.user.id
- getInspect({
- pageNo: pageNo,
- pageSize: this.pageSize,
- userId: id,
- orgId: this.formData.orgId
- }).then(response => {
- this.loading = false
- this.tableData = [...this.tableData, ...response.data.list]
- // this.tableData = response.data.list
- this.total = response.data.total
- })
- },
- //小程序端扫码
- erWeiMa() {
- // #ifdef H5
- this.qrScanShow = true
- // #endif
- // #ifdef MP-WEIXIN
- var that = this
- this.remark = ''
- // 只允许从相机扫码
- uni.scanCode({
- onlyFromCamera: true, //只允许从相机扫码
- success: function(res) {
- if (res.errMsg == "scanCode:ok") {
- console.log('条码内容:' + res.result, JSON.parse(res.result));
- let result = JSON.parse(res.result)
- console.log('条码内容:', JSON.parse(res.result));
- inspTypeList(JSON.parse(res.result)).then(reponse => {
- console.log(reponse, 'reponsesssssssssssssss');
- if (reponse.code == 0) {
- that.maShow = true
- that.show2 = false
- that.insTypeData = reponse.data.records
- that.insTypeData.map(i => {
- i.remark = ''
- i.attUrl = []
- i.handleMethod = ''
- i.handleResult = ''
- i.handleTime = ''
- i.inspectTime = ''
- })
- }
- })
- setTimeout(() => {
- that.$modal.msgSuccess('扫码成功')
- }, 200)
- }
- },
- fail: () => {
- that.$modal.msgError('未识别到二维码,请重新尝试!')
- }
- })
- // #endif
- },
- // #ifdef H5
- // 扫码成功后执行函数
- onDecode(qrcodeVal) {
- this.$modal.msgSuccess('扫码成功', qrcodeVal)
- this.qrcodeResault = qrcodeVal
- this.qrScanShow = false
- let result = JSON.parse(qrcodeVal)
- var that = this
- inspTypeList(JSON.parse(qrcodeVal)).then(reponse => {
- console.log(reponse, 'qrcodeVal');
- if (reponse.code == 0) {
- that.maShow = true
- that.show2 = false
- that.insTypeData = reponse.data.records
- that.insTypeData.map(i => i.attUrl = [])
- }
- })
- setTimeout(() => {
- that.$modal.msgSuccess('扫码成功')
- }, 200)
- },
- // 点击关闭按钮
- qrScanClose() {
- this.qrScanShow = false
- },
- onInit(promise) { //未使用
- promise
- .then(console.log)
- .catch(console.error)
- },
- // #endif
- descriptFpd() { //隐患描述点击确认
- this.show5 = false
- this.handleResult = this.handleResult
- if (this.manualPopup) {
- this.checkManualData[0].handleResult = this.handleResult
- }
- this.checkPopupConfirm()
- // this.maShow=false
- },
- checkPopupConfirmNow() {
- this.show5 = true
- this.handleMethod = "立即处理" //立即整改
- console.log(this.checkManualData, 'this.checkManualData');
- if (this.manualPopup) {
- this.checkManualData[0].handleMethod = "立即处理"
- }
- },
- checkPopupYinHuan() {
- this.handleMethod = "生成隐患" //生成隐患
- this.handleResult = "不正常"
- console.log(this.checkManualData, 'this.checkManualData[this.checkManualData[');
- if (this.manualPopup) { //手动检查
- this.checkManualData[0].handleMethod = "生成隐患"
- this.checkManualData[0].handleResult = "不正常"
- }
- this.checkPopupConfirm()
- },
- photoUpload(val) {
- let pictures = [];
- let that = this;
- uni.chooseImage({
- sourceType: ['camera'], //实现拍照
- count: 3,
- sizeType: ['original', 'compressed'],
- // sourceType: ['album','camera'], //打开系统相册
- success(res) {
- that.loading = true
- if (Array.isArray(res.tempFilePaths)) { //从相册选择有三张的情况
- res.tempFilePaths.forEach(item => {
- loadImage(
- item,
- function(canvas) {
- canvas.toBlob(function(blob) {
- // 压缩后的 Blob 对象
- const compressedFile = blob;
- // 将压缩后的文件 `compressedFile` 转换为临时URL
- const fileUrl = URL.createObjectURL(
- compressedFile);
- uni.uploadFile({
- url: baseUrl +
- '/admin-api/infra/file/upload', //后端用于处理图片并返回图片地址的接口
- filePath: item,
- name: 'file',
- header: {
- "Authorization": 'Bearer ' +
- getAccessToken(),
- }, //请求token
- success: (res) => {
- let imgUrl = JSON.parse(res
- .data)
- that.loading = false
- //消防设备外(扫一扫下方)展示的图片
- //弹出层的消防设备展示的图片
- if (that.manualPopup) { //手动检查
- that.checkManualData.map(
- i => {
- i.attUrl.push(
- imgUrl
- .data)
- })
- } else { //扫码添加
- that.insTypeData.map((i,
- index) => {
- if (val.id == i
- .id) {
- i.attUrl
- .push(
- imgUrl
- .data
- )
- }
- })
- }
- that.$forceUpdate();
- // // 返回的url
- },
- fail: () => {
- that.loading = false
- console.log("err");
- }
- })
- // 上传完毕后,释放临时URL
- URL.revokeObjectURL(fileUrl);
- }, 'image/jpeg', 0.6); // 设置压缩后的图片格式为 JPEG,压缩质量为 0.6
- }, {
- canvas: true,
- maxWidth: 800
- } // 设置最大宽度为 800px
- );
- })
- }
- }
- })
- },
- // 消防设备扫码
- normalPopup(items, indexs, index) {
- // this.insTypeData.map(k => {
- // k.attUrl = []
- // })
- this.insTypeData[index].inspectResultList.map(k => {
- if (k.isNormal == 1) this.nnorNormalValue = k.id
- if (this.insTypeData[index].inspectResultList[indexs].isNormal != 1 && this
- .insTypeData[index]
- .inspectResultList[indexs].subValue != 1) {
- // this.show5 = true
- this.show2 = true
- }
- })
- let tableItem = this.insTypeData[index].inspectResultList[indexs]
- let ALLinspectResultList = this.insTypeData[index].inspectResultList
- let YesinspectResultList = []
- let NorinspectResultList = []
- var Y = ALLinspectResultList.filter(i => i.id == this.nnorNormalValue)
- var N = ALLinspectResultList.filter(i => i.id != this.nnorNormalValue)
- N.map(n => {
- NorinspectResultList.push(n.subValue)
- })
- Y.map(y => {
- YesinspectResultList.push(y.subValue)
- })
- // items.isdenger = 0 ? 1 : 0
- if (NorinspectResultList.includes(1)) { //如果互斥的数组存在true normal!=1的数组
- if (tableItem.id == this.nnorNormalValue) {
- this.insTypeData[index].inspectResultList.map((i, kindex) => {
- if (i.id != this.nnorNormalValue) {
- i.subValue = 0
- this.show2 = false
- } else {
- i.subValue = 1
- }
- })
- } else {
- items.subValue = items.subValue == 0 ? 1 : 0
- this.show2 = false
- }
- } else {
- if (tableItem.id == this.nnorNormalValue) {
- items.subValue = items.subValue == 0 ? 1 : 0
- } else {
- // if (YesinspectResultList.includes(true)) { //是否存在第一份
- this.insTypeData[index].inspectResultList.map((i, kindex) => {
- if (i.id == this.nnorNormalValue) {
- i.subValue = 0
- }
- })
- // }
- items.subValue = items.subValue == 0 ? 1 : 0
- }
- }
- },
- checkPopupConfirm() { //弹出得到的那一条数据insTypeData的id 弹出保存
- if (this.manualPopup) { //手动检查
- this.saveImplement = this.checkManualData[0]
- this.saveImplement.hisResultCreateReqVOList = this.checkManualData[0].inspectSubDOList
- this.saveImplement.dangerDescribe = this.dangerDescribe
- this.saveImplement.handleTime = shijianc(new Date().getTime())
- this.saveImplement.inspectTime = shijianc(new Date().getTime())
- this.saveImplement.remark = this.remark
- this.saveImplement.imgUrl1 = this.checkManualData[0].attUrl[0] ? this.checkManualData[0].attUrl[0] :
- "";
- this.saveImplement.imgUrl2 = this.checkManualData[0].attUrl[1] ? this.checkManualData[0].attUrl[1] :
- "";
- this.saveImplement.imgUrl3 = this.checkManualData[0].attUrl[2] ? this.checkManualData[0].attUrl[2] :
- "";
- console.log(this.saveImplement, this.checkManualData, 'this.saveImplement===');
- this.saveImplement.hisResultCreateReqVOList.map(z => {
- z.resLable = z.subLable
- z.resValue = z.isdenger
- })
- this.saveImplement.inspId = this.saveImplement.id
- this.saveImplement.inspectSubDOList.map(i => {
- if (i.isdenger == 1 && i.isNormal == 0) { //必传参数,只有该检查项正常为0,那么isdenger==1
- this.saveImplement.isdenger = 1
- } else {
- this.saveImplement.isdenger = 0
- }
- })
- this.saveImplement.orgId = this.formData.orgId
- if (!this.saveImplement.dangerDescribe && this.saveImplement.isdenger == 1) return that.$modal
- .msgError('请填写隐患描述');
- console.log(this.saveImplement, 'this.saveImplement===');
- this.baocun(this.saveImplement)
- } else { //设施扫码
- //this.insTypeData[0]扫二维码后点击出现的一条消防列表数据内容 this.newInsTypeData的多条数据列表
- let arr = []
- console.log('aaaaaaaaaaaaaa', this.insTypeData);
- let normalArr = 0
- this.insTypeData[0].inspectResultList.map((i, index) => {
- arr.push(i.subValue)
- if (i.isNormal == 1) {
- normalArr = index //找到正常的所在的index
- }
- })
- if (arr.includes(1)) { //包含了证明勾选了
- this.insTypeData.map(i => {
- })
- this.saveImplement = this.insTypeData
- this.saveImplement.map(i => {
- i.handleTime = shijianc(new Date().getTime())
- i.inspectTime = shijianc(new Date().getTime())
- i.orgId = this.formData.orgId
- i.dangerDescribe = this.dangerDescribe
- i.handleMethod = this.handleMethod
- i.remark = this.remark
- i.handleResult = this.handleResult
- i.fpdId = i.id
- i.inspType = "fpd"
- i.imgUrl1 = i.attUrl[0] ? i.attUrl[0] : ""
- i.imgUrl2 = i.attUrl[1] ? i.attUrl[1] : ""
- i.imgUrl3 = i.attUrl[2] ? i.attUrl[2] : ""
- i.inspName = i.fpdName
- i.inspCode = i.fpdCode
- i.inspId = i.id
- i.fpdResultCreateReqVOList = i.inspectResultList
- i.fpdResultCreateReqVOList.map(z => {
- z.broadId = 0
- z.fpdId = z.id
- z.resLable = z.subLable
- z.resValue = z.subValue
- z.status = 0
- if (z.subValue == 1 && z.isNormal ==
- 0) { //必传参数,只有该检查项正常为0,那么isdenger==1
- i.isdenger = 1
- } else {
- i.isdenger = 0
- }
- })
- })
- console.log(this.saveImplement, 'this.saveImplement[0]this.saveImplement[0]');
- if (!this.saveImplement[0].dangerDescribe && this.saveImplement[0].isdenger == 1) return that
- .$modal.msgError('请填写隐患描述');
- this.baocun(this.saveImplement[0])
- // ----扫码选择隐患
- this.description2 = ''
- this.show2 = false
- } else {
- that.$modal.alert('请勾选检查结果')
- }
- }
- },
- baocun(val) {
- createInspect(JSON.stringify(val)).then(response => {
- if (response.data) {
- uni.showToast({
- title: '提交成功',
- icon: 'none',
- duration: 2000
- })
- this.tableData = []
- this.getData(1)
- this.reselt()
- console.log(this.checkManualData, '===================');
- this.$forceUpdate()
- } else {
- this.$modal.msgError('提交失败')
- }
- })
- this.maShow = false
- this.manualPopup = false
- },
- reselt() {
- this.dangerDescribe = ''
- this.handleResult = ''
- this.saveImplement = { //重置
- attUrl: [],
- dangerDescribe: "", //隐患描述
- fpdId: "",
- fpdResultCreateReqVOList: [], //传的当前事件
- hisResultCreateReqVOList: [],
- handleMethod: "", //处理方式
- handleResult: "", //处理结果描述
- handleTime: "",
- inspectTime: "",
- imgUrl1: "",
- imgUrl2: "",
- imgUrl3: "",
- orgId: 0,
- taskId: 0,
- broadId: 0,
- remark: "", //附加描述
- isdenger: 0,
- }
- this.checkManualData = [{ //重置
- attUrl: [],
- dangerDescribe: "", //隐患描述
- fpdId: "",
- fpdResultCreateReqVOList: [], //传的当前事件
- hisResultCreateReqVOList: [],
- handleMethod: "", //处理方式
- handleResult: "", //处理结果描述
- handleTime: "",
- inspectTime: "",
- imgUrl1: "",
- imgUrl2: "",
- imgUrl3: "",
- orgId: 0,
- taskId: 0,
- broadId: 0,
- remark: "", //附加描述
- isdenger: 0,
- }]
- },
- checkPopupCancel() {
- this.maShow = false
- this.showManual = false
- this.manualPopup = false
- },
- // 隐藏键盘
- hideKeyboard() {
- uni.hideKeyboard();
- },
- addClick() {
- this.manualCheck = true
- },
- addClickDetail(val) {
- uni.navigateTo({
- url: `/pagesA/fire/check_inspection/inspect_detail/inspect_detail?id=${val}`,
- success: function(res) {
- res.eventChannel.emit('acceptDataFromOpenerPage', val);
- }
- })
- },
- },
- // 触底的事件
- onReachBottom() {
- // 判断是否还有下一页数据
- if (this.pageNo * this.pageSize >= this.total) return uni.showToast({
- title: `数据加载完毕`
- })
- // 判断是否正在请求其它数据,如果是,则不发起额外的请求
- if (this.loading) return
- this.pageNo += 1
- this.getData(this.pageNo)
- },
- }
- </script>
- <style>
- page {
- background-color: #F5F7F9;
- }
- </style>
- <style lang="scss" scoped>
- page {
- background-color: #F5F7F9 !important;
- }
- .tops {
- display: flex;
- justify-content: space-between;
- width: 80%;
- margin: 50rpx 10%;
- // 二维码扫描相关样式
- .qr-scan-containner {
- max-width: 600rpx;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- align-content: center;
- background-color: transparent;
- .qr-scan-middle {
- .qr-scan-title {
- font-size: 30rpx;
- text-align: center;
- padding: 20rpx 0;
- }
- max-width: 100%;
- }
- }
- }
- .tupian {
- width: 95rpx;
- height: 95rpx;
- }
- .tupians {
- width: 45rpx;
- height: 45rpx;
- }
- .tiantupian {
- width: 95rpx;
- height: 95rpx;
- }
- .cont {
- font-size: 16px;
- color: #4CB2B6;
- margin-bottom: 30rpx;
- }
- .text {
- text-align: center;
- color: #000;
- font-size: 26rpx;
- margin-left: 20rpx;
- }
- .text2 {
- text-align: center;
- color: #000;
- font-size: 22rpx;
- margin-top: 10rpx;
- }
- ::v-deep .u-icon__icon {
- margin-right: 0px !important;
- }
- .child {
- margin: 20rpx 0 0 20rpx;
- border-radius: 10rpx;
- .child-new {
- display: flex;
- .child-new-item {
- width: 30%;
- margin-top: 25%;
- transform: translateY(-50px);
- }
- .child-result {
- /deep/.data-v-525ecd67 {
- // width: 130rpx;
- height: 100rpx;
- }
- }
- }
- }
- .titles {
- padding: 20rpx 0;
- color: #383838;
- }
- .grid-item-box {
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 15px 0;
- }
- /deep/ .uni-grid-item {
- height: 140rpx !important;
- }
- /deep/.uni-textarea-textarea {
- border: 1px solid #4CB2B6;
- border-radius: 16rpx;
- }
- .btnList {
- display: flex
- }
- .main-content {
- /deep/.u-icon--right[data-v-172979f2],
- /deep/.u-icon--right.data-v-172979f2,
- .u-icon--right {
- // background-color: #f8f8f8;
- border-radius: 5rpx;
- position: absolute;
- top: -14rpx;
- right: 14rpx;
- }
- }
- /deep/.danwei.u-icon--right[data-v-172979f2],
- /deep/.danwei.u-icon--right.data-v-172979f2,
- .danwei.u-icon--right {
- top: 58rpx !important;
- right: 58rpx !important;
- }
- .uni-grid-wraps {
- margin-left: 60rpx;
- margin-bottom: 200rpx;
- }
- /deep/.u-slide-up-enter-active[data-v-39e33bf2],
- /deep/.u-slide-up-enter-active.data-v-39e33bf2,
- .u-slide-up-enter-active {
- height: 90% !important;
- overflow-y: auto;
- }
- .springFarm {
- margin-left: 40rpx;
- }
- .show-title {
- font-size: 32rpx;
- color: #383838;
- margin: 40rpx 0;
- }
- /deep/.u-modal {
- border: 1px solid #4CB2B6 !important;
- }
- .slot-contents {
- // margin-left: 40rpx;
- margin-bottom: 20rpx;
- border-radius: 1px solid #E5E5E5 !important;
- // background-color: #F0F2F3 !important;
- }
- /deep/ .slot-contents .uni-textarea-textarea {
- border: 1px solid #4CB2B6 !important;
- // background-color: #F0F2F3 !important;
- }
- .jieguo {
- /deep/.uni-textarea-textarea {
- border: none !important
- }
- }
- /deep/ .uni-textarea-placeholder {
- color: #a4a8ab;
- margin-top: 20rpx;
- margin-left: 30rpx;
- }
- .detail {
- // width: 72px;
- // height: 60rpx;
- float: right;
- border-radius: 30px;
- background-color: #F7C41E;
- margin-right: 20rpx;
- text-align: center;
- // line-height: 60rpx;
- padding: 3rpx 15rpx;
- }
- .an-niu {
- display: flex;
- justify-content: space-between;
- }
- /deep/.u-input {
- padding: 4px !important;
- }
- /deep/.canvasBox {
- .box {
- width: 600rpx;
- /* 设置扫码容器宽度 */
- height: 600rpx;
- /* 设置扫码容器高度 */
- }
- }
- .manual {
- font-size: 16px;
- padding: 25rpx 0;
- overflow-y: auto;
- }
- .manual-hand {
- margin-left: 30rpx;
- display: flex;
- font-size: 18px;
- color: #30746b;
- margin: 20rpx;
- }
- .manual-hand-item {
- display: flex;
- width: 90%;
- justify-content: space-between;
- margin-left: 3%;
- /deep/.u-input {
- border: 1px solid #726f74 !important;
- }
- }
- //隐患弹框
- /deep/.u-popup__content {
- overflow-y: auto;
-
- }
- .text-xl {
- font-size: 18px;
- font-weight: 600;
- }
- .person-forward {
- padding-top: 40rpx;
- display: flex;
- flex-direction: column;
- flex-wrap: wrap;
- overflow-y: auto;
- margin-bottom: 100rpx;
- }
- .example {
- overflow-y: auto;
- }
-
- /deep/.u-action-sheet {
- overflow-y: auto;
- }
- </style>
|