特殊人群
This commit is contained in:
406
project/sass/apps/AppSpecialAdjustment/components/Add.vue
Normal file
406
project/sass/apps/AppSpecialAdjustment/components/Add.vue
Normal file
@@ -0,0 +1,406 @@
|
||||
<template>
|
||||
<ai-detail>
|
||||
<template #title>
|
||||
<ai-title
|
||||
:title="params.id ? '编辑社区矫正人群' : '新增社区矫正人群'"
|
||||
isShowBottomBorder
|
||||
isShowBack
|
||||
@onBackClick="onBack(true)">
|
||||
</ai-title>
|
||||
</template>
|
||||
<template #content>
|
||||
<ai-card title="基本信息">
|
||||
<template slot="content">
|
||||
<el-form ref="formData" class="ai-form" :rules="rules" :model="formData" label-width="110px" size="small">
|
||||
<div v-for="(item, index) in filedList" :key="index" :style="item.grid == 1 ? 'width: 100%;' : 'width: 50%;'">
|
||||
<el-form-item :label="item.label" :prop="item.formDbName" style="width: 100%">
|
||||
<template v-if="item.type == 'select'">
|
||||
<ai-select v-model="formData[item.formDbName]" :placeholder="item.fieldName" :selectList="dict.getDict(item.dict)" :disabled="item.disable == 1" />
|
||||
</template>
|
||||
<template v-else-if="item.type == 'radio'">
|
||||
<el-radio-group v-model="formData[item.formDbName]" :disabled="item.disable == 1">
|
||||
<el-radio :label="item.dictValue" v-for="(item, i) in dict.getDict(item.dict)" :key="i">{{ item.dictName }}</el-radio>
|
||||
</el-radio-group>
|
||||
</template>
|
||||
<template v-else-if="item.type == 'gird'">
|
||||
<el-input disabled v-model="formData[item.formDbName]" :maxlength="200" size="small" placeholder="请选择选择网格">
|
||||
<template slot="append">
|
||||
<el-button size="small" @click="showGrid = true">选择网格</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template v-else-if="item.type == 'onOff'">
|
||||
<el-switch v-model="formData[item.formDbName]" active-color="#26f" inactive-color="#ddd" active-value="1" inactive-value="0" :disabled="item.disable == 1"></el-switch>
|
||||
</template>
|
||||
<template v-else-if="item.type == 'checkbox'">
|
||||
<el-checkbox-group v-model="formData[item.formDbName]" :disabled="item.disable == 1">
|
||||
<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 == 'idNumber'">
|
||||
<ai-id v-model="formData[item.formDbName]" :disabled="item.disable == 1" />
|
||||
</template>
|
||||
<template v-else-if="item.type == 'input' || item.type == 'name' || item.type == 'phone'">
|
||||
<el-input v-model="formData[item.formDbName]" :placeholder="'请输入'+ item.label" clearable :disabled="item.disable == 1"
|
||||
:maxlength="item.maxLength" show-word-limit></el-input>
|
||||
</template>
|
||||
<template v-else-if="item.type == 'number'">
|
||||
<el-input-number v-model="formData[item.formDbName]" :label="'请输入'+item.label" :disabled="item.disable == 1" :precision="item.decimalPlaces" :max="item.maxValue" :min="item.minValue"></el-input-number>
|
||||
</template>
|
||||
<template v-else-if="item.type == 'textarea' || item.type == 'text'">
|
||||
<el-input v-model="formData[item.formDbName]" :placeholder="'请输入'+item.label" clearable :disabled="item.disable == 1"
|
||||
: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.formDbName]"
|
||||
type="date"
|
||||
style="width: 100%"
|
||||
placeholder="请选择"
|
||||
:disabled="item.disable == 1"
|
||||
value-format="yyyy-MM-DD">
|
||||
</el-date-picker>
|
||||
</template>
|
||||
<template v-else-if="item.type == 'datetime'">
|
||||
<el-date-picker v-model="formData[item.formDbName]" type="datetime" placeholder="选择日期时间" :disabled="item.disable == 1"
|
||||
value-format="yyyy-MM-DD HH-mm-ss"></el-date-picker>
|
||||
</template>
|
||||
<template v-else-if="item.type == 'time'">
|
||||
<el-time-picker v-model="formData[item.formDbName]" placeholder="请选择" :disabled="item.disable == 1"
|
||||
value-format="HH-mm-ss"></el-time-picker>
|
||||
</template>
|
||||
<template v-else-if="item.type == 'upload'">
|
||||
<ai-uploader :instance="instance" isShowTip fileType="file" v-model="formData[item.formDbName]" :disabled="item.disable == 1"
|
||||
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.formDbName]" :instance="instance"/>
|
||||
</template>
|
||||
<template v-else-if="item.type == 'area'">
|
||||
<ai-area-get :instance="instance" v-model="formData[item.formDbName]" :name.sync="formData.areaName" :disabled="item.disable == 1"/>
|
||||
</template>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</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 highlight-current>
|
||||
</el-tree>
|
||||
</div>
|
||||
</ai-dialog>
|
||||
</template>
|
||||
</ai-card>
|
||||
</template>
|
||||
<template #footer>
|
||||
<el-button class="delete-btn footer-btn" @click="onBack">取消</el-button>
|
||||
<el-button class="footer-btn" type="primary" @click="submit('formData')">提交</el-button>
|
||||
</template>
|
||||
</ai-detail>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'Add',
|
||||
props: {
|
||||
instance: Function,
|
||||
params: Object,
|
||||
dict: Object
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showGrid: false,
|
||||
formData: {
|
||||
girdName: '',
|
||||
name: '',
|
||||
idNumber: '',
|
||||
girdId: '',
|
||||
placeTime: '',
|
||||
phone: '',
|
||||
areaId: '',
|
||||
address: '',
|
||||
areaName: '',
|
||||
crime: '',
|
||||
type: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
isCreateGroup: '',
|
||||
isRelease: ''
|
||||
},
|
||||
treeObj: {
|
||||
treeList: [],
|
||||
defaultProps: {
|
||||
children: "girdList",
|
||||
label: "girdName",
|
||||
},
|
||||
checkedKeys: [],
|
||||
},
|
||||
areaId: '',
|
||||
filedList: [
|
||||
{
|
||||
label: '姓名',
|
||||
type: 'input',
|
||||
formDbName: 'name',
|
||||
mustFill: 1,
|
||||
fieldTips: '请输入姓名'
|
||||
},
|
||||
{
|
||||
label: '身份证号',
|
||||
type: 'input',
|
||||
formDbName: 'idNumber',
|
||||
mustFill: 1,
|
||||
fieldTips: '请输入身份证号'
|
||||
},
|
||||
{
|
||||
label: '联系电话',
|
||||
type: 'input',
|
||||
formDbName: 'phone',
|
||||
mustFill: 1,
|
||||
fieldTips: '请输入联系电话'
|
||||
},
|
||||
{
|
||||
label: '所属区域',
|
||||
type: 'area',
|
||||
formDbName: 'areaId',
|
||||
mustFill: 1,
|
||||
fieldTips: '请选择所属区域'
|
||||
},
|
||||
{
|
||||
label: '详细地址',
|
||||
type: 'input',
|
||||
grid: 1,
|
||||
formDbName: 'address'
|
||||
},
|
||||
{
|
||||
label: '所属网格',
|
||||
type: 'gird',
|
||||
grid: 1,
|
||||
formDbName: 'girdName'
|
||||
},
|
||||
{
|
||||
label: '具体罪名',
|
||||
type: 'input',
|
||||
formDbName: 'crime'
|
||||
},
|
||||
{
|
||||
label: '矫正类别',
|
||||
type: 'select',
|
||||
dict: 'appSpecialChangeType',
|
||||
formDbName: 'type'
|
||||
},
|
||||
{
|
||||
label: '矫正开始日期',
|
||||
type: 'date',
|
||||
formDbName: 'startTime',
|
||||
},
|
||||
{
|
||||
label: '矫正结束日期',
|
||||
type: 'date',
|
||||
formDbName: 'endTime',
|
||||
},
|
||||
{
|
||||
label: '是否建立矫正小组',
|
||||
type: 'select',
|
||||
dict: 'yesOrNo',
|
||||
formDbName: 'isCreateGroup',
|
||||
},
|
||||
{
|
||||
label: '是否托管',
|
||||
type: 'select',
|
||||
dict: 'yesOrNo',
|
||||
formDbName: 'isRelease',
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(['user']),
|
||||
rules() {
|
||||
let rules = {}
|
||||
this.filedList.map(e => {
|
||||
rules[e.formDbName] = []
|
||||
if (e.mustFill == 1) {
|
||||
rules[e.formDbName]?.push({required: true, message: e.fieldTips})
|
||||
}
|
||||
})
|
||||
return rules
|
||||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
if (this.params.id) {
|
||||
this.dict.load(this.filedList.filter(v => v.dict).map(v => v.dict)).then(() => {
|
||||
this.getDetail()
|
||||
})
|
||||
} else {
|
||||
this.getGridList()
|
||||
this.dict.load(this.filedList.filter(v => v.dict).map(v => v.dict))
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
getFormData() {
|
||||
this.initForm(this.configs)
|
||||
},
|
||||
|
||||
getCheckedTree() {
|
||||
if (this.$refs.tree.getCheckedNodes().length > 1) {
|
||||
return this.$message.error('不能选择多个网格')
|
||||
}
|
||||
|
||||
const gird = this.$refs.tree.getCheckedNodes()
|
||||
|
||||
if (gird.length) {
|
||||
this.formData.girdName = gird[0].girdName
|
||||
this.formData.girdId = gird[0].id
|
||||
} else {
|
||||
this.formData.girdName = ''
|
||||
this.formData.girdId = ''
|
||||
}
|
||||
this.showGrid = false
|
||||
},
|
||||
|
||||
getGridList() {
|
||||
this.instance.post(`/app/appgirdinfo/listAll`).then((res) => {
|
||||
if (res.code == 0) {
|
||||
this.treeObj.treeList = res.data
|
||||
if (this.formData.girdId) {
|
||||
this.$set(this.treeObj, 'checkedKeys', [this.formData.girdId])
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
getDetail() {
|
||||
this.instance.post(`/app/appspecialadjustment/queryDetailById?id=${this.params.id}`).then((res) => {
|
||||
if (res.data) {
|
||||
this.formData = res.data
|
||||
this.getGridList()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
submit() {
|
||||
this.$refs.formData?.validate((valid) => {
|
||||
if (valid) {
|
||||
this.filedList.map((item) => {
|
||||
if (item.length) {
|
||||
item.map((items) => {
|
||||
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 == 'area' && this.formData[items.fieldDbName]) {
|
||||
var area = []
|
||||
area.push(this.formData[items.fieldDbName])
|
||||
area.push(this.formData[items.fieldDbName+'_name'])
|
||||
this.formData[items.fieldDbName] = area.join('_')
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
this.instance.post(`/app/appspecialadjustment/addOrUpdate`, {
|
||||
...this.formData,
|
||||
id: this.params.id || ''
|
||||
}).then((res) => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('提交成功')
|
||||
setTimeout(() => {
|
||||
this.onBack(true)
|
||||
}, 600)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
onBack(isRefresh) {
|
||||
this.$emit('change', {
|
||||
type: 'List',
|
||||
params: this.params,
|
||||
isRefresh: !!isRefresh,
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
::v-deep .ai-card{
|
||||
width: 100%;
|
||||
}
|
||||
.form-div {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.especial {
|
||||
margin-bottom: 12px;
|
||||
|
||||
.icon {
|
||||
vertical-align: top;
|
||||
display: inline-block;
|
||||
padding-top: 5px;
|
||||
margin-left: 20px;
|
||||
color: #f46;
|
||||
}
|
||||
|
||||
.people {
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
padding-right: 12px;
|
||||
vertical-align: top;
|
||||
width: 64px;
|
||||
word-break: break-all;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.AiWechatSelecter {
|
||||
display: inline-block;
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
||||
.hint {
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
margin-left: 16px;
|
||||
}
|
||||
|
||||
.mar-r40 {
|
||||
margin-right: 40px;
|
||||
}
|
||||
|
||||
.w80 {
|
||||
width: 80px;
|
||||
text-align: right;
|
||||
color: #888;
|
||||
}
|
||||
}
|
||||
|
||||
.AiWechatSelecter {
|
||||
width: calc(100% - 120px);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user