qhw-dev-1010
qiuhongwu 1 year ago
parent 52df6c6b76
commit e566c2bac7

@ -0,0 +1,379 @@
<script lang="ts" setup>
import type { UnwrapRef, VueElement } from 'vue'
import { onMounted, reactive, ref, watch } from 'vue'
import { RedoOutlined, SearchOutlined, UserOutlined } from '@ant-design/icons-vue'
import type { FormProps, ItemType, MenuProps, SelectProps, TableColumnsType } from 'ant-design-vue'
import type { Dayjs } from 'dayjs'
// key
const selectedKeys = ref<string[]>(['1'])
//
const navopenKeys = ref<string[]>(['sub1'])
const items: any = reactive<ItemType[]>([])
function getItem(
label: VueElement | string,
key: string,
icon?: any,
children?: ItemType[],
type?: 'group',
): ItemType {
return {
key,
icon,
children,
label,
type,
} as ItemType
}
//
async function fetchMenuItems() {
//
await new Promise(resolve => setTimeout(resolve, 1000))
//
return [
{
label: '废铁',
key: 'sub1',
icon:'',
children: [
{ label: '车间名称', key: '1' },
{ label: '仓库名称', key: '模拟名称2' },
{ label: '车间名称', key: '模拟名称3' },
{ label: '车间名称', key: '模拟名称4' },
{ label: '车间名称', key: '5' },
{ label: '车间名称', key: '6' },
],
},
{
label: '废铝',
key: 'sub2',
icon:'',
children: [
{ label: '车间名称7', key: '7' },
{ label: '车间名称8', key: '8' },
{ label: '车间名称9', key: '9' },
{ label: '车间名称10', key: '10' },
{ label: '车间名称11', key: '11' },
{ label: '车间名称12', key: '12' },
],
},
]
}
// 使
async function fetchData() {
try {
const data = await fetchMenuItems()
// 使
// itemsreactivefetchData使spliceitemsfetchDataitems
items.splice(0, items.length, ...data.map(item => getItem(item.label, item.key, null, item.children)))
// items.value = data.map(item => getItem(item.label, item.key, null, item.children))
}
catch (error) {
console.error('Error fetching menu items:', error)
}
}
/////////////////////////////////////////////////////////////
//
//
interface FormState {
username: string
}
const formState: UnwrapRef<FormState> = reactive({
username: '',
})
const onFinish: FormProps['onFinish'] = (values) => {
console.log(values, formState)
}
const onFinishFailed: FormProps['onFinishFailed'] = (errors) => {
console.log(errors)
}
//
const options = ref<SelectProps['options']>([
{ value: 'jack', label: 'Jack' },
{ value: 'lucy', label: 'Lucy' },
{ value: 'tom', label: 'Tom' },
])
function handleChange(value: string) {
console.log(`selected ${value}`)
}
function handleBlur() {
console.log('blur')
}
function handleFocus() {
console.log('focus')
}
function filterOption(input: string, option: any) {
return option.value.toLowerCase().includes(input.toLowerCase())
}
const department = ref<string | undefined>(undefined)
//
const columns: TableColumnsType = [
{ title: 'Full Name', width: 100, dataIndex: 'name', key: 'name', fixed: 'left' },
{ title: 'Age', width: 100, dataIndex: 'age', key: 'age', fixed: 'left' },
{ title: 'Column 1', dataIndex: 'address', key: '1', width: 150 },
{ title: 'Column 2', dataIndex: 'address', key: '2', width: 150 },
{ title: 'Column 3', dataIndex: 'address', key: '3', width: 150 },
{ title: 'Column 4', dataIndex: 'address', key: '4', width: 150 },
{ title: 'Column 5', dataIndex: 'address', key: '5', width: 150 },
{ title: 'Column 6', dataIndex: 'address', key: '6', width: 150 },
{ title: 'Column 7', dataIndex: 'address', key: '7', width: 150 },
{ title: 'Column 8', dataIndex: 'address', key: '8' },
{
title: 'Action',
key: 'operation',
fixed: 'right',
width: 100,
},
]
interface DataItem {
key: number
name: string
age: number
address: string
}
const data: DataItem[] = []
for (let i = 0; i < 100; i++) {
data.push({
key: i,
name: `Edrward ${i}`,
age: 32,
address: `London Park no. ${i}`,
})
}
// //
// function myFunction({ item, key, selectedKeys }) {
// // 使 itemkey selectedKeys
// console.log(item)
// console.log(key)
// console.log(selectedKeys)
// }
// // itemkey selectedKeys
// const data = {
// item: '',
// key: 'someKey',
// selectedKeys: ['key1', 'key2'],
// }
// myFunction(data)
onMounted(() => {
fetchData()
})
const handleClick: MenuProps['onClick'] = (e) => {
console.log(e)
console.log('click', e)
alert(`当前打开的是${e.key}`)
}
watch(navopenKeys, (val) => {
console.log('navopenKeys', val)
})
</script>
<template>
<a-card class="card">
<div class="mainbody">
<div class="aside">
<div class="search">
<a-input placeholder="请输入搜索内容">
<template #prefix>
<SearchOutlined />
</template>
</a-input>
</div>
<a-menu
id="dddddd"
v-model:openKeys="navopenKeys"
v-model:selectedKeys="selectedKeys"
style="width: 256px;height: 900px;"
mode="inline"
:items="items"
@click="handleClick"
/>
</div>
<div class="main">
<div class="designation">
<p>
<span></span>
{{ `车间名称` }}
</p>
</div>
<!-- 表单 -->
<div class="inquiry">
<a-form
:model="formState"
name="horizontal_login"
layout="inline"
autocomplete="off"
style="display: flex;"
@finish="onFinish"
@finishFailed="onFinishFailed"
>
<a-form-item
name="username"
style="width: 240px;"
:rules="[{ required: true, message: '输入姓名/工号/手机号/邮箱!' }]"
>
<a-input v-model:value="formState.username" placeholder="输入姓名/工号/手机号/邮箱">
<template #prefix>
<UserOutlined class="site-form-item-icon" />
</template>
</a-input>
</a-form-item>
<a-form-item
name="username"
:rules="[{ required: true, message: '请选择部门!' }]"
>
<a-select
v-model:value="department"
placeholder="选择部门"
style="width: 200px"
:options="options"
:filter-option="filterOption"
@focus="handleFocus"
@blur="handleBlur"
@change="handleChange"
>
<a-select-option value="jack">
Jack
</a-select-option>
<a-select-option value="lucy">
Lucy
</a-select-option>
<a-select-option value="disabled" disabled>
Disabled
</a-select-option>
<a-select-option value="Yiminghe">
yiminghe
</a-select-option>
</a-select>
</a-form-item>
<a-form-item
name="username"
style="width: 240px;"
:rules="[{ required: true, message: '选择时间!' }]"
>
<a-range-picker v-model:value="value1" style="margin-right:10px;" />
</a-form-item>
<a-form-item>
<a-button type="primary" html-type="submit" style="margin-right:10px;">
<SearchOutlined />
查询
</a-button>
<a-button html-type="submit">
<RedoOutlined />
重置
</a-button>
</a-form-item>
</a-form>
</div>
<!-- 关联 导入 -->
<div class="relevance">
<a-button type="primary" html-type="submit" style="margin-right:10px;">
<SearchOutlined />
关联员工
</a-button>
<a-button html-type="submit">
<RedoOutlined />
导入数据
</a-button>
</div>
<!-- 表格 -->
<div class="tablestyle">
<a-table :columns="columns" :data-source="data" :scroll="{ x: 1500, y: 300 }">
<template #bodyCell="{ column }">
<template v-if="column.key === 'operation'">
<a>action</a>
</template>
</template>
</a-table>
</div>
</div>
</div>
</a-card>
</template>
<style scoped lang="less">
.card{
box-sizing: border-box;
width: 90%;
margin: 0 auto;
overflow: hidden;
border-radius: 3px;
.mainbody{
box-sizing: border-box;
display: flex;
width: 100%;
height: 1000px;
.aside{
margin: 50px 0;
.search{
margin: 10px ;
}
}
.main{
margin: 20px;
.designation{
padding-bottom: 16px;
margin: 10px 0 ;
p{
width: 110px;
height: 24px;
margin-bottom: 15px;
font-family: "AlibabaPuHuiTi_3_55_Regular-55 Regular";
font-size:22px;
line-height: 24px;
color: #262626;
background: linear-gradient(90deg, #9EF9FF 0%, #FFF 100%);
span{
font-size:20px;
color:#409EFF;
}
}
}
.inquiry{
display: flex;
justify-content: space-around;
width: 100%;
}
.relevance{
margin: 30px 0;
}
}
}
}
</style>

@ -1,47 +1,12 @@
<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 BusinessOrganizationModal from './BusinessOrganizationModal.vue'
import { columns, searchFormSchema } from './businessOrganization.data'
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 { BasicTable, TableAction, useTable } from '@/components/Table'
import { deleteBusinessWarehouse, exportBusinessWarehouse, getBusinessWarehousePage } from '@/api/xxjj/businessWarehouse'
import { columns, searchFormSchema } from './businessOrganization.data'
defineOptions({ name: 'BusinessOrganization' })
@ -60,8 +25,8 @@ const [registerTable, { getForm, reload }] = useTable({
width: 140,
title: t('common.action'),
dataIndex: 'action',
fixed: 'right'
}
fixed: 'right',
},
})
function handleCreate() {
@ -80,7 +45,7 @@ async function handleExport() {
async onOk() {
await exportBusinessWarehouse(getForm().getFieldsValue())
createMessage.success(t('common.exportSuccessText'))
}
},
})
}
@ -90,3 +55,39 @@ async function handleDelete(record: Recordable) {
reload()
}
</script>
<template>
<div>
<BasicTable @register="registerTable">
<template #toolbar>
<a-button v-auth="['system:business-warehouse:create']" type="primary" :pre-icon="IconEnum.ADD" @click="handleCreate">
{{ t('action.create') }}
</a-button>
<a-button v-auth="['system:business-warehouse:export']" type="warning" :pre-icon="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>

