基础资料模块

main
GaoF 2024-07-27 15:06:35 +08:00
parent 06963db0cc
commit 741484fdd4
9 changed files with 1075 additions and 275 deletions

View File

@ -24,5 +24,9 @@ export default {
// 获取仓库详情 // 获取仓库详情
sysStoreDetail(data) { sysStoreDetail(data) {
return request('detail', data, 'get') return request('detail', data, 'get')
} },
// 获取仓库树结构
sysStoreTree(data) {
return request('tree', data, 'get')
},
} }

View File

@ -15,7 +15,7 @@
/> />
</a-card> </a-card>
<a-card :bordered="false" title="域名" class="mt-4"> <!-- <a-card :bordered="false" title="域名" class="mt-4">
<a-button @click="handleAddDomain"></a-button> <a-button @click="handleAddDomain"></a-button>
<a-form class="mt-8" :model="domainFormData" :rules="domainFormRules" ref="domainFormRef"> <a-form class="mt-8" :model="domainFormData" :rules="domainFormRules" ref="domainFormRef">
<a-row v-for="(item, index) in domainFormItems" :key="item.value" :gutter="12"> <a-row v-for="(item, index) in domainFormItems" :key="item.value" :gutter="12">
@ -29,7 +29,7 @@
</a-col> </a-col>
</a-row> </a-row>
</a-form> </a-form>
</a-card> </a-card>-->
</template> </template>
<script setup name="brandDetail"> <script setup name="brandDetail">
@ -98,16 +98,6 @@
allowClear: true allowClear: true
} }
}, },
{
label: '备注:',
name: 'remarks',
type: 'a-input',
span: 6,
attrs: {
placeholder: '请输入备注',
allowClear: true
}
},
{ {
label: '启用状态:', label: '启用状态:',
name: 'enabledState', name: 'enabledState',
@ -118,6 +108,16 @@
options: tool.dictList('COMMON_STATUS') options: tool.dictList('COMMON_STATUS')
}, },
defaultValue: 'ENABLE' defaultValue: 'ENABLE'
},
{
label: '备注:',
name: 'remarks',
type: 'a-textarea',
span: 24,
attrs: {
placeholder: '请输入备注',
allowClear: true
}
} }
] ]
@ -128,9 +128,9 @@
getDetail: sysBrandApi.sysBrandDetail getDetail: sysBrandApi.sysBrandDetail
}) })
onMounted(() => { onMounted(async () => {
formRefs.value = [formRef1.value, domainFormRef.value] formRefs.value = [formRef1.value]
fetchData(route.query.type) await fetchData(route.query.type)
}) })
// //

View File

@ -1,5 +1,199 @@
<template></template> <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>
</template>
</a-page-header>
<script setup lang="ts"></script> <a-card :bordered="false" title="仓库">
<DynamicForm
:allDisabled="route.query.type === 'SEARCH'"
:formItems="officialAccountFormItems"
:model="formData"
:rules="formRules"
ref="formRef1"
/>
</a-card>
<style scoped></style> <a-card :bordered="false" class="mt-4">
<a-tabs v-model:activeKey="activeKey">
<a-tab-pane key="1" tab="联系信息">
<DynamicForm
:allDisabled="route.query.type === 'SEARCH'"
:formItems="baseFormItems"
:model="formData"
:rules="formRules"
ref="formRef1"
/>
</a-tab-pane>
<a-tab-pane key="2" tab="销售区域管理" force-render>
<DynamicTable :initialData="data" :columns="columns" rowKey="id"></DynamicTable>
</a-tab-pane>
</a-tabs>
</a-card>
</template>
<script setup>
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'
const route = useRoute()
import DynamicTable from '@/components/DynamicTable/index.vue'
const formRules = {
name: [required('请输入名称')],
type: [required('请输入类型')],
appid: [required('请输入AppID')],
secret: [required('请输入AppSecret')]
}
const officialAccountFormItems = [
{
label: '编码:',
name: 'number',
type: 'a-select',
span: 6,
attrs: {
placeholder: '请选择类型',
options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
}
},
{
label: '名称:',
name: 'name',
type: 'a-input',
span: 6,
rules: [required('请输入名称')],
attrs: {
placeholder: '请输入名称',
allowClear: true
}
},
{
label: '仓库条码:',
name: 'name',
type: 'a-input',
span: 6,
rules: [required('请输入名称')],
attrs: {
placeholder: '请输入名称',
allowClear: true
}
},
{
label: '可用状态:',
name: 'enabledState',
type: 'a-select',
span: 6,
attrs: {
placeholder: '请选择可用状态',
options: tool.dictList('COMMON_STATUS')
},
defaultValue: 'ENABLE'
},
{
label: '库存管理方式:',
name: 'name',
type: 'a-input',
span: 6,
rules: [required('请输入名称')],
attrs: {
placeholder: '请输入名称',
allowClear: true
}
},
{
label: '备注:',
name: 'remarks',
type: 'a-textarea',
span: 24,
attrs: {
placeholder: '请输入备注',
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
}
}
]
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',
editable: true,
dataType: 'text' // 'number', 'select'
},
{
title: '上游仓库名称',
dataIndex: 'age',
editable: true,
dataType: 'number'
}
]
</script>

