li.shaoyi 3 роки тому
батько
коміт
00f4016789

+ 15 - 9
src/views/hedgeditem/spot/contract/components/bind/form.ts

@@ -16,6 +16,7 @@ export function useForm(selectedRow: UnLinkSpotContractRsp) {
     const { tableList, queryTable } = queryTableList<Ermcp8EnableHedgeditemRsp>(true, 2); // 表格列表数据
     const loading = ref<boolean>(false);
     const selectedRowKeys = ref<number[]>([]); // 表格选中的 rowKey 数据 :rowKey="(record,index)=>index"
+    const isFixed = selectedRow.pricetype === PriceType.Fixed; // 是否一口价
 
     // 计算当前关联数量
     const currentQty = computed(() => {
@@ -30,7 +31,7 @@ export function useForm(selectedRow: UnLinkSpotContractRsp) {
     // 自定义表格选择项
     const rowSelection = computed(() => ({
         columnTitle: '选择',
-        type: selectedRow.pricetype === PriceType.Fixed ? 'checkbox' : 'radio',
+        type: isFixed ? 'checkbox' : 'radio',
         selectedRowKeys: selectedRowKeys.value,
         onChange: (keys: number[]) => {
             selectedRowKeys.value = keys;
@@ -39,6 +40,8 @@ export function useForm(selectedRow: UnLinkSpotContractRsp) {
             if (!selected) {
                 // 未选中的取消关联量
                 record.relatedqty = undefined;
+            } else if (!isFixed) {
+                record.relatedqty = selectedRow.qty;
             }
         },
     }))
@@ -71,14 +74,17 @@ export function useForm(selectedRow: UnLinkSpotContractRsp) {
     // 表格列
     const columns = computed(() => {
         const result = composeTable.columns.value;
-        result.push({
-            title: '关联量',
-            align: 'center',
-            key: 'relatedqty',
-            slots: {
-                customRender: 'relatedqty'
-            }
-        })
+        // 一口价才有关联量
+        if (isFixed) {
+            result.push({
+                title: '关联量',
+                align: 'center',
+                key: 'relatedqty',
+                slots: {
+                    customRender: 'relatedqty'
+                }
+            })
+        }
         // result.forEach((e) => {
         //     // 高亮选中的行
         //     e.customCell = (record, index) => ({

+ 2 - 2
src/views/information/spot-contract/components/detail/index.vue

@@ -1,9 +1,9 @@
 <template>
   <!-- 现货合同详情-->
   <a-modal class="add-custom custom-detail" title="现货合同详情" v-model:visible="visible" centered :maskClosable="false"
-    @cancel="cancel" width="890px">
+    @cancel="cancel(false)" width="890px">
     <template #footer>
-      <a-button key="submit" type="primary" :loading="loading" @click="cancel">关闭</a-button>
+      <a-button key="submit" type="primary" :loading="loading" @click="cancel(false)">关闭</a-button>
     </template>
     <a-tabs v-model:activeKey="activeKey" @change="tabClick">
       <a-tab-pane v-for="item in tabList" :key="item.key" :tab="item.name"></a-tab-pane>