li.shaoyi 4 лет назад
Родитель
Сommit
337fab5b9e

+ 1 - 0
src/common/components/capitalInfo/index.less

@@ -37,6 +37,7 @@
                 }
 
                 &:last-child {
+                    text-align  : right;
                     border-right: 0;
                 }
             }

+ 31 - 31
src/common/components/thirdMenu/index.vue

@@ -11,41 +11,41 @@
 import { defineComponent, ref, PropType } from 'vue';
 
 interface Key {
-    [propName: string]: string;
+  [propName: string]: string;
 }
 
 export default defineComponent({
-    name: 'third-menu',
-    emits: ['selectMenu'],
-    props: {
-        list: {
-            default: [],
-            type: Object as PropType<Key[]>,
-        },
-        value: {
-            // 需要绑定的值得 key
-            default: 'lable',
-            type: String,
-        },
-        selectedKey: {
-            default: '0',
-            type: String,
-        },
+  name: 'third-menu',
+  emits: ['selectMenu'],
+  props: {
+    list: {
+      default: [],
+      type: Object as PropType<Key[]>,
     },
-    components: {},
-    setup(props, context) {
-        const current = ref<string>(props.selectedKey.toString());
-
-        function menuClick(value: string) {
-            const index = +value;
-            const item = props.list[index];
-            context.emit('selectMenu', +value, item);
-        }
-        return {
-            current,
-            menuClick,
-        };
+    value: {
+      // 需要绑定的值得 key
+      default: 'lable',
+      type: String,
+    },
+    selectedKey: {
+      default: '0',
+      type: String,
     },
+  },
+  components: {},
+  setup(props, context) {
+    const current = ref<string>(props.selectedKey.toString());
+
+    function menuClick(value: string) {
+      const index = +value;
+      const item = props.list[index];
+      context.emit('selectMenu', +value, item);
+    }
+    return {
+      current,
+      menuClick,
+    };
+  },
 });
 </script>
 
@@ -56,7 +56,7 @@ export default defineComponent({
 .thirdMenu {
     width: 100%;
     height: 28px;
-    padding-bottom: 2px;
+    padding: 1px 0;
     background-color: @m-black5;
     z-index: 2;
     .ant-tabs {

+ 8 - 1
src/hooks/account/index.ts

@@ -167,7 +167,14 @@ function calcCapitalValue(account: Taaccount, positionList: TradePosition[]) {
     const positionProfitAndLoss = computed(() => positionList.reduce((res, item) => res + item.positionProfitAndLoss.value, 0));
 
     // 计算总市值
-    const marketCap = computed(() => positionList.reduce((res, item) => res + item.capitalization.value, 0));
+    const marketCap = computed(() => {
+        // 根据系统参数“087 风险净值是否加上市值 - 0:不加 1:加“
+        const flag = systemParams.find((e) => e.paramcode === '087')?.paramvalue === '1';
+        if (flag) {
+            return positionList.reduce((res, item) => res + item.capitalization.value, 0);
+        }
+        return 0;
+    });
 
     // 计算可用资金
     const availableBalance = computed(() => {

+ 1 - 0
src/services/bus/goods.ts

@@ -153,6 +153,7 @@ export function getGoodsQuoteList(exchangeId?: number): GoodsQuote[] {
 
     return goodsList.map((el) => {
         const item: GoodsQuote = {
+            goodsgroupid: el.goodsgroupid,
             goodsid: el.goodsid,
             goodscode: el.goodscode,
             goodsname: el.goodsname,

+ 1 - 0
src/services/go/ermcp/goodsInfo/interface.ts

@@ -326,6 +326,7 @@ export interface ErmcpMiddleGoodsChangeLog {
  * 商品行情
  */
 export interface GoodsQuote {
+    goodsgroupid: number;//所属商品组ID
     goodsid: number; // 商品ID
     goodscode: string; // 商品代码
     goodsname: string; // 商品名称

+ 2 - 0
src/views/business/plan/components/setup.ts

@@ -40,6 +40,8 @@ export function handleForm() {
         ContractType: [{ required: true, validator: v_ContractType, trigger: 'change' }],
         DeliveryGoodsID: [{ required: true, validator: v_DeliveryGoodsID, trigger: 'change' }],
         Currencyid: [{ required: true, validator: v_Currencyid, trigger: 'change' }],
+        WRStandardID: [{ required: true, message: '请选择商品', trigger: 'change', type: 'number' }],
+        Tradeuserid: [{ required: true, message: '请选择交易用户', trigger: 'change', type: 'number' }],
     }
     return { formRef, formState, rules }
 }

+ 97 - 95
src/views/business/spotmarket/components/modify/index.vue

@@ -1,49 +1,49 @@
 <template>
-    <!-- 现货参考价-修改-->
-    <a-modal class="add-custom custom-detail" title="修改现货参考价" v-model:visible="visible" centered :maskClosable="false" @cancel="cancel" width="890px">
-        <a-form class="inlineForm" ref="formRef" :model="formState" :rules="rules">
-            <fieldset class="formFieldSet">
-                <legend>现货市价信息</legend>
-                <a-row :gutter="24">
-                    <a-col :span="12">
-                        <a-form-item label="现货品种">
-                            <span class="white">{{ formatValue(selectedRow.deliverygoodsname) }}</span>
-                        </a-form-item>
-                    </a-col>
-                    <a-col :span="12">
-                        <a-form-item label="商品">
-                            <span class="white">{{ formatValue(selectedRow.wrstandardname) }}</span>
-                        </a-form-item>
-                    </a-col>
-                </a-row>
-                <a-row :gutter="24">
-                    <a-col :span="12">
-                        <a-form-item label="品牌">
-                            <span class="white">{{ formatValue(selectedRow.brandname) }}</span>
-                        </a-form-item>
-                    </a-col>
-                    <a-col :span="12">
-                        <a-form-item label="结算币种" name="CurrencyID">
-                            <a-select class="inlineFormSelect" style="width: 200px" placeholder="请选择结算币种" v-model:value="formState.CurrencyID">
-                                <a-select-option v-for="option in currencyList" :key="option.enumitemname" :value="option.enumitemname">{{ option.enumdicname }}</a-select-option>
-                            </a-select>
-                        </a-form-item>
-                    </a-col>
-                </a-row>
-                <a-row :gutter="24">
-                    <a-col :span="24">
-                        <a-form-item label="现货价格" name="SpotGoodsPrice">
-                            <a-input-number class="dialogInput" style="width: 200px" v-model:value="formState.SpotGoodsPrice" :min="0" placeholder="请输入现货价格" />
-                        </a-form-item>
-                    </a-col>
-                </a-row>
-            </fieldset>
-        </a-form>
-        <template #footer>
-            <a-button key="submit" type="primary" :loading="loading" @click="cancel">取消</a-button>
-            <a-button key="submit" type="primary" :loading="loading" @click="submit">提交</a-button>
-        </template>
-    </a-modal>
+  <!-- 现货参考价-修改-->
+  <a-modal class="add-custom custom-detail" title="修改现货参考价" v-model:visible="visible" centered :maskClosable="false" @cancel="cancel" width="890px">
+    <a-form class="inlineForm" ref="formRef" :model="formState" :rules="rules">
+      <fieldset class="formFieldSet">
+        <legend>现货市价信息</legend>
+        <a-row :gutter="24">
+          <a-col :span="12">
+            <a-form-item label="现货品种">
+              <span class="white">{{ formatValue(selectedRow.deliverygoodsname) }}</span>
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item label="商品">
+              <span class="white">{{ formatValue(selectedRow.wrstandardname) }}</span>
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="24">
+          <a-col :span="12">
+            <a-form-item label="品牌">
+              <span class="white">{{ formatValue(selectedRow.brandname) }}</span>
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item label="结算币种" name="CurrencyID">
+              <a-select class="inlineFormSelect" style="width: 200px" placeholder="请选择结算币种" v-model:value="formState.CurrencyID">
+                <a-select-option v-for="option in currencyList" :key="option.enumitemname" :value="option.enumitemname">{{ option.enumdicname }}</a-select-option>
+              </a-select>
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="24">
+          <a-col :span="24">
+            <a-form-item label="现货价格" name="SpotGoodsPrice">
+              <a-input-number class="dialogInput" style="width: 200px" v-model:value="formState.SpotGoodsPrice" :min="0" placeholder="请输入现货价格" />
+            </a-form-item>
+          </a-col>
+        </a-row>
+      </fieldset>
+    </a-form>
+    <template #footer>
+      <a-button key="submit" type="primary" :loading="loading" @click="cancel">取消</a-button>
+      <a-button key="submit" type="primary" :loading="loading" @click="submit">提交</a-button>
+    </template>
+  </a-modal>
 </template>
 
 <script lang="ts">
@@ -56,63 +56,65 @@ import { getPayCurrencyTypeEnumList } from '@/common/constants/enumsList';
 import { validateAction } from '@/common/setup/form';
 import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 import { ermcpSpotGoodsPrice } from '@/services/proto/delivery';
+import { geLoginID_number } from '@/services/bus/login';
+import moment from 'moment';
 
 export default defineComponent({
-    name: 'spotmarket_price_modify',
-    emits: ['cancel', 'update'],
-    props: {
-        selectedRow: {
-            type: Object as PropType<Ermcp3SpotGoodsPrice>,
-            default: {},
-        },
+  name: 'spotmarket_price_modify',
+  emits: ['cancel', 'update'],
+  props: {
+    selectedRow: {
+      type: Object as PropType<Ermcp3SpotGoodsPrice>,
+      default: {},
     },
-    setup(props, context) {
-        const { visible, cancel } = _closeModal(context);
-        const loading = ref<boolean>(false);
-        const formRef = ref();
+  },
+  setup(props, context) {
+    const { visible, cancel } = _closeModal(context);
+    const loading = ref<boolean>(false);
+    const formRef = ref();
 
-        // 选择币种列表
-        const currencyList = getPayCurrencyTypeEnumList();
+    // 选择币种列表
+    const currencyList = getPayCurrencyTypeEnumList();
 
-        const { deliverygoodsid, wrstandardid, spotgoodsbrandid, tradedate, currencyid, spotgoodsprice, operateid } = props.selectedRow;
-        const formState: UnwrapRef<ErmcpSpotGoodsPriceReq> = reactive({
-            DeliveryGoodsID: deliverygoodsid,
-            WRStandardID: wrstandardid,
-            SpotGoodsBrandID: spotgoodsbrandid,
-            CurrencyID: currencyid,
-            SpotGoodsPrice: spotgoodsprice,
-            TradeDate: tradedate,
-            OperateSrc: 2,
-            OperateID: operateid,
-            OperateType: 2,
-        });
+    const { deliverygoodsid, wrstandardid, spotgoodsbrandid, tradedate, currencyid, spotgoodsprice, operateid } = props.selectedRow;
+    const formState: UnwrapRef<ErmcpSpotGoodsPriceReq> = reactive({
+      DeliveryGoodsID: deliverygoodsid,
+      WRStandardID: wrstandardid,
+      SpotGoodsBrandID: spotgoodsbrandid,
+      CurrencyID: currencyid,
+      SpotGoodsPrice: spotgoodsprice,
+      TradeDate: moment(new Date()).format('YYYYMMDD'),
+      OperateSrc: 2,
+      OperateID: geLoginID_number()!,
+      OperateType: 2,
+    });
 
-        // 表单验证规则
-        const rules = {
-            CurrencyID: [{ required: true, message: '请选择结算币种', trigger: 'change', type: 'number' }],
-            SpotGoodsPrice: [{ required: true, message: '请输入现货价格', trigger: 'blur', type: 'number' }],
-        };
+    // 表单验证规则
+    const rules = {
+      CurrencyID: [{ required: true, message: '请选择结算币种', trigger: 'change', type: 'number' }],
+      SpotGoodsPrice: [{ required: true, message: '请输入现货价格', trigger: 'blur', type: 'number' }],
+    };
 
-        // 提交
-        function submit() {
-            validateAction<ErmcpSpotGoodsPriceReq>(formRef, formState).then((res) => {
-                requestResultLoadingAndInfo(ermcpSpotGoodsPrice, res, loading, ['修改现货参考价成功', '修改现货参考价失败']).then(() => {
-                    cancel(true);
-                });
-            });
-        }
+    // 提交
+    function submit() {
+      validateAction<ErmcpSpotGoodsPriceReq>(formRef, formState).then((res) => {
+        requestResultLoadingAndInfo(ermcpSpotGoodsPrice, res, loading, ['修改现货参考价成功', '修改现货参考价失败']).then(() => {
+          cancel(true);
+        });
+      });
+    }
 
-        return {
-            visible,
-            formRef,
-            cancel,
-            submit,
-            loading,
-            formatValue,
-            formState,
-            rules,
-            currencyList,
-        };
-    },
+    return {
+      visible,
+      formRef,
+      cancel,
+      submit,
+      loading,
+      formatValue,
+      formState,
+      rules,
+      currencyList,
+    };
+  },
 });
 </script>

+ 1 - 1
src/views/information/spot-contract/components/setup.ts

@@ -245,7 +245,7 @@ export function handleDeliveryGoods(formState: UnwrapRef<FormState>) {
     const deliveryGoodsList = ref<Ermcp3DeliveryGoodsDetail[]>([]);
 
     const request = GetDeliveryGoodsDetail().then((res) => {
-        deliveryGoodsList.value = res;
+        deliveryGoodsList.value = res.filter((item) => item.isvalid);
     }).catch(err => {
         message.error(err);
     })

+ 4 - 4
src/views/market/futures/compoments/futures-trade/index.vue

@@ -14,7 +14,7 @@
               </a-select>
             </a-form-item>
             <a-form-item label="合约">
-              <a-select class="inlineFormSelect" placeholder="请选择" :disabled="isHedging" :filterOption="filterOption" v-model:value="formData.GoodsID" @change="goodsChange" show-search>
+              <a-select class="inlineFormSelect" placeholder="请选择" :filterOption="filterOption" v-model:value="formData.GoodsID" @change="goodsChange" show-search>
                 <a-select-option v-for="item in goodsList" :value="item.goodsid" :key="item.goodsid">{{ item.goodsname }}</a-select-option>
               </a-select>
             </a-form-item>
@@ -101,14 +101,14 @@ export default defineComponent({
     const { visible, cancel } = _closeModal(context);
     // 是否套保交易 (根据参数 spotcontractid 来判断)
     const isHedging = Boolean(props.selectedRow.spotcontractid);
-
-    const goodsList = getGoodsQuoteList();
+    // 如果是套保交易,只显示该合约所在的商品组下的合约
+    const goodsList = getGoodsQuoteList().filter((item) => isHedging ? item.goodsgroupid === props.selectedRow.goodsgroupid : true);
     const getGoods = (id: number) => goodsList.find((item) => item.goodsid === id)!;
     // 当前选中的商品合约
     const selectedGoods = ref<GoodsQuote>(getGoods(props.selectedRow.goodsid));
 
     if (!selectedGoods.value) {
-      message.error('商品不存在,不能平仓!');
+      message.error('合约不存在,不能平仓!');
       cancel();
     }