Quellcode durchsuchen

修改套保品种

huangbin vor 4 Jahren
Ursprung
Commit
91d84ae9cd

+ 2 - 0
src/common/constants/buttonType.ts

@@ -14,6 +14,8 @@ export interface ButtonType {
     goods_info_spot_normal_disable: string; // 现货品种 停用
     goods_info_spot_disable_recover: string; // 现货品种 恢复
 
+    goods_info_hedge_normal_modify: string; // 套保品种  修改
+
     spot_contract_btn_add: string; // 现货合同 添加
     spot_contract_btn_resubmit: string; // 现货合同 重新提交
     spot_contract_btn_modify: string; // 现货合同 修改

+ 0 - 52
src/common/setup/buttonPermission/index.ts

@@ -1,52 +0,0 @@
-// 按钮权限
-import { MenuItem } from '@/common/components/contextMenu/interface';
-import { ModalName } from '@/common/constants/modalName';
-import { openModal } from '@/common/setup/modal/index';
-import { OperationTabMenu } from '@/services/go/commonService/interface';
-import { inject, Ref } from 'vue';
-import { BtnType, MenuType } from './interface';
-
-/**
- * 详情 按钮
- * @param modalName 相对应的弹窗组件名
- * @param contextMenuList 右键列表
- */
-export function detailButton(modalName: keyof ModalName, contextMenuList: Ref<MenuItem[]>) {
-    const { openAction } = openModal(modalName);
-    contextMenuList.value.push({ lable: '详情', callback: openAction });
-}
-
-/**
- * 权限 按钮
- * @param modalName 相对应的弹窗组件名
- * @param lable 按钮名
- * @param contextMenuList 右键列表
- */
-export function permissionButton(modalName: keyof ModalName, lable: string, contextMenuList: Ref<MenuItem[]>) {
-    const { openAction } = openModal(modalName);
-    function action() {
-        contextMenuList.value.push({ lable, callback: openAction });
-    }
-    return { action };
-}
-
-/**
- * 判断某个按钮是否有权限
- * @param menuType 
- * @returns 
- */
-export function handlePermission(menuType: keyof MenuType) {
-    const permissionData = inject('thirdMenuList') as Ref<OperationTabMenu[]>;
-    // 判断按钮是否有权限
-    function hasPermission(type: keyof BtnType): boolean {
-        let result = false;
-        if (permissionData) {
-            const btnList = permissionData.value.find((e) => e.code === menuType);
-            if (btnList && btnList.children) {
-                result = btnList.children.find((e) => e.code === type && e.type === 2) ? true : false;
-            }
-        }
-        return result;
-    }
-    return { hasPermission };
-}

+ 0 - 58
src/common/setup/buttonPermission/interface.ts

@@ -1,58 +0,0 @@
-export interface MenuType {
-    custom_info_normal: string; // 客户资料 正常
-    custom_info_disabled: string; // 客户资料 停用
-
-    spot_contract_unsubmitted: string; // 现货合同 未提交
-    spot_contract_checkpending: string; // 现货合同 待审核
-    spot_contract_performance: string; // 现货合同 履约中
-    spot_contract_finished: string; // 现货合同 已完成
-
-    warehouse_info_normal: string; // 仓库信息 正常
-    warehouse_info_disabled: string; // 仓库信息 停用
-
-    purchase_pending: string;   // 采购 待点价
-    purchase_performance: string;   // 采购 履约交收
-    purchase_all: string;   // 采购 全部
-
-    sell_pending: string;   // 销售 待点价
-    sell_performance: string;   // 销售 履约交收
-    sell_all: string;   // 销售 全部
-
-    exposure_realtime: string;   //实时敞口
-    exposure_spot: string;   //现货头寸
-    exposure_futures: string;   //期货头寸
-    exposure_history: string;   //历史敞口
-
-    business_review_someprice: string; // 业务审核 点价
-    business_review_settlement: string; // 业务审核 交收
-
-    finance_review_funds: string; // 财务审核 款项
-    finance_review_invoice: string; // 财务审核 发票
-
-    inventory_review_checkin: string; // 库存审核 入库
-    inventory_review_checkout: string; // 财务审核 出库
-
-    inventory_current: string; // 库存查询 当前库存
-    inventory_applyrecord: string; // 库存查询 申请记录
-
-    finance_report_finance: string; // 财务报表
-    exposure_report_exposure: string; // 敞口报表
-    spot_report_spot: string; // 现货报表
-    inventory_report_inventory: string; // 库存报表
-}
-
-export interface BtnType {
-    custom_info_btn_add: string; // 客户资料 添加
-    custom_info_btn_modify: string; // 客户资料 修改
-    custom_info_btn_disable: string; // 客户资料 停用
-    custom_info_btn_recover: string; // 客户资料 恢复
-    custom_info_btn_delete: string; // 客户资料 删除
-
-    spot_contract_btn_add: string; // 现货合同 添加
-    spot_contract_btn_resubmit: string; // 现货合同 重新提交
-    spot_contract_btn_modify: string; // 现货合同 修改
-    spot_contract_btn_delete: string; // 现货合同 删除
-    spot_contract_btn_finish: string; // 现货合同 正常完结
-    spot_contract_btn_check: string; // 现货合同 审核
-    spot_contract_btn_cancel: string; // 现货合同 撤销
-}

+ 2 - 2
src/common/setup/contextMenu/index.ts

@@ -3,8 +3,8 @@ import { ModalName } from '@/common/constants/modalName';
 import { OperationTabMenu } from '@/services/go/commonService/interface';
 import { sessionStorageUtil } from "@/utils/storage";
 import { inject, onUnmounted, Ref, ref } from "vue";
-import { MenuType } from "../buttonPermission/interface";
 import { openModal } from "../modal";
+import { ButtonListKey } from '../table/interface';
 
 /**
  * 获取class 名
@@ -25,7 +25,7 @@ function getClassName(val: string): BtnClassName {
     return result
 }
 
-export function getBtnList(menuType: keyof MenuType, hasDetail: boolean) {
+export function getBtnList(menuType: keyof ButtonListKey, hasDetail: boolean) {
     // 获取 数据
     const permissionData = inject('thirdMenuList') as Ref<OperationTabMenu[]>;
     const name = 'permissionData'

+ 1 - 1
src/common/setup/index.ts

@@ -1,4 +1,4 @@
-import * as methods from './methods/index';
 import * as computed from './computed/index';
+import * as methods from './methods/index';
 
 export { methods, computed };

+ 13 - 11
src/common/setup/table/button.ts

@@ -34,19 +34,9 @@ export function getThirdMenuData(): OperationTabMenu[] {
     return data;
 }
 
-/**
- * 获取表格操作按钮列表
- * @param menuType 
- * @param hasDetail 操作按钮是否需要详情按钮(详情按钮服务 不配置)
- * @returns 
- */
-export function getBtnList(menuType: keyof ButtonListKey, hasDetail: boolean) {
-    // 获取 数据
-    const data = getThirdMenuData()
+export function handleBtnList(list: OperationTabMenu | undefined, menuType: keyof ButtonListKey, hasDetail: boolean) {
     const commonBtn = ref<BtnList[]>([]); // 通用按钮列表,不用选中数据才显示
     const forDataBtn = ref<BtnList[]>([]); // 针对数据按钮列表,选中某条数据才显示
-
-    const list = data.find((e) => e.code === menuType);
     if (list && list.children) {
         list.children.forEach(e => {
             const { code, type, title } = e;
@@ -70,4 +60,16 @@ export function getBtnList(menuType: keyof ButtonListKey, hasDetail: boolean) {
         forDataBtn.value.push({ lable: '详情', callback: openAction, className: getClassName('') })
     }
     return { commonBtn, forDataBtn }
+}
+
+/**
+ * 获取表格操作按钮列表
+ * @param menuType 
+ * @param hasDetail 操作按钮是否需要详情按钮(详情按钮服务 不配置)
+ * @returns 
+ */
+export function getBtnList(menuType: keyof ButtonListKey, hasDetail: boolean) {
+    const data = getThirdMenuData()
+    const list = data.find((e) => e.code === menuType);
+    return handleBtnList(list, menuType, hasDetail)
 }

+ 3 - 0
src/common/setup/table/interface.ts

@@ -24,6 +24,9 @@ export interface ButtonListKey {
     goods_info_spot_normal: string; // 现货品种 正常
     goods_info_spot_disable: string; // 现货品种 停用
 
+    goods_info_hedge_normal: string; // 现货品种 正常
+    goods_info_hedge_disable: string; // 套保品种 停用
+
     warehouse_info_normal: string; // 仓库信息 正常
     warehouse_info_disabled: string; // 仓库信息 停用
 

+ 4 - 2
src/services/go/ermcp/goodsInfo/index.ts

@@ -94,10 +94,12 @@ export function QueryMiddleGoods(status: number): Promise<ErmcpMiddleGoodsModel[
  * @param middlegoodsid 套保品种id
  * @constructor
  */
-export function QueryMiddleGoodsDetail(middlegoodsid: number): Promise<Ermcp3MiddleGoodsDetailEx[]> {
+export function QueryMiddleGoodsDetail(middlegoodsid?: number): Promise<Ermcp3MiddleGoodsDetailEx[]> {
     const userid = getUserId(); // 用户id
     const usertype = getUserAccountType()  // 用户类型 2-机构 7-企业成员
-    return commonSearch_go('/Ermcp3/QueryMiddleGoodsDetail', { userid, usertype, middlegoodsid }).catch((err) => {
+    const param = middlegoodsid ? { userid, usertype, middlegoodsid } : { userid, usertype }
+
+    return commonSearch_go('/Ermcp3/QueryMiddleGoodsDetail', param).catch((err) => {
         throw new Error(`查询套保品种详情(套保品种/商品详情): ${err.message}`);
     });
 }

+ 72 - 72
src/services/go/ermcp/goodsInfo/interface.ts

@@ -199,41 +199,41 @@ export interface Ermcp3GoodsGroup {
 /**
  * 套保品种
  */
-export interface ErmcpMiddleGoodsModel{
-    areauserid	:number;//机构用户ID
-    createtime	:string;//修改时间
-    enumdicname	:string;//单位名称
-    evaluateratio	:number;//估价系数
-    goodsgroupid	:number;//关联期货品种ID
-    goodsunitid	:number;//单位ID
-    isvalid	:number;//状态 number;
-//-无效(停用) 1-有效(正常)
-    middlegoodscode	:string;//套保品种代码
-    middlegoodsid	:number;//套保品种ID(SEQ_ERMS_MIDDLEGOODS)
-    middlegoodsname	:string;//套保品种名称
-    modifytime	:string;//修改时间
-    needhedgeratio	:number;//套保比率
-    qtydecimalplace	:number;//数量小数位
-    relatedgoodsid	:number;//关联交易商品ID
-    relatedgoodstype	:number;//关联商品类型 - 1:期货合约 2:现货品种
-    remark	:string;//备注
+export interface ErmcpMiddleGoodsModel {
+    areauserid: number;//机构用户ID
+    createtime: string;//修改时间
+    enumdicname: string;//单位名称
+    evaluateratio: number;//估价系数
+    goodsgroupid: number;//关联期货品种ID
+    goodsunitid: number;//单位ID
+    isvalid: number;//状态 number;
+    //-无效(停用) 1-有效(正常)
+    middlegoodscode: string;//套保品种代码
+    middlegoodsid: number;//套保品种ID(SEQ_ERMS_MIDDLEGOODS)
+    middlegoodsname: string;//套保品种名称
+    modifytime: string;//修改时间
+    needhedgeratio: number;//套保比率
+    qtydecimalplace: number;//数量小数位
+    relatedgoodsid: number;//关联交易商品ID
+    relatedgoodstype: number;//关联商品类型 - 1:期货合约 2:现货品种
+    remark: string;//备注
 }
 
 /**
  * 查询套保品种详情
  */
-export interface Ermcp3MiddleGoodsDetailEx{
+export interface Ermcp3MiddleGoodsDetailEx {
     dglist: ErmcpDeliveryGoodsDetail2[]  // 关联的现货品种列表
     gplist: Ermcp3GoodsGroupEx[]  // 关联商品组列表
-    mg: ErmcpMiddleGoodsModel[] //
+    mg: ErmcpMiddleGoodsModel //
 }
 
 /**
  * 关联的现货品种列表
  */
-export interface ErmcpDeliveryGoodsDetail2{
+export interface ErmcpDeliveryGoodsDetail2 {
     convertratio: number   // 套保系数(折算系数)
-    data: ErmcpDeliveryGoods[]
+    data: ErmcpDeliveryGoods
     gblist: Ermcp3Brand[]  // 品牌列表
     gmlist: Ermcp3Wrstandard[] // 品类列表(仓单标准)
 }
@@ -241,56 +241,56 @@ export interface ErmcpDeliveryGoodsDetail2{
 /**
  * 期货商品信息
  */
-export interface Goods{
-    agreeunit	:number;//合约单位
-    auditaccountid	:number;//审核操作员账号
-    audittime	:string;//审核时间
-    cancelaccountid	:number;//注销操作员账号
-    canceltime	:string;//注销时间
-    closepricemode	:number;//强平价格方式 - 1:市价 2:最新价 3:涨跌停(未实现)
-    closepriceparam	:number;//强平最新价浮动比例 - 方式为2时使用 (<1)买 上浮 (1+x)最新价卖 下浮 (1-x)最新价
-    createtime	:string;//创建时间
-    creatorid	:number;//创建人
-    currencyid	:number;//报价货币ID
-    cutmode	:number;//斩仓方式 - 1:不斩仓 2:自动斩仓 3:半自动斩仓
-    decimalplace	:number;//报价小数位
-    delistingdate	:string;//商品退市时间(状态:退市) – 已作废
-    delistingmode	:number;//退市方式 - 1:退市平仓 2:退市交收 3:不处理(仅期权\币币兑换)
-    deliveryflag	:number;//交割标志 - number;
-//:不可交割 1:可交割
-    forceclosemode	:number;//定期强平方式 - 1:无 2:每日 3:每周 4:每月[收益权]
-    forceclosevalue	:number;//定期强平参数 [收益权]
-    goodscode	:string;//商品代码(内部)
-    goodscurrencyid	:number;//合约货币ID
-    goodsgroupid	:number;//所属商品组ID
-    goodsid	:number;//商品ID(自增ID SEQ_GOODS)
-    goodsname	:string;//商品名称
-    goodsquotetype	:number;//合约报价类型: 1-直接报价 2-间接报价
-    goodsstatus	:number;//商品状态- 1:待审核 2:未上市 3:上市 4:已注销 5:审核拒绝 6:退市 7:待退市
-    goodstradetype	:number;//商品交易权限类型 - 1:可建可平 3:不可建可平
-    goodunitid	:number;//报价单位ID
-    hasquoter	:number;//是否有报价商 - number;
-//:无报价商 1:有报价商
-    hqprotecttime	:number;//行情保护时间(秒)
-    innerdealmode	:number;//内部成交方式[通道交易] - 1:净头寸 2:开平 3:平今
-    isbuylimited	:number;//是否限制建仓量 - number;
-//:不限制 1:限制
-    lasttradedate	:string;//最后交易日期(状态:待退市)
-    listingdate	:string;//交易开始日期
-    marketid	:number;//所属市场ID
-    modifierid	:number;//修改人
-    modifystatus	:number;//变更状态 - 1:未变更 2:变更中 3:待审核 4:已审核
-    modifytime	:string;//修改时间
-    outerdealmode	:number;//外部成交方式[通道交易]- 1:净头寸 2:开平 3:平今
-    outgoodscode	:string;//商品代码(外部)
-    qtydecimalplace	:number;//成交量小数位
-    quotegear	:number;//行情档位(1-1number;
-//)
-    quoteminunit	:number;//行情最小变动单位 [整数,报价小数位一起使用]
-    quoteshowtype	:number;//行情报价类型: 1:成交价 2:买卖中间价 3:含买价 4:含卖价做市模式固定为3:含买价
-    quoteshowtypeinterval	:number;//行情报价间隔时间(秒)(成交价时为number;
-//)
-    remark	:string;//备注
+export interface Goods {
+    agreeunit: number;//合约单位
+    auditaccountid: number;//审核操作员账号
+    audittime: string;//审核时间
+    cancelaccountid: number;//注销操作员账号
+    canceltime: string;//注销时间
+    closepricemode: number;//强平价格方式 - 1:市价 2:最新价 3:涨跌停(未实现)
+    closepriceparam: number;//强平最新价浮动比例 - 方式为2时使用 (<1)买 上浮 (1+x)最新价卖 下浮 (1-x)最新价
+    createtime: string;//创建时间
+    creatorid: number;//创建人
+    currencyid: number;//报价货币ID
+    cutmode: number;//斩仓方式 - 1:不斩仓 2:自动斩仓 3:半自动斩仓
+    decimalplace: number;//报价小数位
+    delistingdate: string;//商品退市时间(状态:退市) – 已作废
+    delistingmode: number;//退市方式 - 1:退市平仓 2:退市交收 3:不处理(仅期权\币币兑换)
+    deliveryflag: number;//交割标志 - number;
+    //:不可交割 1:可交割
+    forceclosemode: number;//定期强平方式 - 1:无 2:每日 3:每周 4:每月[收益权]
+    forceclosevalue: number;//定期强平参数 [收益权]
+    goodscode: string;//商品代码(内部)
+    goodscurrencyid: number;//合约货币ID
+    goodsgroupid: number;//所属商品组ID
+    goodsid: number;//商品ID(自增ID SEQ_GOODS)
+    goodsname: string;//商品名称
+    goodsquotetype: number;//合约报价类型: 1-直接报价 2-间接报价
+    goodsstatus: number;//商品状态- 1:待审核 2:未上市 3:上市 4:已注销 5:审核拒绝 6:退市 7:待退市
+    goodstradetype: number;//商品交易权限类型 - 1:可建可平 3:不可建可平
+    goodunitid: number;//报价单位ID
+    hasquoter: number;//是否有报价商 - number;
+    //:无报价商 1:有报价商
+    hqprotecttime: number;//行情保护时间(秒)
+    innerdealmode: number;//内部成交方式[通道交易] - 1:净头寸 2:开平 3:平今
+    isbuylimited: number;//是否限制建仓量 - number;
+    //:不限制 1:限制
+    lasttradedate: string;//最后交易日期(状态:待退市)
+    listingdate: string;//交易开始日期
+    marketid: number;//所属市场ID
+    modifierid: number;//修改人
+    modifystatus: number;//变更状态 - 1:未变更 2:变更中 3:待审核 4:已审核
+    modifytime: string;//修改时间
+    outerdealmode: number;//外部成交方式[通道交易]- 1:净头寸 2:开平 3:平今
+    outgoodscode: string;//商品代码(外部)
+    qtydecimalplace: number;//成交量小数位
+    quotegear: number;//行情档位(1-1number;
+    //)
+    quoteminunit: number;//行情最小变动单位 [整数,报价小数位一起使用]
+    quoteshowtype: number;//行情报价类型: 1:成交价 2:买卖中间价 3:含买价 4:含卖价做市模式固定为3:含买价
+    quoteshowtypeinterval: number;//行情报价间隔时间(秒)(成交价时为number;
+    //)
+    remark: string;//备注
 }
 
 

+ 8 - 5
src/views/information/goods/components/leftMenu/index.vue

@@ -26,16 +26,15 @@
 <script lang="ts">
 import { defineComponent, ref, PropType, SetupContext } from 'vue';
 import { MenuList } from '@/services/go/ermcp/goodsInfo/interface';
-import { initMenu } from '../../setup';
 
 // 菜单栏
-const handleMenu = (context: SetupContext) => {
+const handleMenu = (context: SetupContext, path: string) => {
     const collapsed = ref<boolean>(false);
     const selectedKeys = ref<string[]>(['1-0']);
     const openKeys = ref<string[]>(['1']);
 
     function menuClick(value: any) {
-        const is = value.keyPath.includes('goods_info_spot_normal') ? true : false;
+        const is = value.keyPath.includes(path) ? true : false;
         context.emit('chooseMenu', { key: value.key, is });
     }
     return { collapsed, selectedKeys, openKeys, menuClick };
@@ -45,13 +44,17 @@ export default defineComponent({
     name: 'leftMenu',
     props: {
         menuList: {
-            default: initMenu,
+            default: [],
             type: Object as PropType<MenuList[]>,
         },
+        path: {
+            default: 'goods_info_spot_normal',
+            type: String,
+        },
     },
     components: {},
     setup(props, context) {
-        const { collapsed, selectedKeys, openKeys, menuClick } = handleMenu(context);
+        const { collapsed, selectedKeys, openKeys, menuClick } = handleMenu(context, props.path);
 
         return {
             menuClick,

+ 185 - 0
src/views/information/goods/components/rightHedging/index.vue

@@ -0,0 +1,185 @@
+<template>
+  <div class="rightSpot">
+    <div class="title">
+      <div class="tltLeft">
+        <span class="blue">
+          <svg class="icon svg-icon"
+               aria-hidden="true">
+            <use xlink:href="#icon-shuzhuangtu"></use>
+          </svg>
+          {{selctedMG.mg.middlegoodsname}}({{getGoodsUnit(selctedMG.mg.goodsunitid)}})
+        </span>
+        <span class="green ml10">{{selctedMG.mg.isvalid ? '正常' : '停用'}}</span>
+      </div>
+      <div class="tltBtns">
+        <template v-if="isNormal">
+          <BtnList :btnList="forDataBtn" />
+        </template>
+        <template>
+          <a-button class="blueBtn">恢复</a-button>
+        </template>
+      </div>
+    </div>
+    <div class="spotCont">
+      <a-collapse class="spotCollapse"
+                  :bordered="false">
+        <template #expandIcon="props">
+          <svg class="icon svg-icon"
+               aria-hidden="true"
+               v-if="props.isActive == 0">
+            <use xlink:href="#icon-shouqi1"></use>
+          </svg>
+          <svg class="icon svg-icon"
+               aria-hidden="true"
+               v-else>
+            <use xlink:href="#icon-shouqi2"></use>
+          </svg>
+        </template>
+        <a-collapse-panel key="1">
+          <template #header>
+            <a-row class="headRow">
+              <a-col :span="8">期货品种({{selctedMG.gplist.length}})</a-col>
+              <a-col :span="8">单位</a-col>
+              <a-col :span="8">品种系数</a-col>
+            </a-row>
+          </template>
+
+          <template v-for="(item, i) in selctedMG.gplist"
+                    :key="i + '1111'">
+            <a-row class="contRow">
+              <a-col :span="8">{{item.goodsgroupname}}</a-col>
+              <a-col :span="8">{{item.enumdicname}}</a-col>
+              <a-col :span="8">{{item.convertratio}}</a-col>
+            </a-row>
+            <a-collapse>
+              <template #expandIcon="props">
+                <svg class="icon svg-icon"
+                     aria-hidden="true"
+                     v-if="props.isActive == 0">
+                  <use xlink:href="#icon-shouqi1"></use>
+                </svg>
+                <svg class="icon svg-icon"
+                     aria-hidden="true"
+                     v-else>
+                  <use xlink:href="#icon-shouqi2"></use>
+                </svg>
+              </template>
+              <a-collapse-panel>
+                <template #header>
+                  <a-row class="headRow">
+                    <a-col :span="8">期货合约({{item.glist.length}})</a-col>
+                    <a-col :span="8">单位</a-col>
+                    <a-col :span="8">合约系数</a-col>
+                  </a-row>
+                </template>
+                <a-row class="contRow"
+                       v-for="sub in item.glist"
+                       :key="sub.goodsid">
+                  <a-col :span="8">{{sub.goodsname}}</a-col>
+                  <a-col :span="8">{{sub.enumdicname}}</a-col>
+                  <a-col :span="8">{{sub.agreeunit}}</a-col>
+                </a-row>
+              </a-collapse-panel>
+            </a-collapse>
+          </template>
+        </a-collapse-panel>
+        <a-collapse-panel key="2">
+          <template #header>
+            <a-row class="headRow">
+              <a-col :span="8">现货品种({{selctedMG.dglist.length}})</a-col>
+              <a-col :span="8">单位</a-col>
+              <a-col :span="8">品种系数</a-col>
+            </a-row>
+          </template>
+          <template v-for="(item, i) in selctedMG.dglist"
+                    :key="i + '33'">
+            <a-row class="contRow">
+              <a-col :span="8">{{item.data.deliverygoodsname}}</a-col>
+              <a-col :span="8">{{item.data.agreeunit}}</a-col>
+              <a-col :span="8">{{item.data.enumdicname}}</a-col>
+            </a-row>
+            <a-collapse>
+              <template #expandIcon="props">
+                <svg class="icon svg-icon"
+                     aria-hidden="true"
+                     v-if="props.isActive == 0">
+                  <use xlink:href="#icon-shouqi1"></use>
+                </svg>
+                <svg class="icon svg-icon"
+                     aria-hidden="true"
+                     v-else>
+                  <use xlink:href="#icon-shouqi2"></use>
+                </svg>
+              </template>
+              <a-collapse-panel>
+                <template #header>
+                  <a-row class="headRow">
+                    <a-col :span="8">品类({{item.gmlist.length}})</a-col>
+                    <a-col :span="8">单位</a-col>
+                    <a-col :span="8">标仓系数</a-col>
+                  </a-row>
+                </template>
+                <a-row class="contRow"
+                       v-for="(sub) in item.gmlist"
+                       :key="sub.goodsid">
+                  <a-col :span="8">{{sub.wrstandardname}}</a-col>
+                  <a-col :span="8">{{sub.enumdicname}}</a-col>
+                  <a-col :span="8">{{sub.convertfactor}}</a-col>
+                </a-row>
+              </a-collapse-panel>
+            </a-collapse>
+          </template>
+        </a-collapse-panel>
+      </a-collapse>
+    </div>
+    <Modify />
+    <Disable />
+  </div>
+</template>
+
+<script lang="ts">
+import { defineComponent, PropType } from 'vue';
+import { getGoodsUnit } from '@/views/information/goods/list/spot-variety/setup';
+import { initMG } from '@/views/information/goods/list/hedging-variety/setup';
+import { ErmcpDeliveryGoodsDetailEx } from '@/services/go/ermcp/goodsInfo/interface';
+import { initData } from '@/common/methods';
+import Modify from '../modify/index.vue';
+import Disable from '../disable/index.vue';
+import { BtnList } from '@/common/export/table';
+import { getThirdMenuData, handleBtnList } from '@/common/setup/table/button';
+
+export default defineComponent({
+    name: 'rightHedging',
+    props: {
+        selctedMG: {
+            default: initMG,
+            type: Object as PropType<ErmcpDeliveryGoodsDetailEx>,
+        },
+        isNormal: {
+            default: true,
+            type: Boolean,
+        },
+    },
+    components: {
+        Modify,
+        Disable,
+        BtnList,
+    },
+    setup(props, context) {
+        const menuList = getThirdMenuData();
+        const temp = menuList.find((e) => e.code === 'goods_info_hedge');
+        let list = undefined;
+        if (temp) {
+            list = temp.children.find((e) => e.code === 'goods_info_hedge_normal');
+        }
+
+        const { forDataBtn } = handleBtnList(list, 'goods_info_hedge_normal', true);
+
+        initData(() => {});
+        return { getGoodsUnit, forDataBtn };
+    },
+});
+</script>
+
+<style lang="less">
+</style>;

+ 15 - 9
src/views/information/goods/components/rightSpot/index.vue

@@ -13,10 +13,7 @@
       </div>
       <div class="tltBtns">
         <template v-if="isNormal">
-          <a-button class="blueBtn"
-                    @click="modifyAction">修改</a-button>
-          <a-button class="redBtn"
-                    @click="disableAction">停用</a-button>
+          <BtnList :btnList="forDataBtn" />
         </template>
         <template>
           <a-button class="blueBtn">恢复</a-button>
@@ -122,18 +119,20 @@
 
 <script lang="ts">
 import { defineComponent, ref, PropType } from 'vue';
-import { handleDG, getGoodsUnit } from '../../setup';
+import { handleDG, getGoodsUnit, initDG } from '@/views/information/goods/list/spot-variety/setup';
 import { ErmcpDeliveryGoodsDetailEx } from '@/services/go/ermcp/goodsInfo/interface';
 import { initData } from '@/common/methods';
 import { openModal } from '@/common/setup/modal/index';
 import Modify from '../modify/index.vue';
 import Disable from '../disable/index.vue';
+import { getThirdMenuData, handleBtnList } from '@/common/setup/table/button';
+import { BtnList } from '@/common/export/table';
 
 export default defineComponent({
     name: 'rightSpot',
     props: {
         selctedDeliveryGoods: {
-            default: handleDG,
+            default: initDG,
             type: Object as PropType<ErmcpDeliveryGoodsDetailEx>,
         },
         isNormal: {
@@ -144,12 +143,19 @@ export default defineComponent({
     components: {
         Modify,
         Disable,
+        BtnList,
     },
     setup(props, context) {
-        const { openAction: modifyAction } = openModal('goods_info_spot_normal_modify');
-        const { openAction: disableAction } = openModal('goods_info_spot_normal_disable');
+        const menuList = getThirdMenuData();
+        const temp = menuList.find((e) => e.code === 'goods_info_spot');
+        let list = undefined;
+        if (temp) {
+            list = temp.children.find((e) => e.code === 'goods_info_spot_normal');
+        }
+
+        const { forDataBtn } = handleBtnList(list, 'goods_info_spot_normal', true);
         initData(() => {});
-        return { getGoodsUnit, modifyAction, disableAction };
+        return { getGoodsUnit, forDataBtn };
     },
 });
 </script>

+ 0 - 35
src/views/information/goods/index.vue

@@ -1,35 +0,0 @@
-<template>
-    <!-- 商品信息 -->
-    <div class="goods-info">
-        <firstMenu :list="list" :value="'title'" @selectMenu="selectMenu" />
-        <router-view />
-    </div>
-</template>
-
-<script lang="ts">
-    import { defineComponent } from 'vue';
-    import firstMenu from '@/common/components/firstMenu/index.vue';
-    import { handleRouterMenu } from '@/common/setup/router/index';
-    import { initData } from '@/common/methods';
-
-    export default defineComponent({
-        name: 'custom',
-        components: {
-            firstMenu,
-        },
-        setup() {
-            const { list, selectMenu, getMenuList } = handleRouterMenu();
-            initData(() => {
-                getMenuList();
-            });
-            return { list, selectMenu };
-        },
-    });
-</script>
-
-<style lang="less">
-    .goods-info {
-        width: 100%;
-        height: calc(100% - 40px);
-    }
-</style>

+ 46 - 17
src/views/information/goods/list/hedging-variety/index.vue

@@ -1,28 +1,57 @@
 <template>
-    <!-- 套保品种 -->
-    <div class="hedging-variety">
-        套保品种
+  <!-- 套保品种 -->
+  <div class="hedging-variety spot-variety"
+       :loading="loading">
+    <filterCustomTable @search="search">
+    </filterCustomTable>
+    <div class="spotTableCont">
+      <div class="leftSpot">
+        <leftMenu :menuList="menuList"
+                  :path="'goods_info_hedge_normal'"
+                  @chooseMenu="chooseDG"></leftMenu>
+      </div>
+      <div class="rightCont">
+        <RightHedging :selctedMG="selctedMG"
+                      :isNormal="isNormal"></RightHedging>
+      </div>
     </div>
+  </div>
 </template>
 
 <script lang="ts">
-    import { defineComponent } from 'vue';
+import { defineComponent } from 'vue';
+import filterCustomTable from '@/views/information/goods/components/filterTable/index.vue';
+import leftMenu from '@/views/information/goods/components/leftMenu/index.vue';
+import RightHedging from '../../components/rightHedging/index.vue';
+import { openModal } from '@/common/setup/modal/index';
+import { initData } from '@/common/methods/index';
+import AddGoods from '@/views/information/goods/components/add/index.vue';
+import { handleMG } from './setup';
 
-    import { initData } from '@/common/methods';
+export default defineComponent({
+    name: 'hedging-variety',
+    components: {
+        filterCustomTable,
+        leftMenu,
+        RightHedging,
+        AddGoods,
+    },
+    setup() {
+        // 控制弹窗
+        const { openAction: addAction } = openModal('goods_info_hedge_normal_modify');
+        const { loading, menuList, isNormal, selctedMG, queryMG, chooseDG } = handleMG();
 
-    export default defineComponent({
-        name: 'hedging-variety',
-        components: {},
-        setup() {
-            initData(() => {
-                // 加载数据在这里
-            });
-            return {};
-        },
-    });
+        initData(() => {
+            // 加载数据在这里
+            queryMG();
+        });
+        return { addAction, loading, selctedMG, chooseDG, isNormal, menuList };
+    },
+});
 </script>
 
 <style lang="less">
-    .hedging-variety {
-    }</style
+.hedging-variety {
+}
+</style
 >;

+ 90 - 0
src/views/information/goods/list/hedging-variety/setup.ts

@@ -0,0 +1,90 @@
+import { QueryMiddleGoodsDetail } from '@/services/go/ermcp/goodsInfo';
+import { Ermcp3MiddleGoodsDetailEx } from '@/services/go/ermcp/goodsInfo/interface';
+import { mergeObj } from '@/utils/objHandle';
+import { message } from 'ant-design-vue';
+import { reactive, ref } from 'vue';
+import { getInitMenuData } from '../../setup';
+
+export function initMG(): Ermcp3MiddleGoodsDetailEx {
+    return {
+        dglist: [],  // 关联的现货品种列表
+        gplist: [],  // 关联商品组列表
+        mg: {
+            areauserid: 0,
+            evaluateratio: 0,
+            goodsgroupid: 0,
+            isvalid: 0,
+            middlegoodsid: 0,
+            needhedgeratio: 0,
+            qtydecimalplace: 0,
+            relatedgoodsid: 0,
+            relatedgoodstype: 0,
+            goodsunitid: 0,
+            createtime: '',
+            enumdicname: '',
+            middlegoodscode: '',
+            middlegoodsname: '',
+            modifytime: '',
+            remark: '',
+        }
+    }
+}
+
+/**
+ * 获取套保品种数据
+ * @returns 
+ */
+export function handleMG() {
+    const { menuList, menuMap } = getInitMenuData('goods_info_hedge')
+    const loading = ref<boolean>(false);
+    // 套保品种列表
+    const MGList = ref<Ermcp3MiddleGoodsDetailEx[]>([])
+    // 选中的具体某一天套保品种数据
+    const selctedMG = reactive<Ermcp3MiddleGoodsDetailEx>(initMG())
+    const isNormal = ref<boolean>(true) // true => 正常; false => 停用
+    // 获取套保品种数据
+    function queryMG(param?: number) {
+        loading.value = true;
+        QueryMiddleGoodsDetail(param).then(res => {
+            MGList.value = res;
+            res.forEach(e => {
+                const { isvalid, middlegoodsname, middlegoodsid } = e.mg
+                const normal = 'goods_info_hedge_normal', disable = 'goods_info_hedge_disable';
+                const result = { key: middlegoodsid.toString(), title: middlegoodsname }
+                if (isvalid) { //1-有效(正常)
+                    if (menuMap.has(normal)) {
+                        const index = menuMap.get(normal) as number;
+                        menuList.value[index].children?.push(result)
+                    }
+                } else {    // 0:无效(停用)
+                    if (menuMap.has(disable)) {
+                        const index = menuMap.get(disable) as number;
+                        menuList.value[index].children?.push(result)
+                    }
+                }
+            })
+            // 获取默认第一条数据
+            if (menuList.value[0].children?.length) {
+                chooseDG({ key: menuList.value[0].children[0].key, is: true })
+            } else if (menuList.value[1].children?.length) {
+                chooseDG({ key: menuList.value[1].children[0].key, is: false })
+            }
+        }).catch(err => {
+            message.error(err)
+        }).finally(() => loading.value = false)
+    }
+    interface Value {
+        key: string;
+        is: boolean;
+    }
+    // 选择某条现货数据
+    function chooseDG({ key, is }: Value) {
+        isNormal.value = is
+        const obj = MGList.value.find(e => e.mg.middlegoodsid === Number(key))
+        if (obj) {
+            mergeObj(selctedMG, obj)
+            console.log('selctedMG', selctedMG);
+        }
+    }
+    return { loading, menuList, isNormal, selctedMG, queryMG, chooseDG }
+}

+ 2 - 1
src/views/information/goods/list/spot-variety/index.vue

@@ -10,6 +10,7 @@
     <div class="spotTableCont">
       <div class="leftSpot">
         <leftMenu :menuList="menuList"
+                  :path="'goods_info_spot_normal'"
                   @chooseMenu="chooseDG"></leftMenu>
       </div>
       <div class="rightCont">
@@ -30,7 +31,7 @@ import rightSpot from '@/views/information/goods/components/rightSpot/index.vue'
 import { openModal } from '@/common/setup/modal/index';
 import { initData } from '@/common/methods/index';
 import AddGoods from '@/views/information/goods/components/add/index.vue';
-import { handleDG } from '../../setup';
+import { handleDG } from './setup';
 
 export default defineComponent({
     name: 'spot-variety',

+ 121 - 0
src/views/information/goods/list/spot-variety/setup.ts

@@ -0,0 +1,121 @@
+import { getItemEnum } from '@/services/bus/allEnum';
+import { QueryDeliveryGoodsDetail } from '@/services/go/ermcp/goodsInfo';
+import { ErmcpDeliveryGoodsDetailEx, MenuList } from '@/services/go/ermcp/goodsInfo/interface';
+import { mergeObj } from '@/utils/objHandle';
+import { message } from 'ant-design-vue';
+import { reactive, Ref, ref } from 'vue';
+import { getInitMenuData } from '../../setup';
+
+/**
+ * 初始化 现货品种对象数据
+ * @returns 
+ */
+export function initDG(): ErmcpDeliveryGoodsDetailEx {
+    return {
+        data: {
+            agreeunit: 0,
+            areauserid: 0,
+            auditflag: 0,
+            categoryid: 0,
+            deliverygoodscode: '',
+            deliverygoodsid: 0,
+            deliverygoodsname: '--',
+            deliverygoodstype: 0,
+            dgstatus: 0,
+            enumdicname: '--',
+            goodsunitid: 0,
+            isvalid: 0,
+            qtydecimalplace: 0,
+            remark: '',
+            standardqty: 0,
+            standardqtyrange: 0
+        },
+        gblist: [],
+        gmlist: [],
+        mgList: [],
+    }
+}
+
+
+interface MenuType {
+    menuList: Ref<MenuList[]>;
+    menuMap: Map<string, number>;
+}
+
+
+/**
+ * 获取现货品种数据
+ * @returns 
+ */
+export function handleDG() {
+    const { menuList, menuMap } = getInitMenuData('goods_info_spot')
+    const loading = ref<boolean>(false);
+    // 现货品种列表
+    const deliveryGoodsList = ref<ErmcpDeliveryGoodsDetailEx[]>([])
+    // 选中的具体某一天现货品种数据
+    const selctedDeliveryGoods = reactive<ErmcpDeliveryGoodsDetailEx>(initDG())
+    const isNormal = ref<boolean>(true) // true => 正常; false => 停用
+    // 获取现货品种数据
+    function queryDG(param?: number) {
+        loading.value = true;
+        QueryDeliveryGoodsDetail(param).then(res => {
+            deliveryGoodsList.value = res;
+            res.forEach(e => {
+                const { dgstatus, isvalid, deliverygoodsname, deliverygoodsid } = e.data
+                if (isvalid) { // 有效 
+                    const normal = 'goods_info_spot_normal', disable = 'goods_info_spot_disable';
+                    const result = { key: deliverygoodsid.toString(), title: deliverygoodsname }
+                    if (dgstatus) { //1:正常
+                        if (menuMap.has(normal)) {
+                            const index = menuMap.get(normal) as number;
+                            menuList.value[index].children?.push(result)
+                        }
+                    } else {    // 0:未激活 
+                        if (menuMap.has(disable)) {
+                            const index = menuMap.get(disable) as number;
+                            menuList.value[index].children?.push(result)
+                        }
+                    }
+                }
+            })
+            // 获取默认第一条数据
+            if (menuList.value[0].children?.length) {
+                chooseDG({ key: menuList.value[0].children[0].key, is: true })
+            } else if (menuList.value[1].children?.length) {
+                chooseDG({ key: menuList.value[1].children[0].key, is: false })
+            }
+        }).catch(err => {
+            message.error(err)
+        }).finally(() => loading.value = false)
+    }
+    interface Value {
+        key: string;
+        is: boolean;
+    }
+    // 选择某条现货数据
+    function chooseDG({ key, is }: Value) {
+        isNormal.value = is
+        const obj = deliveryGoodsList.value.find(e => e.data.deliverygoodsid === Number(key))
+        if (obj) {
+            mergeObj(selctedDeliveryGoods, obj)
+            console.log('selctedDeliveryGoods', selctedDeliveryGoods);
+        }
+    }
+    return { loading, deliveryGoodsList, menuList, queryDG, isNormal, selctedDeliveryGoods, chooseDG }
+}
+
+/**
+ * 获取合约单位
+ * @returns 
+ */
+export function getGoodsUnit(unit: number) {
+    return getGoodsUnitList().find(e => e.enumitemname === unit)?.enumdicname
+}
+
+/**
+ * 获取现货品种单位列表
+ * @returns 
+ */
+export function getGoodsUnitList() {
+    return getItemEnum('goodsunit')
+}

+ 4 - 110
src/views/information/goods/setup.ts

@@ -1,51 +1,7 @@
 import { getThirdMenuData } from '@/common/setup/table/button';
 import { getItemEnum } from '@/services/bus/allEnum';
-import { QueryDeliveryGoodsDetail } from '@/services/go/ermcp/goodsInfo';
-import { ErmcpDeliveryGoodsDetailEx, MenuList } from '@/services/go/ermcp/goodsInfo/interface';
-import { mergeObj } from '@/utils/objHandle';
-import { message } from 'ant-design-vue';
-import { reactive, Ref, ref } from 'vue';
-
-/**
- * 初始化 现货品种对象数据
- * @returns 
- */
-export function initDG(): ErmcpDeliveryGoodsDetailEx {
-    return {
-        data: {
-            agreeunit: 0,
-            areauserid: 0,
-            auditflag: 0,
-            categoryid: 0,
-            deliverygoodscode: '',
-            deliverygoodsid: 0,
-            deliverygoodsname: '--',
-            deliverygoodstype: 0,
-            dgstatus: 0,
-            enumdicname: '--',
-            goodsunitid: 0,
-            isvalid: 0,
-            qtydecimalplace: 0,
-            remark: '',
-            standardqty: 0,
-            standardqtyrange: 0
-        },
-        gblist: [],
-        gmlist: [],
-        mgList: [],
-    }
-}
-
-/**
- * 初始化 菜单数据
- * @returns 
- */
-export function initMenu(): MenuList[] {
-    return [
-        { key: '1', title: '正常', children: [] },
-        { key: '2', title: '停用', children: [] },
-    ]
-}
+import { MenuList } from '@/services/go/ermcp/goodsInfo/interface';
+import { Ref, ref } from 'vue';
 
 interface MenuType {
     menuList: Ref<MenuList[]>;
@@ -55,9 +11,9 @@ interface MenuType {
  * 获取菜单数据
  * @returns MenuType
  */
-function getInitMenuData(): MenuType {
+export function getInitMenuData(code: 'goods_info_spot' | 'goods_info_hedge'): MenuType {
     const list = getThirdMenuData();
-    const obj = list.find(e => e.code === 'goods_info_spot'); // 现货品种 数据
+    const obj = list.find(e => e.code === code); // 现货品种 数据
     const menuMap = new Map<string, number>();  // key 正常和停用对应的code,value是它们所在的索引值
     const menuList = ref<MenuList[]>([])
     if (obj && obj.children) {
@@ -71,68 +27,6 @@ function getInitMenuData(): MenuType {
 }
 
 /**
- * 获取现货品种数据
- * @returns 
- */
-export function handleDG() {
-    const { menuList, menuMap } = getInitMenuData()
-    const loading = ref<boolean>(false);
-    // 现货品种列表
-    const deliveryGoodsList = ref<ErmcpDeliveryGoodsDetailEx[]>([])
-    // 选中的具体某一天现货品种数据
-    const selctedDeliveryGoods = reactive<ErmcpDeliveryGoodsDetailEx>(initDG())
-    const isNormal = ref<boolean>(true) // true => 正常; false => 停用
-    // const menuList = ref<MenuList[]>(initMenu());
-    // 获取现货品种数据
-    function queryDG(param?: number) {
-        loading.value = true;
-        QueryDeliveryGoodsDetail(param).then(res => {
-            deliveryGoodsList.value = res;
-            res.forEach(e => {
-                const { dgstatus, isvalid, deliverygoodsname, deliverygoodsid } = e.data
-                if (isvalid) { // 有效 
-                    const normal = 'goods_info_spot_normal', disable = 'goods_info_spot_disable';
-                    const result = { key: deliverygoodsid.toString(), title: deliverygoodsname }
-                    if (dgstatus) { //1:正常
-                        if (menuMap.has(normal)) {
-                            const index = menuMap.get(normal) as number;
-                            menuList.value[index].children?.push(result)
-                        }
-                    } else {    // 0:未激活 
-                        if (menuMap.has(disable)) {
-                            const index = menuMap.get(disable) as number;
-                            menuList.value[index].children?.push(result)
-                        }
-                    }
-                }
-            })
-            // 获取默认第一条数据
-            if (menuList.value[0].children?.length) {
-                chooseDG({ key: menuList.value[0].children[0].key, is: true })
-            } else if (menuList.value[1].children?.length) {
-                chooseDG({ key: menuList.value[1].children[0].key, is: false })
-            }
-        }).catch(err => {
-            message.error(err)
-        }).finally(() => loading.value = false)
-    }
-    interface Value {
-        key: string;
-        is: boolean;
-    }
-    // 选择某条现货数据
-    function chooseDG({ key, is }: Value) {
-        isNormal.value = is
-        const obj = deliveryGoodsList.value.find(e => e.data.deliverygoodsid === Number(key))
-        if (obj) {
-            mergeObj(selctedDeliveryGoods, obj)
-            console.log('selctedDeliveryGoods', selctedDeliveryGoods);
-        }
-    }
-    return { loading, deliveryGoodsList, menuList, queryDG, isNormal, selctedDeliveryGoods, chooseDG }
-}
-
-/**
  * 获取合约单位
  * @returns 
  */

+ 10 - 5
src/views/information/spot-contract/components/add/index.vue

@@ -100,8 +100,8 @@
                           style="width: 200px"
                           placeholder="请选择客户">
                   <!-- 客户资料列表 正常 -->
-                  <a-select-option :value="i"
-                                   v-for="(item, i) in customList"
+                  <a-select-option :value="item.userid"
+                                   v-for="item in customList"
                                    :key="item.userid">
                     {{item.customername}}
                   </a-select-option>
@@ -412,16 +412,17 @@
 import { defineComponent, PropType, ref, toRaw } from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
 import { initData } from '@/common/methods';
-import { handleFromState, handleContract, handleDeliveryGoods, handleAmout, handlePrice, handleDate, addContractReq } from './setup';
+import { addContractReq } from './setup';
 import { getUserName, getUsrId } from '@/services/bus/user';
 import { getGoodsList } from '@/services/bus/goods';
 import { Goods } from '@/services/go/ermcp/goodsInfo/interface';
 import { ValidateErrorEntity } from 'ant-design-vue/lib/form/interface';
-import { FormState } from './interface';
+import { FormState } from '../interface';
 import { formatTime } from '@/common/methods/format';
 import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
 import { handleAccountManager } from '../setup';
 import { Moment } from 'moment';
+import { handleFormRule, handleContract, handleDeliveryGoods, handleAmout, handlePrice, handleDate, handleFromState } from '../setup';
 
 export default defineComponent({
     name: 'add-spot-contract',
@@ -439,7 +440,8 @@ export default defineComponent({
 
         // 表单
         const formRef = ref();
-        const { formState, businessType, rules } = handleFromState();
+        const { formState, businessType } = handleFromState();
+        const { rules } = handleFormRule(formState);
         // 合同类型
         const { contractType, isSell, contractChange, customList, queryCustomList } = handleContract();
 
@@ -457,6 +459,8 @@ export default defineComponent({
         const goodsList = ref<Goods[]>([]);
 
         function submit(OperateType: 1 | 2) {
+            console.log('toRaw(formState);', toRaw(formState));
+
             formRef.value
                 .validate()
                 .then(() => {
@@ -495,6 +499,7 @@ export default defineComponent({
                     console.log('error', error);
                 });
         }
+
         initData(() => {
             queryCustomList();
             getDeliveryGoods();

+ 3 - 281
src/views/information/spot-contract/components/add/setup.ts

@@ -1,128 +1,12 @@
-import { validateCommon } from '@/common/setup/validate';
 import APP from "@/services";
-import { getItemEnum } from '@/services/bus/allEnum';
-import { QueryCustomInfo } from '@/services/go/ermcp/customInfo';
-import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
-import { QueryDeliveryGoods, QueryDeliveryGoodsDetail } from '@/services/go/ermcp/goodsInfo';
-import { Ermcp3Brand, Ermcp3Wrstandard, ErmcpDeliveryGoodsRsp } from '@/services/go/ermcp/goodsInfo/interface';
 import {
     GldErmcpSpotContractOperateReq,
     GldSpotContractInfo
 } from "@/services/proto/spotcontract/interface";
 import { orderContractControl } from "@/views/information/spot-contract/components/setup";
-import { message } from 'ant-design-vue';
-import { RuleObject } from 'ant-design-vue/lib/form/interface';
-import moment, { Moment } from 'moment';
-import { reactive, Ref, ref, UnwrapRef } from 'vue';
-import { FormState } from "./interface";
-
-export function handleFromState() {
-    const formState: UnwrapRef<FormState> = reactive({
-        ContractNo: '', // 现货合同编号
-        ContractType: 1, // int32 现货合同类型-1:采购-1:销售
-        BizType: 1, // uint32 业务类型 - 1:套保 2:套利
-        BuyUserID: 0, // uint64 采购方ID
-        SellUserID: 0,// uint64 客户ID
-        ContractAttachment: new Uint8Array(),// bytes 合同附件
-        DeliveryGoodsID: undefined, // 现货品种ID
-        WrStandardID: undefined,  // uint64 现货商品ID
-        SpotGoodsBrandID: undefined, // uint64 现货品牌ID
-        ConvertFactor: undefined,// double 标仓系数
-        SpotGoodsDesc: '', // string 商品型号
-        PriceType: 1, // uint32 定价类型-1:一口价2:点价3:暂定价
-        Qty: null, // double 数量
-        Price: null,// double 价格暂定价[1:一口价、3:暂定价]
-        Amount: null, // double 金额[1:一口价、3:暂定价]
-        DeliveryStartDate: '', // string 交收期(开始)
-        DeliveryEndDate: '', // string 交收期(结束)
-        ContractMargin: null, // double 合同保证金
-        SaleUserID: undefined, // uint64 业务员ID
-        MerUserID: undefined, // uint64 跟单员ID
-        AccountID: undefined, // uint64 期货账户ID
-        Remark: '', // string 合同备注
-        CurrencyID: undefined, // 结算币种ID
-        GoodsID: undefined, // uint64 点价合约ID-0:为现货,其它为期货商品合约ID[2:点价3:暂定价]
-        PriceMove: null,// double 升贴水[2:点价3:暂定价]
-        StartDate: '', //                       点价开始时间
-        EndDate: '', //                           点价结束时间
-        TradeUserID: undefined, //           交易员ID
-    })
-    // 业务类型
-    const businessType = [
-        { key: 1, value: '套保' },
-        { key: 2, value: '套利' },
-    ];
-    // 验证合同类型
-    async function v_ContractType(rule: RuleObject, value: number) {
-        return validateCommon(value, '请选择合同类型')
-    }
-
-    // 验证业务类型
-    // async function v_BizType(rule: RuleObject, value: number) {
-    //     return validateCommon(value, '请选择业务类型')
-    // }
-
-    // 验证业务类型
-    async function v_BuyUser(rule: RuleObject, value: number) {
-        return validateCommon(value, '请选择采购方')
-    }
-
-    // 验证业务类型
-    async function v_SellUser(rule: RuleObject, value: number) {
-        return validateCommon(value, '请选择销售方')
-    }
-
-    // 验证现货品种
-    async function v_DeliveryGoods(rule: RuleObject, value: number) {
-        return validateCommon(value, '请选择现货品种')
-    }
-
-    // 验证品类
-    async function v_WrStandard(rule: RuleObject, value: number) {
-        const errorInfo = formState.DeliveryGoodsID ? '请选择品类' : '请先选择现货品种'
-        return validateCommon(value, errorInfo)
-    }
-
-    // 验证品牌
-    async function v_SpotGoodsBrand(rule: RuleObject, value: number) {
-        const errorInfo = formState.DeliveryGoodsID ? '请选择品牌' : '请先选择现货品种'
-        return validateCommon(value, errorInfo)
-    }
-
-    // 验证定价类型
-    async function v_PriceType(rule: RuleObject, value: number) {
-        return validateCommon(value, '请选择定价类型')
-    }
-
-    // 验证结算币种
-    async function v_Currency(rule: RuleObject, value: number) {
-        return validateCommon(value, '请选择结算币种')
-    }
-
-    // 验证点价合约
-    async function v_Goods(rule: RuleObject, value: number) {
-        return validateCommon(value, '请选择点价合约')
-    }
-    const rules = {
-        ContractNo: [{ required: true, message: '请输入合同编号', trigger: 'blur' }],
-        ContractType: [{ required: true, validator: v_ContractType, trigger: 'change' }],
-        // BizType: [{ required: true, validator: v_BizType, trigger: 'change' }],
-        BuyUserID: [{ required: true, validator: v_BuyUser, trigger: 'change' }],
-        SellUserID: [{ required: true, validator: v_SellUser, trigger: 'change' }],
-        DeliveryGoodsID: [{ required: true, validator: v_DeliveryGoods, trigger: 'change' }],
-        WrStandardID: [{ required: true, validator: v_WrStandard, trigger: 'blur' }],
-        SpotGoodsBrandID: [{ required: true, validator: v_SpotGoodsBrand, trigger: 'blur' }],
-        GoodsID: [{ required: true, validator: v_Goods, trigger: 'blur' }],
-        // ConvertFactor: [{ required: true, message: '请选择品类', trigger: 'blur' }],
-        SpotGoodsDesc: [{ required: true, message: '请输入商品规格', trigger: 'blur' }],
-        PriceType: [{ required: true, validator: v_PriceType, trigger: 'blur' }],
-        CurrencyID: [{ required: true, validator: v_Currency, trigger: 'blur' }],
-        Qty: [{ required: true, message: '请输入数量', trigger: 'blur' }],
-        Price: [{ required: true, message: '请输入价格', trigger: 'blur' }],
-        PriceMove: [{ required: true, message: '请输入升贴水', trigger: 'blur' }],
-    };
-    return { formState, businessType, rules }
-}
+import moment from 'moment';
+import { Ref } from 'vue';
+import { FormState } from "../interface";
 
 /**
  * 新增现货合同 表单提交
@@ -179,8 +63,6 @@ export function addContractReq() {
             Remark: '',
             Info: info,
         }
-        console.log('prams', params);
-
         return orderContractControl(params, loading)
             .then(res => {
                 return Promise.resolve(res);
@@ -191,164 +73,4 @@ export function addContractReq() {
     }
 
     return { sendReq }
-}
-
-/**
- * 合同类型
- */
-export function handleContract() {
-    // 合同类型
-    const contractType = [
-        { key: 1, value: '采购' },
-        { key: -1, value: '销售' },
-    ];
-    const isSell = ref<boolean>(false)  // true => 销售 false => 采购
-    /**
-     * 合同类型变更
-     */
-    function contractChange(value: number) {
-        isSell.value = value === 1 ? false : true;
-    }
-
-    const customList = ref<QueryCustomInfoType[]>([])
-
-    function queryCustomList() {
-        QueryCustomInfo(3)
-            .then((res) => {
-                customList.value = res
-                console.log('客户资料', customList);
-            })
-            .catch((err) => {
-                message.error(err);
-            })
-    }
-
-    return { contractType, isSell, contractChange, customList, queryCustomList }
-}
-
-
-/**
- * 处理现货商品
- */
-export function handleDeliveryGoods(formState: UnwrapRef<FormState>) {
-    // 现货品种
-    const deliveryGoodsList = ref<ErmcpDeliveryGoodsRsp[]>([])
-    // 品牌
-    const gblist = ref<Ermcp3Brand[]>([])
-    // 品类列表
-    const gmlist = ref<Ermcp3Wrstandard[]>([])
-
-    // 查询现货商品
-    function getDeliveryGoods() {
-        QueryDeliveryGoods({}).then(res => {
-            console.log('查询现货商品', res);
-            deliveryGoodsList.value = res;
-        }).catch(err => {
-            message.error(err)
-        })
-    }
-
-    // 切换现货商品
-    function deliveryGoodsChange(value: number | undefined) {
-        if (value !== undefined) {
-            getDeliveryGoodsDetail(value)
-        } else {
-            gblist.value.length = 0
-            gmlist.value.length = 0
-        }
-    }
-
-    // 查询现货商品详情
-    function getDeliveryGoodsDetail(deliverygoodsid: number) {
-        QueryDeliveryGoodsDetail(deliverygoodsid).then(res => {
-            if (res.length) {
-                gblist.value = res[0].gblist
-                gmlist.value = res[0].gmlist
-            }
-            console.log('查询品类', res);
-        }).catch(err => {
-            message.error(err)
-        })
-    }
-
-    const numberUnit = ref<string>('')
-
-    // 品类变更
-    function WrStandardChange(value: number) {
-        const obj = gmlist.value.find((e) => e.wrstandardid === value);
-        if (obj) {
-            //标仓系数
-            formState.ConvertFactor = obj.convertfactor;
-            // 单位
-            const unitInfo = getItemEnum('goodsunit').find(e => e.enumitemname === obj.unitid)
-            if (unitInfo) {
-                numberUnit.value = unitInfo.enumdicname
-            }
-        }
-    }
-
-    return {
-        deliveryGoodsList,
-        gblist,
-        gmlist,
-        numberUnit,
-        WrStandardChange,
-        getDeliveryGoods,
-        getDeliveryGoodsDetail,
-        deliveryGoodsChange
-    }
-}
-
-/**
- * 价格信息
- */
-export function handlePrice(formState: UnwrapRef<FormState>) {
-    // 定价类型
-    const priceType = [
-        { key: 1, value: '一口价' },
-        { key: 2, value: '点价' },
-        { key: 3, value: '暂定价' },
-    ];
-    // 币种
-    const payCurrency = getItemEnum('paycurrency')
-    console.log('payCurrency', payCurrency);
-    // 目前写死,获取枚举信息里面没有 单位名称,后期进行优化
-    const payCurrencyUnit = ref<string>('元')
-
-    // 切换币种
-    function parCurrencyChange(value: number) {
-        const obj = payCurrency.find(e => e.enumdicid === value)
-        console.log('切换币种', obj);
-
-        // payCurrencyUnit.value = obj?.enumdicname
-    }
-
-    return { priceType, payCurrency, payCurrencyUnit, parCurrencyChange }
-}
-
-/**
- * 处理日期
- */
-export function handleDate() {
-    // 交收期
-    const deliveryDate = ref<Moment[]>([])
-    // 点价期
-    const priceDate = ref<Moment[]>([]);
-
-    function disabledDate(current: Moment) {
-        // Can not select days before today and today
-        return current && current < moment().endOf('day');
-    }
-
-    return { deliveryDate, priceDate, disabledDate }
-}
-/**
- * 处理金额
- */
-export function handleAmout(formState: UnwrapRef<FormState>) {
-    function getAmout() {
-        const { Price, Qty } = formState
-        formState.Amount = (Price && Qty) ? Price * Qty : 0
-    }
-    return { getAmout }
 }

+ 1 - 1
src/views/information/spot-contract/components/add/interface.ts → src/views/information/spot-contract/components/interface.ts

@@ -4,7 +4,7 @@ export interface FormState {
     ContractType: number// int32 现货合同类型-1:采购-1:销售
     // UserID: number // uint64 机构ID
     BuyUserID: number // uint64 采购方ID
-    SellUserID: number // uint64 客户ID
+    SellUserID: number | undefined// uint64 客户ID
     // SignDate: string // string 签订日期
     ContractAttachment: Uint8Array // bytes 合同附件
     ContractMargin: number | null // double 合同保证金

+ 361 - 204
src/views/information/spot-contract/components/modify/index.vue

@@ -2,6 +2,7 @@
   <!-- 修改现货合同-->
   <a-modal class="commonModal modify-custom"
            title="修改现货合同"
+           v-if="visible"
            v-model:visible="visible"
            @cancel="cancel"
            width="890px">
@@ -11,77 +12,109 @@
                 :loading="loading"
                 @click="submit">完成</a-button>
     </template>
-    <a-form class="inlineForm">
+    <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="合同编号">
+            <a-form-item label="合同编号"
+                         name="ContractNo">
               <a-input class="dialogInput"
-                      style="width: 200px"
-                      placeholder="请输入合同编号" />
+                       style="width: 200px"
+                       v-model:value="formState.ContractNo"
+                       placeholder="请输入合同编号" />
             </a-form-item>
           </a-col>
           <a-col :span="12">
-            <a-form-item label="合同类型">
+            <a-form-item label="合同类型"
+                         name="ContractType">
               <a-select class="inlineFormSelect"
                         style="width: 200px"
+                        @change="contractChange"
+                        v-model:value="formState.ContractType"
                         placeholder="请选择合同类型">
-                <a-select-option value="1">
-                  客户一
-                </a-select-option>
-                <a-select-option value="2">
-                  客户二
+                <a-select-option v-for="item in contractType"
+                                 :key="item.key"
+                                 :value="item.key">
+                  {{item.value}}
                 </a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
-        </a-row>
-        <a-row :gutter="24">
           <a-col :span="12">
-            <a-form-item label="业务类型">
+            <a-form-item label="业务类型"
+                         name="BizType">
               <a-select class="inlineFormSelect"
                         style="width: 200px"
+                        v-model:value="formState.BizType"
                         placeholder="请选择业务类型">
-                <a-select-option value="1">
-                  客户一
-                </a-select-option>
-                <a-select-option value="2">
-                  客户二
-                </a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="采购方">
-                <span class="white">河北石家庄刚强矿石公司</span>
-            </a-form-item>
-          </a-col>
-      </a-row>
-      <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="销售方">
-              <a-select class="inlineFormSelect"
-                        style="width: 200px"
-                        placeholder="请选择销售方">
-                <a-select-option value="1">
-                  客户一
-                </a-select-option>
-                <a-select-option value="2">
-                  客户二
+                <a-select-option v-for="item in businessType"
+                                 :key="item.key"
+                                 :value="item.key">
+                  {{item.value}}
                 </a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
+          <template v-if="isSell">
+            <a-col :span="12">
+              <a-form-item label="采购方"
+                           name="BuyUserID">
+                <a-select class="inlineFormSelect"
+                          style="width: 200px"
+                          v-model:value="formState.BuyUserID"
+                          placeholder="请选择客户">
+                  <!-- 客户资料列表 正常 -->
+                  <a-select-option :value="i"
+                                   v-for="(item, i) in customList"
+                                   :key="item.userid">
+                    {{item.customername}}
+                  </a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="销售方">
+                <span class="white">{{getUserName()}}</span>
+              </a-form-item>
+            </a-col>
+          </template>
+          <template v-else>
+            <a-col :span="12">
+              <a-form-item label="采购方">
+                <span class="white">{{getUserName()}}</span>
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="销售方"
+                           name="SellUserID">
+                <a-select class="inlineFormSelect"
+                          v-model:value="formState.SellUserID"
+                          style="width: 200px"
+                          placeholder="请选择客户">
+                  <!-- 客户资料列表 正常 -->
+                  <a-select-option :value="i"
+                                   v-for="(item, i) in customList"
+                                   :key="item.userid">
+                    {{item.customername}}
+                  </a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+          </template>
           <a-col :span="12">
-            <a-form-item label="合同附件">
-                <div class="upload">
-                    <a-upload action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
-                                :transform-file="transformFile">
-                        <a-button class="uploadBtn">上传</a-button>
-                    </a-upload>
-                    <div class="look">查看附件</div>
-                </div>
+            <a-form-item label="合同附件"
+                         name="ContractAttachment">
+              <div class="upload">
+                <a-upload action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
+                          :transform-file="transformFile">
+                  <a-button class="uploadBtn">上传</a-button>
+                </a-upload>
+                <div class="look">查看附件</div>
+              </div>
             </a-form-item>
           </a-col>
         </a-row>
@@ -90,61 +123,69 @@
         <legend>现货信息</legend>
         <a-row :gutter="24">
           <a-col :span="12">
-            <a-form-item label="现货品种">
+            <a-form-item label="现货品种"
+                         name="DeliveryGoodsID">
               <a-select class="inlineFormSelect"
                         style="width: 200px"
+                        @change="deliveryGoodsChange"
+                        v-model:value="formState.DeliveryGoodsID"
                         placeholder="请选择现货品种">
-                <a-select-option value="1">
-                  客户一
-                </a-select-option>
-                <a-select-option value="2">
-                  客户二
+                <a-select-option v-for="item in deliveryGoodsList"
+                                 :key="item.deliverygoodsid"
+                                 :value="item.deliverygoodsid">
+                  {{item.deliverygoodsname}}
                 </a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
           <a-col :span="12">
-            <a-form-item label="品类">
+            <a-form-item label="品类"
+                         name="WrStandardID">
               <a-select class="inlineFormSelect"
                         style="width: 200px"
+                        @change="WrStandardChange"
+                        v-model:value="formState.WrStandardID"
                         placeholder="请选择品类">
-                <a-select-option value="1">
-                  客户一
-                </a-select-option>
-                <a-select-option value="2">
-                  客户二
+                <a-select-option v-for="item in gmlist"
+                                 :key="item.wrstandardid"
+                                 :value="item.wrstandardid">
+                  {{item.wrstandardname}}
                 </a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
-        </a-row>
-        <a-row :gutter="24">
           <a-col :span="12">
-            <a-form-item label="品牌">
+            <a-form-item label="品牌"
+                         name="SpotGoodsBrandID">
               <a-select class="inlineFormSelect"
                         style="width: 200px"
+                        v-model:value="formState.SpotGoodsBrandID"
                         placeholder="请选择品牌">
-                <a-select-option value="1">
-                  客户一
-                </a-select-option>
-                <a-select-option value="2">
-                  客户二
+                <a-select-option v-for="item in gblist"
+                                 :key="item.brandid"
+                                 :value="item.brandid">
+                  {{item.brandname}}
                 </a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
           <a-col :span="12">
-            <a-form-item label="标仓系数">
-                <span class="white">输入数量和价格后自动算</span>
+            <a-form-item label="标仓系数"
+                         name="ConvertFactor">
+              <a-input class="dialogInput"
+                       style="width: 200px"
+                       v-model:value="formState.ConvertFactor"
+                       readonly
+                       placeholder="选择品类后自动填入" />
             </a-form-item>
           </a-col>
-      </a-row>
-      <a-row :gutter="24">
           <a-col :span="24">
-            <a-form-item label="商品规格">
+            <a-form-item label="商品规格"
+                         name="SpotGoodsDesc">
               <a-input class="dialogInput"
-                      style="width: 200px"
-                      placeholder="请输入商品规格" />
+                       style="width: 200px"
+                       v-model:value="formState.SpotGoodsDesc"
+                       placeholder="请输入商品规格" />
             </a-form-item>
           </a-col>
         </a-row>
@@ -153,141 +194,165 @@
         <legend>价格信息</legend>
         <a-row :gutter="24">
           <a-col :span="12">
-            <a-form-item label="定价类型">
+            <a-form-item label="定价类型"
+                         name="PriceType">
               <a-select class="inlineFormSelect"
                         style="width: 200px"
+                        v-model:value="formState.PriceType"
                         placeholder="请选择定价类型">
-                <a-select-option value="1">
-                  点价
-                </a-select-option>
-                <a-select-option value="2">
-                  一口价
+                <a-select-option v-for="item in priceType"
+                                 :key="item.key"
+                                 :value="item.key">
+                  {{item.value}}
                 </a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
           <a-col :span="12">
-            <a-form-item label="数量">
-              <a-input class="dialogInput suffixGrey" placeholder="请输入数量" suffix="单位" />
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <!-- 以下是点价的价格信息 start -->
-        <!-- <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="点价合约">
+            <a-form-item label="结算币种"
+                         name="CurrencyID">
               <a-select class="inlineFormSelect"
+                        v-model:value="formState.CurrencyID"
                         style="width: 200px"
-                        placeholder="请选择点价合约">
-                <a-select-option value="1">
-                  合约一
-                </a-select-option>
-                <a-select-option value="2">
-                  合约二
+                        placeholder="请选择结算币种">
+                <a-select-option v-for="item in payCurrency"
+                                 :key="item.enumdicid"
+                                 :value="item.enumdicid">
+                  {{item.enumdicname}}
                 </a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
           <a-col :span="12">
-            <a-form-item label="升贴水">
-              <a-input class="dialogInput suffixGrey" placeholder="请输入升贴水" suffix="元/单位" style="width: 200px"/>
+            <a-form-item label="数量"
+                         name="Qty">
+              <a-input class="dialogInput suffixGrey"
+                       v-model:value="formState.Qty"
+                       style="width: 200px"
+                       @change="getAmout"
+                       placeholder="请输入数量"
+                       :suffix="numberUnit" />
             </a-form-item>
           </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="点价期">
-              <a-select class="inlineFormSelect"
-                        style="width: 95px"
-                        placeholder="请选择点价期">
-                <a-select-option value="1">
-                  日期一
-                </a-select-option>
-              </a-select>
-              <span class="to">-</span>
-              <a-select class="inlineFormSelect"
-                        style="width: 95px"
-                        placeholder="请选择定价类型">
-                <a-select-option value="1">
-                  日期二
-                </a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="交收期">
-              <a-select class="inlineFormSelect"
-                        style="width: 95px"
-                        placeholder="请选择定价类型">
-                <a-select-option value="1">
-                  日期一
-                </a-select-option>
-              </a-select>
-              <span class="to">-</span>
-              <a-select class="inlineFormSelect"
-                        style="width: 95px"
-                        placeholder="请选择定价类型">
-                <a-select-option value="1">
-                  日期二
-                </a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-        </a-row> -->
-        <!-- 以上是点价的价格信息 end -->
-        <a-row :gutter="24">
-          <a-col :span="12">
-            <a-form-item label="价格">
-              <a-input class="dialogInput suffixGrey" placeholder="请输入价格" suffix="元/单位" style="width: 200px"/>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="金额" class="relative">
-                <span class="white">输入数量和价格后自动算</span>
-                <span class="unit">元</span>
-            </a-form-item>
-          </a-col>
-      </a-row>
-      <a-row :gutter="24">
-          <a-col :span="24">
-            <a-form-item label="交收期">
-              <a-select class="inlineFormSelect"
-                        style="width: 95px"
-                        placeholder="请选择定价类型">
-                <a-select-option value="1">
-                  日期一
-                </a-select-option>
-              </a-select>
-              <span class="to">-</span>
-              <a-select class="inlineFormSelect"
-                        style="width: 95px"
-                        placeholder="请选择定价类型">
-                <a-select-option value="1">
-                  日期二
-                </a-select-option>
-              </a-select>
+          <a-col :span="12"
+                 v-if="formState.PriceType === 3">
+            <a-form-item label="暂定价">
+              <a-input class="dialogInput suffixGrey"
+                       style="width: 200px"
+                       :suffix="payCurrencyUnit"
+                       placeholder="请输入暂定价" />
             </a-form-item>
           </a-col>
+          <!-- 以下是点价的价格信息 start -->
+          <template v-if="formState.PriceType === 2 || formState.PriceType === 3">
+            <a-col :span="12">
+              <a-form-item label="点价合约"
+                           name="GoodsID">
+                <a-select class="inlineFormSelect"
+                          v-model:value="formState.GoodsID"
+                          style="width: 200px"
+                          placeholder="请选择点价合约">
+                  <a-select-option v-for="item in goodsList"
+                                   :key="item.goodsid"
+                                   :value="item.goodsid">
+                    {{item.goodsname}}
+                  </a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="升贴水"
+                           name="PriceMove">
+                <a-input class="dialogInput suffixGrey"
+                         v-model:value="formState.PriceMove"
+                         placeholder="请输入升贴水"
+                         :suffix="`${payCurrencyUnit}/${numberUnit}`"
+                         style="width: 200px" />
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="点价期">
+                <a-range-picker v-model:value="priceDate"
+                                class="commonPicker"
+                                :disabled-date="disabledDate"
+                                style="width: 200px"
+                                :show-time="{hideDisabledOptions: true}"
+                                format="YYYY-MM-DD" />
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="交收期">
+                <a-range-picker v-model:value="deliveryDate"
+                                class="commonPicker"
+                                style="width: 200px"
+                                :disabled-date="disabledDate"
+                                :show-time="{hideDisabledOptions: true}"
+                                format="YYYY-MM-DD" />
+              </a-form-item>
+            </a-col>
+          </template>
+          <!-- 以上是点价的价格信息 end -->
+          <template v-if="formState.PriceType === 1">
+            <a-col :span="12">
+              <a-form-item label="价格"
+                           name="Price">
+                <a-input class="dialogInput suffixGrey"
+                         v-model:value="formState.Price"
+                         @change="getAmout"
+                         placeholder="请输入价格"
+                         :suffix="`${payCurrencyUnit}/${numberUnit}`"
+                         style="width: 200px" />
+              </a-form-item>
+            </a-col>
+            <a-col :span="12">
+              <a-form-item label="金额"
+                           class="relative"
+                           name="Amount">
+                <a-input class="dialogInput suffixGrey"
+                         v-model:value="formState.Amount"
+                         readonly
+                         placeholder="输入数量和价格后自动算"
+                         :suffix="payCurrencyUnit"
+                         style="width: 200px" />
+              </a-form-item>
+            </a-col>
+            <a-col :span="24">
+              <a-form-item label="交收期">
+                <a-range-picker v-model:value="deliveryDate"
+                                style="width: 200px"
+                                class="commonPicker"
+                                :disabled-date="disabledDate"
+                                :show-time="{hideDisabledOptions: true}"
+                                format="YYYY-MM-DD" />
+              </a-form-item>
+            </a-col>
+          </template>
         </a-row>
       </fieldset>
       <fieldset class="formFieldSet">
         <legend>其他信息</legend>
         <a-row :gutter="24">
           <a-col :span="12">
-            <a-form-item label="保证金">
-              <a-input class="dialogInput suffixGrey" placeholder="请输入保证金" suffix="元" />
+            <a-form-item label="保证金"
+                         name="ContractMargin">
+              <a-input class="dialogInput suffixGrey"
+                       placeholder="请输入保证金"
+                       v-model:value="formState.ContractMargin"
+                       style="width: 200px"
+                       :suffix="payCurrencyUnit" />
             </a-form-item>
           </a-col>
           <a-col :span="12">
-            <a-form-item label="业务员">
+            <a-form-item label="业务员"
+                         name="SaleUserID">
               <a-select class="inlineFormSelect"
+                        v-model:value="formState.SaleUserID"
                         style="width: 200px"
                         placeholder="请选择业务员">
-                <a-select-option value="1">
-                  客户一
-                </a-select-option>
-                <a-select-option value="2">
-                  客户二
+                <a-select-option v-for="item in businesserList"
+                                 :key="item.id"
+                                 :value="item.id">
+                  {{item.name}}
                 </a-select-option>
               </a-select>
             </a-form-item>
@@ -295,40 +360,42 @@
         </a-row>
         <a-row :gutter="24">
           <a-col :span="12">
-            <a-form-item label="跟单员">
+            <a-form-item label="跟单员"
+                         name="MerUserID">
               <a-select class="inlineFormSelect"
+                        v-model:value="formState.MerUserID"
                         style="width: 200px"
                         placeholder="请选择跟单员">
-                <a-select-option value="1">
-                  客户一
-                </a-select-option>
-                <a-select-option value="2">
-                  客户二
+                <a-select-option v-for="item in merchandiserList"
+                                 :key="item.id"
+                                 :value="item.id">
+                  {{item.name}}
                 </a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
           <a-col :span="12">
-            <a-form-item label="期货账户">
-                <a-select class="inlineFormSelect"
+            <a-form-item label="交易用户"
+                         name="TradeUserID">
+              <a-select class="inlineFormSelect"
                         style="width: 200px"
+                        v-model:value="formState.TradeUserID"
                         placeholder="请选择期货账户">
-                <a-select-option value="1">
-                  客户一
-                </a-select-option>
-                <a-select-option value="2">
-                  客户二
+                <a-select-option v-for="item in traderList"
+                                 :key="item.id"
+                                 :value="item.id">
+                  {{item.name}}
                 </a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
-      </a-row>
-      <a-row :gutter="24">
+        </a-row>
+        <a-row :gutter="24">
           <a-col :span="24">
             <a-form-item label="备注">
               <a-input class="dialogInput"
-                      style="width: 608px"
-                      placeholder="请输入备注" />
+                       style="width: 608px"
+                       placeholder="请输入备注" />
             </a-form-item>
           </a-col>
         </a-row>
@@ -338,27 +405,117 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, ref } from 'vue';
+import { defineComponent, onMounted, PropType, ref, toRaw, watchEffect } from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
+import { initData } from '@/common/methods';
+import { getUserName, getUsrId } from '@/services/bus/user';
+import { getGoodsList } from '@/services/bus/goods';
+import { Goods } from '@/services/go/ermcp/goodsInfo/interface';
+import { ValidateErrorEntity } from 'ant-design-vue/lib/form/interface';
+import { FormState } from '../interface';
+import { formatTime } from '@/common/methods/format';
+import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
+import { handleAccountManager } from '../setup';
+import { Moment } from 'moment';
+import { handleFormRule, handleContract, handleDeliveryGoods, handleAmout, handlePrice, handleDate, handleFromState } from '../setup';
 
+interface Obj {
+    [props: string]: any;
+}
 export default defineComponent({
     name: 'modify-spot-contract',
+    props: {
+        selectedRow: {
+            type: Object as PropType<Ermcp3ContractRsp>,
+            default: {},
+        },
+    },
     components: {},
-    setup() {
+    setup(props, context) {
         const { visible, cancel } = closeModal('spot_contract_btn_modify');
         const loading = ref<boolean>(false);
-        function submit() {
-            loading.value = true;
-            setTimeout(() => {
-                loading.value = false;
-                cancel();
-            }, 2000);
-        }
+        const { formState, businessType } = handleFromState();
+        console.log('props.selectedRow', props.selectedRow);
+
+        // 表单
+        const formRef = ref();
+
+        const { rules } = handleFormRule(formState);
+        // 合同类型
+        const { contractType, isSell, contractChange, customList, queryCustomList } = handleContract();
+
+        //  处理现货商品
+        const { deliveryGoodsList, gblist, gmlist, numberUnit, WrStandardChange, getDeliveryGoods, deliveryGoodsChange } = handleDeliveryGoods(formState);
+        // 价格信息
+        const { priceType, payCurrency, payCurrencyUnit, parCurrencyChange } = handlePrice(formState);
+        // 日期
+        const { deliveryDate, priceDate, disabledDate } = handleDate();
+        // 处理金额
+        const { getAmout } = handleAmout(formState);
+        // 账号列表: 交易用户 业务员 跟单员
+        const { traderList, businesserList, merchandiserList, getRoleList, getBusinesserList } = handleAccountManager();
+        // 现货商品列表
+        const goodsList = ref<Goods[]>([]);
+        watchEffect(() => {
+            // // formState.ContractAttachment = props.selectedRow.attachment
+            // formState.ContractAttachment = new Uint8Array()
+            // formState.SpotGoodsBrandID = +props.selectedRow.spotcontractid
+            if (props.selectedRow.contractno) {
+                // 处理第一次加载的
+                const obj: Obj = {};
+                Object.keys(formState).forEach((el) => {
+                    const key = el.toLocaleLowerCase() as keyof Ermcp3ContractRsp;
+                    if (Reflect.has(props.selectedRow, key)) {
+                        obj[el] = props.selectedRow[key];
+                    } else {
+                        console.warn(`${key}不对应`);
+                    }
+                });
+                Object.assign(formState, obj);
+                props.selectedRow.deliverygoodsid && deliveryGoodsChange(props.selectedRow.deliverygoodsid);
+            }
+        });
+        function submit() {}
+        initData(() => {
+            queryCustomList();
+            getDeliveryGoods();
+            goodsList.value = getGoodsList();
+            getRoleList();
+            getBusinesserList();
+        });
         return {
             visible,
             cancel,
             submit,
+            formRef,
             loading,
+            maskClosableFlag: false,
+            formState,
+            rules,
+            businessType,
+            contractType,
+            isSell,
+            contractChange,
+            customList,
+            deliveryGoodsList,
+            gblist,
+            gmlist,
+            deliveryGoodsChange,
+            WrStandardChange,
+            priceType,
+            payCurrency,
+            payCurrencyUnit,
+            parCurrencyChange,
+            numberUnit,
+            getUserName,
+            deliveryDate,
+            priceDate,
+            disabledDate,
+            goodsList,
+            getAmout,
+            traderList,
+            businesserList,
+            merchandiserList,
         };
     },
 });

+ 77 - 0
src/views/information/spot-contract/components/modify/setup.ts

@@ -0,0 +1,77 @@
+import APP from "@/services";
+import {
+    GldErmcpSpotContractOperateReq,
+    GldSpotContractInfo
+} from "@/services/proto/spotcontract/interface";
+import { orderContractControl } from "@/views/information/spot-contract/components/setup";
+import moment from 'moment';
+import { Ref } from 'vue';
+import { FormState } from "../interface";
+
+
+/**
+ * 新增现货合同 表单提交
+ */
+export function addContractReq() {
+    /**
+     * @param form 表单信息
+     *  @Param type  1: 保存草稿  2: 提交申请
+     */
+    function sendReq(form: FormState, loading: Ref<boolean>, OperateType: 1 | 2): Promise<string> {
+        loading.value = true
+        const info: GldSpotContractInfo = {
+            UserID: APP.get('userAccount').memberuserid,//  机构ID
+            ProductType: 1, //                              产品类型 产品类型-1:标准仓单2:等标3:非标
+            ContractNo: form.ContractNo,      //            现货合同编号
+            ContractType: form.ContractType, //             现货合同类型-1:采购-1:销售
+            BuyUserID: form.BuyUserID, //                   采购方ID
+            SellUserID: form.SellUserID,//                  客户ID
+            DeliveryGoodsID: form.DeliveryGoodsID as number,//   现货品种ID
+            WrStandardID: form.WrStandardID as number,//         品类ID
+            SpotGoodsBrandID: form.SpotGoodsBrandID as number,// 品牌ID
+            ConvertFactor: form.ConvertFactor as number, //      标仓系数
+            SpotGoodsDesc: form.SpotGoodsDesc, //                商品规格
+            PriceType: form.PriceType,//                         定价类型
+            CurrencyID: form.CurrencyID as number,//             结算币种
+            Qty: Number(form.Qty as number), //                     数量
+            Price: Number(form.Price as number), //                 价格
+            TradeDate: moment().format("YYYYMMDD"),//             交易日
+            SignDate: moment().format("YYYY-MM-DD HH:mm:ss"), //  签订日期
+            // 以上必填
+            // 以下选填
+            BizType: form.BizType, //                       业务类型 - 1:套保 2:套利
+            Remark: form.Remark,  //       合同备注
+            // ContractAttachment: ,  // 合同附件
+            ContractMargin: form.ContractMargin ? Number(form.ContractMargin) : 0, //         合同保证金
+
+            Amount: [1, 3].includes(form.PriceType) ? Number(form.Price) * Number(form.Qty) : 0, //    金额
+            PriceMove: Number(form.PriceMove as number), //  升贴水
+
+            StartDate: form.StartDate, //                       点价开始时间
+            EndDate: form.EndDate, //                           点价结束时间
+            DeliveryStartDate: form.DeliveryStartDate,//        交收期开始
+            DeliveryEndDate: form.DeliveryEndDate, //           交收期结束
+
+            GoodsID: form.GoodsID as number, //               点价合约ID-0:为现货,其它为期货商品合约ID[2:点价3:暂定价]
+
+            MerUserID: form.MerUserID || 0, //             跟单员ID
+            TradeUserID: form.TradeUserID || 0, //           交易员ID
+            SaleUserID: form.SaleUserID || 0,//             业务员id
+        }
+        const params: GldErmcpSpotContractOperateReq = {
+            SpotContractID: '0',
+            OperateType,
+            Remark: '',
+            Info: info,
+        }
+        return orderContractControl(params, loading)
+            .then(res => {
+                return Promise.resolve(res);
+            })
+            .catch(err => {
+                return Promise.reject(err);
+            })
+    }
+
+    return { sendReq }
+}

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

@@ -1,6 +1,12 @@
 import { commonResultInfo, getRequestResultInfo } from "@/common/methods/request";
+import { validateCommon } from "@/common/setup/validate";
+import { getItemEnum } from "@/services/bus/allEnum";
 import { QueryAccMgrLoginUser } from "@/services/go/ermcp/account";
 import { ErmcpLoginUser } from "@/services/go/ermcp/account/interface";
+import { QueryCustomInfo } from "@/services/go/ermcp/customInfo";
+import { QueryCustomInfoType } from "@/services/go/ermcp/customInfo/interface";
+import { QueryDeliveryGoods, QueryDeliveryGoodsDetail } from "@/services/go/ermcp/goodsInfo";
+import { Ermcp3Brand, Ermcp3Wrstandard, ErmcpDeliveryGoodsRsp } from "@/services/go/ermcp/goodsInfo/interface";
 import { orderContract, spotContractStatus } from "@/services/proto/spotcontract";
 import {
     GldErmcpSpotContractOperateReq,
@@ -8,9 +14,14 @@ import {
 } from "@/services/proto/spotcontract/interface";
 import { ContractStateSign, GldContractStateSign } from "@/views/information/spot-contract/setup";
 import { message } from "ant-design-vue";
+import { RuleObject } from "ant-design-vue/lib/form/interface";
 import Long from 'long';
-import { ref, Ref } from "vue";
+import moment, { Moment } from "moment";
+import { reactive, ref, Ref, UnwrapRef } from "vue";
 import { Value } from "./check/interface";
+import { FormState } from './interface';
+
+
 
 /**
  * 合同操作相关 针对操作类型 1: 保存草稿  2: 提交申请 3: 删除成功 4:审核通过
@@ -118,4 +129,284 @@ export function handleAccountManager() {
         }).catch(err => message.error(err))
     }
     return { traderList, businesserList, merchandiserList, getRoleList, getBusinesserList }
+}
+
+/**
+ * 新增和修改的表单数据
+ * @returns 
+ */
+export function handleFromState() {
+    const formState: UnwrapRef<FormState> = reactive({
+        ContractNo: '', // 现货合同编号
+        ContractType: 1, // int32 现货合同类型-1:采购-1:销售
+        BizType: 1, // uint32 业务类型 - 1:套保 2:套利
+        BuyUserID: 0, // uint64 采购方ID
+        SellUserID: undefined,// uint64 客户ID
+        ContractAttachment: new Uint8Array(),// bytes 合同附件
+        DeliveryGoodsID: undefined, // 现货品种ID
+        WrStandardID: undefined,  // uint64 现货商品ID
+        SpotGoodsBrandID: undefined, // uint64 现货品牌ID
+        ConvertFactor: undefined,// double 标仓系数
+        SpotGoodsDesc: '', // string 商品型号
+        PriceType: 1, // uint32 定价类型-1:一口价2:点价3:暂定价
+        Qty: null, // double 数量
+        Price: null,// double 价格暂定价[1:一口价、3:暂定价]
+        Amount: null, // double 金额[1:一口价、3:暂定价]
+        DeliveryStartDate: '', // string 交收期(开始)
+        DeliveryEndDate: '', // string 交收期(结束)
+        ContractMargin: null, // double 合同保证金
+        SaleUserID: undefined, // uint64 业务员ID
+        MerUserID: undefined, // uint64 跟单员ID
+        AccountID: undefined, // uint64 期货账户ID
+        Remark: '', // string 合同备注
+        CurrencyID: undefined, // 结算币种ID
+        GoodsID: undefined, // uint64 点价合约ID-0:为现货,其它为期货商品合约ID[2:点价3:暂定价]
+        PriceMove: null,// double 升贴水[2:点价3:暂定价]
+        StartDate: '', //                       点价开始时间
+        EndDate: '', //                           点价结束时间
+        TradeUserID: undefined, //           交易员ID
+    })
+    // 业务类型
+    const businessType = [
+        { key: 1, value: '套保' },
+        { key: 2, value: '套利' },
+    ];
+
+    return { formState, businessType }
+}
+
+/**
+ * 表单新增和修改验证规则
+ */
+export function handleFormRule(formState: UnwrapRef<FormState>) {
+    // 验证合同类型
+    async function v_ContractType(rule: RuleObject, value: number) {
+        return validateCommon(value, '请选择合同类型')
+    }
+
+    // 验证业务类型
+    // async function v_BizType(rule: RuleObject, value: number) {
+    //     return validateCommon(value, '请选择业务类型')
+    // }
+
+    // 验证业务类型
+    async function v_BuyUser(rule: RuleObject, value: number) {
+        return validateCommon(value, '请选择采购方')
+    }
+
+    // 验证业务类型
+    async function v_SellUser(rule: RuleObject, value: number) {
+        return validateCommon(value, '请选择销售方')
+    }
+
+    // 验证现货品种
+    async function v_DeliveryGoods(rule: RuleObject, value: number) {
+        return validateCommon(value, '请选择现货品种')
+    }
+
+    // 验证品类
+    async function v_WrStandard(rule: RuleObject, value: number) {
+        const errorInfo = formState.DeliveryGoodsID ? '请选择品类' : '请先选择现货品种'
+        return validateCommon(value, errorInfo)
+    }
+
+    // 验证品牌
+    async function v_SpotGoodsBrand(rule: RuleObject, value: number) {
+        const errorInfo = formState.DeliveryGoodsID ? '请选择品牌' : '请先选择现货品种'
+        return validateCommon(value, errorInfo)
+    }
+
+    // 验证定价类型
+    async function v_PriceType(rule: RuleObject, value: number) {
+        return validateCommon(value, '请选择定价类型')
+    }
+
+    // 验证结算币种
+    async function v_Currency(rule: RuleObject, value: number) {
+        return validateCommon(value, '请选择结算币种')
+    }
+
+    // 验证点价合约
+    async function v_Goods(rule: RuleObject, value: number) {
+        return validateCommon(value, '请选择点价合约')
+    }
+    const rules = {
+        ContractNo: [{ required: true, message: '请输入合同编号', trigger: 'blur' }],
+        ContractType: [{ required: true, validator: v_ContractType, trigger: 'change' }],
+        // BizType: [{ required: true, validator: v_BizType, trigger: 'change' }],
+        BuyUserID: [{ required: true, validator: v_BuyUser, trigger: 'change' }],
+        SellUserID: [{ required: true, validator: v_SellUser, trigger: 'change' }],
+        DeliveryGoodsID: [{ required: true, validator: v_DeliveryGoods, trigger: 'change' }],
+        WrStandardID: [{ required: true, validator: v_WrStandard, trigger: 'blur' }],
+        SpotGoodsBrandID: [{ required: true, validator: v_SpotGoodsBrand, trigger: 'blur' }],
+        GoodsID: [{ required: true, validator: v_Goods, trigger: 'blur' }],
+        // ConvertFactor: [{ required: true, message: '请选择品类', trigger: 'blur' }],
+        SpotGoodsDesc: [{ required: true, message: '请输入商品规格', trigger: 'blur' }],
+        PriceType: [{ required: true, validator: v_PriceType, trigger: 'blur' }],
+        CurrencyID: [{ required: true, validator: v_Currency, trigger: 'blur' }],
+        Qty: [{ required: true, message: '请输入数量', trigger: 'blur' }],
+        Price: [{ required: true, message: '请输入价格', trigger: 'blur' }],
+        PriceMove: [{ required: true, message: '请输入升贴水', trigger: 'blur' }],
+    };
+    return { rules }
+}
+
+/**
+ * 合同类型
+ */
+export function handleContract() {
+    // 合同类型
+    const contractType = [
+        { key: 1, value: '采购' },
+        { key: -1, value: '销售' },
+    ];
+    const isSell = ref<boolean>(false)  // true => 销售 false => 采购
+    /**
+     * 合同类型变更
+     */
+    function contractChange(value: number) {
+        isSell.value = value === 1 ? false : true;
+    }
+
+    const customList = ref<QueryCustomInfoType[]>([])
+
+    function queryCustomList() {
+        QueryCustomInfo(3)
+            .then((res) => {
+                customList.value = res
+                console.log('客户资料', customList);
+            })
+            .catch((err) => {
+                message.error(err);
+            })
+    }
+
+    return { contractType, isSell, contractChange, customList, queryCustomList }
+}
+
+
+/**
+ * 处理现货商品
+ */
+export function handleDeliveryGoods(formState: UnwrapRef<FormState>) {
+    // 现货品种
+    const deliveryGoodsList = ref<ErmcpDeliveryGoodsRsp[]>([])
+    // 品牌
+    const gblist = ref<Ermcp3Brand[]>([])
+    // 品类列表
+    const gmlist = ref<Ermcp3Wrstandard[]>([])
+
+    // 查询现货商品
+    function getDeliveryGoods() {
+        QueryDeliveryGoods({}).then(res => {
+            console.log('查询现货商品', res);
+            deliveryGoodsList.value = res;
+        }).catch(err => {
+            message.error(err)
+        })
+    }
+
+    // 切换现货商品
+    function deliveryGoodsChange(value: number | undefined) {
+        if (value !== undefined) {
+            getDeliveryGoodsDetail(value)
+        } else {
+            gblist.value.length = 0
+            gmlist.value.length = 0
+        }
+    }
+
+    // 查询现货商品详情
+    function getDeliveryGoodsDetail(deliverygoodsid: number) {
+        QueryDeliveryGoodsDetail(deliverygoodsid).then(res => {
+            if (res.length) {
+                gblist.value = res[0].gblist
+                gmlist.value = res[0].gmlist
+            }
+            console.log('查询品类', res);
+        }).catch(err => {
+            message.error(err)
+        })
+    }
+
+    const numberUnit = ref<string>('')
+
+    // 品类变更
+    function WrStandardChange(value: number) {
+        const obj = gmlist.value.find((e) => e.wrstandardid === value);
+        if (obj) {
+            //标仓系数
+            formState.ConvertFactor = obj.convertfactor;
+            // 单位
+            const unitInfo = getItemEnum('goodsunit').find(e => e.enumitemname === obj.unitid)
+            if (unitInfo) {
+                numberUnit.value = unitInfo.enumdicname
+            }
+        }
+    }
+
+    return {
+        deliveryGoodsList,
+        gblist,
+        gmlist,
+        numberUnit,
+        WrStandardChange,
+        getDeliveryGoods,
+        getDeliveryGoodsDetail,
+        deliveryGoodsChange
+    }
+}
+
+/**
+ * 价格信息
+ */
+export function handlePrice(formState: UnwrapRef<FormState>) {
+    // 定价类型
+    const priceType = [
+        { key: 1, value: '一口价' },
+        { key: 2, value: '点价' },
+        { key: 3, value: '暂定价' },
+    ];
+    // 币种
+    const payCurrency = getItemEnum('paycurrency')
+    console.log('payCurrency', payCurrency);
+    // 目前写死,获取枚举信息里面没有 单位名称,后期进行优化
+    const payCurrencyUnit = ref<string>('元')
+
+    // 切换币种
+    function parCurrencyChange(value: number) {
+        const obj = payCurrency.find(e => e.enumdicid === value)
+        console.log('切换币种', obj);
+
+        // payCurrencyUnit.value = obj?.enumdicname
+    }
+
+    return { priceType, payCurrency, payCurrencyUnit, parCurrencyChange }
+}
+
+/**
+ * 处理日期
+ */
+export function handleDate() {
+    // 交收期
+    const deliveryDate = ref<Moment[]>([])
+    // 点价期
+    const priceDate = ref<Moment[]>([]);
+
+    function disabledDate(current: Moment) {
+        // Can not select days before today and today
+        return current && current < moment().endOf('day');
+    }
+
+    return { deliveryDate, priceDate, disabledDate }
+}
+/**
+ * 处理金额
+ */
+export function handleAmout(formState: UnwrapRef<FormState>) {
+    function getAmout() {
+        const { Price, Qty } = formState
+        formState.Amount = (Price && Qty) ? Price * Qty : 0
+    }
+    return { getAmout }
 }