12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318 |
- <!-- 开始检查 -->
- <template>
- <view id="startChecking">
- <!--选择检查实验室-->
- <view class="startCheckingPage" v-if="pageType == 1">
- <view class="startCheckingPage-top-box">
- <view class="item-picker-box">
- <view class="name-p">房间号</view>
- <view class="span-p">*</view>
- <view class="picker-big-box">
- <view class="picker-box">
- <input class="picker-text" @click="popupClick(1)" type="text" disabled v-model="form.fjNumber" placeholder="请选择房间">
- <view class="img-box" @click.stop="saoCode">
- <img src="@/images/Version2.2/icon_aqjc_sm.png">
- </view>
- </view>
- </view>
- </view>
- <view class="item-picker-box">
- <view class="name-p">实验楼</view>
- <view class="span-p"></view>
- <view class="picker-big-box">
- <view class="picker-box picker-back">
- <input class="picker-text" type="text" disabled maxlength="11" v-model="form.buildingName" placeholder="选择房间后自动匹配">
- </view>
- </view>
- </view>
- <view class="item-picker-box">
- <view class="name-p">实验室</view>
- <view class="span-p"></view>
- <view class="picker-big-box">
- <view class="picker-box picker-back">
- <input class="picker-text" type="text" disabled maxlength="11" v-model="form.laboratoryName" placeholder="选择房间后自动匹配">
- </view>
- </view>
- </view>
- <view class="item-picker-box">
- <view class="name-p">负责人</view>
- <view class="span-p"></view>
- <view class="picker-big-box">
- <view class="picker-box picker-back">
- <input class="picker-text" type="text" disabled maxlength="11" v-model="form.fzrName" placeholder="选择房间后自动匹配">
- </view>
- </view>
- </view>
- <view class="item-picker-box">
- <view class="name-p">联系方式</view>
- <view class="span-p"></view>
- <view class="picker-big-box">
- <view class="picker-box">
- <input class="picker-text" type="number" maxlength="11" v-model="form.fzrLxfs" placeholder="请输入联系方式">
- </view>
- </view>
- </view>
- </view>
- <view class="startCheckingPage-bottom-button" @click="goButton(2)">确定</view>
- </view>
- <!--录入检查项-->
- <view class="check-item-page" v-if="pageType == 2">
- <!--录入检查项-->
- <view class="user-info-box" @click="goButton(1)">
- <view class="user-info-left">
- <view class="user-info-min-box">
- <img src="@/images/Version2.2/icon_aqjc_sysxx.png">
- <view>实验室信息</view>
- <view>{{form.laboratoryName}}</view>
- </view>
- <view class="user-info-min-box">
- <img src="@/images/Version2.2/icon-aqjc_fzr.png">
- <view>实验室负责人</view>
- <view>{{form.fzrName}}</view>
- </view>
- </view>
- <img class="user-info-right" src="@/images/icon_04.png">
- </view>
- <view class="check-for-max-box" v-if="minPageType == 1">
- <view class="check-for-big-box" v-for="(item,index) in form.detailsList" :key="index">
- <view class="check-for-button-max-box">
- <view class="left-title-p">检查项:</view>
- <uni-data-picker :ellipsis="false" :localdata="checkOptionList[index]" :map="{text:'name',value:'id'}"
- popup-title="请选择所属目录" @change="(e)=>onchange(e,index)" @nodeclick="onnodeclick"
- ref="uniDataPicker" :addType="true" :addIndex="index">
- <view class="button-text-p">{{item.jcxName?item.jcxName:'请选择检查项'}}</view>
- </uni-data-picker>
- </view>
- <view class="check-for-button-add-p" @click="dialogClick(index)"> 手动添加检查项 </view>
- <view class="check-for-img-max-box">
- <view class="left-title-p">隐患图片:</view>
- <view class="right-img-box">
- <view class="img-box" v-for="(imgUrl,imgIndex) in item.yhImg" :key="imgIndex">
- <img class="img-data" :src="configURL+imgUrl">
- <img class="position-img" src="@/images/icon_ssp_closure.png" @click="delImg(index,imgIndex)">
- </view>
- <img class="add-button" src="@/images/icon_07.png" @click="selectImage(item)" v-if="item.yhImg.length<5">
- </view>
- </view>
- <view class="check-for-input-max-box">
- <view class="left-title-p">隐患描述:</view>
- <textarea type="text" v-model="item.yhMs" maxlength="50" placeholder="请输入问题描述"></textarea>
- </view>
- <view class="voice">
- <view class="voice_t">语音备注:</view>
- <view class="voice_b" v-for="(voiceItem,voiceIndex) in item.voice" :key="voiceIndex">
- <view class="voice_b_l" @tap="voicePlay(voiceItem.url)"><img class="add-button" src="@/images/icon_yyt.png"/>{{voiceItem.times}}″</view>
- <img class="voice_b_r" src="@/images/Version2.3/icon_sczl_sc.png" @tap="voiceDele(index,voiceIndex)"/>
- </view>
- </view>
- <view class="broadcast_m">
- <view class="broadcast_m_t" :class="liveType?'broadcast_m_t_back_a':'broadcast_m_t_back_b'" @longpress.stop="recordButton(item,$event)" @touchmove.stop="cancelButton" @touchend.stop="sendButton(item,$event)">
- {{liveType?'松开发送':'按住说话'}}
- </view>
- </view>
-
- <view class="check-for-big-box-position-img-box"
- v-if="form.detailsList.length>1"
- @click="delDetailsList(index)">
- <img src="@/images/icon_ssp_closure.png">
- </view>
- </view>
- </view>
- <view class="add-for-item-p" @click="addDanger" v-if="minPageType == 1">+ 新增隐患项</view>
- <view class="check-button-box-one" v-if="minPageType == 1" @click="goMinButton(2)">下一步</view>
- <!--检查项详情-->
- <view class="danger-list-box" v-if="minPageType == 2" @click="goMinButton(1)">
- <img class="danger-list-left-img" src="@/images/Version2.2/icon_aqjc_yhsl.png">
- <view class="danger-list-left-text">隐患数量</view>
- <view class="danger-list-left-num">{{form.detailsList.length}}</view>
- <img class="danger-list-right-img" src="@/images/icon_04.png">
- </view>
- <view class="danger-title-text-p" v-if="minPageType == 2">整改选项</view>
- <view class="danger-info-picker-max-box" v-if="minPageType == 2">
- <view class="danger-info-picker-box">
- <view class="danger-info-picker-title">截止时间</view>
- <picker mode="date" @change="deadlineChange">
- <input class="picker-text" disabled type="text" v-model="deadline" placeholder="请选择截止时间">
- </picker>
- </view>
- <view class="danger-info-picker-box">
- <view class="danger-info-picker-title">整改类型</view>
- <picker @change="rectificationTypeChange" :range="rectificationTypeArray">
- <input class="picker-text" disabled type="text" v-model="rectificationType" placeholder="请选择整改类型">
- </picker>
- </view>
- <view class="danger-info-picker-box">
- <view class="danger-info-picker-title">检查单位</view>
- <picker @change="inspectionUnitChange" :range="inspectionUnitArray">
- <input class="picker-text" disabled type="text" v-model="inspectionUnit" placeholder="请选择检查单位">
- </picker>
- </view>
- </view>
- <!-- 检查名称弹窗 -->
- <uni-popup ref="popup" class="inspect_name" type="bottom">
- <view class="popup-content">
- <view class="inspect_name_t">
- <view class="inspect_name_t_l">检查名称:</view>
- <input type="text" v-model="form.checkName" maxlength="20" placeholder="请输入检查名称"/>
- </view>
- <view class="inspect_name_b" @click="releaseFun()">发布</view>
- </view>
- </uni-popup>
- <view class="check-button-box" v-if="minPageType == 2">
- <view @click="upDataClick(1)">保存草稿</view>
- <view @click="upDataClick(2)">提交检查</view>
- </view>
- </view>
- <!--搜索项-->
- <view class="search-max-box" v-if="pageType == 3">
- <view class="search-top-input-box">
- <input type="text" maxlength="14" placeholder="请输入检查项关键字" @confirm="inputSearch">
- </view>
- <scroll-view scroll-y @scrolltolower="inputSearch" class="scroll-box">
- <view class="search-for-box" v-for="(item,index) in searchList" :key="index">
- <view>{{item.name}}</view>
- <view>{{item.text}}</view>
- </view>
- <view class="search-add-item" v-if="searchList[0]">
- <view>没有找到对应的检查项</view>
- <view>手动添加 >></view>
- </view>
- <view class="search-null-box" v-if="searchNullType">
- <img src="@/images/Version2.2/icon_xzwt_kzt.png">
- <view>没有找到对应的问题~</view>
- <view>手动添加</view>
- </view>
- </scroll-view>
- </view>
- <!-- 添加项 -->
- <view class="add-search-max-box" v-if="open">
- <view class="add-search-min-box">
- <view class="add-search-box">
- <view class="add-search-title">检查项名称</view>
- <textarea class="add-search-input" type="text" v-model="examinationForm.name" maxlength="30" placeholder="请输入问题名称"></textarea>
- </view>
- <view class="add-search-box">
- <view class="add-search-title">所属目录</view>
- <uni-data-picker :ellipsis="false" :localdata="checkOptionListExamination" :map="{text:'name',value:'id'}"
- popup-title="请选择所属目录" @change="onchangeTwo" @nodeclick="onnodeclickTwo" >
- <view class="add-search-picker">{{examinationForm.value?examinationForm.value:'请选择所属目录'}}</view>
- </uni-data-picker>
- </view>
- </view>
- <view class="add-search-button">
- <view @click="dialogClickOff">返回</view>
- <view @click="addPopupTwoButtonClick">立即添加</view>
- </view>
- </view>
- <!-- 房间选择弹出层 -->
- <view class="popup-max-box" v-if="popupType">
- <view class="popup-null" @click="popupClick(2)"></view>
- <view class="popup-big-box">
- <view class="popup-input-box">
- <input type="text" maxlength="10" v-model="room" placeholder="请输入房间号">
- <view @click="getSelectInfoByRoom">搜索</view>
- </view>
- <view class="popup-for-max-box">
- <view class="popup-for-null" v-if="!roomList[0]">暂无数据</view>
- <view class="popup-for-box" v-for="(item,index) in roomList" :key="index">
- <view class="name-p">{{item.name}} ({{item.room}})</view>
- <view class="button-p" @click="popupClickItem(item)">确定</view>
- </view>
- </view>
- </view>
- </view>
- <!-- 联级选择器(废弃) -->
- <!-- <view class="popup-max-box-two" v-if="popupTwoType">
- <view class="popup-null" @click="popupTwoClick(2)"></view>
- <view class="popup-big-box">
- <view class="popup-two-title-box">检查项</view>
- <view class="popup-position-right" @click="popupTypeClick">{{isLingshi == 0?'手动添加':'选择已有'}}</view>
- <view class="popup-add-name-box" v-if="isLingshi == 1">
- <view>检查项名称:</view>
- <input type="text" v-model="addPopupName" placeholder="请输入检查项名称" maxlength="50">
- </view>
- <view class="popup-top-box">
- <view v-if="!popupTopList[0]" style="text-align: center;color:#999;">{{isLingshi == 0?'请选择检查项':'请选择所属目录'}} </view>
- <view @click="popupTwoMinItemClick(item,index)" :class="index==popupIndex?'view-inline-block-color':''" v-for="(item,index) in popupTopList" :key="index">{{index==0?item.name:'/'+item.name}}</view>
- </view>
- <view class="popup-for-max-box">
- <view class="popup-for-box" v-for="(item,index) in popupBottomList" :key="index">
- <img v-if="item.id == popupMinIndex" class="left-img" src="@/images/icon_6.png">
- <img v-if="item.id != popupMinIndex" class="left-img" src="@/images/icon_5.png">
- <view class="center-view" @click="popupTwoItemClick(item)">{{item.name}}</view>
- <view class="right-img-box" @click="popupTwoImgClick(item)">
- <img v-if="item.children" class="right-img" src="@/images/icon_04.png">
- </view>
- </view>
- </view>
- <view class="popup-button" @click="popupTwoButtonClick" v-if="isLingshi == 0"
- :class="popupMinIndex?'popup-button-colorA':'popup-button-colorB'">确定</view>
- <view class="popup-button" @click="addPopupTwoButtonClick" v-if="isLingshi == 1"
- :class="popupMinIndex&&addPopupName?'popup-button-colorA':'popup-button-colorB'">添加</view>
- </view>
- </view> -->
- </view>
- </template>
- <script>
- const myaudio = uni.createInnerAudioContext();
- import { config } from '@/api/request/config.js'
- import { checkRecordAddC,checkRecordAdd,getSelectInfoByRoom, checkOptionList, treeselect,treeDepselect, addTempCheckOption,recordDettailsList,checkRecordUpdate } from '@/api/index.js'
- export default {
- name: "startChecking",
- data() {
- return {
- configURL:config.base_url,
- id:"",
- submitStatus:null,
- //当前隐患
- popupTwoIndex:"",
- //新增项or固有
- isLingshi:0,
- //新增名称
- addPopupName:"",
- //联级选择器
- popupTwoType:false,
- popupTopList:[],
- popupBottomList:[],
- popupIndex:0,
- popupMinIndex:"",
- popupIndexType:true,
- popupData1:{},
- popupData2:{},
- popupData3:{},
- popupData4:{},
- //房间弹层 状态
- popupType:false,
- //房间搜索字段
- room:"",
- roomList:[],
- //页面状态
- pageType:1,
- //页面子状态
- minPageType:1,
- //数据
- form:{
- checkName:'',//检查名称
- fjNumber:"",
- buildingId:"",
- buildingName:"",
- laboratoryId:"",
- laboratoryName:"",
- fzrId:"",
- fzrName:"",
- fzrLxfs:"",
- jcDw:"",
- detailsList:[
- {
- isLingshi:0,
- yhImg:[],
- voice:[],//语音备忘存储
- yhMs:"",
- jcxId:"",
- jcxName:"",
- }
- ],
- },
- //检查项
- userData:{
- name:"第一教学楼-101号",
- userName:"刘轩宇"
- },
- //检查列表项
- forDataList:[
- {
- dangerImg:[],
- dangerText:"",
- dangerId:"",
- dangerName:"请选择对应检查项",
- }
- ],
- //检查详情选项数据
- deadline:"",
- rectificationType:"",
- rectificationTypeArray:['一般整改','重大整改'],
- inspectionUnit:"",
- inspectionUnitArray:[],
- inspectionUnitArrayData:[],
- //搜索回调列表
- searchList:[
- // {
- // name:"检查项名称",
- // text:"一级检查项名称内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容",
- // },
- // {
- // name:"检查项名称",
- // text:"一级检查项名称内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容",
- // },
- // {
- // name:"检查项名称",
- // text:"一级检查项名称内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容",
- // },
- ],
- searchNullType:true,
- //检查项
- checkOptionList:[],
- checkOptionListExamination:[],
- //新增检查项
- openIndex:"",
- open:false,
- examinationForm:{
- name:"",
- value:"",
- idList:"",
- },
- jcxSstkMs:[],
- jcxSstkNum:'',
- //临时数据组
- temporaryIdList:[],
- //添加项 目录
- uniPicker:"请选择所属目录",
- //滑动记录
- startPoint:{},
- liveType:false,
- sendLock: true, //发送锁,当为true时上锁,false时解锁发送
- recorderManager : wx.getRecorderManager(),
- temporaryData:[],
- }
- },
- onLoad(option) {
- this.getCheckOptionListTwo();
- this.treeselect();
- if(option.id){
- this.id = option.id;
- this.getInfo();
- }else{
- this.getCheckOptionList();
- }
- },
- onShow() {
- },
- methods: {
- //语音备忘播放
- async voicePlay(item){
- myaudio.src = config.base_url+item;
- myaudio.play();
- },
- //语音备忘删除
- async voiceDele(index,voiceIndex){
- let self = this;
- uni.showModal({
- title: '',
- cancelColor:'#999999',
- confirmColor:'#FF6E6E',
- content: '确定删除此语音吗?',
- success (res) {
- if (res.confirm) {
- console.log('用户点击确定')
- self.form.detailsList[index].voice.splice(voiceIndex,1);
- self.$forceUpdate();
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- }
- })
- },
- //录制
- recordButton(item,e){
- console.log("按下")
- let self = this;
- if(item.voice.length>=5){
- uni.showToast({
- title: '语音备忘最多只能上传5条',
- icon:"none",
- mask:true,
- duration: 2000
- });
- return
- }
- this.liveType=true;
- console.log('录制',e)
- this.startPoint = e.touches[0];//记录长按时开始点信息,后面用于计算上划取消时手指滑动的距离。
- const options = {
- duration: 60000,
- sampleRate: 16000,
- numberOfChannels: 1,
- encodeBitRate: 48000,
- format: 'mp3',
- frameSize: 50
- }
- this.recorderManager.start(options);//开始录音
- this.recorderManager.onStart(() => {
- console.log('recorder start')
- })
- this.recorderManager.onError((res) => {
- console.log(res);
- })
- wx.showToast({
- title: "正在录音,上划取消发送",
- icon: "none",
- duration: 60000//先定义个60秒,后面可以手动调用wx.hideToast()隐藏
- });
- this.sendLock = false;//长按时是不上锁的。
- },
- //取消
- cancelButton(e){
- console.log("移动")
- let self = this;
- this.liveType=false;
- console.log('取消',e)
- let moveLenght = e.touches[e.touches.length - 1].clientY - this.startPoint.clientY; //移动距离
- if (Math.abs(moveLenght) > 50) {
- wx.showToast({
- title: "松开手指,取消发送",
- icon: "none",
- duration: 60000
- });
- this.sendLock = true;//触发了上滑取消发送,上锁
- } else {
- wx.showToast({
- title: "正在录音,上划取消发送",
- icon: "none",
- duration: 60000
- });
- this.sendLock = false;//上划距离不足,依然可以发送,不上锁
- }
- },
- //发送
- sendButton(item,e){
- console.log("松开")
- let self = this;
- this.liveType=false;
- console.log('发送',e)
- wx.hideToast();//结束录音、隐藏Toast提示框
- this.recorderManager.stop();//结束录音
- this.recorderManager.onStop((res) => {
- if(!this.sendLock){
- this.uploadVoice(item,res.duration,res.tempFilePath);
- }
- console.log('停止录音', res.tempFilePath)
- console.log("sendLock",this.sendLock);
- })
- },
- //上传MP3
- async uploadVoice(item,times,tempFilePaths){
- var self = this;
- uni.uploadFile({
- url: config.base_url+'/file/upload', //仅为示例,非真实的接口地址
- header:{'Authorization':uni.getStorageSync('token')},
- filePath: tempFilePaths,
- name: 'file',
- formData: {
- 'user': 'test'
- },
- success: (uploadFileRes) => {
- let res = JSON.parse(uploadFileRes.data);
- if(res.code == 200){
- console.log("上传成功",res)
- console.log(item)
- let seconds = Math.round((parseInt(times) % (1000 * 60)) / 1000);
- item.voice.push({'times':seconds,'url':res.data.url})
- console.log(JSON.stringify(self.voice))
- //self.textParseUrlIps(res.data.url);
- // self.newData.imgList.push(res.data.url);
- }else{
- uni.showToast({
- title: res.msg,
- icon:"none",
- mask:true,
- duration: 2000
- });
- }
- },
- fail: err => {
- uni.hideLoading()
- },
- complete: () => {
- }
- });
- },
- //搜索特定检查项
- async searchClick(text,index){
- console.log("搜索text",text);
- console.log("搜索index",index);
- let newObj = {
- level:4,
- searchValue:text
- }
- const {data} = await checkOptionList(newObj);
- if(data.code == 200){
- if(data.data[0]){
- let list = JSON.parse(JSON.stringify(this.checkOptionList));
- list[index] = this.getTreeData(data.data);
- this.$set(this,'checkOptionList',JSON.parse(JSON.stringify(list)))
- console.log('this.$refs.uniDataPicker',this.$refs.uniDataPicker)
- this.$refs.uniDataPicker[index].show();
- }else{
- uni.showToast({
- title: '未找到相关检查项',
- icon:"none",
- mask:true,
- duration: 2000
- });
- }
- }
- },
- //重置检查项
- async resetClick(index){
- console.log("重置index",index);
- let newObj = {
- level:4,
- }
- const {data} = await checkOptionList(newObj);
- if(data.code == 200){
- let list = JSON.parse(JSON.stringify(this.checkOptionList));
- list[index] = this.getTreeData(data.data);
- this.$set(this,'checkOptionList',JSON.parse(JSON.stringify(list)))
- this.$refs.uniDataPicker[index].show();
- }
- },
- async getInfo(){
- let self = this;
- let obj = {
- id:this.id
- };
- const {data} = await recordDettailsList(obj);
- if(data.code == 200){
- let obj = JSON.parse(JSON.stringify(data.data));
- console.log('详情',obj)
- console.log(obj.yhlist[0].voice)
- console.log(JSON.parse(obj.yhlist[0].voice))
- for(let i=0;i<obj.yhlist.length;i++){
- /* 语音格式转换*/
- obj.yhlist[i].voice=JSON.parse(obj.yhlist[i].voice)
- let text = "";
- if(obj.yhlist[i].level1){
- text = text + obj.yhlist[i].level1;
- }
- if(obj.yhlist[i].level2){
- text = text + '/'+ obj.yhlist[i].level2;
- }
- if(obj.yhlist[i].level3){
- text = text + '/'+ obj.yhlist[i].level3;
- }
- if(obj.yhlist[i].level4){
- text = text + '/'+ obj.yhlist[i].level4;
- }
- obj.yhlist[i].level = text;
- if(obj.yhlist[i].yhImg){
- if(obj.yhlist[i].yhImg[i]){
- obj.yhlist[i].yhImg = obj.yhlist[i].yhImg.split(",");
- }
- }
- if(obj.yhlist[i].zmClImg){
- if(obj.yhlist[i].zmClImg[i]){
- obj.yhlist[i].zmClImg = obj.yhlist[i].zmClImg.split(",");
- }
- }
- if(obj.yhlist[i].yhZghImg){
- if(obj.yhlist[i].yhZghImg[i]){
- obj.yhlist[i].yhZghImg = obj.yhlist[i].yhZghImg.split(",");
- }
- }
- }
- for(let i=0;i<obj.yhlist.length;i++){
- if(obj.yhlist[i].isLingshi == 1){
- let list = JSON.parse(JSON.stringify(this.checkOptionList));
- let minObj = {
- id:parseInt(obj.yhlist[i].jcxId+''),
- name:obj.yhlist[i].jcxName,
- }
- list.push(minObj);
- this.$set(this,'checkOptionList',JSON.parse(JSON.stringify(list)));
- this.temporaryIdList.push(obj.yhlist[i].jcxId);
- }
- this.getCheckOptionList();
- }
- let newOjb = obj.record;
- newOjb.detailsList = obj.yhlist;
- this.$set(this,'deadline',newOjb.zgjzTime);
- if(newOjb.zgType == 0){
- this.$set(this,'rectificationType','一般整改');
- }else if(newOjb.zgType == 1){
- this.$set(this,'rectificationType','重大整改');
- }
- for(let i=0;i<self.inspectionUnitArrayData.length;i++){
- if(self.inspectionUnitArrayData[i].id == newOjb.jcDw){
- this.$set(this,'inspectionUnit',self.inspectionUnitArrayData[i].label);
- }
- }
- this.$set(this,'form',newOjb);
- }
- },
- //确认搜索房间
- popupClickItem(item){
- this.$set(this.form,"fjNumber",item.room)
- this.$set(this.form,"deptName",item.deptName)
- this.$set(this.form,"buildingId",item.building)
- this.$set(this.form,"deptId",item.deptId)
- this.$set(this.form,"laboratoryId",item.id)
- this.$set(this.form,"buildingName",item.buildName)
- this.$set(this.form,"laboratoryName",item.name)
- this.$set(this.form,"fzrId",item.userId)
- this.$set(this.form,"fzrName",item.safeUserName)
- this.$set(this.form,"fzrLxfs",item.safeUserPhone)
- this.popupType = false;
- },
- //联级选择器开关
- popupTwoClick(type,index){
- if(type == 1){
- this.isLingshi = 0;
- this.popupTwoIndex = index;
- this.addPopupName = "";
- this.popupBottomList = JSON.parse(JSON.stringify(this.checkOptionList))
- this.popupTwoType = true;
- }else if(type == 2){
- this.popupTwoType = false;
- }
- },
- //联级选择器添加/选择已有 切换
- popupTypeClick(){
- if(this.isLingshi == 0){
- this.isLingshi = 1;
- }else{
- this.isLingshi = 0;
- }
- },
- //搜索房间弹层开关
- popupClick(type){
- if(type == 1){
- this.room = "";
- this.roomList = [];
- this.popupType = true;
- }else if(type == 2){
- this.popupType = false;
- }
- },
- //搜索房间接口
- async getSelectInfoByRoom(){
- let self = this;
- if(!this.room){
- uni.showToast({
- title: '请输入要搜索房间号',
- icon:"none",
- mask:true,
- duration: 2000
- });
- return
- }
- const {data} = await getSelectInfoByRoom(this.room);
- if(data.code==200){
- if(data.data[0]){
- this.roomList = data.data;
- }else{
- uni.showToast({
- title: '未找到相关房间',
- icon:"none",
- mask:true,
- duration: 2000
- });
- }
- }
- },
- //主页面切换
- goButton(type){
- if(type == 1){
- this.pageType = 1;
- }else if(type == 2){
- if(!this.form.fjNumber){
- uni.showToast({
- title: '请选择房间',
- icon:"none",
- mask:true,
- duration: 2000
- });
- return
- }
- this.pageType = 2;
- }
- },
- //调用摄像头
- saoCode(){
- let self = this;
- uni.scanCode({
- onlyFromCamera: true,
- success: function (res) {
- if(res.result.indexOf("code") != -1 && res.result.indexOf("-") != -1 && res.result.indexOf("&") != -1){
- let codeRoom = "";
- let newList = res.result.split("?")[1].split("&")
- let list = newList[0].split("=")[1].split("-")
- codeRoom = list[1];
- if(codeRoom){
- self.roomList = [];
- self.room = codeRoom;
- self.getSelectInfoByRoom();
- self.popupType = true;
- }else{
- uni.showToast({
- title: '请扫描正确的二维码',
- icon:"none",
- mask:true,
- duration: 2000
- });
- }
- }else{
- uni.showToast({
- title: '请扫描正确的二维码',
- icon:"none",
- mask:true,
- duration: 2000
- });
- }
- }
- });
- },
- /**************************检查项***************************/
- //检查项初始化
- initialization(){
- this.popupTopList = [];
- this.popupBottomList = [];
- this.popupIndex = 0;
- this.popupMinIndex = "";
- this.popupIndexType = true;
- this.popupData1 = {};
- this.popupData2 = {};
- this.popupData3 = {};
- this.popupData4 = {};
- this.$forceUpdate();
- },
- //检查项确定按钮
- popupTwoButtonClick(){
- let self = this;
- if(!this.popupMinIndex){
- uni.showToast({
- title: '请选择检查项',
- icon:"none",
- mask:true,
- duration: 2000
- });
- return
- }
- let list = [];
- for(let i=0;i<self.popupTopList.length;i++){
- list.push(self.popupTopList[i].id);
- }
- let num = 0;
- for(let i=0;i<self.temporaryIdList.length;i++){
- if(self.temporaryIdList[i] == self.popupTopList[self.popupTopList.length-1].id){
- num++
- }
- }
- if(num == 0){
- this.$set(this.form.detailsList[this.popupTwoIndex],'isLingshi',0);
- }else{
- this.$set(this.form.detailsList[this.popupTwoIndex],'isLingshi',1);
- }
- this.form.detailsList[this.popupTwoIndex].jcxId = JSON.parse(JSON.stringify(list))
- this.form.detailsList[this.popupTwoIndex].jcxName = JSON.parse(JSON.stringify(self.popupTopList[self.popupTopList.length-1].name))
- this.popupTwoType = false;
- this.initialization();
- },
- //已选中检查项点击事件
- popupTwoMinItemClick(item,index){
- if(this.popupIndex != index){
- this.popupIndex = index;
- console.log("index",index)
- if(index == 0){
- this.popupData2 = {};
- this.popupData3 = {};
- this.popupData4 = {};
- this.popupTopList.splice(1,3);
- this.popupBottomList = this.popupData1;
- }else if(index == 1){
- this.popupData3 = {};
- this.popupData4 = {};
- this.popupTopList.splice(2,2);
- this.popupBottomList = this.popupData2;
- }else if(index == 2){
- this.popupData4 = {};
- this.popupTopList.splice(3,1);
- this.popupBottomList = this.popupData3;
- }
- this.popupMinIndex = "";
- this.$forceUpdate();
- }
- },
- //选中检查项
- popupTwoItemClick(item){
- let obj = {
- name:item.name,
- id:item.id
- }
- if(this.popupIndexType){
- if(this.popupTopList[0]){
- this.popupIndex++
- }
- this.popupTopList.push(obj);
- }else{
- this.popupTopList[this.popupTopList.length-1] = obj;
- }
- this.popupMinIndex = obj.id;
- this.popupIndexType = false;
- this.$forceUpdate();
- },
- //查看检查项下一级
- popupTwoImgClick(item){
- if(item.children){
- let obj = {
- name:item.name,
- id:item.id
- }
- if(this.popupIndexType){
- if(this.popupTopList[0]){
- this.popupIndex++
- }
- this.popupTopList.push(obj);
- }else{
- this.popupTopList[this.popupTopList.length-1] = obj
- }
- if(this.popupIndex == 0){
- this.popupData1 = JSON.parse(JSON.stringify(this.popupBottomList))
- }else if(this.popupIndex == 1){
- this.popupData2 = JSON.parse(JSON.stringify(this.popupBottomList))
- }else if(this.popupIndex == 2){
- this.popupData3 = JSON.parse(JSON.stringify(this.popupBottomList))
- }else if(this.popupIndex == 3){
- this.popupData4 = JSON.parse(JSON.stringify(this.popupBottomList))
- }
- this.popupBottomList = JSON.parse(JSON.stringify(item.children))
- this.popupMinIndex = "";
- this.popupIndexType = true;
- this.$forceUpdate();
- }
- },
- //获取检查项
- async getCheckOptionList() {
- let newObj = {
- level:4,
- }
- const {data} = await checkOptionList(newObj);
- if(data.code == 200){
-
- let list = this.getTreeData(data.data);
- this.checkOptionList.push(JSON.parse(JSON.stringify(list)));
- }
- },
- async getCheckOptionListTwo() {
- let newObj = {
- level:3,
- }
- const {data} = await checkOptionList(newObj);
- if(data.code == 200){
- let list = this.getTreeData(data.data);
- this.checkOptionListExamination = JSON.parse(JSON.stringify(list));
- }
- },
- //获取检查单位
- /* async treeselect() {
- let self = this;
- const {data} = await treeselect({});
- if(data.code == 200){
- let list = [];
- for(let i=0;i<data.data[0].children.length;i++){
- let obj = {
- id:data.data[0].children[i].id,
- label:data.data[0].children[i].label,
- }
- self.inspectionUnitArray.push(data.data[0].children[i].label)
- list.push(obj);
- for(let o=0;o<data.data[0].children[i].children.length;o++){
- let obj = {
- id:data.data[0].children[i].children[o].id,
- label:data.data[0].children[i].children[o].label,
- }
- self.inspectionUnitArray.push(data.data[0].children[i].children[o].label)
- list.push(obj);
- }
- }
- this.inspectionUnitArrayData = list;
- }
- }, */
- async treeselect() {
- let self = this;
- const {data} = await treeselect({});
- if(data.code == 200){
- let list = [];
- for(let i=0;i<data.data[0].children.length;i++){
- let obj = {
- id:data.data[0].children[i].id,
- label:data.data[0].children[i].label,
- }
- if(data.data[0].children[i].children){
- for(let o=0;o<data.data[0].children[i].children.length;o++){
- let obj = {
- id:data.data[0].children[i].children[o].id,
- label:data.data[0].children[i].children[o].label,
- }
- self.inspectionUnitArray.push(data.data[0].children[i].children[o].label)
- list.push(obj);
- }
- }else{
- self.inspectionUnitArray.push(data.data[0].children[i].label)
- list.push(obj);
- }
- }
- this.inspectionUnitArrayData = list;
- }
- },
- getTreeData(data){
- for(var i=0;i<data.length>0;i++){
- if(data[i].children == null||data[i].children.length<=0){
- // children若为空数组,则将children设为undefined
- data[i].children = undefined;
- }else {
- // children若不为空数组,则继续 递归调用 本方法
- this.getTreeData(data[i].children);
- }
- }
- return data;
- },
- // 图片上传
- selectImage(item) {
- let self = this;
- if(item.yhImg.length>4){
- uni.showToast({
- title: '最多上传5张图片',
- icon:"none",
- mask:true,
- duration: 2000
- });
- return
- }
- wx.chooseImage({
- count: 1,
- sizeType: ["original", "compressed"],
- sourceType: ["album", "camera"],
- success: function(res) {
- let tempFilePaths = res.tempFilePaths[0];
- self.uploadImg(tempFilePaths,item);
- }
- });
- },
- async uploadImg(tempFilePaths,item){
- var self = this;
- uni.showLoading({
- title: '上传中',
- mask: true
- });
- uni.uploadFile({
- url: config.base_url+'/file/upload', //仅为示例,非真实的接口地址
- header:{'Authorization':uni.getStorageSync('token')},
- filePath: tempFilePaths,
- name: 'file',
- formData: {
- 'user': 'test'
- },
- success: (uploadFileRes) => {
- let res = JSON.parse(uploadFileRes.data);
- if(res.code == 200){
- item.yhImg.push(res.data.url);
- console.log(res.data.url)
- }else{
- uni.showToast({
- title: res.msg,
- icon:"none",
- mask:true,
- duration: 2000
- });
- }
- },
- fail: err => {},
- complete: () => {
- uni.hideLoading()
- }
- });
- },
- //删除图片
- delImg(index,minIndex){
- this.form.detailsList[index].yhImg.splice(minIndex,1);
- this.$forceUpdate();
- },
- //添加隐患
- addDanger(){
- if(this.form.detailsList.length>19){
- uni.showToast({
- title: '最多添加20个隐患',
- icon:"none",
- mask:true,
- duration: 2000
- });
- return
- }
- let obj = {
- isLingshi:0,
- yhImg:[],
- voice:[],
- yhMs:"",
- jcxId:"",
- jcxName:"",
- }
- this.form.detailsList.push(obj);
- this.getCheckOptionList();
- this.$forceUpdate();
- },
- //删除隐患
- delDetailsList(index){
- this.form.detailsList.splice(index,1);
- this.$forceUpdate();
- },
- //子页面切换
- goMinButton(type){
- let self = this;
- if(type == 1){
- this.minPageType = 1;
- }else if(type == 2){
- for(let i=0;i<self.form.detailsList.length;i++){
- console.log(self.form.detailsList[i])
- console.log(typeof(self.form.detailsList[i].yhMs))
- console.log(typeof(self.form.detailsList[i].voice))
- let num = i+1;
- // if(!self.form.detailsList[i].yhImg[0]){
- // uni.showToast({
- // title: '第'+num+'个隐患项未上传图片',
- // icon:"none",
- // mask:true,
- // duration: 2000
- // });
- // return
- // }else
- /* if(!self.form.detailsList[i].yhMs){
- uni.showToast({
- title: '第'+num+'未填写隐患描述',
- icon:"none",
- mask:true,
- duration: 2000
- });
- return
- }else */ if(!self.form.detailsList[i].jcxName){
- uni.showToast({
- title: '第'+num+'未选择隐患项',
- icon:"none",
- mask:true,
- duration: 2000
- });
- return
- }else if(!self.form.detailsList[i].yhMs && self.form.detailsList[i].voice.length<=0){
- uni.showToast({
- title: '请输入第'+num+'项隐患描述!',
- icon:"none",
- mask:true,
- duration: 2000
- });
- return
- }
- }
- this.minPageType = 2;
- }
- },
- //整改类型选中事件
- rectificationTypeChange(e){
- if(e.target.value == 0){
- this.rectificationType = "一般整改";
- }else if(e.target.value == 1){
- this.rectificationType = "重大整改";
- }
- this.form.zgType = e.target.value;
- },
- //检查单位选中事件
- inspectionUnitChange(e){
- this.form.jcDw = this.inspectionUnitArrayData[e.target.value].id;
- this.form.jcDwName = this.inspectionUnitArrayData[e.target.value].label;
- this.inspectionUnit = this.inspectionUnitArrayData[e.target.value].label;
- },
- //截止时间选中事件
- deadlineChange(e){
- let time = e.target.value.replace(/-/g, '/')
- time = Date.parse(time)
- let time2 = new Date().setHours(0,0,0,0)
- if(time<time2){
- uni.showToast({
- title: '请选择今天或以后的时间',
- icon:"none",
- mask:true,
- duration: 2000
- });
- return
- }
- console.log('picker发送选择改变,携带值为', e.target.value)
- this.form.zgjzTime = e.target.value;
- this.deadline = e.target.value
- },
- //发布
- async releaseFun(){
- let self=this;
-
- let type=this.submitStatus;
-
- let obj = JSON.parse(JSON.stringify(this.form))
-
- for(let i=0;i<obj.detailsList.length;i++){
- if(obj.detailsList[i].jcxName.indexOf("/") != -1){
- let list = obj.detailsList[i].jcxName.split("/");
- obj.detailsList[i].jcxName = list[list.length-1];
- }
- obj.detailsList[i].jcxId = obj.detailsList[i].jcxId + ',';
- obj.detailsList[i].yhImg = obj.detailsList[i].yhImg + '';
- obj.detailsList[i].voice = JSON.stringify(obj.detailsList[i].voice);
-
- }
-
- obj.zgStatus = 0;
-
- if(self.id){
- obj.isCg=0;
- obj.isFabu=1;
- const {data} = await checkRecordUpdate(obj);
- if(data.code == 200){
- uni.showToast({
- title: type == 1?'保存草稿成功':(type == 2?'提交成功':''),
- icon:"none",
- mask:true,
- duration: 2000
- });
- setTimeout(function(){
- uni.navigateBack();
- },2000);
- }
- }else{
- self.saveSubmit(obj,type)
- }
- },
- //保存草稿
- async saveDraft(obj,type){
- obj.isCg=1;
- const {data} = await checkRecordAddC(obj);
- if(data.code == 200){
- uni.showToast({
- title: type == 1?'保存草稿成功':(type == 2?'提交成功':''),
- icon:"none",
- mask:true,
- duration: 2000
- });
- setTimeout(function(){
- uni.navigateBack();
- },2000);
- }
- },
- //立即提交
- async saveSubmit(obj,type){
-
- obj.isCg=0;
- obj.isFabu=1;
-
- const {data} = await checkRecordAdd(obj);
- if(data.code == 200){
- uni.showToast({
- title: type == 1?'保存草稿成功':(type == 2?'提交成功':''),
- icon:"none",
- mask:true,
- duration: 2000
- });
- setTimeout(function(){
- uni.navigateBack();
- },2000);
- }
- },
-
- //提交接口
- async upDataClick(type){
- let self = this;
- this.submitStatus=type;//提交检查和保存草稿箱按钮点击状态保存
- if(!this.form.zgjzTime){
- uni.showToast({
- title: '请选择整改时间',
- icon:"none",
- mask:true,
- duration: 2000
- });
- return
- }
- if(this.form.zgType != 0 && this.form.zgType != 1){
- uni.showToast({
- title: '请选择整改类型',
- icon:"none",
- mask:true,
- duration: 2000
- });
- return
- }
- if(!this.form.jcDw){
- uni.showToast({
- title: '请选择检查单位',
- icon:"none",
- mask:true,
- duration: 2000
- });
- return
- }
-
- let isVoice=false;
- let obj = JSON.parse(JSON.stringify(this.form))
-
- for(let i=0;i<obj.detailsList.length;i++){
- if(obj.detailsList[i].jcxName.indexOf("/") != -1){
- let list = obj.detailsList[i].jcxName.split("/");
- obj.detailsList[i].jcxName = list[list.length-1];
- }
- obj.detailsList[i].jcxId = obj.detailsList[i].jcxId + ',';
- obj.detailsList[i].yhImg = obj.detailsList[i].yhImg + '';
- obj.detailsList[i].voice = JSON.stringify(obj.detailsList[i].voice);
-
- }
- if(type==1){//保存草稿
- self.saveDraft(obj,type)
- }else if(type==2){//提交
- //如果有语音备注,提示
- this.form.detailsList.forEach(function(item){
- if(!item.yhMs && item.voice.length>=0){
- isVoice=true;
- console.log('没有备注,但是有语音')
- return
- }else{
- isVoice=false;
- }
- })
- if(isVoice==true){//有语音
-
- uni.showModal({
- title: '',
- cancelText:'保存草稿',
- cancelColor:'#999999',
- confirmColor:'#0183FA',
- confirmText:'继续发布',
- content: '当前隐患描述使用语音备注,可以补充文字描述后提交发布或者 保存草稿箱后续发布?',
- success (res) {
- if (res.confirm) {
- console.log('继续发布')
- self.minPageType=1;
- } else if (res.cancel) {
- console.log('保存草稿')
- self.saveDraft(obj,type)
-
- }
- }
- })
- }else{
- console.log('没有语音')
- self.$refs.popup.open()
-
- }
- }
-
-
-
- },
- /**************************搜索项***************************/
- //搜索
- inputSearch(event){
- console.log("e",event.detail.value)
- },
- //选中固有检查项(新)
- onchange(e,index) {
- let self = this;
- let val = e.detail.value[e.detail.value.length-1].value
- let num = 0;
- for(let i=0;i<self.temporaryIdList.length;i++){
- if(self.temporaryIdList[i] == val){
- num++
- }
- }
- if(num == 0){
- this.$set(this.form.detailsList[index],'isLingshi',0);
- }else{
- this.$set(this.form.detailsList[index],'isLingshi',1);
- }
- let list = [];
- let listName=[];
- for(let i=0;i<e.detail.value.length;i++){
- list.push(e.detail.value[i].value)
- if(i<3){
- listName.push(e.detail.value[i].text)
- }
- }
- let jcxSstkNum=this.getTreeName(this.checkOptionList[0],e.detail.value[e.detail.value.length-1].value)
- this.$set(this.form.detailsList[index],'jcxSstkNum',jcxSstkNum);
- this.$set(this.form.detailsList[index],'jcxId',list);
- this.$set(this.form.detailsList[index],'jcxSstkMs',listName.join('-'));
- this.$set(this.form.detailsList[index],'jcxName',e.detail.value[e.detail.value.length-1].text);
- },
- //根据id查找父元素
- getTreeName(list,id){
- let _this=this
- for (let i = 0; i < list.length; i++) {
- let a=list[i]
- if(a.id===id){
- return a.code
- }else{
- if(a.children && a.children.length>0){
- let res=_this.getTreeName(a.children,id)
- if(res){
- return res
- }
- }
- }
- }
- },
- onnodeclick(node) {
- console.log("node",node)
- },
- //新增检查项-按钮
- dialogClick(index){
- this.examinationForm.name = "";
- this.examinationForm.value = "";
- this.examinationForm.idList = "";
- this.openIndex = index;
- this.open = true;
- },
- dialogClickOff(){
- this.open = false;
- },
- onchangeTwo(e){
- this.jcxSstkNum=[];
- this.jcxSstkMs='';
- this.$set(this.examinationForm,'value',e.detail.value[e.detail.value.length-1].text);
- this.$set(this.examinationForm,'idList',e.detail.value[e.detail.value.length-1].value);
-
- let list = [];
- let listName=[];
- for(let i=0;i<e.detail.value.length;i++){
- list.push(e.detail.value[i].value)
- if(i<3){
- listName.push(e.detail.value[i].text)
- }
- }
- console.log(9999)
- console.log(this.checkOptionListExamination)
- let jcxSstkNum=this.getTreeName(this.checkOptionListExamination,e.detail.value[e.detail.value.length-1].value)
- this.jcxSstkNum=jcxSstkNum;
- this.jcxSstkMs=listName.join('-');
- console.log(this.jcxSstkNum)
- console.log(this.jcxSstkMs)
- // this.$forceUpdate();
- },
- onnodeclickTwo(node) {
- console.log("node",node)
-
- },
- //新增检查项-提交
- async addPopupTwoButtonClick(){
- let self = this;
- if(!this.examinationForm.name){
- uni.showToast({
- title: '请输入检查项名称',
- icon:"none",
- mask:true,
- duration: 2000
- });
- return
- }
- if(!this.examinationForm.value){
- uni.showToast({
- title: '请选择所属目录',
- icon:"none",
- mask:true,
- duration: 2000
- });
- return
- }
- let obj = {
- name:this.examinationForm.name,
- parentId:this.examinationForm.idList
- };
- const {data} = await addTempCheckOption(obj);
- if(data.code == 200){
- let list = JSON.parse(JSON.stringify(this.checkOptionList));
- let obj = {
- id:data.data.id,
- name:data.data.name,
- };
- list.push(obj);
- this.$set(this,'checkOptionList',JSON.parse(JSON.stringify(list)));
- this.temporaryIdList.push(data.data.id);
-
-
-
- this.$set(this.form.detailsList[this.openIndex],'jcxId',data.data.id);
- this.$set(this.form.detailsList[this.openIndex],'jcxName',data.data.name);
- this.$set(this.form.detailsList[this.openIndex],'isLingshi',1);
-
- this.$set(this.form.detailsList[this.openIndex],'jcxSstkNum',this.jcxSstkNum);
- this.$set(this.form.detailsList[this.openIndex],'jcxSstkMs',this.jcxSstkMs);
-
-
- uni.showToast({
- title: '新增成功',
- icon:"none",
- mask:true,
- duration: 2000
- });
- this.open = false;
- }
- },
- }
- }
- </script>
- <style lang="stylus" scoped>
- #startChecking{
- height: 100%;
- width: 100%;
- display flex
- .startCheckingPage{
- flex:1;
- .startCheckingPage-top-box{
- flex:1;
- margin:20rpx;
- background #fff
- border-radius:20rpx;
- padding:30rpx;
- .item-picker-box{
- display: flex
- margin-bottom:20rpx;
- .name-p{
- width:123rpx;
- line-height:90rpx;
- text-align right
- }
- .span-p{
- width:36rpx;
- color:#FF7373;
- line-height:90rpx;
- }
- .picker-big-box{
- flex:1;
- border:2rpx solid #E0E0E0;
- border-radius:10rpx;
- height:90rpx;
- .picker-box{
- flex:1;
- display flex
- .picker-text{
- flex:1;
- line-height:90rpx;
- margin-left:20rpx;
- color:#999;
- font-size:28rpx;
- }
- input{
- height:90rpx;
- }
- .img-box{
- width:78rpx;
- height:90rpx;
- img{
- width:30rpx;
- height:28rpx;
- margin:34rpx 28rpx;
- }
- }
- }
- .picker-back{
- background:#f5f5f5;
- }
- }
- }
- }
- .startCheckingPage-bottom-button{
- height:100rpx;
- width:650rpx;
- text-align center
- color:#fff;
- background #0183FA
- margin:80rpx auto;
- line-height:100rpx;
- font-size:28rpx;
- border-radius:20rpx;
- }
- }
- .check-item-page{
- flex:1;
- .user-info-box{
- width:710rpx;
- height:200rpx;
- margin:20rpx;
- background #fff
- border-radius:20rpx;
- display flex
- .user-info-left{
- flex:1;
- margin:0 25rpx 0 16rpx;
- .user-info-min-box:nth-child(1){
- border-bottom:1rpx solid #E0E0E0;
- }
- .user-info-min-box{
- display flex
- img{
- height:30rpx;
- width:30rpx;
- margin:37rpx 13rpx 0 16rpx;
- }
- view{
- line-height:100rpx;
- }
- view:nth-child(2){
- font-size:30rpx;
- width:190rpx;
- color:#999999;
- }
- view:nth-child(3){
- width:390rpx;
- display:block;
- overflow:hidden;
- text-overflow:ellipsis;
- white-space:nowrap;
- text-align right;
- font-size:28rpx;
- }
- }
- }
- .user-info-right{
- width:12rpx;
- height:24rpx;
- margin:88rpx 27rpx 0 0;
- }
- }
- .check-for-max-box{
- .check-for-big-box{
- width 710rpx;
- //padding-top:30rpx;
- margin:0 20rpx 20rpx;
- background #fff
- border-radius:20rpx;
- overflow hidden
- position relative;
- padding:20rpx;
- box-sizing border-box;
- .check-for-img-max-box{
- //display flex
- .left-title-p{
- width:150rpx;
- line-height:88rpx;
- text-align right
- font-size:30rpx;
- }
- .right-img-box{
- margin-top:30rpx;
- .img-box{
- display inline-block;
- height:200rpx;
- width:200rpx;
- position relative
- margin:0 20rpx 20rpx 0;
- border-radius 10rpx;
- overflow hidden;
- .img-data{
- height:200rpx;
- width:200rpx;
- }
- .position-img{
- position absolute
- right:0;
- top:0;
- width:36rpx;
- height:36rpx;
- }
- }
- .add-button{
- margin:0 20rpx 20rpx 0;
- border-radius 10rpx;
- overflow hidden;
- display inline-block
- height:200rpx;
- width:200rpx;
- }
- }
- }
- /* 语音备注 */
- .voice{
- .voice_t{
- width:150rpx;
- line-height:88rpx;
- text-align right
- font-size:30rpx;
- }
- .voice_b{
- display flex;
- justify-content flex-start;
- align-items center;
- margin-bottom :30rpx;
- .voice_b_l{
- width: 400rpx;
- height: 40rpx;
- background:rgba(88,175,255,0.3);
- border-radius: 10rpx;
- display flex;
- justify-content flex-start;
- align-items center;
- >img{
- width: 18rpx;
- height: 24rpx;
- margin-left:16rpx;
- margin-right :20rpx;
- }
- }
- .voice_b_r{
- width: 28rpx;
- height: 28rpx;
- margin-left:20rpx;
- }
- }
- }
- .broadcast_m{
- width: 142rpx;
- height: 142rpx;
- position :fixed;
- right :10rpx;
- bottom:188rpx;
- z-index :100;
- .broadcast_m_t{
- width: 142rpx;
- height: 142rpx;
- position :relative;
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 500;
- line-height: 170rpx;
- text-align center
- >img{
- width: 142rpx;
- height: 142rpx;
- position :absolute;
- }
- >label{
- width :100%;
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #0183FA;
- line-height: 24rpx;
- display :inline-block;
- text-align :center;
- position :absolute;
- top:76rpx;
- }
- /* 按下 */
- .press_color{
- color: #FFFFFF;
- }
- /* 松开 */
- .slip_color{
- color: #0183FA;
- }
- }
- .broadcast_m_t_back_a{
- background:url(@/images/icon_sskz_skfs.png);
- background-size 100%
- color: #FFFFFF;
- }
- .broadcast_m_t_back_b{
- background:url(@/images/icon_sskz_azsh.png);
- background-size 100%
- color: #0183FA;
- }
- .broadcast_m_b{
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- line-height: 24rpx;
- text-align center;
- margin-top :14rpx;
- }
- }
- .check-for-input-max-box{
- //display flex
- margin-top:20rpx;
- .left-title-p{
- width:150rpx;
- line-height:88rpx;
- text-align right
- font-size:30rpx;
- }
- textarea{
- border:1rpx solid #E0E0E0;
- width 630rpx;
- height:210rpx;
- border-radius:10rpx;
- line-height :40rpx;
- padding:20rpx;
- font-size:28rpx;
- }
- }
- .check-for-button-max-box{
- display flex
- margin-top:30rpx;
- margin-bottom:20rpx;
- .left-title-p{
- width:150rpx;
- line-height:88rpx;
- text-align right
- font-size:30rpx;
- }
- .button-text-p{
- border:1rpx solid #E0E0E0;
- width:440rpx;
- height:80rpx;
- border-radius:10rpx;
- line-height :80rpx;
- color: #A2A2A2
- padding:0 20rpx;
- font-size:28rpx;
- display:block;
- overflow:hidden;
- text-overflow:ellipsis;
- white-space:nowrap;
- }
- }
- .check-for-button-add-p{
- text-align center;
- line-height:80rpx;
- color:#007AFF;
- margin-bottom:20rpx;
- }
- .check-for-big-box-position-img-box{
- position absolute
- top:0;
- right:0;
- width:60rpx;
- height:60rpx;
- img{
- width:36rpx;
- height:36rpx;
- margin:12rpx;
- }
- }
- }
- }
- .add-for-item-p{
- width:500rpx;
- height:80rpx;
- border:4rpx dashed #0183FA;
- color:#0183FA;
- font-size:28rpx;
- background #fff
- text-align center
- line-height:80rpx;
- border-radius:10rpx;
- margin:40rpx auto 100rpx;
- }
- .check-button-box-one{
- width:650rpx;
- margin:0 auto 100rpx;
- background: linear-gradient(-45deg, #FA9901, #F28E26);
- text-align:center;
- line-height:100rpx;
- font-size:30rpx;
- color:#fff;
- border-radius:50rpx;
- }
- .check-button-box{
- display flex
- width:650rpx;
- margin:0 auto 100rpx;
- view{
- text-align center
- line-height:100rpx;
- font-size:30rpx;
- color:#fff;
- }
- view:nth-child(1){
- width:325rpx;
- line-height:100rpx;
- background: linear-gradient(-45deg, #FA9901, #F28E26);
- border-bottom-left-radius 50rpx
- border-top-left-radius 50rpx
- }
- view:nth-child(2){
- width:325rpx;
- line-height:100rpx;
- background: linear-gradient(-35deg, #309CFF, #0183FA);
- border-bottom-right-radius 50rpx
- border-top-right-radius 50rpx
- }
- }
- .danger-list-box{
- display flex
- background #fff
- margin:0 20rpx;
- border-radius:20rpx;
- .danger-list-left-img{
- height:30rpx;
- width:30rpx;
- margin:37rpx 13rpx 0 30rpx;
- }
- view{
- line-height:100rpx;
- }
- .danger-list-left-text{
- font-size:30rpx;
- flex:1;
- color:#999999;
- }
- .danger-list-left-num{
- font-size:28rpx;
- margin-right:50rpx;
- }
- .danger-list-right-img{
- width:12rpx;
- height:24rpx;
- margin:38rpx 30rpx 0 0
- }
- }
- .danger-title-text-p{
- line-height:80rpx;
- font-size:30rpx;
- color:#333;
- margin-left:40rpx;
- }
- .danger-info-picker-max-box{
- margin:0 20rpx 100rpx;
- background #fff
- border-radius:20rpx;
- padding:30rpx;
- .danger-info-picker-box:nth-child(1){
- margin-top:0;
- }
- .danger-info-picker-box{
- display flex
- margin-top:26rpx;
- .danger-info-picker-title{
- line-height:80rpx;
- font-size:30rpx;
- color:#333;
- }
- .picker-text{
- width:480rpx;
- height:80rpx;
- border: 2rpx solid #E0E0E0;
- padding-left:20rpx;
- margin-left:20rpx;
- color:#A2A2A2;
- font-size:28rpx;
- line-height 80rpx
- border-radius:10rpx;
- }
- }
- }
- /* 检查名称弹框 */
- .inspect_name{
- .popup-content{
- width: 750rpx;
- height: 350rpx;
- background: #FFFFFF;
- border-radius: 10rpx 10rpx 0px 0px;
- padding :0 50rpx;
- box-sizing :border-box;
- overflow :hidden;
- .inspect_name_t{
- display flex
- margin-top:66rpx;
- .inspect_name_t_l{
- line-height:80rpx;
- font-size:30rpx;
- color:#333;
- }
- >input{
- width:440rpx;
- height:80rpx;
- border: 2rpx solid #E0E0E0;
- padding-left:20rpx;
- margin-left:20rpx;
- color:#A2A2A2;
- font-size:28rpx;
- line-height 80rpx
- border-radius:10rpx;
- }
- }
- .inspect_name_b{
- margin-top :64rpx;
- width: 650rpx;
- height: 80rpx;
- background: linear-gradient(-35deg, #309CFF, #0183FA);
- border-radius: 40rpx;
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #FFFFFF;
- line-height: 80rpx;
- text-align :center;
- }
- }
- }
- }
- .search-max-box{
- flex:1;
- display flex
- flex-direction column
- .search-top-input-box{
- overflow hidden
- height:150rpx;
- background #fff
- input{
- width:670rpx;
- height:80rpx;
- border:1rpx solid #E0E0E0;
- border-radius:10rpx;
- margin:34rpx auto;
- padding:0 20rpx;
- font-size:28rpx;
- color:#A2A2A2;
- }
- }
- .scroll-box{
- flex:1;
- padding-top:20rpx;
- .search-for-box:nth-child(1){
- view:nth-child(1){
- border-top:none;
- }
- }
- .search-for-box{
- margin:0 20rpx;
- background #fff
- view:nth-child(1){
- line-height:28rpx;
- font-size:28rpx;
- padding-top:20rpx;
- margin:0 20rpx 20rpx;
- border-top:1rpx solid #E0E0E0;
- }
- view:nth-child(2){
- line-height:30rpx;
- font-size:24rpx;
- color:#666;
- margin:0 20rpx;
- padding-bottom:20rpx;
- }
- }
- .search-add-item{
- width:680rpx;
- margin:20rpx auto;
- height:70rpx;
- background #dedede;
- display flex
- border-radius:10rpx;
- view{
- font-size:24rpx;
- line-height:70rpx;
- }
- view:nth-child(1){
- color:#999;
- flex:1;
- margin-left:45rpx;
- }
- view:nth-child(2){
- color:#0183FA;
- margin-right:45rpx;
- }
- }
- .search-null-box{
- img{
- width:274rpx;
- height:274rpx;
- margin:100rpx 0 20rpx 270rpx;
- }
- view:nth-child(2){
- margin:40rpx auto 90rpx;
- color:#999;
- font-size:28rpx;
- text-align center
- }
- view:nth-child(3){
- width:300rpx;
- height:70rpx;
- line-height:70rpx;
- text-align center
- font-size:28rpx;
- color:#fff;
- background #0183FA
- border-radius:50rpx;
- margin:0 auto;
- }
- }
- }
- }
- .add-search-max-box{
- background #fff;
- position fixed;
- width:100%;
- height:100%;
- z-index:100;
- .add-search-min-box{
- background #fff
- border-radius:10rpx;
- padding:30rpx 20rpx;
- margin:20rpx;
- .add-search-box:nth-child(1){
- margin-bottom:30rpx;
- }
- .add-search-box{
- display flex
- .add-search-title{
- flex:1;
- line-height:90rpx;
- margin-right:20rpx;
- font-size:30rpx;
- }
- .add-search-picker{
- border:1rpx solid #E0E0E0;
- width:431rpx;
- padding:25rpx 25rpx;
- // height:90rpx;
- // min-height:90rpx;
- line-height:40rpx;
- color:#888;
- border-radius:10rpx;
- font-size:28rpx;
- }
- .add-search-input{
- width:438rpx;
- padding:20rpx 20rpx;
- border:1rpx solid #E0E0E0;
- height:80rpx;
- line-height:40rpx;
- border-radius:10rpx;
- font-size:28rpx;
- }
- }
- }
- .add-search-button{
- display flex
- width:650rpx;
- margin:0 auto 100rpx;
- view{
- text-align center
- line-height:100rpx;
- font-size:30rpx;
- color:#fff;
- }
- view:nth-child(1){
- width:325rpx;
- line-height:100rpx;
- background: linear-gradient(-45deg, #999, #999);
- border-bottom-left-radius 50rpx
- border-top-left-radius 50rpx
- }
- view:nth-child(2){
- width:325rpx;
- line-height:100rpx;
- background: linear-gradient(-35deg, #309CFF, #0183FA);
- border-bottom-right-radius 50rpx
- border-top-right-radius 50rpx
- }
- }
- }
- .popup-max-box{
- z-index:10;
- height:100%;
- width:100%;
- position fixed;
- background rgba(0,0,0,0.2)
- display flex;
- flex-direction column
- .popup-null{
- flex:1;
- }
- .popup-big-box{
- border-top-left-radius:20rpx;
- border-top-right-radius:20rpx;
- background #fff
- .popup-input-box{
- padding:30rpx 20rpx;
- display:flex;
- input{
- flex:1;
- height:70rpx;
- border:1rpx solid #e0e0e0;
- border-radius:10rpx;
- margin-right:20rpx;
- padding:0 20rpx;
- }
- view{
- background #0183FA
- color:#fff;
- border-radius:10rpx;
- width:140rpx;
- line-height:70rpx;
- text-align center;
- font-size:28rpx;
- }
- }
- .popup-for-max-box{
- margin:0 20rpx 30rpx;
- height:600rpx;
- overflow-y scroll;
- .popup-for-null{
- line-height:100rpx;
- text-align center
- color:#999;
- }
- .popup-for-box{
- display:flex;
- padding:10px 0;
- .name-p{
- flex:1;
- line-height:60rpx;
- }
- .button-p{
- background #0183FA
- color:#fff;
- text-align center
- width:100rpx;
- line-height:60rpx;
- height:60rpx;
- border-radius:10rpx;
- }
- }
- }
- }
- }
- .popup-max-box-two{
- z-index:10;
- height:100%;
- width:100%;
- position fixed;
- background rgba(0,0,0,0.2)
- display flex;
- flex-direction column
- .popup-null{
- flex:1;
- }
- .popup-big-box{
- border-top-left-radius:20rpx;
- border-top-right-radius:20rpx;
- background #fff
- position relative;
- .popup-two-title-box{
- height:80rpx;
- line-height:80rpx;
- padding:0 20rpx;
- font-size:34rpx;
- text-align center;
- border-bottom:1rpx solid #dedede;
- }
- .popup-position-right{
- position absolute;
- top:0;
- right:20rpx;
- line-height:80rpx;
- font-size:28rpx;
- color:#0183FA;
- }
- .popup-add-name-box{
- display flex;
- padding:0 40rpx;
- margin-top:10rpx;
- view:nth-child(1){
- width:200rpx;
- line-height:80rpx;
- }
- input{
- border:1rpx solid #dedede;
- padding:0 20rpx;
- width:400rpx;
- height:60rpx;
- line-height:60rpx;
- margin:10rpx 0 0 ;
- }
- }
- .popup-top-box{
- height:90rpx;
- line-height:80rpx;
- padding:0 20rpx;
- font-size:30rpx;
- margin:10rpx 20rpx;
- overflow-x scroll
- overflow-y hidden
- white-space: nowrap;
- view{
- display inline-block
- }
- .view-inline-block-color{
- border-bottom:4rpx solid #0183FA;
- }
- }
- .popup-for-max-box{
- padding:20rpx 0 0 0 ;
- margin:0 20rpx 30rpx;
- height:600rpx;
- overflow-y scroll;
- .popup-for-box{
- display flex;
- .left-img{
- width:20rpx;
- height:20rpx;
- margin:30rpx;
- }
- .center-view{
- padding:20rpx 0;
- line-height:40rpx;
- flex:1;
- }
- .right-img-box{
- width:80rpx;
- height:80rpx;
- border-radius:50%;
- .right-img{
- width:18rpx;
- height:36rpx;
- margin:22rpx 31rpx;
- }
- }
- }
- }
- .popup-button{
- margin:20rpx auto;
- width:500rpx;
- height:80rpx;
- line-height:80rpx;
- text-align center;
- color:#fff;
- border-radius:20rpx;
- }
- .popup-button-colorA{
- background #0183FA
- }
- .popup-button-colorB{
- background #999
- }
- }
- }
- }
- </style>
|