Handy_Cao преди 7 месеца
родител
ревизия
31a67ea80d

+ 29 - 0
src/constants/member.ts

@@ -54,4 +54,33 @@ export function getGenderList() {
 export function getGenderName(value?: number) {
     const item = getGenderList().find((e) => e.value === value)
     return item?.label ?? value
+}
+
+/**
+ * 客户类别
+ */
+export enum CustomerType {
+    Normal = 0, // 普通做市商
+    Main = 1, // 主做市商
+}
+
+/**
+ * 获取客户类别列表
+ * @returns 
+ */
+export function getCustomerTypeList() {
+    return [
+        { label: '普通做市商', value: CustomerType.Normal },
+        { label: '主做市商', value: CustomerType.Main },
+    ]
+}
+
+/**
+ * 获取客户类别名称
+ * @param value 
+ * @returns 
+ */
+export function getCustomerTypeName(value?: number) {
+    const item = getCustomerTypeList().find((e) => e.value === value)
+    return item?.label ?? value
 }

+ 78 - 3
src/packages/pc/views/member/institution/broker/components/edit/index.vue

@@ -1,17 +1,92 @@
 <!-- 会员机构管理-机构管理-经纪会员管理-新增/修改 -->
 <template>
-    <app-drawer title="新增/修改" width="900" v-model:show="show" :loading="loading" :refresh="refresh">
+    <app-drawer title="编辑" width="900" v-model:show="show" :loading="loading" :refresh="refresh">
+        <el-form ref="formRef" label-width="140px" :model="formData" :rules="formRules" :show-message="false">
+            <fieldset class="g-fieldset el-form--horizontal">
+                <legend class="g-fieldset__legend">机构</legend>
+                <el-form-item label="机构" prop="userid">
+                    <app-select-member v-model="formData.userid" />
+                </el-form-item>
+                <el-form-item label="角色权限信息:" prop="userid" >
+                    <el-button @click="openComponent('Roles')">查看</el-button>
+                </el-form-item>
+                <el-form-item label="营销中心" prop="userid">
+                    <app-select-member2 v-model="formData.userid" />
+                </el-form-item>
+            </fieldset>
+        </el-form>
+        <template #footer>
+            <el-button @click="onCancel(false)">{{ t('operation.cancel') }}</el-button>
+            <el-button type="primary" @click="onSubmit">{{ t('operation.save') }}</el-button>
+        </template>
+        <component ref="componentRef" v-bind="{ record }" :is="componentMap.get(componentId)" @closed="closeComponent" v-if="componentId" />
     </app-drawer>
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, PropType, defineAsyncComponent } from 'vue'
+import { shallowRef, PropType, ref, defineAsyncComponent, onMounted } from 'vue'
+import { ElMessage, FormInstance, FormRules } from 'element-plus'
+import { useComponent } from '@/hooks/component'
 import { i18n } from '@/stores'
+import { roleadd } from '@/services/api/member'
+import AppSelectMember from '@pc/components/modules/select-member/index.vue'
+import AppSelectMember2 from '@pc/components/modules/select-member2/index.vue'
 import AppDrawer from '@pc/components/base/drawer/index.vue'
 
-const { global: { t } } = i18n
+const props = defineProps({
+    record: {
+        type: Object as PropType<Member.OrganRoleRsp>
+    }
+})
+
+const componentMap = new Map<string, unknown>([
+    ['Roles', defineAsyncComponent(() => import('@pc/components/modules/roles/index.vue'))], // 角色权限信息
+])
+const { componentRef, componentId, openComponent, closeComponent } = useComponent()
 
+const { global: { t } } = i18n
+const formRef = ref<FormInstance>()
 const show = shallowRef(true)
 const refresh = shallowRef(false)
 const loading = shallowRef(false)
+
+const formData = ref<Partial<Member.RoleAddReq>>({
+    roleid: 7
+})
+
+// 表单验证规则
+const formRules: FormRules = {
+    userid: [{ required: true }]
+}
+
+const onSubmit = () => {
+    const rawData = { ...formData.value }
+    formRef.value?.validate((valid) => {
+        if (valid) {
+            loading.value = true
+            roleadd({
+                data: rawData
+            }).then(() => {
+                ElMessage.success(t('common.tips3'))
+                onCancel(true)
+            }).catch((err) => {
+                ElMessage.error(t('common.tips4') + err)
+            }).finally(() => {
+                loading.value = false
+            })
+        }
+    })
+}
+
+const onCancel = (isRefresh = false) => {
+    show.value = false
+    refresh.value = isRefresh
+}
+
+onMounted(() => {
+    const { userid, } = props.record ?? {}
+    if (userid) {
+        formData.value.userid = userid
+    }
+})
 </script>

