| | |
| | | |
| | | <template> |
| | | <a-layout class="main"> |
| | | <a-layout-sider v-model:collapsed="collapsed" :trigger="null" collapsible> |
| | | <a-layout-sider v-model:collapsed="collapsed" :trigger="null" collapsible theme="dark"> |
| | | <div class="logo" /> |
| | | <a-menu v-for="(item, index) in menuCache" :key="index" v-model:selectedKeys="selectedKeys" @select="menuSelect" |
| | | theme="dark" mode="inline"> |
| | | <a-menu v-model:selectedKeys="selectedKeys" @select="menuSelect" theme="dark" mode="inline"> |
| | | <div> |
| | | <a-menu-item key="/" name="主页"> |
| | | <HomeOutlined /> {{ formatMessage('common.home', '主页') }} |
| | | </a-menu-item> |
| | | </div> |
| | | |
| | | <a-sub-menu v-if="item.type == 0"> |
| | | <template #title> |
| | | <span> |
| | | <component :is="components[ref(item.icon).value]" /> |
| | | {{ formatMessage(item.languageId, item.name) }} |
| | | </span> |
| | | </template> |
| | | <div v-for="(child, idx) in item.children"> |
| | | <a-menu-item v-if="child.status == 1" :key="child.route" :name="child.name" :languageId="child.languageId"> |
| | | {{ formatMessage(child.languageId, child.name) }} |
| | | </a-menu-item> |
| | | </div> |
| | | </a-sub-menu> |
| | | <div v-for="(item, index) in menuCache" :key="index"> |
| | | <a-sub-menu :key="index" v-if="item.type == 0"> |
| | | <template #title> |
| | | <span> |
| | | <component :is="components[ref(item.icon).value]" /> |
| | | {{ formatMessage(item.languageId, item.name) }} |
| | | </span> |
| | | </template> |
| | | <div v-for="(child, idx) in item.children"> |
| | | <a-menu-item v-if="child.status == 1" :key="child.route" :name="child.name" |
| | | :languageId="child.languageId"> |
| | | {{ formatMessage(child.languageId, child.name) }} |
| | | </a-menu-item> |
| | | </div> |
| | | </a-sub-menu> |
| | | </div> |
| | | </a-menu> |
| | | |
| | | </a-layout-sider> |
New file |
| | |
| | | <script setup> |
| | | import { ref, nextTick } from 'vue'; |
| | | import { get, post, postBlob, postForm } from '@/utils/request.js' |
| | | import { formatMessage } from '@/utils/localeUtils.js'; |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | const formTable = ref(null); |
| | | const submitButton = ref(null); |
| | | const isSave = ref(true); |
| | | const open = ref(false); |
| | | const initFormData = {} |
| | | let formData = ref(initFormData); |
| | | |
| | | let treeData = ref(null); |
| | | |
| | | const emit = defineEmits(['tableReload']) |
| | | |
| | | const handleOk = (e) => { |
| | | nextTick(() => { |
| | | setTimeout(() => { |
| | | submitButton.value.$el.click(); |
| | | }, 100); |
| | | }); |
| | | }; |
| | | |
| | | const onFinish = values => { |
| | | // console.log('Success:', values); |
| | | open.value = false; |
| | | post(isSave.value ? '/api/tag/save' : '/api/tag/update', formData.value).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code === 200) { |
| | | message.success(formatMessage('page.update.success', '更新成功')); |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | emit('tableReload', 'reload') |
| | | nextTick(() => { |
| | | formTable.value.resetFields() |
| | | }) |
| | | }) |
| | | }; |
| | | const onFinishFailed = errorInfo => { |
| | | console.log('Failed:', errorInfo); |
| | | }; |
| | | |
| | | const UserQueryList = ref(null); |
| | | UserQuery(); |
| | | function UserQuery() { |
| | | postForm('/api/user/query', {}).then(resp => { |
| | | let result = resp.data; |
| | | UserQueryList.value = result.data; |
| | | }) |
| | | } |
| | | |
| | | |
| | | defineExpose({ |
| | | open, |
| | | formData, |
| | | initFormData, |
| | | isSave, |
| | | treeData, |
| | | }) |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | export default { |
| | | name: '归类管理-edit' |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <a-modal v-model:open="open" |
| | | :title="isSave ? formatMessage('page.add', '添加') : formatMessage('page.edit', '编辑')" @ok="handleOk" |
| | | style="width: 600px;"> |
| | | <a-form :model="formData" ref="formTable" name="formTable" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" |
| | | style="display: flex;justify-content: space-between;flex-wrap: wrap;" autocomplete="off" |
| | | @finish="onFinish" @finishFailed="onFinishFailed"> |
| | | <!-- <a-form-item :label="formatMessage('db.man_tag.uuid', '编号')" name="uuid" style="width: 250px;"> |
| | | <a-input v-model:value="formData.uuid" /> |
| | | </a-form-item> --> |
| | | <a-form-item label="上级菜单" name="parentId" style="width: 250px;" |
| | | :rules="[{ required: true, message: '上级菜单不能为空!' }]"> |
| | | <a-tree-select v-model:value="formData.parentId" show-search style="width: 100%" |
| | | :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" |
| | | :placeholder="formatMessage('page.input', '请输入')" allow-clea tree-data-simple-mode |
| | | :tree-data="treeData" tree-node-filter-prop="name" :field-names="{ |
| | | children: 'children', |
| | | label: 'name', |
| | | value: 'id', |
| | | }"> |
| | | <template #title="{ value: id, name }"> |
| | | {{ name }} |
| | | </template> |
| | | </a-tree-select> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_tag.name', '名称')" name="name" style="width: 250px;"> |
| | | <a-input v-model:value="formData.name" /> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_tag.flag', '标识')" name="flag" style="width: 250px;"> |
| | | <a-input v-model:value="formData.flag" /> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_tag.status', '状态')" name="status" style="width: 250px;"> |
| | | <a-select v-model:value="formData.status" :options="[ |
| | | { label: '正常', value: 1 }, |
| | | { label: '禁用', value: 0 }, |
| | | ]"> |
| | | </a-select> |
| | | </a-form-item> |
| | | <!-- <a-form-item :label="formatMessage('db.man_tag.create_time', '添加时间')" name="createTime" |
| | | style="width: 250px;"> |
| | | <a-date-picker v-model:value="formData.createTime" show-time format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" /> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_tag.create_by', '添加人员')" name="createBy" |
| | | style="width: 250px;"> |
| | | <a-select v-model:value="formData.createBy" :placeholder="formatMessage('common.select', '请选择')" |
| | | style="width: 100%" show-search :options="UserQueryList" optionFilterProp="label" |
| | | optionLabelProp="label"> |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_tag.update_time', '修改时间')" name="updateTime" |
| | | style="width: 250px;"> |
| | | <a-date-picker v-model:value="formData.updateTime" show-time format="YYYY-MM-DD HH:mm:ss" |
| | | value-format="YYYY-MM-DD HH:mm:ss" /> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_tag.update_by', '修改人员')" name="updateBy" |
| | | style="width: 250px;"> |
| | | <a-select v-model:value="formData.updateBy" :placeholder="formatMessage('common.select', '请选择')" |
| | | style="width: 100%" show-search :options="UserQueryList" optionFilterProp="label" |
| | | optionLabelProp="label"> |
| | | </a-select> |
| | | </a-form-item> --> |
| | | <a-form-item :label="formatMessage('db.man_tag.memo', '备注')" name="memo" style="width: 250px;"> |
| | | <a-input v-model:value="formData.memo" /> |
| | | </a-form-item> |
| | | <!-- <a-form-item :label="formatMessage('db.man_tag.parent_id', '父级')" name="parentId" |
| | | style="width: 250px;"> |
| | | <a-input v-model:value="formData.parentId" /> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_tag.parent_name', '父级名称')" name="parentName" |
| | | style="width: 250px;"> |
| | | <a-input v-model:value="formData.parentName" /> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_tag.path', '关联路径')" name="path" style="width: 250px;"> |
| | | <a-input v-model:value="formData.path" /> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_tag.path_name', '关联路径名')" name="pathName" |
| | | style="width: 250px;"> |
| | | <a-input v-model:value="formData.pathName" /> |
| | | </a-form-item> --> |
| | | <a-form-item :label="formatMessage('db.man_tag.type', '类型')" name="type" style="width: 250px;"> |
| | | <a-select v-model:value="formData.type" :options="[ |
| | | { label: '其他', value: 0 }, |
| | | ]"> |
| | | </a-select> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_tag.count', '数量')" name="count" style="width: 250px;"> |
| | | <a-input v-model:value="formData.count" /> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_tag.level', '等级')" name="level" style="width: 250px;"> |
| | | <a-input v-model:value="formData.level" /> |
| | | </a-form-item> |
| | | <a-form-item :label="formatMessage('db.man_tag.sort', '排序')" name="sort" style="width: 250px;"> |
| | | <a-input v-model:value="formData.sort" /> |
| | | </a-form-item> |
| | | |
| | | <a-form-item> |
| | | <a-button type="primary" html-type="submit" ref="submitButton" |
| | | style="visibility: hidden;">Submit</a-button> |
| | | </a-form-item> |
| | | </a-form> |
| | | </a-modal> |
| | | </div> |
| | | </template> |
| | | |
| | | <style></style> |
New file |
| | |
| | | <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-tag'; |
| | | let currentPage = 1; |
| | | let pageSize = 10; |
| | | const searchInput = ref("") |
| | | const editChild = ref(null) |
| | | |
| | | let tableData = ref([]); |
| | | getPage(); |
| | | |
| | | const columns = [ |
| | | // { |
| | | // title: formatMessage('db.man_tag.uuid', '编号'), |
| | | // dataIndex: 'uuid', |
| | | // width: 140, |
| | | // ellipsis: true, |
| | | // }, |
| | | { |
| | | title: formatMessage('db.man_tag.name', '名称'), |
| | | dataIndex: 'name', |
| | | width: 140, |
| | | ellipsis: true, |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_tag.flag', '标识'), |
| | | dataIndex: 'flag', |
| | | width: 140, |
| | | ellipsis: true, |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_tag.status', '状态'), |
| | | dataIndex: 'status$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | }, |
| | | // { |
| | | // title: formatMessage('db.man_tag.create_time', '添加时间'), |
| | | // dataIndex: 'createTime$', |
| | | // width: 140, |
| | | // ellipsis: true, |
| | | // }, |
| | | // { |
| | | // title: formatMessage('db.man_tag.create_by', '添加人员'), |
| | | // dataIndex: 'createBy$', |
| | | // width: 140, |
| | | // ellipsis: true, |
| | | // }, |
| | | // { |
| | | // title: formatMessage('db.man_tag.update_time', '修改时间'), |
| | | // dataIndex: 'updateTime$', |
| | | // width: 140, |
| | | // ellipsis: true, |
| | | // }, |
| | | // { |
| | | // title: formatMessage('db.man_tag.update_by', '修改人员'), |
| | | // dataIndex: 'updateBy$', |
| | | // width: 140, |
| | | // ellipsis: true, |
| | | // }, |
| | | { |
| | | title: formatMessage('db.man_tag.memo', '备注'), |
| | | dataIndex: 'memo', |
| | | width: 140, |
| | | ellipsis: true, |
| | | }, |
| | | // { |
| | | // title: formatMessage('db.man_tag.parent_id', '父级'), |
| | | // dataIndex: 'parentId', |
| | | // width: 140, |
| | | // ellipsis: true, |
| | | // }, |
| | | // { |
| | | // title: formatMessage('db.man_tag.parent_name', '父级名称'), |
| | | // dataIndex: 'parentName', |
| | | // width: 140, |
| | | // ellipsis: true, |
| | | // }, |
| | | // { |
| | | // title: formatMessage('db.man_tag.path', '关联路径'), |
| | | // dataIndex: 'path', |
| | | // width: 140, |
| | | // ellipsis: true, |
| | | // }, |
| | | // { |
| | | // title: formatMessage('db.man_tag.path_name', '关联路径名'), |
| | | // dataIndex: 'pathName', |
| | | // width: 140, |
| | | // ellipsis: true, |
| | | // }, |
| | | { |
| | | title: formatMessage('db.man_tag.type', '类型'), |
| | | dataIndex: 'type$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_tag.count', '数量'), |
| | | dataIndex: 'count', |
| | | width: 140, |
| | | ellipsis: true, |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_tag.level', '等级'), |
| | | dataIndex: 'level', |
| | | width: 140, |
| | | ellipsis: true, |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_tag.sort', '排序'), |
| | | dataIndex: 'sort', |
| | | 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/tag/tree', { |
| | | current: currentPage, |
| | | pageSize: pageSize, |
| | | condition: searchInput.value |
| | | }).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code == 200) { |
| | | let data = result.data; |
| | | tableData.value = data; |
| | | |
| | | editChild.value.treeData = [{ |
| | | id: 0, |
| | | name: '全部', |
| | | children: 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/tag/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/tag/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() |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | export default { |
| | | name: '归类管理' |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <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="handleExport">{{ formatMessage('page.export', '导出') }}</a-button> |
| | | </div> |
| | | </div> |
| | | |
| | | <a-table :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }" |
| | | :data-source="tableData" :defaultExpandAllRows="false" key="menu" rowKey="id"> |
| | | <a-table-column :title="formatMessage('db.man_tag.name', '名称')" key="name" data-index="name" /> |
| | | <a-table-column :title="formatMessage('db.man_tag.flag', '标识')" key="flag" data-index="flag" /> |
| | | <a-table-column :title="formatMessage('db.man_tag.status', '状态')" key="status$" data-index="status$" /> |
| | | <a-table-column :title="formatMessage('db.man_tag.memo', '备注')" key="memo" data-index="memo" /> |
| | | <a-table-column :title="formatMessage('db.man_tag.count', '数量')" key="count" data-index="count" /> |
| | | <a-table-column :title="formatMessage('db.man_tag.level', '等级')" key="level" data-index="level" /> |
| | | <a-table-column :title="formatMessage('db.sys_menu.sort', '排序')" key="sort" data-index="sort" /> |
| | | <a-table-column :title="formatMessage('db.sys_menu.status', '状态')" key="status$" data-index="status$" /> |
| | | <a-table-column :title="formatMessage('common.operation', '操作')" key="oper" data-index="oper"> |
| | | <template #default="{ record }"> |
| | | <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> |
| | | </a-table-column> |
| | | </a-table> |
| | | </div> |
| | | </template> |
| | | |
| | | <style></style> |
| | |
| | | import { formatMessage } from '@/utils/localeUtils.js'; |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | const formTable = ref(null); |
| | | const submitButton = ref(null); |
| | | const isSave = ref(true); |
| | | const open = ref(false); |
| | |
| | | message.error(result.msg); |
| | | } |
| | | emit('tableReload', 'reload') |
| | | nextTick(() => { |
| | | formTable.value.resetFields() |
| | | }) |
| | | }) |
| | | }; |
| | | const onFinishFailed = errorInfo => { |
| | |
| | | <a-modal v-model:open="open" |
| | | :title="isSave ? formatMessage('page.add', '添加') : formatMessage('page.edit', '编辑')" @ok="handleOk" |
| | | style="width: 600px;"> |
| | | <a-form :model="formData" name="formTable" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" |
| | | <a-form :model="formData" ref="formTable" name="formTable" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" |
| | | style="display: flex;justify-content: space-between;flex-wrap: wrap;" autocomplete="off" |
| | | @finish="onFinish" @finishFailed="onFinishFailed"> |
| | | <a-form-item label="上级部门" name="parentId" style="width: 250px;" |
| | |
| | | import { formatMessage } from '@/utils/localeUtils.js'; |
| | | import { message } from 'ant-design-vue'; |
| | | |
| | | const formTable = ref(null); |
| | | const submitButton = ref(null); |
| | | const isSave = ref(true); |
| | | const open = ref(false); |
| | |
| | | message.error(result.msg); |
| | | } |
| | | emit('tableReload', 'reload') |
| | | nextTick(() => { |
| | | formTable.value.resetFields() |
| | | }) |
| | | }) |
| | | }; |
| | | const onFinishFailed = errorInfo => { |
| | |
| | | <a-modal v-model:open="open" |
| | | :title="isSave ? formatMessage('page.add', '添加') : formatMessage('page.edit', '编辑')" @ok="handleOk" |
| | | style="width: 600px;"> |
| | | <a-form :model="formData" name="formTable" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" |
| | | <a-form :model="formData" ref="formTable" name="formTable" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" |
| | | style="display: flex;justify-content: space-between;flex-wrap: wrap;" autocomplete="off" |
| | | @finish="onFinish" @finishFailed="onFinishFailed"> |
| | | @{FORMEDITCOLUMNS} |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.KeyValVo; |
| | | import com.zy.asrs.wms.common.domain.PageParam; |
| | | import com.zy.asrs.wms.asrs.entity.Tag; |
| | | import com.zy.asrs.wms.asrs.service.TagService; |
| | | import com.zy.asrs.wms.system.controller.BaseController; |
| | | import com.zy.asrs.wms.utils.ExcelUtil; |
| | | import com.zy.asrs.wms.utils.Utils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api") |
| | | public class TagController extends BaseController { |
| | | |
| | | @Autowired |
| | | private TagService tagService; |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:tag:list')") |
| | | @PostMapping("/tag/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<Tag, BaseParam> pageParam = new PageParam<>(baseParam, Tag.class); |
| | | return R.ok().add(tagService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:tag:list')") |
| | | @PostMapping("/tag/tree") |
| | | public R tree(@RequestBody Map<String, Object> map) { |
| | | List<Tag> tagList = tagService.list(new LambdaQueryWrapper<Tag>().orderByAsc(Tag::getSort)); |
| | | List<Tag> treeData = Utils.toTreeData(tagList, 0L, Tag::getParentId, Tag::getId, Tag::setChildren); |
| | | if (!Cools.isEmpty(map.get("condition"))) { |
| | | Utils.treeRemove(treeData, String.valueOf(map.get("condition")), Tag::getName, Tag::getChildren); |
| | | Utils.treeRemove(treeData, String.valueOf(map.get("condition")), Tag::getName, Tag::getChildren); |
| | | } |
| | | return R.ok().add(treeData); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:tag:list')") |
| | | @PostMapping("/tag/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(tagService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:tag:list')") |
| | | @GetMapping("/tag/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(tagService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:tag:save')") |
| | | @OperationLog("添加归类管理") |
| | | @PostMapping("/tag/save") |
| | | public R save(@RequestBody Tag tag) { |
| | | if (!tagService.save(tag)) { |
| | | return R.error("添加失败"); |
| | | } |
| | | return R.ok("添加成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:tag:update')") |
| | | @OperationLog("修改归类管理") |
| | | @PostMapping("/tag/update") |
| | | public R update(@RequestBody Tag tag) { |
| | | if (!tagService.updateById(tag)) { |
| | | return R.error("修改失败"); |
| | | } |
| | | return R.ok("修改成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:tag:remove')") |
| | | @OperationLog("删除归类管理") |
| | | @PostMapping("/tag/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!tagService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("删除失败"); |
| | | } |
| | | return R.ok("删除成功"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:tag:list')") |
| | | @PostMapping("/tag/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<Tag> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(Tag::getName, condition); |
| | | } |
| | | tagService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getName())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:tag:list')") |
| | | @PostMapping("/tag/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(tagService.list(), Tag.class), response); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.zy.asrs.wms.system.entity.Host; |
| | | import com.zy.asrs.wms.system.entity.User; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.SpringUtils; |
| | | import com.zy.asrs.wms.system.service.UserService; |
| | | import com.zy.asrs.wms.system.service.HostService; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @TableName("man_tag") |
| | | public class Tag implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ID |
| | | */ |
| | | @ApiModelProperty(value= "ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 编号 |
| | | */ |
| | | @ApiModelProperty(value= "编号") |
| | | private String uuid; |
| | | |
| | | /** |
| | | * 名称 |
| | | */ |
| | | @ApiModelProperty(value= "名称") |
| | | private String name; |
| | | |
| | | /** |
| | | * 标识 |
| | | */ |
| | | @ApiModelProperty(value= "标识") |
| | | private String flag; |
| | | |
| | | /** |
| | | * 所属机构 |
| | | */ |
| | | @ApiModelProperty(value= "所属机构") |
| | | private Long hostId; |
| | | |
| | | /** |
| | | * 状态 1: 正常 0: 禁用 |
| | | */ |
| | | @ApiModelProperty(value= "状态 1: 正常 0: 禁用 ") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 是否删除 1: 是 0: 否 |
| | | */ |
| | | @ApiModelProperty(value= "是否删除 1: 是 0: 否 ") |
| | | @TableLogic |
| | | private Integer deleted; |
| | | |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @ApiModelProperty(value= "添加时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 添加人员 |
| | | */ |
| | | @ApiModelProperty(value= "添加人员") |
| | | private Long createBy; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @ApiModelProperty(value= "修改时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 修改人员 |
| | | */ |
| | | @ApiModelProperty(value= "修改人员") |
| | | private Long updateBy; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value= "备注") |
| | | private String memo; |
| | | |
| | | /** |
| | | * 父级 |
| | | */ |
| | | @ApiModelProperty(value= "父级") |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * 父级名称 |
| | | */ |
| | | @ApiModelProperty(value= "父级名称") |
| | | private String parentName; |
| | | |
| | | /** |
| | | * 关联路径 |
| | | */ |
| | | @ApiModelProperty(value= "关联路径") |
| | | private String path; |
| | | |
| | | /** |
| | | * 关联路径名 |
| | | */ |
| | | @ApiModelProperty(value= "关联路径名") |
| | | private String pathName; |
| | | |
| | | /** |
| | | * 类型 0: 其他 |
| | | */ |
| | | @ApiModelProperty(value= "类型 0: 其他 ") |
| | | private Integer type; |
| | | |
| | | /** |
| | | * 数量 |
| | | */ |
| | | @ApiModelProperty(value= "数量") |
| | | private Integer count; |
| | | |
| | | /** |
| | | * 等级 |
| | | */ |
| | | @ApiModelProperty(value= "等级") |
| | | private Integer level; |
| | | |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @ApiModelProperty(value= "排序") |
| | | private Integer sort; |
| | | |
| | | @TableField(exist = false) |
| | | private List<Tag> children; |
| | | |
| | | public Tag() {} |
| | | |
| | | public Tag(String uuid,String name,String flag,Long hostId,Integer status,Integer deleted,Date createTime,Long createBy,Date updateTime,Long updateBy,String memo,Long parentId,String parentName,String path,String pathName,Integer type,Integer count,Integer level,Integer sort) { |
| | | this.uuid = uuid; |
| | | this.name = name; |
| | | this.flag = flag; |
| | | this.hostId = hostId; |
| | | this.status = status; |
| | | this.deleted = deleted; |
| | | this.createTime = createTime; |
| | | this.createBy = createBy; |
| | | this.updateTime = updateTime; |
| | | this.updateBy = updateBy; |
| | | this.memo = memo; |
| | | this.parentId = parentId; |
| | | this.parentName = parentName; |
| | | this.path = path; |
| | | this.pathName = pathName; |
| | | this.type = type; |
| | | this.count = count; |
| | | this.level = level; |
| | | this.sort = sort; |
| | | } |
| | | |
| | | // Tag tag = new Tag( |
| | | // null, // 编号 |
| | | // null, // 名称 |
| | | // null, // 标识 |
| | | // null, // 所属机构 |
| | | // null, // 状态 |
| | | // null, // 是否删除 |
| | | // null, // 添加时间 |
| | | // null, // 添加人员 |
| | | // null, // 修改时间 |
| | | // null, // 修改人员 |
| | | // null, // 备注 |
| | | // null, // 父级 |
| | | // null, // 父级名称 |
| | | // null, // 关联路径 |
| | | // null, // 关联路径名 |
| | | // null, // 类型 |
| | | // null, // 数量 |
| | | // null, // 等级 |
| | | // null // 排序 |
| | | // ); |
| | | |
| | | public String getHostId$(){ |
| | | HostService service = SpringUtils.getBean(HostService.class); |
| | | Host host = service.getById(this.hostId); |
| | | if (!Cools.isEmpty(host)){ |
| | | return String.valueOf(host.getName()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getStatus$(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | case 1: |
| | | return "正常"; |
| | | case 0: |
| | | return "禁用"; |
| | | default: |
| | | return String.valueOf(this.status); |
| | | } |
| | | } |
| | | |
| | | public String getDeleted$(){ |
| | | if (null == this.deleted){ return null; } |
| | | switch (this.deleted){ |
| | | case 1: |
| | | return "是"; |
| | | case 0: |
| | | return "否"; |
| | | default: |
| | | return String.valueOf(this.deleted); |
| | | } |
| | | } |
| | | |
| | | public String getCreateTime$(){ |
| | | if (Cools.isEmpty(this.createTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); |
| | | } |
| | | |
| | | public String getCreateBy$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.createBy); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getUpdateTime$(){ |
| | | if (Cools.isEmpty(this.updateTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); |
| | | } |
| | | |
| | | public String getUpdateBy$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.updateBy); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getType$(){ |
| | | if (null == this.type){ return null; } |
| | | switch (this.type){ |
| | | case 0: |
| | | return "其他"; |
| | | default: |
| | | return String.valueOf(this.type); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.mapper; |
| | | |
| | | import com.zy.asrs.wms.asrs.entity.Tag; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface TagMapper extends BaseMapper<Tag> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.wms.asrs.entity.Tag; |
| | | |
| | | public interface TagService extends IService<Tag> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.service.impl; |
| | | |
| | | import com.zy.asrs.wms.asrs.mapper.TagMapper; |
| | | import com.zy.asrs.wms.asrs.entity.Tag; |
| | | import com.zy.asrs.wms.asrs.service.TagService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("tagService") |
| | | public class TagServiceImpl extends ServiceImpl<TagMapper, Tag> implements TagService { |
| | | |
| | | } |
| | |
| | | List<Menu> menuList = menuService.list(new LambdaQueryWrapper<Menu>() |
| | | .in(Menu::getId, menus) |
| | | .eq(Menu::getType, Menu.TYPE_MENU) |
| | | .eq(Menu::getPath, 1) |
| | | .orderByAsc(Menu::getId)); |
| | | |
| | | return R.ok().add(menuList); |
| | |
| | | // generator.username="sa"; |
| | | // generator.password="Zoneyung@zy56$"; |
| | | |
| | | generator.table="sys_dict"; |
| | | generator.tableName="字典管理"; |
| | | generator.packagePath="com.zy.asrs.wms.system"; |
| | | generator.table="man_tag"; |
| | | generator.tableName="归类管理"; |
| | | generator.packagePath="com.zy.asrs.wms.asrs"; |
| | | |
| | | generator.build(); |
| | | } |
New file |
| | |
| | | -- save tag record |
| | | -- mysql |
| | | insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `host_id`, `status`) values ( '归类管理管理', '0', '/asrs/tag', '/asrs/tag', '0' , '0', '1' , '1'); |
| | | |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '查询归类管理', '', '1', 'asrs:tag:list', '0', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '添加归类管理', '', '1', 'asrs:tag:save', '1', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '修改归类管理', '', '1', 'asrs:tag:update', '2', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '删除归类管理', '', '1', 'asrs:tag:remove', '3', '1', '1'); |
| | | |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zy.asrs.wms.asrs.mapper.TagMapper"> |
| | | |
| | | </mapper> |