| | |
| | | * 获取自动评估历史记录 |
| | | */ |
| | | fetchAutoEvaluation(param){ |
| | | return $fysp.post(`evaluation/auto/record`, param).then((res) => res.data); |
| | | return $fysp.post(`evaluation/auto/record`, param); |
| | | } |
| | | }; |
| | |
| | | */ |
| | | checkProblem({ pId, action, remark = '', userId = id, userName = name }) { |
| | | const params = `?pId=${pId}&action=${action}&remark=${remark}&userId=${userId}&userName=${userName}`; |
| | | return $fysp.post(`problemlist/check${params}`).then((res) => res.data); |
| | | return $fysp.post(`problemlist/check${params}`); |
| | | }, |
| | | }; |
| | |
| | | */ |
| | | searchScene(area, page = 1, perPage = 20) { |
| | | const params = `page=${page}&per_page=${perPage}`; |
| | | return $fysp.post(`scense/find?${params}`, area).then((res) => res.data); |
| | | return $fysp.post(`scense/find?${params}`, area); |
| | | }, |
| | | |
| | | /** |
| | |
| | | * @returns 场景详情 |
| | | */ |
| | | getSceneDetail(sId) { |
| | | return $fysp |
| | | .get(`scense/detail`, { |
| | | return $fysp.get(`scense/detail`, { |
| | | params: { |
| | | sceneId: sId, |
| | | }, |
| | | }) |
| | | .then((res) => res.data); |
| | | sceneId: sId |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | |
| | | const rb = { |
| | | scense: scene ? scene : null, |
| | | subScene: subScene ? JSON.stringify(subScene) : null, |
| | | sceneDevice: sceneDevice ? sceneDevice : null, |
| | | sceneDevice: sceneDevice ? sceneDevice : null |
| | | }; |
| | | return $fysp |
| | | .post(`scense/detail/update?${params}`, rb) |
| | | .then((res) => res.data); |
| | | return $fysp.post(`scense/detail/update?${params}`, rb); |
| | | }, |
| | | |
| | | /** |
| | | * 更新场景额外信息 |
| | | */ |
| | | updateSubScene(typeId, subScene) { |
| | | return this.updateSceneDetail(typeId, { subScene: subScene }).then( |
| | | (res) => res.data |
| | | ); |
| | | return this.updateSceneDetail(typeId, { subScene: subScene }); |
| | | }, |
| | | |
| | | /** |
| | | * 更新场景设备信息 |
| | | */ |
| | | updateSceneDevice(typeId, sceneDevice) { |
| | | return this.updateSceneDetail(typeId, { sceneDevice: sceneDevice }).then( |
| | | (res) => res.data |
| | | ); |
| | | return this.updateSceneDetail(typeId, { sceneDevice: sceneDevice }); |
| | | }, |
| | | |
| | | /** |
| | |
| | | * @param {Object} scene |
| | | */ |
| | | createScene(scene) { |
| | | return $fysp.put('scense', scene).then((res) => res.data); |
| | | return $fysp.put('scense', scene); |
| | | }, |
| | | |
| | | /** |
| | |
| | | * @param {Object} scene |
| | | */ |
| | | updateScene(scene) { |
| | | return $fysp.post('scense', scene).then((res) => res.data); |
| | | }, |
| | | return $fysp.post('scense', scene); |
| | | } |
| | | }; |
| | |
| | | * 获取顶层任务 |
| | | */ |
| | | getTopTask() { |
| | | return $fysp.get('task/alltask/0').then((res) => res.data); |
| | | return $fysp.get('task/alltask/0'); |
| | | }, |
| | | |
| | | /** |
| | | * 获取子任务统计信息 |
| | | */ |
| | | getSubtaskSummary({ topTaskId = undefined, sceneTypeId = undefined }) { |
| | | return $fysp |
| | | .get('subtask/summary', { |
| | | return $fysp.get('subtask/summary', { |
| | | params: { |
| | | topTaskId: topTaskId, |
| | | sceneTypeId: sceneTypeId, |
| | | }, |
| | | }) |
| | | .then((res) => res.data); |
| | | sceneTypeId: sceneTypeId |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | | * 获取子任务问题详情 |
| | | */ |
| | | getProBySubtask(id) { |
| | | return $fysp |
| | | .get('problemlist/subtask', { |
| | | return $fysp.get('problemlist/subtask', { |
| | | params: { |
| | | stGuid: id, |
| | | }, |
| | | }) |
| | | .then((res) => res.data); |
| | | }, |
| | | stGuid: id |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | |
| | | * 获取用户详情 |
| | | */ |
| | | getUserById(id) { |
| | | return $fysp.get(`userinfo/${id}`).then((res) => res.data); |
| | | return $fysp.get(`userinfo/${id}`); |
| | | }, |
| | | |
| | | /** |
| | | * 更新用户详情 |
| | | */ |
| | | updateUser(user) { |
| | | return $fysp.post(`userinfo`, user).then((res) => res.data); |
| | | return $fysp.post(`userinfo`, user); |
| | | }, |
| | | |
| | | /** |
| | | * 获取场景的用户详情 |
| | | */ |
| | | getUserByScene(sId) { |
| | | return $fysp |
| | | .get(`userinfo/scene/get?sceneId=${sId}`) |
| | | .then((res) => res.data); |
| | | return $fysp.get(`userinfo/scene/get?sceneId=${sId}`); |
| | | }, |
| | | |
| | | /** |
| | | * 自动创建账户 |
| | | */ |
| | | autoCreateAccount(sId) { |
| | | return $fysp.post(`userinfo/create?sceneId=${sId}`).then((res) => res.data); |
| | | }, |
| | | return $fysp.post(`userinfo/create?sceneId=${sId}`); |
| | | } |
| | | }; |
| | |
| | | */ |
| | | getNoticeHistory({ type, subtype = null, page = 1, perPage = 20 }) { |
| | | const params = `userId=${id}&page=${page}&per_page=${perPage}`; |
| | | return $fytz |
| | | .post(`notifications/history?${params}`, { |
| | | return $fytz.post(`notifications/history?${params}`, { |
| | | ecNoticetype: type, |
| | | ecNoticesubtype: subtype, |
| | | }) |
| | | .then((res) => res.data); |
| | | ecNoticesubtype: subtype |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | | * 获取用户未读通知 |
| | | */ |
| | | getNotification() { |
| | | return $fytz |
| | | .get('notifications', { |
| | | return $fytz.get('notifications', { |
| | | params: { |
| | | userId: id, |
| | | page: 1, |
| | | per_page: 30, |
| | | }, |
| | | }) |
| | | .then((res) => res.data); |
| | | per_page: 30 |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | |
| | | releaseNotice(notice) { |
| | | notice.authorId = id; |
| | | notice.authorName = name; |
| | | return $fytz |
| | | .post(`notifications/${id}/release2`, notice) |
| | | .then((res) => res.data); |
| | | }, |
| | | return $fytz.post(`notifications/${id}/release2`, notice); |
| | | } |
| | | }; |
| | |
| | | */ |
| | | fetchUser(page = 1, per_page = 20, data) { |
| | | const params = `page=${page}&per_page=${per_page}`; |
| | | return $fytz.post(`baseInfo/search/?${params}`, data).then((res) => res.data); |
| | | return $fytz.post(`baseInfo/search/?${params}`, data); |
| | | }, |
| | | |
| | | /** |
| | |
| | | * @returns |
| | | */ |
| | | fetchUserBaseInfo(userId) { |
| | | return $fytz |
| | | .get(`userInfo/baseInfo?userId=${userId}`) |
| | | .then((res) => res.data); |
| | | return $fytz.get(`userInfo/baseInfo?userId=${userId}`); |
| | | }, |
| | | |
| | | /** |
| | |
| | | * @returns |
| | | */ |
| | | updateUserInfo(data) { |
| | | return $fytz.post('userInfo', data).then((res) => res.data); |
| | | return $fytz.post('userInfo', data); |
| | | }, |
| | | |
| | | /** |
| | |
| | | * @returns |
| | | */ |
| | | createUser(data) { |
| | | return $fytz.put('userInfo', data).then((res) => res.data); |
| | | return $fytz.put('userInfo/create', data); |
| | | }, |
| | | |
| | | /** |
| | | * 重置用户密码 |
| | | */ |
| | | resetPassword(id) { |
| | | return $fytz.post(`userInfo/resetPw?userId=${id}`); |
| | | } |
| | | }; |
| | |
| | | //飞羽监管 |
| | | const $fysp = axios.create({ |
| | | baseURL: ip1, |
| | | timeout: 10000, |
| | | timeout: 10000 |
| | | }); |
| | | $fysp.imgUrl = `${ip1_file}images/`; |
| | | $fysp.downloadUrl = `${ip1_file}files/`; |
| | |
| | | //飞羽环境 |
| | | const $fytz = axios.create({ |
| | | baseURL: ip2, |
| | | timeout: 10000, |
| | | timeout: 10000 |
| | | }); |
| | | $fytz.imgUrl = `${ip2_file}images/`; |
| | | |
| | |
| | | console.log(error); |
| | | ElMessage({ |
| | | message: error, |
| | | type: 'error', |
| | | type: 'error' |
| | | }); |
| | | return Promise.reject(error); |
| | | } |
| | |
| | | console.log(response); |
| | | console.log('==>请求结束'); |
| | | if (response.status == 200) { |
| | | if ( |
| | | response.data.success != undefined && |
| | | response.data.success != null |
| | | ) { |
| | | if (response.data.success != undefined && response.data.success != null) { |
| | | if (response.data.success == true) { |
| | | return response; |
| | | return response.data; |
| | | } else { |
| | | ElMessage({ |
| | | message: response.data.message, |
| | | type: 'error' |
| | | }); |
| | | return Promise.reject(response.data.message); |
| | | } |
| | | } else { |
| | | return response; |
| | | return response.data; |
| | | } |
| | | } else { |
| | | return Promise.reject(response); |
| | |
| | | console.log('==>请求结束'); |
| | | ElMessage({ |
| | | message: error, |
| | | type: 'error', |
| | | type: 'error' |
| | | }); |
| | | return Promise.reject(error); |
| | | } |
| | |
| | | <el-button :disabled="!edit" type="primary" @click="onSubmit" :loading="loading" |
| | | >提交</el-button |
| | | > |
| | | <el-button :disabled="!edit" @click="onReset">重置</el-button> |
| | | <el-button v-if="enableCancelBtn" @click="onCancel">取消</el-button> |
| | | <el-button v-if="useReset" :disabled="!edit" @click="onReset">重置</el-button> |
| | | <el-button v-if="useCancel" @click="onCancel">取消</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </template> |
| | |
| | | default: true |
| | | }, |
| | | //取消按钮是否可用 |
| | | enableCancelBtn: Boolean, |
| | | useCancel: Boolean, |
| | | //重置按钮是否可用 |
| | | useReset: Boolean, |
| | | //触发重置 |
| | | reset: Boolean, |
| | | //通知编辑状态 |
| | |
| | | const emit = defineEmits(['submit', 'cancel', 'update:isEdit']); |
| | | |
| | | //表单操作函数 |
| | | const { formObj, formRef, edit, onSubmit, onCancel, onReset } = useFormConfirm({ |
| | | const { formObj, formRef, edit, onSubmit, onCancel, onReset, formProps } = useFormConfirm({ |
| | | submit: { |
| | | do: submit |
| | | }, |
| | |
| | | emit('submit', formObj, () => { |
| | | loading.value = false; |
| | | resolve(); |
| | | },(err)=>{ |
| | | loading.value = false; |
| | | reject(err); |
| | | }); |
| | | }); |
| | | } |
| | |
| | | () => props.formInfo, |
| | | (nValue) => { |
| | | formObj.value = nValue; |
| | | } |
| | | }, |
| | | { deep: false, immediate: false } |
| | | ); |
| | | |
| | | //监听表单重置功能触发 |
| | |
| | | <template> |
| | | <el-form-item :label="placeholder"> |
| | | <el-form-item :label="placeholder" :prop="prop"> |
| | | <el-cascader |
| | | v-model="selectedOptions" |
| | | :options="locations" |
| | |
| | | checkStrictly: { |
| | | type: Boolean, |
| | | default: true |
| | | } |
| | | }, |
| | | prop: String |
| | | }, |
| | | emits: ['update:value'], |
| | | data() { |
| | |
| | | return |
| | | } |
| | | if (nVal != oVal) { |
| | | if (nVal || nVal.length > 0) { |
| | | this.selectedOptions = this.optionFormatReverse(nVal) |
| | | } |
| | | } |
| | | }, |
| | | deep: true, |
| | |
| | | }, |
| | | optionFormatReverse(val) { |
| | | const res = [] |
| | | if (val) { |
| | | if (val.pCode) { |
| | | res.push([val.pCode, val.pName]) |
| | | } |
| | |
| | | if (val.tCode) { |
| | | res.push([val.tCode, val.tName]) |
| | | } |
| | | } |
| | | return res |
| | | } |
| | | }, |
| | |
| | | <template> |
| | | <el-form-item label="场景类型"> |
| | | <el-form-item label="场景类型" :prop="prop"> |
| | | <el-select |
| | | v-model="selectedOptions" |
| | | placeholder="场景类型" |
| | |
| | | type: Boolean, |
| | | default: true, |
| | | }, |
| | | prop: String |
| | | }, |
| | | emits: ['update:value'], |
| | | data() { |
| | |
| | | <template> |
| | | <el-form-item label="用户类型"> |
| | | <el-form-item label="用户类型" :prop="prop"> |
| | | <el-select |
| | | v-model="selectedOptions" |
| | | placeholder="用户类型" |
| | |
| | | type: Boolean, |
| | | default: true, |
| | | }, |
| | | prop: String |
| | | }, |
| | | emits: ['update:value'], |
| | | data() { |
| | |
| | | import { onActivated, onDeactivated, ref, watch } from 'vue'; |
| | | import { defineProps, onActivated, onDeactivated, ref, watch } from 'vue'; |
| | | import { useCloned } from '@vueuse/core'; |
| | | import { useMessageBoxTip, useMessageBox } from './messageBox'; |
| | | |
| | |
| | | export function useFormConfirm({ |
| | | defaultForm = undefined, |
| | | submit = { |
| | | do: () => {}, |
| | | do: () => {} |
| | | }, |
| | | cancel = { |
| | | do: () => {}, |
| | | do: () => {} |
| | | }, |
| | | reset = { |
| | | do: () => {}, |
| | | }, |
| | | do: () => {} |
| | | } |
| | | }) { |
| | | if (!submit.title) submit.title = '提交'; |
| | | if (!submit.msg) submit.msg = '确认是否提交?'; |
| | | if (!cancel.title) cancel.title = '取消'; |
| | | if (!cancel.msg) cancel.msg = '是否放弃已编辑的内容?'; |
| | | |
| | | const formProps = defineProps({ |
| | | // 是否在提交成功后清空表单 |
| | | clearAftSubmit: Boolean |
| | | }); |
| | | |
| | | //表单内容 |
| | | const formObj = ref(defaultForm ? defaultForm : {}); |
| | |
| | | edit.value = false; |
| | | isReset = true; |
| | | formObj.value = useCloned(formObjClone.cloned, { |
| | | manual: true, |
| | | manual: true |
| | | }).cloned.value; |
| | | formRef.value.clearValidate(); |
| | | }; |
| | | |
| | | // 清空表单 |
| | | const clear = function () { |
| | | edit.value = false; |
| | | isReset = true; |
| | | formRef.value.resetFields(); |
| | | // formRef.value.resetFields(); |
| | | edit.value = false; |
| | | }; |
| | | |
| | | // 提交成功后 |
| | | const submited = function () { |
| | | if (formProps.clearAftSubmit) clear(); |
| | | edit.value = false; |
| | | formObjClone = useCloned(formObj, { manual: true }); |
| | | }; |
| | |
| | | confirmMsg: submit.msg, |
| | | confirmTitle: submit.title, |
| | | onConfirm: async () => { |
| | | await submit.do(); |
| | | const res = await submit.do(); |
| | | submited(); |
| | | return; |
| | | }, |
| | | return res; |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | |
| | | confirmMsg: cancel.msg, |
| | | confirmTitle: cancel.title, |
| | | onConfirm: () => { |
| | | clear(); |
| | | // clear(); |
| | | return cancel.do(); |
| | | }, |
| | | } |
| | | }); |
| | | } else { |
| | | cancel.do(); |
| | |
| | | onConfirm: () => { |
| | | _reset(); |
| | | return reset.do(); |
| | | }, |
| | | } |
| | | }); |
| | | } else { |
| | | _reset(); |
| | |
| | | } |
| | | }; |
| | | |
| | | return { formObj, formRef, edit, onSubmit, onCancel, onReset }; |
| | | return { formProps, formObj, formRef, edit, onSubmit, onCancel, onReset }; |
| | | } |
| | |
| | | let msg = `已${doneMsg}` |
| | | if (typeof onConfirm === 'function') { |
| | | const str = await onConfirm(); |
| | | if (str && str != '') { |
| | | if (typeof str === 'string' && str != '') { |
| | | msg = `已${doneMsg}, ${str}` |
| | | } |
| | | } |
| | |
| | | <FYForm |
| | | :form-info="_formInfo" |
| | | :rules="rules" |
| | | :useReset="true" |
| | | @submit="submit" |
| | | @cancel="cancel" |
| | | > |
| | |
| | | |
| | | const emit = defineEmits(['onSubmit', 'onCancel']); |
| | | |
| | | const _formInfo = ref(); |
| | | const _formInfo = ref({}); |
| | | const sceneTypes = reactive(enumScene(2, false)); |
| | | const locations = reactive(enumLocation(false)); |
| | | const cascaderProps = reactive({ |
| | |
| | | :level="4" |
| | | v-model:value="formSearch._locations" |
| | | ></FYOptionLocation> |
| | | <FYOptionText label="关键字" placeholder="输入名称关键字" v-model:value="formSearch.searchText"></FYOptionText> |
| | | <FYOptionText |
| | | label="关键字" |
| | | placeholder="输入名称关键字" |
| | | v-model:value="formSearch.searchText" |
| | | ></FYOptionText> |
| | | <FYOptionScene |
| | | :allOption="true" |
| | | :type="1" |
| | |
| | | </template> |
| | | |
| | | <template #table-column> |
| | | <el-table-column |
| | | type="index" |
| | | fixed="left" |
| | | prop="userInfo.realname" |
| | | label="名称" |
| | | width="400" |
| | | > |
| | | <el-table-column type="index" fixed="left" prop="userInfo.realname" label="名称" width="400"> |
| | | <template #default="scope"> |
| | | <el-tooltip |
| | | effect="dark" |
| | |
| | | <el-table-column prop="userInfo.usertype" label="用户类型" width="90" /> |
| | | <el-table-column fixed="right" align="right" label="操作" width="160"> |
| | | <template #header> |
| | | <el-button |
| | | icon="DocumentAdd" |
| | | size="default" |
| | | type="success" |
| | | @click="drawer = true" |
| | | <el-button icon="DocumentAdd" size="default" type="success" @click="drawer = true" |
| | | >新增用户</el-button |
| | | > |
| | | </template> |
| | |
| | | |
| | | export default { |
| | | components: { |
| | | CompUserInfoAddDrawer, |
| | | CompUserInfoAddDrawer |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | _locations: {}, |
| | | searchText: '', |
| | | scensetype: {}, |
| | | online: {}, |
| | | online: {} |
| | | }, |
| | | drawer: false, |
| | | drawer: false |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapStores(useLoadingStore), |
| | | ...mapStores(useLoadingStore) |
| | | }, |
| | | methods: { |
| | | onSearch(page, func) { |
| | | const f = this.formSearch; |
| | | const area = {}; |
| | | // 行政区划 |
| | | area.provinceCode = f._locations.pCode ? f._locations.pCode + '0000' : undefined |
| | | area.provinceCode = f._locations.pCode; |
| | | area.provinceName = f._locations.pName; |
| | | if (area.provinceCode == null) { |
| | | area.provinceCode = null; |
| | | area.provinceName = null; |
| | | } |
| | | area.cityCode = f._locations.cCode ? f._locations.cCode.substring(0, 3) + '100' : undefined |
| | | area.cityCode = f._locations.cCode; |
| | | area.cityName = f._locations.cName; |
| | | area.districtCode = f._locations.dCode; |
| | | area.districtName = f._locations.dName; |
| | |
| | | if (res) { |
| | | func({ |
| | | data: res.data, |
| | | total: res.head.totalCount, |
| | | total: res.head.totalCount |
| | | }); |
| | | } |
| | | }); |
| | |
| | | const param = { |
| | | guid: scope.row.userInfo.guid, |
| | | isenable: !scope.row.userInfo.isenable |
| | | } |
| | | }; |
| | | const msg = scope.row.userInfo.isenable ? '下线' : '上线'; |
| | | useMessageBoxTip({ |
| | | confirmMsg: `确认${msg}该场景?`, |
| | | confirmTitle: msg, |
| | | onConfirm: () => { |
| | | onConfirm: async () => { |
| | | scope.row.loading2 = true; |
| | | return userApi |
| | | .updateUserInfo(param) |
| | |
| | | .finally(() => { |
| | | scope.row.loading2 = false; |
| | | }); |
| | | }, |
| | | } |
| | | }); |
| | | }, |
| | | tableRowClassName({ row }) { |
| | | return row.userInfo.isenable ? 'online-row' : 'offline-row'; |
| | | }, |
| | | }, |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | <style></style> |
| | |
| | | :form-info="_formInfo" |
| | | :rules="rules" |
| | | :reset="active" |
| | | :useCancel="create" |
| | | :useReset="!create" |
| | | :clearAftSubmit="create" |
| | | v-model:is-edit="_edit" |
| | | @submit="submit" |
| | | @cancel="cancel" |
| | |
| | | </el-col> |
| | | </el-form-item> |
| | | <FYOptionUserType |
| | | prop="_usertype" |
| | | :allOption="false" |
| | | :initValue="false" |
| | | v-model:value="formObj._usertype" |
| | |
| | | <el-form-item label="手机" prop="telephone"> |
| | | <el-input clearable type="tel" v-model="formObj.telephone" placeholder="手机" /> |
| | | </el-form-item> |
| | | <!-- <el-form-item label="省/市/区/镇" prop="_locations"> |
| | | <el-cascader |
| | | v-model="formObj._locations" |
| | | :options="locations" |
| | | placeholder="省/市/区/镇" |
| | | :props="locationsProps" |
| | | style="width: 280px" |
| | | :disabled="!create" |
| | | /> |
| | | </el-form-item> --> |
| | | <FYOptionLocation |
| | | v-if="create" |
| | | prop="_locations" |
| | | :allOption="false" |
| | | :level="4" |
| | | :checkStrictly="false" |
| | | :initValue="false" |
| | | v-model:value="formObj._locations" |
| | | ></FYOptionLocation> |
| | | <FYOptionScene |
| | | prop="_scenetype" |
| | | :allOption="false" |
| | | :type="1" |
| | | :initValue="false" |
| | |
| | | |
| | | const emit = defineEmits(['onSubmit', 'onCancel', 'update:isEdit']); |
| | | |
| | | const _formInfo = ref(); |
| | | const _formObject = { value: {} }; |
| | | const _formInfo = ref({ isenable: true }); |
| | | const _edit = ref(false); |
| | | const locations = enumLocation(false); |
| | | const locationsProps = reactive({ |
| | | checkStrictly: true |
| | | }); |
| | | const rules = reactive({ |
| | | acountname: [ |
| | | { |
| | |
| | | } |
| | | |
| | | function parseUserInfoReverse(formObj) { |
| | | // 行政区划信息填充 |
| | | const a = formObj.value._locations; |
| | | formObj.value.provincecode = a.pCode; |
| | | formObj.value.provincename = a.pName; |
| | | formObj.value.citycode = a.cCode; |
| | | formObj.value.cityname = a.cName; |
| | | formObj.value.districtcode = a.dCode; |
| | | formObj.value.extension1 = a.dName; |
| | | formObj.value.towncode = a.tCode; |
| | | formObj.value.townname = a.tName; |
| | | // 用户类型信息填充 |
| | | const b = formObj.value._usertype; |
| | | formObj.value.usertypeid = b.value; |
| | |
| | | return formObj; |
| | | } |
| | | |
| | | function createUser(formObj, func) { |
| | | function createUser(formObj, success, fail) { |
| | | const params = { |
| | | userInfo: formObj.value, |
| | | baseInfo: { |
| | | biProvinceCode: formObj.value.provincecode, |
| | | biProvinceName: formObj.value.provincename, |
| | | biCityCode: formObj.value.citycode, |
| | | biCityName: formObj.value.cityname, |
| | | biDistrictCode: formObj.value.districtcode, |
| | | biDistrictName: formObj.value.extension1, |
| | | biTownCode: formObj.value.towncode, |
| | | biTownName: formObj.value.townname |
| | | // biAreaCode |
| | | // biArea |
| | | // biManagementCompanyId |
| | | // biManagementCompany |
| | | // biContact |
| | | // biTelephone |
| | | // biAddress |
| | | } |
| | | }; |
| | | return userApi |
| | | .createUser(formObj.value) |
| | | .createUser(params) |
| | | .then(() => { |
| | | emit('onSubmit', formObj); |
| | | emit('onSubmit', params); |
| | | success(); |
| | | }) |
| | | .finally(() => { |
| | | _formObject.value = formObj.value; |
| | | func(); |
| | | .catch((err) => { |
| | | fail(err); |
| | | }); |
| | | } |
| | | |
| | | function updateUser(formObj, func) { |
| | | function updateUser(formObj, success, fail) { |
| | | return userApi |
| | | .updateUserInfo(formObj.value) |
| | | .then(() => { |
| | | emit('onSubmit', formObj); |
| | | if (success) success(); |
| | | }) |
| | | .finally(() => { |
| | | _formObject.value = formObj.value; |
| | | if (func) func(); |
| | | .catch((err) => { |
| | | if (fail) fail(err); |
| | | }); |
| | | } |
| | | |
| | | function submit(formObj, func) { |
| | | // 行政区划信息填充 |
| | | // const a = formObj.value._locations; |
| | | // if (a[0]) { |
| | | // formObj.value.provincecode = a[0][0]; |
| | | // formObj.value.provincename = a[0][1]; |
| | | // } |
| | | // if (a[1]) { |
| | | // formObj.value.citycode = a[1][0]; |
| | | // formObj.value.cityname = a[1][1]; |
| | | // } |
| | | // if (a[2]) { |
| | | // formObj.value.districtcode = a[2][0]; |
| | | // formObj.value.extension1 = a[2][1]; |
| | | // } |
| | | // if (a[3]) { |
| | | // formObj.value.towncode = a[3][0]; |
| | | // formObj.value.townname = a[3][1]; |
| | | // } |
| | | |
| | | function submit(formObj, success, fail) { |
| | | parseUserInfoReverse(formObj); |
| | | |
| | | return props.create ? createUser(formObj, func) : updateUser(formObj, func); |
| | | return props.create ? createUser(formObj, success, fail) : updateUser(formObj, success, fail); |
| | | } |
| | | |
| | | function cancel() { |
| | |
| | | () => props.formInfo, |
| | | (nValue) => { |
| | | _formInfo.value = parseUserInfo(nValue); |
| | | _formObject.value = _formInfo.value; |
| | | } |
| | | ); |
| | | |
| | | // watch( |
| | | // () => props.create, |
| | | // (nValue) => { |
| | | // if (nValue) { |
| | | |
| | | // } |
| | | // }, |
| | | // {immediate:true} |
| | | // ); |
| | | |
| | | watch(_edit, (nValue) => { |
| | | emit('update:isEdit', nValue); |
| | | }); |
| | | |
| | | |
| | | // 重置密码 |
| | | |
| | |
| | | confirmMsg: '是否重置该场景密码?', |
| | | confirmTitle: '重置密码', |
| | | onConfirm: async () => { |
| | | pwLoading.value = true |
| | | _formObject.value.password = '123456'; |
| | | await updateUser(_formObject); |
| | | pwLoading.value = false |
| | | pwLoading.value = true; |
| | | return userApi.resetPassword(props.formInfo.guid).finally(() => { |
| | | pwLoading.value = false; |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | |
| | | } |
| | | }, |
| | | onDrawerCancel() { |
| | | this.onDrawerClose(() => { |
| | | // this.onDrawerClose(() => { |
| | | // this.drawer_ = false; |
| | | // }); |
| | | this.drawer_ = false; |
| | | }); |
| | | }, |
| | | }, |
| | | }; |