基础资料优化处理

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

View File

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

View File

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

View File

@ -6,6 +6,23 @@
<fullscreen-outlined /> <fullscreen-outlined />
</div> </div>
<!-- <dev-user-message />--> <!-- <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"> <a-dropdown class="user panel-item">
<div class="user-avatar"> <div class="user-avatar">
<a-avatar :src="userInfo ? userInfo.avatar : undefined" /> <a-avatar :src="userInfo ? userInfo.avatar : undefined" />
@ -29,22 +46,6 @@
</a-menu> </a-menu>
</template> </template>
</a-dropdown> </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> </div>
<!-- 整体风格设置抽屉 --> <!-- 整体风格设置抽屉 -->

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -59,6 +59,8 @@
label: 'name', label: 'name',
value: 'id' value: 'id'
}" }"
allowClear
@change="onChangeUnit"
/> />
</template> </template>
<template v-if="column.dataIndex === 'productQty'"> <template v-if="column.dataIndex === 'productQty'">
@ -172,6 +174,7 @@
unitOptions = unitList unitOptions = unitList
dataSource.value = packageData 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 } = const { formData, formRefs, inform, extendFormData, onSubmit, handleBack, fetchData, getExtendField } =
useFormHandler([...materialFormItems, ...baseFormItems, ...unitFormItems], { useFormHandler([...materialFormItems, ...baseFormItems, ...unitFormItems], {
submitForm: materialApi.materialSubmitForm, submitForm: materialApi.materialSubmitForm,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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