View File

@ -73,7 +73,7 @@
<a-button <a-button
type="primary" type="primary"
@click=" @click="
navigateTo('/basicData/publicAccount/detail', { navigateTo('/basicData/client/detail', {
type: 'ADD' type: 'ADD'
}) })
" "
@ -106,7 +106,7 @@
<a-space> <a-space>
<a <a
@click=" @click="
navigateTo('/basicData/publicAccount/detail', { navigateTo('/basicData/client/detail', {
type: 'SEARCH', type: 'SEARCH',
id: record.id id: record.id
}) })
@ -117,7 +117,7 @@
<a-divider type="vertical" v-if="hasPerm(['customerEdit', 'customerDelete'], 'and')" /> <a-divider type="vertical" v-if="hasPerm(['customerEdit', 'customerDelete'], 'and')" />
<a <a
@click=" @click="
navigateTo('/basicData/publicAccount/detail', { navigateTo('/basicData/client/detail', {
type: 'EDIT', type: 'EDIT',
id: record.id id: record.id
}) })
@ -144,9 +144,8 @@
import customerCategoryApi from '@/api/base/customer/customerCategoryApi' import customerCategoryApi from '@/api/base/customer/customerCategoryApi'
import { useTableManagement } from '@/hook/useTableManagement' import { useTableManagement } from '@/hook/useTableManagement'
import CustomerCategoryForm from '@/views/basicData/client/detail/CustomerCategoryForm.vue' import CustomerCategoryForm from '@/views/basicData/client/detail/CustomerCategoryForm.vue'
import UnitGroupForm from "@/views/basicData/unit/detail/UnitGroupForm.vue";
const publicAccountColumn = [ const clientColumn = [
{ {
title: '编码', title: '编码',
dataIndex: 'number', dataIndex: 'number',
@ -215,7 +214,7 @@
page: customerApi.customerPage, page: customerApi.customerPage,
delete: customerApi.customerDelete delete: customerApi.customerDelete
}, },
publicAccountColumn, clientColumn,
['customerEdit', 'customerDelete'] ['customerEdit', 'customerDelete']
) )

View File

