基础资料模块
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) {
|
||||
return request('detail', data, 'get')
|
||||
}
|
||||
},
|
||||
// 获取单位列表
|
||||
sysUnitList(data) {
|
||||
return request(`groupList`, data, 'get')
|
||||
},
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<a-row :gutter="16">
|
||||
<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">
|
||||
<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-col>
|
||||
</a-row>
|
||||
|
|
|
@ -186,6 +186,7 @@
|
|||
if (dataIsConverterFlw) {
|
||||
ids = goDataConverter(ids)
|
||||
}
|
||||
console.log(ids, 'ids')
|
||||
recordIds.value = ids
|
||||
// 加载机构树
|
||||
if (props.orgTreeApi) {
|
||||
|
@ -213,12 +214,14 @@
|
|||
searchFormState.value.size = pageSize.value
|
||||
loadData()
|
||||
if (props.checkedUserListApi) {
|
||||
console.log(recordIds.value)
|
||||
if (isEmpty(recordIds.value)) {
|
||||
return
|
||||
}
|
||||
const param = {
|
||||
idList: recordIds.value
|
||||
}
|
||||
|
||||
selectedTableListLoading.value = true
|
||||
props
|
||||
.checkedUserListApi(param)
|
||||
|
|
|
@ -41,9 +41,9 @@
|
|||
<a-tooltip v-if="item.name === 'delete' && props.toolConfig.delete" :title="item.title" class="s-tool-item">
|
||||
<a-popconfirm
|
||||
v-if="item.name === 'delete' && props.toolConfig.delete"
|
||||
title="确认删除?"
|
||||
ok-text="Yes"
|
||||
cancel-text="No"
|
||||
title="确定要删除吗?"
|
||||
ok-text="确认"
|
||||
cancel-text="取消"
|
||||
@confirm="
|
||||
() => {
|
||||
emit('deleteRowData')
|
||||
|
|
|
@ -15,7 +15,7 @@ export default function useFormHandler(formItems, api) {
|
|||
|
||||
const initializeFormData = (formItems, formData) => {
|
||||
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) {
|
||||
const searchFormState = ref({})
|
||||
const searchFormRef = ref({})
|
||||
const searchFormRef = ref(null)
|
||||
const tableRef = ref(null)
|
||||
const selectedRowKeys = ref([])
|
||||
const router = useRouter()
|
||||
let advanced = ref(false)
|
||||
|
||||
// 动态列配置
|
||||
const columns = ref(tableColumns)
|
||||
|
@ -47,7 +48,7 @@ export function useTableManagement(apiModule = {}, tableColumns, hasPermData) {
|
|||
// 重置
|
||||
const reset = () => {
|
||||
if (tableRef.value) {
|
||||
tableRef.value.resetFields()
|
||||
searchFormRef.value.resetFields()
|
||||
tableRef.value.refresh(true)
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +56,7 @@ export function useTableManagement(apiModule = {}, tableColumns, hasPermData) {
|
|||
// 删除
|
||||
const deleteRecord = (record) => {
|
||||
let params = [{ id: record.id }]
|
||||
apiModule.delete(params).then(() => {
|
||||
return apiModule.delete(params).then(() => {
|
||||
if (tableRef.value) {
|
||||
tableRef.value.refresh(true)
|
||||
}
|
||||
|
@ -94,6 +95,10 @@ export function useTableManagement(apiModule = {}, tableColumns, hasPermData) {
|
|||
})
|
||||
}
|
||||
|
||||
const toggleAdvanced = () => {
|
||||
advanced.value = !advanced.value
|
||||
}
|
||||
|
||||
// 返回Hook的值
|
||||
return {
|
||||
searchFormState,
|
||||
|
@ -107,6 +112,8 @@ export function useTableManagement(apiModule = {}, tableColumns, hasPermData) {
|
|||
deleteBatchRecords,
|
||||
options,
|
||||
toolConfig,
|
||||
navigateTo
|
||||
navigateTo,
|
||||
toggleAdvanced,
|
||||
advanced
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,14 +2,23 @@
|
|||
<a-card :bordered="false">
|
||||
<a-form ref="searchFormRef" name="advanced_search" :model="searchFormState" class="ant-advanced-search-form">
|
||||
<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-form-item label="名称" name="name">
|
||||
<a-input v-model:value="searchFormState.name" placeholder="请输入名称" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-form-item label="类型" name="type">
|
||||
<a-input v-model:value="searchFormState.type" placeholder="请输入类型" />
|
||||
<a-form-item label="可用状态" name="enabledState">
|
||||
<a-select
|
||||
v-model:value="searchFormState.enabledState"
|
||||
placeholder="请选择可用状态"
|
||||
:options="$TOOL.dictList('COMMON_STATUS')"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
|
@ -54,13 +63,14 @@
|
|||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.dataIndex === 'enabledState'">
|
||||
<a-switch
|
||||
<!-- <a-switch
|
||||
checkedValue="ENABLE"
|
||||
unCheckedValue="DISABLED"
|
||||
checked-children="启用"
|
||||
un-checked-children="停用"
|
||||
v-model:checked="record.enabledState"
|
||||
/>
|
||||
/>-->
|
||||
{{ $TOOL.dictTypeData('COMMON_STATUS', record.enabledState) }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
<a-space>
|
||||
|
@ -96,7 +106,7 @@
|
|||
</a-card>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
<script setup name="brand">
|
||||
import sysBrandApi from '@/api/base/brand/sysBrandApi'
|
||||
import { useTableManagement } from '@/hook/useTableManagement'
|
||||
|
||||
|
|
|
@ -265,7 +265,9 @@
|
|||
onMounted(async () => {
|
||||
formRefs.value = [formRef1.value, formRef2.value]
|
||||
fetchData(route.query.type).then((res) => {
|
||||
if (res) {
|
||||
formData.provinceName = [res.province, res.city, res.county]
|
||||
}
|
||||
})
|
||||
|
||||
// 选择品牌
|
||||
|
|
|
@ -8,8 +8,17 @@
|
|||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-form-item label="类型" name="type">
|
||||
<a-input v-model:value="searchFormState.type" placeholder="请输入类型" />
|
||||
<a-form-item label="编码" name="number">
|
||||
<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-col>
|
||||
<a-col :span="6">
|
||||
|
@ -37,13 +46,13 @@
|
|||
<component class="icons" :is="item.icon"></component>
|
||||
</a-tooltip>
|
||||
<!-- 删除 -->
|
||||
<a-tooltip :title="item.title" class="s-tool-item" v-if="item.name === 'delete'" @click="handleDelTree">
|
||||
<a-popconfirm title="确认删除?" ok-text="Yes" cancel-text="No">
|
||||
<a-tooltip :title="item.title" class="s-tool-item" v-if="item.name === 'delete'">
|
||||
<a-popconfirm title="确定要删除吗?" ok-text="确认" cancel-text="取消" @confirm="handleDelTree">
|
||||
<component class="icons" :is="item.icon"></component>
|
||||
</a-popconfirm>
|
||||
</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>
|
||||
</a-tooltip>-->
|
||||
</span>
|
||||
|
@ -55,7 +64,6 @@
|
|||
v-model:selectedKeys="selectedKeys"
|
||||
multiple
|
||||
:tree-data="treeData"
|
||||
:selectedKeys="treeSelectedKeys"
|
||||
:fieldNames="{
|
||||
children: 'children',
|
||||
title: 'name',
|
||||
|
@ -98,16 +106,14 @@
|
|||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.dataIndex === 'enabledState'">
|
||||
<a-switch
|
||||
<!-- <a-switch
|
||||
checkedValue="ENABLE"
|
||||
unCheckedValue="DISABLED"
|
||||
checked-children="启用"
|
||||
un-checked-children="停用"
|
||||
v-model:checked="record.enabledState"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'type'">
|
||||
{{ $TOOL.dictTypeData('OFFICIAL_ACCOUNT_TYPE', record.type) }}
|
||||
/>-->
|
||||
{{ $TOOL.dictTypeData('COMMON_STATUS', record.enabledState) }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
<a-space>
|
||||
|
@ -146,7 +152,7 @@
|
|||
</a-card>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
<script setup name="client">
|
||||
import customerApi from '@/api/base/customer/customerApi'
|
||||
import customerCategoryApi from '@/api/base/customer/customerCategoryApi'
|
||||
import { useTableManagement } from '@/hook/useTableManagement'
|
||||
|
@ -172,7 +178,7 @@
|
|||
},
|
||||
{
|
||||
title: '分类',
|
||||
dataIndex: 'type',
|
||||
dataIndex: 'categoryName',
|
||||
sorter: (a, b) => a.address.length - b.address.length,
|
||||
sortDirections: ['descend', 'ascend'],
|
||||
align: 'center',
|
||||
|
@ -248,13 +254,11 @@
|
|||
const treeData = ref([])
|
||||
const CustomerCategoryFormRef = ref(null)
|
||||
let treeRow = {}
|
||||
let treeSelectedKeys = ref([])
|
||||
|
||||
const handleTreeClick = (selectedKeys, event) => {
|
||||
treeRow = event.node
|
||||
tableRef.value.refresh()
|
||||
searchFormState.value.categoryId = selectedKeys[0]
|
||||
treeSelectedKeys.value = selectedKeys
|
||||
tableRef.value.refresh()
|
||||
}
|
||||
|
||||
const handleAddTree = () => {
|
||||
|
@ -267,9 +271,9 @@
|
|||
}
|
||||
|
||||
const handleDelTree = () => {
|
||||
if (!treeRow.id) return message.error('!请选择要编辑的数据')
|
||||
if (!treeRow.id) return message.error('!请选择要删除的数据')
|
||||
customerCategoryApi.customerCategoryDelete([{ id: treeRow.id }]).then((res) => {
|
||||
treeSelectedKeys.value = []
|
||||
selectedKeys.value = []
|
||||
searchFormState.value.categoryId = null
|
||||
treeRow = {}
|
||||
tableRef.value.refresh()
|
||||
|
@ -281,7 +285,7 @@
|
|||
}
|
||||
|
||||
const successful = () => {
|
||||
treeSelectedKeys.value = []
|
||||
selectedKeys.value = []
|
||||
searchFormState.value.categoryId = null
|
||||
treeRow = {}
|
||||
tableRef.value.refresh()
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<template>
|
||||
<a-page-header style="padding: 10px; font-size: 20px" @back="handleBack">
|
||||
<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>
|
||||
</a-page-header>
|
||||
|
||||
<a-card :bordered="false" title="仓库">
|
||||
<a-card :bordered="false" title="物料">
|
||||
<DynamicForm
|
||||
:allDisabled="route.query.type === 'SEARCH'"
|
||||
:formItems="officialAccountFormItems"
|
||||
:formItems="materialFormItems"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
ref="formRef1"
|
||||
|
@ -23,7 +23,7 @@
|
|||
:formItems="baseFormItems"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
ref="formRef1"
|
||||
ref="formRef2"
|
||||
/>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="2" tab="单位信息" force-render>
|
||||
|
@ -32,26 +32,260 @@
|
|||
:formItems="unitFormItems"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
ref="formRef1"
|
||||
ref="formRef3"
|
||||
/>
|
||||
</a-tab-pane>
|
||||
<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 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-tabs>
|
||||
</a-card>
|
||||
</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 officialAccountApi from '@/api/base/wx/officialAccountApi'
|
||||
import useFormHandler from '@/hook/useFormHandler'
|
||||
import tool from '@/utils/tool'
|
||||
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()
|
||||
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 = {
|
||||
name: [required('请输入名称')],
|
||||
|
@ -60,15 +294,14 @@
|
|||
secret: [required('请输入AppSecret')]
|
||||
}
|
||||
|
||||
const officialAccountFormItems = [
|
||||
const materialFormItems = [
|
||||
{
|
||||
label: '编码:',
|
||||
name: 'number',
|
||||
type: 'a-select',
|
||||
type: 'a-input',
|
||||
span: 6,
|
||||
attrs: {
|
||||
placeholder: '请选择类型',
|
||||
options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
|
||||
placeholder: '请输入编码'
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -83,11 +316,50 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
label: '仓库条码:',
|
||||
name: 'name',
|
||||
label: '简称:',
|
||||
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',
|
||||
span: 6,
|
||||
rules: [required('请输入名称')],
|
||||
attrs: {
|
||||
placeholder: '请输入名称',
|
||||
allowClear: true
|
||||
|
@ -103,18 +375,121 @@
|
|||
options: tool.dictList('COMMON_STATUS')
|
||||
},
|
||||
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: '库存管理方式:',
|
||||
name: 'name',
|
||||
label: '品牌:',
|
||||
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',
|
||||
span: 6,
|
||||
rules: [required('请输入名称')],
|
||||
attrs: {
|
||||
placeholder: '请输入名称',
|
||||
placeholder: '请输入商品条形码',
|
||||
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: '备注:',
|
||||
name: 'remarks',
|
||||
|
@ -125,222 +500,162 @@
|
|||
allowClear: true
|
||||
}
|
||||
}
|
||||
]
|
||||
])
|
||||
|
||||
const baseFormItems = [
|
||||
{
|
||||
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 = [
|
||||
const unitFormItems = reactive([
|
||||
{
|
||||
label: '单位组:',
|
||||
name: 'number',
|
||||
name: 'unitGroupId',
|
||||
type: 'a-select',
|
||||
span: 6,
|
||||
rules: [required('请选择单位组')],
|
||||
attrs: {
|
||||
placeholder: '请选择类型',
|
||||
options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
|
||||
options: [],
|
||||
fieldNames: {
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
},
|
||||
onChange: handleChangeUnitGroup
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '基本单位:',
|
||||
name: 'number',
|
||||
name: 'baseUnitId',
|
||||
type: 'a-select',
|
||||
span: 6,
|
||||
attrs: {
|
||||
placeholder: '请选择类型',
|
||||
options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
|
||||
options: [],
|
||||
disabled: true,
|
||||
fieldNames: {
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '采购单位:',
|
||||
name: 'number',
|
||||
name: 'purchaseUnitId',
|
||||
type: 'a-select',
|
||||
span: 6,
|
||||
rules: [required('请选择采购单位')],
|
||||
attrs: {
|
||||
placeholder: '请选择类型',
|
||||
options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
|
||||
options: [],
|
||||
fieldNames: {
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '分销单位:',
|
||||
name: 'remarks',
|
||||
type: 'a-textarea',
|
||||
span: 24,
|
||||
name: 'distrUnitId',
|
||||
type: 'a-select',
|
||||
span: 6,
|
||||
rules: [required('请选择分销单位')],
|
||||
attrs: {
|
||||
placeholder: '请输入备注',
|
||||
allowClear: true
|
||||
options: [],
|
||||
fieldNames: {
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
label: '生产单位:',
|
||||
name: 'remarks',
|
||||
type: 'a-textarea',
|
||||
span: 24,
|
||||
name: 'produceUnitId',
|
||||
type: 'a-select',
|
||||
span: 6,
|
||||
rules: [required('请选择生产单位')],
|
||||
attrs: {
|
||||
placeholder: '请输入备注',
|
||||
allowClear: true
|
||||
options: [],
|
||||
fieldNames: {
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '销售单位:',
|
||||
name: 'remarks',
|
||||
type: 'a-textarea',
|
||||
span: 24,
|
||||
name: 'saleUnitId',
|
||||
type: 'a-select',
|
||||
span: 6,
|
||||
rules: [required('请选择销售单位')],
|
||||
attrs: {
|
||||
placeholder: '请输入备注',
|
||||
allowClear: true
|
||||
options: [],
|
||||
fieldNames: {
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '库存单位:',
|
||||
name: 'remarks',
|
||||
type: 'a-textarea',
|
||||
span: 24,
|
||||
name: 'storeUnitId',
|
||||
type: 'a-select',
|
||||
rules: [required('请选择库存单位')],
|
||||
span: 6,
|
||||
attrs: {
|
||||
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 = [
|
||||
{
|
||||
title: '上游仓库代码',
|
||||
dataIndex: 'name',
|
||||
title: '启用',
|
||||
dataIndex: 'enabledState',
|
||||
editable: true,
|
||||
dataType: 'text' // 或 'number', 'select'
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '上游仓库名称',
|
||||
dataIndex: 'age',
|
||||
title: '条码类型编码',
|
||||
dataIndex: 'number',
|
||||
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>
|
||||
|
|
|
@ -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-col>
|
||||
<a-col :span="6">
|
||||
<a-form-item label="类型" name="type">
|
||||
<a-input v-model:value="searchFormState.type" placeholder="请输入类型" />
|
||||
<a-form-item label="编码" name="number">
|
||||
<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-col>
|
||||
<a-col :span="6">
|
||||
|
@ -33,28 +42,33 @@
|
|||
<component class="icons" :is="item.icon"></component>
|
||||
</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>
|
||||
</a-tooltip>
|
||||
<!-- 删除 -->
|
||||
<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>
|
||||
</a-popconfirm>
|
||||
</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>
|
||||
</a-tooltip>
|
||||
</a-tooltip>-->
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a-directory-tree
|
||||
v-model:expandedKeys="expandedKeys"
|
||||
v-model:selectedKeys="selectedKeys"
|
||||
multiple
|
||||
:fieldNames="{
|
||||
children: 'children',
|
||||
title: 'name',
|
||||
key: 'id'
|
||||
}"
|
||||
:tree-data="treeData"
|
||||
@select="handleTreeClick"
|
||||
></a-directory-tree>
|
||||
</a-col>
|
||||
<a-col :span="18">
|
||||
|
@ -136,12 +150,16 @@
|
|||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
<materialCategoryForm ref="materialCategoryFormRef" @successful="successful"></materialCategoryForm>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import customerApi from '@/api/base/customer/customerApi'
|
||||
import customerCategoryApi from '@/api/base/customer/customerCategoryApi'
|
||||
<script setup name="materiel">
|
||||
import materialApi from '@/api/base/material/materialApi'
|
||||
import materialCategoryApi from '@/api/base/material/materialCategoryApi'
|
||||
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 = [
|
||||
{
|
||||
|
@ -155,23 +173,56 @@
|
|||
},
|
||||
{
|
||||
title: '名称',
|
||||
dataIndex: 'type',
|
||||
align: 'center',
|
||||
resizable: true,
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '分类',
|
||||
dataIndex: 'name',
|
||||
sorter: (a, b) => a.address.length - b.address.length,
|
||||
sortDirections: ['descend', 'ascend'],
|
||||
align: 'center',
|
||||
resizable: true,
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '年龄',
|
||||
dataIndex: 'enabledState',
|
||||
title: '规格型号',
|
||||
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',
|
||||
resizable: true,
|
||||
width: 100
|
||||
|
@ -209,8 +260,8 @@
|
|||
navigateTo
|
||||
} = useTableManagement(
|
||||
{
|
||||
page: customerApi.customerPage,
|
||||
delete: customerApi.customerDelete
|
||||
page: materialApi.materialPage,
|
||||
delete: materialApi.materialDelete
|
||||
},
|
||||
materielColumn,
|
||||
['customerEdit', 'customerDelete']
|
||||
|
@ -242,16 +293,53 @@
|
|||
// 树结构
|
||||
const expandedKeys = ref(['0-0', '0-1'])
|
||||
const selectedKeys = ref([])
|
||||
const treeData = []
|
||||
const CustomerCategoryFormRef = ref(null)
|
||||
const treeData = ref([])
|
||||
const materialCategoryFormRef = ref(null)
|
||||
let treeRow = {}
|
||||
|
||||
const handleTreeClick = (selectedKeys, event) => {
|
||||
treeRow = event.node
|
||||
searchFormState.value.categoryId = selectedKeys[0]
|
||||
tableRef.value.refresh()
|
||||
}
|
||||
|
||||
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(() => {
|
||||
customerCategoryApi.customerCategoryTree().then((res) => {
|
||||
console.log(res)
|
||||
materialCategoryApi.materialCategoryTree().then((res) => {
|
||||
treeData.value = res || []
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
|
|
@ -8,8 +8,12 @@
|
|||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-form-item label="类型" name="type">
|
||||
<a-input v-model:value="searchFormState.type" placeholder="请输入类型" />
|
||||
<a-form-item label="可用状态" name="enabledState">
|
||||
<a-select
|
||||
v-model:value="searchFormState.enabledState"
|
||||
placeholder="请选择可用状态"
|
||||
:options="$TOOL.dictList('COMMON_STATUS')"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
|
@ -54,13 +58,14 @@
|
|||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.dataIndex === 'enabledState'">
|
||||
<a-switch
|
||||
<!-- <a-switch
|
||||
checkedValue="ENABLE"
|
||||
unCheckedValue="DISABLED"
|
||||
checked-children="启用"
|
||||
un-checked-children="停用"
|
||||
v-model:checked="record.enabledState"
|
||||
/>
|
||||
/>-->
|
||||
{{ $TOOL.dictTypeData('COMMON_STATUS', record.enabledState) }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'type'">
|
||||
{{ $TOOL.dictTypeData('OFFICIAL_ACCOUNT_TYPE', record.type) }}
|
||||
|
@ -99,20 +104,11 @@
|
|||
</a-card>
|
||||
</template>
|
||||
|
||||
<script setup name="basicDataPublicAccount">
|
||||
<script setup name="publicAccount">
|
||||
import officialAccountApi from '@/api/base/wx/officialAccountApi'
|
||||
import { useTableManagement } from '@/hook/useTableManagement'
|
||||
|
||||
const publicAccountColumn = [
|
||||
{
|
||||
title: '编码',
|
||||
dataIndex: 'number',
|
||||
sorter: (a, b) => a.address.length - b.address.length,
|
||||
sortDirections: ['descend', 'ascend'],
|
||||
align: 'center',
|
||||
resizable: true,
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '类型',
|
||||
dataIndex: 'type',
|
||||
|
|
|
@ -27,9 +27,17 @@
|
|||
/>
|
||||
</a-tab-pane>
|
||||
<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-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>
|
||||
</template>
|
||||
|
||||
|
@ -39,8 +47,44 @@
|
|||
import useFormHandler from '@/hook/useFormHandler'
|
||||
import tool from '@/utils/tool'
|
||||
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()
|
||||
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 = {
|
||||
name: [required('请输入名称')],
|
||||
|
@ -119,12 +163,14 @@
|
|||
const baseFormItems = [
|
||||
{
|
||||
label: '管理员:',
|
||||
name: 'manageUserId',
|
||||
type: 'a-select',
|
||||
name: 'manageUserName',
|
||||
type: 'a-input',
|
||||
span: 6,
|
||||
attrs: {
|
||||
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]
|
||||
fetchData(route.query.type)
|
||||
fetchData(route.query.type).then((res) => {
|
||||
if (res) {
|
||||
formData.manageUserId = res.manageUserId
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
let activeKey = ref('1')
|
||||
|
|
|
@ -2,14 +2,23 @@
|
|||
<a-card :bordered="false">
|
||||
<a-form ref="searchFormRef" name="advanced_search" :model="searchFormState" class="ant-advanced-search-form">
|
||||
<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-form-item label="名称" name="name">
|
||||
<a-input v-model:value="searchFormState.name" placeholder="请输入名称" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-form-item label="类型" name="type">
|
||||
<a-input v-model:value="searchFormState.type" placeholder="请输入类型" />
|
||||
<a-form-item label="可用状态" name="enabledState">
|
||||
<a-select
|
||||
v-model:value="searchFormState.enabledState"
|
||||
placeholder="请选择可用状态"
|
||||
:options="$TOOL.dictList('COMMON_STATUS')"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
|
@ -54,13 +63,14 @@
|
|||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.dataIndex === 'enabledState'">
|
||||
<a-switch
|
||||
<!-- <a-switch
|
||||
checkedValue="ENABLE"
|
||||
unCheckedValue="DISABLED"
|
||||
checked-children="启用"
|
||||
un-checked-children="停用"
|
||||
v-model:checked="record.enabledState"
|
||||
/>
|
||||
/>-->
|
||||
{{ $TOOL.dictTypeData('COMMON_STATUS', record.enabledState) }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
<a-space>
|
||||
|
@ -96,7 +106,7 @@
|
|||
</a-card>
|
||||
</template>
|
||||
|
||||
<script setup name="officialaccount">
|
||||
<script setup name="stash">
|
||||
import sysStoreApi from '@/api/base/store/sysStoreApi'
|
||||
import { useTableManagement } from '@/hook/useTableManagement'
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<xn-form-container
|
||||
:title="formData.id ? '编辑生产组织' : '增加生产组织'"
|
||||
:title="pageType === 'EDIT' ? '编辑生产组织' : pageType === 'ADD' ? '增加生产组织' : '查看生产组织'"
|
||||
:width="700"
|
||||
:visible="visible"
|
||||
:destroy-on-close="true"
|
||||
|
@ -10,12 +10,18 @@
|
|||
<a-row :gutter="16">
|
||||
<a-col :span="24">
|
||||
<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-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="类型:" name="type">
|
||||
<a-select
|
||||
:disabled="pageType !== 'ADD'"
|
||||
v-model:value="formData.type"
|
||||
placeholder="请选择组织类型"
|
||||
:options="typeOptions"
|
||||
|
@ -24,12 +30,18 @@
|
|||
</a-col>
|
||||
<a-col :span="24">
|
||||
<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-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="仓库:" name="storeId">
|
||||
<a-tree-select
|
||||
:disabled="pageType === 'SEARCH'"
|
||||
v-model:value="formData.storeId"
|
||||
style="width: 100%"
|
||||
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
||||
|
@ -45,13 +57,14 @@
|
|||
</a-form-item>
|
||||
</a-col>
|
||||
<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
|
||||
:disabled="pageType === 'SEARCH'"
|
||||
v-model:value="formData.parentId"
|
||||
style="width: 100%"
|
||||
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
||||
:tree-data="parentTreeData"
|
||||
placeholder="请选择上级仓库"
|
||||
placeholder="请选择上级组织"
|
||||
:fieldNames="{
|
||||
children: 'children',
|
||||
label: 'name',
|
||||
|
@ -63,12 +76,18 @@
|
|||
</a-col>
|
||||
<a-col :span="24">
|
||||
<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-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="启用状态:" name="enabledState">
|
||||
<a-select
|
||||
:disabled="pageType === 'SEARCH'"
|
||||
v-model:value="formData.enabledState"
|
||||
placeholder="请选择启用状态"
|
||||
:options="enabledStateOptions"
|
||||
|
@ -79,7 +98,7 @@
|
|||
</a-form>
|
||||
<template #footer>
|
||||
<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>
|
||||
</xn-form-container>
|
||||
</template>
|
||||
|
@ -95,21 +114,28 @@
|
|||
const emit = defineEmits({ successful: null })
|
||||
const formRef = ref()
|
||||
// 表单数据
|
||||
const formData = 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
|
||||
}
|
||||
|
||||
typeOptions.value = tool.dictList('PRODUCTION_ORGANIZATION_TYPE')
|
||||
enabledStateOptions.value = tool.dictList('COMMON_STATUS')
|
||||
|
||||
|
@ -124,14 +150,13 @@
|
|||
// 关闭抽屉
|
||||
const onClose = () => {
|
||||
formRef.value.resetFields()
|
||||
formData.value = {}
|
||||
visible.value = false
|
||||
}
|
||||
// 默认要校验的
|
||||
// 默认要校验的refresh
|
||||
const formRules = {
|
||||
name: [required('请输入名称')],
|
||||
type: [required('请输入类型')],
|
||||
parentId: [required('请选择上级仓库')],
|
||||
parentId: [required('请选择上级仓库')]
|
||||
}
|
||||
// 验证并提交数据
|
||||
const onSubmit = () => {
|
||||
|
|
|
@ -7,14 +7,36 @@
|
|||
<a-input v-model:value="searchFormState.name" placeholder="请输入名称" />
|
||||
</a-form-item>
|
||||
</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-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-col>
|
||||
<a-col :span="6">
|
||||
<a-button type="primary" @click="tableRef.refresh()">查询</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-row>
|
||||
</a-form>
|
||||
|
@ -33,6 +55,7 @@
|
|||
key: 'id'
|
||||
}"
|
||||
:tree-data="treeData"
|
||||
@select="handleSelectTree"
|
||||
></a-directory-tree>
|
||||
</a-col>
|
||||
<a-col :span="20">
|
||||
|
@ -61,33 +84,31 @@
|
|||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.dataIndex === 'enabledState'">
|
||||
<a-switch
|
||||
<!-- <a-switch
|
||||
checkedValue="ENABLE"
|
||||
unCheckedValue="DISABLED"
|
||||
checked-children="启用"
|
||||
un-checked-children="停用"
|
||||
v-model:checked="record.enabledState"
|
||||
/>
|
||||
/>-->
|
||||
{{ $TOOL.dictTypeData('COMMON_STATUS', record.enabledState) }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'type'">
|
||||
{{ $TOOL.dictTypeData('PRODUCTION_ORGANIZATION_TYPE', record.type) }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
<a-space>
|
||||
<a @click="TissueFormRef.onOpen()" v-if="hasPerm('officialAccountEdit')">查看</a>
|
||||
<a-divider type="vertical" v-if="hasPerm(['officialAccountEdit', 'officialAccountDelete'], 'and')" />
|
||||
<a
|
||||
@click="
|
||||
navigateTo('/basicData/publicAccount/detail', {
|
||||
type: 'EDIT',
|
||||
id: record.id
|
||||
})
|
||||
"
|
||||
@click="TissueFormRef.onOpen({ ...record, pageType: 'SEARCH' })"
|
||||
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-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-popconfirm>
|
||||
</a-space>
|
||||
|
@ -98,13 +119,14 @@
|
|||
</a-row>
|
||||
</a-card>
|
||||
|
||||
<TissueForm ref="TissueFormRef"></TissueForm>
|
||||
<TissueForm ref="TissueFormRef" @successful="successful"></TissueForm>
|
||||
</template>
|
||||
|
||||
<script setup name="basicDataPublicAccount">
|
||||
import productionOrganizationApi from '@/api/base/production-organization/productionOrganizationApi'
|
||||
import { useTableManagement } from '@/hook/useTableManagement'
|
||||
import TissueForm from '@/views/basicData/tissue/detail/TissueForm.vue'
|
||||
import tool from '@/utils/tool'
|
||||
|
||||
const publicAccountColumn = [
|
||||
{
|
||||
|
@ -162,7 +184,9 @@
|
|||
options,
|
||||
searchFormRef,
|
||||
toolConfig,
|
||||
navigateTo
|
||||
navigateTo,
|
||||
toggleAdvanced,
|
||||
advanced
|
||||
} = useTableManagement(
|
||||
{
|
||||
page: productionOrganizationApi.productionOrganizationPage,
|
||||
|
@ -180,9 +204,29 @@
|
|||
let treeData = ref([])
|
||||
|
||||
onMounted(() => {
|
||||
getProductionOrganizationTree()
|
||||
})
|
||||
|
||||
const successful = () => {
|
||||
tableRef.value.refresh()
|
||||
selectedKeys.value = []
|
||||
getProductionOrganizationTree()
|
||||
}
|
||||
|
||||
const getProductionOrganizationTree = () => {
|
||||
productionOrganizationApi.productionOrganizationTree().then((res) => {
|
||||
console.log(res)
|
||||
treeData.value = res
|
||||
treeData.value = res || []
|
||||
})
|
||||
}
|
||||
|
||||
const deleteRecordRestTRee = (record) => {
|
||||
deleteRecord(record).then(() => {
|
||||
getProductionOrganizationTree()
|
||||
})
|
||||
}
|
||||
|
||||
const handleSelectTree = (value) => {
|
||||
searchFormState.value.parentId = value[0]
|
||||
tableRef.value.refresh()
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue