| | |
| | | placeholder="头像url" |
| | | /> |
| | | </el-form-item> --> |
| | | <el-form-item label="账户名" prop="acountname"> |
| | | <el-input clearable v-model="formObj.acountname" placeholder="账户名" /> |
| | | <el-form-item label="店铺名" prop="acountname"> |
| | | <el-input clearable v-model="formObj.acountname" placeholder="店铺名" /> |
| | | </el-form-item> |
| | | <el-form-item label="用户昵称" prop="realname"> |
| | | <el-input clearable v-model="formObj.realname" placeholder="用户昵称" /> |
| | | <el-form-item label="昵称" prop="realname"> |
| | | <el-input clearable v-model="formObj.realname" placeholder="昵称" /> |
| | | </el-form-item> |
| | | <el-form-item label="密码" prop="password"> |
| | | <el-col :span="18"> |
| | |
| | | prop="_scenetype" |
| | | :allOption="false" |
| | | :type="1" |
| | | :initValue="false" |
| | | :initValue="true" |
| | | v-model:value="formObj._scenetype" |
| | | ></FYOptionScene> |
| | | </template> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { defineProps, defineEmits, reactive, ref, watch, computed } from 'vue'; |
| | | import { getSceneName } from '@/enum/scene'; |
| | | import userApi from '@/api/fytz/userApi'; |
| | | import { useMessageBoxTip } from '@/composables/messageBox'; |
| | | import { defineProps, defineEmits, reactive, ref, watch, computed } from 'vue' |
| | | import { getSceneName } from '@/enum/scene' |
| | | import userApi from '@/api/fytz/userApi' |
| | | import { useMessageBoxTip } from '@/composables/messageBox' |
| | | |
| | | const props = defineProps({ |
| | | //基本信息 |
| | | model: { |
| | | type: Object |
| | | type: Object, |
| | | // default: () => { |
| | | // return { isenable: true }; |
| | | // } |
| | | }, |
| | | create: { |
| | | type: Boolean, |
| | | default: false |
| | | default: false, |
| | | }, |
| | | active: { |
| | | type: Boolean, |
| | | default: false |
| | | } |
| | | }); |
| | | default: false, |
| | | }, |
| | | }) |
| | | |
| | | const formInfo = ref({ isenable: true }); |
| | | const formInfo = ref({ isenable: true }) |
| | | |
| | | watch( |
| | | () => props.model, |
| | | (nValue) => { |
| | | formInfo.value = parseUserInfo(nValue); |
| | | } |
| | | ); |
| | | formInfo.value = parseUserInfo(nValue) |
| | | }, |
| | | ) |
| | | |
| | | const emit = defineEmits(['onSubmit', 'onCancel', 'updateEdit']); |
| | | const emit = defineEmits(['onSubmit', 'onCancel', 'updateEdit']) |
| | | |
| | | const rules = reactive({ |
| | | acountname: [ |
| | | { |
| | | required: true, |
| | | message: '账户名不能为空', |
| | | trigger: 'blur' |
| | | } |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | realname: [ |
| | | { |
| | | required: true, |
| | | message: '用户昵称不能为空', |
| | | trigger: 'blur' |
| | | } |
| | | ] |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | // password: [ |
| | | // { |
| | | // required: props.create, |
| | |
| | | // trigger: 'blur', |
| | | // }, |
| | | // ], |
| | | }); |
| | | }) |
| | | |
| | | // 用户基本信息格式化 |
| | | function parseUserInfo(s) { |
| | | if (s.usertype && s.usertypeid) { |
| | | s._usertype = { |
| | | label: s.usertype, |
| | | value: s.usertypeid + '' |
| | | }; |
| | | value: s.usertypeid + '', |
| | | } |
| | | } |
| | | |
| | | if (s.extension2) { |
| | | s._scenetype = getSceneName(s.extension2, 1); |
| | | s._scenetype = getSceneName(s.extension2, 1) |
| | | } |
| | | |
| | | s._locations = {}; |
| | | s._locations = {} |
| | | |
| | | return s; |
| | | return s |
| | | } |
| | | |
| | | function parseUserInfoReverse(v) { |
| | | // 行政区划信息填充 |
| | | const a = v._locations; |
| | | v.extension1 = a.dName; |
| | | const a = v._locations |
| | | v.extension1 = a.dName |
| | | // 用户类型信息填充 |
| | | const b = v._usertype; |
| | | v.usertypeid = b.value; |
| | | v.usertype = b.label; |
| | | const b = v._usertype |
| | | v.usertypeid = b.value |
| | | v.usertype = b.label |
| | | |
| | | // 场景类型信息填充 |
| | | const c = v._scenetype; |
| | | v.extension2 = c.value; |
| | | const c = v._scenetype |
| | | v.extension2 = c.value |
| | | |
| | | return v; |
| | | return v |
| | | } |
| | | |
| | | function createUser(v, success, fail) { |
| | | const l = v._locations; |
| | | const l = v._locations |
| | | const params = { |
| | | userInfo: v, |
| | | baseInfo: { |
| | |
| | | biTownCode: l.tCode, |
| | | biTownName: l.tName, |
| | | biAreaCode: l.aCode, |
| | | biArea: l.aName |
| | | biArea: l.aName, |
| | | // biManagementCompanyId: |
| | | // biManagementCompany: |
| | | // biContact |
| | | // biTelephone |
| | | // biAddress |
| | | } |
| | | }; |
| | | }, |
| | | } |
| | | return userApi |
| | | .createUser(params) |
| | | .then(() => { |
| | | emit('onSubmit', params); |
| | | success(); |
| | | emit('onSubmit', params) |
| | | success() |
| | | }) |
| | | .catch((err) => { |
| | | fail(err); |
| | | }); |
| | | fail(err) |
| | | }) |
| | | } |
| | | |
| | | function updateUser(v, success, fail) { |
| | | return userApi |
| | | .updateUserInfo(v) |
| | | .then(() => { |
| | | emit('onSubmit', v); |
| | | if (success) success(); |
| | | emit('onSubmit', v) |
| | | if (success) success() |
| | | }) |
| | | .catch((err) => { |
| | | if (fail) fail(err); |
| | | }); |
| | | if (fail) fail(err) |
| | | }) |
| | | } |
| | | |
| | | function submit(v, success, fail) { |
| | | parseUserInfoReverse(v.value); |
| | | parseUserInfoReverse(v.value) |
| | | |
| | | return props.create ? createUser(v.value, success, fail) : updateUser(v.value, success, fail); |
| | | return props.create ? createUser(v.value, success, fail) : updateUser(v.value, success, fail) |
| | | // parseUserInfoReverse(props.formInfo); |
| | | |
| | | // return props.create |
| | |
| | | } |
| | | |
| | | // 重置密码 |
| | | const pwLoading = ref(false); |
| | | const pwLoading = ref(false) |
| | | |
| | | function onResetPw() { |
| | | useMessageBoxTip({ |
| | | confirmMsg: '是否重置该场景密码?', |
| | | confirmTitle: '重置密码', |
| | | onConfirm: async () => { |
| | | pwLoading.value = true; |
| | | pwLoading.value = true |
| | | return userApi.resetPassword(formInfo.value.guid).finally(() => { |
| | | pwLoading.value = false; |
| | | }); |
| | | } |
| | | }); |
| | | pwLoading.value = false |
| | | }) |
| | | }, |
| | | }) |
| | | } |
| | | </script> |