liucong пре 4 година
родитељ
комит
a005525d9f

+ 2 - 2
src/common/methods/table/interface.ts

@@ -1,4 +1,3 @@
-
 interface CustomRender {
     customRender: string;
 }
@@ -17,4 +16,5 @@ export interface TableKey {
     table_pcweb_delivery: string; // 现货合同
     table_pcweb_userinfo: string; // 客户资料
     table_pcweb_warehouse: string; // 仓库信息
-}
+    table_pcweb_purchase: string; // 采购合同
+}

+ 11 - 67
src/views/business/purchase/list/pending/index.vue

@@ -1,78 +1,22 @@
 <template>
-    <!-- 采购: 现货头寸-->
-    <div class="spot-contract-peddding">
-        采购: 现货头寸
+    <!-- 采购: 待点价-->
+    <div class="purchase-peddding" :loading="loading">
+        <!-- <filterCustomTable @search="search">
+            <a-button class="operBtn" v-if="hasPermission('custom_info_btn_add')" @click="addAction">新增</a-button>
+        </filterCustomTable> -->
+        <contextMenu :contextMenuList="contextMenuList" :tableList="customList">
+            <a-table :columns="columns" class="topTable" :pagination="false" rowKey="key" :data-source="customList"></a-table>
+        </contextMenu>
     </div>
 </template>
 
 <script lang="ts">
     import { defineComponent, ref } from 'vue';
-    import { QueryCustomInfo } from '@/services/go/ermcp/customInfo/index';
-    import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
-    import { message } from 'ant-design-vue';
-    import { initData } from '@/common/methods';
-
-    // 查询客户资料列表
-    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 { handlePurchase, btnAndComp } from '../../setup';
     export default defineComponent({
-        name: 'spot-contract-peddding',
-        components: {},
+        name: 'purchase-peddding',
         setup() {
-            const { customList, actionQuery } = getCustomList();
-            initData(() => {
-                actionQuery();
-                // 加载数据在这里
-            });
-            return { customList };
+            return { ...handlePurchase(), ...btnAndComp() };
         },
     });
 </script>

+ 75 - 0
src/views/business/purchase/setup.ts

@@ -0,0 +1,75 @@
+import { QueryPurchase } from '@/services/go/ermcp/purchase';
+import { Ermcp3SellBuyContract, SellBuyContractReq } from '@/services/go/ermcp/purchase/interface';
+import { ref, Ref } from '@vue/reactivity';
+import APP from '@/services';
+import { getUserId } from '@/services/bus/account';
+import { initData } from '@/common/methods';
+import { ColumnType, getTableHead } from '@/common/methods/table';
+import { detailButton, permissionButton, handlePermission } from '@/common/setup/buttonPermission/index';
+import { MenuItem } from '@/common/components/contextMenu/interface';
+import { openModal } from '@/common/setup/modal/index';
+import { watchEffect } from 'vue';
+// 采购数据获取和表头数据整理
+export function handlePurchase() {
+    // ========================loading========================
+    const loading = ref<boolean>(false);
+    // ========================获取列表数据========================
+    let purchaseList = ref<Ermcp3SellBuyContract[] | []>([]);
+    function queryPurchase() {
+        const AreaUserID = APP.get('userAccount').memberuserid; // 所属机构id
+        const req: SellBuyContractReq = {
+            areauserid: AreaUserID, //  所属机构ID
+            contracttype: 1, // 合同类型 1-采购, -1-销售
+            querytype: 1, // 查询类型 1-全部 2-待点价 3-履约结算 4-已完成
+            userid: getUserId(), // 用户ID
+        };
+        QueryPurchase(req).then((res) => {
+            purchaseList.value = res;
+        });
+    }
+
+    // ========================获取表头========================
+    const columns = ref<ColumnType[]>([]);
+    function getColumns() {
+        const list = getTableHead('table_pcweb_purchase');
+        columns.value.length = 0;
+        list.forEach((e, i) => {
+            const { columnfield, columntitle, aligntype } = e;
+            const item: ColumnType = {
+                key: String(i),
+                dataIndex: columnfield,
+                title: columntitle,
+                align: aligntype === 1 ? 'center' : aligntype === 2 ? 'left' : 'right',
+                slots: { customRender: columnfield },
+            };
+            columns.value.push(item);
+        });
+    }
+
+    // ========================数据初始化========================
+    initData((): void => {
+        queryPurchase();
+        getColumns();
+    });
+    return { loading, purchaseList, columns };
+}
+
+// 按钮权限与功能组件
+export function btnAndComp() {
+    const { hasPermission } = handlePermission('custom_info_normal');
+    const contextMenuList = ref<MenuItem[]>([]);
+    const { openAction: addAction } = openModal('addCustomInfo');
+    detailButton('customDetail', contextMenuList);
+    const { action: deleteAction } = permissionButton('deleteCustomInfo', '删除', contextMenuList);
+    const { action: recoverAction } = permissionButton('recoverCustomInfo', '恢复', contextMenuList);
+    const stop = watchEffect(() => {
+        hasPermission('custom_info_btn_recover') && recoverAction();
+        hasPermission('custom_info_btn_delete') && deleteAction();
+    });
+    return {
+        stop,
+        addAction,
+        hasPermission,
+        contextMenuList,
+    };
+}

