特殊人群
This commit is contained in:
		
							
								
								
									
										211
									
								
								packages/2.0.5/AppCodeGeneration/components/Add.vue
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										211
									
								
								packages/2.0.5/AppCodeGeneration/components/Add.vue
									
									
									
									
										vendored
									
									
								
							| @@ -1,5 +1,5 @@ | ||||
| <template> | ||||
|   <ai-detail v-if="pageShow"> | ||||
|   <ai-detail v-if="pageShow" class="add-form"> | ||||
|     <template #title> | ||||
|       <ai-title :title="params.id ? '编辑'+colData.applicationName : '新增' + colData.applicationName" isShowBottomBorder | ||||
|                 isShowBack @onBackClick="onBack(true)"></ai-title> | ||||
| @@ -13,72 +13,96 @@ | ||||
|               <el-form-item :label="item.fieldName" :prop="item.fieldDbName" style="width: 100%"> | ||||
|                 <!-- 字典下拉选择 --> | ||||
|                 <template v-if="item.type == 'dict'"> | ||||
|                   <ai-select v-model="formData[item.fieldDbName]" :placeholder="item.fieldName" :selectList="dict.getDict(item.dict)" :disabled="item.disable == 1" /> | ||||
|                   <ai-select v-model="formData[item.fieldDbName]" :placeholder="item.fieldName" :selectList="dict.getDict(item.dict)" :disabled="item.disable == 1 || !!(formData.resident_id && item.isInit)" /> | ||||
|                 </template> | ||||
|                 <!-- 单选radio --> | ||||
|                 <template v-else-if="item.type == 'radio'"> | ||||
|                   <el-radio-group v-model="formData[item.fieldDbName]" :disabled="item.disable == 1"> | ||||
|                   <el-radio-group v-model="formData[item.fieldDbName]" :disabled="item.disable == 1 || !!(formData.resident_id && item.isInit)"> | ||||
|                     <el-radio :label="item.dictValue" v-for="(item, i) in dict.getDict(item.dict)" :key="i">{{ item.dictName }}</el-radio> | ||||
|                   </el-radio-group> | ||||
|                 </template> | ||||
|                 <!-- 开关onOff --> | ||||
|                 <template v-else-if="item.type == 'onOff'"> | ||||
|                   <el-switch v-model="formData[item.fieldDbName]" active-color="#26f" inactive-color="#ddd" active-value="1" inactive-value="0" :disabled="item.disable == 1"></el-switch> | ||||
|                   <el-switch v-model="formData[item.fieldDbName]" active-color="#26f" inactive-color="#ddd" active-value="1" inactive-value="0" :disabled="item.disable == 1 || !!(formData.resident_id && item.isInit)"></el-switch> | ||||
|                 </template> | ||||
|                 <!-- 多选checkbox --> | ||||
|                 <template v-else-if="item.type == 'checkbox'"> | ||||
|                   <el-checkbox-group v-model="formData[item.fieldDbName]" :disabled="item.disable == 1"> | ||||
|                   <el-checkbox-group v-model="formData[item.fieldDbName]" :disabled="item.disable == 1 || !!(formData.resident_id && item.isInit)"> | ||||
|                     <el-checkbox v-for="(item, i) in dict.getDict(item.dict)" :label="item.dictValue" :key="i"> | ||||
|                       {{ item.dictName }} | ||||
|                     </el-checkbox> | ||||
|                   </el-checkbox-group> | ||||
|                 </template> | ||||
|                 <!-- 身份证输入框 --> | ||||
|                 <!-- 网格 --> | ||||
|                 <template v-else-if="item.type === 'gird'"> | ||||
|                   <el-input disabled :value="girdName" size="small" placeholder="请选择网格"> | ||||
|                     <template slot="append"> | ||||
|                       <el-button size="small" @click="showGrid = true" :disabled="!!(formData.resident_id && item.isInit)">选择网格</el-button> | ||||
|                     </template> | ||||
|                   </el-input> | ||||
|                 </template> | ||||
|                 <template v-else-if="item.type === 'resident'"> | ||||
|                   <el-input | ||||
|                     v-model="formData.name" | ||||
|                     :placeholder="'请选择'+item.fieldName"> | ||||
|                     <template slot="append"> | ||||
|                       <ai-person-select | ||||
|                         :instance="instance" | ||||
|                         :url="'/app/appresident/list?areaId=' + user.info.areaId" | ||||
|                         :isMultiple="false" dialogTitle="选择" @selectPerson="onChange"> | ||||
|                         <template name="option" v-slot:option="{ item }"> | ||||
|                           <span class="iconfont iconProlife">{{ item.name }}</span> | ||||
|                           <ai-id mode="show" :show-eyes="false" :value="item.idNumber"/> | ||||
|                         </template> | ||||
|                       </ai-person-select> | ||||
|                     </template> | ||||
|                   </el-input> | ||||
|                 </template> | ||||
|                 <template v-else-if="item.type == 'idNumber'"> | ||||
|                   <ai-id v-model="formData[item.fieldDbName]" :disabled="item.disable == 1" /> | ||||
|                   <ai-id v-model="formData[item.fieldDbName]" :disabled="item.disable == 1 || !!(formData.resident_id && item.isInit)" /> | ||||
|                 </template> | ||||
|                 <!-- input输入框 --> | ||||
|                 <template v-else-if="item.type == 'input' || item.type == 'name' || item.type == 'phone'"> | ||||
|                   <el-input v-model="formData[item.fieldDbName]" :placeholder="'请输入'+item.fieldName" clearable :disabled="item.disable == 1" | ||||
|                   <el-input v-model="formData[item.fieldDbName]" :placeholder="'请输入'+item.fieldName" clearable :disabled="item.disable == 1 || !!(formData.resident_id && item.isInit)" | ||||
|                             :maxlength="item.maxLength" show-word-limit></el-input> | ||||
|                 </template> | ||||
|                 <!-- number 输入框 --> | ||||
|                 <template v-else-if="item.type == 'number'"> | ||||
|                   <el-input-number v-model="formData[item.fieldDbName]" :label="'请输入'+item.fieldName" :disabled="item.disable == 1" :precision="item.decimalPlaces" :max="item.maxValue" :min="item.minValue"></el-input-number> | ||||
|                   <el-input-number v-model="formData[item.fieldDbName]" :label="'请输入'+item.fieldName" :disabled="item.disable == 1 || !!(formData.resident_id && item.isInit)" :precision="item.decimalPlaces" :max="item.maxValue" :min="item.minValue"></el-input-number> | ||||
|                 </template> | ||||
|                 <!-- textarea输入框 --> | ||||
|                 <template v-else-if="item.type == 'textarea' || item.type == 'text'"> | ||||
|                   <el-input v-model="formData[item.fieldDbName]" :placeholder="'请输入'+item.fieldName" clearable :disabled="item.disable == 1" | ||||
|                   <el-input v-model="formData[item.fieldDbName]" :placeholder="'请输入'+item.fieldName" clearable :disabled="item.disable == 1 || !!(formData.resident_id && item.isInit)" | ||||
|                             :maxlength="item.maxLength" type="textarea" show-word-limit :rows="3"></el-input> | ||||
|                 </template> | ||||
|                 <!-- 日期选择 --> | ||||
|                 <template v-else-if="item.type == 'date'"> | ||||
|                   <el-date-picker v-model="formData[item.fieldDbName]" type="date" placeholder="请选择" :disabled="item.disable == 1" | ||||
|                   <el-date-picker style="width: 100%;" v-model="formData[item.fieldDbName]" type="date" placeholder="请选择" :disabled="item.disable == 1 || !!(formData.resident_id && item.isInit)" | ||||
|                                   :value-format="item.timePattern"></el-date-picker> | ||||
|                 </template> | ||||
|                 <!-- 日期带时分秒选择 --> | ||||
|                 <template v-else-if="item.type == 'datetime'"> | ||||
|                   <el-date-picker v-model="formData[item.fieldDbName]" type="datetime" placeholder="选择日期时间" :disabled="item.disable == 1" | ||||
|                   <el-date-picker v-model="formData[item.fieldDbName]" type="datetime" placeholder="选择日期时间" :disabled="item.disable == 1 || !!(formData.resident_id && item.isInit)" | ||||
|                                   :value-format="item.timePattern"></el-date-picker> | ||||
|                 </template> | ||||
|                 <!-- 时间-时分秒选择 --> | ||||
|                 <template v-else-if="item.type == 'time'"> | ||||
|                   <el-time-picker v-model="formData[item.fieldDbName]" placeholder="请选择" :disabled="item.disable == 1" | ||||
|                   <el-time-picker v-model="formData[item.fieldDbName]" placeholder="请选择" :disabled="item.disable == 1 || !!(formData.resident_id && item.isInit)" | ||||
|                                   :value-format="item.timePattern"></el-time-picker> | ||||
|                 </template> | ||||
|                 <!-- 附件 --> | ||||
|                 <template v-else-if="item.type == 'upload'"> | ||||
|                   <ai-uploader :instance="instance" isShowTip fileType="file" v-model="formData[item.fieldDbName]" :disabled="item.disable == 1" | ||||
|                   <ai-uploader :instance="instance" isShowTip fileType="file" v-model="formData[item.fieldDbName]" :disabled="item.disable == 1 || !!(formData.resident_id && item.isInit)" | ||||
|                                acceptType=".zip,.rar,.doc,.docx,.xls,.ppt,.pptx,.pdf,.txt,.jpg,.png,.xlsx" | ||||
|                                :limit="item.fileMaxCount" :maxSize="item.fileChoseSize"></ai-uploader> | ||||
|                 </template> | ||||
|                 <!-- 富文本 --> | ||||
|                 <template v-else-if="item.type == 'rtf'"> | ||||
|                   <ai-editor v-model="formData[item.fieldDbName]" :instance="instance"/> | ||||
|                   <ai-editor v-model="formData[item.fieldDbName]" :instance="instance" :disabled="item.disable == 1 || !!(formData.resident_id && item.isInit)"/> | ||||
|                 </template> | ||||
|                 <!-- 地区选择 --> | ||||
|                 <template v-else-if="item.type == 'area'"> | ||||
|                   <ai-area-get :instance="instance" v-model="formData[item.fieldDbName]" :name.sync="formData[item.fieldDbName +'_name']" :disabled="item.disable == 1"/> | ||||
|                   <ai-area-get :instance="instance" v-model="formData[item.fieldDbName]" :name.sync="formData[item.fieldDbName +'_name']" :disabled="item.disable == 1 || !!(formData.resident_id && item.isInit)"/> | ||||
|                 </template> | ||||
|                 <!-- 人员选择 --> | ||||
|                 <div class="especial" v-else-if="item.type == 'user'"> | ||||
| @@ -92,6 +116,27 @@ | ||||
|           </template> | ||||
|         </ai-card> | ||||
|       </el-form> | ||||
|       <ai-dialog | ||||
|         title="选择网格" | ||||
|         :visible.sync="showGrid" | ||||
|         :destroyOnClose="true" | ||||
|           @close="showGrid = false" | ||||
|           @onConfirm="getCheckedTree" | ||||
|           width="720px"> | ||||
|         <div class="grid"> | ||||
|           <el-tree | ||||
|             :data="treeObj.treeList" | ||||
|             :props="treeObj.defaultProps" | ||||
|             node-key="id" | ||||
|             ref="tree" | ||||
|             :check-strictly="true" | ||||
|             show-checkbox | ||||
|             :default-checked-keys="treeObj.checkedKeys" | ||||
|             default-expand-all | ||||
|             @check="onCheckChange"> | ||||
|           </el-tree> | ||||
|         </div> | ||||
|       </ai-dialog> | ||||
|     </template> | ||||
|     <template #footer> | ||||
|       <el-button class="delete-btn footer-btn" @click="onBack">取消</el-button> | ||||
| @@ -115,14 +160,26 @@ export default { | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       formData: {}, | ||||
|       formData: { | ||||
|         age: 2 | ||||
|       }, | ||||
|       pickerOptions0: { | ||||
|         disabledDate(time) { | ||||
|           return time.getTime() < Date.now() - 8.64e7; | ||||
|         } | ||||
|       }, | ||||
|       girdName: '', | ||||
|       showGrid: false, | ||||
|       formDataList: [], | ||||
|       pageShow: false, | ||||
|       pageShow: true, | ||||
|       treeObj: { | ||||
|         treeList: [], | ||||
|         defaultProps: { | ||||
|           children: "girdList", | ||||
|           label: "girdName", | ||||
|         }, | ||||
|         checkedKeys: [], | ||||
|       }, | ||||
|       colData: {}, | ||||
|       areaId: '' | ||||
|     } | ||||
| @@ -141,12 +198,77 @@ export default { | ||||
|     } | ||||
|   }, | ||||
|   created() { | ||||
|     this.getGridList() | ||||
|     this.getFormData() | ||||
|     if (this.params.id) { | ||||
|       this.getDetail() | ||||
|     }  | ||||
|   }, | ||||
|   methods: { | ||||
|     getGridList() { | ||||
|       this.instance.post(`/app/appgirdinfo/listAll`).then((res) => { | ||||
|         if (res.code == 0) { | ||||
|           this.treeObj.treeList = this.format(res.data) | ||||
|           if (this.formData.girdId) { | ||||
|             this.$set(this.treeObj, 'checkedKeys', [this.formData.girdId]) | ||||
|           } | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|  | ||||
|     onChange (e) { | ||||
|       Object.keys(this.formData).forEach(item => { | ||||
|         for (var p in e){ | ||||
|           if (item === p) { | ||||
|             this.$set(this.formData, item, e[item]) | ||||
|           } | ||||
|         } | ||||
|       }) | ||||
|  | ||||
|       const idNumberInfo = this.idCardNoUtil.getIdCardInfo(e.idNumber) | ||||
|       this.formData.resident_id = e.id | ||||
|       this.$set(this.formData, 'birthDate', idNumberInfo.birthday) | ||||
|       this.formData.photo = e.photo ? [{ | ||||
|         url: e.photo | ||||
|       }] : [] | ||||
|     }, | ||||
|     getCheckedTree() { | ||||
|       const gird = this.$refs.tree.getCheckedNodes() | ||||
|  | ||||
|       if (gird.length) { | ||||
|         this.girdName = gird[0].girdName | ||||
|         this.formData.gird_id = gird[0].id | ||||
|       } else { | ||||
|         this.girdName = '' | ||||
|         this.formData.gird_id = '' | ||||
|       } | ||||
|  | ||||
|       this.showGrid = false | ||||
|     }, | ||||
|  | ||||
|     onCheckChange (e) { | ||||
|       this.$nextTick(() => { | ||||
|         this.$refs.tree.getCheckedKeys().forEach(v => { | ||||
|           this.$refs.tree.setChecked(v, false) | ||||
|         }) | ||||
|         this.$refs.tree.setChecked(e.id, true) | ||||
|       }) | ||||
|     }, | ||||
|  | ||||
|     format (list) { | ||||
|       return list.map(item => { | ||||
|         if (item.girdLevel !== '2') { | ||||
|           item.disabled = true | ||||
|         } | ||||
|  | ||||
|         if (item.girdList && item.girdList.length) { | ||||
|           item.girdList = this.format(item.girdList) | ||||
|         } | ||||
|  | ||||
|         return item | ||||
|       }) | ||||
|     }, | ||||
|  | ||||
|     initForm(data) { | ||||
|       this.colData = data | ||||
|       let dictList = [] | ||||
| @@ -184,6 +306,11 @@ export default { | ||||
|             colItem.fieldValue = val | ||||
|           } | ||||
|  | ||||
|         } else if (item.type === 'upload') { | ||||
|           colItem = { | ||||
|             ...item, | ||||
|             fieldValue: [] | ||||
|           } | ||||
|         } else if (item.type == 'onOff') { | ||||
|           colItem = { | ||||
|             ...item, | ||||
| @@ -195,8 +322,10 @@ export default { | ||||
|           colItem = { | ||||
|             ...item, | ||||
|             type: item.type, | ||||
|             min: item.minValue || '', | ||||
|             max: item.maxValue || '' | ||||
|             min: item.minValue || 1, | ||||
|             max: item.maxValue || 1000000000, | ||||
|             minValue: item.minValue || 1, | ||||
|             maxValue: item.maxValue || 1000000000 | ||||
|           } | ||||
|           if (!this.params.id) { | ||||
|             colItem.fieldValue = Number(item.defaultValue) || 0 | ||||
| @@ -222,7 +351,11 @@ export default { | ||||
|         } | ||||
|         // console.log(colItem) | ||||
|         formList[item.groupIndex]?.push(colItem) || (formList[item.groupIndex] = [colItem]) | ||||
|         this.$set(this.formData, colItem.fieldDbName, colItem.fieldValue || "") | ||||
|         if (item.type === 'number') { | ||||
|           this.$set(this.formData, item.fieldDbName, 1) | ||||
|         } else { | ||||
|           this.$set(this.formData, item.fieldDbName, colItem.fieldValue || '') | ||||
|         } | ||||
|       }) | ||||
|       this.formDataList = Object.values(formList) | ||||
|  | ||||
| @@ -240,12 +373,21 @@ export default { | ||||
|     getDetail() { | ||||
|       this.instance.post(`/app/appapplicationinfo/queryDetailById?appId=${this.appId}&id=${this.params.id}`).then((res) => { | ||||
|         if (res?.data) { | ||||
|           this.formData = res.data | ||||
|           this.configs.tableInfos.map((item) => { | ||||
|             this.formData[item.fieldDbName] = res.data[item.fieldDbName] || '' | ||||
|             if(item.type == 'checkbox') { | ||||
|               var checkList = this.formData[item.fieldDbName]?.split(',') | ||||
|               this.formData[item.fieldDbName] = checkList | ||||
|             } | ||||
|  | ||||
|             if (item.type === 'gird' && this.formData[item.fieldDbName]) { | ||||
|               this.girdName = res.data.gird_id_name | ||||
|               this.girdName = res.data.gird_id_name | ||||
|             } | ||||
|  | ||||
|             if (item.type === 'upload' && !this.formData[item.fieldDbName]) { | ||||
|               this.formData[item.fieldDbName] = [] | ||||
|             } | ||||
|           }) | ||||
|         } | ||||
|       }) | ||||
| @@ -264,12 +406,12 @@ export default { | ||||
|                 if (items.type == 'checkbox' && this.formData[items.fieldDbName].length) { //多选 | ||||
|                   this.formData[items.fieldDbName] = this.formData[items.fieldDbName]?.toString() | ||||
|                 } | ||||
|                 if (items.type == 'upload' && this.formData[items.fieldDbName].length) { //附件 只传id | ||||
|                   var files = [] | ||||
|                   this.formData[items.fieldDbName].map((item) => { | ||||
|                     files.push(item.id) | ||||
|                   }) | ||||
|                   this.formData[items.fieldDbName] = files.join(',') | ||||
|                 if (items.type == 'upload') { | ||||
|                   this.formData[items.fieldDbName] = this.formData[items.fieldDbName].map(v => v.url).join(',') | ||||
|                 } | ||||
|  | ||||
|                 if(items.type == 'gird' && this.formData[items.fieldDbName]) { | ||||
|                   this.formData[items.fieldDbName] = this.formData[items.fieldDbName] + '_' + this.girdName | ||||
|                 } | ||||
|                 if(items.type == 'area' && this.formData[items.fieldDbName]) { | ||||
|                   var area = [] | ||||
| @@ -314,6 +456,19 @@ export default { | ||||
|   vertical-align: top; | ||||
| } | ||||
|  | ||||
| .add-form { | ||||
|   ::v-deep .AiPersonSelect { | ||||
|     .el-button { | ||||
|       border-color: transparent; | ||||
|     background-color: transparent; | ||||
|     color: inherit; | ||||
|     border-top: 0; | ||||
|     border-bottom: 0; | ||||
|     background: transparent; | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| .especial { | ||||
|   margin-bottom: 12px; | ||||
|  | ||||
|   | ||||
| @@ -136,7 +136,11 @@ | ||||
|             } | ||||
|           } | ||||
|           formList[item.groupIndex]?.push(colItem) || (formList[item.groupIndex] = [colItem]) | ||||
|           this.$set(this.formData, colItem.fieldDbName, colItem.fieldValue || "") | ||||
|           if (item.type === 'upload') { | ||||
|             this.$set(this.formData, colItem.fieldDbName, []) | ||||
|           } else { | ||||
|             this.$set(this.formData, colItem.fieldDbName, colItem.fieldValue || "") | ||||
|           } | ||||
|         }) | ||||
|         this.formDataList = Object.values(formList) | ||||
|  | ||||
|   | ||||
| @@ -69,7 +69,7 @@ | ||||
|             <div v-if="item.type == 'checkbox'">{{ row[item.fieldDbName] }}</div> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column slot="options" label="操作" align="center" width="200"> | ||||
|         <el-table-column slot="options" label="操作" fixed="right" align="center" width="160"> | ||||
|           <template slot-scope="{ row }"> | ||||
|             <div class="table-options"> | ||||
|               <el-button type="text" @click="toDetail(row, 'Detail')">详情</el-button> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user