123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- <template>
- <a-drawer :title="title" :width="850" :open="visible" :destroy-on-close="true" @close="onClose">
- <a-card :bordered="false" class="mb-2">
- <s-table
- ref="tableRef"
- :columns="columns"
- :data="loadData"
- bordered
- :row-key="(record) => record.id"
- >
- <template #operator class="table-operator">
- <a-space>
- <a-button type="primary" @click="formRef.onOpen()" v-if="hasPerm('bizSupplierTransportAdd')">
- <template #icon><plus-outlined /></template>
- 新增
- </a-button>
- </a-space>
- </template>
- <template #bodyCell="{ column, record }">
- <template v-if="column.dataIndex === 'action'">
- <a-space>
- <a @click="formRef.onOpen(record)" v-if="hasPerm('bizSupplierTransportEdit')">编辑</a>
- <a-divider type="vertical" v-if="hasPerm(['bizSupplierTransportEdit', 'bizSupplierTransportDelete'], 'and')" />
- <a-button type="link" danger size="small" v-if="hasPerm('bizSupplierTransportDelete')" @click="deleteConfig(record)">删除</a-button>
- </a-space>
- </template>
- </template>
- </s-table>
- </a-card>
- </a-drawer>
- <Form ref="formRef" @successful="tableRef.refresh()" />
- </template>
- <script setup name="bizsuppliertransport">
- import { cloneDeep } from 'lodash-es'
- import Form from './transportForm.vue'
- import bizSupplierTransportApi from '@/api/biz/bizSupplierTransportApi'
- import {ExclamationCircleOutlined} from '@ant-design/icons-vue';
- import {Modal} from 'ant-design-vue';
- import {createVNode} from 'vue';
-
- const submitLoading = ref(false)
- const toolConfig = { refresh: true, height: false, columnSetting: false, striped: false }
- // 默认是关闭状态
- const visible = ref(false)
- const searchFormState = ref({})
- const tableRef = ref()
- const formRef = ref()
- const recordData = ref()
- const title = ref()
-
- const columns = [
- {
- title: '序号',
- width: 50,
- dataIndex: 'serial',
- align:'center'
- },
- {
- title: '运输类型 1:汽运 2:船运',
- dataIndex: 'transportType',
- align: 'center',
- },
- {
- title: '运输号',
- dataIndex: 'transportNo',
- align: 'center',
- },
- {
- title: '创建时间',
- dataIndex: 'createTime',
- align: 'center'
- },
- ]
- // 操作栏通过权限判断是否显示
- if (hasPerm(['bizSupplierTransportEdit', 'bizSupplierTransportDelete'])) {
- columns.push({
- title: '操作',
- dataIndex: 'action',
- align: 'center',
- width: 150
- })
- }
- // 打开抽屉
- const onOpen = (record) => {
- recordData.value = record
- title.value = "【" + record.supplierName + "】-运输车辆/船舶管理"
- searchFormState.value = {
- supplierId: record.id
- }
- visible.value = true
- }
- const loadData = (parameter) => {
- return bizSupplierTransportApi.bizSupplierTransportPage(Object.assign(parameter, searchFormState.value)).then((data) => {
- return data
- })
- }
- // 关闭抽屉
- const onClose = () => {
- visible.value = false
- }
- // 删除
- const deleteConfig = (record) => {
- Modal.confirm({
- title: '确定删除该数据吗?',
- icon: createVNode(ExclamationCircleOutlined),
- content: '',
- onOk() {
- submitLoading.value = true
- let params = [
- {
- id: record.id
- }
- ]
- bizLoadTimeApi
- .bizLoadTimeDelete(params)
- .then(() => {
- tableRef.value.refresh(true)
- })
- .finally(() => {
- submitLoading.value = false
- })
- },
- onCancel() {}
- })
- }
- // 调用这个函数将子组件的一些数据和方法暴露出去
- defineExpose({
- onOpen
- })
- </script>
|