123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308 |
- <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.loading = false
- 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;
- }
- /deep/.u-popup__content {
- overflow-y: auto;
- }
- .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: 480rpx !important;
- // 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;
- }
- .manual:last-child{
- font-size: 25px;
- padding: 60rpx 0;
- background-color: red;
- }
- .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 {
- height: 90%;
- overflow-y: auto;
- }
- </style>
|