|
|
|
@ -1,3 +1,8 @@
|
|
|
|
|
<!--
|
|
|
|
|
* @Desc:
|
|
|
|
|
* @Author: lijj
|
|
|
|
|
* @Date: 2024-07-26 19:41:41
|
|
|
|
|
-->
|
|
|
|
|
<template>
|
|
|
|
|
<BasicModal
|
|
|
|
|
v-bind="$attrs"
|
|
|
|
@ -6,148 +11,33 @@
|
|
|
|
|
width="90%"
|
|
|
|
|
@register="registerModal"
|
|
|
|
|
>
|
|
|
|
|
<a-row :gutter="16">
|
|
|
|
|
<a-col :span="6">
|
|
|
|
|
<BasicTable @register="registerOpBusinessYardTable" @row-click="onRowClick">
|
|
|
|
|
<template #tableTitle>
|
|
|
|
|
<div class="buttonGroup">
|
|
|
|
|
<a-button type="link" @click="FnClickAdd" class="pl0">
|
|
|
|
|
<span class="iconfont icon-new_document"></span>
|
|
|
|
|
新建
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-popconfirm
|
|
|
|
|
title="确定要删除所选数据?"
|
|
|
|
|
ok-text="确定"
|
|
|
|
|
cancel-text="取消"
|
|
|
|
|
@confirm="FnClickDel"
|
|
|
|
|
>
|
|
|
|
|
<a-button type="link">
|
|
|
|
|
<span class="iconfont icon-shanchu21"></span>
|
|
|
|
|
删除
|
|
|
|
|
</a-button>
|
|
|
|
|
</a-popconfirm>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</BasicTable>
|
|
|
|
|
</a-col>
|
|
|
|
|
<a-col :span="18" class="OPCol">
|
|
|
|
|
<OpBusinessYardEdit
|
|
|
|
|
ref="YardEdit"
|
|
|
|
|
:business-id="businessId"
|
|
|
|
|
:select-id="selectId"
|
|
|
|
|
@success="handleSuccess"
|
|
|
|
|
/>
|
|
|
|
|
</a-col>
|
|
|
|
|
</a-row>
|
|
|
|
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
<span></span>
|
|
|
|
|
<el-button @click="closeModal">取消</el-button>
|
|
|
|
|
<el-button type="primary" @click="save">确认</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</BasicModal>
|
|
|
|
|
</template>
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
import { columns } from './OpBusinessYardColumns'
|
|
|
|
|
import { BasicModal, useModalInner } from '/@/components/Modal'
|
|
|
|
|
import { BasicTable, useTable } from '/@/components/Table'
|
|
|
|
|
import { GetOpBusinessYardList, BatchDelOpBusinessYard } from './LetterApi'
|
|
|
|
|
import OpBusinessYardEdit from './OpBusinessYardEdit.vue'
|
|
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'
|
|
|
|
|
const { notification } = useMessage()
|
|
|
|
|
// 声明Emits
|
|
|
|
|
const emit = defineEmits(['success', 'register'])
|
|
|
|
|
const businessId = ref()
|
|
|
|
|
const selectId = ref()
|
|
|
|
|
const [registerModal] = useModalInner((data) => {
|
|
|
|
|
businessId.value = data.id
|
|
|
|
|
})
|
|
|
|
|
const [
|
|
|
|
|
registerOpBusinessYardTable,
|
|
|
|
|
{ reload, setSelectedRowKeys, clearSelectedRowKeys, getSelectRows },
|
|
|
|
|
] = useTable({
|
|
|
|
|
api: async (p) => {
|
|
|
|
|
const res: API.DataResult = await GetOpBusinessYardList(p)
|
|
|
|
|
setSelectedRowKeys([res.data[0].id])
|
|
|
|
|
selectId.value = res.data[0].id
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
resolve({ data: [...res.data], total: res.count })
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
resizeHeightOffset: 200,
|
|
|
|
|
beforeFetch: () => {
|
|
|
|
|
const postParam: API.PageRequest = {
|
|
|
|
|
queryCondition: '',
|
|
|
|
|
pageCondition: {
|
|
|
|
|
pageIndex: 1,
|
|
|
|
|
pageSize: 99999,
|
|
|
|
|
sortConditions: [],
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
let condition: API.ConditionItem[] = []
|
|
|
|
|
condition.push({
|
|
|
|
|
FieldName: 'businessId',
|
|
|
|
|
FieldValue: businessId.value,
|
|
|
|
|
ConditionalType: 1,
|
|
|
|
|
})
|
|
|
|
|
postParam.queryCondition = JSON.stringify(condition)
|
|
|
|
|
|
|
|
|
|
return postParam
|
|
|
|
|
},
|
|
|
|
|
rowKey: 'id',
|
|
|
|
|
columns,
|
|
|
|
|
isTreeTable: false,
|
|
|
|
|
pagination: false,
|
|
|
|
|
striped: true,
|
|
|
|
|
showTableSetting: false,
|
|
|
|
|
bordered: true,
|
|
|
|
|
showIndexColumn: false,
|
|
|
|
|
autoCreateKey: false,
|
|
|
|
|
indexColumnProps: {
|
|
|
|
|
fixed: 'left',
|
|
|
|
|
},
|
|
|
|
|
canResize: true,
|
|
|
|
|
rowSelection: {
|
|
|
|
|
type: 'radio',
|
|
|
|
|
onSelect: (e) => {
|
|
|
|
|
selectId.value = e.id
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
const [registerModal, { closeModal }] = useModalInner((data) => {
|
|
|
|
|
businessId.value = data.info
|
|
|
|
|
})
|
|
|
|
|
// 场站编辑组件
|
|
|
|
|
const YardEdit = ref(null)
|
|
|
|
|
// 行点击事件
|
|
|
|
|
const onRowClick = (record) => {
|
|
|
|
|
YardEdit.value.setFieldsValue({
|
|
|
|
|
...record,
|
|
|
|
|
})
|
|
|
|
|
YardEdit.value.setFieldsValue1({
|
|
|
|
|
...record
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// 删除
|
|
|
|
|
function FnClickDel() {
|
|
|
|
|
if (getSelectRows().length) {
|
|
|
|
|
let Apidata: any = {
|
|
|
|
|
ids: [],
|
|
|
|
|
}
|
|
|
|
|
getSelectRows().forEach((item) => {
|
|
|
|
|
Apidata.ids.push(item.id)
|
|
|
|
|
})
|
|
|
|
|
BatchDelOpBusinessYard(Apidata).then((res) => {
|
|
|
|
|
if (res.succeeded) {
|
|
|
|
|
notification.success({ message: '删除成功', duration: 3 })
|
|
|
|
|
handleSuccess()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
notification.warning({ message: '请至少选择一条数据', duration: 3 })
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function FnClickAdd() {
|
|
|
|
|
clearSelectedRowKeys()
|
|
|
|
|
selectId.value = ''
|
|
|
|
|
}
|
|
|
|
|
async function handleSuccess() {
|
|
|
|
|
await reload()
|
|
|
|
|
// 保存
|
|
|
|
|
const save = async () => {
|
|
|
|
|
await YardEdit.value.handleSave()
|
|
|
|
|
closeModal()
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|