Merge remote-tracking branch 'origin/build' into build
# Conflicts: # project/pingchang/apps/AppRiskArea/components/List.vue
This commit is contained in:
		| @@ -0,0 +1,65 @@ | ||||
| <template> | ||||
|   <div class="doc-circulation ailist-wrapper"> | ||||
|     <keep-alive :include="['List']"> | ||||
|       <component ref="component" :moduleName="moduleName" :moduleId="moduleId" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component> | ||||
|     </keep-alive> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   import List from './components/List' | ||||
|   import Add from './components/Add' | ||||
|  | ||||
|   export default { | ||||
|     name: 'AppCheckpointManage', | ||||
|     label: '卡口管理', | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object | ||||
|     }, | ||||
|  | ||||
|     data () { | ||||
|       return { | ||||
|         component: 'List', | ||||
|         params: {}, | ||||
|         moduleId: '', | ||||
|         include: [], | ||||
|         moduleName: '' | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     components: { | ||||
|       Add, | ||||
|       List | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       onChange (data) { | ||||
|         if (data.type === 'Add') { | ||||
|           this.component = 'Add' | ||||
|           this.params = data.params | ||||
|         } | ||||
|  | ||||
|         if (data.type === 'list') { | ||||
|           this.component = 'List' | ||||
|           this.params = data.params | ||||
|  | ||||
|           this.$nextTick(() => { | ||||
|             if (data.isRefresh) { | ||||
|               this.$refs.component.getList() | ||||
|             } | ||||
|           }) | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss"> | ||||
|   .doc-circulation { | ||||
|     height: 100%; | ||||
|     background: #F3F6F9; | ||||
|     overflow: auto; | ||||
|   } | ||||
| </style> | ||||
| @@ -0,0 +1,92 @@ | ||||
| <template> | ||||
|   <ai-detail class="content-add"> | ||||
|     <template slot="title"> | ||||
|       <ai-title :title="params.id ? '编辑卡口' : '添加卡口'" isShowBack isShowBottomBorder @onBackClick="cancel(false)"> | ||||
|       </ai-title> | ||||
|     </template> | ||||
|     <template slot="content"> | ||||
|       <ai-card title="基本信息"> | ||||
|         <template #content> | ||||
|           <el-form class="ai-form" :model="form" label-width="120px" ref="form"> | ||||
|             <el-form-item prop="name" style="width: 100%;" label="卡口名称" :rules="[{required: true, message: '请输入卡口名称', trigger: 'blur'}]"> | ||||
|               <el-input size="small" v-model="form.name" placeholder="请输入卡口名称"></el-input> | ||||
|             </el-form-item> | ||||
|             <el-form-item prop="remark" style="width: 100%;" label="备注" :rules="[{required: true, message: '请输入备注', trigger: 'blur'}]"> | ||||
|               <el-input size="small" type="textarea" :rows="5" placeholder="请输入备注" v-model="form.remark"></el-input> | ||||
|             </el-form-item> | ||||
|           </el-form> | ||||
|         </template> | ||||
|       </ai-card> | ||||
|     </template> | ||||
|     <template #footer> | ||||
|       <el-button @click="cancel">取消</el-button> | ||||
|       <el-button type="primary" @click="confirm">提交</el-button> | ||||
|     </template> | ||||
|   </ai-detail> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   export default { | ||||
|     name: 'Add', | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object, | ||||
|       params: Object | ||||
|     }, | ||||
|     data () { | ||||
|       return { | ||||
|         info: {}, | ||||
|         form: { | ||||
|           name: '', | ||||
|           remark: '' | ||||
|         }, | ||||
|         id: '' | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     created () { | ||||
|       if (this.params && this.params.id) { | ||||
|         this.id = this.params.id | ||||
|         this.getInfo(this.params.id) | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       getInfo (id) { | ||||
|         this.instance.post(`/app/appepidemicpreventiongateway/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/appepidemicpreventiongateway/addOrUpdate`, { | ||||
|               ...this.form | ||||
|             }).then(res => { | ||||
|               if (res.code == 0) { | ||||
|                 this.$message.success('提交成功') | ||||
|                 setTimeout(() => { | ||||
|                   this.cancel(true) | ||||
|                 }, 600) | ||||
|               } | ||||
|             }) | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       cancel (isRefresh) { | ||||
|         this.$emit('change', { | ||||
|           type: 'list', | ||||
|           isRefresh: !!isRefresh | ||||
|         }) | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
|  | ||||
| <style scoped lang="scss"> | ||||
| </style> | ||||
							
								
								
									
										181
									
								
								project/pingchang/apps/AppCheckpointManage/components/List.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										181
									
								
								project/pingchang/apps/AppCheckpointManage/components/List.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,181 @@ | ||||
| <template> | ||||
|   <ai-list class="notice"> | ||||
|     <template slot="title"> | ||||
|       <ai-title title="卡口管理" isShowBottomBorder></ai-title> | ||||
|     </template> | ||||
|     <template slot="content"> | ||||
|       <ai-search-bar class="search-bar"> | ||||
|         <template #left> | ||||
|           <el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加</el-button> | ||||
|         </template> | ||||
|         <template #right> | ||||
|           <el-input | ||||
|             v-model="search.name" | ||||
|             class="search-input" | ||||
|             size="small" | ||||
|             v-throttle="() => {search.current = 1, getList()}" | ||||
|             placeholder="卡口名称" | ||||
|             clearable | ||||
|             @clear="search.current = 1, search.name = '', getList()" | ||||
|             suffix-icon="iconfont iconSearch"> | ||||
|           </el-input> | ||||
|         </template> | ||||
|       </ai-search-bar> | ||||
|       <ai-table | ||||
|         :tableData="tableData" | ||||
|         :col-configs="colConfigs" | ||||
|         :total="total" | ||||
|         style="margin-top: 6px;" | ||||
|         v-loading="isLoading" | ||||
|         :current.sync="search.current" | ||||
|         :size.sync="search.size" | ||||
|         @getList="getList"> | ||||
|         <el-table-column slot="qrcode" width="200px" label="二维码" align="center"> | ||||
|           <template slot-scope="{ row }"> | ||||
|             <div class="qrcode"> | ||||
|               <el-button type="text" @click="qrcode(row.qrCode, row.id)">{{ row.qrCode ? '预览' : '生成' }}</el-button> | ||||
|             </div> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column slot="options" width="180px" fixed="right" label="操作" align="center"> | ||||
|           <template slot-scope="{ row }"> | ||||
|             <div class="table-options"> | ||||
|               <el-button type="text" @click="downloadImg(row.qrCode)">下载二维码</el-button> | ||||
|               <el-button type="text" @click="toAdd(row.id)">编辑</el-button> | ||||
|               <el-button type="text" @click="remove(row.id)">删除</el-button> | ||||
|             </div> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </ai-table> | ||||
|       <div class="qrCode" v-viewer="{movable: true}" v-show="false"> | ||||
|         <img :src="img"> | ||||
|       </div> | ||||
|     </template> | ||||
|   </ai-list> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   import Viewer from 'v-viewer' | ||||
|   import Vue from 'vue' | ||||
|   Vue.use(Viewer) | ||||
|   export default { | ||||
|     name: 'List', | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object | ||||
|     }, | ||||
|  | ||||
|     data() { | ||||
|       return { | ||||
|         search: { | ||||
|           current: 1, | ||||
|           size: 10, | ||||
|           name: '' | ||||
|         }, | ||||
|         img: '', | ||||
|         isLoading: false, | ||||
|         total: 10, | ||||
|         colConfigs: [ | ||||
|           { type: 'index',  label: '序号', align: 'left' }, | ||||
|           { prop: 'name',  label: '卡口名称', align: 'center' }, | ||||
|           { prop: 'remark', label: '备注', align: 'center' }, | ||||
|           { slot: 'qrcode', label: '二维码', align: 'center' }, | ||||
|           { slot: 'options', label: '操作', align: 'center' } | ||||
|         ], | ||||
|         tableData: [] | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     created() { | ||||
|       this.getList() | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       getList() { | ||||
|         this.instance.post(`/app/appepidemicpreventiongateway/list`, null, { | ||||
|           params: { | ||||
|             ...this.search | ||||
|           } | ||||
|         }).then(res => { | ||||
|           if (res.code == 0) { | ||||
|             this.tableData = res.data.records | ||||
|             this.total = res.data.total | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       downloadImg (url) { | ||||
|         if (!url) { | ||||
|           return this.$message.error('请先生成二维码') | ||||
|         } | ||||
|  | ||||
|         this.isLoading = true | ||||
|         let image = new Image() | ||||
|         image.setAttribute('crossOrigin', 'anonymous') | ||||
|         image.onload = function () { | ||||
|           let canvas = document.createElement('canvas') | ||||
|           canvas.width = image.width | ||||
|           canvas.height = image.height | ||||
|           let context = canvas.getContext('2d') | ||||
|           context.drawImage(image, 0, 0, image.width, image.height) | ||||
|           let url = canvas.toDataURL("image/png") | ||||
|           let a = document.createElement("a") | ||||
|           let event = new MouseEvent("click") | ||||
|           a.download = '二维码' | ||||
|           a.href = url | ||||
|           a.dispatchEvent(event) | ||||
|         } | ||||
|         image.src = url | ||||
|         this.isLoading = false | ||||
|       }, | ||||
|  | ||||
|       qrcode (qrcode, id) { | ||||
|         if (!qrcode) { | ||||
|           this.isLoading = true | ||||
|           this.instance.post(`/app/appepidemicpreventiongateway/createQRCode?id=${id}&width=400&height=400`).then(res => { | ||||
|             if (res.code == 0) { | ||||
|               this.$message.success('二维码生成成功!') | ||||
|               this.getList() | ||||
|             } | ||||
|             this.isLoading = false | ||||
|           }) | ||||
|         } else { | ||||
|           this.img = qrcode | ||||
|  | ||||
|           this.$nextTick(() => { | ||||
|             setTimeout(() => { | ||||
|               const viewer = this.$el.querySelector('.qrCode').$viewer | ||||
|               viewer.view() | ||||
|             }, 600) | ||||
|           }) | ||||
|         } | ||||
|       }, | ||||
|  | ||||
|       remove(id) { | ||||
|         this.$confirm('确定删除该数据?').then(() => { | ||||
|           this.instance.post(`/app/appepidemicpreventiongateway/delete?ids=${id}`).then(res => { | ||||
|             if (res.code == 0) { | ||||
|               this.$message.success('删除成功!') | ||||
|               this.getList() | ||||
|             } | ||||
|           }) | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       toAdd(id) { | ||||
|         this.$emit('change', { | ||||
|           type: 'Add', | ||||
|           params: { | ||||
|             id: id || '' | ||||
|           } | ||||
|         }) | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
|   .notice { | ||||
|   } | ||||
| </style> | ||||
| @@ -11,6 +11,9 @@ | ||||
|             <el-form-item prop="areaId" style="width: 100%;" label="选择地区" :rules="[{required: true, message: '请选择地区', trigger: 'change'}]"> | ||||
|               <ai-area-select clearable @fullname="v => form.areaName = v" always-show :instance="instance" v-model="form.areaId"></ai-area-select> | ||||
|             </el-form-item> | ||||
|             <el-form-item prop="address" style="width: 100%;" label="详细地址"> | ||||
|               <el-input size="small" type="textarea" :rows="5" placeholder="请输入详细地址" v-model="form.address"></el-input> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="风险等级" style="width: 100%;" prop="level" :rules="[{required: true, message: '请选择风险等级', trigger: 'change'}]"> | ||||
|               <ai-select | ||||
|                 v-model="form.level" | ||||
| @@ -47,7 +50,8 @@ | ||||
|         form: { | ||||
|           level: '', | ||||
|           areaId: '', | ||||
|           areaName: '' | ||||
|           areaName: '', | ||||
|           address: '' | ||||
|         }, | ||||
|         id: '' | ||||
|       } | ||||
| @@ -68,7 +72,7 @@ | ||||
|  | ||||
|     methods: { | ||||
|       getInfo (id) { | ||||
|         this.instance.post(`/app/appepidemicdangerousarea/queryDetailById?id=${id}`).then(res => { | ||||
|         this.instance.post(`/app/appepidemicpreventionriskarea/queryDetailById?id=${id}`).then(res => { | ||||
|           if (res.code === 0) { | ||||
|             this.form = res.data | ||||
|           } | ||||
| @@ -78,7 +82,7 @@ | ||||
|       confirm () { | ||||
|         this.$refs.form.validate((valid) => { | ||||
|           if (valid) { | ||||
|             this.instance.post(`/app/appepidemicdangerousarea/addOrUpdate`, { | ||||
|             this.instance.post(`/app/appepidemicpreventionriskarea/addOrUpdate`, { | ||||
|               ...this.form | ||||
|             }).then(res => { | ||||
|               if (res.code == 0) { | ||||
|   | ||||
| @@ -66,33 +66,34 @@ export default { | ||||
|     moduleName: String | ||||
|   }, | ||||
|  | ||||
|   data() { | ||||
|     return { | ||||
|       search: { | ||||
|         current: 1, | ||||
|         size: 10, | ||||
|         level: '', | ||||
|         province: '' | ||||
|       }, | ||||
|       currIndex: -1, | ||||
|       areaList: [], | ||||
|       total: 10, | ||||
|       colConfigs: [ | ||||
|         {prop: 'province', label: '省级', align: 'left', width: '200px'}, | ||||
|         {prop: 'city', label: '市级', align: 'center'}, | ||||
|         {prop: 'district', label: '区级', align: 'center'}, | ||||
|         {prop: 'town', label: '镇级', align: 'center'}, | ||||
|         {prop: 'village', label: '村级', align: 'center'}, | ||||
|         {prop: 'level', label: '等级', align: 'center', formart: v => this.dict.getLabel('epidemicDangerousAreaLevel', v)}, | ||||
|         {prop: 'createTime', label: '设置时间', align: 'center'}, | ||||
|         {prop: 'createUserName', label: '添加人', align: 'center'}, | ||||
|         {slot: 'options', label: '操作', align: 'center'} | ||||
|       ], | ||||
|       areaName: '', | ||||
|       unitName: '', | ||||
|       tableData: [] | ||||
|     } | ||||
|   }, | ||||
|     data() { | ||||
|       return { | ||||
|         search: { | ||||
|           current: 1, | ||||
|           size: 10, | ||||
|           level: '', | ||||
|           province: '' | ||||
|         }, | ||||
|         currIndex: -1, | ||||
|         areaList: [], | ||||
|         total: 10, | ||||
|         colConfigs: [ | ||||
|           { prop: 'province',  label: '省级', align: 'left', width: '200px' }, | ||||
|           { prop: 'city', label: '市级', align: 'center' }, | ||||
|           { prop: 'district', label: '区级', align: 'center' }, | ||||
|           { prop: 'town', label: '镇级', align: 'center' }, | ||||
|           { prop: 'village', label: '村级', align: 'center' }, | ||||
|           { prop: 'address', label: '详细地址', align: 'center' }, | ||||
|           { prop: 'level', label: '等级', align: 'center', formart: v => this.dict.getLabel('epidemicDangerousAreaLevel', v) }, | ||||
|           { prop: 'createTime', label: '设置时间', align: 'center' }, | ||||
|           { prop: 'createUserName', label: '添加人', align: 'center' }, | ||||
|           { slot: 'options', label: '操作', align: 'center' } | ||||
|         ], | ||||
|         areaName: '', | ||||
|         unitName: '', | ||||
|         tableData: [] | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|   computed: { | ||||
|     ...mapState(['user']) | ||||
| @@ -104,30 +105,30 @@ export default { | ||||
|     }) | ||||
|   }, | ||||
|  | ||||
|   methods: { | ||||
|     getList() { | ||||
|       this.instance.post(`/app/appepidemicpreventionriskarea/list`, null, { | ||||
|         params: { | ||||
|           ...this.search | ||||
|         } | ||||
|       }).then(res => { | ||||
|         if (res.code == 0) { | ||||
|           this.tableData = res.data.records | ||||
|           this.total = res.data.total | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|  | ||||
|     remove(id) { | ||||
|       this.$confirm('确定删除该数据?').then(() => { | ||||
|         this.instance.post(`/app/appepidemicpreventionriskarea/delete?ids=${id}`).then(res => { | ||||
|     methods: { | ||||
|       getList() { | ||||
|         this.instance.post(`/app/appepidemicpreventionriskarea/list`, null, { | ||||
|           params: { | ||||
|             ...this.search | ||||
|           } | ||||
|         }).then(res => { | ||||
|           if (res.code == 0) { | ||||
|             this.$message.success('删除成功!') | ||||
|             this.getList() | ||||
|             this.tableData = res.data.records | ||||
|             this.total = res.data.total | ||||
|           } | ||||
|         }) | ||||
|       }) | ||||
|     }, | ||||
|       }, | ||||
|  | ||||
|       remove(id) { | ||||
|         this.$confirm('确定删除该数据?').then(() => { | ||||
|           this.instance.post(`/app/appepidemicpreventionriskarea/delete?ids=${id}`).then(res => { | ||||
|             if (res.code == 0) { | ||||
|               this.$message.success('删除成功!') | ||||
|               this.getList() | ||||
|             } | ||||
|           }) | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|     toAdd(id) { | ||||
|       this.$emit('change', { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user