Explorar o código

修改仓库信息

huangbin %!s(int64=4) %!d(string=hai) anos
pai
achega
80d1929b8c

+ 3 - 2
src/services/go/ermcp/spot-contract/index.ts

@@ -1,4 +1,5 @@
 /** ================================= 现货合同 ================================**/
+import APP from '@/services';
 import { commonSearch_go } from '@/services/go';
 import { Ermcp3ContractReq, Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
 
@@ -11,8 +12,8 @@ import { Ermcp3ContractReq, Ermcp3ContractRsp } from '@/services/go/ermcp/spot-c
  * @constructor
  */
 export function QuerySpotContract(req: Ermcp3ContractReq): Promise<Ermcp3ContractRsp[]> {
-    // const areauserid = APP.get('userAccount').memberuserid; // 所属机构id
-    const areauserid = 10000; // 所属机构id
+    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}`);
     });

+ 6 - 0
src/views/information/custom/list/index.ts

@@ -0,0 +1,6 @@
+import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
+import { getFilterTableCB, queryTableList } from './setup';
+
+export { queryTableList, getFilterTableCB };
+export type { QueryCustomInfoType };
+

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

@@ -37,10 +37,7 @@
 import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
 
 import { filterCustomTable, CustomDetail, ModifyCustom, DisableCustom, AddCustom } from '../../compoments';
-
-import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
-
-import { queryTableList, getFilterTableCB } from '../setup';
+import { queryTableList, getFilterTableCB, QueryCustomInfoType } from '../index';
 
 export default defineComponent({
     name: 'custom-normal',

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

@@ -38,8 +38,7 @@ import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList,
 
 import { filterCustomTable, CustomDetail, DeleteCustom, RecoverCustom, AddCustom } from '../../compoments';
 
-import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
-import { queryTableList, getFilterTableCB } from '../setup';
+import { queryTableList, getFilterTableCB, QueryCustomInfoType } from '../index';
 
 export default defineComponent({
     name: 'custom-normal',

+ 2 - 2
src/views/information/spot-contract/list/checkpending/index.vue

@@ -34,7 +34,7 @@
 <script lang="ts">
 import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
 import { AddSpotContract, SpotContractDeatil, Check, Cancel, filterCustomTable } from '../../components';
-import { queryTableList, getFilterTableCB, QueryCustomInfoType } from '../index';
+import { queryTableList, getFilterTableCB, Ermcp3ContractRsp } from '../index';
 
 export default defineComponent({
     name: 'spot-contract-peddding',
@@ -51,7 +51,7 @@ export default defineComponent({
         // 表头数据
         const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns();
         // 表格事件
-        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<QueryCustomInfoType>({});
+        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<Ermcp3ContractRsp>({});
         // 表格操作按钮列表
         const { commonBtn, forDataBtn } = getBtnList('spot_contract_checkpending', true);
         // 表格列表数据

+ 2 - 2
src/views/information/spot-contract/list/finished/index.vue

@@ -33,7 +33,7 @@
 import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
 import { AddSpotContract, SpotContractDeatil, filterCustomTable } from '../../components';
 
-import { queryTableList, getFilterTableCB, QueryCustomInfoType } from '../index';
+import { queryTableList, getFilterTableCB, Ermcp3ContractRsp } from '../index';
 
 export default defineComponent({
     name: 'spot-contract-done',
@@ -48,7 +48,7 @@ export default defineComponent({
         // 表头数据
         const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns();
         // 表格事件
-        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<QueryCustomInfoType>({});
+        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<Ermcp3ContractRsp>({});
         // 表格操作按钮列表
         const { commonBtn, forDataBtn } = getBtnList('spot_contract_finished', true);
         // 表格列表数据

+ 2 - 2
src/views/information/spot-contract/list/index.ts

@@ -1,6 +1,6 @@
-import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
+import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
 import { getFilterTableCB, queryTableList } from './setup';
 
 export { queryTableList, getFilterTableCB };
-export type { QueryCustomInfoType };
+export type { Ermcp3ContractRsp };
 

+ 2 - 2
src/views/information/spot-contract/list/performance/index.vue

@@ -33,7 +33,7 @@
 import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
 import { AddSpotContract, SpotContractDeatil, filterCustomTable, Finish } from '../../components';
 
-import { queryTableList, getFilterTableCB, QueryCustomInfoType } from '../index';
+import { queryTableList, getFilterTableCB, Ermcp3ContractRsp } from '../index';
 
 export default defineComponent({
     name: 'spot-contract-performance',
@@ -49,7 +49,7 @@ export default defineComponent({
         // 表头数据
         const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns();
         // 表格事件
-        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<QueryCustomInfoType>({});
+        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<Ermcp3ContractRsp>({});
         // 表格操作按钮列表
         const { commonBtn, forDataBtn } = getBtnList('spot_contract_performance', true);
         // 表格列表数据

+ 2 - 2
src/views/information/spot-contract/list/unsubmitted/index.vue

@@ -39,7 +39,7 @@
 import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
 import { AddSpotContract, SpotContractDeatil, filterCustomTable, ModifySpotContract, DeleteSpotContract, ResubmitSpotContract } from '../../components';
 
-import { queryTableList, getFilterTableCB, QueryCustomInfoType } from '../index';
+import { queryTableList, getFilterTableCB, Ermcp3ContractRsp } from '../index';
 
 export default defineComponent({
     name: 'spot-contract-not-commit',
@@ -57,7 +57,7 @@ export default defineComponent({
         // 表头数据
         const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns();
         // 表格事件
-        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<QueryCustomInfoType>({});
+        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<Ermcp3ContractRsp>({});
         // 表格操作按钮列表
         const { commonBtn, forDataBtn } = getBtnList('spot_contract_unsubmitted', true);
         // 表格列表数据

+ 6 - 6
src/views/information/spot-contract/setup.ts

@@ -4,9 +4,9 @@
  * //合同状态 - number;
  //:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回
  */
-export function getContractStatusName(state: number) : string{
-    let result : string = "--";
-    switch (state){
+export function getContractStatusName(state: number): string {
+    let result = "--";
+    switch (state) {
         case 1:
             result = "待审核";
             break
@@ -33,9 +33,9 @@ export function getContractStatusName(state: number) : string{
  * 定价类型返回 - 1:一口价 2:点价 3:暂定价
  * @param state
  */
-export function getPriceTypeName(state: number) : string{
-    let result : string = "--";
-    switch (state){
+export function getPriceTypeName(state: number): string {
+    let result = "--";
+    switch (state) {
         case 1:
             result = "一口价";
             break

+ 8 - 0
src/views/information/warehouse-info/compoments/index.ts

@@ -0,0 +1,8 @@
+import Add from './add/index.vue';
+import Detail from './detail/index.vue';
+import Disable from './disable/index.vue';
+import filterCustomTable from './filterTable/index.vue';
+import Modify from './modify/index.vue';
+import Recover from './recover/index.vue';
+
+export { filterCustomTable, Add, Disable, Detail, Modify, Recover };

+ 10 - 0
src/views/information/warehouse-info/list/index.ts

@@ -0,0 +1,10 @@
+import { ErmcpWareHouseInfo } from '@/services/go/ermcp/warehouse-info/interface';
+import { gerWareHouseStatusName, getWareHouseTypeName } from '../setup';
+import { getFilterTableCB, queryTableList } from './setup';
+
+export {
+    gerWareHouseStatusName, getWareHouseTypeName,
+    queryTableList, getFilterTableCB
+};
+export type { ErmcpWareHouseInfo };
+

+ 31 - 26
src/views/information/warehouse-info/list/normal-use/index.vue

@@ -18,10 +18,10 @@
           <BtnList :btnList="forDataBtn" />
         </template>
         <template #warehousetype="{ text }">
-          <span>{{ getWareHouseType(text) }}</span>
+          <span>{{ getWareHouseTypeName(text) }}</span>
         </template>
         <template #warehousestatus="{ text }">
-          <span>{{ getWareHouseStatus(text) }}</span>
+          <span>{{ gerWareHouseStatusName(text) }}</span>
         </template>
       </a-table>
     </contextMenu>
@@ -37,18 +37,9 @@
 </template>
 
 <script lang="ts">
-import { defineComponent } from 'vue';
-import { initData } from '@/common/methods';
-import filterCustomTable from '@/views/information/warehouse-info/compoments/filterTable/index.vue';
-import { getTableList, getWareHouseType, getWareHouseStatus } from '../setup';
-import { getBtnList } from '@/common/setup/contextMenu/index';
-import contextMenu from '@/common/components/contextMenu/index.vue';
-import Add from '../../compoments/add/index.vue';
-import Disable from '../../compoments/disable/index.vue';
-import Detail from '../../compoments/detail/index.vue';
-import Modify from '../../compoments/modify/index.vue';
-import { handleTableEvent } from '@/common/setup/event/index';
-import BtnList from '@/common/components/buttonList/index.vue';
+import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
+import { filterCustomTable, Add, Disable, Detail, Modify } from '../../compoments';
+import { gerWareHouseStatusName, getWareHouseTypeName, queryTableList, getFilterTableCB, ErmcpWareHouseInfo } from '../index';
 
 export default defineComponent({
     name: 'warehouse-info-normal',
@@ -62,25 +53,39 @@ export default defineComponent({
         BtnList,
     },
     setup() {
-        const { tableList, actionQuery, columns, filteredInfo, getColumns, search, loading } = getTableList();
+        // 表头数据
+        const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns();
+        // 表格事件
+        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<ErmcpWareHouseInfo>({});
+        // 表格操作按钮列表
         const { commonBtn, forDataBtn } = getBtnList('warehouse_info_normal', true);
-
+        // 表格列表数据
+        const { loading, tableList, queryTable } = queryTableList('1');
         initData(() => {
-            actionQuery('1');
-            getColumns();
+            // 获取列表数据
+            queryTable();
+            // 注册表头信息 过滤
+            registerColumn('table_pcweb_warehouse', getFilterTableCB);
         });
-
+        // 查询
+        function search(value: any) {
+            filteredInfo.value = value;
+            // 更新表信息
+            updateColumn();
+        }
         return {
-            tableList,
-            filteredInfo,
             columns,
-            search,
-            loading,
+            filteredInfo,
+            expandedRowKeys,
+            selectedRow,
+            Rowclick,
             commonBtn,
             forDataBtn,
-            getWareHouseStatus,
-            getWareHouseType,
-            ...handleTableEvent(),
+            loading,
+            tableList,
+            search,
+            getWareHouseTypeName,
+            gerWareHouseStatusName,
         };
     },
 });

+ 30 - 90
src/views/information/warehouse-info/list/setup.ts

@@ -1,53 +1,22 @@
-import { ColumnType, getTableHead } from '@/common/methods/table';
+import { Column, ColumnType } from '@/common/setup/table/index';
 import { QueryWareHouse } from '@/services/go/ermcp/warehouse-info/index';
 import { ErmcpWareHouseInfo } from '@/services/go/ermcp/warehouse-info/interface';
 import { message } from 'ant-design-vue';
 import { ref } from 'vue';
 
-// 列表
-export function getTableList() {
+
+/**
+ * 获取表格列表数据
+ * @param type 
+ * @returns 
+ */
+export function queryTableList(type: string) {
+    // 加载状态
+    const loading = ref<boolean>(false);
     // 表格数据
     const tableList = ref<ErmcpWareHouseInfo[]>([]);
-    // 表头数据
-    const columns = ref<ColumnType[]>([]);
-    // 过滤项
-    const filteredInfo = ref();
-    const loading = ref<boolean>(false);
-    
-    // 获取表头
-    function getColumns() {
-        const list = getTableHead('table_pcweb_warehouse');
-        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.columnfield === 'warehousetype') {
-                item.onFilter = (value: string, record: ErmcpWareHouseInfo) => String(record.warehousetype).includes(String(value));
-                item.filteredValue = filtered.warehousetype || null;
-            }
-            if (e.columnfield === 'warehousename') {
-                item.onFilter = (value: string, record: ErmcpWareHouseInfo) => record.warehousename.includes(value);
-                item.filteredValue = filtered.warehousename || null;
-            }
-            if (e.columnfield === 'address') {
-                item.onFilter = (value: string, record: ErmcpWareHouseInfo) => record.address.includes(value);
-                item.filteredValue = filtered.address || null;
-            }
-            columns.value.push(item);
-        });
-    }
-    // 查询列表
-    function actionQuery(status: string) {
-        loading.value = true;
-        QueryWareHouse(status)
+    function queryTable() {
+        QueryWareHouse(type)
             .then((res) => {
                 tableList.value = res.map((e, i) => {
                     return { ...e, key: String(i) };
@@ -60,56 +29,27 @@ export function getTableList() {
                 loading.value = false;
             });
     }
-    // 查询
-    function search(value: any) {
-        filteredInfo.value = value;
-        getColumns();
-    }
-
-    return { tableList, actionQuery, columns, filteredInfo, getColumns, search, loading, };
+    return { loading, tableList, queryTable }
 }
 
 /**
- * 获取仓库类型
- * @param type 
- * @returns 
+ * 过滤表格的回调函数
+ * @param e 
+ * @param item 
+ * @param filtered 
  */
-export function getWareHouseType(type: number): string {
-    let result = '--';
-    switch (type) {
-        case 1:
-            result = '厂库'
-            break
-        case 2:
-            result = '自有库'
-            break
-        case 3:
-            result = '合作库'
-            break
+export function getFilterTableCB(e: Column, item: ColumnType, filtered: any) {
+    // 以下添加过滤数据对应的方法
+    if (e.columnfield === 'warehousetype') {
+        item.onFilter = (value: string, record: ErmcpWareHouseInfo) => String(record.warehousetype).includes(String(value));
+        item.filteredValue = filtered.warehousetype || null;
     }
-    return result;
-}
-
-/**
- * 获取仓库状态
- * @param status 
- * @returns 
- */
-export function getWareHouseStatus(status: number): string {
-    let result = '--';
-    switch (status) {
-        case 1:
-            result = '正常'
-            break
-        case 2:
-            result = '注销'
-            break
-        case 3:
-            result = '待审核'
-            break
-        case 4:
-            result = '审核拒绝'
-            break
+    if (e.columnfield === 'warehousename') {
+        item.onFilter = (value: string, record: ErmcpWareHouseInfo) => record.warehousename.includes(value);
+        item.filteredValue = filtered.warehousename || null;
     }
-    return result;
-}
+    if (e.columnfield === 'address') {
+        item.onFilter = (value: string, record: ErmcpWareHouseInfo) => record.address.includes(value);
+        item.filteredValue = filtered.address || null;
+    }
+}

+ 32 - 24
src/views/information/warehouse-info/list/stop-use/index.vue

@@ -17,10 +17,10 @@
           <BtnList :btnList="forDataBtn" />
         </template>
         <template #warehousetype="{ text }">
-          <span>{{ getWareHouseType(text) }}</span>
+          <span>{{ getWareHouseTypeName(text) }}</span>
         </template>
         <template #warehousestatus="{ text }">
-          <span>{{ getWareHouseStatus(text) }}</span>
+          <span>{{ gerWareHouseStatusName(text) }}</span>
         </template>
       </a-table>
     </contextMenu>
@@ -32,16 +32,9 @@
 </template>
 
 <script lang="ts">
-import { defineComponent } from 'vue';
-import { initData } from '@/common/methods';
-import filterCustomTable from '@/views/information/warehouse-info/compoments/filterTable/index.vue';
-import { getTableList, getWareHouseType, getWareHouseStatus } from '../setup';
-import { getBtnList } from '@/common/setup/contextMenu/index';
-import contextMenu from '@/common/components/contextMenu/index.vue';
-import Add from '../../compoments/add/index.vue';
-import Recover from '../../compoments/recover/index.vue';
-import BtnList from '@/common/components/buttonList/index.vue';
-import { handleTableEvent } from '@/common/setup/event/index';
+import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
+import { filterCustomTable, Add, Recover } from '../../compoments';
+import { gerWareHouseStatusName, getWareHouseTypeName, queryTableList, getFilterTableCB, ErmcpWareHouseInfo } from '../index';
 
 export default defineComponent({
     name: 'warehouse-info-stop',
@@ -53,24 +46,39 @@ export default defineComponent({
         BtnList,
     },
     setup() {
-        const { tableList, actionQuery, columns, filteredInfo, getColumns, search, loading } = getTableList();
-        const { commonBtn, forDataBtn } = getBtnList('warehouse_info_normal', true);
-
+        // 表头数据
+        const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns();
+        // 表格事件
+        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<ErmcpWareHouseInfo>({});
+        // 表格操作按钮列表
+        const { commonBtn, forDataBtn } = getBtnList('warehouse_info_disabled', true);
+        // 表格列表数据
+        const { loading, tableList, queryTable } = queryTableList('2');
         initData(() => {
-            actionQuery('2');
-            getColumns();
+            // 获取列表数据
+            queryTable();
+            // 注册表头信息 过滤
+            registerColumn('table_pcweb_warehouse', getFilterTableCB);
         });
+        // 查询
+        function search(value: any) {
+            filteredInfo.value = value;
+            // 更新表信息
+            updateColumn();
+        }
         return {
-            tableList,
-            filteredInfo,
             columns,
-            search,
-            loading,
+            filteredInfo,
+            expandedRowKeys,
+            selectedRow,
+            Rowclick,
             commonBtn,
             forDataBtn,
-            getWareHouseStatus,
-            getWareHouseType,
-            ...handleTableEvent(),
+            loading,
+            tableList,
+            search,
+            getWareHouseTypeName,
+            gerWareHouseStatusName,
         };
     },
 });

+ 6 - 6
src/views/information/warehouse-info/setup.ts

@@ -2,9 +2,9 @@
  * 仓库状态名称 - 1:正常 2:注销 3:待审核 4:审核拒绝
  * @param status
  */
-export function gerWareHouseStatusName(status: number): string{
-    let result : string = "--";
-    switch (status){
+export function gerWareHouseStatusName(status: number): string {
+    let result = "--";
+    switch (status) {
         case 1:
             result = "正常";
             break
@@ -25,9 +25,9 @@ export function gerWareHouseStatusName(status: number): string{
  * 仓库类型 - 1 厂库 2 自有库 3 合作库
  * @param type
  */
-export function getWareHouseTypeName(type: number): string{
-    let result : string = "--";
-    switch (type){
+export function getWareHouseTypeName(type: number): string {
+    let result = "--";
+    switch (type) {
         case 1:
             result = "厂库";
             break