@ -1,22 +1,17 @@
<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 { createFormSchema, updateFormSchema } from './businessWarehouse.data'
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 emit = defineEmits(['success', 'register'])
const { t } = useI18n()
const { createMessage } = useMessage()
const emit = defineEmits(['success', 'register'])
const isUpdate = ref(true)
const [registerForm, { setFieldsValue, resetFields, resetSchema, validate }] = useForm({
@ -24,7 +19,7 @@ const [registerForm, { setFieldsValue, resetFields, resetSchema, validate }] = u
baseColProps: { span: 24 },
schemas: createFormSchema,
showActionButtonGroup: false,
actionColOptions: { span: 23 }
actionColOptions: { span: 23 },
})
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
@ -42,16 +37,23 @@ async function handleSubmit() {
try {
const values = await validate()
setModalProps({ confirmLoading: true })
if (unref(isUpdate)) {
if (unref(isUpdate))
await updateBusinessWarehouse(values)
} else {
else
await createBusinessWarehouse(values)
}
closeModal()
emit('success')
createMessage.success(t('common.saveSuccessText'))
} finally {
}
finally {
setModalProps({ confirmLoading: false })
}
}
</script>
<template>
<BasicModal v-bind="$attrs" :title="isUpdate ? t('action.edit') : t('action.create')" @register="registerModal" @ok="handleSubmit">
<BasicForm @register="registerForm" />
</BasicModal>
</template>

