Procházet zdrojové kódy

修改库存查询

huangbin před 4 roky
rodič
revize
4cacc16ba1

+ 2 - 1
src/common/components/contextMenu/index.vue

@@ -4,7 +4,8 @@
        @click="updateContextMenu(false)"
        @contextmenu.prevent="onContextMenu">
     <slot></slot>
-    <contextMenu :contextMenu="menuContext"
+    <contextMenu v-if="contextMenuList.length"
+                 :contextMenu="menuContext"
                  @update="updateContextMenu" />
   </div>
 </template>

+ 3 - 0
src/router/index.ts

@@ -252,6 +252,9 @@ const routes: Array<RouteRecordRaw> = [
                 meta: {
                     requireAuth: true,
                 },
+                redirect: (to) => {
+                    return { name: 'inventory_current' };
+                },
                 children: [
                     {
                         path: '/inventory/current',

+ 7 - 4
src/services/go/ermcp/search-inventory/index.ts

@@ -1,4 +1,5 @@
-import {commonSearch_go} from "@/services/go";
+import { getUserId } from "@/services/bus/account";
+import { commonSearch_go } from "@/services/go";
 import {
     Ermcp3AreaStock,
     Ermcp3AreaStockApply,
@@ -8,11 +9,11 @@ import {
 /** ================================= 库存查询 ================================**/
 /**
  * 查询机构库存(库存查询/当前库存) /Ermcp3/QueryAreaStock
- * @param userid
  * @constructor
  */
-export function QueryAreaStock(userid: number): Promise<Ermcp3AreaStock[]>{
-    return commonSearch_go('/Ermcp3/QueryAreaStock', {userid}).catch((err) => {
+export function QueryAreaStock(): Promise<Ermcp3AreaStock[]> {
+    const userid = getUserId(); // 所属机构id
+    return commonSearch_go('/Ermcp3/QueryAreaStock', { userid }).catch((err) => {
         throw new Error(`查询机构库存(库存管理/当前库存): ${err.message}`);
     });
 }
@@ -23,6 +24,8 @@ export function QueryAreaStock(userid: number): Promise<Ermcp3AreaStock[]>{
  * @constructor
  */
 export function QueryAreaStockApply(req: QueryAreaStockApplyReq): Promise<Ermcp3AreaStockApply[]> {
+    const userid = getUserId(); // 所属机构id
+    Object.assign(req, { userid })
     return commonSearch_go('/Ermcp3/QueryAreaStockApply', req).catch((err) => {
         throw new Error(`查询库存申请: ${err.message}`);
     });

+ 70 - 71
src/services/go/ermcp/search-inventory/interface.ts

@@ -1,36 +1,35 @@
 // 查询机构库存(库存管理/当前库存)
-export interface Ermcp3AreaStock{
-    brandname	:string;//品牌名称
-    curstock	:number;//期末库存量(今日量)
-    deliverygoodscode	:string;//现货品种代码
-    deliverygoodsid	:number;//现货品种id
-    deliverygoodsname	:string;//现货品种名称
-    enumdicname	:string;//单位名称
-    goodsunitid	:number;//现货商品单位id
-    oristock	:number;//期初库存量(昨日量)
-    spotgoodsbrandid	:number;//现货品牌ID
-    todaybuyinqty	:number;//今日采购入库量
-    todayproduceinqty	:number;//今日生产入库量
-    todayproduceoutqty	:number;//今日生产出库量
-    todayselloutqty	:number;//今日销售出库量
-    unitid	:number;//单位id
-    updatetime	:string;//更新时间
-    userid	:number;//机构ID
-    username	:string;//机构名称
-    warehousecode	:string;//仓库代码
-    warehouseinfoid	:string;//仓库ID
-    warehousename	:string;//仓库名称
-    warehousetype	:number;//仓库类型 - 1 厂库 2 自有库 3 合作库
-    wrstandardcode	:string;//品类代码
-    wrstandardid	:string;//品类ID
-    wrstandardname	:string;//品类名称
+export interface Ermcp3AreaStock {
+    brandname: string;//品牌名称
+    curstock: number;//期末库存量(今日量)
+    deliverygoodscode: string;//现货品种代码
+    deliverygoodsid: number;//现货品种id
+    deliverygoodsname: string;//现货品种名称
+    enumdicname: string;//单位名称
+    goodsunitid: number;//现货商品单位id
+    oristock: number;//期初库存量(昨日量)
+    spotgoodsbrandid: number;//现货品牌ID
+    todaybuyinqty: number;//今日采购入库量
+    todayproduceinqty: number;//今日生产入库量
+    todayproduceoutqty: number;//今日生产出库量
+    todayselloutqty: number;//今日销售出库量
+    unitid: number;//单位id
+    updatetime: string;//更新时间
+    userid: number;//机构ID
+    username: string;//机构名称
+    warehousecode: string;//仓库代码
+    warehouseinfoid: string;//仓库ID
+    warehousename: string;//仓库名称
+    warehousetype: number;//仓库类型 - 1 厂库 2 自有库 3 合作库
+    wrstandardcode: string;//品类代码
+    wrstandardid: string;//品类ID
+    wrstandardname: string;//品类名称
 }
 
 /**
  * 查询库存申请请求
  */
-export interface QueryAreaStockApplyReq{
-    userid: number;  // 用户ID
+export interface QueryAreaStockApplyReq {
     deliverygoodsid?: number;  // 现货商品ID
     inouttype?: string;  // 出入库类型(可多项,逗号隔开) 1:采购入库 2:销售出库 3:生产入库 4:生产出库
     spotcontractid?: number; // 合同ID
@@ -42,49 +41,49 @@ export interface QueryAreaStockApplyReq{
 
 
 // 查询库存申请(出入库记录|库存审核)
-export interface Ermcp3AreaStockApply{
-    applyid	:number;//申请人
-    applyname	:string;//申请人名称
-    applyremark	:string;//申请备注
-    applysrc	:number;//申请来源 - 1:管理端 2:终端
-    applystatus	:number;//申请状态 - 1:待审核 2:审核通过 3:审核拒绝 4:处理失败 5:已撤回
-    applytime	:string;//申请时间
-    auditid	:number;//审核人
-    auditname	:string;//审核人名称
-    auditremark	:string;//审核备注
-    auditsrc	:number;//审核来源 - 1:管理端 2:终端
-    audittime	:string;//审核时间
-    audittradedate	:string;//审核交易日(yyyyMMdd)
-    brandname	:string;//品牌名称
-    buynickname	:string;//采购方昵称
-    buyuserid	:number;//采购方userid
-    buyusername	:string;//采购方名称
-    contractno	:string;//合同编号
-    contractqty	:number;//合同量
-    contracttype	:number;//现货合同类型 - 1:采购 -1:销售
-    deliverygoodscode	:string;//现货品种代码
-    deliverygoodsid	:number;//现货品种id
-    deliverygoodsname	:string;//现货品种名称
-    enumdicname	:string;//现货商品单位名称
-    inoutapplyid	:string;//申请ID(6number;
-//7+Unix秒时间戳(1number;
-//位)+xxxxxx)
-    inouttype	:number;//出入库类型 - 1:采购入库 2:销售出库 3:生产入库 4:生产出库
-    pricetype	:number;//定价类型 - 1:一口价 2:点价 3:暂定价
-    qty	:number;//数量
-    sellnickname	:string;//销售方昵称
-    selluserid	:number;//销售方userid
-    sellusername	:string;//销售方名称
-    spotcontractid	:string;//关联现货合同ID
-    spotgoodsbrandid	:number;//现货品牌ID
-    unitid	:number;//单位id
-    userid	:number;//机构ID
-    warehousecode	:string;//仓库代码
-    warehouseinfoid	:string;//现货仓库ID
-    warehousename	:string;//仓库名称
-    warehousetype	:number;//仓库类型 - 1 厂库 2 自有库 3 合作库
-    wrstandardcode	:string;//品类代码
-    wrstandardid	:number;//品类ID
-    wrstandardname	:string;//品类名称
+export interface Ermcp3AreaStockApply {
+    applyid: number;//申请人
+    applyname: string;//申请人名称
+    applyremark: string;//申请备注
+    applysrc: number;//申请来源 - 1:管理端 2:终端
+    applystatus: number;//申请状态 - 1:待审核 2:审核通过 3:审核拒绝 4:处理失败 5:已撤回
+    applytime: string;//申请时间
+    auditid: number;//审核人
+    auditname: string;//审核人名称
+    auditremark: string;//审核备注
+    auditsrc: number;//审核来源 - 1:管理端 2:终端
+    audittime: string;//审核时间
+    audittradedate: string;//审核交易日(yyyyMMdd)
+    brandname: string;//品牌名称
+    buynickname: string;//采购方昵称
+    buyuserid: number;//采购方userid
+    buyusername: string;//采购方名称
+    contractno: string;//合同编号
+    contractqty: number;//合同量
+    contracttype: number;//现货合同类型 - 1:采购 -1:销售
+    deliverygoodscode: string;//现货品种代码
+    deliverygoodsid: number;//现货品种id
+    deliverygoodsname: string;//现货品种名称
+    enumdicname: string;//现货商品单位名称
+    inoutapplyid: string;//申请ID(6number;
+    //7+Unix秒时间戳(1number;
+    //位)+xxxxxx)
+    inouttype: number;//出入库类型 - 1:采购入库 2:销售出库 3:生产入库 4:生产出库
+    pricetype: number;//定价类型 - 1:一口价 2:点价 3:暂定价
+    qty: number;//数量
+    sellnickname: string;//销售方昵称
+    selluserid: number;//销售方userid
+    sellusername: string;//销售方名称
+    spotcontractid: string;//关联现货合同ID
+    spotgoodsbrandid: number;//现货品牌ID
+    unitid: number;//单位id
+    userid: number;//机构ID
+    warehousecode: string;//仓库代码
+    warehouseinfoid: string;//现货仓库ID
+    warehousename: string;//仓库名称
+    warehousetype: number;//仓库类型 - 1 厂库 2 自有库 3 合作库
+    wrstandardcode: string;//品类代码
+    wrstandardid: number;//品类ID
+    wrstandardname: string;//品类名称
 }
 

+ 4 - 4
src/views/search/inventory/components/filterTable/index.vue

@@ -19,7 +19,7 @@ export default defineComponent({
         const select: SelectList[] = [
             {
                 value: undefined,
-                key: 'contracttype',
+                key: 'deliverygoodsid',
                 placeholder: '全部现货品种',
                 list: [
                     { value: 1, lable: '采购' },
@@ -28,7 +28,7 @@ export default defineComponent({
             },
             {
                 value: undefined,
-                key: 'pricetype',
+                key: 'wrstandardid',
                 placeholder: '全部品类',
                 list: [
                     { value: 1, lable: '一口价' },
@@ -38,7 +38,7 @@ export default defineComponent({
             },
             {
                 value: undefined,
-                key: 'pricetype',
+                key: 'spotgoodsbrandid',
                 placeholder: '全部品牌',
                 list: [
                     { value: 1, lable: '一口价' },
@@ -48,7 +48,7 @@ export default defineComponent({
             },
             {
                 value: undefined,
-                key: 'pricetype',
+                key: 'warehouseinfoid',
                 placeholder: '全部仓库',
                 list: [
                     { value: 1, lable: '一口价' },

+ 5 - 5
src/views/search/inventory/list/inventory_applyrecord/index.vue

@@ -51,7 +51,7 @@ import Filter from '../../components/filterTable/index.vue';
 import Add from '../../components/add/index.vue';
 
 import { getBizTypeName, getContractStatusName, getContractTypeName, getPriceTypeName } from '@/views/information/spot-contract/setup';
-import { Ermcp3ContractRsp, queryTableList } from '@/views/information/spot-contract/list';
+import { Ermcp3AreaStockApply, queryTableList } from './setup';
 
 export default defineComponent({
     name: 'inventory_current',
@@ -65,11 +65,11 @@ export default defineComponent({
         // 表头数据
         const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns();
         // 表格事件
-        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<Ermcp3ContractRsp>({});
+        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<Ermcp3AreaStockApply>({});
         // 表格操作按钮列表
-        const { commonBtn, forDataBtn } = getBtnList('inventory_current', true);
+        const { commonBtn, forDataBtn } = getBtnList('inventory_current', false);
         // 表格列表数据
-        const { loading, tableList, queryTable } = queryTableList(2);
+        const { loading, tableList, queryTable } = queryTableList();
 
         // 查询
         function search(value: any) {
@@ -82,7 +82,7 @@ export default defineComponent({
             // 获取列表数据
             queryTable();
             // 注册表头信息 过滤
-            // registerColumn('table_pcweb_delivery', getFilterTableCB);
+            registerColumn('table_pcweb_delivery', ['deliverygoodsid', 'wrstandardid', 'spotgoodsbrandid', 'warehouseinfoid']);
         });
         return {
             columns,

+ 31 - 0
src/views/search/inventory/list/inventory_applyrecord/setup.ts

@@ -0,0 +1,31 @@
+import { QueryAreaStockApply } from "@/services/go/ermcp/search-inventory";
+import { Ermcp3AreaStockApply } from "@/services/go/ermcp/search-inventory/interface";
+import { message } from "ant-design-vue";
+import { ref } from "vue";
+
+/**
+ * 获取表格列表数据
+ * @param type 
+ * @returns 
+ */
+export function queryTableList() {
+    // 加载状态
+    const loading = ref<boolean>(false);
+    // 表格数据
+    const tableList = ref<Ermcp3AreaStockApply[]>([]);
+    function queryTable() {
+        QueryAreaStockApply({})
+            .then((res) => {
+                tableList.value = res.map((e, i) => {
+                    return { ...e, key: String(i) };
+                });
+                console.log('查询列表', tableList);
+            })
+            .catch((err) => {
+                message.error(err);
+            }).finally(() => loading.value = false)
+    }
+    return { loading, tableList, queryTable }
+}
+export type { Ermcp3AreaStockApply };
+

+ 5 - 26
src/views/search/inventory/list/inventory_current/index.vue

@@ -17,29 +17,8 @@
         <template #expandedRowRender="{  }">
           <BtnList :btnList="forDataBtn" />
         </template>
-        <!-- <template #userinfotype="{ text }">
-                  <a>{{ text === '2' ? '企业' : '个人'}}</a>
-                </template> -->
-
-        <template #biztype="{ text }">
-          <a>{{ getBizTypeName(text) }}</a>
-        </template>
-
-        <template #pricetype="{ text }">
-          <a>{{ getPriceTypeName(text) }}</a>
-        </template>
-
-        <template #contracctstatus="{ text }">
-          <a>{{ getContractStatusName(text) }}</a>
-        </template>
-
-        <template #contracttype="{ text }">
-          <a>{{ getContractTypeName(text) }}</a>
-        </template>
-
       </a-table>
     </contextMenu>
-    <!-- 现货合同: 审核 -->
     <Add :selectedRow="selectedRow"
          @refresh="queryTable" />
   </div>
@@ -51,7 +30,7 @@ import Filter from '../../components/filterTable/index.vue';
 import Add from '../../components/add/index.vue';
 
 import { getBizTypeName, getContractStatusName, getContractTypeName, getPriceTypeName } from '@/views/information/spot-contract/setup';
-import { Ermcp3ContractRsp, queryTableList } from '@/views/information/spot-contract/list';
+import { Ermcp3AreaStock, queryTableList } from './setup';
 
 export default defineComponent({
     name: 'inventory_current',
@@ -65,11 +44,11 @@ export default defineComponent({
         // 表头数据
         const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns();
         // 表格事件
-        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<Ermcp3ContractRsp>({});
+        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<Ermcp3AreaStock>({});
         // 表格操作按钮列表
-        const { commonBtn, forDataBtn } = getBtnList('inventory_current', true);
+        const { commonBtn, forDataBtn } = getBtnList('inventory_current', false);
         // 表格列表数据
-        const { loading, tableList, queryTable } = queryTableList(2);
+        const { loading, tableList, queryTable } = queryTableList();
 
         // 查询
         function search(value: any) {
@@ -82,7 +61,7 @@ export default defineComponent({
             // 获取列表数据
             queryTable();
             // 注册表头信息 过滤
-            // registerColumn('table_pcweb_delivery', getFilterTableCB);
+            registerColumn('table_pcweb_delivery', ['deliverygoodsid', 'wrstandardid', 'spotgoodsbrandid', 'warehouseinfoid']);
         });
         return {
             columns,

+ 31 - 0
src/views/search/inventory/list/inventory_current/setup.ts

@@ -0,0 +1,31 @@
+import { QueryAreaStock } from "@/services/go/ermcp/search-inventory";
+import { Ermcp3AreaStock } from "@/services/go/ermcp/search-inventory/interface";
+import { message } from "ant-design-vue";
+import { ref } from "vue";
+
+/**
+ * 获取表格列表数据
+ * @param type 
+ * @returns 
+ */
+export function queryTableList() {
+    // 加载状态
+    const loading = ref<boolean>(false);
+    // 表格数据
+    const tableList = ref<Ermcp3AreaStock[]>([]);
+    function queryTable() {
+        QueryAreaStock()
+            .then((res) => {
+                tableList.value = res.map((e, i) => {
+                    return { ...e, key: String(i) };
+                });
+                console.log('查询列表', tableList);
+            })
+            .catch((err) => {
+                message.error(err);
+            }).finally(() => loading.value = false)
+    }
+    return { loading, tableList, queryTable }
+}
+export type { Ermcp3AreaStock };
+

+ 0 - 12
src/views/search/inventory/list/setup.ts

@@ -1,12 +0,0 @@
-import { Column, ColumnType } from "@/common/setup/table";
-
-export function filterTable(e: Column, item: ColumnType, filtered: any, keyList: string[]) {
-    keyList.forEach(el => {
-        // 以下添加过滤数据对应的方法
-        if (e.columnfield === el) {
-            item.onFilter = (value: string, record: any) => record[el].toString().includes(String(value));
-            item.filteredValue = filtered[el] || null;
-        }
-    })
-}
-