2024-06-23 17:30:00 +08:00
|
|
|
|
<template>
|
2024-06-25 11:13:29 +08:00
|
|
|
|
<div>
|
|
|
|
|
|
<ai-detail class="add">
|
|
|
|
|
|
<template slot="title">
|
|
|
|
|
|
<ai-title title="添加档案" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template slot="content">
|
|
|
|
|
|
<el-form class="content-right" :model="form" ref="ruleForm" :rules="rules" label-width="130px"
|
|
|
|
|
|
label-position="right" size="small">
|
|
|
|
|
|
|
|
|
|
|
|
<ai-card title="基本信息">
|
|
|
|
|
|
<template #content>
|
|
|
|
|
|
<el-row type="flex">
|
|
|
|
|
|
<el-form-item label="经营者姓名:" style="width: 100%;" prop="name">
|
|
|
|
|
|
<el-input v-model="form.name" placeholder="请输入姓名" autocomplete="off"
|
2024-06-23 17:30:00 +08:00
|
|
|
|
size="small" maxlength="20"
|
|
|
|
|
|
show-word-limit></el-input>
|
|
|
|
|
|
</el-form-item>
|
2024-06-25 11:13:29 +08:00
|
|
|
|
<el-form-item label="身份证号:" style="width: 100%;" prop="idNumber">
|
2024-06-27 11:23:15 +08:00
|
|
|
|
<ai-id v-model="form.idNumber" @change="getInfoByIdNumber" placeholder="请输入身份证号"/>
|
2024-06-25 11:13:29 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
<el-row type="flex">
|
|
|
|
|
|
<el-form-item label="性别:" style="width: 100%;" prop="sex">
|
2024-06-25 10:25:37 +08:00
|
|
|
|
<ai-select
|
2024-06-25 11:13:29 +08:00
|
|
|
|
v-model="form.sex"
|
|
|
|
|
|
style="width: 100%;"
|
|
|
|
|
|
placeholder="性别"
|
|
|
|
|
|
:selectList="$dict.getDict('sex')">
|
2024-06-25 10:25:37 +08:00
|
|
|
|
</ai-select>
|
2024-06-23 17:30:00 +08:00
|
|
|
|
</el-form-item>
|
2024-06-25 11:13:29 +08:00
|
|
|
|
<el-form-item label="联系电话:" v-model="form.phone" style="width: 100%;" prop="phone">
|
|
|
|
|
|
<el-input v-model="form.phone" placeholder="请输入联系电话" autocomplete="off"
|
2024-06-27 11:23:15 +08:00
|
|
|
|
size="small" maxlength="11"
|
2024-06-25 11:13:29 +08:00
|
|
|
|
show-word-limit></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
<el-row type="flex">
|
|
|
|
|
|
<el-form-item label="出生日期:" style="width: 100%;" prop="birthday">
|
|
|
|
|
|
<el-date-picker value-format="yyyy-MM-dd" size="small" v-model="form.birthday"
|
|
|
|
|
|
placeholder="请选择出生日期" disabled style="width: 100%"></el-date-picker>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="年龄:" style="width: 100%;" prop="age">
|
|
|
|
|
|
<el-input v-model="form.age" placeholder="请输入年龄" disabled autocomplete="off"
|
|
|
|
|
|
size="small"></el-input>
|
2024-06-23 17:30:00 +08:00
|
|
|
|
</el-form-item>
|
2024-06-25 11:13:29 +08:00
|
|
|
|
</el-row>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</ai-card>
|
|
|
|
|
|
<ai-card title="门店信息">
|
|
|
|
|
|
<template #content>
|
|
|
|
|
|
<el-row type="flex">
|
|
|
|
|
|
<div class="flex-colum">
|
|
|
|
|
|
<el-form-item label="门店名称:" style="width: 100%;" prop="shopName">
|
|
|
|
|
|
<el-input v-model="form.shopName" placeholder="请输入姓名" autocomplete="off"
|
|
|
|
|
|
size="small" maxlength="20"
|
|
|
|
|
|
show-word-limit></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="经营类型:" style="width: 100%;" prop="operatorType">
|
|
|
|
|
|
<ai-select
|
|
|
|
|
|
v-model="form.operatorType"
|
|
|
|
|
|
placeholder="请选择经营范围"
|
|
|
|
|
|
:selectList="$dict.getDict('operatorType')" style="width: 100%;">
|
|
|
|
|
|
</ai-select>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="所属片区:" style="width: 100%;" prop="girdCode">
|
|
|
|
|
|
<el-input disabled v-model="form.girdName" size="small" placeholder="请选择片区">
|
|
|
|
|
|
<template slot="append">
|
2024-06-25 14:35:50 +08:00
|
|
|
|
<el-button size="small" @click="dialog=true">选择片区</el-button>
|
2024-06-25 11:13:29 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="门店照片" style="width: 100%;" prop="fileUrl">
|
|
|
|
|
|
<ai-uploader
|
|
|
|
|
|
:instance="instance"
|
|
|
|
|
|
isShowTip
|
|
|
|
|
|
v-model="form.fileUrl"
|
|
|
|
|
|
:limit="1"
|
|
|
|
|
|
is-crop>
|
|
|
|
|
|
<template slot="tips">
|
|
|
|
|
|
<p>最多上传1张图片,单个文件最大10MB,支持jpg、jpeg、png格式</p>
|
|
|
|
|
|
<p>图片比例:1.6:1</p>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</ai-uploader>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
<el-form-item label="社会信用代码:" style="width: 100%;" prop="creditCode">
|
|
|
|
|
|
<el-input v-model="form.creditCode" placeholder="请输入社会统一信用代码" size="small"></el-input>
|
|
|
|
|
|
</el-form-item>
|
2024-06-25 16:36:01 +08:00
|
|
|
|
<el-form-item label="门店住址:" style="width: 100%;" prop="areaId">
|
2024-06-25 11:13:29 +08:00
|
|
|
|
<ai-area-select :instance="instance" clearable always-show
|
2024-06-25 16:36:01 +08:00
|
|
|
|
@name="v=>form.areaName=v" v-model="form.areaId"/>
|
2024-06-25 11:13:29 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="" style="width:100%" prop="address">
|
|
|
|
|
|
<el-input
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
placeholder="请输入详细地址"
|
|
|
|
|
|
clearable
|
|
|
|
|
|
v-model="form.address"
|
|
|
|
|
|
maxlength="50"
|
|
|
|
|
|
show-word-limit
|
|
|
|
|
|
></el-input>
|
2024-06-23 17:30:00 +08:00
|
|
|
|
</el-form-item>
|
2024-06-25 11:13:29 +08:00
|
|
|
|
<el-form-item label="门店描述:" style="width: 100%" prop="description">
|
|
|
|
|
|
<el-input v-model="form.description" placeholder="请输入门店描述" type="textarea" :rows="3"></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</ai-card>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
|
<el-button @click="cancel">取消</el-button>
|
|
|
|
|
|
<el-button type="primary" @click="handleSave">保存</el-button>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</ai-detail>
|
|
|
|
|
|
<ai-dialog title="选择片区" :visible.sync="dialog" :customFooter="true" border width="720px">
|
|
|
|
|
|
<div class="grid">
|
|
|
|
|
|
<el-tree
|
|
|
|
|
|
:data="treeList"
|
|
|
|
|
|
:props="defaultProps"
|
|
|
|
|
|
node-key="id"
|
|
|
|
|
|
ref="treeRef"
|
|
|
|
|
|
:check-strictly="true"
|
|
|
|
|
|
show-checkbox
|
2024-06-25 14:35:50 +08:00
|
|
|
|
:default-expanded-keys="currCheckedKeys"
|
|
|
|
|
|
:default-checked-keys="currCheckedKeys"
|
2024-06-26 11:19:28 +08:00
|
|
|
|
@check-change="handleCheckChange"
|
2024-06-25 11:13:29 +08:00
|
|
|
|
@check="onCheckChange">
|
|
|
|
|
|
</el-tree>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="dialog-footer" slot="footer">
|
|
|
|
|
|
<el-button size="medium" @click="dialog=false">取消</el-button>
|
2024-06-25 14:35:50 +08:00
|
|
|
|
<el-button type="primary" size="medium" @click="getCheckedTree">确认</el-button>
|
2024-06-25 11:13:29 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</ai-dialog>
|
|
|
|
|
|
</div>
|
2024-06-23 17:30:00 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2024-06-25 10:06:32 +08:00
|
|
|
|
import {ID} from "dui/lib/js/utils";
|
|
|
|
|
|
|
2024-06-23 17:30:00 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
name: 'Add',
|
|
|
|
|
|
|
|
|
|
|
|
props: {
|
|
|
|
|
|
instance: Function,
|
|
|
|
|
|
dict: Object,
|
|
|
|
|
|
params: Object
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
2024-06-25 10:06:32 +08:00
|
|
|
|
form: {
|
2024-06-25 11:13:29 +08:00
|
|
|
|
id: null,
|
|
|
|
|
|
areaId: '',
|
2024-06-25 16:36:01 +08:00
|
|
|
|
girdCode: '',
|
|
|
|
|
|
girdName: '',
|
2024-06-25 10:25:37 +08:00
|
|
|
|
name: '',
|
|
|
|
|
|
idNumber: '',
|
|
|
|
|
|
sex: '',
|
|
|
|
|
|
phone: '',
|
|
|
|
|
|
birthday: '',
|
|
|
|
|
|
age: '',
|
2024-06-25 16:36:01 +08:00
|
|
|
|
fileUrl:[],
|
|
|
|
|
|
girdInfoList: []
|
2024-06-25 10:06:32 +08:00
|
|
|
|
},
|
2024-06-25 16:36:01 +08:00
|
|
|
|
currCheckedKeys: [],
|
2024-06-25 11:13:29 +08:00
|
|
|
|
dialog: false,
|
|
|
|
|
|
treeList: [],
|
2024-06-26 11:19:28 +08:00
|
|
|
|
treeArray:[],
|
2024-06-25 14:35:50 +08:00
|
|
|
|
treeObj: {
|
|
|
|
|
|
checkedKeys: [],
|
|
|
|
|
|
},
|
|
|
|
|
|
defaultExpandedKeys: [],
|
2024-06-25 11:13:29 +08:00
|
|
|
|
defaultProps: {
|
|
|
|
|
|
children: "children",
|
|
|
|
|
|
label: "girdName",
|
|
|
|
|
|
},
|
2024-06-27 11:23:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
computed:{
|
|
|
|
|
|
rules(){
|
|
|
|
|
|
const IdNumberPass = (rule, value, callback) => {
|
|
|
|
|
|
if (value) {
|
|
|
|
|
|
if (ID.check(value)) {
|
|
|
|
|
|
callback();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
callback(new Error("身份证号格式错误"));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-07-01 17:12:46 +08:00
|
|
|
|
// else {
|
|
|
|
|
|
// callback(new Error("请输入身份证号"));
|
|
|
|
|
|
// }
|
2024-06-27 11:23:15 +08:00
|
|
|
|
};
|
|
|
|
|
|
return {
|
2024-06-25 10:25:37 +08:00
|
|
|
|
name: [{required: true, message: '请输入经营者姓名', trigger: 'blur'}],
|
2024-07-01 16:59:21 +08:00
|
|
|
|
idNumber: [{required: false, validator: IdNumberPass, trigger: 'change'}],
|
|
|
|
|
|
sex: [{required: false, message: '请选择性别', trigger: 'change'}],
|
2024-06-25 10:25:37 +08:00
|
|
|
|
phone: [{required: true, message: '请输入手机号', trigger: 'blur'}],
|
|
|
|
|
|
shopName: [{required: true, message: '请输入门店名称', trigger: 'blur'}],
|
|
|
|
|
|
operatorType: [{required: true, message: '请选择经营者类型', trigger: 'change'}],
|
|
|
|
|
|
girdCode: [{required: true, message: '请选择所属片区', trigger: 'change'}],
|
2024-07-01 16:59:21 +08:00
|
|
|
|
fileUrl: [{required: false, message: '请选择门店照片', trigger: 'change'}],
|
2024-07-01 17:12:46 +08:00
|
|
|
|
areaId: [{required: false, message: '请选择门店住址', trigger: 'change'}],
|
2024-06-25 10:06:32 +08:00
|
|
|
|
}
|
2024-06-23 17:30:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2024-06-25 10:25:37 +08:00
|
|
|
|
created() {
|
2024-06-25 14:35:50 +08:00
|
|
|
|
this.beforeSelectTree()
|
2024-06-25 11:13:29 +08:00
|
|
|
|
this.form.areaId = this.$store.state.user.info.areaId
|
|
|
|
|
|
this.$dict.load('sex', 'operatorType')
|
2024-06-25 11:23:15 +08:00
|
|
|
|
|
2024-06-25 16:36:01 +08:00
|
|
|
|
if (this.params.id) {
|
2024-06-25 11:23:15 +08:00
|
|
|
|
this.getDetail(this.params);
|
|
|
|
|
|
}
|
2024-06-25 10:06:32 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
2024-06-25 14:35:50 +08:00
|
|
|
|
|
2024-06-23 17:30:00 +08:00
|
|
|
|
methods: {
|
2024-06-27 11:23:15 +08:00
|
|
|
|
getInfoByIdNumber(code) {
|
|
|
|
|
|
if (ID.check(code)) {
|
|
|
|
|
|
let info = new ID(code)
|
|
|
|
|
|
this.form.age = info.age
|
|
|
|
|
|
this.form.birthday = info.birthday
|
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2024-06-25 14:35:50 +08:00
|
|
|
|
beforeSelectTree() {
|
|
|
|
|
|
this.treeObj.checkedKeys = [];
|
|
|
|
|
|
this.instance.post(`/app/appgirdinfo/listAll3`, null, null).then((res) => {
|
|
|
|
|
|
if (res.code == 0) {
|
2024-06-26 11:19:28 +08:00
|
|
|
|
this.treeArray = res.data
|
2024-06-25 14:35:50 +08:00
|
|
|
|
this.form.girdInfoList.map((e) => {
|
|
|
|
|
|
this.treeObj.checkedKeys.push(e.id);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.treeList = res.data.filter(e => !e.parentGirdId)
|
|
|
|
|
|
const parentGirdId = this.treeList[0].id
|
|
|
|
|
|
|
|
|
|
|
|
this.treeList.map(p => this.addChild(p, res.data.map(v => {
|
|
|
|
|
|
if (v.id === parentGirdId) {
|
|
|
|
|
|
this.defaultExpandedKeys.push(v.id)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
...v
|
|
|
|
|
|
}
|
|
|
|
|
|
}), {
|
|
|
|
|
|
parent: 'parentGirdId'
|
|
|
|
|
|
}))
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
2024-06-25 16:36:01 +08:00
|
|
|
|
async getDetail({id}) {
|
2024-06-25 11:23:15 +08:00
|
|
|
|
try {
|
2024-06-25 16:36:01 +08:00
|
|
|
|
const {code, data} = await this.instance.post('/app/appshoparchives/queryDetailById', null, {
|
|
|
|
|
|
params: {
|
2024-06-25 11:23:15 +08:00
|
|
|
|
id
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2024-06-25 16:36:01 +08:00
|
|
|
|
if (code === 0) {
|
2024-06-26 11:19:28 +08:00
|
|
|
|
this.form = {...data,girdInfoList:[]}
|
|
|
|
|
|
this.form.fileUrl = [{
|
|
|
|
|
|
url: data.fileUrl
|
|
|
|
|
|
}]
|
|
|
|
|
|
const target = this.treeArray?.find(v=>v.girdCode === data.girdCode)
|
|
|
|
|
|
this.currCheckedKeys = [target.id]
|
2024-06-25 11:23:15 +08:00
|
|
|
|
}
|
2024-06-25 16:36:01 +08:00
|
|
|
|
} catch (e) {
|
2024-06-25 11:23:15 +08:00
|
|
|
|
console.error(e)
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2024-06-25 11:13:29 +08:00
|
|
|
|
|
|
|
|
|
|
getCheckedTree() {
|
2024-06-25 14:35:50 +08:00
|
|
|
|
const nodes = this.$refs.treeRef.getCheckedNodes()
|
|
|
|
|
|
if (!nodes.length) {
|
|
|
|
|
|
return this.$message.error('请选择网格')
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.currCheckedKeys = [nodes[0]?.id]
|
2024-06-25 16:36:01 +08:00
|
|
|
|
this.form.girdCode = nodes[0]?.girdCode
|
|
|
|
|
|
this.form.girdName = nodes[0]?.girdName
|
2024-06-25 14:35:50 +08:00
|
|
|
|
this.dialog = false;
|
2024-06-25 11:13:29 +08:00
|
|
|
|
},
|
2024-06-25 14:35:50 +08:00
|
|
|
|
|
2024-06-26 11:19:28 +08:00
|
|
|
|
handleCheckChange(data, checked){
|
|
|
|
|
|
if (checked) {
|
|
|
|
|
|
this.$refs.treeRef.setCheckedKeys([data.id])
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2024-06-25 11:13:29 +08:00
|
|
|
|
|
2024-06-26 11:19:28 +08:00
|
|
|
|
onCheckChange(e) {
|
|
|
|
|
|
if(e.children && e.children.length>0){
|
|
|
|
|
|
this.$refs.treeRef.setCheckedKeys([]);
|
|
|
|
|
|
}
|
2024-06-25 11:13:29 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
2024-06-25 10:06:32 +08:00
|
|
|
|
|
2024-06-25 10:25:37 +08:00
|
|
|
|
async addOrUpdate() {
|
|
|
|
|
|
try {
|
2024-06-26 09:24:04 +08:00
|
|
|
|
const {code} = await this.instance.post(`/app/appshoparchives/addOrUpdate`,{
|
2024-06-25 16:36:01 +08:00
|
|
|
|
...this.form,
|
|
|
|
|
|
fileId:this.form.fileUrl[0]?.id,
|
|
|
|
|
|
fileUrl:this.form.fileUrl[0]?.path,
|
2024-06-25 10:25:37 +08:00
|
|
|
|
})
|
2024-06-25 11:13:29 +08:00
|
|
|
|
if (code === 0) {
|
2024-06-25 10:25:37 +08:00
|
|
|
|
this.$message.success('保存成功');
|
2024-06-26 09:24:04 +08:00
|
|
|
|
this.cancel()
|
2024-06-25 10:25:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
console.error(e)
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2024-06-23 17:30:00 +08:00
|
|
|
|
|
2024-06-25 10:25:37 +08:00
|
|
|
|
handleSave() {
|
|
|
|
|
|
this.$refs['ruleForm'].validate(valid => {
|
|
|
|
|
|
if (valid) {
|
|
|
|
|
|
this.addOrUpdate()
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2024-06-23 17:30:00 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
cancel() {
|
|
|
|
|
|
this.$emit('change', {
|
|
|
|
|
|
type: 'List',
|
|
|
|
|
|
isRefresh: true
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
|
.add {
|
|
|
|
|
|
|
2024-06-25 10:25:37 +08:00
|
|
|
|
.flex-colum {
|
2024-06-23 17:30:00 +08:00
|
|
|
|
width: 100%;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.files {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
|
|
|
|
|
|
|
.file-item {
|
|
|
|
|
|
width: 118px;
|
|
|
|
|
|
height: 118px;
|
|
|
|
|
|
margin: 0 20px 20px 0;
|
|
|
|
|
|
|
|
|
|
|
|
img, video {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
object-fit: cover;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
img {
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
transition: all ease 0.3s;
|
|
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
opacity: 0.7;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|