@ -1,5 +1,346 @@
<template></template> <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>
</template>
</a-page-header>
<script setup lang="ts"></script> <a-card :bordered="false" title="仓库">
<DynamicForm
:allDisabled="route.query.type === 'SEARCH'"
:formItems="officialAccountFormItems"
:model="formData"
:rules="formRules"
ref="formRef1"
/>
</a-card>
<style scoped></style> <a-card :bordered="false" class="mt-4">
<a-tabs v-model:activeKey="activeKey">
<a-tab-pane key="1" tab="基本信息">
<DynamicForm
:allDisabled="route.query.type === 'SEARCH'"
:formItems="baseFormItems"
:model="formData"
:rules="formRules"
ref="formRef1"
/>
</a-tab-pane>
<a-tab-pane key="2" tab="单位信息" force-render>
<DynamicForm
:allDisabled="route.query.type === 'SEARCH'"
:formItems="unitFormItems"
:model="formData"
:rules="formRules"
ref="formRef1"
/>
</a-tab-pane>
<a-tab-pane key="3" tab="包装关系" force-render>
<DynamicTable :initialData="data" :columns="columns" rowKey="id"></DynamicTable>
</a-tab-pane>
<a-tab-pane key="4" tab="商品推广" force-render>
</a-tab-pane>
</a-tabs>
</a-card>
</template>
<script setup>
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'
const route = useRoute()
import DynamicTable from '@/components/DynamicTable/index.vue'
const formRules = {
name: [required('请输入名称')],
type: [required('请输入类型')],
appid: [required('请输入AppID')],
secret: [required('请输入AppSecret')]
}
const officialAccountFormItems = [
{
label: '编码:',
name: 'number',
type: 'a-select',
span: 6,
attrs: {
placeholder: '请选择类型',
options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
}
},
{
label: '名称:',
name: 'name',
type: 'a-input',
span: 6,
rules: [required('请输入名称')],
attrs: {
placeholder: '请输入名称',
allowClear: true
}
},
{
label: '仓库条码:',
name: 'name',
type: 'a-input',
span: 6,
rules: [required('请输入名称')],
attrs: {
placeholder: '请输入名称',
allowClear: true
}
},
{
label: '可用状态:',
name: 'enabledState',
type: 'a-select',
span: 6,
attrs: {
placeholder: '请选择可用状态',
options: tool.dictList('COMMON_STATUS')
},
defaultValue: 'ENABLE'
},
{
label: '库存管理方式:',
name: 'name',
type: 'a-input',
span: 6,
rules: [required('请输入名称')],
attrs: {
placeholder: '请输入名称',
allowClear: true
}
},
{
label: '备注:',
name: 'remarks',
type: 'a-textarea',
span: 24,
attrs: {
placeholder: '请输入备注',
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 = [
{
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
}
}
]
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',
editable: true,
dataType: 'text' // 'number', 'select'
},
{
title: '上游仓库名称',
dataIndex: 'age',
editable: true,
dataType: 'number'
}
]
</script>

View File

