Handy_Cao пре 7 месеци
родитељ
комит
d2106d5063

+ 28 - 6
src/packages/pc/views/member/institution/marketer/components/edit/index.vue

@@ -21,9 +21,13 @@
             </fieldset>
             <fieldset class="g-fieldset el-form--horizontal">
                 <legend class="g-fieldset__legend">默认做市商资金账户</legend>
-                <!-- <template v-for="item in talist" :key="item.accountid"> -->
-                    <!-- <el-form-item label="币种" prop="userid">{{ item.currency }}</el-form-item> -->
-                <!-- </template> -->
+                <el-form-item label="币种" prop="currency">{{ currency }}</el-form-item>
+                <el-form-item label="资金账户" prop="accountid">
+                    <el-select v-model="formData.accountid" :placeholder="t('common.pleasechoice')" @change="onTaAccount">
+                        <el-option v-for="item in talist" :key="item.accountId" :label="item.accountId"
+                        :value="item.accountId" />
+                    </el-select>
+                </el-form-item>
             </fieldset>
             <fieldset class="g-fieldset el-form--horizontal">
                 <legend class="g-fieldset__legend">风险率信息</legend>
@@ -73,9 +77,10 @@ const formRef = ref<FormInstance>()
 const show = shallowRef(true)
 const refresh = shallowRef(false)
 const organSelect = ref<Model.OrganSelectRsp>()
+const currency = ref('')
 
 const formData = ref<Partial<Member.RoleAddReq>>({
-    roleid: 8
+    roleid: 8,
 })
 
 const { data, loading } = useRequest(initAdd, {
@@ -97,11 +102,17 @@ const { data: manger, run: runDefaultManager } = useRequest(getOragnDefaultManag
     }
 })
 
-const { data: talist, run: runTAAccountList } = useRequest(queryTAAccountList, {
+const { dataList: talist, run: runTAAccountList } = useRequest(queryTAAccountList, {
     manual: true,
     params: {
         userId: formData?.value.userid
     },
+    onSuccess: (res) => {
+        if (res.data.length != 0) {
+            formData.value.accountid = res.data[0].accountId
+            currency.value = res.data[0].currency
+        }
+    },
     onError: (err) => {
         ElMessage.error(err)
     }
@@ -119,10 +130,17 @@ const { data: marker, run } = useRequest(getRiskRatioTypeForMarketer, {
 
 // 表单验证规则
 const formRules: FormRules = {
-    userid: [{ required: true }]
+    userid: [{ required: true }],
+    customertype: [{ required: true }]
 }
 
 const onSubmit = () => {
+    formData.value.enumdicnames = [1]
+    const { accountid } = formData.value
+    if (accountid) {
+        formData.value.accountids = [accountid]
+    }
+    formData.value.type = props.record ? 2 : 1
     const rawData = { ...formData.value }
     formRef.value?.validate((valid) => {
         if (valid) {
@@ -160,6 +178,10 @@ const detailProps3 = computed<CellProp[]>(() => {
     ]
 })
 
+const onTaAccount = (accountid: number) => {
+    currency.value = talist.value.find(e => e.accountId === accountid)?.currency ?? ''
+}
+
 const onMemberChange = (item?: Model.OrganSelectRsp) => {
     organSelect.value = item