@ -1,11 +1,12 @@
import { BasicColumn, FormSchema, useRender } from '@/components/Table'
import type { BasicColumn, FormSchema } from '@/components/Table'
import { useRender } from '@/components/Table'
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
export const columns: BasicColumn[] = [
{
title: '业务线名称',
dataIndex: 'name',
width: 160
width: 160,
},
{
title: '类型',
@ -13,7 +14,7 @@ export const columns: BasicColumn[] = [
width: 180,
customRender: ({ text }) => {
return useRender.renderDict(text, DICT_TYPE.BUSINESS_TYPE)
}
},
},
{
title: '状态',
@ -21,27 +22,27 @@ export const columns: BasicColumn[] = [
width: 180,
customRender: ({ text }) => {
return useRender.renderDict(text, DICT_TYPE.CLASS_STATUS)
}
},
},
{
title: '关联机构',
dataIndex: 'institutionNum',
width: 160
width: 160,
},
{
title: '成员数量',
dataIndex: 'employeeNum',
width: 160
width: 160,
},
{
title: '主管人员',
dataIndex: 'belongUserId',
width: 160
width: 160,
},
{
title: '介绍',
dataIndex: 'description',
width: 160
width: 160,
},
{
title: '更新时间',
@ -49,7 +50,7 @@ export const columns: BasicColumn[] = [
width: 180,
customRender: ({ text }) => {
return useRender.renderDate(text)
}
},
},
]
@ -58,7 +59,7 @@ export const searchFormSchema: FormSchema[] = [
label: '业务线名称',
field: 'name',
component: 'Input',
colProps: { span: 8 }
colProps: { span: 8 },
},
// {
// label: '类型',
@ -112,60 +113,60 @@ export const createFormSchema: FormSchema[] = [
label: '编号',
field: 'id',
show: false,
component: 'Input'
component: 'Input',
},
{
label: '业务线编号',
field: 'businessCode',
required: true,
component: 'Input'
component: 'Input',
},
{
label: '业务线名称',
field: 'name',
required: true,
component: 'Input'
component: 'Input',
},
{
label: '业务线简称',
field: 'businessSimple',
component: 'Input'
component: 'Input',
},
{
label: '类型',
field: 'type',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.BUSINESS_TYPE, 'number')
}
options: getDictOptions(DICT_TYPE.BUSINESS_TYPE, 'number'),
},
},
{
label: '所属行业',
field: 'industry',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.DUTY_TYPE, 'number')
}
options: getDictOptions(DICT_TYPE.DUTY_TYPE, 'number'),
},
},
{
label: '所在城市',
field: 'city',
component: 'Input'
component: 'Input',
},
{
label: '成立时间',
field: 'establishDate',
component: 'DatePicker'
component: 'DatePicker',
},
{
label: '介绍',
field: 'description',
component: 'InputTextArea'
component: 'InputTextArea',
},
{
label: '归属人员',
field: 'belongUserId',
component: 'Input'
component: 'Input',
},
{
label: '区分标志',
@ -173,8 +174,8 @@ export const createFormSchema: FormSchema[] = [
required: true,
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.DIFF_FLAG, 'number')
}
options: getDictOptions(DICT_TYPE.DIFF_FLAG, 'number'),
},
},
]
@ -183,60 +184,60 @@ export const updateFormSchema: FormSchema[] = [
label: '编号',
field: 'id',
show: false,
component: 'Input'
component: 'Input',
},
{
label: '业务线编号',
field: 'businessCode',
required: true,
component: 'Input'
component: 'Input',
},
{
label: '业务线名称',
field: 'name',
required: true,
component: 'Input'
component: 'Input',
},
{
label: '业务线简称',
field: 'businessSimple',
component: 'Input'
component: 'Input',
},
{
label: '类型',
field: 'type',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.BUSINESS_TYPE, 'number')
}
options: getDictOptions(DICT_TYPE.BUSINESS_TYPE, 'number'),
},
},
{
label: '所属行业',
field: 'industry',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.DUTY_TYPE, 'number')
}
options: getDictOptions(DICT_TYPE.DUTY_TYPE, 'number'),
},
},
{
label: '所在城市',
field: 'city',
component: 'Input'
component: 'Input',
},
{
label: '成立时间',
field: 'establishDate',
component: 'DatePicker'
component: 'DatePicker',
},
{
label: '介绍',
field: 'description',
component: 'InputTextArea'
component: 'InputTextArea',
},
{
label: '归属人员',
field: 'belongUserId',
component: 'Input'
component: 'Input',
},
{
label: '区分标志',
@ -244,7 +245,7 @@ export const updateFormSchema: FormSchema[] = [
required: true,
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.DIFF_FLAG, 'number')
}
options: getDictOptions(DICT_TYPE.DIFF_FLAG, 'number'),
},
},
]
]

@ -1,50 +1,14 @@
<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 BusinessWarehouseModal from './BusinessWarehouseModal.vue'
import { columns, searchFormSchema } from './businessWarehouse.data'
import BusinessTree from './BusinessTree.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 { BasicTable, TableAction, useTable } 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' })
@ -64,8 +28,8 @@ const [registerTable, { getForm, reload }] = useTable({
width: 140,
title: t('common.action'),
dataIndex: 'action',
fixed: 'right'
}
fixed: 'right',
},
})
function handleCreate() {
@ -84,7 +48,7 @@ async function handleExport() {
async onOk() {
await exportBusinessWarehouse(getForm().getFieldsValue())
createMessage.success(t('common.exportSuccessText'))
}
},
})
}
@ -100,3 +64,40 @@ function handleSelect(deptId = '') {
reload()
}
</script>
<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 v-auth="['system:business-warehouse:create']" type="primary" :pre-icon="IconEnum.ADD" @click="handleCreate">
{{ t('action.create') }}
</a-button>
<a-button v-auth="['system:business-warehouse:export']" type="warning" :pre-icon="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>

Loading…
Cancel
Save