+ 81 - 3
src/packages/pc/views/member/institution/marketer/components/edit/index.vue

@@ -1,17 +1,95 @@
 <!-- 会员机构管理-机构管理-做市会员管理-新增/修改 -->
 <template>
-    <app-drawer title="新增/修改" width="900" v-model:show="show" :loading="loading" :refresh="refresh">
+    <app-drawer title="编辑" width="900" v-model:show="show" :loading="loading" :refresh="refresh">
+        <el-form ref="formRef" label-width="140px" :model="formData" :rules="formRules" :show-message="false">
+            <fieldset class="g-fieldset el-form--horizontal">
+                <legend class="g-fieldset__legend">机构</legend>
+                <el-form-item label="机构" prop="userid">
+                    <app-select-member v-model="formData.userid" />
+                </el-form-item>
+                <el-form-item label="角色权限信息:" prop="userid" >
+                    <el-button @click="openComponent('Roles')">查看</el-button>
+                </el-form-item>
+                <el-form-item label="客户类别" prop="customertype">
+                    <el-select v-model="formData.customertype" :placeholder="t('common.pleasechoice')">
+                        <el-option v-for="item in getCustomerTypeList()" :key="item.value" :label="item.label"
+                        :value="item.value" />
+                    </el-select>
+                </el-form-item>
+            </fieldset>
+        </el-form>
+        <template #footer>
+            <el-button @click="onCancel(false)">{{ t('operation.cancel') }}</el-button>
+            <el-button type="primary" @click="onSubmit">{{ t('operation.save') }}</el-button>
+        </template>
+        <component ref="componentRef" v-bind="{ record }" :is="componentMap.get(componentId)" @closed="closeComponent" v-if="componentId" />
     </app-drawer>
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, PropType, defineAsyncComponent } from 'vue'
+import { shallowRef, PropType, ref, defineAsyncComponent, onMounted } from 'vue'
+import { ElMessage, FormInstance, FormRules } from 'element-plus'
+import { useComponent } from '@/hooks/component'
 import { i18n } from '@/stores'
+import { roleadd } from '@/services/api/member'
+import AppSelectMember from '@pc/components/modules/select-member/index.vue'
 import AppDrawer from '@pc/components/base/drawer/index.vue'
+import { getCustomerTypeList } from '@/constants/member'
 
-const { global: { t } } = i18n
+const props = defineProps({
+    record: {
+        type: Object as PropType<Member.OrganRoleRsp>
+    }
+})
+
+const componentMap = new Map<string, unknown>([
+    ['Roles', defineAsyncComponent(() => import('@pc/components/modules/roles/index.vue'))], // 角色权限信息
+])
+const { componentRef, componentId, openComponent, closeComponent } = useComponent()
 
+const { global: { t } } = i18n
+const formRef = ref<FormInstance>()
 const show = shallowRef(true)
 const refresh = shallowRef(false)
 const loading = shallowRef(false)
+
+const formData = ref<Partial<Member.RoleAddReq>>({
+    roleid: 8
+})
+
+// 表单验证规则
+const formRules: FormRules = {
+    userid: [{ required: true }]
+}
+
+const onSubmit = () => {
+    const rawData = { ...formData.value }
+    formRef.value?.validate((valid) => {
+        if (valid) {
+            loading.value = true
+            roleadd({
+                data: rawData
+            }).then(() => {
+                ElMessage.success(t('common.tips3'))
+                onCancel(true)
+            }).catch((err) => {
+                ElMessage.error(t('common.tips4') + err)
+            }).finally(() => {
+                loading.value = false
+            })
+        }
+    })
+}
+
+const onCancel = (isRefresh = false) => {
+    show.value = false
+    refresh.value = isRefresh
+}
+
+onMounted(() => {
+    const { userid, } = props.record ?? {}
+    if (userid) {
+        formData.value.userid = userid
+    }
+})
 </script>

+ 74 - 4
src/packages/pc/views/member/institution/operation/components/edit/index.vue

@@ -1,18 +1,88 @@
 <!-- 会员机构管理-机构管理-运营机构管理-新增 -->
 <template>
