基础资料优化处理

main
GaoF 2024-08-05 09:19:55 +08:00
parent 4bbeda9f60
commit d60c2992f7
17 changed files with 108 additions and 74 deletions

View File

@ -30,12 +30,11 @@
</span>
</div>
</div>
<a-directory-tree
<a-tree
:loading="localLoading"
show-line
v-model:expandedKeys="expandedKeys"
v-model:selectedKeys="selectedKeys"
multiple
:fieldNames="{
children: 'children',
title: 'name',
@ -43,7 +42,7 @@
}"
:tree-data="treeData"
@select="handleTreeClick"
></a-directory-tree>
></a-tree>
</a-spin>
</div>
</template>
@ -120,18 +119,16 @@
const expandedKeys = ref()
const selectedKeys = ref([])
const localLoading = ref(false)
const treeData = ref([
{
id: 0,
parentId: '-1',
name: '所有',
children: ''
}
])
const treeData = ref([])
let treeRow = {}
let paramsValue = {}
const handleTreeClick = (selectedKeys, event) => {
treeRow = event.node
if (selectedKeys.length > 0) {
treeRow = event.node
} else {
treeRow = {}
}
emit('selectTree', treeRow)
}
@ -150,23 +147,24 @@
selectedKeys.value = []
treeRow = {}
emit('delTree', treeRow)
loadTreeData()
loadTreeData(paramsValue)
})
}
const handleRefresh = () => {
loadTreeData()
loadTreeData(paramsValue)
emit('treeRefresh')
}
const loadTreeData = async () => {
const loadTreeData = async (params) => {
try {
paramsValue = params
localLoading.value = true
const treeRes = await props.apiModel.getTree()
const treeRes = await props.apiModel.getTree(paramsValue)
if (Array.isArray(treeRes)) {
treeData.value[0].children = treeRes
treeData.value = treeRes
} else {
treeData.value[0].children = []
treeData.value = []
}
if (selectedKeys.value.length > 0) {

View File

@ -31,7 +31,7 @@ const DEFAULT_CONFIG = {
REQUEST_CACHE: false,
// 布局 经典classical双排菜单doublerow, 顶栏菜单top
SNOWY_LAYOUT: 'doublerow',
SNOWY_LAYOUT: 'classical',
// 菜单是否折叠
SNOWY_MENU_COLLAPSE: false,
@ -70,7 +70,7 @@ const DEFAULT_CONFIG = {
COLOR: '#1677FF',
// 默认整体主题
SNOWY_THEME: 'dark',
SNOWY_THEME: 'light',
// 整体表单风格
SNOWY_FORM_STYLE: 'drawer',

View File

@ -93,8 +93,8 @@ export default function useFormHandler(formItems, api) {
* 处理返回操作返回上一级页面并关闭当前标签页
*/
const handleBack = () => {
useTabs.close(route)
// router.push('/basicData/unit') // 优化为通用的返回上一页操作
// useTabs.close(route)
router.push('/basicData/publicAccount') // 优化为通用的返回上一页操作
}
/**

View File

@ -6,6 +6,23 @@
<fullscreen-outlined />
</div>
<!-- <dev-user-message />-->
<!-- <a-dropdown v-if="!isMobile" class="panel-item">
<global-outlined />
<template #overlay>
<a-menu :selected-keys="lang">
<a-menu-item key="zh-cn" @click="handleIn18('zh-cn')">
<span>简体中文</span>
</a-menu-item>
<a-menu-item key="en" @click="handleIn18('en')">
<span>English</span>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>-->
<div class="setting panel-item" @click="openSetting">
<layout-outlined />
</div>
<a-dropdown class="user panel-item">
<div class="user-avatar">
<a-avatar :src="userInfo ? userInfo.avatar : undefined" />
@ -29,22 +46,6 @@
</a-menu>
</template>
</a-dropdown>
<a-dropdown v-if="!isMobile" class="panel-item">
<global-outlined />
<template #overlay>
<a-menu :selected-keys="lang">
<a-menu-item key="zh-cn" @click="handleIn18('zh-cn')">
<span>简体中文</span>
</a-menu-item>
<a-menu-item key="en" @click="handleIn18('en')">
<span>English</span>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
<div class="setting panel-item" @click="openSetting">
<layout-outlined />
</div>
</div>
<!-- 整体风格设置抽屉 -->

View File

@ -8,7 +8,7 @@
* 5.不可二次分发开源参与同类竞品如有想法可联系团队xiaonuobase@qq.com商议合作
* 6.若您的项目无法满足以上几点需要更多功能代码获取Snowy商业授权许可请在官网购买授权地址为 https://www.xiaonuo.vip
*/
import { createRouter, createWebHistory } from 'vue-router'
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
import { notification } from 'ant-design-vue'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
@ -37,7 +37,7 @@ const routes_404 = [
const routes = [...systemRouter, ...whiteListRouters, ...routes_404]
const router = createRouter({
history: createWebHistory(),
history: createWebHashHistory(),
routes
})

View File

@ -41,7 +41,7 @@
:row-selection="options.rowSelection"
:scroll="{
x: 100,
y: 'calc(100vh - 300px)'
}"
>
<template #operator>

View File

@ -1,6 +1,6 @@
<template>
<xn-form-container
:title="formData.id ? '编辑客户' : '增加客户'"
:title="formData.id ? '编辑客户分类' : '增加客户分类'"
:width="700"
:visible="visible"
:destroy-on-close="true"
@ -85,7 +85,7 @@
{
id: 0,
parentId: '0',
name: '所有',
name: '顶级',
children: res ? res : []
}
]

View File

@ -202,7 +202,7 @@
name: 'brandId',
type: 'a-select',
span: 8,
rules: [required('请选择品牌')],
// rules: [required('')],
attrs: {
placeholder: '请选择品牌',
options: tool.dictList('COMMON_STATUS'),
@ -427,14 +427,7 @@
.then((res) => {
clientFormItems.forEach((item) => {
if (item.name === 'categoryId') {
item.attrs.treeData = [
{
id: 0,
parentId: '-1',
name: '所有',
children: res || []
}
]
item.attrs.treeData = res || []
}
})
})

View File

@ -58,7 +58,7 @@
:row-selection="options.rowSelection"
:scroll="{
x: 100,
y: 'calc(100vh - 300px)'
}"
>
<template #operator>

View File

@ -59,6 +59,8 @@
label: 'name',
value: 'id'
}"
allowClear
@change="onChangeUnit"
/>
</template>
<template v-if="column.dataIndex === 'productQty'">
@ -172,6 +174,7 @@
unitOptions = unitList
dataSource.value = packageData
console.log(dataSource.value, 'dataSource.value')
}
})
@ -668,6 +671,15 @@
}
]
const onChangeUnit = (value) => {
const unitIdList = new Set(dataSource.value.map((item) => item.unitId))
// unitOptions disabled
unitOptions.forEach((item) => {
item.disabled = unitIdList.has(item.id)
})
}
const { formData, formRefs, inform, extendFormData, onSubmit, handleBack, fetchData, getExtendField } =
useFormHandler([...materialFormItems, ...baseFormItems, ...unitFormItems], {
submitForm: materialApi.materialSubmitForm,

View File

@ -93,7 +93,7 @@
{
id: 0,
parentId: '0',
name: '所有',
name: '顶级',
children: res ? res : []
}
]

View File

@ -58,7 +58,6 @@
:row-selection="options.rowSelection"
:scroll="{
x: 100,
y: 'calc(100vh - 300px)'
}"
>
<template #operator class="table-operator">

