浏览代码

修改现货合同

huangbin 4 年之前
父节点
当前提交
f467def151

+ 6 - 6
src/goServiceAPI/ermcp/spot-contract/index.ts

@@ -1,7 +1,6 @@
 /** ================================= 现货合同 ================================**/
-import APP from "@/services";
-import {commonSearch_go} from "@/goServiceAPI";
-import {Ermcp3ContractReq, Ermcp3ContractRsp} from "@/goServiceAPI/ermcp/spot-contract/interface";
+import { commonSearch_go } from "@/goServiceAPI";
+import { Ermcp3ContractReq, Ermcp3ContractRsp } from "@/goServiceAPI/ermcp/spot-contract/interface";
 
 /**
  * 查询现货合同 /Ermcp3/QuerySpotContract
@@ -11,9 +10,10 @@ import {Ermcp3ContractReq, Ermcp3ContractRsp} from "@/goServiceAPI/ermcp/spot-co
  * @param req.contractid 合同ID(SpotContractId) (非必填)
  * @constructor
  */
-export function QuerySpotContract( req : Ermcp3ContractReq) : Promise<Ermcp3ContractRsp[]>{
-    const areauserid = APP.get('userAccount').memberuserid; // 所属机构id
-    return commonSearch_go('/Ermcp3/QuerySpotContract', {areauserid ,  ...req})
+export function QuerySpotContract(req: Ermcp3ContractReq): Promise<Ermcp3ContractRsp[]> {
+    // const areauserid = APP.get('userAccount').memberuserid; // 所属机构id
+    const areauserid = 10000; // 所属机构id
+    return commonSearch_go('/Ermcp3/QuerySpotContract', { areauserid, ...req })
         .catch(err => {
             throw new Error(`查询现货合同: ${err.message}`);
         })

+ 62 - 62
src/goServiceAPI/ermcp/spot-contract/interface.ts

@@ -1,71 +1,71 @@
 /**
  * 现货合同请求
  */
-export interface Ermcp3ContractReq{
-    querytype:  number    //  查询类型 1-未提交 2-待审核 3-履约中 4-已完成
-    userid? :   number    //  用户ID
-    usertype? : number    //  用户类型 2-机构 7-企业成员
-    contractid? : string  //  合同ID(SpotContractId)
+export interface Ermcp3ContractReq {
+    querytype: number    //  查询类型 1-未提交 2-待审核 3-履约中 4-已完成
+    userid?: number    //  用户ID
+    usertype?: number    //  用户类型 2-机构 7-企业成员
+    contractid?: string  //  合同ID(SpotContractId)
 }
 
 /**
  * 现货合同返回
  */
-export interface Ermcp3ContractRsp{
-    accountid	:string;//期货账户id
-    amount	:number;//金额 [1:一口价、3:暂定价]
-    attachment	:string;//附件
-    auditremark	:string;//审核意见
-    audittime	:string;//审核时间
-    biztype	:number;//业务类型 1-套保 2-套利
-    brandname	:string;//品牌名称
-    buynickname	:string;//销售方昵称
-    buyuserid	:number;//采购方ID
-    buyusername	:string;//采购方名称
-    contracctstatus	:number;//合同状态 - number;
-//:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回
-    contractmargin	:number;//合同保证金
-    contractno	:string;//现货合同编号
-    contracttype	:number;//现货合同类型 - 1:采购 -1:销售
-    convertfactor	:number;//标仓系数(品类)
-    createtime	:string;//创建时间
-    deliveryenddate	:string;//交收期(结束)
-    deliverygoodscode	:string;//现货品种代码
-    deliverygoodsid	:number;//现货品种ID
-    deliverygoodsname	:string;//现货品种名称
-    deliverystartdate	:string;//交收期(开始)
-    enddate	:string;//点价结束日期 [2:点价 3:暂定价]
-    enumdicname	:string;//单位名称
-    goodscode	:string;//点价合约代码
-    goodsid	:number;//点价合约ID - number;
-//:为现货,其它为期货商品合约ID [2:点价 3:暂定价]
-    goodsname	:string;//点价商品名称
-    margin	:number;//当前保证金
-    meruserid	:number;//跟单员id
-    meruserlogincode	:string;//跟单员登录代码
-    price	:number;//价格\暂定价 [1:一口价、3:暂定价]
-    pricemove	:number;//升贴水 [2:点价 3:暂定价]
-    pricetype	:number;//定价类型 - 1:一口价 2:点价 3:暂定价
-    producttype	:number;//产品类型 - 1:标准仓单 2:等标 3:非标
-    qty	:number;//数量
-    remark	:string;//备注
-    saleuserid	:number;//业务员id
-    saleuserlogincode	:string;//业务员登录代码
-    sellnickname	:string;//采购方昵称
-    selluserid	:number;//销售方ID
-    sellusername	:string;//销售方名称
-    spotcontractid	:string;//现货合同ID(6number;
-//2+Unix秒时间戳(1number;
-//位)+xxxxxx)
-    spotgoodsbrandid	:number;//现货品牌ID(DGFactoryItem表的ID)
-    spotgoodsdesc	:string;//商品型号
-    startdate	:string;//点价开始日期 [2:点价 3:暂定价]
-    tradeuserid	:number;//交易员id
-    tradeuserlogincode	:string;//交易员登录代码
-    unitid	:number;//单位id(取品类上的单位id)
-    updatetime	:string;//更新时间
-    userid	:number;//所属机构ID
-    wrstandardcode	:string;//品类代码
-    wrstandardid	:number;//品类ID
-    wrstandardname	:string;//品类名称
+export interface Ermcp3ContractRsp {
+    accountid: string;//期货账户id
+    amount: number;//金额 [1:一口价、3:暂定价]
+    attachment: string;//附件
+    auditremark: string;//审核意见
+    audittime: string;//审核时间
+    biztype: number;//业务类型 1-套保 2-套利
+    brandname: string;//品牌名称
+    buynickname: string;//销售方昵称
+    buyuserid: number;//采购方ID
+    buyusername: string;//采购方名称
+    contracctstatus: number;//合同状态 - number;
+    //:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回
+    contractmargin: number;//合同保证金
+    contractno: string;//现货合同编号
+    contracttype: number;//现货合同类型 - 1:采购 -1:销售
+    convertfactor: number;//标仓系数(品类)
+    createtime: string;//创建时间
+    deliveryenddate: string;//交收期(结束)
+    deliverygoodscode: string;//现货品种代码
+    deliverygoodsid: number;//现货品种ID
+    deliverygoodsname: string;//现货品种名称
+    deliverystartdate: string;//交收期(开始)
+    enddate: string;//点价结束日期 [2:点价 3:暂定价]
+    enumdicname: string;//单位名称
+    goodscode: string;//点价合约代码
+    goodsid: number;//点价合约ID - number;
+    //:为现货,其它为期货商品合约ID [2:点价 3:暂定价]
+    goodsname: string;//点价商品名称
+    margin: number;//当前保证金
+    meruserid: number;//跟单员id
+    meruserlogincode: string;//跟单员登录代码
+    price: number;//价格\暂定价 [1:一口价、3:暂定价]
+    pricemove: number;//升贴水 [2:点价 3:暂定价]
+    pricetype: number;//定价类型 - 1:一口价 2:点价 3:暂定价
+    producttype: number;//产品类型 - 1:标准仓单 2:等标 3:非标
+    qty: number;//数量
+    remark: string;//备注
+    saleuserid: number;//业务员id
+    saleuserlogincode: string;//业务员登录代码
+    sellnickname: string;//采购方昵称
+    selluserid: number;//销售方ID
+    sellusername: string;//销售方名称
+    spotcontractid: string;//现货合同ID(6number;
+    //2+Unix秒时间戳(1number;
+    //位)+xxxxxx)
+    spotgoodsbrandid: number;//现货品牌ID(DGFactoryItem表的ID)
+    spotgoodsdesc: string;//商品型号
+    startdate: string;//点价开始日期 [2:点价 3:暂定价]
+    tradeuserid: number;//交易员id
+    tradeuserlogincode: string;//交易员登录代码
+    unitid: number;//单位id(取品类上的单位id)
+    updatetime: string;//更新时间
+    userid: number;//所属机构ID
+    wrstandardcode: string;//品类代码
+    wrstandardid: number;//品类ID
+    wrstandardname: string;//品类名称
 }

+ 1 - 7
src/views/information/custom/compoments/filterTable/index.vue

@@ -24,15 +24,11 @@
     <a-button class="selectBtn"
               @click="reset">重置</a-button>
     <slot></slot>
-
-    <!-- 新增弹窗 -->
-    <AddCustom />
   </div>
 </template>
 
 <script lang="ts">
 import { defineComponent, ref, SetupContext } from 'vue';
-import AddCustom from '../addCustom/index.vue';
 
 // 搜索
 function handleSearch(context: SetupContext) {
@@ -67,9 +63,7 @@ function handleSearch(context: SetupContext) {
 
 export default defineComponent({
     name: 'filter-custom-table',
-    components: {
-        AddCustom,
-    },
+    components: {},
     setup(props, context) {
         return {
             ...handleSearch(context),

+ 1 - 1
src/views/information/custom/list/setup.ts

@@ -6,7 +6,7 @@ import { ColumnType, getTableHead } from '@/services/bus/table';
 import { message } from 'ant-design-vue';
 import { inject, Ref, ref } from 'vue';
 
-// 查询客户资料列表
+// 客户资料列表
 export function getCustomList() {
     // 表格数据
     const customList = ref<QueryCustomInfoType[]>([]);

+ 1 - 1
src/views/information/custom/list/stop-use/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <!-- 客户信息: 正常 -->
+  <!-- 客户信息: 停用 -->
   <div class="custom-normal"
        :loading="loading">
     <filterCustomTable @search="search">

+ 154 - 0
src/views/information/spot-contract/components/filterTable/index.vue

@@ -0,0 +1,154 @@
+<template>
+  <!-- 过滤客户资料表格 -->
+  <div class="filter-custom-table">
+    <a-select label-in-value
+              class="conditionSelect"
+              style="width: 120px"
+              v-model:value="contracttype"
+              placeholder="全部合同类型"
+              @change="handleChange">
+      <a-select-option value="1">采购</a-select-option>
+      <a-select-option value="-1">销售</a-select-option>
+    </a-select>
+    <a-select label-in-value
+              class="conditionSelect"
+              style="width: 120px"
+              v-model:value="pricetype"
+              placeholder="全部定价类型"
+              @change="handlePricetype">
+      <a-select-option value="1">一口价</a-select-option>
+      <a-select-option value="2">点价</a-select-option>
+      <a-select-option value="3">暂定价</a-select-option>
+    </a-select>
+    <a-input v-model:value="contractno"
+             class="tableConditionInput"
+             placeholder="模糊搜索合同编号" />
+    <a-input v-model:value="negative"
+             class="tableConditionInput"
+             placeholder="模糊搜索对手方" />
+    <a-button class="selectBtn"
+              @click="search">查询</a-button>
+    <a-button class="selectBtn"
+              @click="reset">重置</a-button>
+    <slot></slot>
+
+    <!-- 新增弹窗 -->
+
+  </div>
+</template>
+
+<script lang="ts">
+import { defineComponent, ref, SetupContext } from 'vue';
+
+// 搜索
+function handleSearch(context: SetupContext) {
+    const contractno = ref<string>('');
+    const negative = ref<string>('');
+    interface Value {
+        key: string;
+        value: string;
+    }
+    // 全部合同类型
+    let useType = '';
+    const contracttype = ref<number>(0);
+    function handleChange(value: Value) {
+        useType = value.value;
+        search();
+    }
+    // 全部定价类型
+    const pricetype = ref<number>(0);
+    let cachePricetype = '';
+    function handlePricetype(value: Value) {
+        cachePricetype = value.value;
+        search();
+    }
+    function search() {
+        const result = { contractno: [contractno.value], negative: [negative.value], contracttype: [useType], pricetype: [cachePricetype] };
+        context.emit('search', result);
+    }
+    function reset() {
+        contractno.value = '';
+        negative.value = '';
+
+        contracttype.value = 0;
+        useType = '';
+        pricetype.value = 0;
+        cachePricetype = '';
+        search();
+    }
+
+    return { contractno, negative, search, reset, contracttype, handleChange, pricetype, handlePricetype };
+}
+
+export default defineComponent({
+    name: 'filter-spot-contract-table',
+    components: {},
+    setup(props, context) {
+        return {
+            ...handleSearch(context),
+        };
+    },
+});
+</script>
+
+<style lang="less">
+.filter-custom-table {
+    width: 100%;
+    display: inline-flex;
+    padding-top: 9px;
+    padding-bottom: 6px;
+}
+.ant-select-single:not(.ant-select-customize-input) {
+    margin-right: 10px;
+    // background: #252D34;
+    // .rounded-corners(3px);
+    .ant-select-selector {
+        height: 30px;
+        padding: 0 8px;
+        background: @m-grey9;
+        border: none;
+        .rounded-corners(3px);
+        color: @m-grey10;
+        .ant-select-arrow {
+            right: 8px;
+            color: @m-grey1;
+        }
+    }
+    .ant-select-arrow {
+        color: @m-grey1;
+    }
+    .ant-select-selection-item {
+        color: @m-white1;
+    }
+}
+.conditionSelect + .conditionSelect {
+    margin-left: 10px;
+}
+.selectBtn.ant-btn {
+    margin-left: 10px;
+    width: 80px;
+    height: 30px;
+    line-height: 30px;
+    text-align: center;
+    background: linear-gradient(0deg, @m-grey15 0%, @m-grey16 98%);
+    border: 0;
+    color: @m-white0;
+    font-size: 14px;
+    .rounded-corners(3px);
+    &:hover,
+    &:focus {
+        background: linear-gradient(0deg, @m-grey15-hover 0%, @m-grey16-hover 98%);
+        color: rgba(@m-white0, 0.8);
+        border: 0;
+    }
+}
+.operBtn.ant-btn:extend(.selectBtn.ant-btn) {
+    background: linear-gradient(0deg, @m-blue6 0%, @m-blue7 99%);
+    &:hover,
+    &:focus {
+        background: linear-gradient(0deg, @m-blue6-hover 0%, @m-blue7-hover 99%);
+        color: rgba(@m-white0, 0.8);
+        border: 0;
+    }
+}
+</style>;

+ 33 - 60
src/views/information/spot-contract/list/not-commit/index.vue

@@ -1,78 +1,51 @@
 <template>
   <!-- 现货合同: 未提交-->
   <div class="spot-contract-not-commit">
-    现货合同: 未提交
+    <filterCustomTable @search="search">
+      <a-button class="operBtn"
+                v-if="hasPermission('spot_contract_btn_add')"
+                @click="openAction">新增</a-button>
+    </filterCustomTable>
+    <contextMenu :contextMenuList="contextMenuList"
+                 :tableList="spotContractList">
+      <a-table :columns="columns"
+               class="topTable"
+               :pagination="false"
+               rowKey="key"
+               :data-source="spotContractList">
+        <!-- <template #userinfotype="{ text }">
+          <a>{{ text === '2' ? '企业' : '个人'}}</a>
+        </template> -->
+      </a-table>
+    </contextMenu>
   </div>
 </template>
 
 <script lang="ts">
 import { defineComponent, ref } from 'vue';
-import { QueryCustomInfo } from '@/goServiceAPI/ermcp/customInfo/index';
-import { QueryCustomInfoType } from '@/goServiceAPI/ermcp/customInfo/interface';
-import { message } from 'ant-design-vue';
 import { initData } from '@/setup/methods/index';
-
-// 查询客户资料列表
-function getCustomList() {
-    // const filteredInfo = ref();
-    // const sortedInfo = ref();
-    // const columns = computed(() => {
-    //     const filtered = filteredInfo.value || {};
-    //     const sorted = sortedInfo.value || {};
-    //     return [
-    //         {
-    //             title: '序号',
-    //             dataIndex: 'index',
-    //             key: 'index',
-    //             align: 'center',
-    //             width: 50,
-    //             customRender: (param: any) => `${param.index + 1}`,
-    //         },
-    //         {
-    //             title: 'Age',
-    //             dataIndex: 'age',
-    //             key: 'age',
-    //             sorter: (a: DataItem, b: DataItem) => a.age - b.age,
-    //             sortOrder: sorted.columnKey === 'age' && sorted.order,
-    //         },
-    //         {
-    //             title: 'Address',
-    //             dataIndex: 'address',
-    //             key: 'address',
-    //             filters: [
-    //                 { text: 'London', value: 'London' },
-    //                 { text: 'New York', value: 'New York' },
-    //             ],
-    //             filteredValue: filtered.address || null,
-    //             onFilter: (value: string, record: DataItem) => record.address.includes(value),
-    //             sorter: (a: DataItem, b: DataItem) => a.address.length - b.address.length,
-    //             sortOrder: sorted.columnKey === 'address' && sorted.order,
-    //             ellipsis: true,
-    //         },
-    //     ];
-    // });
-    const customList = ref<QueryCustomInfoType[]>([]);
-    function actionQuery() {
-        QueryCustomInfo(4)
-            .then((res) => {
-                console.log('L', res);
-            })
-            .catch((err) => message.error(err));
-    }
-
-    return { customList, actionQuery };
-}
+import filterCustomTable from '@/views/information/spot-contract/components/filterTable/index.vue';
+import { getCustomList } from '../setup';
+import { openModal } from '@/setup/controlModal/index';
+import contextMenu from '@/components/contextMenu/index.vue';
+import { MenuItem } from '@/components/contextMenu/interface';
 
 export default defineComponent({
     name: 'spot-contract-not-commit',
-    components: {},
+    components: {
+        filterCustomTable,
+        contextMenu,
+    },
     setup() {
-        const { customList, actionQuery } = getCustomList();
+        const { spotContractList, actionQuery, columns, getColumns, search, loading, handlePermission } = getCustomList();
+        const { hasPermission } = handlePermission('spot_contract_unsubmitted');
+        const { openAction } = openModal('addCustomInfo');
+        const contextMenuList = ref<MenuItem[]>([]);
         initData(() => {
-            actionQuery();
-            // 加载数据在这里
+            actionQuery(2);
+            getColumns();
         });
-        return { customList };
+        return { spotContractList, columns, search, contextMenuList, loading, hasPermission };
     },
 });
 </script>

+ 105 - 0
src/views/information/spot-contract/list/setup.ts

@@ -0,0 +1,105 @@
+import { OperationTabMenu } from '@/goServiceAPI/commonService/interface';
+import { QuerySpotContract } from '@/goServiceAPI/ermcp/spot-contract/index';
+import { Ermcp3ContractRsp } from '@/goServiceAPI/ermcp/spot-contract/interface';
+import { ColumnType, getTableHead } from '@/services/bus/table';
+import { message } from 'ant-design-vue';
+import { inject, Ref, ref } from 'vue';
+
+// 处理现货列表
+export function getCustomList() {
+    // 表格数据
+    const spotContractList = ref<Ermcp3ContractRsp[]>([]);
+    // 表头数据
+    const columns = ref<ColumnType[]>([]);
+    // 过滤项
+    const filteredInfo = ref();
+    const loading = ref<boolean>(false);
+    const permissionData = inject('thirdMenuList') as Ref<OperationTabMenu[]>
+    // 获取表头
+    function getColumns() {
+        const list = getTableHead('table_pcweb_delivery');
+        const filtered = filteredInfo.value || {};
+        columns.value.length = 0;
+        list.forEach((e, i) => {
+            const { columnfield, columntitle, aligntype } = e;
+            const item: ColumnType = {
+                key: String(i),
+                dataIndex: columnfield, // 表格数据对应的key
+                title: columntitle,
+                align: aligntype === 1 ? 'center' : aligntype === 2 ? 'left' : 'right',
+                slots: { customRender: columnfield },
+            };
+            // 以下添加过滤数据对应的方法
+            if (e.columntitle === '类型') {
+                item.onFilter = (value: string, record: Ermcp3ContractRsp) => String(record.contracttype).includes(value)
+                item.filteredValue = filtered.contracttype || null;
+            }
+            if (e.columntitle === '定价类型') {
+                item.onFilter = (value: string, record: Ermcp3ContractRsp) => String(record.pricetype).includes(value)
+                item.filteredValue = filtered.pricetype || null;
+            }
+            if (e.columntitle === '合同编号') {
+                item.onFilter = (value: string, record: Ermcp3ContractRsp) => record.contractno.includes(value);
+                item.filteredValue = filtered.contractno || null;
+            }
+            if (e.columntitle === '对手方') {
+                item.onFilter = (value: string, record: Ermcp3ContractRsp) => {
+                    if (record.contracttype === 1) { //采购方
+                        return record.sellusername.includes(value)
+                    } else { // 销售
+                        return record.buyusername.includes(value)
+                    }
+                };
+                item.filteredValue = filtered.negative || null;
+            }
+            columns.value.push(item);
+        });
+        console.log('columns', columns);
+
+    }
+    // 1-未提交 2-待审核 3-履约中 4-已完成
+    type EnumType = 1 | 2 | 3 | 4;
+    // 查询列表
+    function actionQuery(type: EnumType) {
+        loading.value = true;
+        QuerySpotContract({ querytype: type })
+            .then((res) => {
+                spotContractList.value = res.map((e, i) => {
+                    return { ...e, key: String(i) };
+                });
+                loading.value = false;
+                console.log('查询列表', spotContractList);
+            })
+            .catch((err) => {
+                message.error(err);
+                loading.value = false;
+            });
+    }
+    // 查询
+    function search(value: any) {
+        filteredInfo.value = value;
+        getColumns();
+    }
+
+    // 处理按钮是否有权限
+    type customType = 'spot_contract_unsubmitted' | "spot_contract_checkpending" | "spot_contract_performance" | "spot_contract_finished"
+    // 未提交 | "待审核" | "履约中" | "已完成"
+    function handlePermission(menuType: customType) {
+        // "新增" | "重新提交" | "修改" | "删除" | 
+        type codeType = "spot_contract_btn_add" | "spot_contract_btn_resubmit" | "spot_contract_btn_modify" | "spot_contract_btn_delete";
+
+        // 判断按钮是否有权限
+        function hasPermission(type: codeType): 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 };
+    }
+    return { spotContractList, actionQuery, columns, filteredInfo, getColumns, search, loading, handlePermission };
+}