-    <app-drawer title="新增" width="900" v-model:show="show" :loading="loading" :refresh="refresh">
-        
+    <app-drawer title="编辑" width="900" v-model:show="show" :loading="loading" :refresh="refresh">
+        <el-form ref="formRef" label-width="140px" :model="formData" :rules="formRules" :show-message="false">
+            <fieldset class="g-fieldset el-form--horizontal">
+                <legend class="g-fieldset__legend">机构</legend>
+                <el-form-item label="机构" prop="userid">
+                    <app-select-member v-model="formData.userid" />
+                </el-form-item>
+                <el-form-item label="角色权限信息:" prop="userid" >
+                    <el-button @click="openComponent('Roles')">查看</el-button>
+                </el-form-item>
+            </fieldset>
+        </el-form>
+        <template #footer>
+            <el-button @click="onCancel(false)">{{ t('operation.cancel') }}</el-button>
+            <el-button type="primary" @click="onSubmit">{{ t('operation.save') }}</el-button>
+        </template>
+        <component ref="componentRef" v-bind="{ record }" :is="componentMap.get(componentId)" @closed="closeComponent" v-if="componentId" />
     </app-drawer>
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, PropType, defineAsyncComponent } from 'vue'
+import { shallowRef, PropType, ref, defineAsyncComponent, onMounted } from 'vue'
+import { ElMessage, FormInstance, FormRules } from 'element-plus'
+import { useComponent } from '@/hooks/component'
 import { i18n } from '@/stores'
+import { roleadd } from '@/services/api/member'
+import AppSelectMember from '@pc/components/modules/select-member/index.vue'
 import AppDrawer from '@pc/components/base/drawer/index.vue'
 
-const { global: { t } } = i18n
+const props = defineProps({
+    record: {
+        type: Object as PropType<Member.OrganRoleRsp>
+    }
+})
+
+const componentMap = new Map<string, unknown>([
+    ['Roles', defineAsyncComponent(() => import('@pc/components/modules/roles/index.vue'))], // 角色权限信息
+])
+const { componentRef, componentId, openComponent, closeComponent } = useComponent()
 
+const { global: { t } } = i18n
+const formRef = ref<FormInstance>()
 const show = shallowRef(true)
 const refresh = shallowRef(false)
 const loading = shallowRef(false)
+
+const formData = ref<Partial<Member.RoleAddReq>>({
+    roleid: 2
+})
+
+// 表单验证规则
+const formRules: FormRules = {
+    userid: [{ required: true }]
+}
+
+const onSubmit = () => {
+    const rawData = { ...formData.value }
+    formRef.value?.validate((valid) => {
+        if (valid) {
+            loading.value = true
+            roleadd({
+                data: rawData
+            }).then(() => {
+                ElMessage.success(t('common.tips3'))
+                onCancel(true)
+            }).catch((err) => {
+                ElMessage.error(t('common.tips4') + err)
+            }).finally(() => {
+                loading.value = false
+            })
+        }
+    })
+}
+
+const onCancel = (isRefresh = false) => {
+    show.value = false
+    refresh.value = isRefresh
+}
+
+onMounted(() => {
+    const { userid, } = props.record ?? {}
+    if (userid) {
+        formData.value.userid = userid
+    }
+})
 </script>

+ 74 - 3
src/packages/pc/views/member/institution/operation/components/modify/index.vue

@@ -1,17 +1,88 @@
 <!-- 会员机构管理-机构管理-运营机构管理-修改 -->
 <template>
-    <app-drawer title="修改" width="900" v-model:show="show" :loading="loading" :refresh="refresh">
+    <app-drawer title="编辑" width="900" v-model:show="show" :loading="loading" :refresh="refresh">
+        <el-form ref="formRef" label-width="140px" :model="formData" :rules="formRules" :show-message="false">
+            <fieldset class="g-fieldset el-form--horizontal">
+                <legend class="g-fieldset__legend">机构</legend>
+                <el-form-item label="机构" prop="userid">
+                    <app-select-member v-model="formData.userid" />
+                </el-form-item>
+                <el-form-item label="角色权限信息:" prop="userid" >
+                    <el-button @click="openComponent('Roles')">查看</el-button>
+                </el-form-item>
+            </fieldset>
+        </el-form>
+        <template #footer>
+            <el-button @click="onCancel(false)">{{ t('operation.cancel') }}</el-button>
+            <el-button type="primary" @click="onSubmit">{{ t('operation.save') }}</el-button>
+        </template>
+        <component ref="componentRef" v-bind="{ record }" :is="componentMap.get(componentId)" @closed="closeComponent" v-if="componentId" />
     </app-drawer>
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, PropType, defineAsyncComponent } from 'vue'
+import { shallowRef, PropType, ref, defineAsyncComponent, onMounted } from 'vue'
+import { ElMessage, FormInstance, FormRules } from 'element-plus'
+import { useComponent } from '@/hooks/component'
 import { i18n } from '@/stores'
+import { roleadd } from '@/services/api/member'
+import AppSelectMember from '@pc/components/modules/select-member/index.vue'
 import AppDrawer from '@pc/components/base/drawer/index.vue'
 
-const { global: { t } } = i18n
+const props = defineProps({
+    record: {
+        type: Object as PropType<Member.OrganRoleRsp>
+    }
+})
+
+const componentMap = new Map<string, unknown>([
+    ['Roles', defineAsyncComponent(() => import('@pc/components/modules/roles/index.vue'))], // 角色权限信息
+])
+const { componentRef, componentId, openComponent, closeComponent } = useComponent()
 