View File

@ -36,7 +36,7 @@
:row-selection="options.rowSelection"
:scroll="{
x: 100,
y: 'calc(100vh - 300px)'
}"
>
<template #operator>

View File

@ -34,7 +34,7 @@
<a-col :span="6">
<dynamic-tree
ref="dynamicTreeRef"
treeTitle="生产组织"
treeTitle="仓库"
:tableRef="tableRef"
:apiModel="{
getTree: sysStoreApi.sysStoreTree,
@ -61,8 +61,7 @@
:tool-config="options.toolConfig"
:row-selection="options.rowSelection"
:scroll="{
x: 100,
y: 'calc(100vh - 300px)'
x: 100
}"
>
<template #operator>

View File

@ -25,11 +25,12 @@
v-model:value="formData.type"
placeholder="请选择组织类型"
:options="typeOptions"
@change="typeChange"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="工厂名称:" name="name">
<a-form-item :label="`${factoryName}名称:`" name="name">
<a-input
:disabled="pageType === 'SEARCH'"
v-model:value="formData.name"
@ -127,6 +128,8 @@
const enabledStateOptions = ref([])
let pageType = ref('ADD')
let factoryName = ref('工厂')
//
const onOpen = (record) => {
visible.value = true
@ -147,14 +150,21 @@
treeData.value = res || []
})
productionOrganizationApi.productionOrganizationTree().then((res) => {
parentTreeData.value = res
})
productionOrganizationApi
.productionOrganizationTree({
type: 'FACTORY,WORKSHOP',
extId: record && record.id
})
.then((res) => {
parentTreeData.value = res
})
}
//
const onClose = () => {
formRef.value.resetFields()
visible.value = false
factoryName.value = '工厂'
}
// refresh
const formRules = {
@ -179,6 +189,16 @@
})
}
const typeChange = () => {
if (formData.value.type === 'FACTORY') {
factoryName.value = '工厂'
} else if (formData.value.type === 'WORKSHOP') {
factoryName.value = '车间'
} else {
factoryName.value = '产线'
}
}
let treeData = ref([])
let parentTreeData = ref([])
//

