基础资料模块
							parent
							
								
									3d5aed578c
								
							
						
					
					
						commit
						c51d3a5ca3
					
				| 
						 | 
					@ -0,0 +1,32 @@
 | 
				
			||||||
 | 
					import { baseRequest } from '@/utils/request'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const request = (url, ...arg) => baseRequest(`/base/material/` + url, ...arg)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 物料Api接口管理器
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @author Luck
 | 
				
			||||||
 | 
					 * @date  2024/07/24 19:54
 | 
				
			||||||
 | 
					 **/
 | 
				
			||||||
 | 
					export default {
 | 
				
			||||||
 | 
						// 获取物料分页
 | 
				
			||||||
 | 
						materialPage(data) {
 | 
				
			||||||
 | 
							return request('page', data, 'get')
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						// 获取物料 -- 物料包装数据
 | 
				
			||||||
 | 
						materialPackageData(data) {
 | 
				
			||||||
 | 
							return request('package/data', data, 'get')
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						// 提交物料表单 edit为true时为编辑,默认为新增
 | 
				
			||||||
 | 
						materialSubmitForm(data, edit = false) {
 | 
				
			||||||
 | 
							return request(edit ? 'edit' : 'add', data)
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						// 删除物料
 | 
				
			||||||
 | 
						materialDelete(data) {
 | 
				
			||||||
 | 
							return request('delete', data)
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						// 获取物料详情
 | 
				
			||||||
 | 
						materialDetail(data) {
 | 
				
			||||||
 | 
							return request('detail', data, 'get')
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,32 @@
 | 
				
			||||||
 | 
					import { baseRequest } from '@/utils/request'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const request = (url, ...arg) => baseRequest(`/base/materialCategory/` + url, ...arg)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 物料分类Api接口管理器
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @author Luck
 | 
				
			||||||
 | 
					 * @date  2024/07/24 19:35
 | 
				
			||||||
 | 
					 **/
 | 
				
			||||||
 | 
					export default {
 | 
				
			||||||
 | 
						// 获取物料分类分页
 | 
				
			||||||
 | 
						materialCategoryPage(data) {
 | 
				
			||||||
 | 
							return request('page', data, 'get')
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						// 获取物料分类 树结构
 | 
				
			||||||
 | 
						materialCategoryTree(data) {
 | 
				
			||||||
 | 
							return request('tree', data, 'get')
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						// 提交物料分类表单 edit为true时为编辑,默认为新增
 | 
				
			||||||
 | 
						materialCategorySubmitForm(data, edit = false) {
 | 
				
			||||||
 | 
							return request(edit ? 'edit' : 'add', data)
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						// 删除物料分类
 | 
				
			||||||
 | 
						materialCategoryDelete(data) {
 | 
				
			||||||
 | 
							return request('delete', data)
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						// 获取物料分类详情
 | 
				
			||||||
 | 
						materialCategoryDetail(data) {
 | 
				
			||||||
 | 
							return request('detail', data, 'get')
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -24,5 +24,9 @@ export default {
 | 
				
			||||||
	// 获取单位详情
 | 
						// 获取单位详情
 | 
				
			||||||
	sysUnitDetail(data) {
 | 
						sysUnitDetail(data) {
 | 
				
			||||||
		return request('detail', data, 'get')
 | 
							return request('detail', data, 'get')
 | 
				
			||||||
	}
 | 
						},
 | 
				
			||||||
 | 
						// 获取单位列表
 | 
				
			||||||
 | 
						sysUnitList(data) {
 | 
				
			||||||
 | 
							return request(`groupList`, data, 'get')
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,7 +3,7 @@
 | 
				
			||||||
		<a-row :gutter="16">
 | 
							<a-row :gutter="16">
 | 
				
			||||||
			<a-col :span="item.span || 6" v-for="(item, index) in formItems" :key="index">
 | 
								<a-col :span="item.span || 6" v-for="(item, index) in formItems" :key="index">
 | 
				
			||||||
				<a-form-item :label="item.label" :name="item.name" :rules="item.rules">
 | 
									<a-form-item :label="item.label" :name="item.name" :rules="item.rules">
 | 
				
			||||||
					<component :is="item.type" v-model:value="model[item.name]" v-bind="item.attrs" :disabled="allDisabled" />
 | 
										<component style="width: 100%" :is="item.type" v-model:value="model[item.name]" :disabled="allDisabled" v-bind="item.attrs"  />
 | 
				
			||||||
				</a-form-item>
 | 
									</a-form-item>
 | 
				
			||||||
			</a-col>
 | 
								</a-col>
 | 
				
			||||||
		</a-row>
 | 
							</a-row>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -186,6 +186,7 @@
 | 
				
			||||||
		if (dataIsConverterFlw) {
 | 
							if (dataIsConverterFlw) {
 | 
				
			||||||
			ids = goDataConverter(ids)
 | 
								ids = goDataConverter(ids)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							console.log(ids, 'ids')
 | 
				
			||||||
		recordIds.value = ids
 | 
							recordIds.value = ids
 | 
				
			||||||
		// 加载机构树
 | 
							// 加载机构树
 | 
				
			||||||
		if (props.orgTreeApi) {
 | 
							if (props.orgTreeApi) {
 | 
				
			||||||
| 
						 | 
					@ -213,12 +214,14 @@
 | 
				
			||||||
		searchFormState.value.size = pageSize.value
 | 
							searchFormState.value.size = pageSize.value
 | 
				
			||||||
		loadData()
 | 
							loadData()
 | 
				
			||||||
		if (props.checkedUserListApi) {
 | 
							if (props.checkedUserListApi) {
 | 
				
			||||||
 | 
								console.log(recordIds.value)
 | 
				
			||||||
			if (isEmpty(recordIds.value)) {
 | 
								if (isEmpty(recordIds.value)) {
 | 
				
			||||||
				return
 | 
									return
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			const param = {
 | 
								const param = {
 | 
				
			||||||
				idList: recordIds.value
 | 
									idList: recordIds.value
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			selectedTableListLoading.value = true
 | 
								selectedTableListLoading.value = true
 | 
				
			||||||
			props
 | 
								props
 | 
				
			||||||
				.checkedUserListApi(param)
 | 
									.checkedUserListApi(param)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,9 +41,9 @@
 | 
				
			||||||
					<a-tooltip v-if="item.name === 'delete' && props.toolConfig.delete" :title="item.title" class="s-tool-item">
 | 
										<a-tooltip v-if="item.name === 'delete' && props.toolConfig.delete" :title="item.title" class="s-tool-item">
 | 
				
			||||||
						<a-popconfirm
 | 
											<a-popconfirm
 | 
				
			||||||
							v-if="item.name === 'delete' && props.toolConfig.delete"
 | 
												v-if="item.name === 'delete' && props.toolConfig.delete"
 | 
				
			||||||
							title="确认删除?"
 | 
												title="确定要删除吗?"
 | 
				
			||||||
							ok-text="Yes"
 | 
												ok-text="确认"
 | 
				
			||||||
							cancel-text="No"
 | 
												cancel-text="取消"
 | 
				
			||||||
							@confirm="
 | 
												@confirm="
 | 
				
			||||||
								() => {
 | 
													() => {
 | 
				
			||||||
									emit('deleteRowData')
 | 
														emit('deleteRowData')
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,7 +15,7 @@ export default function useFormHandler(formItems, api) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const initializeFormData = (formItems, formData) => {
 | 
						const initializeFormData = (formItems, formData) => {
 | 
				
			||||||
		formItems.forEach((item) => {
 | 
							formItems.forEach((item) => {
 | 
				
			||||||
			formData[item.name] = item.defaultValue || ''
 | 
								formData[item.name] = item.defaultValue || null
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,10 +11,11 @@ import useTabs from '@/utils/useTabs'
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export function useTableManagement(apiModule = {}, tableColumns, hasPermData) {
 | 
					export function useTableManagement(apiModule = {}, tableColumns, hasPermData) {
 | 
				
			||||||
	const searchFormState = ref({})
 | 
						const searchFormState = ref({})
 | 
				
			||||||
	const searchFormRef = ref({})
 | 
						const searchFormRef = ref(null)
 | 
				
			||||||
	const tableRef = ref(null)
 | 
						const tableRef = ref(null)
 | 
				
			||||||
	const selectedRowKeys = ref([])
 | 
						const selectedRowKeys = ref([])
 | 
				
			||||||
	const router = useRouter()
 | 
						const router = useRouter()
 | 
				
			||||||
 | 
						let advanced = ref(false)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 动态列配置
 | 
						// 动态列配置
 | 
				
			||||||
	const columns = ref(tableColumns)
 | 
						const columns = ref(tableColumns)
 | 
				
			||||||
| 
						 | 
					@ -47,7 +48,7 @@ export function useTableManagement(apiModule = {}, tableColumns, hasPermData) {
 | 
				
			||||||
	// 重置
 | 
						// 重置
 | 
				
			||||||
	const reset = () => {
 | 
						const reset = () => {
 | 
				
			||||||
		if (tableRef.value) {
 | 
							if (tableRef.value) {
 | 
				
			||||||
			tableRef.value.resetFields()
 | 
								searchFormRef.value.resetFields()
 | 
				
			||||||
			tableRef.value.refresh(true)
 | 
								tableRef.value.refresh(true)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -55,7 +56,7 @@ export function useTableManagement(apiModule = {}, tableColumns, hasPermData) {
 | 
				
			||||||
	// 删除
 | 
						// 删除
 | 
				
			||||||
	const deleteRecord = (record) => {
 | 
						const deleteRecord = (record) => {
 | 
				
			||||||
		let params = [{ id: record.id }]
 | 
							let params = [{ id: record.id }]
 | 
				
			||||||
		apiModule.delete(params).then(() => {
 | 
							return apiModule.delete(params).then(() => {
 | 
				
			||||||
			if (tableRef.value) {
 | 
								if (tableRef.value) {
 | 
				
			||||||
				tableRef.value.refresh(true)
 | 
									tableRef.value.refresh(true)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					@ -94,6 +95,10 @@ export function useTableManagement(apiModule = {}, tableColumns, hasPermData) {
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const toggleAdvanced = () => {
 | 
				
			||||||
 | 
							advanced.value = !advanced.value
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 返回Hook的值
 | 
						// 返回Hook的值
 | 
				
			||||||
	return {
 | 
						return {
 | 
				
			||||||
		searchFormState,
 | 
							searchFormState,
 | 
				
			||||||
| 
						 | 
					@ -107,6 +112,8 @@ export function useTableManagement(apiModule = {}, tableColumns, hasPermData) {
 | 
				
			||||||
		deleteBatchRecords,
 | 
							deleteBatchRecords,
 | 
				
			||||||
		options,
 | 
							options,
 | 
				
			||||||
		toolConfig,
 | 
							toolConfig,
 | 
				
			||||||
		navigateTo
 | 
							navigateTo,
 | 
				
			||||||
 | 
							toggleAdvanced,
 | 
				
			||||||
 | 
							advanced
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,14 +2,23 @@
 | 
				
			||||||
	<a-card :bordered="false">
 | 
						<a-card :bordered="false">
 | 
				
			||||||
		<a-form ref="searchFormRef" name="advanced_search" :model="searchFormState" class="ant-advanced-search-form">
 | 
							<a-form ref="searchFormRef" name="advanced_search" :model="searchFormState" class="ant-advanced-search-form">
 | 
				
			||||||
			<a-row :gutter="24">
 | 
								<a-row :gutter="24">
 | 
				
			||||||
 | 
									<a-col :span="6">
 | 
				
			||||||
 | 
										<a-form-item label="编码" name="number">
 | 
				
			||||||
 | 
											<a-input v-model:value="searchFormState.number" placeholder="请输入编码" />
 | 
				
			||||||
 | 
										</a-form-item>
 | 
				
			||||||
 | 
									</a-col>
 | 
				
			||||||
				<a-col :span="6">
 | 
									<a-col :span="6">
 | 
				
			||||||
					<a-form-item label="名称" name="name">
 | 
										<a-form-item label="名称" name="name">
 | 
				
			||||||
						<a-input v-model:value="searchFormState.name" placeholder="请输入名称" />
 | 
											<a-input v-model:value="searchFormState.name" placeholder="请输入名称" />
 | 
				
			||||||
					</a-form-item>
 | 
										</a-form-item>
 | 
				
			||||||
				</a-col>
 | 
									</a-col>
 | 
				
			||||||
				<a-col :span="6">
 | 
									<a-col :span="6">
 | 
				
			||||||
					<a-form-item label="类型" name="type">
 | 
										<a-form-item label="可用状态" name="enabledState">
 | 
				
			||||||
						<a-input v-model:value="searchFormState.type" placeholder="请输入类型" />
 | 
											<a-select
 | 
				
			||||||
 | 
												v-model:value="searchFormState.enabledState"
 | 
				
			||||||
 | 
												placeholder="请选择可用状态"
 | 
				
			||||||
 | 
												:options="$TOOL.dictList('COMMON_STATUS')"
 | 
				
			||||||
 | 
											/>
 | 
				
			||||||
					</a-form-item>
 | 
										</a-form-item>
 | 
				
			||||||
				</a-col>
 | 
									</a-col>
 | 
				
			||||||
				<a-col :span="6">
 | 
									<a-col :span="6">
 | 
				
			||||||
| 
						 | 
					@ -54,13 +63,14 @@
 | 
				
			||||||
			</template>
 | 
								</template>
 | 
				
			||||||
			<template #bodyCell="{ column, record }">
 | 
								<template #bodyCell="{ column, record }">
 | 
				
			||||||
				<template v-if="column.dataIndex === 'enabledState'">
 | 
									<template v-if="column.dataIndex === 'enabledState'">
 | 
				
			||||||
					<a-switch
 | 
					<!--					<a-switch
 | 
				
			||||||
						checkedValue="ENABLE"
 | 
											checkedValue="ENABLE"
 | 
				
			||||||
						unCheckedValue="DISABLED"
 | 
											unCheckedValue="DISABLED"
 | 
				
			||||||
						checked-children="启用"
 | 
											checked-children="启用"
 | 
				
			||||||
						un-checked-children="停用"
 | 
											un-checked-children="停用"
 | 
				
			||||||
						v-model:checked="record.enabledState"
 | 
											v-model:checked="record.enabledState"
 | 
				
			||||||
					/>
 | 
										/>-->
 | 
				
			||||||
 | 
										{{ $TOOL.dictTypeData('COMMON_STATUS', record.enabledState) }}
 | 
				
			||||||
				</template>
 | 
									</template>
 | 
				
			||||||
				<template v-if="column.dataIndex === 'action'">
 | 
									<template v-if="column.dataIndex === 'action'">
 | 
				
			||||||
					<a-space>
 | 
										<a-space>
 | 
				
			||||||
| 
						 | 
					@ -96,7 +106,7 @@
 | 
				
			||||||
	</a-card>
 | 
						</a-card>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script setup>
 | 
					<script setup name="brand">
 | 
				
			||||||
	import sysBrandApi from '@/api/base/brand/sysBrandApi'
 | 
						import sysBrandApi from '@/api/base/brand/sysBrandApi'
 | 
				
			||||||
	import { useTableManagement } from '@/hook/useTableManagement'
 | 
						import { useTableManagement } from '@/hook/useTableManagement'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -265,7 +265,9 @@
 | 
				
			||||||
	onMounted(async () => {
 | 
						onMounted(async () => {
 | 
				
			||||||
		formRefs.value = [formRef1.value, formRef2.value]
 | 
							formRefs.value = [formRef1.value, formRef2.value]
 | 
				
			||||||
		fetchData(route.query.type).then((res) => {
 | 
							fetchData(route.query.type).then((res) => {
 | 
				
			||||||
			formData.provinceName = [res.province, res.city, res.county]
 | 
								if (res) {
 | 
				
			||||||
 | 
									formData.provinceName = [res.province, res.city, res.county]
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// 选择品牌
 | 
							// 选择品牌
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,8 +8,17 @@
 | 
				
			||||||
					</a-form-item>
 | 
										</a-form-item>
 | 
				
			||||||
				</a-col>
 | 
									</a-col>
 | 
				
			||||||
				<a-col :span="6">
 | 
									<a-col :span="6">
 | 
				
			||||||
					<a-form-item label="类型" name="type">
 | 
										<a-form-item label="编码" name="number">
 | 
				
			||||||
						<a-input v-model:value="searchFormState.type" placeholder="请输入类型" />
 | 
											<a-input v-model:value="searchFormState.number" placeholder="请输入编码" />
 | 
				
			||||||
 | 
										</a-form-item>
 | 
				
			||||||
 | 
									</a-col>
 | 
				
			||||||
 | 
									<a-col :span="6">
 | 
				
			||||||
 | 
										<a-form-item label="可用状态" name="enabledState">
 | 
				
			||||||
 | 
											<a-select
 | 
				
			||||||
 | 
												v-model:value="searchFormState.enabledState"
 | 
				
			||||||
 | 
												placeholder="请选择可用状态"
 | 
				
			||||||
 | 
												:options="$TOOL.dictList('COMMON_STATUS')"
 | 
				
			||||||
 | 
											/>
 | 
				
			||||||
					</a-form-item>
 | 
										</a-form-item>
 | 
				
			||||||
				</a-col>
 | 
									</a-col>
 | 
				
			||||||
				<a-col :span="6">
 | 
									<a-col :span="6">
 | 
				
			||||||
| 
						 | 
					@ -37,13 +46,13 @@
 | 
				
			||||||
								<component class="icons" :is="item.icon"></component>
 | 
													<component class="icons" :is="item.icon"></component>
 | 
				
			||||||
							</a-tooltip>
 | 
												</a-tooltip>
 | 
				
			||||||
							<!-- 删除 -->
 | 
												<!-- 删除 -->
 | 
				
			||||||
							<a-tooltip :title="item.title" class="s-tool-item" v-if="item.name === 'delete'" @click="handleDelTree">
 | 
												<a-tooltip :title="item.title" class="s-tool-item" v-if="item.name === 'delete'">
 | 
				
			||||||
								<a-popconfirm title="确认删除?" ok-text="Yes" cancel-text="No">
 | 
													<a-popconfirm title="确定要删除吗?" ok-text="确认" cancel-text="取消" @confirm="handleDelTree">
 | 
				
			||||||
									<component class="icons" :is="item.icon"></component>
 | 
														<component class="icons" :is="item.icon"></component>
 | 
				
			||||||
								</a-popconfirm>
 | 
													</a-popconfirm>
 | 
				
			||||||
							</a-tooltip>
 | 
												</a-tooltip>
 | 
				
			||||||
							<!-- 刷新 -->
 | 
												<!-- 刷新 -->
 | 
				
			||||||
<!--							<a-tooltip :title="item.title" class="s-tool-item" v-if="item.name === 'refresh'">
 | 
												<!--							<a-tooltip :title="item.title" class="s-tool-item" v-if="item.name === 'refresh'">
 | 
				
			||||||
								<component class="icons" :is="item.icon"></component>
 | 
													<component class="icons" :is="item.icon"></component>
 | 
				
			||||||
							</a-tooltip>-->
 | 
												</a-tooltip>-->
 | 
				
			||||||
						</span>
 | 
											</span>
 | 
				
			||||||
| 
						 | 
					@ -55,7 +64,6 @@
 | 
				
			||||||
					v-model:selectedKeys="selectedKeys"
 | 
										v-model:selectedKeys="selectedKeys"
 | 
				
			||||||
					multiple
 | 
										multiple
 | 
				
			||||||
					:tree-data="treeData"
 | 
										:tree-data="treeData"
 | 
				
			||||||
					:selectedKeys="treeSelectedKeys"
 | 
					 | 
				
			||||||
					:fieldNames="{
 | 
										:fieldNames="{
 | 
				
			||||||
						children: 'children',
 | 
											children: 'children',
 | 
				
			||||||
						title: 'name',
 | 
											title: 'name',
 | 
				
			||||||
| 
						 | 
					@ -98,16 +106,14 @@
 | 
				
			||||||
					</template>
 | 
										</template>
 | 
				
			||||||
					<template #bodyCell="{ column, record }">
 | 
										<template #bodyCell="{ column, record }">
 | 
				
			||||||
						<template v-if="column.dataIndex === 'enabledState'">
 | 
											<template v-if="column.dataIndex === 'enabledState'">
 | 
				
			||||||
							<a-switch
 | 
												<!--							<a-switch
 | 
				
			||||||
								checkedValue="ENABLE"
 | 
													checkedValue="ENABLE"
 | 
				
			||||||
								unCheckedValue="DISABLED"
 | 
													unCheckedValue="DISABLED"
 | 
				
			||||||
								checked-children="启用"
 | 
													checked-children="启用"
 | 
				
			||||||
								un-checked-children="停用"
 | 
													un-checked-children="停用"
 | 
				
			||||||
								v-model:checked="record.enabledState"
 | 
													v-model:checked="record.enabledState"
 | 
				
			||||||
							/>
 | 
												/>-->
 | 
				
			||||||
						</template>
 | 
												{{ $TOOL.dictTypeData('COMMON_STATUS', record.enabledState) }}
 | 
				
			||||||
						<template v-if="column.dataIndex === 'type'">
 | 
					 | 
				
			||||||
							{{ $TOOL.dictTypeData('OFFICIAL_ACCOUNT_TYPE', record.type) }}
 | 
					 | 
				
			||||||
						</template>
 | 
											</template>
 | 
				
			||||||
						<template v-if="column.dataIndex === 'action'">
 | 
											<template v-if="column.dataIndex === 'action'">
 | 
				
			||||||
							<a-space>
 | 
												<a-space>
 | 
				
			||||||
| 
						 | 
					@ -146,7 +152,7 @@
 | 
				
			||||||
	</a-card>
 | 
						</a-card>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script setup>
 | 
					<script setup name="client">
 | 
				
			||||||
	import customerApi from '@/api/base/customer/customerApi'
 | 
						import customerApi from '@/api/base/customer/customerApi'
 | 
				
			||||||
	import customerCategoryApi from '@/api/base/customer/customerCategoryApi'
 | 
						import customerCategoryApi from '@/api/base/customer/customerCategoryApi'
 | 
				
			||||||
	import { useTableManagement } from '@/hook/useTableManagement'
 | 
						import { useTableManagement } from '@/hook/useTableManagement'
 | 
				
			||||||
| 
						 | 
					@ -172,7 +178,7 @@
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			title: '分类',
 | 
								title: '分类',
 | 
				
			||||||
			dataIndex: 'type',
 | 
								dataIndex: 'categoryName',
 | 
				
			||||||
			sorter: (a, b) => a.address.length - b.address.length,
 | 
								sorter: (a, b) => a.address.length - b.address.length,
 | 
				
			||||||
			sortDirections: ['descend', 'ascend'],
 | 
								sortDirections: ['descend', 'ascend'],
 | 
				
			||||||
			align: 'center',
 | 
								align: 'center',
 | 
				
			||||||
| 
						 | 
					@ -248,13 +254,11 @@
 | 
				
			||||||
	const treeData = ref([])
 | 
						const treeData = ref([])
 | 
				
			||||||
	const CustomerCategoryFormRef = ref(null)
 | 
						const CustomerCategoryFormRef = ref(null)
 | 
				
			||||||
	let treeRow = {}
 | 
						let treeRow = {}
 | 
				
			||||||
	let treeSelectedKeys = ref([])
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const handleTreeClick = (selectedKeys, event) => {
 | 
						const handleTreeClick = (selectedKeys, event) => {
 | 
				
			||||||
		treeRow = event.node
 | 
							treeRow = event.node
 | 
				
			||||||
		tableRef.value.refresh()
 | 
					 | 
				
			||||||
		searchFormState.value.categoryId = selectedKeys[0]
 | 
							searchFormState.value.categoryId = selectedKeys[0]
 | 
				
			||||||
		treeSelectedKeys.value = selectedKeys
 | 
							tableRef.value.refresh()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const handleAddTree = () => {
 | 
						const handleAddTree = () => {
 | 
				
			||||||
| 
						 | 
					@ -267,9 +271,9 @@
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const handleDelTree = () => {
 | 
						const handleDelTree = () => {
 | 
				
			||||||
		if (!treeRow.id) return message.error('!请选择要编辑的数据')
 | 
							if (!treeRow.id) return message.error('!请选择要删除的数据')
 | 
				
			||||||
		customerCategoryApi.customerCategoryDelete([{ id: treeRow.id }]).then((res) => {
 | 
							customerCategoryApi.customerCategoryDelete([{ id: treeRow.id }]).then((res) => {
 | 
				
			||||||
			treeSelectedKeys.value = []
 | 
								selectedKeys.value = []
 | 
				
			||||||
			searchFormState.value.categoryId = null
 | 
								searchFormState.value.categoryId = null
 | 
				
			||||||
			treeRow = {}
 | 
								treeRow = {}
 | 
				
			||||||
			tableRef.value.refresh()
 | 
								tableRef.value.refresh()
 | 
				
			||||||
| 
						 | 
					@ -281,7 +285,7 @@
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const successful = () => {
 | 
						const successful = () => {
 | 
				
			||||||
		treeSelectedKeys.value = []
 | 
							selectedKeys.value = []
 | 
				
			||||||
		searchFormState.value.categoryId = null
 | 
							searchFormState.value.categoryId = null
 | 
				
			||||||
		treeRow = {}
 | 
							treeRow = {}
 | 
				
			||||||
		tableRef.value.refresh()
 | 
							tableRef.value.refresh()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,14 +1,14 @@
 | 
				
			||||||
<template>
 | 
					<template>
 | 
				
			||||||
	<a-page-header style="padding: 10px; font-size: 20px" @back="handleBack">
 | 
						<a-page-header style="padding: 10px; font-size: 20px" @back="handleBack">
 | 
				
			||||||
		<template #extra>
 | 
							<template #extra>
 | 
				
			||||||
			<a-button v-if="route.query.type !== 'SEARCH'" key="1" type="primary" @click="onSubmit">保存</a-button>
 | 
								<a-button v-if="route.query.type !== 'SEARCH'" key="1" type="primary" @click="onSubmitForm">保存</a-button>
 | 
				
			||||||
		</template>
 | 
							</template>
 | 
				
			||||||
	</a-page-header>
 | 
						</a-page-header>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	<a-card :bordered="false" title="仓库">
 | 
						<a-card :bordered="false" title="物料">
 | 
				
			||||||
		<DynamicForm
 | 
							<DynamicForm
 | 
				
			||||||
			:allDisabled="route.query.type === 'SEARCH'"
 | 
								:allDisabled="route.query.type === 'SEARCH'"
 | 
				
			||||||
			:formItems="officialAccountFormItems"
 | 
								:formItems="materialFormItems"
 | 
				
			||||||
			:model="formData"
 | 
								:model="formData"
 | 
				
			||||||
			:rules="formRules"
 | 
								:rules="formRules"
 | 
				
			||||||
			ref="formRef1"
 | 
								ref="formRef1"
 | 
				
			||||||
| 
						 | 
					@ -23,7 +23,7 @@
 | 
				
			||||||
					:formItems="baseFormItems"
 | 
										:formItems="baseFormItems"
 | 
				
			||||||
					:model="formData"
 | 
										:model="formData"
 | 
				
			||||||
					:rules="formRules"
 | 
										:rules="formRules"
 | 
				
			||||||
					ref="formRef1"
 | 
										ref="formRef2"
 | 
				
			||||||
				/>
 | 
									/>
 | 
				
			||||||
			</a-tab-pane>
 | 
								</a-tab-pane>
 | 
				
			||||||
			<a-tab-pane key="2" tab="单位信息" force-render>
 | 
								<a-tab-pane key="2" tab="单位信息" force-render>
 | 
				
			||||||
| 
						 | 
					@ -32,26 +32,260 @@
 | 
				
			||||||
					:formItems="unitFormItems"
 | 
										:formItems="unitFormItems"
 | 
				
			||||||
					:model="formData"
 | 
										:model="formData"
 | 
				
			||||||
					:rules="formRules"
 | 
										:rules="formRules"
 | 
				
			||||||
					ref="formRef1"
 | 
										ref="formRef3"
 | 
				
			||||||
				/>
 | 
									/>
 | 
				
			||||||
			</a-tab-pane>
 | 
								</a-tab-pane>
 | 
				
			||||||
			<a-tab-pane key="3" tab="包装关系" force-render>
 | 
								<a-tab-pane key="3" tab="包装关系" force-render>
 | 
				
			||||||
				<DynamicTable :initialData="data" :columns="columns" rowKey="id"></DynamicTable>
 | 
									<a-table :dataSource="dataSource" :columns="columns">
 | 
				
			||||||
 | 
										<template #bodyCell="{ column, record }">
 | 
				
			||||||
 | 
											<template v-if="column.dataIndex === 'enabledState'">
 | 
				
			||||||
 | 
												<a-switch
 | 
				
			||||||
 | 
													:disabled="route.query.type === 'SEARCH'"
 | 
				
			||||||
 | 
													checkedValue="ENABLE"
 | 
				
			||||||
 | 
													unCheckedValue="DISABLED"
 | 
				
			||||||
 | 
													checked-children="启用"
 | 
				
			||||||
 | 
													un-checked-children="停用"
 | 
				
			||||||
 | 
													v-model:checked="record.enabledState"
 | 
				
			||||||
 | 
												/>
 | 
				
			||||||
 | 
											</template>
 | 
				
			||||||
 | 
											<template v-if="column.dataIndex === 'unitId'">
 | 
				
			||||||
 | 
												<a-select
 | 
				
			||||||
 | 
													:disabled="route.query.type === 'SEARCH'"
 | 
				
			||||||
 | 
													style="width: 100%"
 | 
				
			||||||
 | 
													placeholder="请选择单位"
 | 
				
			||||||
 | 
													v-model:value="record.unitId"
 | 
				
			||||||
 | 
													:options="unitOptions"
 | 
				
			||||||
 | 
													:field-names="{
 | 
				
			||||||
 | 
														label: 'name',
 | 
				
			||||||
 | 
														value: 'id'
 | 
				
			||||||
 | 
													}"
 | 
				
			||||||
 | 
												/>
 | 
				
			||||||
 | 
											</template>
 | 
				
			||||||
 | 
											<template v-if="column.dataIndex === 'productQty'">
 | 
				
			||||||
 | 
												<a-input-number
 | 
				
			||||||
 | 
													:disabled="route.query.type === 'SEARCH'"
 | 
				
			||||||
 | 
													style="width: 100%"
 | 
				
			||||||
 | 
													v-model:value="record.productQty"
 | 
				
			||||||
 | 
												/>
 | 
				
			||||||
 | 
											</template>
 | 
				
			||||||
 | 
											<template v-if="column.dataIndex === 'name'">
 | 
				
			||||||
 | 
												<a-input :disabled="route.query.type === 'SEARCH'" v-model:value="record.name" />
 | 
				
			||||||
 | 
											</template>
 | 
				
			||||||
 | 
										</template>
 | 
				
			||||||
 | 
									</a-table>
 | 
				
			||||||
			</a-tab-pane>
 | 
								</a-tab-pane>
 | 
				
			||||||
			<a-tab-pane key="4" tab="商品推广" force-render>
 | 
								<a-tab-pane key="4" tab="商品推广" force-render>
 | 
				
			||||||
 | 
									<a-form :model="productFormData" class="w-1/3" layout="vertical">
 | 
				
			||||||
 | 
										<a-form-item label="是否启用" name="promoteEnabledState">
 | 
				
			||||||
 | 
											<a-select
 | 
				
			||||||
 | 
												v-model:value="productFormData.promoteEnabledState"
 | 
				
			||||||
 | 
												:options="tool.dictList('COMMON_STATUS') || []"
 | 
				
			||||||
 | 
											/>
 | 
				
			||||||
 | 
										</a-form-item>
 | 
				
			||||||
 | 
										<a-form-item label="商品推广 (支持上传:.png .jpg且大小为200k的图片,最多可上传5张)">
 | 
				
			||||||
 | 
											<a-upload
 | 
				
			||||||
 | 
												v-model:file-list="fileList"
 | 
				
			||||||
 | 
												name="avatar"
 | 
				
			||||||
 | 
												list-type="picture-card"
 | 
				
			||||||
 | 
												class="avatar-uploader"
 | 
				
			||||||
 | 
												:show-upload-list="false"
 | 
				
			||||||
 | 
												action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
 | 
				
			||||||
 | 
												:before-upload="beforeUpload"
 | 
				
			||||||
 | 
												@change="handleChange"
 | 
				
			||||||
 | 
											>
 | 
				
			||||||
 | 
												<img v-if="imageUrl" :src="imageUrl" alt="avatar" />
 | 
				
			||||||
 | 
												<div v-else>
 | 
				
			||||||
 | 
													<loading-outlined v-if="loading"></loading-outlined>
 | 
				
			||||||
 | 
													<plus-outlined v-else></plus-outlined>
 | 
				
			||||||
 | 
													<div class="ant-upload-text">Upload</div>
 | 
				
			||||||
 | 
												</div>
 | 
				
			||||||
 | 
											</a-upload>
 | 
				
			||||||
 | 
										</a-form-item>
 | 
				
			||||||
 | 
										<a-form-item name="promoteUrl">
 | 
				
			||||||
 | 
											<a-input v-model:value="productFormData.promoteUrl" placeholder="请输入商品链接" />
 | 
				
			||||||
 | 
										</a-form-item>
 | 
				
			||||||
 | 
									</a-form>
 | 
				
			||||||
			</a-tab-pane>
 | 
								</a-tab-pane>
 | 
				
			||||||
		</a-tabs>
 | 
							</a-tabs>
 | 
				
			||||||
	</a-card>
 | 
						</a-card>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script setup>
 | 
					<script setup name="materielDetail">
 | 
				
			||||||
 | 
						import unitGroupsApi from '@/api/base/unit/unitGroupsApi'
 | 
				
			||||||
 | 
						import unitApi from '@/api/base/unit/unitApi'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	import { required } from '@/utils/formRules'
 | 
						import { required } from '@/utils/formRules'
 | 
				
			||||||
	import officialAccountApi from '@/api/base/wx/officialAccountApi'
 | 
					 | 
				
			||||||
	import useFormHandler from '@/hook/useFormHandler'
 | 
						import useFormHandler from '@/hook/useFormHandler'
 | 
				
			||||||
	import tool from '@/utils/tool'
 | 
						import tool from '@/utils/tool'
 | 
				
			||||||
	import { useRoute } from 'vue-router'
 | 
						import { useRoute } from 'vue-router'
 | 
				
			||||||
 | 
						import materialApi from '@/api/base/material/materialApi'
 | 
				
			||||||
 | 
						import materialCategoryApi from '@/api/base/material/materialCategoryApi'
 | 
				
			||||||
 | 
						import { message } from 'ant-design-vue'
 | 
				
			||||||
 | 
						import sysBrandApi from '@/api/base/brand/sysBrandApi'
 | 
				
			||||||
	const route = useRoute()
 | 
						const route = useRoute()
 | 
				
			||||||
	import DynamicTable from '@/components/DynamicTable/index.vue'
 | 
					
 | 
				
			||||||
 | 
						const formRef1 = ref(null)
 | 
				
			||||||
 | 
						const formRef2 = ref(null)
 | 
				
			||||||
 | 
						const formRef3 = ref(null)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						let dataSource = ref([])
 | 
				
			||||||
 | 
						let unitOptions = reactive([])
 | 
				
			||||||
 | 
						let productFormData = ref({
 | 
				
			||||||
 | 
							promoteEnabledState: 'ENABLE'
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						onMounted(async () => {
 | 
				
			||||||
 | 
							formRefs.value = [formRef1.value, formRef2.value, formRef3.value]
 | 
				
			||||||
 | 
							fetchData(route.query.type).then(async (res) => {
 | 
				
			||||||
 | 
								if (res) {
 | 
				
			||||||
 | 
									productFormData.value.promoteEnabledState = res.promoteEnabledState
 | 
				
			||||||
 | 
									productFormData.value.promoteUrl = res.promoteUrl
 | 
				
			||||||
 | 
									const packageData = await materialApi.materialPackageData({
 | 
				
			||||||
 | 
										materialId: res.id
 | 
				
			||||||
 | 
									})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									const unitList = await unitApi.sysUnitList({
 | 
				
			||||||
 | 
										groupId: res.unitGroupId
 | 
				
			||||||
 | 
									})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									unitFormItems.forEach((item) => {
 | 
				
			||||||
 | 
										if (item.name !== 'unitGroupId') {
 | 
				
			||||||
 | 
											item.attrs.options = unitList || []
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									unitOptions = unitList
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									dataSource.value = packageData
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (route.query.type === 'ADD') {
 | 
				
			||||||
 | 
								const packageType = tool.dictList('MATERIAL_PACKAGE_TYPE')
 | 
				
			||||||
 | 
								packageType.forEach((item) => {
 | 
				
			||||||
 | 
									dataSource.value.push({
 | 
				
			||||||
 | 
										enabledState: 'ENABLE',
 | 
				
			||||||
 | 
										number: item.value,
 | 
				
			||||||
 | 
										type: item.label,
 | 
				
			||||||
 | 
										name: item.label,
 | 
				
			||||||
 | 
										unitId: '',
 | 
				
			||||||
 | 
										productQty: ''
 | 
				
			||||||
 | 
									})
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// 单位列表
 | 
				
			||||||
 | 
							const unitList = await unitGroupsApi.sysUnitGroupList({
 | 
				
			||||||
 | 
								enabledState: 'ENABLE'
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							unitList &&
 | 
				
			||||||
 | 
								unitFormItems.forEach((item) => {
 | 
				
			||||||
 | 
									if (item.name === 'unitGroupId') {
 | 
				
			||||||
 | 
										item.attrs.options = unitList
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// 物料类型
 | 
				
			||||||
 | 
							const materialCategoryList = await materialCategoryApi.materialCategoryTree({
 | 
				
			||||||
 | 
								enabledState: 'ENABLE'
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							materialCategoryList &&
 | 
				
			||||||
 | 
								baseFormItems.forEach((item) => {
 | 
				
			||||||
 | 
									if (item.name === 'categoryId') {
 | 
				
			||||||
 | 
										item.attrs.options = materialCategoryList
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// 品牌列表
 | 
				
			||||||
 | 
							const brandList = await sysBrandApi.sysBrandList({
 | 
				
			||||||
 | 
								enabledState: 'ENABLE'
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							brandList &&
 | 
				
			||||||
 | 
								baseFormItems.forEach((item) => {
 | 
				
			||||||
 | 
									if (item.name === 'brandId') {
 | 
				
			||||||
 | 
										item.attrs.options = brandList
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						let activeKey = ref('1')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// 选择单位组
 | 
				
			||||||
 | 
						const handleChangeUnitGroup = (value) => {
 | 
				
			||||||
 | 
							unitFormItems.forEach((item) => {
 | 
				
			||||||
 | 
								if (item.name !== 'unitGroupId') {
 | 
				
			||||||
 | 
									formData[item.name] = null
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							unitApi
 | 
				
			||||||
 | 
								.sysUnitList({
 | 
				
			||||||
 | 
									groupId: value
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
								.then((res) => {
 | 
				
			||||||
 | 
									unitFormItems.forEach((item) => {
 | 
				
			||||||
 | 
										if (item.name !== 'unitGroupId') {
 | 
				
			||||||
 | 
											item.attrs.options = res
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									unitOptions = res
 | 
				
			||||||
 | 
									const resFilter = res.filter((item) => item.isBase === 'YES')
 | 
				
			||||||
 | 
									if (resFilter.length > 0) formData.baseUnitId = resFilter[0].id
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const onSubmitForm = () => {
 | 
				
			||||||
 | 
							console.log(productFormData.value, 'productFormData.value')
 | 
				
			||||||
 | 
							onSubmit({
 | 
				
			||||||
 | 
								isDeep: true,
 | 
				
			||||||
 | 
								materialPackageList: dataSource.value,
 | 
				
			||||||
 | 
								...formData,
 | 
				
			||||||
 | 
								...productFormData.value
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// 图片上传
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						function getBase64(img, callback) {
 | 
				
			||||||
 | 
							const reader = new FileReader()
 | 
				
			||||||
 | 
							reader.addEventListener('load', () => callback(reader.result))
 | 
				
			||||||
 | 
							reader.readAsDataURL(img)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						const fileList = ref([])
 | 
				
			||||||
 | 
						const loading = ref(false)
 | 
				
			||||||
 | 
						const imageUrl = ref('')
 | 
				
			||||||
 | 
						const handleChange = (info) => {
 | 
				
			||||||
 | 
							if (info.file.status === 'uploading') {
 | 
				
			||||||
 | 
								loading.value = true
 | 
				
			||||||
 | 
								return
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if (info.file.status === 'done') {
 | 
				
			||||||
 | 
								// Get this url from response in real world.
 | 
				
			||||||
 | 
								getBase64(info.file.originFileObj, (base64Url) => {
 | 
				
			||||||
 | 
									imageUrl.value = base64Url
 | 
				
			||||||
 | 
									loading.value = false
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if (info.file.status === 'error') {
 | 
				
			||||||
 | 
								loading.value = false
 | 
				
			||||||
 | 
								message.error('upload error')
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						const beforeUpload = (file) => {
 | 
				
			||||||
 | 
							const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'
 | 
				
			||||||
 | 
							if (!isJpgOrPng) {
 | 
				
			||||||
 | 
								message.error('You can only upload JPG file!')
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							const isLt2M = file.size / 1024 / 1024 < 2
 | 
				
			||||||
 | 
							if (!isLt2M) {
 | 
				
			||||||
 | 
								message.error('Image must smaller than 2MB!')
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return isJpgOrPng && isLt2M
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const formRules = {
 | 
						const formRules = {
 | 
				
			||||||
		name: [required('请输入名称')],
 | 
							name: [required('请输入名称')],
 | 
				
			||||||
| 
						 | 
					@ -60,15 +294,14 @@
 | 
				
			||||||
		secret: [required('请输入AppSecret')]
 | 
							secret: [required('请输入AppSecret')]
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const officialAccountFormItems = [
 | 
						const materialFormItems = [
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			label: '编码:',
 | 
								label: '编码:',
 | 
				
			||||||
			name: 'number',
 | 
								name: 'number',
 | 
				
			||||||
			type: 'a-select',
 | 
								type: 'a-input',
 | 
				
			||||||
			span: 6,
 | 
								span: 6,
 | 
				
			||||||
			attrs: {
 | 
								attrs: {
 | 
				
			||||||
				placeholder: '请选择类型',
 | 
									placeholder: '请输入编码'
 | 
				
			||||||
				options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
 | 
					 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
| 
						 | 
					@ -83,11 +316,50 @@
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			label: '仓库条码:',
 | 
								label: '简称:',
 | 
				
			||||||
			name: 'name',
 | 
								name: 'shortName',
 | 
				
			||||||
 | 
								type: 'a-input',
 | 
				
			||||||
 | 
								span: 6,
 | 
				
			||||||
 | 
								attrs: {
 | 
				
			||||||
 | 
									placeholder: '请输入名称',
 | 
				
			||||||
 | 
									allowClear: true
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								label: '别名:',
 | 
				
			||||||
 | 
								name: 'alias',
 | 
				
			||||||
 | 
								type: 'a-input',
 | 
				
			||||||
 | 
								span: 6,
 | 
				
			||||||
 | 
								attrs: {
 | 
				
			||||||
 | 
									placeholder: '请输入名称',
 | 
				
			||||||
 | 
									allowClear: true
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								label: '规格型号:',
 | 
				
			||||||
 | 
								name: 'specification',
 | 
				
			||||||
 | 
								type: 'a-input',
 | 
				
			||||||
 | 
								span: 6,
 | 
				
			||||||
 | 
								attrs: {
 | 
				
			||||||
 | 
									placeholder: '请输入名称',
 | 
				
			||||||
 | 
									allowClear: true
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								label: '包装比例:',
 | 
				
			||||||
 | 
								name: 'packageProportion',
 | 
				
			||||||
 | 
								type: 'a-input',
 | 
				
			||||||
 | 
								span: 6,
 | 
				
			||||||
 | 
								attrs: {
 | 
				
			||||||
 | 
									placeholder: '请输入名称',
 | 
				
			||||||
 | 
									allowClear: true
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								label: '助记码:',
 | 
				
			||||||
 | 
								name: 'mnemonicCode',
 | 
				
			||||||
			type: 'a-input',
 | 
								type: 'a-input',
 | 
				
			||||||
			span: 6,
 | 
								span: 6,
 | 
				
			||||||
			rules: [required('请输入名称')],
 | 
					 | 
				
			||||||
			attrs: {
 | 
								attrs: {
 | 
				
			||||||
				placeholder: '请输入名称',
 | 
									placeholder: '请输入名称',
 | 
				
			||||||
				allowClear: true
 | 
									allowClear: true
 | 
				
			||||||
| 
						 | 
					@ -103,18 +375,121 @@
 | 
				
			||||||
				options: tool.dictList('COMMON_STATUS')
 | 
									options: tool.dictList('COMMON_STATUS')
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
			defaultValue: 'ENABLE'
 | 
								defaultValue: 'ENABLE'
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const baseFormItems = reactive([
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								label: '物料类型:',
 | 
				
			||||||
 | 
								name: 'categoryId',
 | 
				
			||||||
 | 
								type: 'a-select',
 | 
				
			||||||
 | 
								span: 6,
 | 
				
			||||||
 | 
								rules: [required('请选择物料类型')],
 | 
				
			||||||
 | 
								attrs: {
 | 
				
			||||||
 | 
									placeholder: '请选择物料类型',
 | 
				
			||||||
 | 
									options: tool.dictList('OFFICIAL_ACCOUNT_TYPE'),
 | 
				
			||||||
 | 
									fieldNames: {
 | 
				
			||||||
 | 
										label: 'name',
 | 
				
			||||||
 | 
										value: 'id'
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			label: '库存管理方式:',
 | 
								label: '品牌:',
 | 
				
			||||||
			name: 'name',
 | 
								name: 'brandId',
 | 
				
			||||||
 | 
								type: 'a-select',
 | 
				
			||||||
 | 
								span: 6,
 | 
				
			||||||
 | 
								rules: [required('请选择品牌')],
 | 
				
			||||||
 | 
								attrs: {
 | 
				
			||||||
 | 
									placeholder: '请选择品牌',
 | 
				
			||||||
 | 
									options: [],
 | 
				
			||||||
 | 
									fieldNames: {
 | 
				
			||||||
 | 
										label: 'name',
 | 
				
			||||||
 | 
										value: 'id'
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								label: '最高库存:',
 | 
				
			||||||
 | 
								name: 'maxInventory',
 | 
				
			||||||
 | 
								type: 'a-input-number',
 | 
				
			||||||
 | 
								span: 6,
 | 
				
			||||||
 | 
								attrs: {
 | 
				
			||||||
 | 
									placeholder: '请输入最高库存'
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								label: '最低库存:',
 | 
				
			||||||
 | 
								name: 'minInventory',
 | 
				
			||||||
 | 
								type: 'a-input-number',
 | 
				
			||||||
 | 
								span: 6,
 | 
				
			||||||
 | 
								attrs: {
 | 
				
			||||||
 | 
									placeholder: '请输入最高库存'
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								label: '保质期:',
 | 
				
			||||||
 | 
								name: 'shelfLife',
 | 
				
			||||||
 | 
								type: 'a-input-number',
 | 
				
			||||||
 | 
								span: 6,
 | 
				
			||||||
 | 
								rules: [required('请选择保质期')],
 | 
				
			||||||
 | 
								attrs: {
 | 
				
			||||||
 | 
									placeholder: '请输入保质期',
 | 
				
			||||||
 | 
									allowClear: true
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								label: '统一零售价:',
 | 
				
			||||||
 | 
								name: 'retailPrice',
 | 
				
			||||||
 | 
								type: 'a-input-number',
 | 
				
			||||||
 | 
								span: 6,
 | 
				
			||||||
 | 
								attrs: {
 | 
				
			||||||
 | 
									placeholder: '请输入统一零售价',
 | 
				
			||||||
 | 
									allowClear: true
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								label: '商品条形码:',
 | 
				
			||||||
 | 
								name: 'barcode',
 | 
				
			||||||
			type: 'a-input',
 | 
								type: 'a-input',
 | 
				
			||||||
			span: 6,
 | 
								span: 6,
 | 
				
			||||||
			rules: [required('请输入名称')],
 | 
					 | 
				
			||||||
			attrs: {
 | 
								attrs: {
 | 
				
			||||||
				placeholder: '请输入名称',
 | 
									placeholder: '请输入商品条形码',
 | 
				
			||||||
				allowClear: true
 | 
									allowClear: true
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								label: '保质期单位:',
 | 
				
			||||||
 | 
								name: 'shelfLifeUnit',
 | 
				
			||||||
 | 
								type: 'a-select',
 | 
				
			||||||
 | 
								span: 6,
 | 
				
			||||||
 | 
								rules: [required('请选择保质期单位')],
 | 
				
			||||||
 | 
								attrs: {
 | 
				
			||||||
 | 
									placeholder: '请选择保质期单位',
 | 
				
			||||||
 | 
									options: tool.dictList('DATE_UNIT')
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								label: '最大包装数量:',
 | 
				
			||||||
 | 
								name: 'maxPackageQuantity',
 | 
				
			||||||
 | 
								type: 'a-input-number',
 | 
				
			||||||
 | 
								span: 6,
 | 
				
			||||||
 | 
								rules: [required('请输入最大包装数量')],
 | 
				
			||||||
 | 
								attrs: {
 | 
				
			||||||
 | 
									placeholder: '请输入最大包装数量',
 | 
				
			||||||
 | 
									allowClear: true
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								label: '批次管理:',
 | 
				
			||||||
 | 
								name: 'batchManage',
 | 
				
			||||||
 | 
								type: 'a-select',
 | 
				
			||||||
 | 
								span: 6,
 | 
				
			||||||
 | 
								attrs: {
 | 
				
			||||||
 | 
									placeholder: '请选择批次管理',
 | 
				
			||||||
 | 
									options: tool.dictList('COMMON_STATUS')
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			label: '备注:',
 | 
								label: '备注:',
 | 
				
			||||||
			name: 'remarks',
 | 
								name: 'remarks',
 | 
				
			||||||
| 
						 | 
					@ -125,222 +500,162 @@
 | 
				
			||||||
				allowClear: true
 | 
									allowClear: true
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	]
 | 
						])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const baseFormItems = [
 | 
						const unitFormItems = reactive([
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			label: '物料类型:',
 | 
					 | 
				
			||||||
			name: 'number',
 | 
					 | 
				
			||||||
			type: 'a-select',
 | 
					 | 
				
			||||||
			span: 6,
 | 
					 | 
				
			||||||
			attrs: {
 | 
					 | 
				
			||||||
				placeholder: '请选择类型',
 | 
					 | 
				
			||||||
				options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			label: '品牌:',
 | 
					 | 
				
			||||||
			name: 'number',
 | 
					 | 
				
			||||||
			type: 'a-select',
 | 
					 | 
				
			||||||
			span: 6,
 | 
					 | 
				
			||||||
			attrs: {
 | 
					 | 
				
			||||||
				placeholder: '请选择类型',
 | 
					 | 
				
			||||||
				options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			label: '最高库存:',
 | 
					 | 
				
			||||||
			name: 'number',
 | 
					 | 
				
			||||||
			type: 'a-select',
 | 
					 | 
				
			||||||
			span: 6,
 | 
					 | 
				
			||||||
			attrs: {
 | 
					 | 
				
			||||||
				placeholder: '请选择类型',
 | 
					 | 
				
			||||||
				options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			label: '最低库存:',
 | 
					 | 
				
			||||||
			name: 'remarks',
 | 
					 | 
				
			||||||
			type: 'a-textarea',
 | 
					 | 
				
			||||||
			span: 24,
 | 
					 | 
				
			||||||
			attrs: {
 | 
					 | 
				
			||||||
				placeholder: '请输入备注',
 | 
					 | 
				
			||||||
				allowClear: true
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			label: '保质期:',
 | 
					 | 
				
			||||||
			name: 'remarks',
 | 
					 | 
				
			||||||
			type: 'a-textarea',
 | 
					 | 
				
			||||||
			span: 24,
 | 
					 | 
				
			||||||
			attrs: {
 | 
					 | 
				
			||||||
				placeholder: '请输入备注',
 | 
					 | 
				
			||||||
				allowClear: true
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			label: '统一零售价:',
 | 
					 | 
				
			||||||
			name: 'remarks',
 | 
					 | 
				
			||||||
			type: 'a-textarea',
 | 
					 | 
				
			||||||
			span: 24,
 | 
					 | 
				
			||||||
			attrs: {
 | 
					 | 
				
			||||||
				placeholder: '请输入备注',
 | 
					 | 
				
			||||||
				allowClear: true
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			label: '商品条形码:',
 | 
					 | 
				
			||||||
			name: 'remarks',
 | 
					 | 
				
			||||||
			type: 'a-textarea',
 | 
					 | 
				
			||||||
			span: 24,
 | 
					 | 
				
			||||||
			attrs: {
 | 
					 | 
				
			||||||
				placeholder: '请输入备注',
 | 
					 | 
				
			||||||
				allowClear: true
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			label: '保质期单位:',
 | 
					 | 
				
			||||||
			name: 'remarks',
 | 
					 | 
				
			||||||
			type: 'a-textarea',
 | 
					 | 
				
			||||||
			span: 24,
 | 
					 | 
				
			||||||
			attrs: {
 | 
					 | 
				
			||||||
				placeholder: '请输入备注',
 | 
					 | 
				
			||||||
				allowClear: true
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			label: '最大包装数量:',
 | 
					 | 
				
			||||||
			name: 'remarks',
 | 
					 | 
				
			||||||
			type: 'a-textarea',
 | 
					 | 
				
			||||||
			span: 24,
 | 
					 | 
				
			||||||
			attrs: {
 | 
					 | 
				
			||||||
				placeholder: '请输入备注',
 | 
					 | 
				
			||||||
				allowClear: true
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			label: '批次管理:',
 | 
					 | 
				
			||||||
			name: 'number',
 | 
					 | 
				
			||||||
			type: 'a-select',
 | 
					 | 
				
			||||||
			span: 6,
 | 
					 | 
				
			||||||
			attrs: {
 | 
					 | 
				
			||||||
				placeholder: '请选择类型',
 | 
					 | 
				
			||||||
				options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
	]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	const unitFormItems = [
 | 
					 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			label: '单位组:',
 | 
								label: '单位组:',
 | 
				
			||||||
			name: 'number',
 | 
								name: 'unitGroupId',
 | 
				
			||||||
			type: 'a-select',
 | 
								type: 'a-select',
 | 
				
			||||||
			span: 6,
 | 
								span: 6,
 | 
				
			||||||
 | 
								rules: [required('请选择单位组')],
 | 
				
			||||||
			attrs: {
 | 
								attrs: {
 | 
				
			||||||
				placeholder: '请选择类型',
 | 
									placeholder: '请选择类型',
 | 
				
			||||||
				options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
 | 
									options: [],
 | 
				
			||||||
 | 
									fieldNames: {
 | 
				
			||||||
 | 
										label: 'name',
 | 
				
			||||||
 | 
										value: 'id'
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									onChange: handleChangeUnitGroup
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			label: '基本单位:',
 | 
								label: '基本单位:',
 | 
				
			||||||
			name: 'number',
 | 
								name: 'baseUnitId',
 | 
				
			||||||
			type: 'a-select',
 | 
								type: 'a-select',
 | 
				
			||||||
			span: 6,
 | 
								span: 6,
 | 
				
			||||||
			attrs: {
 | 
								attrs: {
 | 
				
			||||||
				placeholder: '请选择类型',
 | 
									placeholder: '请选择类型',
 | 
				
			||||||
				options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
 | 
									options: [],
 | 
				
			||||||
 | 
									disabled: true,
 | 
				
			||||||
 | 
									fieldNames: {
 | 
				
			||||||
 | 
										label: 'name',
 | 
				
			||||||
 | 
										value: 'id'
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			label: '采购单位:',
 | 
								label: '采购单位:',
 | 
				
			||||||
			name: 'number',
 | 
								name: 'purchaseUnitId',
 | 
				
			||||||
			type: 'a-select',
 | 
								type: 'a-select',
 | 
				
			||||||
			span: 6,
 | 
								span: 6,
 | 
				
			||||||
 | 
								rules: [required('请选择采购单位')],
 | 
				
			||||||
			attrs: {
 | 
								attrs: {
 | 
				
			||||||
				placeholder: '请选择类型',
 | 
									placeholder: '请选择类型',
 | 
				
			||||||
				options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
 | 
									options: [],
 | 
				
			||||||
 | 
									fieldNames: {
 | 
				
			||||||
 | 
										label: 'name',
 | 
				
			||||||
 | 
										value: 'id'
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			label: '分销单位:',
 | 
								label: '分销单位:',
 | 
				
			||||||
			name: 'remarks',
 | 
								name: 'distrUnitId',
 | 
				
			||||||
			type: 'a-textarea',
 | 
								type: 'a-select',
 | 
				
			||||||
			span: 24,
 | 
								span: 6,
 | 
				
			||||||
 | 
								rules: [required('请选择分销单位')],
 | 
				
			||||||
			attrs: {
 | 
								attrs: {
 | 
				
			||||||
				placeholder: '请输入备注',
 | 
									placeholder: '请输入备注',
 | 
				
			||||||
				allowClear: true
 | 
									options: [],
 | 
				
			||||||
 | 
									fieldNames: {
 | 
				
			||||||
 | 
										label: 'name',
 | 
				
			||||||
 | 
										value: 'id'
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			label: '生产单位:',
 | 
								label: '生产单位:',
 | 
				
			||||||
			name: 'remarks',
 | 
								name: 'produceUnitId',
 | 
				
			||||||
			type: 'a-textarea',
 | 
								type: 'a-select',
 | 
				
			||||||
			span: 24,
 | 
								span: 6,
 | 
				
			||||||
 | 
								rules: [required('请选择生产单位')],
 | 
				
			||||||
			attrs: {
 | 
								attrs: {
 | 
				
			||||||
				placeholder: '请输入备注',
 | 
									placeholder: '请输入备注',
 | 
				
			||||||
				allowClear: true
 | 
									options: [],
 | 
				
			||||||
 | 
									fieldNames: {
 | 
				
			||||||
 | 
										label: 'name',
 | 
				
			||||||
 | 
										value: 'id'
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			label: '销售单位:',
 | 
								label: '销售单位:',
 | 
				
			||||||
			name: 'remarks',
 | 
								name: 'saleUnitId',
 | 
				
			||||||
			type: 'a-textarea',
 | 
								type: 'a-select',
 | 
				
			||||||
			span: 24,
 | 
								span: 6,
 | 
				
			||||||
 | 
								rules: [required('请选择销售单位')],
 | 
				
			||||||
			attrs: {
 | 
								attrs: {
 | 
				
			||||||
				placeholder: '请输入备注',
 | 
									placeholder: '请输入备注',
 | 
				
			||||||
				allowClear: true
 | 
									options: [],
 | 
				
			||||||
 | 
									fieldNames: {
 | 
				
			||||||
 | 
										label: 'name',
 | 
				
			||||||
 | 
										value: 'id'
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			label: '库存单位:',
 | 
								label: '库存单位:',
 | 
				
			||||||
			name: 'remarks',
 | 
								name: 'storeUnitId',
 | 
				
			||||||
			type: 'a-textarea',
 | 
								type: 'a-select',
 | 
				
			||||||
			span: 24,
 | 
								rules: [required('请选择库存单位')],
 | 
				
			||||||
 | 
								span: 6,
 | 
				
			||||||
			attrs: {
 | 
								attrs: {
 | 
				
			||||||
				placeholder: '请输入备注',
 | 
									placeholder: '请输入备注',
 | 
				
			||||||
				allowClear: true
 | 
									options: [],
 | 
				
			||||||
 | 
									fieldNames: {
 | 
				
			||||||
 | 
										label: 'name',
 | 
				
			||||||
 | 
										value: 'id'
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	const formRef1 = ref(null)
 | 
					 | 
				
			||||||
	const formRef2 = ref(null)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	const { state, formData, submitLoading, formRefs, onSubmit, handleBack, fetchData } = useFormHandler(
 | 
					 | 
				
			||||||
		[...officialAccountFormItems, ...baseFormItems],
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			submitForm: officialAccountApi.officialAccountSubmitForm,
 | 
					 | 
				
			||||||
			getDetail: officialAccountApi.officialAccountDetail
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	onMounted(() => {
 | 
					 | 
				
			||||||
		formRefs.value = [formRef1.value, formRef2.value]
 | 
					 | 
				
			||||||
		fetchData(route.query.type)
 | 
					 | 
				
			||||||
	})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	let activeKey = ref('1')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	const data = ref([
 | 
					 | 
				
			||||||
		{ id: '1', name: 'John', age: 28 },
 | 
					 | 
				
			||||||
		{ id: '2', name: 'Jane', age: 22 }
 | 
					 | 
				
			||||||
	])
 | 
						])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const columns = [
 | 
						const columns = [
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			title: '上游仓库代码',
 | 
								title: '启用',
 | 
				
			||||||
			dataIndex: 'name',
 | 
								dataIndex: 'enabledState',
 | 
				
			||||||
			editable: true,
 | 
								editable: true,
 | 
				
			||||||
			dataType: 'text' // 或 'number', 'select'
 | 
								align: 'center'
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			title: '上游仓库名称',
 | 
								title: '条码类型编码',
 | 
				
			||||||
			dataIndex: 'age',
 | 
								dataIndex: 'number',
 | 
				
			||||||
			editable: true,
 | 
								editable: true,
 | 
				
			||||||
			dataType: 'number'
 | 
								align: 'center'
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								title: '条码类型',
 | 
				
			||||||
 | 
								dataIndex: 'type',
 | 
				
			||||||
 | 
								editable: true,
 | 
				
			||||||
 | 
								align: 'center'
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								title: '包装关系名称',
 | 
				
			||||||
 | 
								dataIndex: 'name',
 | 
				
			||||||
 | 
								editable: true,
 | 
				
			||||||
 | 
								align: 'center'
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								title: '单位',
 | 
				
			||||||
 | 
								dataIndex: 'unitId',
 | 
				
			||||||
 | 
								editable: true,
 | 
				
			||||||
 | 
								align: 'center'
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								title: '产品数',
 | 
				
			||||||
 | 
								dataIndex: 'productQty',
 | 
				
			||||||
 | 
								editable: true,
 | 
				
			||||||
 | 
								align: 'center'
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	]
 | 
						]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const { state, formData, submitLoading, formRefs, onSubmit, handleBack, fetchData } = useFormHandler(
 | 
				
			||||||
 | 
							[...materialFormItems, ...baseFormItems, ...unitFormItems],
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								submitForm: materialApi.materialSubmitForm,
 | 
				
			||||||
 | 
								getDetail: materialApi.materialDetail
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,135 @@
 | 
				
			||||||
 | 
					<template>
 | 
				
			||||||
 | 
						<xn-form-container
 | 
				
			||||||
 | 
							:title="pageType === 'EDIT' ? '编辑物料' : pageType === 'ADD' ? '增加物料' : '查看物料'"
 | 
				
			||||||
 | 
							:width="700"
 | 
				
			||||||
 | 
							:visible="visible"
 | 
				
			||||||
 | 
							:destroy-on-close="true"
 | 
				
			||||||
 | 
							@close="onClose"
 | 
				
			||||||
 | 
						>
 | 
				
			||||||
 | 
							<a-form ref="formRef" :model="formData" :rules="formRules" layout="vertical">
 | 
				
			||||||
 | 
								<a-row :gutter="16">
 | 
				
			||||||
 | 
									<a-col :span="24">
 | 
				
			||||||
 | 
										<a-form-item label="编码:" name="number">
 | 
				
			||||||
 | 
											<a-input
 | 
				
			||||||
 | 
												:disabled="pageType === 'SEARCH'"
 | 
				
			||||||
 | 
												v-model:value="formData.number"
 | 
				
			||||||
 | 
												placeholder="请输入编码"
 | 
				
			||||||
 | 
												allow-clear
 | 
				
			||||||
 | 
											/>
 | 
				
			||||||
 | 
										</a-form-item>
 | 
				
			||||||
 | 
									</a-col>
 | 
				
			||||||
 | 
									<a-col :span="24">
 | 
				
			||||||
 | 
										<a-form-item label="名称:" name="name">
 | 
				
			||||||
 | 
											<a-input
 | 
				
			||||||
 | 
												:disabled="pageType === 'SEARCH'"
 | 
				
			||||||
 | 
												v-model:value="formData.name"
 | 
				
			||||||
 | 
												placeholder="请输入物料名称"
 | 
				
			||||||
 | 
												allow-clear
 | 
				
			||||||
 | 
											/>
 | 
				
			||||||
 | 
										</a-form-item>
 | 
				
			||||||
 | 
									</a-col>
 | 
				
			||||||
 | 
									<a-col :span="24">
 | 
				
			||||||
 | 
										<a-form-item label="上级物料:" name="parentId">
 | 
				
			||||||
 | 
											<a-tree-select
 | 
				
			||||||
 | 
												:disabled="pageType === 'SEARCH'"
 | 
				
			||||||
 | 
												v-model:value="formData.parentId"
 | 
				
			||||||
 | 
												style="width: 100%"
 | 
				
			||||||
 | 
												:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
 | 
				
			||||||
 | 
												:tree-data="treeData"
 | 
				
			||||||
 | 
												placeholder="请选择上级物料"
 | 
				
			||||||
 | 
												:fieldNames="{
 | 
				
			||||||
 | 
													children: 'children',
 | 
				
			||||||
 | 
													label: 'name',
 | 
				
			||||||
 | 
													value: 'id'
 | 
				
			||||||
 | 
												}"
 | 
				
			||||||
 | 
											>
 | 
				
			||||||
 | 
											</a-tree-select>
 | 
				
			||||||
 | 
										</a-form-item>
 | 
				
			||||||
 | 
									</a-col>
 | 
				
			||||||
 | 
								</a-row>
 | 
				
			||||||
 | 
							</a-form>
 | 
				
			||||||
 | 
							<template #footer>
 | 
				
			||||||
 | 
								<a-button style="margin-right: 8px" @click="onClose">关闭</a-button>
 | 
				
			||||||
 | 
								<a-button v-if="pageType !== 'SEARCH'" type="primary" @click="onSubmit" :loading="submitLoading">保存</a-button>
 | 
				
			||||||
 | 
							</template>
 | 
				
			||||||
 | 
						</xn-form-container>
 | 
				
			||||||
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<script setup name="productionOrganizationForm">
 | 
				
			||||||
 | 
						import { cloneDeep } from 'lodash-es'
 | 
				
			||||||
 | 
						import { required } from '@/utils/formRules'
 | 
				
			||||||
 | 
						import productionOrganizationApi from '@/api/base/production-organization/productionOrganizationApi'
 | 
				
			||||||
 | 
						import sysStoreApi from '@/api/base/store/sysStoreApi'
 | 
				
			||||||
 | 
						import materialCategoryApi from '@/api/base/material/materialCategoryApi'
 | 
				
			||||||
 | 
						// 抽屉状态
 | 
				
			||||||
 | 
						const visible = ref(false)
 | 
				
			||||||
 | 
						const emit = defineEmits({ successful: null })
 | 
				
			||||||
 | 
						const formRef = ref()
 | 
				
			||||||
 | 
						// 表单数据
 | 
				
			||||||
 | 
						let formData_enum = {
 | 
				
			||||||
 | 
							type: 'FACTORY',
 | 
				
			||||||
 | 
							enabledState: 'ENABLE'
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						const formData = ref({})
 | 
				
			||||||
 | 
						const submitLoading = ref(false)
 | 
				
			||||||
 | 
						const typeOptions = ref([])
 | 
				
			||||||
 | 
						const enabledStateOptions = ref([])
 | 
				
			||||||
 | 
						let pageType = ref('ADD')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// 打开抽屉
 | 
				
			||||||
 | 
						const onOpen = (record) => {
 | 
				
			||||||
 | 
							visible.value = true
 | 
				
			||||||
 | 
							if (record) {
 | 
				
			||||||
 | 
								pageType.value = record.pageType
 | 
				
			||||||
 | 
								let recordData = cloneDeep(record)
 | 
				
			||||||
 | 
								formData.value = Object.assign({}, recordData)
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								pageType.value = 'ADD'
 | 
				
			||||||
 | 
								formData.value = formData_enum
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							materialCategoryApi.materialCategoryTree().then((res) => {
 | 
				
			||||||
 | 
								treeData.value = [
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										id: 0,
 | 
				
			||||||
 | 
										parentId: '0',
 | 
				
			||||||
 | 
										name: '顶级',
 | 
				
			||||||
 | 
										children: res ? res : []
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								]
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						// 关闭抽屉
 | 
				
			||||||
 | 
						const onClose = () => {
 | 
				
			||||||
 | 
							formRef.value.resetFields()
 | 
				
			||||||
 | 
							visible.value = false
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						// 默认要校验的refresh
 | 
				
			||||||
 | 
						const formRules = {
 | 
				
			||||||
 | 
							name: [required('请输入名称')],
 | 
				
			||||||
 | 
							parentId: [required('请选择上级物料')]
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						// 验证并提交数据
 | 
				
			||||||
 | 
						const onSubmit = () => {
 | 
				
			||||||
 | 
							formRef.value.validate().then(() => {
 | 
				
			||||||
 | 
								submitLoading.value = true
 | 
				
			||||||
 | 
								const formDataParam = cloneDeep(formData.value)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								materialCategoryApi
 | 
				
			||||||
 | 
									.materialCategorySubmitForm(formDataParam, formDataParam.id)
 | 
				
			||||||
 | 
									.then(() => {
 | 
				
			||||||
 | 
										onClose()
 | 
				
			||||||
 | 
										emit('successful')
 | 
				
			||||||
 | 
									})
 | 
				
			||||||
 | 
									.finally(() => {
 | 
				
			||||||
 | 
										submitLoading.value = false
 | 
				
			||||||
 | 
									})
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						let treeData = ref([])
 | 
				
			||||||
 | 
						// 抛出函数
 | 
				
			||||||
 | 
						defineExpose({
 | 
				
			||||||
 | 
							onOpen
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
| 
						 | 
					@ -8,8 +8,17 @@
 | 
				
			||||||
					</a-form-item>
 | 
										</a-form-item>
 | 
				
			||||||
				</a-col>
 | 
									</a-col>
 | 
				
			||||||
				<a-col :span="6">
 | 
									<a-col :span="6">
 | 
				
			||||||
					<a-form-item label="类型" name="type">
 | 
										<a-form-item label="编码" name="number">
 | 
				
			||||||
						<a-input v-model:value="searchFormState.type" placeholder="请输入类型" />
 | 
											<a-input v-model:value="searchFormState.number" placeholder="请输入编码" />
 | 
				
			||||||
 | 
										</a-form-item>
 | 
				
			||||||
 | 
									</a-col>
 | 
				
			||||||
 | 
									<a-col :span="6">
 | 
				
			||||||
 | 
										<a-form-item label="可用状态" name="enabledState">
 | 
				
			||||||
 | 
											<a-select
 | 
				
			||||||
 | 
												v-model:value="searchFormState.enabledState"
 | 
				
			||||||
 | 
												placeholder="请选择可用状态"
 | 
				
			||||||
 | 
												:options="$TOOL.dictList('COMMON_STATUS')"
 | 
				
			||||||
 | 
											/>
 | 
				
			||||||
					</a-form-item>
 | 
										</a-form-item>
 | 
				
			||||||
				</a-col>
 | 
									</a-col>
 | 
				
			||||||
				<a-col :span="6">
 | 
									<a-col :span="6">
 | 
				
			||||||
| 
						 | 
					@ -33,28 +42,33 @@
 | 
				
			||||||
								<component class="icons" :is="item.icon"></component>
 | 
													<component class="icons" :is="item.icon"></component>
 | 
				
			||||||
							</a-tooltip>
 | 
												</a-tooltip>
 | 
				
			||||||
							<!-- 修改 -->
 | 
												<!-- 修改 -->
 | 
				
			||||||
							<a-tooltip :title="item.title" class="s-tool-item" v-if="item.name === 'edit'">
 | 
												<a-tooltip :title="item.title" class="s-tool-item" v-if="item.name === 'edit'" @click="handleEditTree">
 | 
				
			||||||
								<component class="icons" :is="item.icon"></component>
 | 
													<component class="icons" :is="item.icon"></component>
 | 
				
			||||||
							</a-tooltip>
 | 
												</a-tooltip>
 | 
				
			||||||
							<!-- 删除 -->
 | 
												<!-- 删除 -->
 | 
				
			||||||
							<a-tooltip :title="item.title" class="s-tool-item" v-if="item.name === 'delete'">
 | 
												<a-tooltip :title="item.title" class="s-tool-item" v-if="item.name === 'delete'">
 | 
				
			||||||
								<a-popconfirm title="确认删除?" ok-text="Yes" cancel-text="No">
 | 
													<a-popconfirm title="确定要删除吗?" ok-text="确认" cancel-text="取消" @confirm="handleDelTree">
 | 
				
			||||||
									<component class="icons" :is="item.icon"></component>
 | 
														<component class="icons" :is="item.icon"></component>
 | 
				
			||||||
								</a-popconfirm>
 | 
													</a-popconfirm>
 | 
				
			||||||
							</a-tooltip>
 | 
												</a-tooltip>
 | 
				
			||||||
							<!-- 刷新 -->
 | 
												<!-- 刷新 -->
 | 
				
			||||||
							<a-tooltip :title="item.title" class="s-tool-item" v-if="item.name === 'refresh'">
 | 
												<!--							<a-tooltip :title="item.title" class="s-tool-item" v-if="item.name === 'refresh'">
 | 
				
			||||||
								<component class="icons" :is="item.icon"></component>
 | 
													<component class="icons" :is="item.icon"></component>
 | 
				
			||||||
							</a-tooltip>
 | 
												</a-tooltip>-->
 | 
				
			||||||
						</span>
 | 
											</span>
 | 
				
			||||||
					</div>
 | 
										</div>
 | 
				
			||||||
				</div>
 | 
									</div>
 | 
				
			||||||
 | 
					 | 
				
			||||||
				<a-directory-tree
 | 
									<a-directory-tree
 | 
				
			||||||
					v-model:expandedKeys="expandedKeys"
 | 
										v-model:expandedKeys="expandedKeys"
 | 
				
			||||||
					v-model:selectedKeys="selectedKeys"
 | 
										v-model:selectedKeys="selectedKeys"
 | 
				
			||||||
					multiple
 | 
										multiple
 | 
				
			||||||
 | 
										:fieldNames="{
 | 
				
			||||||
 | 
											children: 'children',
 | 
				
			||||||
 | 
											title: 'name',
 | 
				
			||||||
 | 
											key: 'id'
 | 
				
			||||||
 | 
										}"
 | 
				
			||||||
					:tree-data="treeData"
 | 
										:tree-data="treeData"
 | 
				
			||||||
 | 
										@select="handleTreeClick"
 | 
				
			||||||
				></a-directory-tree>
 | 
									></a-directory-tree>
 | 
				
			||||||
			</a-col>
 | 
								</a-col>
 | 
				
			||||||
			<a-col :span="18">
 | 
								<a-col :span="18">
 | 
				
			||||||
| 
						 | 
					@ -136,12 +150,16 @@
 | 
				
			||||||
			</a-col>
 | 
								</a-col>
 | 
				
			||||||
		</a-row>
 | 
							</a-row>
 | 
				
			||||||
	</a-card>
 | 
						</a-card>
 | 
				
			||||||
 | 
						<materialCategoryForm ref="materialCategoryFormRef" @successful="successful"></materialCategoryForm>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script setup>
 | 
					<script setup name="materiel">
 | 
				
			||||||
	import customerApi from '@/api/base/customer/customerApi'
 | 
						import materialApi from '@/api/base/material/materialApi'
 | 
				
			||||||
	import customerCategoryApi from '@/api/base/customer/customerCategoryApi'
 | 
						import materialCategoryApi from '@/api/base/material/materialCategoryApi'
 | 
				
			||||||
	import { useTableManagement } from '@/hook/useTableManagement'
 | 
						import { useTableManagement } from '@/hook/useTableManagement'
 | 
				
			||||||
 | 
						import MaterialCategoryForm from '@/views/basicData/materiel/detail/materialCategoryForm.vue'
 | 
				
			||||||
 | 
						import { message } from 'ant-design-vue'
 | 
				
			||||||
 | 
						import customerCategoryApi from '@/api/base/customer/customerCategoryApi'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const materielColumn = [
 | 
						const materielColumn = [
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
| 
						 | 
					@ -155,23 +173,56 @@
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			title: '名称',
 | 
								title: '名称',
 | 
				
			||||||
			dataIndex: 'type',
 | 
					 | 
				
			||||||
			align: 'center',
 | 
					 | 
				
			||||||
			resizable: true,
 | 
					 | 
				
			||||||
			width: 100
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			title: '分类',
 | 
					 | 
				
			||||||
			dataIndex: 'name',
 | 
								dataIndex: 'name',
 | 
				
			||||||
			sorter: (a, b) => a.address.length - b.address.length,
 | 
					 | 
				
			||||||
			sortDirections: ['descend', 'ascend'],
 | 
					 | 
				
			||||||
			align: 'center',
 | 
								align: 'center',
 | 
				
			||||||
			resizable: true,
 | 
								resizable: true,
 | 
				
			||||||
			width: 100
 | 
								width: 100
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			title: '年龄',
 | 
								title: '规格型号',
 | 
				
			||||||
			dataIndex: 'enabledState',
 | 
								dataIndex: 'specification',
 | 
				
			||||||
 | 
								align: 'center',
 | 
				
			||||||
 | 
								resizable: true,
 | 
				
			||||||
 | 
								width: 100
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							// {
 | 
				
			||||||
 | 
							// 	title: '分类',
 | 
				
			||||||
 | 
							// 	dataIndex: 'name',
 | 
				
			||||||
 | 
							// 	align: 'center',
 | 
				
			||||||
 | 
							// 	resizable: true,
 | 
				
			||||||
 | 
							// 	width: 100
 | 
				
			||||||
 | 
							// },
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								title: '品牌',
 | 
				
			||||||
 | 
								dataIndex: 'brandName',
 | 
				
			||||||
 | 
								align: 'center',
 | 
				
			||||||
 | 
								resizable: true,
 | 
				
			||||||
 | 
								width: 100
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								title: '保质期',
 | 
				
			||||||
 | 
								dataIndex: 'shelfLifeUnit',
 | 
				
			||||||
 | 
								align: 'center',
 | 
				
			||||||
 | 
								resizable: true,
 | 
				
			||||||
 | 
								width: 100
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								title: '基本单位',
 | 
				
			||||||
 | 
								dataIndex: 'baseUnitName',
 | 
				
			||||||
 | 
								align: 'center',
 | 
				
			||||||
 | 
								resizable: true,
 | 
				
			||||||
 | 
								width: 100
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								title: '生产单位',
 | 
				
			||||||
 | 
								dataIndex: 'produceUnitName',
 | 
				
			||||||
 | 
								align: 'center',
 | 
				
			||||||
 | 
								resizable: true,
 | 
				
			||||||
 | 
								width: 100
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								title: '采购单位',
 | 
				
			||||||
 | 
								dataIndex: 'purchaseUnitName',
 | 
				
			||||||
			align: 'center',
 | 
								align: 'center',
 | 
				
			||||||
			resizable: true,
 | 
								resizable: true,
 | 
				
			||||||
			width: 100
 | 
								width: 100
 | 
				
			||||||
| 
						 | 
					@ -209,8 +260,8 @@
 | 
				
			||||||
		navigateTo
 | 
							navigateTo
 | 
				
			||||||
	} = useTableManagement(
 | 
						} = useTableManagement(
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			page: customerApi.customerPage,
 | 
								page: materialApi.materialPage,
 | 
				
			||||||
			delete: customerApi.customerDelete
 | 
								delete: materialApi.materialDelete
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		materielColumn,
 | 
							materielColumn,
 | 
				
			||||||
		['customerEdit', 'customerDelete']
 | 
							['customerEdit', 'customerDelete']
 | 
				
			||||||
| 
						 | 
					@ -242,16 +293,53 @@
 | 
				
			||||||
	// 树结构
 | 
						// 树结构
 | 
				
			||||||
	const expandedKeys = ref(['0-0', '0-1'])
 | 
						const expandedKeys = ref(['0-0', '0-1'])
 | 
				
			||||||
	const selectedKeys = ref([])
 | 
						const selectedKeys = ref([])
 | 
				
			||||||
	const treeData = []
 | 
						const treeData = ref([])
 | 
				
			||||||
	const CustomerCategoryFormRef = ref(null)
 | 
						const materialCategoryFormRef = ref(null)
 | 
				
			||||||
 | 
						let treeRow = {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const handleTreeClick = (selectedKeys, event) => {
 | 
				
			||||||
 | 
							treeRow = event.node
 | 
				
			||||||
 | 
							searchFormState.value.categoryId = selectedKeys[0]
 | 
				
			||||||
 | 
							tableRef.value.refresh()
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const handleAddTree = () => {
 | 
						const handleAddTree = () => {
 | 
				
			||||||
		CustomerCategoryFormRef.value.onOpen()
 | 
							materialCategoryFormRef.value.onOpen()
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const handleEditTree = () => {
 | 
				
			||||||
 | 
							if (!treeRow.id) return message.error('!请选择要编辑的数据')
 | 
				
			||||||
 | 
							materialCategoryFormRef.value.onOpen(treeRow)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const handleDelTree = () => {
 | 
				
			||||||
 | 
							if (!treeRow.id) return message.error('!请选择要删除的数据')
 | 
				
			||||||
 | 
							materialCategoryApi.materialCategoryDelete([{ id: treeRow.id }]).then((res) => {
 | 
				
			||||||
 | 
								selectedKeys.value = []
 | 
				
			||||||
 | 
								searchFormState.value.categoryId = null
 | 
				
			||||||
 | 
								treeRow = {}
 | 
				
			||||||
 | 
								tableRef.value.refresh()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								materialCategoryApi.materialCategoryTree().then((res) => {
 | 
				
			||||||
 | 
									treeData.value = res || []
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const successful = () => {
 | 
				
			||||||
 | 
							selectedKeys.value = []
 | 
				
			||||||
 | 
							searchFormState.value.categoryId = null
 | 
				
			||||||
 | 
							treeRow = {}
 | 
				
			||||||
 | 
							tableRef.value.refresh()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							materialCategoryApi.materialCategoryTree().then((res) => {
 | 
				
			||||||
 | 
								treeData.value = res
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	onMounted(() => {
 | 
						onMounted(() => {
 | 
				
			||||||
		customerCategoryApi.customerCategoryTree().then((res) => {
 | 
							materialCategoryApi.materialCategoryTree().then((res) => {
 | 
				
			||||||
			console.log(res)
 | 
								treeData.value = res || []
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,8 +8,12 @@
 | 
				
			||||||
					</a-form-item>
 | 
										</a-form-item>
 | 
				
			||||||
				</a-col>
 | 
									</a-col>
 | 
				
			||||||
				<a-col :span="6">
 | 
									<a-col :span="6">
 | 
				
			||||||
					<a-form-item label="类型" name="type">
 | 
										<a-form-item label="可用状态" name="enabledState">
 | 
				
			||||||
						<a-input v-model:value="searchFormState.type" placeholder="请输入类型" />
 | 
											<a-select
 | 
				
			||||||
 | 
												v-model:value="searchFormState.enabledState"
 | 
				
			||||||
 | 
												placeholder="请选择可用状态"
 | 
				
			||||||
 | 
												:options="$TOOL.dictList('COMMON_STATUS')"
 | 
				
			||||||
 | 
											/>
 | 
				
			||||||
					</a-form-item>
 | 
										</a-form-item>
 | 
				
			||||||
				</a-col>
 | 
									</a-col>
 | 
				
			||||||
				<a-col :span="6">
 | 
									<a-col :span="6">
 | 
				
			||||||
| 
						 | 
					@ -54,13 +58,14 @@
 | 
				
			||||||
			</template>
 | 
								</template>
 | 
				
			||||||
			<template #bodyCell="{ column, record }">
 | 
								<template #bodyCell="{ column, record }">
 | 
				
			||||||
				<template v-if="column.dataIndex === 'enabledState'">
 | 
									<template v-if="column.dataIndex === 'enabledState'">
 | 
				
			||||||
					<a-switch
 | 
										<!--					<a-switch
 | 
				
			||||||
						checkedValue="ENABLE"
 | 
											checkedValue="ENABLE"
 | 
				
			||||||
						unCheckedValue="DISABLED"
 | 
											unCheckedValue="DISABLED"
 | 
				
			||||||
						checked-children="启用"
 | 
											checked-children="启用"
 | 
				
			||||||
						un-checked-children="停用"
 | 
											un-checked-children="停用"
 | 
				
			||||||
						v-model:checked="record.enabledState"
 | 
											v-model:checked="record.enabledState"
 | 
				
			||||||
					/>
 | 
										/>-->
 | 
				
			||||||
 | 
										{{ $TOOL.dictTypeData('COMMON_STATUS', record.enabledState) }}
 | 
				
			||||||
				</template>
 | 
									</template>
 | 
				
			||||||
				<template v-if="column.dataIndex === 'type'">
 | 
									<template v-if="column.dataIndex === 'type'">
 | 
				
			||||||
					{{ $TOOL.dictTypeData('OFFICIAL_ACCOUNT_TYPE', record.type) }}
 | 
										{{ $TOOL.dictTypeData('OFFICIAL_ACCOUNT_TYPE', record.type) }}
 | 
				
			||||||
| 
						 | 
					@ -99,20 +104,11 @@
 | 
				
			||||||
	</a-card>
 | 
						</a-card>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script setup name="basicDataPublicAccount">
 | 
					<script setup name="publicAccount">
 | 
				
			||||||
	import officialAccountApi from '@/api/base/wx/officialAccountApi'
 | 
						import officialAccountApi from '@/api/base/wx/officialAccountApi'
 | 
				
			||||||
	import { useTableManagement } from '@/hook/useTableManagement'
 | 
						import { useTableManagement } from '@/hook/useTableManagement'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const publicAccountColumn = [
 | 
						const publicAccountColumn = [
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			title: '编码',
 | 
					 | 
				
			||||||
			dataIndex: 'number',
 | 
					 | 
				
			||||||
			sorter: (a, b) => a.address.length - b.address.length,
 | 
					 | 
				
			||||||
			sortDirections: ['descend', 'ascend'],
 | 
					 | 
				
			||||||
			align: 'center',
 | 
					 | 
				
			||||||
			resizable: true,
 | 
					 | 
				
			||||||
			width: 100
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			title: '类型',
 | 
								title: '类型',
 | 
				
			||||||
			dataIndex: 'type',
 | 
								dataIndex: 'type',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,9 +27,17 @@
 | 
				
			||||||
				/>
 | 
									/>
 | 
				
			||||||
			</a-tab-pane>
 | 
								</a-tab-pane>
 | 
				
			||||||
			<a-tab-pane key="2" tab="上游仓库系统" force-render>
 | 
								<a-tab-pane key="2" tab="上游仓库系统" force-render>
 | 
				
			||||||
<!--				<DynamicTable :initialData="data" :columns="columns" rowKey="id"></DynamicTable>-->
 | 
									<!--				<DynamicTable :initialData="data" :columns="columns" rowKey="id"></DynamicTable>-->
 | 
				
			||||||
			</a-tab-pane>
 | 
								</a-tab-pane>
 | 
				
			||||||
		</a-tabs>
 | 
							</a-tabs>
 | 
				
			||||||
 | 
							<user-selector-plus
 | 
				
			||||||
 | 
								ref="userSelectorPlusProRef"
 | 
				
			||||||
 | 
								:org-tree-api="selectorApiFunction.orgTreeApi"
 | 
				
			||||||
 | 
								:user-page-api="selectorApiFunction.userPageApi"
 | 
				
			||||||
 | 
								:checkedUserListApi="selectorApiFunction.userListByIdListApi"
 | 
				
			||||||
 | 
								@onBack="userSelectorOnBack"
 | 
				
			||||||
 | 
								:radioModel="true"
 | 
				
			||||||
 | 
							></user-selector-plus>
 | 
				
			||||||
	</a-card>
 | 
						</a-card>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -39,8 +47,44 @@
 | 
				
			||||||
	import useFormHandler from '@/hook/useFormHandler'
 | 
						import useFormHandler from '@/hook/useFormHandler'
 | 
				
			||||||
	import tool from '@/utils/tool'
 | 
						import tool from '@/utils/tool'
 | 
				
			||||||
	import { useRoute } from 'vue-router'
 | 
						import { useRoute } from 'vue-router'
 | 
				
			||||||
 | 
						import UserSelectorPlus from '@/components/Selector/userSelectorPlus.vue'
 | 
				
			||||||
 | 
						import bizOrgApi from '@/api/biz/bizOrgApi'
 | 
				
			||||||
 | 
						import userCenterApi from '@/api/sys/userCenterApi'
 | 
				
			||||||
	const route = useRoute()
 | 
						const route = useRoute()
 | 
				
			||||||
	import DynamicTable from '@/components/DynamicTable/index.vue'
 | 
						const userSelectorPlusProRef = ref(null)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// 传递设计器需要的API
 | 
				
			||||||
 | 
						const selectorApiFunction = {
 | 
				
			||||||
 | 
							orgTreeApi: (param) => {
 | 
				
			||||||
 | 
								return bizOrgApi.orgTreeSelector(param).then((data) => {
 | 
				
			||||||
 | 
									return Promise.resolve(data)
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							userPageApi: (param) => {
 | 
				
			||||||
 | 
								return bizOrgApi.orgUserSelector(param).then((data) => {
 | 
				
			||||||
 | 
									return Promise.resolve(data)
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							userListByIdListApi: (param) => {
 | 
				
			||||||
 | 
								return userCenterApi.userCenterGetUserListByIdList(param).then((data) => {
 | 
				
			||||||
 | 
									return Promise.resolve(data)
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const handleManageUser = () => {
 | 
				
			||||||
 | 
							userSelectorPlusProRef.value.showUserPlusModal([formData.manageUserId])
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const userSelectorOnBack = (data) => {
 | 
				
			||||||
 | 
							if (data.length > 0) {
 | 
				
			||||||
 | 
								formData.manageUserId = data[0].id
 | 
				
			||||||
 | 
								formData.manageUserName = data[0].name
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								formData.manageUserId = null
 | 
				
			||||||
 | 
								formData.manageUserName = null
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const formRules = {
 | 
						const formRules = {
 | 
				
			||||||
		name: [required('请输入名称')],
 | 
							name: [required('请输入名称')],
 | 
				
			||||||
| 
						 | 
					@ -119,12 +163,14 @@
 | 
				
			||||||
	const baseFormItems = [
 | 
						const baseFormItems = [
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			label: '管理员:',
 | 
								label: '管理员:',
 | 
				
			||||||
			name: 'manageUserId',
 | 
								name: 'manageUserName',
 | 
				
			||||||
			type: 'a-select',
 | 
								type: 'a-input',
 | 
				
			||||||
			span: 6,
 | 
								span: 6,
 | 
				
			||||||
			attrs: {
 | 
								attrs: {
 | 
				
			||||||
				placeholder: '请选择管理员',
 | 
									placeholder: '请选择管理员',
 | 
				
			||||||
				options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
 | 
									options: tool.dictList('OFFICIAL_ACCOUNT_TYPE'),
 | 
				
			||||||
 | 
									readonly: true,
 | 
				
			||||||
 | 
									onClick: handleManageUser
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
| 
						 | 
					@ -168,9 +214,13 @@
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	)
 | 
						)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	onMounted(() => {
 | 
						onMounted(async () => {
 | 
				
			||||||
		formRefs.value = [formRef1.value, formRef2.value]
 | 
							formRefs.value = [formRef1.value, formRef2.value]
 | 
				
			||||||
		fetchData(route.query.type)
 | 
							fetchData(route.query.type).then((res) => {
 | 
				
			||||||
 | 
								if (res) {
 | 
				
			||||||
 | 
									formData.manageUserId = res.manageUserId
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	let activeKey = ref('1')
 | 
						let activeKey = ref('1')
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,14 +2,23 @@
 | 
				
			||||||
	<a-card :bordered="false">
 | 
						<a-card :bordered="false">
 | 
				
			||||||
		<a-form ref="searchFormRef" name="advanced_search" :model="searchFormState" class="ant-advanced-search-form">
 | 
							<a-form ref="searchFormRef" name="advanced_search" :model="searchFormState" class="ant-advanced-search-form">
 | 
				
			||||||
			<a-row :gutter="24">
 | 
								<a-row :gutter="24">
 | 
				
			||||||
 | 
									<a-col :span="6">
 | 
				
			||||||
 | 
										<a-form-item label="编码" name="number">
 | 
				
			||||||
 | 
											<a-input v-model:value="searchFormState.number" placeholder="请输入编码" />
 | 
				
			||||||
 | 
										</a-form-item>
 | 
				
			||||||
 | 
									</a-col>
 | 
				
			||||||
				<a-col :span="6">
 | 
									<a-col :span="6">
 | 
				
			||||||
					<a-form-item label="名称" name="name">
 | 
										<a-form-item label="名称" name="name">
 | 
				
			||||||
						<a-input v-model:value="searchFormState.name" placeholder="请输入名称" />
 | 
											<a-input v-model:value="searchFormState.name" placeholder="请输入名称" />
 | 
				
			||||||
					</a-form-item>
 | 
										</a-form-item>
 | 
				
			||||||
				</a-col>
 | 
									</a-col>
 | 
				
			||||||
				<a-col :span="6">
 | 
									<a-col :span="6">
 | 
				
			||||||
					<a-form-item label="类型" name="type">
 | 
										<a-form-item label="可用状态" name="enabledState">
 | 
				
			||||||
						<a-input v-model:value="searchFormState.type" placeholder="请输入类型" />
 | 
											<a-select
 | 
				
			||||||
 | 
												v-model:value="searchFormState.enabledState"
 | 
				
			||||||
 | 
												placeholder="请选择可用状态"
 | 
				
			||||||
 | 
												:options="$TOOL.dictList('COMMON_STATUS')"
 | 
				
			||||||
 | 
											/>
 | 
				
			||||||
					</a-form-item>
 | 
										</a-form-item>
 | 
				
			||||||
				</a-col>
 | 
									</a-col>
 | 
				
			||||||
				<a-col :span="6">
 | 
									<a-col :span="6">
 | 
				
			||||||
| 
						 | 
					@ -54,13 +63,14 @@
 | 
				
			||||||
			</template>
 | 
								</template>
 | 
				
			||||||
			<template #bodyCell="{ column, record }">
 | 
								<template #bodyCell="{ column, record }">
 | 
				
			||||||
				<template v-if="column.dataIndex === 'enabledState'">
 | 
									<template v-if="column.dataIndex === 'enabledState'">
 | 
				
			||||||
					<a-switch
 | 
										<!--					<a-switch
 | 
				
			||||||
						checkedValue="ENABLE"
 | 
											checkedValue="ENABLE"
 | 
				
			||||||
						unCheckedValue="DISABLED"
 | 
											unCheckedValue="DISABLED"
 | 
				
			||||||
						checked-children="启用"
 | 
											checked-children="启用"
 | 
				
			||||||
						un-checked-children="停用"
 | 
											un-checked-children="停用"
 | 
				
			||||||
						v-model:checked="record.enabledState"
 | 
											v-model:checked="record.enabledState"
 | 
				
			||||||
					/>
 | 
										/>-->
 | 
				
			||||||
 | 
										{{ $TOOL.dictTypeData('COMMON_STATUS', record.enabledState) }}
 | 
				
			||||||
				</template>
 | 
									</template>
 | 
				
			||||||
				<template v-if="column.dataIndex === 'action'">
 | 
									<template v-if="column.dataIndex === 'action'">
 | 
				
			||||||
					<a-space>
 | 
										<a-space>
 | 
				
			||||||
| 
						 | 
					@ -96,7 +106,7 @@
 | 
				
			||||||
	</a-card>
 | 
						</a-card>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script setup name="officialaccount">
 | 
					<script setup name="stash">
 | 
				
			||||||
	import sysStoreApi from '@/api/base/store/sysStoreApi'
 | 
						import sysStoreApi from '@/api/base/store/sysStoreApi'
 | 
				
			||||||
	import { useTableManagement } from '@/hook/useTableManagement'
 | 
						import { useTableManagement } from '@/hook/useTableManagement'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
<template>
 | 
					<template>
 | 
				
			||||||
	<xn-form-container
 | 
						<xn-form-container
 | 
				
			||||||
		:title="formData.id ? '编辑生产组织' : '增加生产组织'"
 | 
							:title="pageType === 'EDIT' ? '编辑生产组织' : pageType === 'ADD' ? '增加生产组织' : '查看生产组织'"
 | 
				
			||||||
		:width="700"
 | 
							:width="700"
 | 
				
			||||||
		:visible="visible"
 | 
							:visible="visible"
 | 
				
			||||||
		:destroy-on-close="true"
 | 
							:destroy-on-close="true"
 | 
				
			||||||
| 
						 | 
					@ -10,12 +10,18 @@
 | 
				
			||||||
			<a-row :gutter="16">
 | 
								<a-row :gutter="16">
 | 
				
			||||||
				<a-col :span="24">
 | 
									<a-col :span="24">
 | 
				
			||||||
					<a-form-item label="编码:" name="number">
 | 
										<a-form-item label="编码:" name="number">
 | 
				
			||||||
						<a-input v-model:value="formData.number" placeholder="请输入编码" allow-clear />
 | 
											<a-input
 | 
				
			||||||
 | 
												:disabled="pageType === 'SEARCH'"
 | 
				
			||||||
 | 
												v-model:value="formData.number"
 | 
				
			||||||
 | 
												placeholder="请输入编码"
 | 
				
			||||||
 | 
												allow-clear
 | 
				
			||||||
 | 
											/>
 | 
				
			||||||
					</a-form-item>
 | 
										</a-form-item>
 | 
				
			||||||
				</a-col>
 | 
									</a-col>
 | 
				
			||||||
				<a-col :span="24">
 | 
									<a-col :span="24">
 | 
				
			||||||
					<a-form-item label="类型:" name="type">
 | 
										<a-form-item label="类型:" name="type">
 | 
				
			||||||
						<a-select
 | 
											<a-select
 | 
				
			||||||
 | 
												:disabled="pageType !== 'ADD'"
 | 
				
			||||||
							v-model:value="formData.type"
 | 
												v-model:value="formData.type"
 | 
				
			||||||
							placeholder="请选择组织类型"
 | 
												placeholder="请选择组织类型"
 | 
				
			||||||
							:options="typeOptions"
 | 
												:options="typeOptions"
 | 
				
			||||||
| 
						 | 
					@ -24,12 +30,18 @@
 | 
				
			||||||
				</a-col>
 | 
									</a-col>
 | 
				
			||||||
				<a-col :span="24">
 | 
									<a-col :span="24">
 | 
				
			||||||
					<a-form-item label="工厂名称:" name="name">
 | 
										<a-form-item label="工厂名称:" name="name">
 | 
				
			||||||
						<a-input v-model:value="formData.name" placeholder="请输入工厂名称" allow-clear />
 | 
											<a-input
 | 
				
			||||||
 | 
												:disabled="pageType === 'SEARCH'"
 | 
				
			||||||
 | 
												v-model:value="formData.name"
 | 
				
			||||||
 | 
												placeholder="请输入工厂名称"
 | 
				
			||||||
 | 
												allow-clear
 | 
				
			||||||
 | 
											/>
 | 
				
			||||||
					</a-form-item>
 | 
										</a-form-item>
 | 
				
			||||||
				</a-col>
 | 
									</a-col>
 | 
				
			||||||
				<a-col :span="24">
 | 
									<a-col :span="24">
 | 
				
			||||||
					<a-form-item label="仓库:" name="storeId">
 | 
										<a-form-item label="仓库:" name="storeId">
 | 
				
			||||||
						<a-tree-select
 | 
											<a-tree-select
 | 
				
			||||||
 | 
												:disabled="pageType === 'SEARCH'"
 | 
				
			||||||
							v-model:value="formData.storeId"
 | 
												v-model:value="formData.storeId"
 | 
				
			||||||
							style="width: 100%"
 | 
												style="width: 100%"
 | 
				
			||||||
							:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
 | 
												:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
 | 
				
			||||||
| 
						 | 
					@ -45,13 +57,14 @@
 | 
				
			||||||
					</a-form-item>
 | 
										</a-form-item>
 | 
				
			||||||
				</a-col>
 | 
									</a-col>
 | 
				
			||||||
				<a-col :span="24">
 | 
									<a-col :span="24">
 | 
				
			||||||
					<a-form-item label="上级仓库:" name="parentId" v-if="formData.type !== 'FACTORY'">
 | 
										<a-form-item label="上级组织:" name="parentId" v-if="formData.type !== 'FACTORY'">
 | 
				
			||||||
						<a-tree-select
 | 
											<a-tree-select
 | 
				
			||||||
 | 
												:disabled="pageType === 'SEARCH'"
 | 
				
			||||||
							v-model:value="formData.parentId"
 | 
												v-model:value="formData.parentId"
 | 
				
			||||||
							style="width: 100%"
 | 
												style="width: 100%"
 | 
				
			||||||
							:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
 | 
												:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
 | 
				
			||||||
							:tree-data="parentTreeData"
 | 
												:tree-data="parentTreeData"
 | 
				
			||||||
							placeholder="请选择上级仓库"
 | 
												placeholder="请选择上级组织"
 | 
				
			||||||
							:fieldNames="{
 | 
												:fieldNames="{
 | 
				
			||||||
								children: 'children',
 | 
													children: 'children',
 | 
				
			||||||
								label: 'name',
 | 
													label: 'name',
 | 
				
			||||||
| 
						 | 
					@ -63,12 +76,18 @@
 | 
				
			||||||
				</a-col>
 | 
									</a-col>
 | 
				
			||||||
				<a-col :span="24">
 | 
									<a-col :span="24">
 | 
				
			||||||
					<a-form-item label="厂家名称:" name="manufacturer" v-if="formData.type === 'FACTORY'">
 | 
										<a-form-item label="厂家名称:" name="manufacturer" v-if="formData.type === 'FACTORY'">
 | 
				
			||||||
						<a-input v-model:value="formData.manufacturer" placeholder="请输入仓库id" allow-clear />
 | 
											<a-input
 | 
				
			||||||
 | 
												:disabled="pageType === 'SEARCH'"
 | 
				
			||||||
 | 
												v-model:value="formData.manufacturer"
 | 
				
			||||||
 | 
												placeholder="请输入厂家名称"
 | 
				
			||||||
 | 
												allow-clear
 | 
				
			||||||
 | 
											/>
 | 
				
			||||||
					</a-form-item>
 | 
										</a-form-item>
 | 
				
			||||||
				</a-col>
 | 
									</a-col>
 | 
				
			||||||
				<a-col :span="24">
 | 
									<a-col :span="24">
 | 
				
			||||||
					<a-form-item label="启用状态:" name="enabledState">
 | 
										<a-form-item label="启用状态:" name="enabledState">
 | 
				
			||||||
						<a-select
 | 
											<a-select
 | 
				
			||||||
 | 
												:disabled="pageType === 'SEARCH'"
 | 
				
			||||||
							v-model:value="formData.enabledState"
 | 
												v-model:value="formData.enabledState"
 | 
				
			||||||
							placeholder="请选择启用状态"
 | 
												placeholder="请选择启用状态"
 | 
				
			||||||
							:options="enabledStateOptions"
 | 
												:options="enabledStateOptions"
 | 
				
			||||||
| 
						 | 
					@ -79,7 +98,7 @@
 | 
				
			||||||
		</a-form>
 | 
							</a-form>
 | 
				
			||||||
		<template #footer>
 | 
							<template #footer>
 | 
				
			||||||
			<a-button style="margin-right: 8px" @click="onClose">关闭</a-button>
 | 
								<a-button style="margin-right: 8px" @click="onClose">关闭</a-button>
 | 
				
			||||||
			<a-button type="primary" @click="onSubmit" :loading="submitLoading">保存</a-button>
 | 
								<a-button v-if="pageType !== 'SEARCH'" type="primary" @click="onSubmit" :loading="submitLoading">保存</a-button>
 | 
				
			||||||
		</template>
 | 
							</template>
 | 
				
			||||||
	</xn-form-container>
 | 
						</xn-form-container>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
| 
						 | 
					@ -95,21 +114,28 @@
 | 
				
			||||||
	const emit = defineEmits({ successful: null })
 | 
						const emit = defineEmits({ successful: null })
 | 
				
			||||||
	const formRef = ref()
 | 
						const formRef = ref()
 | 
				
			||||||
	// 表单数据
 | 
						// 表单数据
 | 
				
			||||||
	const formData = ref({
 | 
						let formData_enum = {
 | 
				
			||||||
		type: 'FACTORY',
 | 
							type: 'FACTORY',
 | 
				
			||||||
		enabledState: 'ENABLE'
 | 
							enabledState: 'ENABLE'
 | 
				
			||||||
	})
 | 
						}
 | 
				
			||||||
 | 
						const formData = ref({})
 | 
				
			||||||
	const submitLoading = ref(false)
 | 
						const submitLoading = ref(false)
 | 
				
			||||||
	const typeOptions = ref([])
 | 
						const typeOptions = ref([])
 | 
				
			||||||
	const enabledStateOptions = ref([])
 | 
						const enabledStateOptions = ref([])
 | 
				
			||||||
 | 
						let pageType = ref('ADD')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 打开抽屉
 | 
						// 打开抽屉
 | 
				
			||||||
	const onOpen = (record) => {
 | 
						const onOpen = (record) => {
 | 
				
			||||||
		visible.value = true
 | 
							visible.value = true
 | 
				
			||||||
		if (record) {
 | 
							if (record) {
 | 
				
			||||||
 | 
								pageType.value = record.pageType
 | 
				
			||||||
			let recordData = cloneDeep(record)
 | 
								let recordData = cloneDeep(record)
 | 
				
			||||||
			formData.value = Object.assign({}, recordData)
 | 
								formData.value = Object.assign({}, recordData)
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								pageType.value = 'ADD'
 | 
				
			||||||
 | 
								formData.value = formData_enum
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		typeOptions.value = tool.dictList('PRODUCTION_ORGANIZATION_TYPE')
 | 
							typeOptions.value = tool.dictList('PRODUCTION_ORGANIZATION_TYPE')
 | 
				
			||||||
		enabledStateOptions.value = tool.dictList('COMMON_STATUS')
 | 
							enabledStateOptions.value = tool.dictList('COMMON_STATUS')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -124,14 +150,13 @@
 | 
				
			||||||
	// 关闭抽屉
 | 
						// 关闭抽屉
 | 
				
			||||||
	const onClose = () => {
 | 
						const onClose = () => {
 | 
				
			||||||
		formRef.value.resetFields()
 | 
							formRef.value.resetFields()
 | 
				
			||||||
		formData.value = {}
 | 
					 | 
				
			||||||
		visible.value = false
 | 
							visible.value = false
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// 默认要校验的
 | 
						// 默认要校验的refresh
 | 
				
			||||||
	const formRules = {
 | 
						const formRules = {
 | 
				
			||||||
		name: [required('请输入名称')],
 | 
							name: [required('请输入名称')],
 | 
				
			||||||
		type: [required('请输入类型')],
 | 
							type: [required('请输入类型')],
 | 
				
			||||||
		parentId: [required('请选择上级仓库')],
 | 
							parentId: [required('请选择上级仓库')]
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// 验证并提交数据
 | 
						// 验证并提交数据
 | 
				
			||||||
	const onSubmit = () => {
 | 
						const onSubmit = () => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,14 +7,36 @@
 | 
				
			||||||
						<a-input v-model:value="searchFormState.name" placeholder="请输入名称" />
 | 
											<a-input v-model:value="searchFormState.name" placeholder="请输入名称" />
 | 
				
			||||||
					</a-form-item>
 | 
										</a-form-item>
 | 
				
			||||||
				</a-col>
 | 
									</a-col>
 | 
				
			||||||
 | 
									<a-col :span="6">
 | 
				
			||||||
 | 
										<a-form-item label="编码" name="number">
 | 
				
			||||||
 | 
											<a-input v-model:value="searchFormState.number" placeholder="请输入类型" />
 | 
				
			||||||
 | 
										</a-form-item>
 | 
				
			||||||
 | 
									</a-col>
 | 
				
			||||||
				<a-col :span="6">
 | 
									<a-col :span="6">
 | 
				
			||||||
					<a-form-item label="类型" name="type">
 | 
										<a-form-item label="类型" name="type">
 | 
				
			||||||
						<a-input v-model:value="searchFormState.type" placeholder="请输入类型" />
 | 
											<a-select
 | 
				
			||||||
 | 
												v-model:value="searchFormState.type"
 | 
				
			||||||
 | 
												placeholder="请选择组织类型"
 | 
				
			||||||
 | 
												:options="tool.dictList('PRODUCTION_ORGANIZATION_TYPE')"
 | 
				
			||||||
 | 
											/>
 | 
				
			||||||
 | 
										</a-form-item>
 | 
				
			||||||
 | 
									</a-col>
 | 
				
			||||||
 | 
									<a-col :span="6" v-show="advanced">
 | 
				
			||||||
 | 
										<a-form-item label="可用状态" name="type">
 | 
				
			||||||
 | 
											<a-select
 | 
				
			||||||
 | 
												v-model:value="searchFormState.enabledState"
 | 
				
			||||||
 | 
												placeholder="请选择可用状态"
 | 
				
			||||||
 | 
												:options="tool.dictList('COMMON_STATUS')"
 | 
				
			||||||
 | 
											/>
 | 
				
			||||||
					</a-form-item>
 | 
										</a-form-item>
 | 
				
			||||||
				</a-col>
 | 
									</a-col>
 | 
				
			||||||
				<a-col :span="6">
 | 
									<a-col :span="6">
 | 
				
			||||||
					<a-button type="primary" @click="tableRef.refresh()">查询</a-button>
 | 
										<a-button type="primary" @click="tableRef.refresh()">查询</a-button>
 | 
				
			||||||
					<a-button style="margin: 0 8px" @click="reset">重置</a-button>
 | 
										<a-button style="margin: 0 8px" @click="reset">重置</a-button>
 | 
				
			||||||
 | 
										<a @click="toggleAdvanced" style="margin-left: 8px">
 | 
				
			||||||
 | 
											{{ advanced ? '收起' : '展开' }}
 | 
				
			||||||
 | 
											<component :is="advanced ? 'up-outlined' : 'down-outlined'" />
 | 
				
			||||||
 | 
										</a>
 | 
				
			||||||
				</a-col>
 | 
									</a-col>
 | 
				
			||||||
			</a-row>
 | 
								</a-row>
 | 
				
			||||||
		</a-form>
 | 
							</a-form>
 | 
				
			||||||
| 
						 | 
					@ -33,6 +55,7 @@
 | 
				
			||||||
						key: 'id'
 | 
											key: 'id'
 | 
				
			||||||
					}"
 | 
										}"
 | 
				
			||||||
					:tree-data="treeData"
 | 
										:tree-data="treeData"
 | 
				
			||||||
 | 
										@select="handleSelectTree"
 | 
				
			||||||
				></a-directory-tree>
 | 
									></a-directory-tree>
 | 
				
			||||||
			</a-col>
 | 
								</a-col>
 | 
				
			||||||
			<a-col :span="20">
 | 
								<a-col :span="20">
 | 
				
			||||||
| 
						 | 
					@ -61,33 +84,31 @@
 | 
				
			||||||
					</template>
 | 
										</template>
 | 
				
			||||||
					<template #bodyCell="{ column, record }">
 | 
										<template #bodyCell="{ column, record }">
 | 
				
			||||||
						<template v-if="column.dataIndex === 'enabledState'">
 | 
											<template v-if="column.dataIndex === 'enabledState'">
 | 
				
			||||||
							<a-switch
 | 
												<!--							<a-switch
 | 
				
			||||||
								checkedValue="ENABLE"
 | 
													checkedValue="ENABLE"
 | 
				
			||||||
								unCheckedValue="DISABLED"
 | 
													unCheckedValue="DISABLED"
 | 
				
			||||||
								checked-children="启用"
 | 
													checked-children="启用"
 | 
				
			||||||
								un-checked-children="停用"
 | 
													un-checked-children="停用"
 | 
				
			||||||
								v-model:checked="record.enabledState"
 | 
													v-model:checked="record.enabledState"
 | 
				
			||||||
							/>
 | 
												/>-->
 | 
				
			||||||
 | 
												{{ $TOOL.dictTypeData('COMMON_STATUS', record.enabledState) }}
 | 
				
			||||||
						</template>
 | 
											</template>
 | 
				
			||||||
						<template v-if="column.dataIndex === 'type'">
 | 
											<template v-if="column.dataIndex === 'type'">
 | 
				
			||||||
							{{ $TOOL.dictTypeData('PRODUCTION_ORGANIZATION_TYPE', record.type) }}
 | 
												{{ $TOOL.dictTypeData('PRODUCTION_ORGANIZATION_TYPE', record.type) }}
 | 
				
			||||||
						</template>
 | 
											</template>
 | 
				
			||||||
						<template v-if="column.dataIndex === 'action'">
 | 
											<template v-if="column.dataIndex === 'action'">
 | 
				
			||||||
							<a-space>
 | 
												<a-space>
 | 
				
			||||||
								<a @click="TissueFormRef.onOpen()" v-if="hasPerm('officialAccountEdit')">查看</a>
 | 
					 | 
				
			||||||
								<a-divider type="vertical" v-if="hasPerm(['officialAccountEdit', 'officialAccountDelete'], 'and')" />
 | 
					 | 
				
			||||||
								<a
 | 
													<a
 | 
				
			||||||
									@click="
 | 
														@click="TissueFormRef.onOpen({ ...record, pageType: 'SEARCH' })"
 | 
				
			||||||
										navigateTo('/basicData/publicAccount/detail', {
 | 
					 | 
				
			||||||
											type: 'EDIT',
 | 
					 | 
				
			||||||
											id: record.id
 | 
					 | 
				
			||||||
										})
 | 
					 | 
				
			||||||
									"
 | 
					 | 
				
			||||||
									v-if="hasPerm('officialAccountEdit')"
 | 
														v-if="hasPerm('officialAccountEdit')"
 | 
				
			||||||
 | 
														>查看</a
 | 
				
			||||||
 | 
													>
 | 
				
			||||||
 | 
													<a-divider type="vertical" v-if="hasPerm(['officialAccountEdit', 'officialAccountDelete'], 'and')" />
 | 
				
			||||||
 | 
													<a @click="TissueFormRef.onOpen({ ...record, pageType: 'EDIT' })" v-if="hasPerm('officialAccountEdit')"
 | 
				
			||||||
									>编辑</a
 | 
														>编辑</a
 | 
				
			||||||
								>
 | 
													>
 | 
				
			||||||
								<a-divider type="vertical" v-if="hasPerm(['officialAccountEdit', 'officialAccountDelete'], 'and')" />
 | 
													<a-divider type="vertical" v-if="hasPerm(['officialAccountEdit', 'officialAccountDelete'], 'and')" />
 | 
				
			||||||
								<a-popconfirm title="确定要删除吗?" @confirm="deleteRecord(record)">
 | 
													<a-popconfirm title="确定要删除吗?" @confirm="deleteRecordRestTRee(record)">
 | 
				
			||||||
									<a-button type="link" danger size="small" v-if="hasPerm('officialAccountDelete')">删除</a-button>
 | 
														<a-button type="link" danger size="small" v-if="hasPerm('officialAccountDelete')">删除</a-button>
 | 
				
			||||||
								</a-popconfirm>
 | 
													</a-popconfirm>
 | 
				
			||||||
							</a-space>
 | 
												</a-space>
 | 
				
			||||||
| 
						 | 
					@ -98,13 +119,14 @@
 | 
				
			||||||
		</a-row>
 | 
							</a-row>
 | 
				
			||||||
	</a-card>
 | 
						</a-card>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	<TissueForm ref="TissueFormRef"></TissueForm>
 | 
						<TissueForm ref="TissueFormRef" @successful="successful"></TissueForm>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script setup name="basicDataPublicAccount">
 | 
					<script setup name="basicDataPublicAccount">
 | 
				
			||||||
	import productionOrganizationApi from '@/api/base/production-organization/productionOrganizationApi'
 | 
						import productionOrganizationApi from '@/api/base/production-organization/productionOrganizationApi'
 | 
				
			||||||
	import { useTableManagement } from '@/hook/useTableManagement'
 | 
						import { useTableManagement } from '@/hook/useTableManagement'
 | 
				
			||||||
	import TissueForm from '@/views/basicData/tissue/detail/TissueForm.vue'
 | 
						import TissueForm from '@/views/basicData/tissue/detail/TissueForm.vue'
 | 
				
			||||||
 | 
						import tool from '@/utils/tool'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const publicAccountColumn = [
 | 
						const publicAccountColumn = [
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
| 
						 | 
					@ -162,7 +184,9 @@
 | 
				
			||||||
		options,
 | 
							options,
 | 
				
			||||||
		searchFormRef,
 | 
							searchFormRef,
 | 
				
			||||||
		toolConfig,
 | 
							toolConfig,
 | 
				
			||||||
		navigateTo
 | 
							navigateTo,
 | 
				
			||||||
 | 
							toggleAdvanced,
 | 
				
			||||||
 | 
							advanced
 | 
				
			||||||
	} = useTableManagement(
 | 
						} = useTableManagement(
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			page: productionOrganizationApi.productionOrganizationPage,
 | 
								page: productionOrganizationApi.productionOrganizationPage,
 | 
				
			||||||
| 
						 | 
					@ -180,9 +204,29 @@
 | 
				
			||||||
	let treeData = ref([])
 | 
						let treeData = ref([])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	onMounted(() => {
 | 
						onMounted(() => {
 | 
				
			||||||
		productionOrganizationApi.productionOrganizationTree().then((res) => {
 | 
							getProductionOrganizationTree()
 | 
				
			||||||
			console.log(res)
 | 
					 | 
				
			||||||
			treeData.value = res
 | 
					 | 
				
			||||||
		})
 | 
					 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const successful = () => {
 | 
				
			||||||
 | 
							tableRef.value.refresh()
 | 
				
			||||||
 | 
							selectedKeys.value = []
 | 
				
			||||||
 | 
							getProductionOrganizationTree()
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const getProductionOrganizationTree = () => {
 | 
				
			||||||
 | 
							productionOrganizationApi.productionOrganizationTree().then((res) => {
 | 
				
			||||||
 | 
								treeData.value = res || []
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const deleteRecordRestTRee = (record) => {
 | 
				
			||||||
 | 
							deleteRecord(record).then(() => {
 | 
				
			||||||
 | 
								getProductionOrganizationTree()
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const handleSelectTree = (value) => {
 | 
				
			||||||
 | 
							searchFormState.value.parentId = value[0]
 | 
				
			||||||
 | 
							tableRef.value.refresh()
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue