基础资料模块

main
GaoF 2024-07-27 19:59:19 +08:00
parent 741484fdd4
commit 3d5aed578c
13 changed files with 17138 additions and 321 deletions

View File

@ -24,5 +24,9 @@ export default {
// 获取公众号详情
officialAccountDetail(data) {
return request('detail', data, 'get')
},
// 获取公众号详情
officialAccountList(data) {
return request('list', data, 'get')
}
}

View File

@ -590,7 +590,7 @@
props.rowSelection.selectedRows = selectedRows
// eslint-disable-next-line vue/no-mutating-props
props.rowSelection.selectedRowKeys = selectedRowKeys
props.rowSelection.onChange(selectedRowKeys, selectedRows)
// props.rowSelection.onChange(selectedRowKeys, selectedRows)
getTableProps()
}
const list = data.needTotalList

View File

@ -58,6 +58,8 @@ export default function useFormHandler(formItems, api) {
formData[key] = res[key]
}
}
return res
} catch (error) {
console.error('API request failed:', error)
}

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@
/>
</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-form class="mt-8" :model="domainFormData" :rules="domainFormRules" ref="domainFormRef">
<a-row v-for="(item, index) in domainFormItems" :key="item.value" :gutter="12">
@ -38,6 +38,7 @@
import useFormHandler from '@/hook/useFormHandler'
import tool from '@/utils/tool'
import { useRoute } from 'vue-router'
import officialAccountApi from '@/api/base/wx/officialAccountApi'
const route = useRoute()
const formRules = {
@ -47,7 +48,7 @@
secret: [required('请输入AppSecret')]
}
const brandFormItems = [
const brandFormItems = reactive([
{
label: '名称:',
name: 'name',
@ -91,11 +92,16 @@
{
label: '公众号:',
name: 'officialAccountId',
type: 'a-input',
type: 'a-select',
span: 6,
attrs: {
placeholder: '请输入公众号',
allowClear: true
options: [],
fieldNames: {
children: 'children',
label: 'name',
value: 'id'
}
}
},
{
@ -119,7 +125,7 @@
allowClear: true
}
}
]
])
const formRef1 = ref(null)
@ -131,6 +137,18 @@
onMounted(async () => {
formRefs.value = [formRef1.value]
await fetchData(route.query.type)
officialAccountApi
.officialAccountList({
enabledState: 'ENABLE'
})
.then((res) => {
brandFormItems.forEach((item) => {
if (item.name === 'officialAccountId') {
item.attrs.options = res
}
})
})
})
//

View File