View File

@ -77,7 +77,7 @@
:row-selection="options.rowSelection"
:scroll="{
x: 100,
y: 'calc(100vh - 300px)'
}"
>
<template #operator>
@ -120,7 +120,7 @@
</a-tooltip>
<a-divider type="vertical" v-if="hasPerm(['customerEdit', 'customerDelete'], 'and')" />
<a-popconfirm title="确定要删除吗?" @confirm="deleteRecord(record)">
<a-popconfirm title="确定要删除吗?" @confirm="handleConfirmDeleteRecord(record)">
<a-button type="link" danger size="small" v-if="hasPerm('customerDelete')">
<DeleteOutlined />
</a-button>
@ -198,7 +198,7 @@
deleteBatchRecords,
options,
searchFormRef,
navigateTo,
deleteRecord,
toggleAdvanced,
advanced
} = useTableManagement(
@ -212,8 +212,10 @@
const TissueFormRef = ref(null)
const dynamicTreeRef = ref(null)
let treeValue = ref({})
const onSelectTree = (value) => {
treeValue.value = value
searchFormState.value.parentId = value.id
tableRef.value.refresh()
}
@ -223,6 +225,16 @@
tableRef.value.refresh()
}
const handleConfirmDeleteRecord = (record) => {
deleteRecord(record).then((res) => {
console.log(res, '删除成功')
dynamicTreeRef.value.loadTreeData({
type: 'FACTORY,WORKSHOP'
})
})
}
const treeRefresh = () => {
searchFormState.value.parentId = null
tableRef.value.refresh()
@ -232,10 +244,14 @@
searchFormState.value.parentId = null
tableRef.value.refresh()
dynamicTreeRef.value.loadTreeData()
dynamicTreeRef.value.loadTreeData({
type: 'FACTORY,WORKSHOP'
})
}
onMounted(() => {
dynamicTreeRef.value.loadTreeData()
dynamicTreeRef.value.loadTreeData({
type: 'FACTORY,WORKSHOP'
})
})
</script>

View File

@ -50,16 +50,13 @@
:columns="unitGroupColumns"
:data="loadGroupsData"
bordered
tableLayout="fixed"
:row-key="(record) => record.id"
:tool-config="unitGroupToolConfig"
@plusRowData="handlePlusRowData"
@editRowData="handleEditRowData"
@deleteRowData="handleDeleteRowData"
:rowSelection="unitGroupRowSelection"
:scroll="{
x: 100,
y: 'calc(100vh - 300px)'
}"
>
<template #operator class="table-operator">
<span>单位组</span>
@ -90,8 +87,7 @@
:tool-config="options.toolConfig"
:row-selection="options.rowSelection"
:scroll="{
x: 1500,
y: 'calc(100vh - 300px)'
x: 100
}"
>
<template #operator>