权限管理bug修复

This commit is contained in:
THK3121 2023-07-19 09:38:30 +08:00
parent 7a3a12285b
commit e32efeae31

View File

@ -8,18 +8,31 @@
@confirm="handleSubmit"
@close="handleClose"
>
<el-form ref="formRef" :model="formData" label-width="84px" :rules="formRules">
<div style="font-size: 1.2rem; margin: 10px 0">基本信息创建</div>
<el-form-item label="头像">
<div>
<div>
<material-picker v-model="formData.avatar" :limit="1" />
</div>
<div class="form-tips">建议尺寸100*100px支持jpgjpegpng格式</div>
</div>
</el-form-item>
<el-col :span="24" class="pt-6 !border-none">
<el-row>
<div style="display: flex;justify-content: space-between;">
<p style="flex: 1;">
<el-upload
v-model="formData.avatar"
class="avatar-uploader-head"
:data="{ cid: 1 }"
action="https://worker-task.lihaink.cn/api/upload/image"
:show-file-list="false"
:on-success="handleAvatarSuccessAvatar"
>
<img
v-if="formData.avatar"
:src="formData.avatar"
class="avatar"
/>
<el-icon v-else class="avatar-uploader-icon">
<Plus />
</el-icon>
</el-upload>
</p>
<el-col style="flex: 8;" class="pt-6 !border-none">
<el-row >
<el-col :span="12">
<el-form-item label="姓名" prop="name">
<el-input
@ -31,23 +44,16 @@
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="12">
<el-form-item label="性别" prop="sex">
<!-- <el-input
v-model="formData.sex"
placeholder="请输入性别"
clearable
:style="{ width: '100%' }"
>
</el-input> -->
<el-select v-model="formData.sex" placeholder="请选择性别" :style="{ width: '100%' }">
<el-option label="男" value="1" />
<el-option label="女" value="2" />
</el-select>
<el-option label="男" value="1" />
<el-option label="女" value="2" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="身份证号" prop="id_card">
<el-input
@ -70,8 +76,10 @@
</el-input>
</el-form-item>
</el-col>
<el-col :span="3">
<el-form-item label="省" prop="province">
</el-row>
<el-row >
<p style="display: flex;">
<el-form-item label="省" prop="province" style="flex: 1;">
<el-select
v-model="formData.province"
placeholder="请选择省"
@ -87,9 +95,9 @@
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="3">
<el-form-item label="市" prop="city">
<el-form-item label="市" prop="city" style="flex: 1;">
<el-select
v-model="formData.city"
placeholder="请选择市"
@ -105,9 +113,9 @@
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="3">
<el-form-item label="区" prop="area">
<el-form-item label="区" prop="area" style="flex: 1;">
<el-select
v-model="formData.area"
placeholder="请选择区"
@ -123,9 +131,9 @@
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="3">
<el-form-item label="镇" prop="street">
<el-form-item label="镇" prop="street" style="flex: 1;">
<el-select
v-model="formData.street"
placeholder="请选择镇"
@ -141,9 +149,7 @@
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="村社小队" prop="address">
<el-form-item label="村社小队" prop="address" style="flex: 1.5;">
<el-input
v-model="formData.address"
placeholder="请输入村社小队"
@ -151,17 +157,20 @@
:style="{ width: '100%' }"
>
</el-input>
</el-form-item>
</el-col>
</el-form-item>
</p>
</el-row>
</el-col>
</div>
<el-col :span="24">
<el-form-item label="授权身份" prop="role_id">
<el-select
v-model="formData.role_id"
:disabled="formData.root == 1"
class="flex-1"
placeholder="请选择授权身份"
clearable
>
@ -350,13 +359,14 @@
<el-col :span="12">
<el-form-item label-width="100px" label="合同类型" prop="contract_type">
<el-select
@change="getcontract"
@change="getcontract()"
v-model="formData.contract_type"
placeholder="请选择合同类型"
clearable
:style="{ width: '100%' }"
>
<el-option
v-for="(item, index) in datas.contract_type"
:key="index"
:label="item.name"
@ -507,7 +517,7 @@ const formData = reactive({
contract:"",
file:'',
is_contract: 0,
role_id: '',
role_id: "",
avatar: '',
multipoint_login: 1,
root: 0
@ -528,11 +538,15 @@ const getcontract_type = async () => {
}
//
const getcontract=async ()=>{
const data=await dictDataLists({ type_id: 9 })
var i= datas['contract_type'].findIndex(item => item.id ===formData.contract_type )
// console.log( datas['contract_type'][i])
const data=await dictDataLists({ type_value: datas['contract_type'][i].type_value })
datas['contract'] = data['lists']
}
getcontract_type()
getcontract()
//
const ValidatorPhone = (rule: object, value: string, callback: any) => {
let rg= /^(?:(?:\+|00)86)?1[3-9]\d{9}$/
@ -657,7 +671,7 @@ const { optionsData } = useDictOptions<{
const handleSubmit = async () => {
await formRef.value?.validate()
return
mode.value == 'edit' ? await adminEdit(formData) : await adminAdd(formData).then(res=>console.log(res))
popupRef.value?.close()
emit('success')
@ -671,6 +685,9 @@ const open = (type = 'add') => {
const handleAvatarSuccessIdA: UploadProps['onSuccess'] = (response, uploadFile) => {
formData.qualification.id_card = response.data.uri
}
const handleAvatarSuccessAvatar: UploadProps['onSuccess'] = (response, uploadFile) => {
formData.avatar = response.data.uri
}
const handleAvatarSuccessIdB: UploadProps['onSuccess'] = (response, uploadFile) => {
formData.qualification.id_card_b = response.data.uri
}
@ -733,15 +750,15 @@ const setFormData = async (row: any) => {
const data = await adminDetail({
id: row.id
})
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
key=='role_id'? formData[key] = data[key][0]: formData[key]= data[key]
}
}
}
console.log(formData)
const handleClose = () => {
emit('close')
}
@ -751,9 +768,23 @@ defineExpose({
open,
setFormData
})
</script>
<style>
.avatar-uploader-head .el-upload{
width: 7.5vw;
height: 8.5vw;
background-color: #fff;
border: 1px dashed var(--el-border-color);
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
transition: var(--el-transition-duration-fast);
}
.avatar-uploader .el-upload {
width: 10vw;
height: 6.3vw;