添加正元同步表单项
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")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-dialog :title="form.id ? '编辑' : '新增'" width="40%" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="90px" v-loading="loading">
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="110px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="商户名" prop="name">
|
||||
@@ -31,6 +31,12 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item v-if="useUserInfo().userInfos.roleCodes.includes('ROLE_ADMIN')" label="是否同步到正元" prop="isSyncZy">
|
||||
<el-switch v-model="form.isSyncZy" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="商户logo" prop="logoPic">
|
||||
<upload-img v-model:imageUrl="form.logoPic" />
|
||||
@@ -108,6 +114,7 @@ import { useDict } from "/@/hooks/dict"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import { getObj, addObj, putObj } from "/@/api/wallet/mch-manage"
|
||||
const emit = defineEmits(["refresh"])
|
||||
import { useUserInfo } from "/@/stores/userInfo"
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref()
|
||||
@@ -126,6 +133,7 @@ const form = reactive({
|
||||
logoPic: "",
|
||||
collectMoneyCode: "",
|
||||
swiperPic: "",
|
||||
isSyncZy: false,
|
||||
phone: "",
|
||||
businessTime: "",
|
||||
address: "",
|
||||
@@ -175,6 +183,7 @@ const onSubmit = async () => {
|
||||
if (!valid) return false
|
||||
const _pa = {
|
||||
...form,
|
||||
isSyncZy: form.isSyncZy ? "1" : "0",
|
||||
types: form.merchantType,
|
||||
jobTime: (jobTime.morning?.join("-") || "") + "," + (jobTime.noon?.join("-") || "") + "," + (jobTime.evening?.join("-") || ""),
|
||||
}
|
||||
@@ -201,6 +210,7 @@ const getmerchantInfoData = async (id: string) => {
|
||||
const resJobTime = res.data.jobTime && regex.test(res.data.jobTime) ? res.data.jobTime.split(",") : []
|
||||
Object.assign(form, res.data, {
|
||||
merchantType: res.data.types,
|
||||
isSyncZy: res.data.isSyncZy == "1" ? true : false,
|
||||
})
|
||||
jobTime.morning = resJobTime[0]?.split("-") ?? []
|
||||
jobTime.noon = resJobTime[1]?.split("-") ?? []
|
||||
|
||||
Reference in new issue
Block a user