费用申请
commit
cf472fece1
@ -0,0 +1,181 @@
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
:use-wrapper="true"
|
||||
title="派车信息"
|
||||
width="70%"
|
||||
@register="registerModal"
|
||||
>
|
||||
<BasicTable @register="registerOpBusinessTruckTable">
|
||||
<template #tableTitle>
|
||||
<div class="buttonGroup">
|
||||
<div class="nav" @click="AddOpBusinessTruck">
|
||||
<i class="iconfont icon-jiahao2fill"></i>新增
|
||||
</div>
|
||||
<a-popconfirm
|
||||
title="确定要删除所选数据?"
|
||||
ok-text="确定"
|
||||
cancel-text="取消"
|
||||
@confirm="FnClickDel"
|
||||
>
|
||||
<div class="nav"> <i class="iconfont icon-shanchu"></i>删除 </div>
|
||||
</a-popconfirm>
|
||||
</div>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'action'">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
icon: 'clarity:note-edit-line',
|
||||
tooltip: '编辑',
|
||||
onClick: FnEditOpBusinessTruck.bind(null, record),
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<OpBusinessTruckEdit
|
||||
:business-id="businessId"
|
||||
@register="registerOpBusinessTruckModal"
|
||||
@success="handleSuccess"
|
||||
/>
|
||||
<!--右下角按钮-->
|
||||
<template #footer>
|
||||
<span></span>
|
||||
</template>
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue'
|
||||
import { columns, searchFormSchema } from './OpBusinessTruckColumns'
|
||||
import { BasicModal, useModalInner, useModal } from '/@/components/Modal'
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'
|
||||
import { GetOpBusinessTruckList, BatchDelOpBusinessTruck } from './LetterApi'
|
||||
import OpBusinessTruckEdit from './OpBusinessTruckEdit.vue'
|
||||
import { useMessage } from '/@/hooks/web/useMessage'
|
||||
const { notification } = useMessage()
|
||||
// 声明Emits
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const businessId = ref()
|
||||
const [registerModal] = useModalInner(async (data) => {
|
||||
businessId.value = data.id
|
||||
})
|
||||
const [registerOpBusinessTruckTable, { reload, getForm, getPaginationRef, getSelectRows }] =
|
||||
useTable({
|
||||
api: async (p) => {
|
||||
const res: API.DataResult = await GetOpBusinessTruckList(p)
|
||||
return new Promise((resolve) => {
|
||||
resolve({ data: [...res.data], total: res.count })
|
||||
})
|
||||
},
|
||||
resizeHeightOffset: 200,
|
||||
beforeFetch: () => {
|
||||
var currentPageInfo: any = getPaginationRef()
|
||||
var data = getForm().getFieldsValue()
|
||||
const postParam: API.PageRequest = {
|
||||
queryCondition: '',
|
||||
pageCondition: {
|
||||
pageIndex: currentPageInfo.current,
|
||||
pageSize: currentPageInfo.pageSize,
|
||||
sortConditions: [],
|
||||
},
|
||||
}
|
||||
let condition: API.ConditionItem[] = []
|
||||
condition.push({
|
||||
FieldName: 'businessId',
|
||||
FieldValue: businessId.value,
|
||||
ConditionalType: 1,
|
||||
})
|
||||
if (!!data.toName) {
|
||||
condition.push({
|
||||
FieldName: 'toName',
|
||||
FieldValue: data.toName,
|
||||
ConditionalType: 1,
|
||||
})
|
||||
}
|
||||
if (!!data.toAttn) {
|
||||
condition.push({
|
||||
FieldName: 'toAttn',
|
||||
FieldValue: data.toAttn,
|
||||
ConditionalType: 1,
|
||||
})
|
||||
}
|
||||
if (!!data.fromName) {
|
||||
condition.push({
|
||||
FieldName: 'fromName',
|
||||
FieldValue: data.fromName,
|
||||
ConditionalType: 1,
|
||||
})
|
||||
}
|
||||
postParam.queryCondition = JSON.stringify(condition)
|
||||
|
||||
return postParam
|
||||
},
|
||||
columns,
|
||||
formConfig: {
|
||||
labelWidth: 160,
|
||||
schemas: searchFormSchema,
|
||||
},
|
||||
isTreeTable: false,
|
||||
pagination: true,
|
||||
striped: true,
|
||||
useSearchForm: true,
|
||||
showTableSetting: true,
|
||||
bordered: true,
|
||||
showIndexColumn: true,
|
||||
indexColumnProps: {
|
||||
fixed: 'left',
|
||||
},
|
||||
canResize: true,
|
||||
actionColumn: {
|
||||
width: 80,
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
fixed: 'right',
|
||||
},
|
||||
rowSelection: { type: 'checkbox' },
|
||||
})
|
||||
|
||||
const [registerOpBusinessTruckModal, { openModal }] = useModal()
|
||||
function AddOpBusinessTruck() {
|
||||
openModal(true, {
|
||||
isParent: false,
|
||||
isUpdate: false,
|
||||
businessId: businessId.value,
|
||||
})
|
||||
}
|
||||
// 删除
|
||||
function FnClickDel() {
|
||||
if (getSelectRows().length) {
|
||||
let Apidata: any = {
|
||||
ids: [],
|
||||
}
|
||||
getSelectRows().forEach((item) => {
|
||||
Apidata.ids.push(item.id)
|
||||
})
|
||||
BatchDelOpBusinessTruck(Apidata).then((res) => {
|
||||
if (res.succeeded) {
|
||||
notification.success({ message: '删除成功', duration: 3 })
|
||||
handleSuccess()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
notification.warning({ message: '请至少选择一条数据', duration: 3 })
|
||||
}
|
||||
}
|
||||
function FnEditOpBusinessTruck(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
})
|
||||
}
|
||||
function handleSuccess() {
|
||||
// businessId.value = 0
|
||||
reload()
|
||||
}
|
||||
</script>
|
||||
<style lang="less">
|
||||
@import url('/@/styles/buttonGroup.scss');
|
||||
</style>
|
Loading…
Reference in New Issue