| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465 |
- <template>
- <div class="lz-edit">
- <nav-bar></nav-bar>
- <div class="page-container">
- <!-- 基本信息 -->
- <div class="card" v-if="taskInfo">
- <van-panel :title="taskInfo.title" :status="getDicts(taskInfo.status,'resumption_status')">
- <van-cell title="日期时间" :value="rangDate(taskInfo.planstarttime,taskInfo.planendtime)" />
- <van-collapse :border="false" v-model="activeNames">
- <van-collapse-item title="履职内容" :name="1">
- <van-cell title="检查内容:" :value="allCheckNum" />
- <van-cell title="NFC:" >
- <template #extra>
- <p class="flex-box">
- <span >已扫 {{taskInfo.areaScanY}}</span>
- <span >未扫 {{taskInfo.areaScanN}}</span>
- </p>
- </template>
- </van-cell>
- <van-cell title="检查区域:">
- <template #extra>
- <p class="flex-box">
- <span >已查 {{taskInfo.nfcScanY}}</span>
- <span >未查 {{taskInfo.nfcScanN}}</span>
- </p>
- </template>
- </van-cell>
- </van-collapse-item>
- </van-collapse>
- </van-panel>
- </div>
- <!-- 检查区域 -->
- <div class="card">
- <van-panel title="巡检区域" v-if="areaList">
- <div style="padding: 10px;">
- <van-row >
- <van-col span="12" v-for="(v,i) in areaList" :key="v.areaid">
- <div class="check-area" @click="clickArea(v,i)">
- {{v.areaname}}
- <!-- <van-icon v-if="v.status" name="success" color="primary"/>-->
- <!-- <van-icon v-else name="fail" color="red"/>-->
- </div>
- </van-col>
- </van-row>
- <van-cell title="检查内容:" :value="checkNum" />
- <van-cell>
- <template #title>
- <span>NFC:</span>
- </template>
- <template #extra>
- <span style="display: inline-block;color:#969799;">{{NFCNum}}</span>
- <img v-if="enable && NFCNum" :src="require('../../../assets/svg/NFC.svg')" class="nfc-icon" @click="clickNFC"/>
- </template>
- </van-cell>
- <van-cell v-show="nfcImage.length > 0" :border="false" >
- <img class="nfc-img" v-for="(v,i) in selectArea.nfclist" v-if="v.img" :src="imgUrl(v.img)" alt="" :key="v.img">
- </van-cell>
- </div>
- </van-panel>
- </div>
- <!-- 检查事项 -->
- <!-- <div class="card" v-if="selectArea" v-for="v in checkList" :key="v.itemid">-->
- <!-- <van-panel :title="v.itemname">-->
- <!-- <van-collapse v-model="activeNames" v-for="(item,index) in v.checkitemlist" :key="item.pointdataid">-->
- <!-- <van-collapse-item :title="item.pointname" :name="index" >-->
- <!-- <van-cell :border="false" title="是否异常">-->
- <!-- <template #right-icon>-->
- <!-- <van-switch-->
- <!-- v-model="item.resvalue"-->
- <!-- inactive-color="#4fc08d"-->
- <!-- active-color="orange"-->
- <!-- size="20" />-->
- <!-- </template>-->
- <!-- </van-cell>-->
- <!-- <van-cell-group v-show="item.resvalue">-->
- <!-- <van-field-->
- <!-- v-model="item.resremark"-->
- <!-- rows="1"-->
- <!-- autosize-->
- <!-- label="情况描述:"-->
- <!-- type="textarea"-->
- <!-- placeholder="请输入"/>-->
- <!-- <div class="upload-box" >-->
- <!-- <uploader v-model="item.imgData" multiple />-->
- <!-- </div>-->
- <!-- <select-cell title="整改期限" v-model="item.rectificationDeadline" :dict="'rectification_deadline'" is-link/>-->
- <!-- </van-cell-group>-->
- <!-- <date-cell v-if="item.businessType === 1" v-for="(val,ind) in item.protectionVo" :title="val.protectionName" v-model="val.statusUpdateTime" :key="val.id" date-type="datetime" />-->
- <!-- </van-collapse-item >-->
- <!-- </van-collapse >-->
- <!-- </van-panel>-->
- <!-- </div>-->
- <!-- 检查项目2 -->
- <fieldset class="fieldset" :disabled="!enable">
- <div class="card" v-if="selectArea">
- <van-collapse v-model="activeNames" v-for="v in checkList" :key="v.itemid">
- <van-collapse-item :title="v.itemname" :name="v.itemname" >
- <div v-for="(item,index) in v.checkitemlist" :key="item.pointdataid">
- <van-cell :title="item.pointname">
- <template #right-icon>
- <van-switch
- v-if="enable"
- v-model="item.resvalue"
- :active-value="1"
- :inactive-value="0"
- inactive-color="#4fc08d"
- active-color="orange"
- @change="switchChange(item)"
- size="20" />
- </template>
- </van-cell>
- <van-cell-group v-show="item.resvalue">
- <van-field
- v-model="item.resremark"
- rows="1"
- autosize
- label="情况描述:"
- type="textarea"
- placeholder="请输入"/>
- <div class="upload-box" >
- <uploader v-model="item.imgData"/>
- </div>
- <select-cell :disabled="!enable" title="整改期限" v-model="item.rectificationDeadline" :dict="'rectification_deadline'" />
- </van-cell-group>
- <date-cell
- :disabled="!enable"
- v-if="item.businessType === 1"
- v-for="(val,ind) in item.protectionVo"
- :title="val.protectionName"
- v-model="val.statusUpdateTime"
- :key="val.id"
- date-type="datetime" />
- </div>
- </van-collapse-item>
- </van-collapse>
- </div >
- <p v-if="enable" class="warning-msg">需要完成所有区域的履职内容才能提交内容</p>
- <div v-if="enable" class="flex-box">
- <van-button type="default" style="width: 28%;" plain @click="goBack">取消</van-button>
- <van-button type="info" style="width: 28%;" plain hairline @click="saveData">保存</van-button>
- <van-button type="info" style="width: 28%;" @click="submitData">提交</van-button>
- </div>
- </fieldset>
- </div>
- <!-- nfc弹窗 -->
- <nfc-popup v-if="enable" ref="NfcPopup" @change="changeNfcImg"></nfc-popup>
- </div>
- </template>
- <script>
- import NavBar from '@/components/NavBar';
- import SelectCell from '@/components/selectCell';
- import DateCell from '@/components/dateCell';
- import Uploader from '@/components/upload';
- import NfcPopup from '@/components/nfcPopup/more';
- import {taskDetails,saveTaskData} from "@/views/menu/LZRegister/api";
- import {formatDate} from "@/filters/filter";
- export default {
- components:{NavBar,SelectCell,DateCell,Uploader,NfcPopup},
- data(){
- return {
- activeNames: ['1'],
- //区域列表
- areaList:[],
- //基本信息
- taskInfo:[],
- //字典
- dicts: ['resumption_status'],
- //选中的区域
- selectArea:[],
- //区域下nfc列表
- NFCList:[],
- //区域下检查内容列表
- checkList:[],
- //检查内容具体项列表
- checkItemList:[],
- //nfc扫描数量
- NFCNum:0,
- //所有检查项数量
- allCheckNum:0,
- //区域下检查项数量
- checkNum:0,
- //nfc图片
- nfcImage:[],
- enable:false,
- }
- },
- mounted() {
- this.getData();
- },
- computed:{
- },
- // watch:{
- // NFCList(){
- // if(!this.NFCList) return;
- // let arr = this.NFCList.filter(item=>{
- // return item.status == 0;
- // })
- // this.NFCNum = arr.length;
- // },
- // },
- methods:{
- //初始化数据
- getData() {
- let data = {
- dateTime:new Date(),
- taskId:this.$route.query.id,
- }
- taskDetails(data).then(res=>{
- //res = json;
- console.log(res,'res')
- let {areaScanN,areaScanY,nfcScanN,nfcScanY} = res.data;
- this.taskInfo = {
- areaScanN,
- areaScanY,
- nfcScanN,
- nfcScanY,
- ...res.data.taskObj
- }
- this.taskInfo.nfcScaning = res.data.nfcScaning;
- this.enable = this.taskInfo.status === 1 || this.taskInfo.status === 2; //是否可编辑
- this.areaList = res.data.taskarealist;
- this.activeArea(this.areaList[0],0);
- this.getAllCheckItemNum();
- console.log(res)
- })
- },
- //保存数据
- saveData(){
- let pointdata = [];
- this.areaList.forEach(area=>{
- console.log(area,'area')
- area.checklist.forEach(item=>{
- item.checkitemlist.forEach(checkItem=>{
- checkItem.protections = checkItem.protectionVo;
- checkItem.resRemark = checkItem.resremark;
- checkItem.resStatus = checkItem.resstatus;
- checkItem.areaId = checkItem.areaid;
- checkItem.id = checkItem.pointdataid;
- checkItem.pointId = checkItem.pointid;
- checkItem.resValue = checkItem.resvalue;
- checkItem.resumptionId = this.$route.query.id;
- pointdata.push(checkItem);
- })
- })
- })
- let data = {
- dateTime:new Date(),
- isSubmit:0,
- resumptionId:this.$route.query.id,
- year: this.taskInfo.year,
- quarter: this.taskInfo.quarter,
- nfcData:this.nfcImage,
- pointdata,
- }
- saveTaskData(data).then(res=>{
- this.$toast('提交成功');
- this.$router.go(-1);
- })
- },
- //获取所有检查项数量
- getAllCheckItemNum(){
- let num = 0;
- this.areaList.forEach(v=>{
- v.checklist.forEach(item=>{
- num += item.checkitemlist.length;
- })
- });
- this.allCheckNum = num;
- console.log(num,'num1111')
- },
- //点击区域
- clickArea(area,index){
- this.activeArea(area,index);
- },
- //选中区域时数据变更
- activeArea(area,index){
- this.$nextTick(()=>{
- let doms = document.getElementsByClassName('check-area');
- console.log(doms,'doms')
- Array.prototype.forEach.call(doms,item=>{
- item.classList.remove('active');
- })
- doms[index].classList.add('active');
- })
- this.selectArea = area;
- this.checkList = area.checklist;
- //设置默认展开项
- this.activeNames = this.checkList.map(v=>v.itemname);
- //回显nfc图片
- area.nfclist.forEach( v =>{
- if(v.img){
- v.url = v.img;
- this.nfcImage.push(v)
- }
- });
- console.log(this.nfcImage,'nfcImage')
- //获取当前区域检查项数量
- this.getCheckItemNum();
- //获取当前区域nfc数量
- this.getNFCItemNum();
- },
- //获取当前区域检查项数量
- getCheckItemNum(){
- let num = 0;
- this.selectArea.checklist.forEach(v=>{
- num += v.checkitemlist.length;
- });
- this.checkNum = num;
- },
- //获取当前区域nfc数量
- getNFCItemNum(){
- let num = 0;
- this.selectArea.nfclist.forEach(v=>{
- if(v.status === 0 || !v.img){
- num++;
- }
- })
- this.NFCNum = num;
- },
- //提交数据
- submitData(){
- let pointdata = [];
- this.areaList.forEach(area=>{
- area.checklist.forEach(item=>{
- item.checkitemlist.forEach(checkItem=>{
- checkItem.protections = checkItem.protectionVo;
- checkItem.resRemark = checkItem.resremark;
- checkItem.resStatus = checkItem.resstatus;
- checkItem.areaId = checkItem.areaid;
- checkItem.id = checkItem.pointdataid;
- checkItem.pointId = checkItem.pointid;
- checkItem.resValue = checkItem.resvalue;
- checkItem.resumptionId = this.$route.query.id;
- pointdata.push(checkItem);
- })
- })
- })
- console.log(pointdata,'pointdata')
- let data = {
- dateTime:new Date(),
- isSubmit:1,
- resumptionId:this.$route.query.id,
- year: this.taskInfo.year,
- quarter: this.taskInfo.quarter,
- nfcData:[],
- pointdata,
- }
- saveTaskData(data).then(res=>{
- this.$toast('提交成功');
- this.$router.go(-1);
- })
- },
- //返回
- goBack(){
- this.$router.go(-1);
- this.clearData();
- },
- //点击NFC图标
- clickNFC(){
- if(!this.NFCNum) return;
- let arr = this.selectArea.nfclist.filter(item=>{
- return item.status == 0;
- })
- this.$refs.NfcPopup.show(arr);
- },
- //清空数据
- clearData(){
- this.areaList = [];
- this.taskInfo= [];
- this.selectArea = [];
- this.NFCList = [];
- this.checkList = [];
- this.checkItemList = [];
- this.NFCNum = 0;
- this.enable = false;
- },
- //切换开关时添加操作时间
- switchChange(item){
- console.log(item,'666')
- item.resTime = formatDate(new Date());
- },
- //添加图片时的回调
- changeNfcImg(imgItem){
- console.log(imgItem,'imgItem')
- this.selectArea.nfclist.forEach(v=>{
- if(v.nfccdoe === imgItem.nfcCode){
- v.img = imgItem.url;
- this.nfcImage.push(v);
- }
- })
- console.log( this.selectArea.nfclist,this.nfcImage,'nfcObj')
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .lz-edit{
- height: 100%;
- overflow: hidden;
- }
- .page-container{
- height: calc(100vh - 90px);
- overflow: auto;
- padding: 20px;
- }
- .flex-box{
- display: flex;
- justify-content: space-between;
- align-items: center;
- >span{
- margin: 0 20px;
- }
- }
- .card{
- margin-bottom: 20px;
- box-shadow: 0 10px 10px #eaeaea;
- }
- .check-area{
- background-color: #f1f1f1;
- margin: 10px;
- padding:20px;
- color:#aaa;
- border-radius: 6px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- box-shadow: 0 2px 6px #ddd;
- }
- .nfc-icon{
- width: 50px;
- height: 50px;
- margin-left: 20px;
- }
- .custom-title {
- align-self: center;
- vertical-align: middle;
- }
- .upload-box{
- margin: 30px;
- }
- .warning-msg{
- color: orange;
- text-align: center;
- height: 80px;
- line-height: 80px;
- }
- .active{
- color: #fff;
- background-color: #1989fa;
- }
- .nfc-img{
- width: 160px;
- height: 160px;
- }
- </style>
|