@ -8,39 +8,48 @@
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="6"> <a-col :span="6">
<a-form-item label="编码" name="number"> <a-form-item label="类型" name="type">
<a-input v-model:value="searchFormState.number" placeholder="请输入编码" /> <a-input v-model:value="searchFormState.type" placeholder="请输入类型" />
</a-form-item>
</a-col>
<a-col :span="6">
<a-form-item label="物料类型" name="categoryId">
<a-input v-model:value="searchFormState.categoryId" placeholder="请输入物料类型" />
</a-form-item>
</a-col>
<a-col :span="6" v-show="advanced">
<a-form-item label="启用状态" name="enabledState">
<a-select
v-model:value="searchFormState.enabledState"
placeholder="请选择启用状态"
:options="enabledStateOptions"
/>
</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>
</a-card> </a-card>
<a-card :bordered="false" class="mt-4"> <a-card :bordered="false" class="mt-4">
<a-row :gutter="20"> <a-row :gutter="16">
<a-col :span="6"> <a-col :span="6">
<div className="s-table-tool">
<div className="s-table-tool-left">分类</div>
<!-- 斑马纹 -->
<div className="layout-items-center s-table-tool-right">
<span v-for="item in tool" :key="item.name">
<!-- 新增 -->
<a-tooltip :title="item.title" class="s-tool-item" v-if="item.name === 'plus'" @click="handleAddTree">
<component class="icons" :is="item.icon"></component>
</a-tooltip>
<!-- 修改 -->
<a-tooltip :title="item.title" class="s-tool-item" v-if="item.name === 'edit'">
<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">
<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'">
<component class="icons" :is="item.icon"></component>
</a-tooltip>
</span>
</div>
</div>
<a-directory-tree <a-directory-tree
v-model:expandedKeys="expandedKeys" v-model:expandedKeys="expandedKeys"
v-model:selectedKeys="selectedKeys" v-model:selectedKeys="selectedKeys"
@ -52,7 +61,7 @@
<s-table <s-table
ref="tableRef" ref="tableRef"
:columns="columns" :columns="columns"
:data="[]" :data="loadData"
:alert="options.alert.show" :alert="options.alert.show"
bordered bordered
:row-key="(record) => record.id" :row-key="(record) => record.id"
@ -61,33 +70,64 @@
> >
<template #operator class="table-operator"> <template #operator class="table-operator">
<a-space> <a-space>
<a-button type="primary" @click="formRef.onOpen()" v-if="hasPerm('materialAdd')"> <a-button
type="primary"
@click="
navigateTo('/basicData/materiel/detail', {
type: 'ADD'
})
"
v-if="hasPerm('customerAdd')"
>
<template #icon><plus-outlined /></template> <template #icon><plus-outlined /></template>
新增 新增
</a-button> </a-button>
<xn-batch-delete <xn-batch-delete
v-if="hasPerm('materialBatchDelete')" v-if="hasPerm('customerBatchDelete')"
:selectedRowKeys="selectedRowKeys" :selectedRowKeys="selectedRowKeys"
@batchDelete="deleteBatchMaterial" @batchDelete="deleteBatchRecords"
/> />
</a-space> </a-space>
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'enabledState'"> <template v-if="column.dataIndex === 'enabledState'">
{{ $TOOL.dictTypeData('COMMON_STATUS', record.enabledState) }} <a-switch
checkedValue="ENABLE"
unCheckedValue="DISABLED"
checked-children="启用"
un-checked-children="停用"
v-model:checked="record.enabledState"
/>
</template> </template>
<template v-if="column.dataIndex === 'batchManage'"> <template v-if="column.dataIndex === 'type'">
{{ $TOOL.dictTypeData('YES_NO', record.batchManage) }} {{ $TOOL.dictTypeData('OFFICIAL_ACCOUNT_TYPE', record.type) }}
</template>
<template v-if="column.dataIndex === 'promoteEnabledState'">
{{ $TOOL.dictTypeData('COMMON_STATUS', record.promoteEnabledState) }}
</template> </template>
<template v-if="column.dataIndex === 'action'"> <template v-if="column.dataIndex === 'action'">
<a-space> <a-space>
<a @click="formRef.onOpen(record)" v-if="hasPerm('materialEdit')"></a> <a
<a-divider type="vertical" v-if="hasPerm(['materialEdit', 'materialDelete'], 'and')" /> @click="
<a-popconfirm title="确定要删除吗?" @confirm="deleteMaterial(record)"> navigateTo('/basicData/materiel/detail', {
<a-button type="link" danger size="small" v-if="hasPerm('materialDelete')"></a-button> type: 'SEARCH',
id: record.id
})
"
v-if="hasPerm('customerEdit')"
>查看</a
>
<a-divider type="vertical" v-if="hasPerm(['customerEdit', 'customerDelete'], 'and')" />
<a
@click="
navigateTo('/basicData/materiel/detail', {
type: 'EDIT',
id: record.id
})
"
v-if="hasPerm('customerEdit')"
>编辑</a
>
<a-divider type="vertical" v-if="hasPerm(['customerEdit', 'customerDelete'], 'and')" />
<a-popconfirm title="确定要删除吗?" @confirm="deleteRecord(record)">
<a-button type="link" danger size="small" v-if="hasPerm('customerDelete')"></a-button>
</a-popconfirm> </a-popconfirm>
</a-space> </a-space>
</template> </template>
@ -96,246 +136,139 @@
</a-col> </a-col>
</a-row> </a-row>
</a-card> </a-card>
<!-- <Form ref="formRef" @successful="tableRef.refresh()" />-->
</template> </template>
<script setup name="material"> <script setup>
import tool from '@/utils/tool' import customerApi from '@/api/base/customer/customerApi'
import { cloneDeep } from 'lodash-es' import customerCategoryApi from '@/api/base/customer/customerCategoryApi'
// import Form from './form.vue' import { useTableManagement } from '@/hook/useTableManagement'
// import materialApi from '@/api/base/materialApi'
const searchFormState = ref({}) const materielColumn = [
const searchFormRef = ref()
const tableRef = ref()
const formRef = ref()
const toolConfig = { refresh: true, height: true, columnSetting: true, striped: false }
//
const advanced = ref(false)
const toggleAdvanced = () => {
advanced.value = !advanced.value
}
const columns = [
{
title: '名称',
dataIndex: 'name',
width: 100
},
{ {
title: '编码', title: '编码',
dataIndex: 'number', dataIndex: 'number',
sorter: (a, b) => a.address.length - b.address.length,
sortDirections: ['descend', 'ascend'],
align: 'center',
resizable: true,
width: 100 width: 100
}, },
{ {
title: '简称', title: '名称',
dataIndex: 'shortName', dataIndex: 'type',
align: 'center',
resizable: true,
width: 100 width: 100
}, },
{ {
title: '别名', title: '分类',
dataIndex: 'alias', dataIndex: 'name',
sorter: (a, b) => a.address.length - b.address.length,
sortDirections: ['descend', 'ascend'],
align: 'center',
resizable: true,
width: 100 width: 100
}, },
{ {
title: '物料类型', title: '年龄',
dataIndex: 'categoryId',
width: 100
},
{
title: '规格型号',
dataIndex: 'specification',
width: 100
},
{
title: '包装比例',
dataIndex: 'packageProportion',
width: 100
},
{
title: '启用状态',
dataIndex: 'enabledState', dataIndex: 'enabledState',
align: 'center',
resizable: true,
width: 100 width: 100
}, },
{ {
title: '扩展信息', title: '可用状态',
dataIndex: 'extJson', dataIndex: 'enabledState',
align: 'center',
resizable: true,
width: 100 width: 100
}, },
{ {
title: '助记码', title: '创建时间',
dataIndex: 'mnemonicCode', dataIndex: 'createTime',
sorter: (a, b) => a.address.length - b.address.length,
sortDirections: ['descend', 'ascend'],
align: 'center',
resizable: true,
width: 100 width: 100
},
{
title: '批次管理',
dataIndex: 'batchManage',
width: 100
},
{
title: '品牌',
dataIndex: 'brandId',
width: 100
},
{
title: '最高库存',
dataIndex: 'maxInventory',
width: 100
},
{
title: '最低库存',
dataIndex: 'minInventory',
width: 100
},
{
title: '统一零售价',
dataIndex: 'retailPrice',
width: 100
},
{
title: '商品条形码',
dataIndex: 'barcode',
width: 100
},
{
title: '保质期',
dataIndex: 'shelfLife',
width: 100
},
{
title: '保质期单位',
dataIndex: 'shelfLifeUnit',
width: 100
},
{
title: '最大包装数量',
dataIndex: 'maxPackageQuantity'
},
{
title: '备注',
dataIndex: 'remarks'
},
{
title: '单位组',
dataIndex: 'unitGroupId'
},
{
title: '基本单位',
dataIndex: 'baseUnitId'
},
{
title: '采购单位',
dataIndex: 'purchaseUnitId'
},
{
title: '分销单位',
dataIndex: 'distrUnitId'
},
{
title: '生成单位',
dataIndex: 'produceUnitId'
},
{
title: '销售单位',
dataIndex: 'saleUnitId'
},
{
title: '库存单位',
dataIndex: 'storeUnitId'
},
{
title: '推广启用状态',
dataIndex: 'promoteEnabledState'
} }
] ]
//
if (hasPerm(['materialEdit', 'materialDelete'])) { const {
columns.push({ searchFormState,
title: '操作', tableRef,
dataIndex: 'action', selectedRowKeys,
align: 'center', columns,
width: 150 loadData,
}) reset,
} deleteRecord,
const selectedRowKeys = ref([]) deleteBatchRecords,
// options,
const options = { searchFormRef,
// columns needTotal: true toolConfig,
alert: { navigateTo
show: true, } = useTableManagement(
clear: () => { {
selectedRowKeys.value = ref([]) page: customerApi.customerPage,
} delete: customerApi.customerDelete
}, },
rowSelection: { materielColumn,
onChange: (selectedRowKey, selectedRows) => { ['customerEdit', 'customerDelete']
selectedRowKeys.value = selectedRowKey )
}
const tool = [
{
name: 'plus',
icon: 'plus-outlined',
title: '新增'
},
{
name: 'edit',
icon: 'edit-outlined',
title: '编辑'
},
{
name: 'delete',
icon: 'delete-outlined',
title: '删除'
},
{
name: 'refresh',
icon: 'sync-outlined',
title: '刷新'
} }
} ]
const loadData = (parameter) => {
const searchFormParam = cloneDeep(searchFormState.value)
return materialApi.materialPage(Object.assign(parameter, searchFormParam)).then((data) => {
return data
})
}
//
const reset = () => {
searchFormRef.value.resetFields()
tableRef.value.refresh(true)
}
//
const deleteMaterial = (record) => {
let params = [
{
id: record.id
}
]
materialApi.materialDelete(params).then(() => {
tableRef.value.refresh(true)
})
}
//
const deleteBatchMaterial = (params) => {
materialApi.materialDelete(params).then(() => {
tableRef.value.clearRefreshSelected()
})
}
const enabledStateOptions = tool.dictList('COMMON_STATUS')
// //
const expandedKeys = ref(['0-0', '0-1']) const expandedKeys = ref(['0-0', '0-1'])
const selectedKeys = ref([]) const selectedKeys = ref([])
const treeData = [ const treeData = []
{ const CustomerCategoryFormRef = ref(null)
title: 'parent 0',
key: '0-0', const handleAddTree = () => {
children: [ CustomerCategoryFormRef.value.onOpen()
{ }
title: 'leaf 0-0',
key: '0-0-0', onMounted(() => {
isLeaf: true customerCategoryApi.customerCategoryTree().then((res) => {
}, console.log(res)
{ })
title: 'leaf 0-1', })
key: '0-0-1',
isLeaf: true
}
]
},
{
title: 'parent 1',
key: '0-1',
children: [
{
title: 'leaf 1-0',
key: '0-1-0',
isLeaf: true
},
{
title: 'leaf 1-1',
key: '0-1-1',
isLeaf: true
}
]
}
]
</script> </script>
<style lang="less" scoped>
.s-table-tool {
display: flex;
margin-bottom: 16px;
.s-table-tool-left {
flex: 1;
}
.s-table-tool-right {
.s-tool-item {
font-size: 16px;
@apply ml-4;
cursor: pointer;
}
}
}
</style>

