123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <template>
- <view class="wrap">
- <uni-section :title="point.pointContent" type="line">
- <uni-forms ref="form" :modelValue="formData" :rules="rules" :label-width="300" label-position="top">
- <uni-forms-item label="检查结果" name="checkResult" required>
- <view class="uni-data-checkbox-wrap">
- <uni-data-checkbox v-model="formData.checkResult" :localdata="checkResults" />
- </view>
- </uni-forms-item>
- <uni-forms-item label="备注" name="remark">
- <uni-easyinput v-model="formData.remark" type="textarea" :maxlength="-1" autoHeight placeholder="备注" />
- </uni-forms-item>
- <uni-file-picker v-model="formData.attachList"
- fileMediatype="image"
- title="请上传附件"
- limit="1"
- @select="uploadSuccess"
- @delete="deleteFile"></uni-file-picker>
- </uni-forms>
- </uni-section>
- <button type="primary" @click="onSubmit" class="submit-BT">提交</button>
- </view>
- </template>
- <script>
- import {upload} from '@/api/system/upload.js'
- import {updateChecklistPoint} from '@/api/aqpt/checklistPoint.js'
- export default {
- data() {
- return {
- checkResults:[
- {text:"通过",value:1},
- {text:"不通过",value:-1},
- ],
- formData:{
- checkResult:1,
- remark:"",
- attachList:[]
- },
- rules:{},
- point:{}
- }
- },
- onBackPress() {
- },
- onLoad() {
- this.init()
- },
- methods: {
- init(){
- let point=uni.getStorageSync('point');
- this.point=point;
- },
- getLocation(){
- const self=this;
- uni.getLocation({
- type: 'wgs84',
- success: function (res) {
- self.formData.dutyLongitude=res.longitude
- self.formData.dutyLatitude=res.latitude
- }
- });
- },
- async onSubmit() {
- let point=uni.getStorageSync('point')
- let attachList=[]
- for(let i=0;i<this.formData.attachList.length;i++){
- let filePath=this.formData.attachList[i].url
- fileresq=await upload({filePath,formData:{
- additions: `经度:${this.formData.dutyLongitude};纬度:${this.formData.dutyLatitude}`
- }})
- fileresq=JSON.parse(fileresq)
- attachList.push(fileresq.data)
- }
- await updateChecklistPoint({
- recordId:point.recordId,
- checklistId:point.checklistId,
- itemId:point.itemId,
- pointId:point.pointId,
- checkResult:this.formData.checkResult,
- remark:this.formData.remark,
- attachList,
- }).catch(()=>{
- uni.showToast({
- icon:'none',
- title:"提交失败!"
- })
- })
- uni.showToast({
- icon:'none',
- title:"提交成功!",
- complete() {
- uni.redirectTo({
- url:`/pages/app_views/checkList/index/index?type=form&id=${point.checklistId}&recordId=${point.recordId}`
- })
- }
- })
- },
- uploadSuccess(e){
- let attachList=JSON.parse(JSON.stringify(this.formData.attachList))
- attachList.push(e.tempFiles[0])
- this.formData.attachList=attachList
- },
- deleteFile(e){
- let attachList=JSON.parse(JSON.stringify(this.formData.attachList))
- attachList.filter(item=>item.uuid!==e.tempFile.uuid)
- this.formData.attachList=attachList
- },
- },
- onUnload() {
- uni.removeStorageSync('point')
- }
- }
- </script>
- <style lang="scss" scoped>
- .wrap{
- padding: 20rpx;
- .submit-BT {
- width: 750rpx;
- color: #4D73FF;
- text-align: center;
- font-size: 32rpx;
- padding-bottom: 68rpx;
- background-color: #fff;
- position: fixed;
- left: 0;
- bottom: 0;
- z-index: 99;
- box-shadow: 0px 0px 12px 0px #0000000A;
- border-radius: 8px 8px 0px 0px
- }
- ::v-deep .uni-forms-item{
- .uni-forms-item__content{
- .uni-data-checkbox-wrap{
- height: 100%;
- display: flex;
- align-items: center;
- }
-
- }
- }
- }
- </style>
|