|
|
@@ -0,0 +1,172 @@
|
|
|
+<!-- 账号管理-资金账户管理-编辑 -->
|
|
|
+<template>
|
|
|
+ <app-drawer title="编辑" width="900" v-model:show="show" :refresh="refresh" :loading="loading">
|
|
|
+ <el-form ref="formRef" class="el-form--horizontal" label-width="180px" :model="formData" :show-message="false">
|
|
|
+ <el-form-item label="资金账户">
|
|
|
+ <span>{{ record.accountId }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="账户类型" v-if="record.isMain === 1">
|
|
|
+ <span>{{ mainaccounttypeEnum.getEnumTypeName(record.isMain) }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ <template v-else>
|
|
|
+ <el-form-item label="所属母账户">
|
|
|
+ <span>{{ record.parentAccountId }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-if="data && data.selfFlag === 1">
|
|
|
+ <template v-if="!data.cannotEdit">
|
|
|
+ <el-form-item class="el-form-item--row" label="市场权限">
|
|
|
+ <el-table ref="tableRef" :data="formData.dtype" @selection-change="handleSelectionChange"
|
|
|
+ border>
|
|
|
+ <el-table-column type="selection" width="55" />
|
|
|
+ <el-table-column prop="marketName" label="市场" />
|
|
|
+ <el-table-column prop="tradeMode" label="买大厅权限"
|
|
|
+ v-if="multipleSelection.some((e) => e.tradeProperty === 4 || e.tradeMode === 79)">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <span v-if="row.tradeMode === 79">买大厅权限:可挂</span>
|
|
|
+ <template v-else-if="row.tradeMode === 17 && row.tradeProperty === 4">
|
|
|
+ <el-select v-model="row.dtype">
|
|
|
+ <template v-for="(value, key) in data.marketbstype" :key="key">
|
|
|
+ <el-option :label="value" :value="Number(key)" />
|
|
|
+ </template>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ {{ handleNoneValue() }}
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="tradeMode" label="卖大厅权限"
|
|
|
+ v-if="multipleSelection.some((e) => e.tradeProperty === 4 || [77, 78].includes(e.tradeMode))">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <span v-if="[77, 78].includes(row.tradeMode)">卖大厅权限:可挂</span>
|
|
|
+ <template v-else-if="row.tradeProperty === 4">
|
|
|
+ <el-select v-model="row.spotRightType">
|
|
|
+ <template v-for="(value, key) in data.marketbstype" :key="key">
|
|
|
+ <el-option :label="value" :value="Number(key)" />
|
|
|
+ </template>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ {{ handleNoneValue() }}
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <el-form-item class="el-form-item--row" label="授权登录账户(交易员)">
|
|
|
+ <!-- <el-checkbox-group v-model="formData.loginIds">
|
|
|
+ <template v-for="value in data.loginaccount" :key="value">
|
|
|
+ <el-checkbox :label="value" :value="value" />
|
|
|
+ </template>
|
|
|
+ </el-checkbox-group> -->
|
|
|
+ {{ handleNoneValue(data.loginaccount.join(',')) }}
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item class="el-form-item--row" label="默认授权登录账户">
|
|
|
+ {{ handleNoneValue(data.defaultloginaccount.join(',')) }}
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="onCancel(false)">{{ t('operation.close') }}</el-button>
|
|
|
+ <el-button type="primary" @click="onSubmit">{{ t('operation.submit') }}</el-button>
|
|
|
+ </template>
|
|
|
+ </app-drawer>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup>
|
|
|
+import { ref, reactive, PropType, toRaw, nextTick } from 'vue'
|
|
|
+import { ElMessage, FormInstance, TableInstance } from 'element-plus'
|
|
|
+import { handleNoneValue } from '@/filters'
|
|
|
+import { useEnum } from '@/hooks/enum'
|
|
|
+import { useRequest } from '@/hooks/request'
|
|
|
+import { updateTaAccountInit, updateTaAccount, queryTaAccountDetail } from '@/services/api/account'
|
|
|
+import { i18n } from '@/stores'
|
|
|
+import AppDrawer from '@pc/components/base/drawer/index.vue'
|
|
|
+
|
|
|
+const props = defineProps({
|
|
|
+ record: {
|
|
|
+ type: Object as PropType<Model.TaAccountRsp>,
|
|
|
+ required: true
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const mainaccounttypeEnum = useEnum('mainaccounttype') // 账户类型
|
|
|
+
|
|
|
+const t = i18n.global.t
|
|
|
+const tableRef = ref<TableInstance>()
|
|
|
+const formRef = ref<FormInstance>()
|
|
|
+const show = ref(true)
|
|
|
+const refresh = ref(false)
|
|
|
+const multipleSelection = ref<Model.UpdateTaAccountReq['dtype']>([]) // 已选中的市场数据
|
|
|
+
|
|
|
+const formData = reactive<Partial<Model.UpdateTaAccountReq>>({
|
|
|
+ dtype: [],
|
|
|
+ loginIds: []
|
|
|
+})
|
|
|
+
|
|
|
+const { data } = useRequest(updateTaAccountInit, {
|
|
|
+ params: {
|
|
|
+ accountId: props.record.accountId
|
|
|
+ },
|
|
|
+ onSuccess: (res) => {
|
|
|
+ formData.dtype = Object.values(res.data.clildmarkets)
|
|
|
+ // 初始化已选中的市场
|
|
|
+ nextTick(() => {
|
|
|
+ formData.dtype?.forEach((e) => {
|
|
|
+ if (e.checked) {
|
|
|
+ tableRef.value?.toggleRowSelection(e)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const { loading } = useRequest(queryTaAccountDetail, {
|
|
|
+ params: {
|
|
|
+ accountId: props.record.accountId
|
|
|
+ },
|
|
|
+ onSuccess: (res) => {
|
|
|
+ const data = res.data
|
|
|
+ formData.accountId = data.accountId
|
|
|
+ formData.loginIds = data.loginIds
|
|
|
+ formData.relatedaccountstatus = data.relatedAccountStatus
|
|
|
+ formData.relateduserid = data.relatedUserId
|
|
|
+ formData.userid = data.userId
|
|
|
+ },
|
|
|
+ onError: (err) => {
|
|
|
+ ElMessage.error(err)
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const handleSelectionChange = (selection: Model.UpdateTaAccountReq['dtype']) => {
|
|
|
+ multipleSelection.value = selection
|
|
|
+}
|
|
|
+
|
|
|
+const onCancel = (isRefresh = false) => {
|
|
|
+ show.value = false
|
|
|
+ refresh.value = isRefresh
|
|
|
+}
|
|
|
+
|
|
|
+const onSubmit = () => {
|
|
|
+ formRef.value?.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ loading.value = true
|
|
|
+ const rawData = toRaw(formData)
|
|
|
+ rawData.dtype = multipleSelection.value
|
|
|
+
|
|
|
+ updateTaAccount({
|
|
|
+ data: rawData
|
|
|
+ }).then(() => {
|
|
|
+ ElMessage.success(t('common.tips3'))
|
|
|
+ onCancel(true)
|
|
|
+ }).catch((err) => {
|
|
|
+ ElMessage.error(t('common.tips4') + err)
|
|
|
+ }).finally(() => {
|
|
|
+ loading.value = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+</script>
|