Handy_Cao 7 ヶ月 前
コミット
409d0bc23a

+ 85 - 0
src/packages/pc/components/modules/roles/index.vue

@@ -0,0 +1,85 @@
+<template>
+    <app-drawer :title="t('admin.role.edit.title')" width="680" v-model:show="show" :loading="loading">
+        <app-table-details :data="data" :label-width="120" :cell-props="detailProps" :column="1">
+            <template #sensitivefields>
+                {{ getSensitiveWords() }}
+            </template>
+            <template #menuids>
+                <el-scrollbar max-height="300px" style="width: 100%; border: 1px solid #f2f2f2;">
+                    <el-tree :data="filteredRoutes" :props="{ label: (data: Model.MenusRsp)=> t('routes.'+data.resourceCode) }" node-key="resourceCode" />
+                </el-scrollbar>
+            </template>
+        </app-table-details>
+        <template #footer>
+            <el-button @click="onCancel">{{ t('operation.cancel') }}</el-button>
+        </template>
+    </app-drawer>
+</template>
+
+<script lang="ts" setup>
+import { ref, PropType } from 'vue'
+import { ElMessage } from 'element-plus'
+import { handleNoneValue } from '@/filters'
+import { useRequest } from '@/hooks/request'
+import { queryDetail } from '@/services/api/admin'
+import { useRouterStore, i18n } from '@/stores'
+import { CellProp } from '@pc/components/base/table-details/types'
+import AppDrawer from '@pc/components/base/drawer/index.vue'
+import AppTableDetails from '@pc/components/base/table-details/index.vue'
+
+const props = defineProps({
+    record: {
+        type: Object as PropType<Member.OrganRoleRsp>,
+        required: true
+    }
+})
+
+const { global: { t } } = i18n
+const routerStore = useRouterStore()
+const filteredRoutes = ref<Model.MenusRsp[]>([])
+const show = ref(true)
+
+const getSensitiveWords = () => {
+    const options = [
+        { label: t('admin.role.edit.mobilephone'), value: 1 },
+        { label: t('admin.role.edit.cardtypeid'), value: 2 },
+        { label: t('admin.role.edit.email'), value: 3 }
+    ]
+    const checkedValues = data.value?.sensitivefields.split(',') ?? []
+    const selectedOptions = options.filter((e) => checkedValues.includes(e.value.toString()))
+    const label = selectedOptions.map((e) => e.label).join(',')
+    return handleNoneValue(label)
+}
+
+const { data, loading } = useRequest(queryDetail, {
+    params: {
+        autoId: props.record.userid
+    },
+    onSuccess: (res) => {
+        const codeSet = new Set(res.data.menuids)
+        // 递归过滤菜单
+        filteredRoutes.value = routerStore.userRoutes.filter(menu => {
+            if (codeSet.has(menu.resourceCode)) {
+                return true
+            }
+            if (menu.children && menu.children.length) {
+                return menu.children.some(child => codeSet.has(child.resourceCode))
+            }
+            return false
+        })
+    },
+    onError: (err) => {
+        ElMessage.error(err)
+    }
+})
+
+const detailProps: CellProp[] = [
+    { prop: 'rolename', label: t('admin.role.edit.rolename') },
+    { prop: 'sensitivefields', label: t('admin.role.edit.sensitivefields') },
+    { prop: 'menuids', label: t('admin.role.edit.menuids') },
+]
+
+const onCancel = () => {
+    show.value = false
+}
+</script>

+ 81 - 3
src/packages/pc/views/member/institution/industry/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>
+            </fieldset>
+            <fieldset class="g-fieldset el-form--horizontal">
+                <legend class="g-fieldset__legend">权限信息</legend>
+                会员市场:
+            </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, onMounted, ref, 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 AppDrawer from '@pc/components/base/drawer/index.vue'
+import AppSelectMember from '@pc/components/modules/select-member/index.vue'
 
 const { global: { t } } = i18n
-
+const formRef = ref<FormInstance>()
 const show = shallowRef(true)
 const refresh = shallowRef(false)
 const loading = shallowRef(false)