@ -6,105 +6,38 @@
:destroy-on-close="true"
@close="onClose"
>
<a-form ref="formRef" :model="formData" :rules="formRules" layout="horizontal">
<a-form ref="formRef" :model="formData" :rules="formRules" layout="vertical">
<a-row :gutter="16">
<a-col :span="12">
<a-col :span="24">
<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-col :span="24">
<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="shortName">
<a-input v-model:value="formData.shortName" placeholder="请输入简称" allow-clear />
<a-col :span="24">
<a-form-item label="上级:" name="parentId">
<a-tree-select
v-model:value="formData.parentId"
style="width: 100%"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
:tree-data="parentTreeData"
placeholder="请选择上级仓库"
:fieldNames="{
children: 'children',
label: 'name',
value: 'id'
}"
>
</a-tree-select>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="客户分类ID" name="categoryId">
<a-input v-model:value="formData.categoryId" placeholder="请输入客户分类ID" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="品牌:" name="brandId">
<a-input v-model:value="formData.brandId" placeholder="请输入品牌" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="省:" name="province">
<a-input v-model:value="formData.province" placeholder="请输入省" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="市:" name="city">
<a-input v-model:value="formData.city" placeholder="请输入市" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="县:" name="county">
<a-input v-model:value="formData.county" placeholder="请输入县" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="详细地址 " name="address">
<a-input v-model:value="formData.address" placeholder="请输入详细地址 " allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="启用状态:" name="enabledState">
<a-radio-group
v-model:value="formData.enabledState"
placeholder="请选择启用状态"
:options="enabledStateOptions"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="联系人:" name="contacts">
<a-input v-model:value="formData.contacts" placeholder="请输入联系人" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="手机:" name="phone">
<a-input v-model:value="formData.phone" placeholder="请输入手机" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="固话:" name="tel">
<a-input v-model:value="formData.tel" placeholder="请输入固话" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="传真:" name="fax">
<a-input v-model:value="formData.fax" placeholder="请输入传真" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="电子邮箱:" name="email">
<a-input v-model:value="formData.email" placeholder="请输入电子邮箱" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="qq" name="qq">
<a-input v-model:value="formData.qq" placeholder="请输入qq" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="微信号:" name="wechat">
<a-input v-model:value="formData.wechat" placeholder="请输入微信号" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="联系地址:" name="contactAddress">
<a-input v-model:value="formData.contactAddress" placeholder="请输入联系地址" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="扩展信息:" name="extJson">
<a-input v-model:value="formData.extJson" placeholder="请输入扩展信息" allow-clear />
<a-col :span="24">
<a-form-item label="排序码:" name="sortCode">
<a-input v-model:value="formData.sortCode" placeholder="请输入排序码" allow-clear />
</a-form-item>
</a-col>
</a-row>
@ -126,7 +59,9 @@
const emit = defineEmits({ successful: null })
const formRef = ref()
//
const formData = ref({})
const formData = ref({
sortCode: '99'
})
const submitLoading = ref(false)
const enabledStateOptions = ref([])
@ -138,6 +73,17 @@
formData.value = Object.assign({}, recordData)
}
enabledStateOptions.value = tool.dictList('COMMON_STATUS')
customerCategoryApi.customerCategoryTree().then(res => {
parentTreeData.value = [
{
id: 0,
parentId: '0',
name: '顶级',
children: res ? res : []
}
]
})
}
//
const onClose = () => {
@ -146,14 +92,17 @@
visible.value = false
}
//
const formRules = {}
const formRules = {
name: [required('请输入名称')],
parentId: [required('请选择上级')],
}
//
const onSubmit = () => {
formRef.value.validate().then(() => {
submitLoading.value = true
const formDataParam = cloneDeep(formData.value)
customerCategoryApi
.customerSubmitForm(formDataParam, formDataParam.id)
.customerCategorySubmitForm(formDataParam, formDataParam.id)
.then(() => {
onClose()
emit('successful')
@ -163,6 +112,8 @@
})
})
}
let parentTreeData = ref([])
//
defineExpose({
onOpen

View File

@ -5,10 +5,10 @@
</template>
</a-page-header>
<a-card :bordered="false" title="仓库">
<a-card :bordered="false" title="客户">
<DynamicForm
:allDisabled="route.query.type === 'SEARCH'"
:formItems="officialAccountFormItems"
:formItems="clientFormItems"
: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>
@ -33,14 +33,18 @@
</a-card>
</template>
<script setup>
<script setup name="clientDetail">
import { required } from '@/utils/formRules'
import officialAccountApi from '@/api/base/wx/officialAccountApi'
import sysBrandApi from '@/api/base/brand/sysBrandApi'
import customerCategoryApi from '@/api/base/customer/customerCategoryApi'
import customerApi from '@/api/base/customer/customerApi'
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'
import cityOptions from '@/utils/cityOptions'
const formRules = {
name: [required('请输入名称')],
@ -49,12 +53,19 @@
secret: [required('请输入AppSecret')]
}
const officialAccountFormItems = [
//
const onCascaderChange = (value) => {
formData.province = value[0] && value[0]
formData.city = value[1] && value[1]
formData.county = value[2] && value[2]
}
const clientFormItems = reactive([
{
label: '编码:',
name: 'number',
type: 'a-select',
span: 6,
type: 'a-input',
span: 8,
attrs: {
placeholder: '请选择类型',
options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
@ -64,7 +75,7 @@
label: '名称:',
name: 'name',
type: 'a-input',
span: 6,
span: 8,
rules: [required('请输入名称')],
attrs: {
placeholder: '请输入名称',
@ -72,11 +83,10 @@
}
},
{
label: '仓库条码',
name: 'name',
label: '简称',
name: 'shortName',
type: 'a-input',
span: 6,
rules: [required('请输入名称')],
span: 8,
attrs: {
placeholder: '请输入名称',
allowClear: true
@ -86,7 +96,7 @@
label: '可用状态:',
name: 'enabledState',
type: 'a-select',
span: 6,
span: 8,
attrs: {
placeholder: '请选择可用状态',
options: tool.dictList('COMMON_STATUS')
@ -94,14 +104,60 @@
defaultValue: 'ENABLE'
},
{
label: '库存管理方式',
name: 'name',
type: 'a-input',
span: 6,
rules: [required('请输入名称')],
label: '品牌',
name: 'brandId',
type: 'a-select',
span: 8,
rules: [required('请选择品牌')],
attrs: {
placeholder: '请输入名称',
allowClear: true
placeholder: '请选择品牌',
options: tool.dictList('COMMON_STATUS'),
fieldNames: {
label: 'name',
value: 'id'
}
}
},
{
label: '客户分类:',
name: 'categoryId',
type: 'a-tree-select',
span: 8,
rules: [required('请选择客户分类')],
attrs: {
placeholder: '请选择客户分类',
allowClear: true,
fieldNames: {
children: 'children',
label: 'name',
value: 'id'
}
}
},
{
label: '详细地址:',
name: 'provinceName',
type: 'a-cascader',
span: 8,
rules: [required('请选择详细地址')],
attrs: {
placeholder: '请选择详细地址',
options: cityOptions,
onChange: onCascaderChange
}
},
{
name: 'address',
type: 'a-textarea',
span: 24,
attrs: {
placeholder: '请输入详细地址',
allowClear: true,
fieldNames: {
children: 'children',
label: 'name',
value: 'id'
}
}
},
{
@ -114,44 +170,80 @@
allowClear: true
}
}
]
])
const baseFormItems = [
{
label: '管理员',
name: 'number',
type: 'a-select',
label: '联系人',
name: 'contacts',
type: 'a-input',
span: 6,
attrs: {
placeholder: '请选择类型',
options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
placeholder: '请选择类型'
}
},
{
label: '手机:',
name: 'number',
type: 'a-select',
name: 'phone',
type: 'a-input',
span: 6,
attrs: {
placeholder: '请选择类型',
options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
placeholder: '请选择类型'
}
},
{
label: '固话:',
name: 'number',
type: 'a-select',
name: 'tel',
type: 'a-input',
span: 6,
attrs: {
placeholder: '请选择类型',
options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
placeholder: '请选择类型'
}
},
{
label: '地址:',
name: 'remarks',
type: 'a-textarea',
span: 24,
label: '传真:',
name: 'fax',
type: 'a-input',
span: 6,
attrs: {
placeholder: '请选择类型'
}
},
{
label: '电子邮箱:',
name: 'email',
type: 'a-input',
span: 6,
attrs: {
placeholder: '请输入备注',
allowClear: true
}
},
{
label: 'QQ',
name: 'qq',
type: 'a-input',
span: 6,
attrs: {
placeholder: '请输入备注',
allowClear: true
}
},
{
label: '微信:',
name: 'wechat',
type: 'a-input',
span: 6,
attrs: {
placeholder: '请输入备注',
allowClear: true
}
},
{
label: '联系地址:',
name: 'contactAddress',
type: 'a-input',
span: 6,
attrs: {
placeholder: '请输入备注',
allowClear: true
@ -163,16 +255,45 @@
const formRef2 = ref(null)
const { state, formData, submitLoading, formRefs, onSubmit, handleBack, fetchData } = useFormHandler(
[...officialAccountFormItems, ...baseFormItems],
[...clientFormItems, ...baseFormItems],
{
submitForm: officialAccountApi.officialAccountSubmitForm,
getDetail: officialAccountApi.officialAccountDetail
submitForm: customerApi.customerSubmitForm,
getDetail: customerApi.customerDetail
}
)
onMounted(() => {
onMounted(async () => {
formRefs.value = [formRef1.value, formRef2.value]
fetchData(route.query.type)
fetchData(route.query.type).then((res) => {
formData.provinceName = [res.province, res.city, res.county]
})
//
sysBrandApi
.sysBrandList({
enabledState: 'ENABLE'
})
.then((res) => {
clientFormItems.forEach((item) => {
if (item.name === 'brandId') {
item.attrs.options = res
}
})
})
//
customerCategoryApi
.customerCategoryTree({
enabledState: 'ENABLE'
})
.then((res) => {
clientFormItems.forEach((item) => {
if (item.name === 'categoryId') {
item.attrs.treeData = res
}
})
})
})
let activeKey = ref('1')

View File

@ -33,19 +33,19 @@
<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-tooltip :title="item.title" class="s-tool-item" v-if="item.name === 'delete'" @click="handleDelTree">
<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'">
<!-- <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>
@ -55,6 +55,13 @@
v-model:selectedKeys="selectedKeys"
multiple
:tree-data="treeData"
:selectedKeys="treeSelectedKeys"
:fieldNames="{
children: 'children',
title: 'name',
key: 'id'
}"
@select="handleTreeClick"
></a-directory-tree>
</a-col>
<a-col :span="18">
@ -135,7 +142,7 @@
</s-table>
</a-col>
</a-row>
<CustomerCategoryForm ref="CustomerCategoryFormRef"></CustomerCategoryForm>
<CustomerCategoryForm ref="CustomerCategoryFormRef" @successful="successful"></CustomerCategoryForm>
</a-card>
</template>
@ -144,6 +151,7 @@
import customerCategoryApi from '@/api/base/customer/customerCategoryApi'
import { useTableManagement } from '@/hook/useTableManagement'
import CustomerCategoryForm from '@/views/basicData/client/detail/CustomerCategoryForm.vue'
import { message } from 'ant-design-vue'
const clientColumn = [
{
@ -157,27 +165,20 @@
},
{
title: '名称',
dataIndex: 'type',
dataIndex: 'name',
align: 'center',
resizable: true,
width: 100
},
{
title: '分类',
dataIndex: 'name',
dataIndex: 'type',
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: 'enabledState',
@ -244,16 +245,55 @@
//
const expandedKeys = ref(['0-0', '0-1'])
const selectedKeys = ref([])
const treeData = []
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
}
const handleAddTree = () => {
CustomerCategoryFormRef.value.onOpen()
}
const handleEditTree = () => {
if (!treeRow.id) return message.error('!请选择要编辑的数据')
CustomerCategoryFormRef.value.onOpen(treeRow)
}
const handleDelTree = () => {
if (!treeRow.id) return message.error('!请选择要编辑的数据')
customerCategoryApi.customerCategoryDelete([{ id: treeRow.id }]).then((res) => {
treeSelectedKeys.value = []
searchFormState.value.categoryId = null
treeRow = {}
tableRef.value.refresh()
customerCategoryApi.customerCategoryTree().then((res) => {
treeData.value = res
})
})
}
const successful = () => {
treeSelectedKeys.value = []
searchFormState.value.categoryId = null
treeRow = {}
tableRef.value.refresh()
customerCategoryApi.customerCategoryTree().then((res) => {
treeData.value = res
})
}
onMounted(() => {
customerCategoryApi.customerCategoryTree().then((res) => {
console.log(res)
treeData.value = res
})
})
</script>

View File

@ -23,24 +23,24 @@
:formItems="baseFormItems"
:model="formData"
:rules="formRules"
ref="formRef1"
ref="formRef2"
/>
</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>
</a-card>
</template>
<script setup>
<script setup name="stashDetail">
import { required } from '@/utils/formRules'
import officialAccountApi from '@/api/base/wx/officialAccountApi'
import sysStoreApi from '@/api/base/store/sysStoreApi'
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';
import DynamicTable from '@/components/DynamicTable/index.vue'
const formRules = {
name: [required('请输入名称')],
@ -53,11 +53,10 @@
{
label: '编码:',
name: 'number',
type: 'a-select',
type: 'a-input',
span: 6,
attrs: {
placeholder: '请选择类型',
options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
placeholder: '请选择编码'
}
},
{
@ -73,12 +72,12 @@
},
{
label: '仓库条码:',
name: 'name',
name: 'barcode',
type: 'a-input',
span: 6,
rules: [required('请输入名称')],
rules: [required('请输入仓库条码')],
attrs: {
placeholder: '请输入名称',
placeholder: '请输入仓库条码',
allowClear: true
}
},
@ -95,14 +94,15 @@
},
{
label: '库存管理方式:',
name: 'name',
type: 'a-input',
name: 'manageMode',
type: 'a-select',
span: 6,
rules: [required('请输入名称')],
rules: [required('请选择库存管理方式')],
attrs: {
placeholder: '请输入名称',
allowClear: true
}
placeholder: '请选择库存管理方式',
options: tool.dictList('STORE_MANAGE_MODE')
},
defaultValue: ''
},
{
label: '备注:',
@ -119,55 +119,52 @@
const baseFormItems = [
{
label: '管理员:',
name: 'number',
name: 'manageUserId',
type: 'a-select',
span: 6,
attrs: {
placeholder: '请选择类型',
placeholder: '请选择管理员',
options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
}
},
{
label: '手机:',
name: 'number',
type: 'a-select',
name: 'phone',
type: 'a-input',
span: 6,
attrs: {
placeholder: '请选择类型',
options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
placeholder: '请输入手机'
}
},
{
label: '固话:',
name: 'number',
type: 'a-select',
name: 'tel',
type: 'a-input',
span: 6,
attrs: {
placeholder: '请选择类型',
options: tool.dictList('OFFICIAL_ACCOUNT_TYPE')
placeholder: '请选择固话'
}
},
{
label: '地址:',
name: 'remarks',
name: 'address',
type: 'a-textarea',
span: 24,
attrs: {
placeholder: '请输入备注',
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
submitForm: sysStoreApi.sysStoreSubmitForm,
getDetail: sysStoreApi.sysStoreDetail
}
)

View File

@ -6,36 +6,67 @@
:destroy-on-close="true"
@close="onClose"
>
<a-form ref="formRef" :model="formData" :rules="formRules" layout="horizontal">
<a-form ref="formRef" :model="formData" :rules="formRules" layout="vertical">
<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-col :span="24">
<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-col :span="24">
<a-form-item label="类型:" name="type">
<a-select
v-model:value="formData.type"
placeholder="请选择组织类型"
:options="typeOptions"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="厂家名称:" name="manufacturer">
<a-col :span="24">
<a-form-item label="工厂名称:" name="name">
<a-input 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
v-model:value="formData.manufacturer"
v-model:value="formData.storeId"
style="width: 100%"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
:tree-data="treeData"
placeholder="Please select"
placeholder="请选择仓库名称"
:fieldNames="{
children: 'children',
label: 'name',
value: 'id'
}"
>
</a-tree-select>
</a-form-item>
</a-col>
<a-col :span="12">
<a-col :span="24">
<a-form-item label="上级仓库:" name="parentId" v-if="formData.type !== 'FACTORY'">
<a-tree-select
v-model:value="formData.parentId"
style="width: 100%"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
:tree-data="parentTreeData"
placeholder="请选择上级仓库"
:fieldNames="{
children: 'children',
label: 'name',
value: 'id'
}"
>
</a-tree-select>
</a-form-item>
</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-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="启用状态:" name="enabledState">
<a-select
v-model:value="formData.enabledState"
@ -64,7 +95,10 @@
const emit = defineEmits({ successful: null })
const formRef = ref()
//
const formData = ref({})
const formData = ref({
type: 'FACTORY',
enabledState: 'ENABLE'
})
const submitLoading = ref(false)
const typeOptions = ref([])
const enabledStateOptions = ref([])
@ -76,11 +110,15 @@
let recordData = cloneDeep(record)
formData.value = Object.assign({}, recordData)
}
typeOptions.value = tool.dictList('GENDER')
typeOptions.value = tool.dictList('PRODUCTION_ORGANIZATION_TYPE')
enabledStateOptions.value = tool.dictList('COMMON_STATUS')
sysStoreApi.sysStoreTree().then(res => {
console.log(res)
sysStoreApi.sysStoreTree().then((res) => {
treeData.value = res || []
})
productionOrganizationApi.productionOrganizationTree().then((res) => {
parentTreeData.value = res
})
}
//
@ -90,7 +128,11 @@
visible.value = false
}
//
const formRules = {}
const formRules = {
name: [required('请输入名称')],
type: [required('请输入类型')],
parentId: [required('请选择上级仓库')],
}
//
const onSubmit = () => {
formRef.value.validate().then(() => {
@ -108,32 +150,8 @@
})
}
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'
}
]
let treeData = ref([])
let parentTreeData = ref([])
//
defineExpose({
onOpen

View File

@ -21,64 +21,81 @@
</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-row :gutter="24">
<a-col :span="4">
<a-directory-tree
v-model:expandedKeys="expandedKeys"
v-model:selectedKeys="selectedKeys"
multiple
:fieldNames="{
children: 'children',
title: 'name',
key: 'id'
}"
:tree-data="treeData"
></a-directory-tree>
</a-col>
<a-col :span="20">
<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('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
})
"
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-col>
</a-row>
</a-card>
<TissueForm ref="TissueFormRef"></TissueForm>
@ -156,4 +173,16 @@
)
const TissueFormRef = ref(null)
//
const expandedKeys = ref(['0-0', '0-1'])
const selectedKeys = ref([])
let treeData = ref([])
onMounted(() => {
productionOrganizationApi.productionOrganizationTree().then((res) => {
console.log(res)
treeData.value = res
})
})
</script>

View File

@ -3,9 +3,6 @@
<template #extra>
<a-button key="1" type="primary" @click="onSubmit"></a-button>
</template>
<template #title>
<span style="font-size: 18px">新增</span>
</template>
</a-page-header>
<a-card :bordered="false" title="基本信息">
<a-form ref="formRef" :model="formData" :rules="formRules" layout="vertical">

View File

@ -8,8 +8,8 @@
</a-form-item>
</a-col>
<a-col :span="6">
<a-form-item label="状态" name="state">
<a-select v-model:value="searchFormState.state" placeholder="请选择状态" :options="stateOptions" />
<a-form-item label="状态" name="enabledState">
<a-select v-model:value="searchFormState.enabledState" placeholder="请选择状态" :options="stateOptions" />
</a-form-item>
</a-col>
<a-col :span="6">
@ -26,13 +26,8 @@
/>
</a-form-item>
</a-col>
<a-col :span="6" v-show="advanced">
<a-form-item label="单位组id" name="unitGroupId">
<a-input v-model:value="searchFormState.unitGroupId" placeholder="请输入单位组id" />
</a-form-item>
</a-col>
<a-col :span="6">
<a-button type="primary" @click="tableRef.refresh()"></a-button>
<a-button type="primary" @click="unitTableRef.refresh()"></a-button>
<a-button style="margin: 0 8px" @click="reset"></a-button>
<a @click="toggleAdvanced" style="margin-left: 8px">
{{ advanced ? '收起' : '展开' }}
@ -56,23 +51,21 @@
@plusRowData="handlePlusRowData"
@editRowData="handleEditRowData"
@deleteRowData="handleDeleteRowData"
:rowSelection="{
type: 'radio',
onChange: unitGroupOnChange
}"
:rowSelection="unitGroupRowSelection"
>
<template #operator class="table-operator">
<span>单位组</span>
</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>
</s-table>
@ -111,13 +104,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 === 'isBase'">
{{ $TOOL.dictTypeData('YES_NO', record.isBase) }}
@ -233,7 +227,7 @@
//
const reset = () => {
searchFormRef.value.resetFields()
tableRef.value.refresh(true)
unitTableRef.value.refresh(true)
}
//
const deleteSysUnit = (record) => {
@ -243,13 +237,13 @@
}
]
sysUnitApi.sysUnitDelete(params).then(() => {
tableRef.value.refresh(true)
unitTableRef.value.refresh(true)
})
}
//
const deleteBatchSysUnit = (params) => {
sysUnitApi.sysUnitDelete(params).then(() => {
tableRef.value.clearRefreshSelected()
unitTableRef.value.clearRefreshSelected()
})
}
const stateOptions = tool.dictList('COMMON_STATUS')
@ -260,7 +254,19 @@
//
let unitGroupRecord = ''
let unitGroupSelectedRowKeys = ref([])
const unitGroupRowSelection = {
type: 'radio',
onChange: (selectedRowKey, selectedRows) => {
unitGroupRecord = selectedRows[0]
searchFormState.value.unitGroupId = selectedRowKey[0]
unitTableRef.value.refresh()
unitGroupSelectedRowKeys.value = selectedRowKey
}
}
const handlePlusRowData = () => {
unitGroupRecord = ''
unitGroupTableRef.value.clearSelected()
UnitGroupFormRef.value.onOpen()
}
@ -278,17 +284,16 @@
}
])
.then(() => {
searchFormState.value.unitGroupId = ''
unitGroupTableRef.value.clearSelected()
unitGroupTableRef.value.refresh()
})
}
const successful = () => {
searchFormState.value.unitGroupId = ''
unitGroupTableRef.value.refresh()
}
const unitGroupOnChange = (value, selectedOptions) => {
unitGroupRecord = selectedOptions[0]
searchFormState.value.unitGroupId = value[0]
unitTableRef.value.refresh()
unitGroupRecord = ''
unitGroupTableRef.value.clearSelected()
}
</script>