123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448 |
- <template>
- <view class="f-padding">
- <u-navbar
- :title="title"
- title-color="#fff"
- :border-bottom="false"
- :custom-back="customBack"
- back-icon-color="#CCE8FF"
- :background="{background: 'linear-gradient(99deg, #7A4398 0%, #5A5DB9 100%)' }"></u-navbar>
- <u-form :model="form" ref="uForm">
- <!-- <u-form-item label="路段/停车场:" prop="roadName" required :label-width="labelWidth">
- <u-input v-model="form.roadName" type="select" :border="true" placeholder="请选择" @click="selectShow = true" />
- <u-select v-model="selectShow" :list="roadList" value-name="roadNo" label-name="roadName" @confirm="selectConfirm"></u-select>
- </u-form-item> -->
- <view class="block-til">异常信息</view>
- <view class="block">
- <u-form-item label="问题描述" prop="exceprionDes" required :label-width="labelWidth">
- <u-input type="textarea" :border="true" maxlength="200" v-model="form.exceprionDes" />
- </u-form-item>
- <u-form-item label="图片说明" :label-width="labelWidth" :border-bottom="false">
- <u-upload ref="uploadRef" :action="action" :file-list="fileList" max-count="3"></u-upload>
- </u-form-item>
- </view>
- <view class="block-til">处理登记</view>
- <view class="block">
- <u-form-item label="处理状态" :label-width="labelWidth" prop="isProcess" :required="true">
- <view class="select-view" @click="oneSelectOpen('isProcess')">
- {{form.isProcess|filterIsProcess}}
- </view>
- <u-icon @click="oneSelectOpen('isProcess')" color="#42494F" name="arrow-right"></u-icon>
- </u-form-item>
- <view v-if="form.isProcess&&form.isProcess!=0" class="">
- <u-form-item label="处理员" prop="processBy" required :label-width="labelWidth">
- <u-input type="text" :border="true" maxlength="200" v-model="form.processBy" />
- </u-form-item>
- <u-form-item label="处理设备" :label-width="labelWidth" prop="processDevice" :required="false">
- <view class="select-view" @click="oneSelectOpen('processDeviceList')">
- {{filterProcessDevice(form.processDevice)||'请选择'}}
- </view>
- <u-icon @click="oneSelectOpen('processDeviceList')" color="#42494F" name="arrow-right"></u-icon>
- </u-form-item>
- <u-form-item label="损坏类型" :label-width="labelWidth" prop="damageType" :required="false">
- <view class="select-view" @click="oneSelectOpen('damageTypeList')">
- {{filterDamageType(form.damageType)||'请选择'}}
- </view>
- <u-icon @click="oneSelectOpen('damageTypeList')" color="#42494F" name="arrow-right"></u-icon>
- </u-form-item>
- <u-form-item label="处理方式" :label-width="labelWidth" prop="processType" :required="false">
- <view class="select-view" @click="oneSelectOpen('processTypeList')">
- {{filterProcessType(form.processType)||'请选择'}}
- </view>
- <u-input @click="oneSelectOpen('processTypeList')" placeholder="请选择" v-model="form.processType"
- disabled />
- <u-icon @click="oneSelectOpen('processTypeList')" color="#42494F" name="arrow-right"></u-icon>
- </u-form-item>
- </view>
- </view>
- </u-form>
- <u-button type="primary" @click="submit" style="margin-top: 24rpx;">提交</u-button>
- <!-- 单列下拉选择 -->
- <u-select v-model="selectShow" :list="selectData" @confirm="selectConfirm"></u-select>
- </view>
- </template>
- <script>
- export default{
- data(){
- return{
- title:'问题上报',
- labelWidth:190,
- action:this.config.upFileUrl,
- fileList:[],
- selectShow:false,
- selectList:[],
- roadList:[],
- selectTag: '',
- selectShow: false,
- selectData: [],
- listMap: {
- isProcess: [{
- value: '0',
- label: '未处理'
- }, {
- value: '1',
- label: '已处理'
- }, {
- value: '2',
- label: '部分处理'
- }],
- processDeviceList:[],
- damageTypeList:[],
- processTypeList:[],
- },
- form:{
- roadName:'',
- roadNo:'',
- exceprionDes:'',
- imgList:[]
- },
- rules:{
- roadName: [
- {
- required: true,
- message: '请选择路段',
- trigger: ['change','blur'],
- }
- ],
- processBy: [
- {
- required: true,
- message: '请输入处理员',
- trigger: ['change','blur'],
- }
- ],
- exceprionDes: [
- {
- required: true,
- message: '请输入内容',
- trigger: ['change','blur'],
- }
- ],
- }
- }
- },
- onLoad(page){
- this.form.deviceId = page.deviceId;
- this.form.deviceType = page.deviceType;
- this.form.roadNo = page.roadNo;
- this.form.roadName = page.roadName;
- this.reportId = page.reportId;
- // console.log('this.reportId',this.reportId);
- if(this.reportId){
- this.getReportDetails();
- }
-
- },
- onShow(){
- this.getProcessDevice();
- this.getDamageType();
- this.getProcessType();
- },
- onReady() {
- this.$refs.uForm.setRules(this.rules);
- },
- computed:{
- filterProcessDevice(value){
- return function(value){
- let v = '';
- for (let i = 0; i < this.listMap.processDeviceList.length; i++){
- let item = this.listMap.processDeviceList[i];
- if (value == item.value) {
- v = item.label;
- break;
- }
- }
- return v
- }
- },
- filterDamageType(value){
- return function(value){
- let v = '';
- for (let i = 0; i < this.listMap.damageTypeList.length; i++){
- let item = this.listMap.damageTypeList[i];
- if (value == item.value) {
- v = item.label;
- break;
- }
- }
- return v
- }
- },
- filterProcessType(value){
- return function(value){
- let v = '';
- for (let i = 0; i < this.listMap.processTypeList.length; i++){
- let item = this.listMap.processTypeList[i];
- if (value == item.value) {
- v = item.label;
- break;
- }
- }
- return v
- }
- },
- },
- methods:{
- customBack(){
- uni.navigateBack()
- },
- getReportDetails(){
- this.$u.api.excptionById({id:this.reportId}).then(res=>{
- if(res.code==200){
- // this.reportDetails = res.data;
- // this.fileList = res.data.imgList;
- let imgList = res.data.imgList;
- if(imgList.length>0){
- this.fileList=imgList.map(img=>{
- return {url:img}
- })
- }
- this.form = {
- ...res.data,
- imgList:[],
- }
- console.log('this.formthis.form',this.form);
- }else{
- uni.showToast({
- icon:'none',
- title:res.msg
- })
- }
- console.log('res',res);
- }).catch(err=>{
- console.log('err',err);
- })
- },
- getProcessDevice(){
- console.log('this.form.deviceType',this.form.deviceType);
- if(this.form.deviceType==1){
- this.getProcessDeviceGeo();
- }else if(this.form.deviceType==2){
- this.getProcessDeviceLock();
- }else if(this.form.deviceType==3){
- this.getProcessDeviceRoom();
- }
-
- },
- getProcessDeviceGeo(){
- this.$u.api.processDeviceGeo().then(res=>{
- if(res.code==200){
- this.listMap.processDeviceList = res.data.data.map(item=>{
- return {value:item.dictValue,label:item.dictLabel}
- });
- // console.log('this.listMap.processDeviceList',this.listMap.processDeviceList);
- }else{
- uni.showToast({
- icon:'none',
- title:res.msg
- })
- }
- console.log('res',res);
- }).catch(err=>{
- console.log('err',err);
- })
- },
- getProcessDeviceLock(){
- this.$u.api.processDeviceLock().then(res=>{
- if(res.code==200){
- this.listMap.processDeviceList = res.data.data.map(item=>{
- return {value:item.dictValue,label:item.dictLabel}
- });
- // console.log('this.listMap.processDeviceList',this.listMap.processDeviceList);
- }else{
- uni.showToast({
- icon:'none',
- title:res.msg
- })
- }
- console.log('res',res);
- }).catch(err=>{
- console.log('err',err);
- })
- },
- getProcessDeviceRoom(){
- this.$u.api.processDeviceRoom().then(res=>{
- if(res.code==200){
- this.listMap.processDeviceList = res.data.data.map(item=>{
- return {value:item.dictValue,label:item.dictLabel}
- });
- // console.log('this.listMap.processDeviceList',this.listMap.processDeviceList);
- }else{
- uni.showToast({
- icon:'none',
- title:res.msg
- })
- }
- console.log('res',res);
- }).catch(err=>{
- console.log('err',err);
- })
- },
- getDamageType(){
- this.$u.api.damageType().then(res=>{
- if(res.code==200){
- this.listMap.damageTypeList = res.data.data.map(item=>{
- return {value:item.dictValue,label:item.dictLabel}
- });
- // console.log('getDeviceStatis',res);
- }else{
- uni.showToast({
- icon:'none',
- title:res.msg
- })
- }
- console.log('res',res);
- }).catch(err=>{
- console.log('err',err);
- })
- },
- getProcessType(){
- this.$u.api.processType().then(res=>{
- if(res.code==200){
- this.listMap.processTypeList = res.data.data.map(item=>{
- return {value:item.dictValue,label:item.dictLabel}
- });
- // console.log('getDeviceStatis',res);
- }else{
- uni.showToast({
- icon:'none',
- title:res.msg
- })
- }
- console.log('res',res);
- }).catch(err=>{
- console.log('err',err);
- })
- },
- // selectConfirm(e){
- // // console.log('e',e);
- // this.form.roadNo = e[0].value;
- // this.form.roadName = e[0].label;
- // // console.log('this.form',this.form);
- // },
- // 单列下拉选择框打开事件
- oneSelectOpen(key) {
- this.selectTag = key;
- this.selectData = this.listMap[key];
- this.selectShow = true
- },
- selectConfirm(e) {
- // console.log('selectConfirm',e);
- // console.log('selectTag', this.selectTag);
- switch (this.selectTag) {
- case 'isProcess': //处理状态
- // console.log('处理状态',e);
- this.form.isProcess = e[0].value;
- break;
- case 'processDeviceList': //处理设备
- this.form.processDevice = e[0].value;
- this.form.damageType = '';
- this.form.processType = '';
- // this.getDamageType();
- break;
- case 'damageTypeList': //损坏类型
- this.form.damageType = e[0].value;
- this.form.processType = '';
- // this.getProcessType();
- break;
- case 'processTypeList': //处理方式
- this.form.processType = e[0].value;
- break;
- default:
- // console.log('3', e);
- }
- },
- submit(){
- // console.log('this.form',this.form);
- let that = this;
- this.$refs.uForm.validate(valid => {
- if (valid) {
- console.log('验证通过');
- // delete this.dealForm.selectedUserList;
- let files = [];
- // 通过filter,筛选出上传进度为100的文件(因为某些上传失败的文件,进度值不为100,这个是可选的操作)
- files = this.$refs.uploadRef.lists.filter(val => {
- return val.progress == 100;
- })
- console.log('files',files);
- // 如果您不需要进行太多的处理,直接如下即可
- // files = this.$refs.uUpload.lists;
- files.forEach(function(item){
- console.log('item',item);
- if(item?.response?.data){that.form.imgList.push(item.response.data.url)}
- else if(item.url){that.form.imgList.push(item.url)}
- });
- if(this.reportId){
- this.editReport();
- }else{
- this.addReport();
- }
-
- } else {
- console.log('验证失败');
- }
- });
- },
- addReport(){
- let that = this;
- this.$u.api.deviceexcptionprocess(this.form).then(res=>{
- console.log('res',res);
- // this.form = {};
- uni.showToast({
- icon:'none',
- title:res.msg,
- duration:1500,
- });
- if(res.code==200){
- setTimeout(()=>{
- that.customBack()
- },1500)
- }
- }).catch(err=>{
- uni.showToast({
- icon:'none',
- title:err.msg
- })
- console.log('err',err);
- })
- },
- editReport(){
- let that = this;
- this.$u.api.editDeviceexcptionprocess(this.form).then(res=>{
- console.log('res',res);
- // this.form = {};
- uni.showToast({
- icon:'none',
- title:res.msg,
- duration:1500,
- });
- if(res.code==200){
- setTimeout(()=>{
- that.customBack()
- },1500)
- }
- }).catch(err=>{
- uni.showToast({
- icon:'none',
- title:err.msg
- })
- console.log('err',err);
- })
-
- }
- }
- }
- </script>
- <style>
- page{background-color: #F3F3F3;}
- </style>
- <style lang="scss" scoped>
- @import '@/pages/report/report.scss';
- .select-view{
- box-sizing: border-box;
- padding-right: 24rpx;
- width: 100%;
- text-align: right;
- }
- </style>
|