添加正元同步表单项
This commit is contained in:
1 parent
9969dc2b41
commit
7bfc398c59
2 files changed
+21
-4
No files matched your search
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-dialog :title="dataForm.deptId ? $t('common.editBtn') : $t('common.addBtn')" v-model="visible" width="600">
|
||||
<el-form ref="deptDialogFormRef" :model="dataForm" label-width="90px" :rules="dataRules" v-loading="loading">
|
||||
<el-form ref="deptDialogFormRef" :model="dataForm" label-width="110px" :rules="dataRules" v-loading="loading">
|
||||
<el-form-item :label="$t('sysdept.parentId')" prop="parentId">
|
||||
<el-tree-select
|
||||
v-model="dataForm.parentId"
|
||||
@@ -21,6 +21,9 @@
|
||||
<select-hard-group v-model="dataForm.hardGroupId" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-form-item v-if="useUserInfo().userInfos.roleCodes.includes('ROLE_ADMIN')" label="是否同步到正元" prop="isSyncZy">
|
||||
<el-switch v-model="dataForm.isSyncZy" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('sysdept.sortOrder')" prop="sortOrder">
|
||||
<el-input-number v-model="dataForm.sortOrder" :placeholder="$t('sysdept.inputsortOrderTip')" clearable />
|
||||
</el-form-item>
|
||||
@@ -39,6 +42,7 @@ import { useI18n } from "vue-i18n"
|
||||
import { getObj, deptTree, addObj, putObj } from "/@/api/admin/dept"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import { rule } from "/@/utils/validate"
|
||||
import { useUserInfo } from "/@/stores/userInfo"
|
||||
|
||||
// 定义子组件向父组件传值/事件
|
||||
const emit = defineEmits(["refresh"])
|
||||
@@ -49,6 +53,7 @@ const dataForm = reactive({
|
||||
parentId: "",
|
||||
deptId: "",
|
||||
name: "",
|
||||
isSyncZy: false,
|
||||
sortOrder: 9999,
|
||||
hardGroupId: "",
|
||||
})
|
||||
@@ -78,7 +83,7 @@ const openDialog = (type: string, id: string) => {
|
||||
if (type === "edit") {
|
||||
getObj(id)
|
||||
.then((res) => {
|
||||
Object.assign(dataForm, res.data)
|
||||
Object.assign(dataForm, res.data, { isSyncZy: res.data.isSyncZy == "1" ? true : false })
|
||||
})
|
||||
.catch((err) => {
|
||||
useMessage().error(err.msg)
|
||||
@@ -95,7 +100,9 @@ const onSubmit = async () => {
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
dataForm.deptId ? await putObj(dataForm) : await addObj(dataForm)
|
||||
dataForm.deptId
|
||||
? await putObj({ ...dataForm, isSyncZy: dataForm.isSyncZy ? "1" : "0" })
|
||||
: await addObj({ ...dataForm, isSyncZy: dataForm.isSyncZy ? "1" : "0" })
|
||||
useMessage().success(t(dataForm.deptId ? "common.editSuccessText" : "common.addSuccessText"))
|
||||
visible.value = false
|
||||
emit("refresh")
|
||||
|
||||
Reference in new issue
Block a user