+ 67 - 76
src/views/information/custom/list/normal-use/index.vue

@@ -1,89 +1,80 @@
 <template>
-  <!-- 客户信息: 正常 -->
-  <div class="custom-normal"
-       :loading="loading">
-    <filterCustomTable @search="search">
-      <a-button class="operBtn"
-                v-if="hasPermission('custom_info_btn_add')"
-                @click="addAction">新增</a-button>
-    </filterCustomTable>
-    <contextMenu :contextMenuList="contextMenuList"
-                 :tableList="customList">
-      <a-table :columns="columns"
-               class="topTable"
-               :pagination="false"
-               rowKey="key"
-               :data-source="customList">
-        <template #userinfotype="{ text }">
-          <a>{{ text === '2' ? '企业' : '个人' }}</a>
-        </template>
-      </a-table>
-    </contextMenu>
-    <!-- 新增 -->
-    <AddCustom />
-    <!-- 详情 -->
-    <CustomDetail />
-    <!-- 修改 -->
-    <ModifyCustom />
-    <!-- 停用 -->
-    <DisableCustom />
-  </div>
+    <!-- 客户信息: 正常 -->
+    <div class="custom-normal" :loading="loading">
+        <filterCustomTable @search="search">
+            <a-button class="operBtn" v-if="hasPermission('custom_info_btn_add')" @click="addAction">新增</a-button>
+        </filterCustomTable>
+        <contextMenu :contextMenuList="contextMenuList" :tableList="customList">
+            <a-table :columns="columns" class="topTable" :pagination="false" rowKey="key" :data-source="customList">
+                <template #userinfotype="{ text }">
+                    <a>{{ text === '2' ? '企业' : '个人' }}</a>
+                </template>
+            </a-table>
+        </contextMenu>
+        <!-- 新增 -->
+        <AddCustom />
+        <!-- 详情 -->
+        <CustomDetail />
+        <!-- 修改 -->
+        <ModifyCustom />
+        <!-- 停用 -->
+        <DisableCustom />
+    </div>
 </template>
 
 <script lang="ts">
-import { defineComponent, onUnmounted, Ref, ref, watchEffect } from 'vue';
+    import { defineComponent, onUnmounted, Ref, ref, watchEffect } from 'vue';
 
-import { initData } from '@/common/methods/index';
-import filterCustomTable from '@/views/information/custom/compoments/filterTable/index.vue';
-import { MenuItem } from '@/common/components/contextMenu/interface';
-import contextMenu from '@/common/components/contextMenu/index.vue';
-import { getCustomList } from '../setup';
-import { openModal } from '@/common/setup/modal/index';
-import CustomDetail from '@/views/information/custom/compoments/detail/index.vue';
-import ModifyCustom from '@/views/information/custom/compoments/modify/index.vue';
-import DisableCustom from '@/views/information/custom/compoments/disable/index.vue';
-import AddCustom from '@/views/information/custom/compoments/add/index.vue';
-import { detailButton, permissionButton, handlePermission } from '@/common/setup/buttonPermission/index';
+    import { initData } from '@/common/methods/index';
+    import filterCustomTable from '@/views/information/custom/compoments/filterTable/index.vue';
+    import { MenuItem } from '@/common/components/contextMenu/interface';
+    import contextMenu from '@/common/components/contextMenu/index.vue';
+    import { getCustomList } from '../setup';
+    import { openModal } from '@/common/setup/modal/index';
+    import CustomDetail from '@/views/information/custom/compoments/detail/index.vue';
+    import ModifyCustom from '@/views/information/custom/compoments/modify/index.vue';
+    import DisableCustom from '@/views/information/custom/compoments/disable/index.vue';
+    import AddCustom from '@/views/information/custom/compoments/add/index.vue';
+    import { detailButton, permissionButton, handlePermission } from '@/common/setup/buttonPermission/index';
 