View File

@ -0,0 +1,141 @@
<template>
<xn-form-container
:title="formData.id ? '编辑生产组织' : '增加生产组织'"
:width="700"
:visible="visible"
:destroy-on-close="true"
@close="onClose"
>
<a-form ref="formRef" :model="formData" :rules="formRules" layout="horizontal">
<a-row :gutter="16">
<a-col :span="12">
<a-form-item label="名称:" name="name">
<a-input v-model:value="formData.name" placeholder="请输入名称" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="编码:" name="number">
<a-input v-model:value="formData.number" placeholder="请输入编码" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="仓库:" name="storeId">
<a-input v-model:value="formData.storeId" placeholder="请输入仓库id" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="厂家名称:" name="manufacturer">
<a-tree-select
v-model:value="formData.manufacturer"
style="width: 100%"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
:tree-data="treeData"
placeholder="Please select"
>
</a-tree-select>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="启用状态:" name="enabledState">
<a-select
v-model:value="formData.enabledState"
placeholder="请选择启用状态"
:options="enabledStateOptions"
/>
</a-form-item>
</a-col>
</a-row>
</a-form>
<template #footer>
<a-button style="margin-right: 8px" @click="onClose"></a-button>
<a-button type="primary" @click="onSubmit" :loading="submitLoading">保存</a-button>
</template>
</xn-form-container>
</template>
<script setup name="productionOrganizationForm">
import tool from '@/utils/tool'
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'
//
const visible = ref(false)
const emit = defineEmits({ successful: null })
const formRef = ref()
//
const formData = ref({})
const submitLoading = ref(false)
const typeOptions = ref([])
const enabledStateOptions = ref([])
//
const onOpen = (record) => {
visible.value = true
if (record) {
let recordData = cloneDeep(record)
formData.value = Object.assign({}, recordData)
}
typeOptions.value = tool.dictList('GENDER')
enabledStateOptions.value = tool.dictList('COMMON_STATUS')
sysStoreApi.sysStoreTree().then(res => {
console.log(res)
})
}
//
const onClose = () => {
formRef.value.resetFields()
formData.value = {}
visible.value = false
}
//
const formRules = {}
//
const onSubmit = () => {
formRef.value.validate().then(() => {
submitLoading.value = true
const formDataParam = cloneDeep(formData.value)
productionOrganizationApi
.productionOrganizationSubmitForm(formDataParam, formDataParam.id)
.then(() => {
onClose()
emit('successful')
})
.finally(() => {
submitLoading.value = false
})
})
}
const treeData = [
{
title: 'Node1',
value: '0-0',
key: '0-0',
children: [
{
value: '0-0-1',
key: '0-0-1',
slots: {
title: 'title'
}
},
{
title: 'Child Node2',
value: '0-0-2',
key: '0-0-2'
}
]
},
{
title: 'Node2',
value: '0-1',
key: '0-1'
}
]
//
defineExpose({
onOpen
})
</script>

