|
@@ -29,11 +29,14 @@
|
|
|
<view>
|
|
|
<view class="paizhao">现场照片</view>
|
|
|
<view class="paizhao-posit" v-if="!isview">
|
|
|
- <image :src="photograph" @click="photoUpload" class="tiantupian-photo"></image>
|
|
|
+ <view class="">
|
|
|
+ <image :src="photograph" @click="photoUpload" class="tiantupian-photo"></image>
|
|
|
+ <span v-if="loading" class="photo-loading">上传照片中...</span>
|
|
|
+ </view>
|
|
|
<view class="">
|
|
|
拍照上传
|
|
|
+
|
|
|
</view>
|
|
|
-
|
|
|
</view>
|
|
|
</view>
|
|
|
<view v-if="formData.streetRepPicsDOList" class="show-photo">
|
|
@@ -55,25 +58,21 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
-
|
|
|
</view>
|
|
|
</view>
|
|
|
-
|
|
|
</u--form>
|
|
|
</view>
|
|
|
<view class="sub-botn heigthButton">
|
|
|
<u-button v-if="isedit" @click="submit('customForm')" type="primary" shape="circle" size="large"
|
|
|
color="#4CB2B6" text="确认修改" style="width:200px">
|
|
|
</u-button>
|
|
|
- <u-button v-else-if="!formData.id" @click="submit('customForm')" type="primary" shape="circle"
|
|
|
- size="large" color="#4CB2B6" text="确认新增" style="width:200px">
|
|
|
+ <u-button v-else-if="!formData.id" @click="submit('customForm')" type="primary" shape="circle" size="large"
|
|
|
+ color="#4CB2B6" text="确认新增" style="width:200px">
|
|
|
</u-button>
|
|
|
- <u-button v-else-if="isview" @click="submit('customForm')" type="primary" shape="circle"
|
|
|
- size="large" color="#4CB2B6" text="返回" style="width:200px">
|
|
|
+ <u-button v-else-if="isview" @click="submit('customForm')" type="primary" shape="circle" size="large"
|
|
|
+ color="#4CB2B6" text="返回" style="width:200px">
|
|
|
</u-button>
|
|
|
</view>
|
|
|
- <!-- 加载中 -->
|
|
|
- <!-- <isLodingModel></isLodingModel> -->
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -120,7 +119,7 @@
|
|
|
isview: false, //查看
|
|
|
screenHeight: this.$screenHeight,
|
|
|
wheight: '',
|
|
|
- loading:false
|
|
|
+ loading: false
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
@@ -140,8 +139,6 @@
|
|
|
}
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
- this.loading=true
|
|
|
-
|
|
|
if (option.editData) {
|
|
|
this.isedit = true
|
|
|
this.parentId = option.editData
|
|
@@ -169,56 +166,60 @@
|
|
|
this.formData.streetRepPicsDOList.splice(index, 1)
|
|
|
},
|
|
|
photoUpload() {
|
|
|
+ this.loading = true
|
|
|
takePhotos(this)
|
|
|
- },
|
|
|
- bindDateChange(e) {
|
|
|
- this.formData.reporttime = e.detail.value
|
|
|
- },
|
|
|
- submit(ref) {
|
|
|
- this.$refs[ref].validate().then(res => {
|
|
|
- const formList = this.formData
|
|
|
- Object.keys(formList).forEach(key => {
|
|
|
- formList[key] = formList[key] === '' ? 0 : formList[key];
|
|
|
- });
|
|
|
- formList.streetRepPicsDOList.forEach((item) => {
|
|
|
- // 删除除了feildname和url以外的多余字段
|
|
|
- Object.keys(item).forEach((key) => {
|
|
|
- if (key !== 'feildname' && key !== 'url' && key !== 'repid') {
|
|
|
- delete item[key];
|
|
|
- }
|
|
|
- });
|
|
|
- // 如果feildname为空,赋值为默认名称
|
|
|
- if (!item.feildname) {
|
|
|
- item.feildname = '默认名称';
|
|
|
+ },
|
|
|
+ bindDateChange(e) {
|
|
|
+ this.formData.reporttime = e.detail.value
|
|
|
+ },
|
|
|
+ submit(ref) {
|
|
|
+ this.$refs[ref].validate().then(res => {
|
|
|
+ const formList = this.formData
|
|
|
+ Object.keys(formList).forEach(key => {
|
|
|
+ formList[key] = formList[key] === '' ? 0 : formList[key];
|
|
|
+ });
|
|
|
+ formList.streetRepPicsDOList.forEach((item) => {
|
|
|
+ // 删除除了feildname和url以外的多余字段
|
|
|
+ Object.keys(item).forEach((key) => {
|
|
|
+ if (key !== 'feildname' && key !== 'url' && key !== 'repid') {
|
|
|
+ delete item[key];
|
|
|
}
|
|
|
});
|
|
|
- console.log(formList, 'this.formData');
|
|
|
- if (this.isedit) {
|
|
|
- updateCzfpczl(JSON.stringify(this.formData)).then(res => {
|
|
|
- this.$modal.msg('修改成功')
|
|
|
- this.isedit = false
|
|
|
- setTimeout(() => {
|
|
|
- uni.navigateBack()
|
|
|
- }, 400)
|
|
|
- })
|
|
|
- } else if (this.isview) {
|
|
|
- this.isview = false
|
|
|
- uni.navigateBack()
|
|
|
- } else {
|
|
|
- createCzfpczl(JSON.stringify(this.formData)).then(res => {
|
|
|
- this.$modal.msg('新增成功')
|
|
|
- setTimeout(() => {
|
|
|
- uni.navigateBack()
|
|
|
- }, 400)
|
|
|
- })
|
|
|
+ // 如果feildname为空,赋值为默认名称
|
|
|
+ if (!item.feildname) {
|
|
|
+ item.feildname = '默认名称';
|
|
|
+ }
|
|
|
+ if(this.isedit&&!item.repid){
|
|
|
+ item.repid=this.parentId
|
|
|
}
|
|
|
+ });
|
|
|
+ console.log(formList, 'this.formData');
|
|
|
+ if (this.isedit) {
|
|
|
+ updateCzfpczl(JSON.stringify(this.formData)).then(res => {
|
|
|
+ this.$modal.msg('修改成功')
|
|
|
+ this.isedit = false
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.navigateBack()
|
|
|
+ }, 400)
|
|
|
+ })
|
|
|
+ } else if (this.isview) {
|
|
|
+ this.isview = false
|
|
|
+ uni.navigateBack()
|
|
|
+ } else {
|
|
|
+ createCzfpczl(JSON.stringify(this.formData)).then(res => {
|
|
|
+ this.$modal.msg('新增成功')
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.navigateBack()
|
|
|
+ }, 400)
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
- }).catch(err => {
|
|
|
- console.log(err);
|
|
|
- })
|
|
|
- }
|
|
|
+ }).catch(err => {
|
|
|
+ console.log(err);
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
|
|
@@ -241,7 +242,8 @@
|
|
|
box-shadow: 0px 0px 3px 0px rgba(86, 165, 168, 0.15);
|
|
|
border-radius: 30rpx;
|
|
|
}
|
|
|
- .example{
|
|
|
+
|
|
|
+ .example {
|
|
|
overflow-y: auto;
|
|
|
}
|
|
|
</style>
|