-export default defineComponent({
-    name: 'custom-normal',
-    components: {
-        filterCustomTable,
-        contextMenu,
-        CustomDetail,
-        ModifyCustom,
-        DisableCustom,
-        AddCustom,
-    },
-    setup() {
-        const { customList, actionQuery, columns, getColumns, search, loading } = getCustomList();
-        const { hasPermission } = handlePermission('custom_info_normal');
-        const contextMenuList = ref<MenuItem[]>([]);
+    export default defineComponent({
+        name: 'custom-normal',
+        components: {
+            filterCustomTable,
+            contextMenu,
+            CustomDetail,
+            ModifyCustom,
+            DisableCustom,
+            AddCustom,
+        },
+        setup() {
+            const { customList, actionQuery, columns, getColumns, search, loading } = getCustomList();
+            const { hasPermission } = handlePermission('custom_info_normal');
+            const contextMenuList = ref<MenuItem[]>([]);
 
-        const { openAction: addAction } = openModal('addCustomInfo');
+            const { openAction: addAction } = openModal('addCustomInfo');
 
-        detailButton('customDetail', contextMenuList);
-        const { action: modifyAction } = permissionButton('modifyCustomInfo', '修改', contextMenuList);
-        const { action: disableAction } = permissionButton('disableCustomInfo', '停用', contextMenuList);
+            detailButton('customDetail', contextMenuList);
+            const { action: modifyAction } = permissionButton('modifyCustomInfo', '修改', contextMenuList);
+            const { action: disableAction } = permissionButton('disableCustomInfo', '停用', contextMenuList);
 
-        const stop = watchEffect(() => {
-            hasPermission('custom_info_btn_modify') && modifyAction();
-            hasPermission('custom_info_btn_disable') && disableAction();
-        });
-        onUnmounted(() => {
-            stop();
-        });
-        initData(() => {
-            actionQuery(3);
-            getColumns();
-        });
-        return { customList, columns, search, loading, contextMenuList, hasPermission, addAction };
-    },
-});
+            const stop = watchEffect(() => {
+                hasPermission('custom_info_btn_modify') && modifyAction();
+                hasPermission('custom_info_btn_disable') && disableAction();
+            });
+            onUnmounted(() => {
+                stop();
+            });
+            initData(() => {
+                actionQuery(3);
+                getColumns();
+            });
+            return { customList, columns, search, loading, contextMenuList, hasPermission, addAction };
+        },
+    });
 </script>
 
 <style lang="less">
-.custom-normal {
-}
-</style
+    .custom-normal {
+    }</style
 >;

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

@@ -1,89 +1,80 @@
 <template>
-  <!-- 客户信息: 停用 -->
-  <div class="custom-normal"
-       :loading="loading">
-    <filterCustomTable @search="search">
-      <a-button class="operBtn"
-                v-if="hasPermission('custom_info_btn_add')"
-                @click="addAction">新增</a-button>
-    </filterCustomTable>
-    <contextMenu :contextMenuList="contextMenuList"
-                 :tableList="customList">
-      <a-table :columns="columns"
-               class="topTable"
-               :pagination="false"
-               rowKey="key"
-               :data-source="customList">
-        <template #userinfotype="{ text }">
-          <a>{{ text === '2' ? '企业' : '个人' }}</a>
-        </template>
-      </a-table>
-    </contextMenu>
-    <!-- 新增 -->
-    <AddCustom />
-    <!-- 详情 -->
-    <CustomDetail />
-    <!-- 删除 -->
-    <DeleteCustom />
-    <!-- 恢复客户资料 -->@/common/methods
-    <RecoverCustom />
-  </div>
+    <!-- 客户信息: 停用 -->
+    <div class="custom-normal" :loading="loading">
+        <filterCustomTable @search="search">
+            <a-button class="operBtn" v-if="hasPermission('custom_info_btn_add')" @click="addAction">新增</a-button>
+        </filterCustomTable>
+        <contextMenu :contextMenuList="contextMenuList" :tableList="customList">
+            <a-table :columns="columns" class="topTable" :pagination="false" rowKey="key" :data-source="customList">
+                <template #userinfotype="{ text }">
+                    <a>{{ text === '2' ? '企业' : '个人' }}</a>
+                </template>
+            </a-table>
+        </contextMenu>
+        <!-- 新增 -->
+        <AddCustom />
+        <!-- 详情 -->
+        <CustomDetail />
+        <!-- 删除 -->
+        <DeleteCustom />
+        <!-- 恢复客户资料 -->@/common/methods
+        <RecoverCustom />
+    </div>
 </template>
 
 <script lang="ts">
