|
|
@@ -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) => ({
|