From e83dacb5066a86db29dbdc232218d8aba6adc95f Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期五, 02 八月 2024 13:34:04 +0800
Subject: [PATCH] #
---
zy-asrs-admin/src/views/base/mat/index.vue | 132 ++++++++++++++++++++++++++++++++++---------
1 files changed, 104 insertions(+), 28 deletions(-)
diff --git a/zy-asrs-admin/src/views/base/mat/index.vue b/zy-asrs-admin/src/views/base/mat/index.vue
index 414c1ee..e67349e 100644
--- a/zy-asrs-admin/src/views/base/mat/index.vue
+++ b/zy-asrs-admin/src/views/base/mat/index.vue
@@ -1,11 +1,12 @@
<script setup>
import { getCurrentInstance, ref, computed, reactive } from 'vue';
import { useRouter } from "vue-router";
-import { get, post, postBlob } from '@/utils/request.js'
+import { get, post, postBlob, postForm } from '@/utils/request.js'
import { message, Modal } from 'ant-design-vue';
import { logout } from '@/config.js';
import EditView from './edit.vue'
import { formatMessage } from '@/utils/localeUtils.js';
+import useTableSearch from '@/utils/tableUtils.jsx';
const context = getCurrentInstance()?.appContext.config.globalProperties;
const router = useRouter();
@@ -17,152 +18,201 @@
const editChild = ref(null)
let tableData = ref([]);
+getColumns();
getPage();
-const columns = [
+const {
+ getColumnSearchProps,
+ handleResizeColumn,
+} = useTableSearch();
+
+const state = reactive({
+ selectedRowKeys: [],
+ loading: false,
+ columns: []
+});
+const hasSelected = computed(() => state.selectedRowKeys.length > 0);
+const start = () => {
+ state.loading = true;
+ // ajax request after empty completing
+ setTimeout(() => {
+ state.loading = false;
+ state.selectedRowKeys = [];
+ }, 1000);
+};
+const onSelectChange = selectedRowKeys => {
+ // console.log('selectedRowKeys changed: ', selectedRowKeys);
+ state.selectedRowKeys = selectedRowKeys;
+};
+
+state.columns = [
{
title: formatMessage('db.man_mat.tag_id', '鎵�灞炲綊绫�'),
dataIndex: 'tagId$',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('tagId$'),
},
{
title: formatMessage('db.man_mat.matnr', '鍟嗗搧缂栧彿'),
dataIndex: 'matnr',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('matnr'),
},
{
title: formatMessage('db.man_mat.maktx', '鍟嗗搧鍚嶇О'),
dataIndex: 'maktx',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('maktx'),
},
{
title: formatMessage('db.man_mat.name', '鍒悕'),
dataIndex: 'name',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('name'),
},
{
title: formatMessage('db.man_mat.specs', '瑙勬牸'),
dataIndex: 'specs',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('specs'),
},
{
title: formatMessage('db.man_mat.model', '鍨嬪彿'),
dataIndex: 'model',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('model'),
},
{
title: formatMessage('db.man_mat.color', '棰滆壊'),
dataIndex: 'color',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('color'),
},
{
title: formatMessage('db.man_mat.brand', '鍝佺墝'),
dataIndex: 'brand',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('brand'),
},
{
title: formatMessage('db.man_mat.unit', '鍗曚綅'),
dataIndex: 'unit',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('unit'),
},
{
title: formatMessage('db.man_mat.price', '鍗曚环'),
dataIndex: 'price',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('price'),
},
{
title: formatMessage('db.man_mat.sku', 'sku'),
dataIndex: 'sku',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('sku'),
},
{
title: formatMessage('db.man_mat.units', '鍗曚綅閲�'),
dataIndex: 'units',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('units'),
},
{
title: formatMessage('db.man_mat.barcode', '鏉$爜'),
dataIndex: 'barcode',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('barcode'),
},
{
title: formatMessage('db.man_mat.origin', '浜у湴'),
dataIndex: 'origin',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('origin'),
},
{
title: formatMessage('db.man_mat.manu', '鍘傚'),
dataIndex: 'manu',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('manu'),
},
{
title: formatMessage('db.man_mat.manu_date', '鐢熶骇鏃ユ湡'),
dataIndex: 'manuDate',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('manuDate'),
},
{
title: formatMessage('db.man_mat.item_num', '鍝侀」鏁�'),
dataIndex: 'itemNum',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('itemNum'),
},
{
title: formatMessage('db.man_mat.weight', '閲嶉噺'),
dataIndex: 'weight',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('weight'),
},
{
title: formatMessage('db.man_mat.length', '闀垮害'),
dataIndex: 'length',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('length'),
},
{
title: formatMessage('db.man_mat.volume', '浣撶Н'),
dataIndex: 'volume',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('volume'),
},
{
title: formatMessage('db.man_mat.three_code', '涓夋柟缂栫爜'),
dataIndex: 'threeCode',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('threeCode'),
},
{
title: formatMessage('db.man_mat.supp', '渚涘簲鍟�'),
dataIndex: 'supp',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('supp'),
},
{
title: formatMessage('db.man_mat.supp_code', '渚涘簲鍟嗙紪鐮�'),
dataIndex: 'suppCode',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('suppCode'),
},
{
title: formatMessage('db.man_mat.dead_time', '淇濊川鏈�'),
dataIndex: 'deadTime',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('deadTime'),
},
{
@@ -170,24 +220,28 @@
dataIndex: 'uuid',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('uuid'),
},
{
title: formatMessage('db.man_mat.flag', '鏍囪瘑'),
dataIndex: 'flag',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('flag'),
},
{
title: formatMessage('db.man_mat.sort', '鎺掑簭'),
dataIndex: 'sort',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('sort'),
},
{
title: formatMessage('db.man_mat.status', '鐘舵��'),
dataIndex: 'status$',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('status$'),
},
// {
// title: formatMessage('db.man_mat.create_time', '娣诲姞鏃堕棿'),
@@ -218,36 +272,49 @@
dataIndex: 'memo',
width: 140,
ellipsis: true,
+ ...getColumnSearchProps('memo'),
},
- {
- title: formatMessage('common.operation', '鎿嶄綔'),
- name: 'oper',
- dataIndex: 'oper',
- key: 'oper',
- width: 140,
- },
];
-const state = reactive({
- selectedRowKeys: [],
- loading: false,
-});
-const hasSelected = computed(() => state.selectedRowKeys.length > 0);
-const start = () => {
- state.loading = true;
- // ajax request after empty completing
- setTimeout(() => {
- state.loading = false;
- state.selectedRowKeys = [];
- }, 1000);
-};
-const onSelectChange = selectedRowKeys => {
- // console.log('selectedRowKeys changed: ', selectedRowKeys);
- state.selectedRowKeys = selectedRowKeys;
-};
+//鍔犺浇鎵╁睍瀛楁
+async function getColumns() {
+ let fieldResp = await post('/api/matField/list', {
+ fieldType: 0
+ })
+ let fieldResult = fieldResp.data;
+ let tmp = state.columns;
+ if (fieldResult.code == 200) {
+ let data = fieldResult.data;
-function getPage() {
+ data.forEach((item) => {
+ tmp.push({
+ title: formatMessage(item.language, item.describe),
+ name: item.name,
+ dataIndex: item.name,
+ key: item.name,
+ width: 140,
+ })
+ })
+
+ tmp.push({
+ title: formatMessage('common.operation', '鎿嶄綔'),
+ name: 'oper',
+ dataIndex: 'oper',
+ key: 'oper',
+ width: 140,
+ })
+
+ state.columns = tmp;
+ } else if (result.code === 401) {
+ message.error(result.msg);
+ logout()
+ } else {
+ message.error(result.msg);
+ }
+}
+
+async function getPage() {
post('/api/mat/page', {
current: currentPage,
pageSize: pageSize,
@@ -320,6 +387,15 @@
getPage()
}
+const matFieldList = ref(null);
+MatFieldQuery();
+function MatFieldQuery() {
+ post('/api/matField/list', {}).then(resp => {
+ let result = resp.data;
+ matFieldList.value = result.data;
+ })
+}
+
</script>
<script>
@@ -342,7 +418,7 @@
<a-table :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }"
:data-source="tableData.records" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id"
:pagination="{ total: tableData.total, onChange: onPageChange }"
- :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="columns">
+ :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="state.columns" @resizeColumn="handleResizeColumn">
<template #bodyCell="{ column, text, record }">
<template v-if="column.dataIndex === 'oper'">
<div style="display: flex;justify-content: space-evenly;">
--
Gitblit v1.9.1