-import { defineComponent, onUnmounted, Ref, ref, watchEffect } from 'vue';
+    import { defineComponent, onUnmounted, Ref, ref, watchEffect } from 'vue';
 
-import { initData } from '@/common/methods/index';
-import filterCustomTable from '@/views/information/custom/compoments/filterTable/index.vue';
-import { MenuItem } from '@/common/components/contextMenu/interface';
-import contextMenu from '@/common/components/contextMenu/index.vue';
-import { getCustomList } from '../setup';
-import { openModal } from '@/common/setup/modal/index';
-import CustomDetail from '@/views/information/custom/compoments/detail/index.vue';
-import DeleteCustom from '@/views/information/custom/compoments/delete/index.vue';
-import RecoverCustom from '@/views/information/custom/compoments/recover/index.vue';
-import AddCustom from '@/views/information/custom/compoments/add/index.vue';
-import { detailButton, permissionButton, handlePermission } from '@/common/setup/buttonPermission/index';
+    import { initData } from '@/common/methods/index';
+    import filterCustomTable from '@/views/information/custom/compoments/filterTable/index.vue';
+    import { MenuItem } from '@/common/components/contextMenu/interface';
+    import contextMenu from '@/common/components/contextMenu/index.vue';
+    import { getCustomList } from '../setup';
+    import { openModal } from '@/common/setup/modal/index';
+    import CustomDetail from '@/views/information/custom/compoments/detail/index.vue';
+    import DeleteCustom from '@/views/information/custom/compoments/delete/index.vue';
+    import RecoverCustom from '@/views/information/custom/compoments/recover/index.vue';
+    import AddCustom from '@/views/information/custom/compoments/add/index.vue';
+    import { detailButton, permissionButton, handlePermission } from '@/common/setup/buttonPermission/index';
 
-export default defineComponent({
-    name: 'custom-normal',
-    components: {
-        filterCustomTable,
-        contextMenu,
-        CustomDetail,
-        DeleteCustom,
-        RecoverCustom,
-        AddCustom,
-    },
-    setup() {
-        const { customList, actionQuery, columns, getColumns, search, loading } = getCustomList();
-        const { hasPermission } = handlePermission('custom_info_normal');
-        const contextMenuList = ref<MenuItem[]>([]);
+    export default defineComponent({
+        name: 'custom-normal',
+        components: {
+            filterCustomTable,
+            contextMenu,
+            CustomDetail,
+            DeleteCustom,
+            RecoverCustom,
+            AddCustom,
+        },
+        setup() {
+            const { customList, actionQuery, columns, getColumns, search, loading } = getCustomList();
+            const { hasPermission } = handlePermission('custom_info_normal');
+            const contextMenuList = ref<MenuItem[]>([]);
 
-        const { openAction: addAction } = openModal('addCustomInfo');
+            const { openAction: addAction } = openModal('addCustomInfo');
 
-        detailButton('customDetail', contextMenuList);
-        const { action: deleteAction } = permissionButton('deleteCustomInfo', '删除', contextMenuList);
-        const { action: recoverAction } = permissionButton('recoverCustomInfo', '恢复', contextMenuList);
+            detailButton('customDetail', contextMenuList);
+            const { action: deleteAction } = permissionButton('deleteCustomInfo', '删除', contextMenuList);
+            const { action: recoverAction } = permissionButton('recoverCustomInfo', '恢复', contextMenuList);
 
-        const stop = watchEffect(() => {
-            hasPermission('custom_info_btn_recover') && recoverAction();
-            hasPermission('custom_info_btn_delete') && deleteAction();
-        });
-        onUnmounted(() => {
-            stop();
-        });
-        initData(() => {
-            actionQuery(4);
-            getColumns();
-        });
-        return { customList, columns, search, loading, contextMenuList, hasPermission, addAction };
-    },
-});
+            const stop = watchEffect(() => {
+                hasPermission('custom_info_btn_recover') && recoverAction();
+                hasPermission('custom_info_btn_delete') && deleteAction();
+            });
+            onUnmounted(() => {
+                stop();
+            });
+            initData(() => {
+                actionQuery(4);
+                getColumns();
+            });
+            return { customList, columns, search, loading, contextMenuList, hasPermission, addAction };
+        },
+    });
 </script>
 
 <style lang="less">
-.custom-normal {
-}
-</style
+    .custom-normal {
+    }</style
 >;