From 46d2d574d02f426522a2b5765d3bea7da52697c7 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期五, 12 七月 2024 15:50:01 +0800
Subject: [PATCH] #
---
zy-asrs-admin/src/views/base/mat/index.vue | 103 +++++++++++++++++++++++++++++++++------------------
1 files changed, 67 insertions(+), 36 deletions(-)
diff --git a/zy-asrs-admin/src/views/base/mat/index.vue b/zy-asrs-admin/src/views/base/mat/index.vue
index 987cb16..721af7e 100644
--- a/zy-asrs-admin/src/views/base/mat/index.vue
+++ b/zy-asrs-admin/src/views/base/mat/index.vue
@@ -1,11 +1,10 @@
<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 FieldView from './field.vue'
import { formatMessage } from '@/utils/localeUtils.js';
const context = getCurrentInstance()?.appContext.config.globalProperties;
@@ -16,12 +15,31 @@
let pageSize = 10;
const searchInput = ref("")
const editChild = ref(null)
-const fieldChild = ref(null)
let tableData = ref([]);
+getColumns();
getPage();
-const columns = [
+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$',
@@ -222,34 +240,44 @@
ellipsis: true,
},
- {
- 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', {})
+ 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,
@@ -272,10 +300,6 @@
editChild.value.open = true;
editChild.value.formData = item == null ? editChild.value.initFormData : JSON.parse(JSON.stringify(item));
editChild.value.isSave = item == null;
-}
-
-const handleField = () => {
- fieldChild.value.open = true;
}
const handleDel = (rows) => {
@@ -326,6 +350,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>
@@ -336,21 +369,19 @@
<template>
<div>
- <FieldView ref="fieldChild" @tableReload="handleTableReload" />
<EditView ref="editChild" @tableReload="handleTableReload" />
<div class="table-header">
<a-input-search v-model:value="searchInput" :placeholder="formatMessage('page.input', '璇疯緭鍏�')"
style="width: 200px;" @search="onSearch" />
<div class="table-header-right">
<a-button @click="handleEdit(null)" type="primary">{{ formatMessage('page.add', '娣诲姞') }}</a-button>
- <a-button @click="handleField" type="primary">{{ formatMessage('page.add.field', '娣诲姞瀛楁') }}</a-button>
<a-button @click="handleExport">{{ formatMessage('page.export', '瀵煎嚭') }}</a-button>
</div>
</div>
<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">
<template #bodyCell="{ column, text, record }">
<template v-if="column.dataIndex === 'oper'">
<div style="display: flex;justify-content: space-evenly;">
--
Gitblit v1.9.1