123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631 |
- <template>
- <view>
- <image src="https://cczdsz.cn/app/images//background-from.png" mode="" class="background"></image>
- <view class="project-content">
- <u-form labelPosition="left" :model="form" :rules="rules" ref="form">
- <u-form-item label="工程名称" labelWidth="150" borderBottom ref="item1">
- <u-input v-model="form.enginName" borderBottom placeholder="请输入工程名称" ></u-input>
- </u-form-item>
- <u-form-item label="涉及户数" labelWidth="150" borderBottom ref="item1">
- <u-input v-model="form.houseHolds" borderBottom placeholder="请输入涉及户数" ></u-input>
- </u-form-item>
- <u-form-item label="接警时间" borderBottom ref="item1" labelWidth="150">
- <u-input v-model="form.repairTime" borderBottom placeholder="请选择接警时间" disabled
- @click="showtime=true "></u-input>
- <u-picker v-model="showtime" mode="time" :params="params" @confirm="time()"></u-picker>
- </u-form-item>
- <u-form-item label="报修人名称" labelWidth="150" borderBottom ref="item1">
- <u-input v-model="form.repairName" borderBottom placeholder="请输入报修人名称" ></u-input>
- </u-form-item>
- <u-form-item label="联系电话" labelWidth="150" borderBottom ref="item1">
- <u-input v-model="form.repairPhone" borderBottom placeholder="请输入联系电话"
- ></u-input>
- </u-form-item>
- <u-form-item label="报修类型" labelWidth="150" borderBottom ref="item1">
- <u-input v-model="repairTypeLabel" disabled @click=" showrepairType= true;" borderBottom
- disabledColor="#ffffff" placeholder="请选择报修类型" ></u-input>
- <u-input v-model="labelList.repair_type" disabled borderBottom disabledColor="#ffffff"
- placeholder="请选择报修类型" v-if="type==1"></u-input>
- <u-select v-model="showrepairType" :list="typelist.repair_type" label-name="dictLabel"
- value-name="dictValue" @confirm="repairType()" :value="form.repairType"></u-select>
- <u-icon slot="right" name="arrow-right"></u-icon>
- </u-form-item>
- <u-form-item borderBottom ref="item1">
- <view>报修内容</view>
- <u-input v-model="form.repairContent" type="textarea" showWordLimit='255' borderBottom
- placeholder="请输入报修内容"></u-input>
- </u-form-item>
- <u-form-item label="到达时间" labelWidth="150" borderBottom ref="item1">
- <u-input v-model="form.arrivalTime" borderBottom disabled
- @click="showtime4=true "></u-input>
- <u-picker v-model="showtime4" mode="time" :params="params" @confirm="time4()"></u-picker>
- </u-form-item>
- <u-form-item label="损坏原因" labelWidth="150" borderBottom ref="item1">
- <u-input v-model="causesOfFamageLabel" disabled @click=" causesOfFamageType = true;"
- borderBottom placeholder="请选择损坏原因"></u-input>
- <u-input v-model="labelList.causes_of_damage" disabled v-if="type==1" borderBottom
- placeholder="请选择损坏原因"></u-input>
- <u-select v-model="causesOfFamageType" :list="typelist.causes_of_damage" label-name="dictLabel"
- value-name="dictValue" @confirm="causesOfFamage()" :value="form.causesOfFamage"></u-select>
- <u-icon slot="right" name="arrow-right"></u-icon>
- </u-form-item>
- <u-form-item label="施工管径" labelWidth="150" borderBottom ref="item1">
- <u-input v-model="form.constructionPipeDiameter" borderBottom
- placeholder="请输入施工管径"></u-input>
- </u-form-item>
- <u-form-item label="管线压力" labelWidth="150" borderBottom ref="item1">
- <u-input v-model="pipelinePressureLabel" disabled @click=" pipelinePressureType= true;"
- placeholder="请输入管线压力" borderBottom></u-input>
- <u-input v-model="labelList.pipeline_pressure" disabled borderBottom v-if="type==1"></u-input>
- <u-select v-model="pipelinePressureType" :list="typelist.pipeline_pressure" label-name="dictLabel"
- value-name="dictValue" @confirm="pipelinePressure()" :value="form.pipelinePressure"></u-select>
- <u-icon slot="right" name="arrow-right"></u-icon>
- </u-form-item>
- <u-form-item label="停气方式" labelWidth="150" borderBottom ref="item1">
- <u-input v-model="form.stopGasMethod" borderBottom
- placeholder="请输入停气方式"></u-input>
- </u-form-item>
- <u-form-item label="使用材料" labelWidth="150" borderBottom ref="item1">
- <u-input v-model="form.usingMaterials" borderBottom
- placeholder="请输入使用材料" ></u-input>
- </u-form-item>
- <u-form-item label="维修人" labelWidth="150" borderBottom ref="item1">
- <u-input v-model="form.maintenanceName" borderBottom disabled
- placeholder="请输入维修人" @click="workerModel=true "></u-input>
- <!-- <u-select v-model="workerModel" :list="workerList" label-name="name"
- value-name="id" @confirm="Worker()" :value="form.maintenanceName"></u-select> -->
- <u-popup v-model="workerModel" style= "height: 200px ;padding: 40rpx 36rpx;"mode="bottom">
- <view style="color: #00aaff;margin-left: 10px;">维修人</view>
- <u-search placeholder="请输入维修人名称" v-model="namevalue" :action-style="{'font-size':'40rpx'}" :show-action="false" @search="getWorker()"></u-search>
- <scroll-view class="scroll-view" scroll-y="true" :scroll-top="scrollTop" style= "padding: 20rpx 36rpx; height: 200px; overflow-y:scroll;" >
- <u-checkbox-group width="200px" @change="checkboxGroupChange" style="margin: 0 0 40rpx 0;">
- <u-checkbox :customStyle="{marginBottom: '20px'}"
- @change="checkboxChange"
- v-model="item.checked"
- v-for="(item, index) in workerList" :key="item.id"
- :name="item.name"
- :label="item.name"
- >{{item.name}}
- </u-checkbox>
- </u-checkbox-group>
- </scroll-view>
- <view style="overflow: hidden;margin: 40rpx 0 0 0; padding: 40rpx 36rpx;">
- <u-button @click="workerCancel()" style="width: 46%; float: left;background: #eae9e9;">取消</u-button>
- <u-button@click="workerButton()" type="primary" style="width: 46%; float: right;background: #0f59ca !important; color: #fff;">确认</u-button>
- </view>
- </u-popup>
- <u-icon slot="right" name="arrow-right"></u-icon>
- </u-form-item>
- <u-form-item label="施工时间" labelWidth="150" borderBottom ref="item1">
- <u-input v-model="form.constructionTime" borderBottom disabled
- @click="showtime3=true "></u-input>
- <u-picker v-model="showtime3" mode="time" :params="params" @confirm="time3()"></u-picker>
- </u-form-item>
- <u-form-item label="现场领导" labelWidth="150" borderBottom ref="item1">
- <u-input v-model="form.onSiteLeadership" borderBottom placeholder="请输入现场领导" ></u-input>
- </u-form-item>
- <u-form-item label="完成时间" labelWidth="150" borderBottom ref="item1">
- <u-input v-model="form.maintenanceTime" borderBottom disabled
- @click="showtime2=true "></u-input>
- <u-picker v-model="showtime2" mode="time" :params="params" @confirm="time2()"></u-picker>
- </u-form-item>
- <u-form-item label="维修照片" labelWidth="150" borderBottom ref="item1">
- <view class="" style="display: flex; flex-wrap: wrap; margin: 0 55rpx;">
- <image src="https://cczdsz.cn/app/images//chooseimg.png" mode=""
- style="width: 190rpx; height: 190rpx; margin: 0 12rpx; " @click="choose()" >
- </image>
- <view v-for="(item,index) in imgymxs" :key="index" style="position: relative;">
- <view v-if="item.type == 'image'">
- <image :src="item.url" mode="" style="width: 190rpx; height: 190rpx; margin: 0 20rpx;"
- @click="showPhoto(index)">
- </image>
- </view>
- <view v-else>
- <video :src="item" style="width: 190rpx; height: 190rpx; margin: 0 20rpx;"></video>
- </view>
- <view @click="remove(index)"
- style="position: absolute; top: 0; right: 14rpx; border-radius: 50%; background-color: #FF0000;">
- <u-icon name="close" color="#FFFFFF" size="25" ></u-icon>
- </view>
- </view>
- </view>
- </u-form-item>
- <u-form-item borderBottom ref="item1">
- <view>备注</view>
- <u-input v-model="form.remarks" borderBottom type="textarea" ></u-input>
- </u-form-item>
- </u-form>
- <u-button @click="save()" type='primary' v-if="type!=1">确认上传</u-button>
- <u-button @click="update()" type='primary' v-else>确认修改</u-button>
- </view>
- </view>
- </template>
- <script>
- import service from '@/api/index.js'
- export default {
- data() {
- return {
- params: {
- year: true,
- month: true,
- day: true,
- hour: true,
- minute: true,
- second: false
- },
- showtime: false,
- action: this.$HTTP.webUrl + `/obs`,
- causesOfFamageType: false,
- pipelinePressureType: false,
- repairTypeLabel: null,
- causesOfFamageLabel: null,
- pipelinePressureLabel: null,
- showtime2: false,
- showtime3: false,
- showtime4: false,
- headers: {
- MAuthorization: "wxBearer " + uni.getStorageSync('token')
- },
- url: [],
- uploading: false,
- imgArr: [],
- imgymxs: [],
- causesOfDamage: null,
- progress: 0, //图片或视频上传百分比
- form: {},
- userInfo: {},
- showrepairType: false,
- community: null,
- communityName: null,
- dictlist: ['causes_of_damage', 'pipeline_pressure', 'repair_type'],
- typelist: {},
- typelist2: {},
- labelList: {},
- type: 2,
- id: null,
- createBy:null,
- workerList:[],
- workerModel:false,
- WorkerList:[],
- WorkerName:null,
- userIdList:[],
- maintenanceName:null,
- namevalue:''
- };
- },
- onLoad(e) {
- this.getdictsysinfo()
- this.type = e.type
- this.id = e.id
- uni.setNavigationBarTitle({
- title: '抢险维修单'
- });
- uni.setNavigationBarColor({
- frontColor: '#ffffff',
- backgroundColor: '#2d95f4',
- })
- this.getUserName()
- this.getWorker()
- },
- onShow() {},
- methods: {
- checkboxGroupChange(val)
- {
- this.WorkerList=val
- // this.maintenanceName=this.WorkerList.join(",")
- // console.log(111,this.maintenanceName)
- },
- workerCancel()
- {
- this.WorkerList=[]
- this.workerModel=false
- },
- workerButton()
- {
- this.form.maintenanceName=this.WorkerList.join(",")
- console.log(111,this.form.maintenanceName)
- this.workerModel=false
- },
- checkboxChange(val)
- {
- console.log(222,val)
- },
- getdictsysinfo() {
- let _this = this
- service.getDictInfoList({
- type: this.dictlist
- }).then(res => {
- _this.typelist = res
- if (this.type == 1) {
- let _this = this
- console.log(this.id)
- service.getemergencyRepair(this.id).then(res => {
- console.log(_this.typelist)
- let list = []
- list = _this.typelist.repair_type
- list.forEach((item) => {
- if (item.dictValue == res.repairType) {
- _this.labelList.repair_type = item.dictLabel
- }
- })
- let list2 = []
- list2 = _this.typelist.causes_of_damage
- list2.forEach((item) => {
- if (item.dictValue == res.causesOfDamage) {
- _this.labelList.causes_of_damage = item.dictLabel
- }
- })
- let list3 = []
- list3 = _this.typelist.pipeline_pressure
- list3.forEach((item) => {
- if (item.dictValue == res.pipelinePressure) {
- _this.labelList.pipeline_pressure = item.dictLabel
- }
- })
- if (null != res.photoList) {
- res.photoList.forEach(item => {
- let url = {}
- url.url = item
- url.type = 'image'
- this.imgymxs.push(url)
- this.imgArr.push(item)
- })
- }
- this.form = res
- })
- } else {
- // this.getwarningPileInfo(e.value)
- }
- })
- },
- showPhoto(index) {
- uni.previewImage({
- current: index,
- urls: this.imgArr,
- })
- },
- showPhotos(index) {
- uni.previewImage({
- current: index,
- urls: this.photo,
- })
- },
- getdictinfo(data, value) {
- let _this = this
- let name = null
- service.getDictInfo({
- type: data
- }).then(res => {
- let list = []
- list = res
- list.forEach((item) => {
- if (item.dictValue == value) {
- _this.labelList[item.dictType] = item.dictLabel
- }
- })
- })
- },
- Worker(val)
- {
- console.log(val)
- },
- getWorker()
- {
- service.getWorker({type:'0',name:this.namevalue}).then(res=>{
- console.log(res)
- this.workerList=res
- })
- },
- time(e) {
- console.log(`${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}`)
- this.form.repairTime = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}`
- },
- time2(e) {
- console.log(`${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}`)
- this.form.maintenanceTime = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}`
- },
- time3(e) {
- console.log(`${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}`)
- this.form.constructionTime = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}`
- },
- time4(e) {
- console.log(`${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}`)
- this.form.arrivalTime = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}`
- },
- update()
- {
- let _this = this
- // this.form.unitId=this.unit
- if(this.imgArr.length==0)
- {
- _this.$UTILS.showPrompt('请上传照片!')
- return
- }
- this.form.pressureStatus = null
- this.form.photoList = this.imgArr
- this.form.userId=this.userId
- this.form.createBy=this.userId
- service.updateemergencyRepair(this.form).then(res => {
- console.log(res)
- _this.$UTILS.showPrompt('修改成功!')
- // setTimeout(() => {
- // console.log('跳')
- // uni.switchTab({
- // url: '/pages/index/index'
- // })
- // }, 2000)
- // this.form={}
- // this.maintenanceName=''
- // this.labelList.repair_type=''
- // this.repairTypeLabel=''
- // this.labelList.causes_of_damage=''
- // this.causesOfFamageLabel=''
- // this.causesOfFamageType=''
- // this.labelList.pipeline_pressure=''
- // this.pipelinePressureLabel=''
- // this.pipelinePressureType=''
- // this.showtime2=''
- // this.imgArr=[]
- // this.imgymxs=[]
- })
- },
- save() {
- let _this = this
- // this.form.unitId=this.unit
- if(this.imgArr.length==0)
- {
- _this.$UTILS.showPrompt('请上传照片!')
- return
- }
- this.form.photoList = this.imgArr
- this.form.userId=this.userId
- this.form.createBy=this.userId
- service.setemergencyRepair(this.form).then(res => {
- console.log(res)
- _this.$UTILS.showPrompt('上报成功!')
- // setTimeout(() => {
- // console.log('跳')
- // uni.switchTab({
- // url: '/pages/index/index'
- // })
- // }, 2000)
- this.form={}
- this.maintenanceName=''
- this.labelList.repair_type=''
- this.repairTypeLabel=''
- this.labelList.causes_of_damage=''
- this.causesOfFamageLabel=''
- this.causesOfFamageType=''
- this.labelList.pipeline_pressure=''
- this.pipelinePressureLabel=''
- this.pipelinePressureType=''
- this.showtime2=''
- this.imgArr=[]
- this.imgymxs=[]
- })
- },
- getUserName(){
- service.getUserName().then(res=>{
- this.userId=res.id
- this.createBy=res.name
- })
- },
- repairType(e) {
- console.log(e[0])
- this.form.repairType = e[0].value
- this.repairTypeLabel = e[0].label
- },
- causesOfFamage(e) {
- this.causesOfDamage = e[0].value
- this.form.causesOfDamage = e[0].value
- console.log(e[0])
- this.causesOfFamageLabel = e[0].label
- },
- pipelinePressure(e) {
- console.log(e[0])
- this.form.pipelinePressure = e[0].value
- this.pipelinePressureLabel = e[0].label
- },
- choose() {
- let _this = this;
- uni.showActionSheet({
- title: '上传',
- itemList: ['图片', '视频'],
- success: (res) => {
- // console.log(res)
- if (res.tapIndex == 0) {
- this.chooseimage()
- } else {
- this.choosevideo()
- }
- }
- })
- },
- chooseimage() {
- console.log('图片')
- let _this = this;
- uni.chooseImage({
- sourceType: ['camera','album'],
- success(resp) {
- console.log('res--uni.chooseMedia', resp);
- resp.tempFiles.forEach((item, index) => {
- const task = uni.uploadFile({
- url: _this.$HTTP.webUrl + `/obs`,
- filePath: item.path,
- name: 'file',
- formData: {},
- header: _this.headers,
- success: res => {
- // 判断是否json字符串,将其转为json格式
- let data = _this.$u.test.jsonString(res.data) ? JSON.parse(
- res.data) : res.data;
- if (![200, 201, 204].includes(res.statusCode)) {
- // this.uploadError(index, data);
- _this.$UTILS.showPrompt('选取失败!')
- } else {
- // 上传成功
- // this.lists[index].response = data;
- // this.lists[index].progress = 100;
- // this.lists[index].error = false;
- // this.$emit('on-success', data, index, this.lists, this
- // .index);
- if (_this.progress === 100) {
- // console.log('_this.progress', _this.progress)
- // console.log('data----', data)
- // console.log('res--', res)
- _this.imgymxs.push({
- url: data.data.url,
- type: 'image'
- })
- _this.imgArr.push(data.data.url)
- // console.log('imgArr', _this.imgArr)
- _this.$UTILS.showPrompt('选取成功!')
- }
- }
- },
- fail: e => {
- _this.$UTILS.showPrompt('选取失败!')
- this.uploadError(index, e);
- },
- complete: res => {
- _this.uploading = false;
- // _this.uploadFile(index + 1);
- // this.$emit('on-change', res, index, this.lists, this
- // .index);
- }
- });
- task.onProgressUpdate(res => {
- // if (res.progress > 0) {
- // this.lists[index].progress = res.progress;
- // this.$emit('on-progress', res, index, this.lists, this.index);
- // }
- _this.progress = res.progress;
- console.log('onProgressUpdate', res)
- uni.showLoading({
- title: '选取中'
- })
- });
- })
- },
- })
- },
- choosevideo() {
- let _this = this;
- console.log('视频')
- uni.chooseVideo({
- sourceType: ['camera'],
- maxDuration: 30,
- success(resp) {
- const task = uni.uploadFile({
- url: _this.$HTTP.webUrl + `/obs`,
- filePath: resp.tempFilePath,
- name: 'file',
- formData: {},
- header: _this.headers,
- success: res => {
- // 判断是否json字符串,将其转为json格式
- let data = _this.$u.test.jsonString(res.data) ? JSON.parse(res.data) :
- res.data;
- if (![200, 201, 204].includes(res.statusCode)) {
- this.uploadError(index, data);
- } else {
- // 上传成功
- // this.lists[index].response = data;
- // this.lists[index].progress = 100;
- // this.lists[index].error = false;
- // this.$emit('on-success', data, index, this.lists, this
- // .index);
- if (_this.progress === 100) {
- console.log('_this.progress', _this.progress)
- console.log('data----', data)
- console.log('res--', res)
- // _this.imgArr.push(data.data.url)
- _this.imgymxs.push({
- url: data.data.url,
- type: 'video'
- })
- _this.imgArr.push(data.data.url)
- console.log('imgArr', _this.imgArr)
- _this.$UTILS.showPrompt('选取成功!')
- }
- }
- },
- fail: e => {
- _this.$UTILS.showPrompt('选取失败!')
- this.uploadError(index, e);
- },
- complete: res => {
- uni.hideLoading();
- _this.uploading = false;
- // _this.uploadFile(index + 1);
- // this.$emit('on-change', res, index, this.lists, this
- // .index);
- }
- });
- task.onProgressUpdate(res => {
- // if (res.progress > 0) {
- // this.lists[index].progress = res.progress;
- // this.$emit('on-progress', res, index, this.lists, this.index);
- // }
- _this.progress = res.progress;
- console.log('onProgressUpdate', res)
- uni.showLoading({
- title: '选取中'
- })
- });
- },
- })
- },
- remove(index) {
- uni.showModal({
- title: '提示',
- content: '是否删除该图片或视频?',
- success: (res) => {
- if (res.confirm) {
- this.imgArr.splice(index, 1);
- this.imgymxs.splice(index, 1);
- console.log('this.imgarr', this.imgArr)
- }
- }
- })
- },
- }
- }
- </script>
- <style lang="scss">
- .scroll-view {
- white-space: nowrap;
- height: 200px;
- width: 100%;
- }
- .u-form-right__content__slot{
- display: flex;
- }
- .background {
- z-index: -1;
- position: fixed;
- width: 100%;
- height: 100%;
- background-size: 100% 100%;
- top: 0;
- }
- .project-content {
- padding: 20rpx;
- border-radius: 20rpx;
- width: 90%;
- margin: 0 auto;
- background: #fff;
- }
- .button {
- background: #2d95f4;
- }
- </style>
|