Merge branch 'master' of http://222.71.165.188:3000/linkage/YX-SCM
commit
30e63f041f
@ -0,0 +1,57 @@
|
|||||||
|
<template>
|
||||||
|
<BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? t('action.edit') : t('action.create')" @ok="handleSubmit">
|
||||||
|
<BasicForm @register="registerForm" />
|
||||||
|
</BasicModal>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, unref } from 'vue'
|
||||||
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
|
import { BasicForm, useForm } from '@/components/Form'
|
||||||
|
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||||
|
import { createFormSchema, updateFormSchema } from './businessOrganization.data'
|
||||||
|
import { createBusinessWarehouse, getBusinessWarehouse, updateBusinessWarehouse } from '@/api/xxjj/businessWarehouse'
|
||||||
|
|
||||||
|
defineOptions({ name: 'BusinessOrganizationModal' })
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
const { createMessage } = useMessage()
|
||||||
|
const emit = defineEmits(['success', 'register'])
|
||||||
|
const isUpdate = ref(true)
|
||||||
|
|
||||||
|
const [registerForm, { setFieldsValue, resetFields, resetSchema, validate }] = useForm({
|
||||||
|
labelWidth: 120,
|
||||||
|
baseColProps: { span: 24 },
|
||||||
|
schemas: createFormSchema,
|
||||||
|
showActionButtonGroup: false,
|
||||||
|
actionColOptions: { span: 23 }
|
||||||
|
})
|
||||||
|
|
||||||
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||||
|
resetFields()
|
||||||
|
setModalProps({ confirmLoading: false })
|
||||||
|
isUpdate.value = !!data?.isUpdate
|
||||||
|
if (unref(isUpdate)) {
|
||||||
|
resetSchema(updateFormSchema)
|
||||||
|
const res = await getBusinessWarehouse(data.record.id)
|
||||||
|
setFieldsValue({ ...res })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
async function handleSubmit() {
|
||||||
|
try {
|
||||||
|
const values = await validate()
|
||||||
|
setModalProps({ confirmLoading: true })
|
||||||
|
if (unref(isUpdate)) {
|
||||||
|
await updateBusinessWarehouse(values)
|
||||||
|
} else {
|
||||||
|
await createBusinessWarehouse(values)
|
||||||
|
}
|
||||||
|
closeModal()
|
||||||
|
emit('success')
|
||||||
|
createMessage.success(t('common.saveSuccessText'))
|
||||||
|
} finally {
|
||||||
|
setModalProps({ confirmLoading: false })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@ -0,0 +1,92 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<BasicTable @register="registerTable">
|
||||||
|
<template #toolbar>
|
||||||
|
<a-button type="primary" v-auth="['system:business-warehouse:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
|
||||||
|
{{ t('action.create') }}
|
||||||
|
</a-button>
|
||||||
|
<a-button type="warning" v-auth="['system:business-warehouse:export']" :preIcon="IconEnum.EXPORT" @click="handleExport">
|
||||||
|
{{ t('action.export') }}
|
||||||
|
</a-button>
|
||||||
|
</template>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<TableAction
|
||||||
|
:actions="[
|
||||||
|
{ icon: IconEnum.EDIT, label: t('action.edit'), auth: 'system:business-warehouse:update', onClick: handleEdit.bind(null, record) },
|
||||||
|
{
|
||||||
|
icon: IconEnum.DELETE,
|
||||||
|
color: 'error',
|
||||||
|
label: t('action.delete'),
|
||||||
|
auth: 'system:business-warehouse:delete',
|
||||||
|
popConfirm: {
|
||||||
|
title: t('common.delMessage'),
|
||||||
|
placement: 'left',
|
||||||
|
confirm: handleDelete.bind(null, record)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
<BusinessOrganizationModal @register="registerModal" @success="reload()" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
|
import { useModal } from '@/components/Modal'
|
||||||
|
import BusinessOrganizationModal from './BusinessOrganizationModal.vue'
|
||||||
|
import { IconEnum } from '@/enums/appEnum'
|
||||||
|
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
||||||
|
import { deleteBusinessWarehouse, exportBusinessWarehouse, getBusinessWarehousePage } from '@/api/xxjj/businessWarehouse'
|
||||||
|
import { columns, searchFormSchema } from './businessOrganization.data'
|
||||||
|
|
||||||
|
defineOptions({ name: 'BusinessOrganization' })
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
const { createConfirm, createMessage } = useMessage()
|
||||||
|
const [registerModal, { openModal }] = useModal()
|
||||||
|
|
||||||
|
const [registerTable, { getForm, reload }] = useTable({
|
||||||
|
title: '业务线列表',
|
||||||
|
api: getBusinessWarehousePage,
|
||||||
|
columns,
|
||||||
|
formConfig: { labelWidth: 120, schemas: searchFormSchema },
|
||||||
|
useSearchForm: true,
|
||||||
|
showTableSetting: true,
|
||||||
|
actionColumn: {
|
||||||
|
width: 140,
|
||||||
|
title: t('common.action'),
|
||||||
|
dataIndex: 'action',
|
||||||
|
fixed: 'right'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function handleCreate() {
|
||||||
|
openModal(true, { isUpdate: false })
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleEdit(record: Recordable) {
|
||||||
|
openModal(true, { record, isUpdate: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleExport() {
|
||||||
|
createConfirm({
|
||||||
|
title: t('common.exportTitle'),
|
||||||
|
iconType: 'warning',
|
||||||
|
content: t('common.exportMessage'),
|
||||||
|
async onOk() {
|
||||||
|
await exportBusinessWarehouse(getForm().getFieldsValue())
|
||||||
|
createMessage.success(t('common.exportSuccessText'))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleDelete(record: Recordable) {
|
||||||
|
await deleteBusinessWarehouse(record.id)
|
||||||
|
createMessage.success(t('common.delSuccessText'))
|
||||||
|
reload()
|
||||||
|
}
|
||||||
|
</script>
|
@ -0,0 +1,42 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { onMounted, ref } from 'vue'
|
||||||
|
|
||||||
|
import type { TreeItem } from '@/components/Tree'
|
||||||
|
import { BasicTree } from '@/components/Tree'
|
||||||
|
import { listSimpleDept } from '@/api/system/dept'
|
||||||
|
import { listSimpleBusiness } from '@/api/xxjj/businessWarehouse'
|
||||||
|
import { handleTree } from '@/utils/tree'
|
||||||
|
|
||||||
|
defineOptions({ name: 'SystemDeptTree' })
|
||||||
|
|
||||||
|
const emit = defineEmits(['select'])
|
||||||
|
const treeData = ref<TreeItem[]>([])
|
||||||
|
|
||||||
|
async function fetch() {
|
||||||
|
const res = await listSimpleBusiness()
|
||||||
|
treeData.value = handleTree(res, 'id')
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSelect(keys) {
|
||||||
|
emit('select', keys[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
fetch()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="m-4 mr-0 overflow-hidden">
|
||||||
|
<BasicTree
|
||||||
|
title="业务线列表"
|
||||||
|
toolbar
|
||||||
|
search
|
||||||
|
tree-wrapper-class-name="h-[calc(100%-35px)] overflow-auto"
|
||||||
|
:click-row-to-expand="false"
|
||||||
|
:tree-data="treeData"
|
||||||
|
:field-names="{ key: 'id', title: 'name' }"
|
||||||
|
@select="handleSelect"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
@ -0,0 +1,57 @@
|
|||||||
|
<template>
|
||||||
|
<BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? t('action.edit') : t('action.create')" @ok="handleSubmit">
|
||||||
|
<BasicForm @register="registerForm" />
|
||||||
|
</BasicModal>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, unref } from 'vue'
|
||||||
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
|
import { BasicForm, useForm } from '@/components/Form'
|
||||||
|
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||||
|
import { createFormSchema, updateFormSchema } from './businessWarehouse.data'
|
||||||
|
import { createBusinessWarehouse, getBusinessWarehouse, updateBusinessWarehouse } from '@/api/xxjj/businessWarehouse'
|
||||||
|
|
||||||
|
defineOptions({ name: 'BusinessWarehouseModal' })
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
const { createMessage } = useMessage()
|
||||||
|
const emit = defineEmits(['success', 'register'])
|
||||||
|
const isUpdate = ref(true)
|
||||||
|
|
||||||
|
const [registerForm, { setFieldsValue, resetFields, resetSchema, validate }] = useForm({
|
||||||
|
labelWidth: 120,
|
||||||
|
baseColProps: { span: 24 },
|
||||||
|
schemas: createFormSchema,
|
||||||
|
showActionButtonGroup: false,
|
||||||
|
actionColOptions: { span: 23 }
|
||||||
|
})
|
||||||
|
|
||||||
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||||
|
resetFields()
|
||||||
|
setModalProps({ confirmLoading: false })
|
||||||
|
isUpdate.value = !!data?.isUpdate
|
||||||
|
if (unref(isUpdate)) {
|
||||||
|
resetSchema(updateFormSchema)
|
||||||
|
const res = await getBusinessWarehouse(data.record.id)
|
||||||
|
setFieldsValue({ ...res })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
async function handleSubmit() {
|
||||||
|
try {
|
||||||
|
const values = await validate()
|
||||||
|
setModalProps({ confirmLoading: true })
|
||||||
|
if (unref(isUpdate)) {
|
||||||
|
await updateBusinessWarehouse(values)
|
||||||
|
} else {
|
||||||
|
await createBusinessWarehouse(values)
|
||||||
|
}
|
||||||
|
closeModal()
|
||||||
|
emit('success')
|
||||||
|
createMessage.success(t('common.saveSuccessText'))
|
||||||
|
} finally {
|
||||||
|
setModalProps({ confirmLoading: false })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@ -0,0 +1,102 @@
|
|||||||
|
<template>
|
||||||
|
<div class="flex">
|
||||||
|
<BusinessTree class="w-1/4 xl:w-1/5" @select="handleSelect" />
|
||||||
|
<BasicTable class="w-3/4 xl:w-4/5" :search-info="searchInfo" @register="registerTable">
|
||||||
|
<template #toolbar>
|
||||||
|
<a-button type="primary" v-auth="['system:business-warehouse:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
|
||||||
|
{{ t('action.create') }}
|
||||||
|
</a-button>
|
||||||
|
<a-button type="warning" v-auth="['system:business-warehouse:export']" :preIcon="IconEnum.EXPORT" @click="handleExport">
|
||||||
|
{{ t('action.export') }}
|
||||||
|
</a-button>
|
||||||
|
</template>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<TableAction
|
||||||
|
:actions="[
|
||||||
|
{ icon: IconEnum.EDIT, label: t('action.edit'), auth: 'system:business-warehouse:update', onClick: handleEdit.bind(null, record) },
|
||||||
|
{
|
||||||
|
icon: IconEnum.DELETE,
|
||||||
|
color: 'error',
|
||||||
|
label: t('action.delete'),
|
||||||
|
auth: 'system:business-warehouse:delete',
|
||||||
|
popConfirm: {
|
||||||
|
title: t('common.delMessage'),
|
||||||
|
placement: 'left',
|
||||||
|
confirm: handleDelete.bind(null, record)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
<BusinessWarehouseModal @register="registerModal" @success="reload()" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { reactive } from 'vue'
|
||||||
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
|
import { useModal } from '@/components/Modal'
|
||||||
|
import BusinessWarehouseModal from './BusinessWarehouseModal.vue'
|
||||||
|
import { IconEnum } from '@/enums/appEnum'
|
||||||
|
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
||||||
|
import { deleteBusinessWarehouse, exportBusinessWarehouse, getBusinessWarehousePage } from '@/api/xxjj/businessWarehouse'
|
||||||
|
import { columns, searchFormSchema } from './businessWarehouse.data'
|
||||||
|
import BusinessTree from './BusinessTree.vue'
|
||||||
|
|
||||||
|
defineOptions({ name: 'BusinessWarehouse' })
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
const { createConfirm, createMessage } = useMessage()
|
||||||
|
const [registerModal, { openModal }] = useModal()
|
||||||
|
const searchInfo = reactive<Recordable>({})
|
||||||
|
|
||||||
|
const [registerTable, { getForm, reload }] = useTable({
|
||||||
|
title: '业务线/仓库列表',
|
||||||
|
api: getBusinessWarehousePage,
|
||||||
|
columns,
|
||||||
|
formConfig: { labelWidth: 120, schemas: searchFormSchema },
|
||||||
|
useSearchForm: true,
|
||||||
|
showTableSetting: true,
|
||||||
|
actionColumn: {
|
||||||
|
width: 140,
|
||||||
|
title: t('common.action'),
|
||||||
|
dataIndex: 'action',
|
||||||
|
fixed: 'right'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function handleCreate() {
|
||||||
|
openModal(true, { isUpdate: false })
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleEdit(record: Recordable) {
|
||||||
|
openModal(true, { record, isUpdate: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleExport() {
|
||||||
|
createConfirm({
|
||||||
|
title: t('common.exportTitle'),
|
||||||
|
iconType: 'warning',
|
||||||
|
content: t('common.exportMessage'),
|
||||||
|
async onOk() {
|
||||||
|
await exportBusinessWarehouse(getForm().getFieldsValue())
|
||||||
|
createMessage.success(t('common.exportSuccessText'))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleDelete(record: Recordable) {
|
||||||
|
await deleteBusinessWarehouse(record.id)
|
||||||
|
createMessage.success(t('common.delSuccessText'))
|
||||||
|
reload()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 点击部门操作 */
|
||||||
|
function handleSelect(deptId = '') {
|
||||||
|
searchInfo.deptId = deptId
|
||||||
|
reload()
|
||||||
|
}
|
||||||
|
</script>
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.yunxi.scm.module.system.enums.business;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum BusinessEnum {
|
||||||
|
|
||||||
|
ENABLE("0"), // 启用
|
||||||
|
|
||||||
|
DISABLE("1"); // 禁用
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private final String status;
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.yunxi.scm.module.system.controller.admin.businesswarehouse.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 业务线表精简信息 Response VO")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class BusinessSimpleRespVo {
|
||||||
|
|
||||||
|
@Schema(description = "业务线编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "业务线名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "父部门 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private Long parentId;
|
||||||
|
}
|
Loading…
Reference in new issue