+const { global: { t } } = i18n
+const formRef = ref<FormInstance>()
 const show = shallowRef(true)
 const refresh = shallowRef(false)
 const loading = shallowRef(false)
+
+const formData = ref<Partial<Member.RoleAddReq>>({
+    roleid: 2
+})
+
+// 表单验证规则
+const formRules: FormRules = {
+    userid: [{ required: true }]
+}
+
+const onSubmit = () => {
+    const rawData = { ...formData.value }
+    formRef.value?.validate((valid) => {
+        if (valid) {
+            loading.value = true
+            roleadd({
+                data: rawData
+            }).then(() => {
+                ElMessage.success(t('common.tips3'))
+                onCancel(true)
+            }).catch((err) => {
+                ElMessage.error(t('common.tips4') + err)
+            }).finally(() => {
+                loading.value = false
+            })
+        }
+    })
+}
+
+const onCancel = (isRefresh = false) => {
+    show.value = false
+    refresh.value = isRefresh
+}
+
+onMounted(() => {
+    const { userid, } = props.record ?? {}
+    if (userid) {
+        formData.value.userid = userid
+    }
+})
 </script>

+ 74 - 3
src/packages/pc/views/member/institution/self/components/edit/index.vue

@@ -1,17 +1,88 @@
 <!-- 会员机构管理-机构管理-自营会员管理-修改/新增 -->
 <template>
-    <app-drawer title="修改/新增" width="900" v-model:show="show" :loading="loading" :refresh="refresh">
+    <app-drawer title="编辑" width="900" v-model:show="show" :loading="loading" :refresh="refresh">
+        <el-form ref="formRef" label-width="140px" :model="formData" :rules="formRules" :show-message="false">
+            <fieldset class="g-fieldset el-form--horizontal">
+                <legend class="g-fieldset__legend">机构</legend>
+                <el-form-item label="机构" prop="userid">
+                    <app-select-member v-model="formData.userid" />
+                </el-form-item>
+                <el-form-item label="角色权限信息:" prop="userid" >
+                    <el-button @click="openComponent('Roles')">查看</el-button>
+                </el-form-item>
+            </fieldset>
+        </el-form>
+        <template #footer>
+            <el-button @click="onCancel(false)">{{ t('operation.cancel') }}</el-button>
+            <el-button type="primary" @click="onSubmit">{{ t('operation.save') }}</el-button>
+        </template>
+        <component ref="componentRef" v-bind="{ record }" :is="componentMap.get(componentId)" @closed="closeComponent" v-if="componentId" />
     </app-drawer>
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, PropType, defineAsyncComponent } from 'vue'
+import { shallowRef, PropType, ref, onMounted, defineAsyncComponent } from 'vue'
+import { ElMessage, FormInstance, FormRules } from 'element-plus'
 import { i18n } from '@/stores'
+import { useComponent } from '@/hooks/component'
+import { roleadd } from '@/services/api/member'
+import AppSelectMember from '@pc/components/modules/select-member/index.vue'
 import AppDrawer from '@pc/components/base/drawer/index.vue'
 
-const { global: { t } } = i18n
+const props = defineProps({
+    record: {
+        type: Object as PropType<Member.OrganRoleRsp>
+    }
+})
+
+const componentMap = new Map<string, unknown>([
+    ['Roles', defineAsyncComponent(() => import('@pc/components/modules/roles/index.vue'))], // 角色权限信息
+])
+const { componentRef, componentId, openComponent, closeComponent } = useComponent()
 
+const { global: { t } } = i18n
+const formRef = ref<FormInstance>()
 const show = shallowRef(true)
 const refresh = shallowRef(false)
 const loading = shallowRef(false)
+
+const formData = ref<Partial<Member.RoleAddReq>>({
+    roleid: 6
+})
+
+// 表单验证规则
+const formRules: FormRules = {
+    userid: [{ required: true }]
+}
+
+const onSubmit = () => {
+    const rawData = { ...formData.value }
+    formRef.value?.validate((valid) => {
+        if (valid) {
+            loading.value = true
+            roleadd({
+                data: rawData
+            }).then(() => {
+                ElMessage.success(t('common.tips3'))
+                onCancel(true)
+            }).catch((err) => {
+                ElMessage.error(t('common.tips4') + err)
+            }).finally(() => {
+                loading.value = false
+            })
+        }
+    })
+}
+
+const onCancel = (isRefresh = false) => {
+    show.value = false
+    refresh.value = isRefresh
+}
+
+onMounted(() => {
+    const { userid, } = props.record ?? {}
+    if (userid) {
+        formData.value.userid = userid
+    }
+})
 </script>