+
+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 formData = ref<Partial<Member.RoleAddReq>>({
+    roleid: 9
+})
+
+// 表单验证规则
+const formRules: FormRules = {
+    userid: [{ required: true }],
+    marketid: [{ required: true }],
+    goodsid: [{ 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/marketing/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, 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: 3
+})
+
+// 表单验证规则
+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>

+ 1 - 1
src/packages/pc/views/member/institution/self/index.vue

@@ -43,7 +43,7 @@ const { global: { t } } = i18n
 // 状态
 const areastatusEnum = useEnum('areastatus')
 
-const { componentMap, componentId, record, openComponent, closeComponent, getActionButtons } = useOperation<Member.OrganRoleReq>({
+const { componentMap, componentId, record, openComponent, closeComponent, getActionButtons } = useOperation<Member.OrganRoleRsp>({
     onClose: () => onSearch()
 })
 

+ 0 - 13
src/packages/pc/views/member/institution/warehouse/components/details/index.vue

@@ -2,9 +2,6 @@
 <template>
     <app-drawer :title="t('member.institution.warehouse.details.title')" width="900" v-model:show="show" :loading="loading" :refresh="refresh">
         <app-table-details :title="t('member.institution.warehouse.details.subtitle')" :data="data?.organ" :label-width="160" :cell-props="detailProps1" :column="2" />
-        <!-- <app-table-details title="" :data="goodslimit" :label-width="160" :cell-props="detailProps2" :column="1">
-            
-        </app-table-details> -->
         <span>
             <span>{{ t('member.institution.warehouse.details.subtitle2') }}</span>
             <span v-for="item in warehouse" v-bind:key="item.id">
@@ -70,16 +67,6 @@ const warehouse = computed(() => {
     }) ?? []
 })
 
-// const detailProps2 = computed(() => {
-//     return data.value?.markets.map<CellProp>(e =>({ 
-//         prop: e.marketid.toString(), 
-//         label: e.marketname,
-//         formatValue: (val) => {
-//             return data.value?.operategoodsinfo.filter(e => e.marketid === val).map(e => e.goodsname).join(',')
-//         },
-//      }) ) ?? []
-// }) 
-
 const onCancel = (isRefresh = false) => {
     show.value = false
     refresh.value = isRefresh

+ 74 - 2
src/packages/pc/views/member/institution/warehouse/components/edit/index.vue

@@ -1,17 +1,89 @@
 <!-- 会员机构管理-机构管理-仓库机构管理-修改/新增 -->
 <template>
     <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, defineAsyncComponent, ref, onMounted } 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.MemberGoodsLimitRsp>
+    }
+})
+
+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: 4
+})
+
+// 表单验证规则
+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>

+ 1 - 1
src/packages/pc/views/member/institution/warehouse/index.vue

@@ -43,7 +43,7 @@ const { global: { t } } = i18n
 // 状态
 const areastatusEnum = useEnum('areastatus')
 
-const { componentMap, componentId, record, openComponent, closeComponent, getActionButtons } = useOperation<Member.OrganRoleReq>({
+const { componentMap, componentId, record, openComponent, closeComponent, getActionButtons } = useOperation<Member.OrganRoleRsp>({
     onClose: () => onSearch()
 })
 

+ 7 - 0
src/services/api/member/index.ts

@@ -391,4 +391,11 @@ export function createTree(options: CommonFetchOptions<{ response: Member.Create
  */
 export function OrganDetailTradeConfigView(options: CommonFetchOptions<{ request: Member.TradeConfigViewReq; response: Member.TradeConfigViewRsp; }>) {
     return httpClient.commonRequest('/organDetail/tradeConfigView', 'get', options)
+}
+
+/**
+ * 会员机构管理-->机构管理-->新增、修改
+ */
+export function roleadd(options: CommonFetchOptions<{ request: Member.RoleAddReq; }>) {
+    return httpClient.commonRequest('/organDetail/roleadd', 'post', options)
 }

+ 59 - 0
src/types/model/member.d.ts

@@ -2085,4 +2085,63 @@ declare namespace Member {
         tradetype: number; // 交易类型[交易费用] - 1:投资者自营 2:做市
         userid: number; // 用户ID
     }
+
+    /** 会员机构管理-->机构管理-->新增、修改 */
+    interface RoleAddReq {
+        accountid?: number;
+        accountids?: number[]; // 出金阈值
+        customertype?: number; // 做市客户类别
+        dtype?: TaAccountMarketVo[]; // 市场权限 及对应交易类型
+        enumdicnames?: number[]
+        fee?: Arearoledivideconfig[] // 分润配置
+        goodsids?: number[] // 商品ID集合
+        marketids?: number[] // 市场ID集合
+        marketings?: string // 做市机构ID集合
+        outuserid?: string
+        parentuserid?: number
+        pfee?: Arearoledivideconfig[] // 分润配置 个性化
+        roleid?: number
+        shoppassword?: string
+        sjaccountno?: string
+        transurl?: string
+        type?: number // 1新增 2修改
+        userid?: number
+    }
+
+    interface TaAccountMarketVo {
+        checked?: number
+        dtype?: number
+        fdType?: number
+        fspotRightType?: number
+        marketId?: number
+        marketName?: string
+        spotRightType?: number // code:marketbstype
+        tradeMode?: number
+        tradeProperty?: number
+    }
+
+    interface Arearoledivideconfig { 
+        // 创建时间
+        createtime?: string
+        // 创建人ID
+        creatorid?: number
+        // 分润值
+        dividevalue?: number
+        // 费用算法 1:比率 2:固定
+        feealgorithm?: number
+        // 商品ID(此项为0时,为通用设置)
+        goodsid?: number
+        // 市场ID(此项为0时,为通用设置)
+        marketid?: number
+        // 修改人ID
+        modifierid?: number
+        // 修改时间
+        modifytime?: string
+        // 角色类型 - 1:交易所 2:运营机构 3:营销中心 4:仓库机构 5:三方服务机构 6:自营会员 7:纪经会员 8:做市会员 9:产业会员 10:金融机构
+        roletype?: number
+        // 费用类型 - 101建仓(买)手续费 102平仓(卖)手续费 103买递延费(仓储费) 104卖递延费 105买交割手续费 106 卖交割手续费 107 调期费
+        tradefeeid?: number
+        // 机构用户ID 其他做市关系,都设置为 1
+        userid?: number
+    }
 }