View File

@ -0,0 +1,29 @@
<template>
<div></div>
</template>
<script setup>
// const props = defineProps({})
// const emit = defineEmits()
//
onMounted(() => {
console.log('Component mounted')
// TODO: Add your onMounted code here
})
onUpdated(() => {
console.log('Component updated')
// TODO: Add your onUpdated code here
})
onUnmounted(() => {
console.log('Component unmounted')
// TODO: Add your onUnmounted code here
})
// watch(() => {}, () => {})
</script>
<style scoped></style>

View File

@ -0,0 +1,159 @@
<template>
<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="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>
</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-col>
</a-row>
</a-form>
</a-card>
<a-card :bordered="false" class="mt-4">
<s-table
ref="tableRef"
:columns="columns"
:data="loadData"
:alert="options.alert.show"
bordered
:row-key="(record) => record.id"
:tool-config="toolConfig"
:row-selection="options.rowSelection"
>
<template #operator class="table-operator">
<a-space>
<a-button type="primary" @click="TissueFormRef.onOpen()" v-if="hasPerm('officialAccountAdd')">
<template #icon><plus-outlined /></template>
新增工厂
</a-button>
<xn-batch-delete
v-if="hasPerm('officialAccountBatchDelete')"
:selectedRowKeys="selectedRowKeys"
@batchDelete="deleteBatchRecords"
/>
</a-space>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'enabledState'">
<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) }}
</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
})
"
v-if="hasPerm('officialAccountEdit')"
>编辑</a
>
<a-divider type="vertical" v-if="hasPerm(['officialAccountEdit', 'officialAccountDelete'], 'and')" />
<a-popconfirm title="确定要删除吗?" @confirm="deleteRecord(record)">
<a-button type="link" danger size="small" v-if="hasPerm('officialAccountDelete')"></a-button>
</a-popconfirm>
</a-space>
</template>
</template>
</s-table>
</a-card>
<TissueForm ref="TissueFormRef"></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'
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',
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',
align: 'center',
resizable: true,
width: 100
},
{
title: '创建时间',
dataIndex: 'createTime',
sorter: (a, b) => a.address.length - b.address.length,
sortDirections: ['descend', 'ascend'],
align: 'center',
resizable: true,
width: 100
}
]
const {
searchFormState,
tableRef,
selectedRowKeys,
columns,
loadData,
reset,
deleteRecord,
deleteBatchRecords,
options,
searchFormRef,
toolConfig,
navigateTo
} = useTableManagement(
{
page: productionOrganizationApi.productionOrganizationPage,
delete: productionOrganizationApi.productionOrganizationDelete
},
publicAccountColumn,
['officialAccountEdit', 'officialAccountDelete']
)
const TissueFormRef = ref(null)
</script>