|
@@ -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 { QueryWareHouse } from '@/services/go/ermcp/warehouse-info/index';
|
|
|
import { ErmcpWareHouseInfo } from '@/services/go/ermcp/warehouse-info/interface';
|
|
import { ErmcpWareHouseInfo } from '@/services/go/ermcp/warehouse-info/interface';
|
|
|
import { message } from 'ant-design-vue';
|
|
import { message } from 'ant-design-vue';
|
|
|
import { ref } from '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 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) => {
|
|
.then((res) => {
|
|
|
tableList.value = res.map((e, i) => {
|
|
tableList.value = res.map((e, i) => {
|
|
|
return { ...e, key: String(i) };
|
|
return { ...e, key: String(i) };
|
|
@@ -60,56 +29,27 @@ export function getTableList() {
|
|
|
loading.value = false;
|
|
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;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|