pc_vue_admin/src/views/basicData/tissue/index.vue

189 lines
5.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<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">
<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>
</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)
// 树级结构
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>