Merge branch 'dev' of http://git.sinoecare.com/sinoecare/digital_village_v2/dvcp_v2_webapp into dev
This commit is contained in:
		
							
								
								
									
										158
									
								
								packages/3.0.0/AppVillageAlbum/components/Add.vue
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										158
									
								
								packages/3.0.0/AppVillageAlbum/components/Add.vue
									
									
									
									
										vendored
									
									
								
							| @@ -8,21 +8,24 @@ | |||||||
|       <ai-card title="基本信息"> |       <ai-card title="基本信息"> | ||||||
|         <template #content> |         <template #content> | ||||||
|           <el-form class="ai-form" :model="form" label-width="120px" ref="form"> |           <el-form class="ai-form" :model="form" label-width="120px" ref="form"> | ||||||
|             <el-form-item label="相册主题" style="width: 100%;" prop="type" :rules="[{required: true, message: '请选择相册主题', trigger: 'blur'}]"> |             <el-form-item label="相册主题" style="width: 100%;" prop="type" | ||||||
|  |                           :rules="[{required: true, message: '请选择相册主题', trigger: 'blur'}]"> | ||||||
|               <ai-select |               <ai-select | ||||||
|                 v-model="form.type" |                   v-model="form.type" | ||||||
|                 placeholder="请选择相册主题" |                   placeholder="请选择相册主题" | ||||||
|                 :selectList="dict.getDict('villagePictureAlbumType')"> |                   :selectList="dict.getDict('villagePictureAlbumType')"> | ||||||
|               </ai-select> |               </ai-select> | ||||||
|             </el-form-item> |             </el-form-item> | ||||||
|             <el-form-item prop="areaId" style="width: 100%;" label="发布地区" :rules="[{required: true, pattern: /[^000]$/, message: '请选择到村', trigger: 'change'}]"> |             <el-form-item prop="areaId" style="width: 100%;" label="发布地区" | ||||||
|               <ai-area-select @fullname="v => form.areaName = v" clearable always-show :instance="instance" v-model="form.areaId" :disabled-level="disabledLevel"></ai-area-select> |                           :rules="[{required: true, pattern: /([^0]\d{2}|0[^0]\d|0\d[^0])$/, message: '请选择到村', trigger: 'change'}]"> | ||||||
|  |               <ai-area-select @fullname="v => form.areaName = v" clearable always-show :instance="instance" | ||||||
|  |                               v-model="form.areaId" :disabled-level="disabledLevel"></ai-area-select> | ||||||
|             </el-form-item> |             </el-form-item> | ||||||
|             <el-form-item label="图片" style="width: 100%;" prop="urlList" :rules="[{required: true,  message: '请上传图片'}]"> |             <el-form-item label="图片" style="width: 100%;" prop="urlList" :rules="[{required: true,  message: '请上传图片'}]"> | ||||||
|               <ai-uploader |               <ai-uploader | ||||||
|                 :instance="instance" |                   :instance="instance" | ||||||
|                 v-model="form.urlList" |                   v-model="form.urlList" | ||||||
|                 :limit="9"> |                   :limit="9"> | ||||||
|               </ai-uploader> |               </ai-uploader> | ||||||
|             </el-form-item> |             </el-form-item> | ||||||
|           </el-form> |           </el-form> | ||||||
| @@ -37,82 +40,83 @@ | |||||||
| </template> | </template> | ||||||
|  |  | ||||||
| <script> | <script> | ||||||
|   import { mapState } from 'vuex' | import {mapState} from 'vuex' | ||||||
|   export default { |  | ||||||
|     name: 'Add', |  | ||||||
|  |  | ||||||
|     props: { | export default { | ||||||
|       instance: Function, |   name: 'Add', | ||||||
|       dict: Object, |  | ||||||
|       params: Object |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     data () { |   props: { | ||||||
|       return { |     instance: Function, | ||||||
|         info: {}, |     dict: Object, | ||||||
|         form: { |     params: Object | ||||||
|           areaName: '', |   }, | ||||||
|           areaId: '', |  | ||||||
|           urlList: [] |  | ||||||
|         }, |  | ||||||
|         cropOps: { |  | ||||||
|           width: "336px", |  | ||||||
|           height: "210px" |  | ||||||
|         }, |  | ||||||
|         id: '' |  | ||||||
|       } |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     computed: { |   data() { | ||||||
|       ...mapState(['user']) |     return { | ||||||
|     }, |       info: {}, | ||||||
|  |       form: { | ||||||
|     created () { |         areaName: '', | ||||||
|       this.form.areaId = this.user.info.areaId |         areaId: '', | ||||||
|       this.disabledLevel = this.user.info.areaList.length |         urlList: [] | ||||||
|       this.dict.load(['villagePictureAlbumType']) |  | ||||||
|       if (this.params && this.params.id) { |  | ||||||
|         this.id = this.params.id |  | ||||||
|         this.getInfo(this.params.id) |  | ||||||
|       } |  | ||||||
|     }, |  | ||||||
|  |  | ||||||
|     methods: { |  | ||||||
|       getInfo (id) { |  | ||||||
|         this.instance.post(`/app/appcountrysidetourism/queryDetailById?id=${id}`).then(res => { |  | ||||||
|           if (res.code === 0) { |  | ||||||
|             this.form = res.data |  | ||||||
|           } |  | ||||||
|         }) |  | ||||||
|       }, |       }, | ||||||
|  |       cropOps: { | ||||||
|       confirm () { |         width: "336px", | ||||||
|         this.$refs.form.validate((valid) => { |         height: "210px" | ||||||
|           if (valid) { |  | ||||||
|             this.instance.post(`/app/appvillagepicturealbum/addPictures`, { |  | ||||||
|               ...this.form, |  | ||||||
|               id: this.params.id, |  | ||||||
|               urlList: this.form.urlList.map(v => v.url) |  | ||||||
|             }).then(res => { |  | ||||||
|               if (res.code == 0) { |  | ||||||
|                 this.$message.success('提交成功') |  | ||||||
|                 setTimeout(() => { |  | ||||||
|                   this.cancel(true) |  | ||||||
|                 }, 600) |  | ||||||
|               } |  | ||||||
|             }) |  | ||||||
|           } |  | ||||||
|         }) |  | ||||||
|       }, |       }, | ||||||
|  |       id: '' | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |  | ||||||
|       cancel (isRefresh) { |   computed: { | ||||||
|         this.$emit('change', { |     ...mapState(['user']) | ||||||
|           type: 'list', |   }, | ||||||
|           isRefresh: !!isRefresh |  | ||||||
|         }) |   created() { | ||||||
|       } |     this.form.areaId = this.user.info.areaId | ||||||
|  |     this.disabledLevel = this.user.info.areaList.length | ||||||
|  |     this.dict.load(['villagePictureAlbumType']) | ||||||
|  |     if (this.params && this.params.id) { | ||||||
|  |       this.id = this.params.id | ||||||
|  |       this.getInfo(this.params.id) | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   methods: { | ||||||
|  |     getInfo(id) { | ||||||
|  |       this.instance.post(`/app/appcountrysidetourism/queryDetailById?id=${id}`).then(res => { | ||||||
|  |         if (res.code === 0) { | ||||||
|  |           this.form = res.data | ||||||
|  |         } | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |  | ||||||
|  |     confirm() { | ||||||
|  |       this.$refs.form.validate((valid) => { | ||||||
|  |         if (valid) { | ||||||
|  |           this.instance.post(`/app/appvillagepicturealbum/addPictures`, { | ||||||
|  |             ...this.form, | ||||||
|  |             id: this.params.id, | ||||||
|  |             urlList: this.form.urlList.map(v => v.url) | ||||||
|  |           }).then(res => { | ||||||
|  |             if (res.code == 0) { | ||||||
|  |               this.$message.success('提交成功') | ||||||
|  |               setTimeout(() => { | ||||||
|  |                 this.cancel(true) | ||||||
|  |               }, 600) | ||||||
|  |             } | ||||||
|  |           }) | ||||||
|  |         } | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |  | ||||||
|  |     cancel(isRefresh) { | ||||||
|  |       this.$emit('change', { | ||||||
|  |         type: 'list', | ||||||
|  |         isRefresh: !!isRefresh | ||||||
|  |       }) | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  | } | ||||||
| </script> | </script> | ||||||
|  |  | ||||||
| <style scoped lang="scss"> | <style scoped lang="scss"> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user