|
|
@@ -0,0 +1,71 @@
|
|
|
+import { ColumnType, getTableHead } from '@/common/methods/table';
|
|
|
+import { QueryBusinessJs } from '@/services/go/ermcp/business-review/index';
|
|
|
+import { getUserId } from '@/services/bus/account';
|
|
|
+import { QryBussinessJsRsp } from '@/services/go/ermcp/business-review/interface';
|
|
|
+import { message } from 'ant-design-vue';
|
|
|
+import { ref } from 'vue';
|
|
|
+
|
|
|
+// 管理-业务审核-点价
|
|
|
+export function getTableList() {
|
|
|
+ // 表格数据
|
|
|
+ const tableList = ref<QryBussinessJsRsp[]>([]);
|
|
|
+ // 表头数据
|
|
|
+ const columns = ref<ColumnType[]>([]);
|
|
|
+ // 过滤项
|
|
|
+ const filteredInfo = ref();
|
|
|
+ const loading = ref<boolean>(false);
|
|
|
+
|
|
|
+ // 获取表头
|
|
|
+ function getColumns() {
|
|
|
+ const list = getTableHead('table_pcweb_business_aduit_js');
|
|
|
+ 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: QryBusinessDjRsp) => String(record.warehousetype).includes(String(value));
|
|
|
+ // item.filteredValue = filtered.warehousetype || null;
|
|
|
+ // }
|
|
|
+ // if (e.columnfield === 'warehousename') {
|
|
|
+ // item.onFilter = (value: string, record: QryBusinessDjRsp) => record.warehousename.includes(value);
|
|
|
+ // item.filteredValue = filtered.warehousename || null;
|
|
|
+ // }
|
|
|
+ // if (e.columnfield === 'address') {
|
|
|
+ // item.onFilter = (value: string, record: QryBusinessDjRsp) => record.address.includes(value);
|
|
|
+ // item.filteredValue = filtered.address || null;
|
|
|
+ // }
|
|
|
+ columns.value.push(item);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 查询列表
|
|
|
+ function actionQuery() {
|
|
|
+ loading.value = true;
|
|
|
+ QueryBusinessJs({UserId: getUserId()})
|
|
|
+ .then((res) => {
|
|
|
+ tableList.value = res.map((e, i) => {
|
|
|
+ return { ...e, key: String(i) };
|
|
|
+ });
|
|
|
+ loading.value = false;
|
|
|
+ console.log('查询列表', tableList);
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ message.error(err);
|
|
|
+ loading.value = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 查询
|
|
|
+ function search(value: any) {
|
|
|
+ filteredInfo.value = value;
|
|
|
+ getColumns();
|
|
|
+ }
|
|
|
+
|
|
|
+ return { tableList, actionQuery, columns, filteredInfo, getColumns, search, loading, };
|
|
|
+}
|