From fee38f39e36bcda9924f5b26dca609dda6b331e0 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期日, 22 六月 2025 16:53:27 +0800
Subject: [PATCH] no message
---
zy-asrs-admin/src/views/base/locTypeBind/index.vue | 597 ++++++++++++++++++++++++++++++-----------------------------
1 files changed, 306 insertions(+), 291 deletions(-)
diff --git a/zy-asrs-admin/src/views/base/locTypeBind/index.vue b/zy-asrs-admin/src/views/base/locTypeBind/index.vue
index 4490c60..81ca934 100644
--- a/zy-asrs-admin/src/views/base/locTypeBind/index.vue
+++ b/zy-asrs-admin/src/views/base/locTypeBind/index.vue
@@ -1,291 +1,306 @@
-<script setup>
-import { getCurrentInstance, ref, computed, reactive } from 'vue';
-import { useRouter } from "vue-router";
-import { get, post, postBlob } 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';
-const context = getCurrentInstance()?.appContext.config.globalProperties;
-
-const router = useRouter();
-
-const TABLE_KEY = 'table-locTypeBind';
-let currentPage = 1;
-let pageSize = 10;
-const searchInput = ref("")
-const editChild = ref(null)
-
-let currentLocType = ref(null)
-let tableData = ref([]);
-getPage();
-
-const columns = [
- {
- title: formatMessage('db.man_loc_type_bind.loc_id', '搴撲綅'),
- dataIndex: 'locId$',
- width: 140,
- ellipsis: true,
- },
- {
- title: formatMessage('db.man_loc_type_bind.type_id', '搴撲綅绫诲瀷'),
- dataIndex: 'typeId$',
- width: 140,
- ellipsis: true,
- },
- {
- title: formatMessage('db.man_loc_type_bind.uuid', '缂栧彿'),
- dataIndex: 'uuid',
- width: 140,
- ellipsis: true,
- },
- {
- title: formatMessage('db.man_loc_type_bind.name', '鍚嶇О'),
- dataIndex: 'name',
- width: 140,
- ellipsis: true,
- },
- {
- title: formatMessage('db.man_loc_type_bind.flag', '鏍囪瘑'),
- dataIndex: 'flag',
- width: 140,
- ellipsis: true,
- },
- {
- title: formatMessage('db.man_loc_type_bind.status', '鐘舵��'),
- dataIndex: 'status$',
- width: 140,
- ellipsis: true,
- },
- {
- title: formatMessage('db.man_loc_type_bind.create_time', '娣诲姞鏃堕棿'),
- dataIndex: 'createTime$',
- width: 140,
- ellipsis: true,
- },
- {
- title: formatMessage('db.man_loc_type_bind.create_by', '娣诲姞浜哄憳'),
- dataIndex: 'createBy$',
- width: 140,
- ellipsis: true,
- },
- {
- title: formatMessage('db.man_loc_type_bind.update_time', '淇敼鏃堕棿'),
- dataIndex: 'updateTime$',
- width: 140,
- ellipsis: true,
- },
- {
- title: formatMessage('db.man_loc_type_bind.update_by', '淇敼浜哄憳'),
- dataIndex: 'updateBy$',
- width: 140,
- ellipsis: true,
- },
- {
- title: formatMessage('db.man_loc_type_bind.memo', '澶囨敞'),
- dataIndex: 'memo',
- width: 140,
- 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;
-};
-
-function getPage() {
- post('/api/locTypeBind/page', {
- current: currentPage,
- pageSize: pageSize,
- condition: searchInput.value,
- typeId: currentLocType?.value,
- }).then((resp) => {
- let result = resp.data;
- if (result.code == 200) {
- let data = result.data;
- tableData.value = data;
- } else if (result.code === 401) {
- message.error(result.msg);
- logout()
- } else {
- message.error(result.msg);
- }
- })
-}
-
-const handleEdit = (item) => {
- editChild.value.open = true;
- editChild.value.formData = item == null ? editChild.value.initFormData : JSON.parse(JSON.stringify(item));
- editChild.value.isSave = item == null;
-}
-
-const handleDel = (rows) => {
- Modal.confirm({
- title: formatMessage('page.delete', '鍒犻櫎'),
- content: formatMessage('page.delete.confirm', '纭畾鍒犻櫎璇ラ」鍚楋紵'),
- maskClosable: true,
- onOk: async () => {
- const hide = message.loading(formatMessage('common.loading', '璇锋眰涓�'));
- try {
- post('/api/locTypeBind/remove/' + rows.map((row) => row.id).join(','), {}).then(resp => {
- let result = resp.data;
- if (result.code === 200) {
- message.success(result.msg);
- } else {
- message.error(result.msg);
- }
- getPage()
- hide()
- })
- } catch (error) {
- message.error(formatMessage('common.fail', '璇锋眰澶辫触'));
- }
- },
- });
-}
-
-const handleExport = async (intl) => {
- postBlob('/api/locTypeBind/export', {}).then(result => {
- const blob = new Blob([result.data], { type: 'application/vnd.ms-excel' });
- window.location.href = window.URL.createObjectURL(blob);
- return true;
- })
-};
-
-const onSearch = () => {
- // console.log('search');
- getPage()
-}
-
-const onPageChange = (page, size) => {
- currentPage = page;
- pageSize = size;
- getPage();
-}
-
-function handleTableReload(value) {
- getPage()
-}
-
-let locTypeExpandedKeys = ref([]);
-let locTypeData = ref([]);
-let searchLocType = ref("");
-getLocTypeData()
-function getLocTypeData() {
- post('/api/locType/tree', {
- current: currentPage,
- pageSize: pageSize,
- condition: searchLocType.value
- }).then((resp) => {
- let result = resp.data;
- if (result.code == 200) {
- let data = result.data;
- locTypeData.value = [{
- id: null,
- name: '鍏ㄩ儴',
- children: data
- }]
- } else if (result.code === 401) {
- message.error(result.msg);
- logout()
- } else {
- message.error(result.msg);
- }
-
- locTypeExpandedKeys.value = ['0-0']
- })
-}
-
-const handleLocTypeSelected = (selectedKeys, e) => {
- let tmp = [];
- if(e.node.children != null) {
- e.node.children.forEach((item) => {
- tmp.push(item.id);
- })
- }
- tmp.push(e.node.id)
- currentLocType.value = tmp;
- if(e.node.id == null) {
- currentLocType.value = null;
- }
- getPage()
-}
-
-const handleLocTypeDept = (e) => {
- getLocTypeData()
-}
-
-</script>
-
-<script>
-export default {
- name: '搴撲綅绫诲瀷缁戝畾'
-}
-</script>
-
-<template>
- <div style="display: flex;">
- <a-card :title="formatMessage('db.man_loc_area_type.type_id', '搴撲綅绫诲瀷')" style="flex: 3;margin-right: 30px;">
- <a-input v-model:value="searchLocType" @change="handleLocAreaTypeDept"
- :placeholder="formatMessage('page.input', '璇疯緭鍏�')" style="margin-bottom: 8px" />
- <a-tree v-model:expandedKeys="locTypeExpandedKeys" @select="handleLocTypeSelected"
- :tree-data="locTypeData" blockNode>
- <template #title="{ name }">
- <span>{{ name }}</span>
- </template>
- </a-tree>
- </a-card>
-
- <a-card style="flex: 10;">
- <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.init', '鍒濆鍖�') }}</a-button>
- <a-button @click="handleEdit(null)" type="primary">{{ formatMessage('page.add', '娣诲姞') }}</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">
- <template #bodyCell="{ column, text, record }">
- <template v-if="column.dataIndex === 'oper'">
- <div style="display: flex;justify-content: space-evenly;">
- <a-button type="link" primary @click="handleEdit(record)">{{ formatMessage('page.edit', '缂栬緫')
- }}</a-button>
- <a-button type="link" danger @click="handleDel([record])">{{ formatMessage('page.delete', '鍒犻櫎')
- }}</a-button>
- </div>
- </template>
- </template>
- </a-table>
- </a-card>
- </div>
-</template>
-
-<style></style>
+<script setup>
+import { getCurrentInstance, ref, computed, reactive } from 'vue';
+import { useRouter } from "vue-router";
+import { get, post, postBlob } from '@/utils/request.js'
+import { message, Modal, Col, Divider, Row, Flex } from 'ant-design-vue';
+import { logout } from '@/config.js';
+import EditView from './edit.vue'
+import InitView from './init.vue'
+import { formatMessage } from '@/utils/localeUtils.js';
+const context = getCurrentInstance()?.appContext.config.globalProperties;
+
+const router = useRouter();
+
+const TABLE_KEY = 'table-locTypeBind';
+let currentPage = 1;
+let pageSize = 10;
+const searchInput = ref("")
+const editChild = ref(null)
+const initChild = ref(null)
+
+const state = reactive({
+ selectedRowKeys: [],
+ loading: false,
+});
+
+let currentLocType = ref(null)
+let tableData = ref([]);
+getPage();
+
+const columns = [
+ {
+ title: formatMessage('db.man_loc_type_bind.loc_id', '搴撲綅'),
+ dataIndex: 'locId$',
+ width: 140,
+ ellipsis: true,
+ },
+ {
+ title: formatMessage('db.man_loc_type_bind.type_id', '搴撲綅绫诲瀷'),
+ dataIndex: 'typeId$',
+ width: 140,
+ ellipsis: true,
+ },
+ {
+ title: formatMessage('db.man_loc_type_bind.uuid', '缂栧彿'),
+ dataIndex: 'uuid',
+ width: 140,
+ ellipsis: true,
+ },
+ {
+ title: formatMessage('db.man_loc_type_bind.name', '鍚嶇О'),
+ dataIndex: 'name',
+ width: 140,
+ ellipsis: true,
+ },
+ {
+ title: formatMessage('db.man_loc_type_bind.flag', '鏍囪瘑'),
+ dataIndex: 'flag',
+ width: 140,
+ ellipsis: true,
+ },
+ {
+ title: formatMessage('db.man_loc_type_bind.status', '鐘舵��'),
+ dataIndex: 'status$',
+ width: 140,
+ ellipsis: true,
+ },
+ {
+ title: formatMessage('db.man_loc_type_bind.create_time', '娣诲姞鏃堕棿'),
+ dataIndex: 'createTime$',
+ width: 140,
+ ellipsis: true,
+ },
+ {
+ title: formatMessage('db.man_loc_type_bind.create_by', '娣诲姞浜哄憳'),
+ dataIndex: 'createBy$',
+ width: 140,
+ ellipsis: true,
+ },
+ {
+ title: formatMessage('db.man_loc_type_bind.update_time', '淇敼鏃堕棿'),
+ dataIndex: 'updateTime$',
+ width: 140,
+ ellipsis: true,
+ },
+ {
+ title: formatMessage('db.man_loc_type_bind.update_by', '淇敼浜哄憳'),
+ dataIndex: 'updateBy$',
+ width: 140,
+ ellipsis: true,
+ },
+ {
+ title: formatMessage('db.man_loc_type_bind.memo', '澶囨敞'),
+ dataIndex: 'memo',
+ width: 140,
+ ellipsis: true,
+ },
+
+ {
+ title: formatMessage('common.operation', '鎿嶄綔'),
+ name: 'oper',
+ dataIndex: 'oper',
+ key: 'oper',
+ width: 140,
+ },
+];
+
+
+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;
+};
+
+function getPage() {
+ state.loading = true;
+ post('/api/locTypeBind/page', {
+ current: currentPage,
+ pageSize: pageSize,
+ condition: searchInput.value,
+ typeId: currentLocType?.value,
+ }).then((resp) => {
+ let result = resp.data;
+ if (result.code == 200) {
+ let data = result.data;
+ tableData.value = data;
+
+ state.loading = false;
+ } else if (result.code === 401) {
+ message.error(result.msg);
+ logout()
+ } else {
+ message.error(result.msg);
+ }
+ })
+}
+
+const handleInit = (item) => {
+ initChild.value.open = true;
+}
+
+const handleEdit = (item) => {
+ editChild.value.open = true;
+ editChild.value.formData = item == null ? editChild.value.initFormData : JSON.parse(JSON.stringify(item));
+ editChild.value.isSave = item == null;
+}
+
+const handleDel = (rows) => {
+ Modal.confirm({
+ title: formatMessage('page.delete', '鍒犻櫎'),
+ content: formatMessage('page.delete.confirm', '纭畾鍒犻櫎璇ラ」鍚楋紵'),
+ maskClosable: true,
+ onOk: async () => {
+ const hide = message.loading(formatMessage('common.loading', '璇锋眰涓�'));
+ try {
+ post('/api/locTypeBind/remove/' + rows.map((row) => row.id).join(','), {}).then(resp => {
+ let result = resp.data;
+ if (result.code === 200) {
+ message.success(result.msg);
+ } else {
+ message.error(result.msg);
+ }
+ getPage()
+ hide()
+ })
+ } catch (error) {
+ message.error(formatMessage('common.fail', '璇锋眰澶辫触'));
+ }
+ },
+ });
+}
+
+const handleExport = async (intl) => {
+ postBlob('/api/locTypeBind/export', {}).then(result => {
+ const blob = new Blob([result.data], { type: 'application/vnd.ms-excel' });
+ window.location.href = window.URL.createObjectURL(blob);
+ return true;
+ })
+};
+
+const onSearch = () => {
+ // console.log('search');
+ getPage()
+}
+
+const onPageChange = (page, size) => {
+ currentPage = page;
+ pageSize = size;
+ getPage();
+}
+
+function handleTableReload(value) {
+ getPage()
+}
+
+let locTypeExpandedKeys = ref([]);
+let locTypeData = ref([]);
+let searchLocType = ref("");
+getLocTypeData()
+function getLocTypeData() {
+ post('/api/locType/tree', {
+ current: currentPage,
+ pageSize: pageSize,
+ condition: searchLocType.value
+ }).then((resp) => {
+ let result = resp.data;
+ if (result.code == 200) {
+ let data = result.data;
+ locTypeData.value = [{
+ id: null,
+ name: '鍏ㄩ儴',
+ children: data
+ }]
+ } else if (result.code === 401) {
+ message.error(result.msg);
+ logout()
+ } else {
+ message.error(result.msg);
+ }
+
+ locTypeExpandedKeys.value = ['0-0']
+ })
+}
+
+const handleLocTypeSelected = (selectedKeys, e) => {
+ let tmp = [];
+ if(e.node.children != null) {
+ e.node.children.forEach((item) => {
+ tmp.push(item.id);
+ })
+ }
+ tmp.push(e.node.id)
+ currentLocType.value = tmp;
+ if(e.node.id == null) {
+ currentLocType.value = null;
+ }
+ getPage()
+}
+
+const handleLocTypeDept = (e) => {
+ getLocTypeData()
+}
+
+</script>
+
+<script>
+export default {
+ name: '搴撲綅绫诲瀷缁戝畾'
+}
+</script>
+
+<template>
+ <Row>
+ <Col :span="5">
+ <a-card :title="formatMessage('db.man_loc_area_type.type_id', '搴撲綅绫诲瀷')" style="flex: 3;margin-right: 30px;">
+ <a-input v-model:value="searchLocType" @change="handleLocAreaTypeDept"
+ :placeholder="formatMessage('page.input', '璇疯緭鍏�')" style="margin-bottom: 8px" />
+ <a-tree v-model:expandedKeys="locTypeExpandedKeys" @select="handleLocTypeSelected"
+ :tree-data="locTypeData" blockNode>
+ <template #title="{ name }">
+ <span>{{ name }}</span>
+ </template>
+ </a-tree>
+ </a-card>
+ </Col>
+ <Col :span="19">
+ <a-card style="flex: 10;">
+ <InitView ref="initChild" @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="handleInit(null)" type="primary">{{ formatMessage('page.init', '鍒濆鍖�') }}</a-button>
+ <a-button @click="handleEdit(null)" type="primary">{{ formatMessage('page.add', '娣诲姞') }}</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" :loading="state.loading">
+ <template #bodyCell="{ column, text, record }">
+ <template v-if="column.dataIndex === 'oper'">
+ <div style="display: flex;justify-content: space-evenly;">
+ <a-button type="link" primary @click="handleEdit(record)">{{ formatMessage('page.edit', '缂栬緫')
+ }}</a-button>
+ <a-button type="link" danger @click="handleDel([record])">{{ formatMessage('page.delete', '鍒犻櫎')
+ }}</a-button>
+ </div>
+ </template>
+ </template>
+ </a-table>
+ </a-card>
+ </Col>
+ </Row>
+</template>
+
+<style></style>
--
Gitblit v1.9.1