Ver Fonte

commit 采购

xkwg há 4 anos atrás
pai
commit
919dfc34fb
1 ficheiros alterados com 17 adições e 77 exclusões
  1. 17 77
      src/views/business/purchase/setup.ts

+ 17 - 77
src/views/business/purchase/setup.ts

@@ -1,79 +1,19 @@
-import { QueryPurchase } from '@/services/go/ermcp/purchase';
-import { Ermcp3SellBuyContract, SellBuyContractReq } from '@/services/go/ermcp/purchase/interface';
-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, ref } from 'vue';
-// 采购数据获取和表头数据整理
-export function handlePurchase() {
-    // ========================loading========================
-    const loading = ref<boolean>(false);
-    // ========================获取列表数据========================
-    let customList = 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) => {
-            customList.value = res;
-        });
+/**
+ * 定价类型 - 1:一口价 2:点价 3:暂定价
+ * @param pricetype 定价类型
+ */
+export function getPriceTypeName(pricetype: number): string{
+    let result : string = "--";
+    switch (pricetype){
+        case 1:
+            result = "一口价";
+            break
+        case 2:
+            result = "点价";
+            break
+        case 3:
+            result = "暂定价";
+            break
     }
-
-    // ========================获取表头========================
-    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, customList, columns };
-}
-
-// 按钮权限与功能组件
-export function btnAndComp() {
-    // 传入父及的code 得到当前1234级的整个权限
-    const { hasPermission } = handlePermission('purchase_pending');
-    // 配置右键菜单列表
-    const contextMenuList = ref<MenuItem[]>([]);
-    // 打开新增页的弹窗 返回打开弹窗的方法
-    const { openAction: addAction } = openModal('addCustomInfo');
-    // 创建详情页并写入右键菜单列表(每个页面都有,写死)
-    detailButton('customDetail', contextMenuList);
-    // 通过code跟弹窗建立联系 返回写入右键的方法
-    const { action: deleteAction } = permissionButton('purchase_pending_someprice', '点价登记', contextMenuList);
-
-    const stop = watchEffect(() => {
-        // 判断是否有权限 有就写入
-        hasPermission('custom_info_btn_delete') && deleteAction();
-    });
-    return {
-        stop,
-        addAction,
-        hasPermission,
-        contextMenuList,
-    };
+    return result
 }