szh-new
张同海 5 months ago
parent c92ade2d9b
commit 3f19a6f0cc

@ -18,7 +18,8 @@ import {
GetClientFrtSelectList, GetClientFrtSelectList,
GetServiceSelectList, GetServiceSelectList,
GetPackageSelectList, GetPackageSelectList,
GetTruckClientList GetTruckClientList,
GetDispatcherList,
} from '/@/views/operation/seaexport/api/BookingLedger' } from '/@/views/operation/seaexport/api/BookingLedger'
import { GetFeeCurrencySelectList } from '/@/api/common/index' import { GetFeeCurrencySelectList } from '/@/api/common/index'
export default { export default {
@ -118,4 +119,10 @@ export default {
return res.data return res.data
}) })
}, },
//派车调度人员
GetDispatcherList: () => {
return GetDispatcherList().then((res) => {
return res.data
})
},
} }

@ -42,6 +42,8 @@ export const useOptionsStore = defineStore({
GetFeeCurrencySelectList: null, GetFeeCurrencySelectList: null,
// 币别 // 币别
GetTruckClientList: null, GetTruckClientList: null,
// 派车调度人员
GetDispatcherList:null
}), }),
getters: { getters: {
// 通过code获取下拉字典code)就是接口尾部单词 // 通过code获取下拉字典code)就是接口尾部单词

@ -404,6 +404,14 @@ export function GetSaleList(parameter) {
params: parameter, params: parameter,
}) })
} }
// 获取派车调度人员列表 (Auth)
export function GetDispatcherList(parameter) {
return request({
url: '/mainApi/ClientCommon/GetDispatcherList',
method: 'get',
params: parameter,
})
}
/** /**
* 分页查询订舱主表 * 分页查询订舱主表
* @params PageSize * @params PageSize

@ -6,6 +6,7 @@ import { useComponentRegister } from '/@/components/Form'
useComponentRegister('Space', Space) useComponentRegister('Space', Space)
const optionsStore = useOptionsStore() const optionsStore = useOptionsStore()
import { getOptions } from '/@/hooks/dict' import { getOptions } from '/@/hooks/dict'
import { getDictOption } from '/@/utils/dictUtil'
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [
{ {
title: '车队名称', title: '车队名称',
@ -427,10 +428,20 @@ export const formSchema: FormSchema[] = [
{ {
label: '结算方式', label: '结算方式',
field: 'payType', field: 'payType',
component: 'Select', component: 'ApiSelect',
defaultValue: '', required: false,
colProps: { dynamicDisabled: false,
span: 6, colProps: { span: 6 },
componentProps: ({ formModel }) => {
return {
immediate: false,
option: optionsStore.getOptionsByCode('GetClientStlModeSelectList'),
labelField: 'stlName',
valueField: 'id',
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
}
}, },
}, },
{ {
@ -605,12 +616,29 @@ export const formSchema: FormSchema[] = [
}, },
}, },
{ {
label: '派车状态',
field: 'truckStatus', field: 'truckStatus',
component: 'Select', label: '派车状态',
defaultValue: '', component: 'ApiSelect',
colProps: { dynamicDisabled: false,
span: 6, colProps: { span: 6 },
componentProps: () => {
return {
allowClear: true,
showSearch: true,
api: () => {
return new Promise((resolve) => {
getDictOption('truck_status').then((res) => {
resolve(res)
})
})
},
labelField: 'label',
valueField: 'value',
resultField: 'data',
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
}
}, },
}, },
{ {
@ -769,12 +797,31 @@ export const formSchema: FormSchema[] = [
}, },
}, },
{ {
label: '调度人员名称',
field: 'dispatcherId', field: 'dispatcherId',
component: 'Select', label: '调度人员名称',
component: 'ApiSelect',
defaultValue: '', defaultValue: '',
colProps: { colProps: { span: 6 },
span: 6, componentProps: ({ formModel }) => {
return {
// style: 'width:100%',
allowClear: true,
showSearch: true,
option: optionsStore.getOptionsByCode('GetDispatcherList'),
labelField: 'userName',
valueField: 'id',
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
onChange: (e, obj) => {
if (obj) {
console.log(obj)
formModel.dispatcherName = obj.userName
} else {
formModel.dispatcherName = ''
}
},
}
}, },
}, },
{ {

@ -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>

@ -3,45 +3,38 @@
v-bind="$attrs" v-bind="$attrs"
:use-wrapper="true" :use-wrapper="true"
title="派车信息" title="派车信息"
width="70%" width="90%"
@register="registerModal" @register="registerModal"
> >
<BasicTable @register="registerOpBusinessTruckTable"> <a-row>
<template #tableTitle> <a-col :span="6">
<div class="buttonGroup"> <BasicTable @register="registerOpBusinessTruckTable">
<div class="nav" @click="AddOpBusinessTruck"> <template #tableTitle>
<i class="iconfont icon-jiahao2fill"></i>新增 <div class="buttonGroup">
</div> <div class="nav" @click="FnClickAdd">
<a-popconfirm <i class="iconfont icon-jiahao2fill"></i>新建
title="确定要删除所选数据?" </div>
ok-text="确定" <a-popconfirm
cancel-text="取消" title="确定要删除所选数据?"
@confirm="FnClickDel" ok-text="确定"
> cancel-text="取消"
<div class="nav"> <i class="iconfont icon-shanchu"></i>删除 </div> @confirm="FnClickDel"
</a-popconfirm> >
</div> <div class="nav"> <i class="iconfont icon-shanchu"></i>删除 </div>
</template> </a-popconfirm>
<template #bodyCell="{ column, record }"> </div>
<template v-if="column.key === 'action'"> </template>
<TableAction </BasicTable>
:actions="[ </a-col>
{ <a-col :span="18" class="OPCol">
icon: 'clarity:note-edit-line', <OpBusinessTruckEdit
tooltip: '编辑', :business-id="businessId"
onClick: FnEditOpBusinessTruck.bind(null, record), :select-id="selectId"
}, @success="handleSuccess"
]" />
/> </a-col>
</template> </a-row>
</template>
</BasicTable>
<OpBusinessTruckEdit
:business-id="businessId"
@register="registerOpBusinessTruckModal"
@success="handleSuccess"
/>
<!--右下角按钮-->
<template #footer> <template #footer>
<span></span> <span></span>
</template> </template>
@ -49,7 +42,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue' import { ref } from 'vue'
import { columns, searchFormSchema } from './OpBusinessTruckColumns' import { columns } from './OpBusinessYardColumns'
import { BasicModal, useModalInner, useModal } from '/@/components/Modal' import { BasicModal, useModalInner, useModal } from '/@/components/Modal'
import { BasicTable, useTable, TableAction } from '/@/components/Table' import { BasicTable, useTable, TableAction } from '/@/components/Table'
import { GetOpBusinessTruckList, BatchDelOpBusinessTruck } from './LetterApi' import { GetOpBusinessTruckList, BatchDelOpBusinessTruck } from './LetterApi'
@ -59,93 +52,65 @@
// Emits // Emits
const emit = defineEmits(['success', 'register']) const emit = defineEmits(['success', 'register'])
const businessId = ref() const businessId = ref()
const [registerModal] = useModalInner(async (data) => { const selectId = ref()
const [registerModal] = useModalInner((data) => {
businessId.value = data.id businessId.value = data.id
}) })
const [registerOpBusinessTruckTable, { reload, getForm, getPaginationRef, getSelectRows }] = const [
useTable({ registerOpBusinessTruckTable,
api: async (p) => { { reload, setSelectedRowKeys, clearSelectedRowKeys, getSelectRows },
const res: API.DataResult = await GetOpBusinessTruckList(p) ] = useTable({
return new Promise((resolve) => { api: async (p) => {
resolve({ data: [...res.data], total: res.count }) const res: API.DataResult = await GetOpBusinessTruckList(p)
}) setSelectedRowKeys([res.data[0].id])
}, selectId.value = res.data[0].id
resizeHeightOffset: 200, return new Promise((resolve) => {
beforeFetch: () => { resolve({ data: [...res.data], total: res.count })
var currentPageInfo: any = getPaginationRef() })
var data = getForm().getFieldsValue() },
const postParam: API.PageRequest = { resizeHeightOffset: 200,
queryCondition: '', beforeFetch: () => {
pageCondition: { const postParam: API.PageRequest = {
pageIndex: currentPageInfo.current, queryCondition: '',
pageSize: currentPageInfo.pageSize, pageCondition: {
sortConditions: [], pageIndex: 1,
}, pageSize: 99999,
} sortConditions: [],
let condition: API.ConditionItem[] = [] },
condition.push({ }
FieldName: 'businessId', let condition: API.ConditionItem[] = []
FieldValue: businessId.value, condition.push({
ConditionalType: 1, FieldName: 'businessId',
}) FieldValue: businessId.value,
if (!!data.toName) { ConditionalType: 1,
condition.push({ })
FieldName: 'toName', postParam.queryCondition = JSON.stringify(condition)
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 return postParam
}, },
columns, rowKey: 'id',
formConfig: { columns,
labelWidth: 160, isTreeTable: false,
schemas: searchFormSchema, pagination: false,
}, striped: true,
isTreeTable: false, showTableSetting: false,
pagination: true, bordered: true,
striped: true, showIndexColumn: false,
useSearchForm: true, autoCreateKey: false,
showTableSetting: true, indexColumnProps: {
bordered: true, fixed: 'left',
showIndexColumn: true, },
indexColumnProps: { canResize: true,
fixed: 'left', clickToRowSelect: false,
}, rowSelection: {
canResize: true, type: 'radio',
actionColumn: { onSelect: (e) => {
width: 80, console.log(e)
title: '操作', selectId.value = e.id
dataIndex: 'action',
fixed: 'right',
}, },
rowSelection: { type: 'checkbox' }, },
}) })
const [registerOpBusinessTruckModal, { openModal }] = useModal()
function AddOpBusinessTruck() {
openModal(true, {
isParent: false,
isUpdate: false,
businessId: businessId.value,
})
}
// //
function FnClickDel() { function FnClickDel() {
if (getSelectRows().length) { if (getSelectRows().length) {
@ -165,17 +130,18 @@
notification.warning({ message: '请至少选择一条数据', duration: 3 }) notification.warning({ message: '请至少选择一条数据', duration: 3 })
} }
} }
function FnEditOpBusinessTruck(record: Recordable) { function FnClickAdd() {
openModal(true, { clearSelectedRowKeys()
record, selectId.value = ''
isUpdate: true,
})
} }
function handleSuccess() { async function handleSuccess() {
// businessId.value = 0 await reload()
reload()
} }
</script> </script>
<style lang="less"> <style lang="less">
@import url('/@/styles/buttonGroup.scss'); @import url('/@/styles/buttonGroup.scss');
.OPCol {
height: 60vh;
overflow-y: auto;
}
</style> </style>

@ -0,0 +1,362 @@
<template>
<BasicModal
v-bind="$attrs"
:use-wrapper="true"
:title="getTitle"
width="60%"
@register="registerModal"
@ok="handleSave"
>
<BasicForm @register="registerForm" />
<div>
<div class="buttonGroup">
<div class="nav" @click="TableAdd"> <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>
</div>
<hot-table ref="hotTb" :data="list" :settings="settings"></hot-table>
<!--右下角按钮-->
<template #footer>
<a-button
pre-icon="ant-design:close-outlined"
type="warning"
:loading="loading"
ghost
style="margin-right: 0.8rem"
@click="closeModal"
>取消</a-button
>
<a-button
type="success"
:loading="loading"
pre-icon="ant-design:check-outlined"
style="margin-right: 0.8rem"
@click="handleSave(false)"
>仅保存</a-button
>
<a-button
pre-icon="ant-design:check-circle-outlined"
type="primary"
:loading="loading"
@click="handleSave(true)"
>保存并关闭</a-button
>
</template>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, unref, h } from 'vue'
import { BasicModal, useModalInner, useModal } from '/@/components/Modal'
import { BasicForm, useForm } from '/@/components/Form/index'
import { formSchema, BankColumns } from './OpBusinessTruckColumns'
import { EditOpBusinessTruck, GetOpBusinessTruckInfo } from './LetterApi'
import { useMessage } from '/@/hooks/web/useMessage'
import {
GetCtnSelectList,
GetPackageSelectList,
} from '/@/views/operation/seaexport/api/BookingLedger'
import { HotTable } from '@handsontable/vue3'
import { registerAllModules } from 'handsontable/registry'
registerAllModules()
import { propTypes } from '/@/utils/propTypes'
const props = defineProps({
businessId: propTypes.object,
})
init()
// Emits
const emit = defineEmits(['success', 'register'])
const isUpdate = ref(true)
const loading = ref(false)
const rowId = ref('')
const list = ref<any>([])
const { createMessage } = useMessage()
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({
labelWidth: 100,
schemas: formSchema,
showActionButtonGroup: false,
})
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
resetFields()
setModalProps({ confirmLoading: false, loading: true })
isUpdate.value = !!data?.isUpdate
if (unref(isUpdate)) {
// setModalProps({ confirmLoading: true });
rowId.value = data.record.id
const res: API.DataResult = await GetOpBusinessTruckInfo({ id: unref(rowId) })
if (res.succeeded) {
setFieldsValue({
...res.data,
})
}
} else {
setFieldsValue({ permissionIdentity: unref(2) })
}
setModalProps({ loading: false })
})
const getTitle = computed(() => (!unref(isUpdate) ? '新增派车信息' : '编辑派车信息'))
async function handleSave(exit) {
try {
setModalProps({ confirmLoading: true, loading: true })
let ApiData: any = {
truckCtnList: [],
}
const values = await validate()
Object.keys(values).forEach((item) => {
if (item == 'businessId' && !values.businessId) {
ApiData.businessId = props.businessId
} else {
ApiData[item] = values[item]
}
})
ApiData.truckCtnList = list.value
const res: API.DataResult = await EditOpBusinessTruck(ApiData)
if (res.succeeded) {
createMessage.success(res.message)
emit('success')
//
if (!exit) {
if (unref(isUpdate)) {
await refresh()
} else {
rowId.value = res.data
isUpdate.value = true
await refresh()
}
}
} else {
createMessage.error(res.message)
}
exit && closeModal()
} finally {
// loading.value = false;
setModalProps({ confirmLoading: false, loading: false })
}
}
async function refresh() {
const res: API.DataResult = await GetOpBusinessTruckInfo({ id: unref(rowId) })
if (res.succeeded) {
await setFieldsValue({
...res.data,
})
}
}
const ctnDict = ref()
const kindPkgsDict = ref()
async function init() {
await GetCtnSelectList().then((res) => {
ctnDict.value = res.data
})
await GetPackageSelectList().then((res) => {
kindPkgsDict.value = res.data
})
}
function TableAdd() {
list.value.push({ selected: false })
}
//
const columns = [
{
data: 'selected',
type: 'checkbox',
title: ' ',
width: 32,
className: 'htCenter',
readOnly: false,
},
{
title: '主键Id',
width: 80,
data: 'id',
},
{
title: '业务Id',
width: 80,
data: 'pid',
},
{
title: '箱型Id',
width: 80,
data: 'ctnId',
},
{
title: '箱型代码',
width: 80,
data: 'ctnCode',
},
{
title: '箱型',
width: 120,
data: 'ctn',
type: 'dropdown',
// (process)
source: async (query, process) => {
const res = ctnDict.value.length ? ctnDict.value : (await GetCtnSelectList())?.data
if (!ctnDict.value.length) ctnDict.value = res
const dict = res.map((res) => {
return res.ctnName
})
process(dict)
},
},
{
title: '尺寸',
width: 80,
data: 'size',
type: 'numeric',
format: '0',
},
{
title: '箱量',
width: 80,
data: 'ctnNum',
type: 'numeric',
format: '0',
},
{
title: 'TEU',
width: 80,
data: 'teu',
type: 'numeric',
format: '0',
},
{
title: '表现形式',
width: 80,
data: 'ctnAll',
},
{
title: '箱号',
width: 80,
data: 'cntrNo',
},
{
title: '封号',
width: 80,
data: 'sealNo',
},
{
title: '件数',
width: 80,
data: 'pkgs',
type: 'numeric',
format: '0',
},
{
title: '毛重',
width: 80,
data: 'kgs',
type: 'numeric',
format: '0',
},
{
title: '尺码',
width: 80,
data: 'cbm',
type: 'numeric',
format: '0',
},
{
title: '包装',
width: 80,
data: 'kindPkgs',
},
{
title: '包装',
width: 120,
data: 'kindPkgsName',
type: 'dropdown',
// (process)
source: async (query, process) => {
const res = kindPkgsDict.value.length
? kindPkgsDict.value
: (await GetPackageSelectList())?.data
if (!kindPkgsDict.value.length) {
kindPkgsDict.value.splice(0)
res.forEach((e) => {
kindPkgsDict.value.push(e)
})
}
const dict = res.map((res) => {
return res.packageName
})
process(dict)
},
},
]
//
const settings = {
height: '400',
width: '100%',
autoWrapRow: true,
autoWrapCol: true,
//
rowHeights: 32,
fixedColumnsLeft: 1,
//
hiddenColumns: {
columns: [1, 2, 3, 4, 15],
indicators: true,
},
//
enterMoves: 'row',
columnSorting: true,
//
// afterValidate: function (isValid, value, row, prop, source) {
// if (!isValid) {
// hotTb.value.hotInstance.setDataAtRowProp(row, prop, '')
// }
// },
columns: columns,
// ()
licenseKey: 'non-commercial-and-evaluation',
//
async afterChange(changes, source) {
//
if (source === 'edit' || source === 'Autofill.fill' || source === 'CopyPaste.paste') {
let dict: any = {}
if (changes[0][1] === 'ctn') {
const res = ctnDict.value.length ? ctnDict.value : (await GetCtnSelectList())?.data
if (!ctnDict.value.length) ctnDict.value = res
const item = res.filter((item) => {
return item.ctnName === changes[0][3]
})
if (item) dict = item[0]
console.log(dict)
list.value[changes[0][0]]['ctn'] = dict?.ctnName
list.value[changes[0][0]]['ctnCode'] = dict?.ediCode
list.value[changes[0][0]]['ctnId'] = dict?.id
}
if (changes[0][1] === 'kindPkgsName') {
const res = kindPkgsDict.value.length
? kindPkgsDict.value
: (await GetPackageSelectList())?.data
if (!kindPkgsDict.value.length) {
kindPkgsDict.value.splice(0)
res.forEach((e) => {
kindPkgsDict.value.push(e)
})
}
const item = res.filter((item) => {
return item.packageName === changes[0][3]
})
if (item) dict = item[0]
list.value[changes[0][0]]['kindPkgs'] = dict?.id
list.value[changes[0][0]]['kindPkgsName'] = dict?.packageName
}
}
},
}
</script>
<style lang="less">
@import url('/@/styles/buttonGroup.scss');
</style>

@ -1,12 +1,8 @@
<template> <template>
<BasicModal <a-spin :spinning="spinning">
v-bind="$attrs" <div class="buttonGroup">
:use-wrapper="true" <div class="nav" @click="handleSave"> <i class="iconfont icon-jiahao2fill"></i>保存 </div>
:title="getTitle" </div>
width="60%"
@register="registerModal"
@ok="handleSave"
>
<BasicForm @register="registerForm" /> <BasicForm @register="registerForm" />
<div> <div>
<div class="buttonGroup"> <div class="buttonGroup">
@ -22,59 +18,66 @@
</div> </div>
</div> </div>
<hot-table ref="hotTb" :data="list" :settings="settings"></hot-table> <hot-table ref="hotTb" :data="list" :settings="settings"></hot-table>
<!--右下角按钮--> </a-spin>
<template #footer>
<a-button
pre-icon="ant-design:close-outlined"
type="warning"
:loading="loading"
ghost
style="margin-right: 0.8rem"
@click="closeModal"
>取消</a-button
>
<a-button
type="success"
:loading="loading"
pre-icon="ant-design:check-outlined"
style="margin-right: 0.8rem"
@click="handleSave(false)"
>仅保存</a-button
>
<a-button
pre-icon="ant-design:check-circle-outlined"
type="primary"
:loading="loading"
@click="handleSave(true)"
>保存并关闭</a-button
>
</template>
</BasicModal>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed, unref, h } from 'vue' import { ref, watch } from 'vue'
import { BasicModal, useModalInner, useModal } from '/@/components/Modal'
import { BasicForm, useForm } from '/@/components/Form/index' import { BasicForm, useForm } from '/@/components/Form/index'
import { formSchema, BankColumns } from './OpBusinessTruckColumns' import { formSchema } from './OpBusinessTruckColumns'
import { EditOpBusinessTruck, GetOpBusinessTruckInfo } from './LetterApi' import {
import { useMessage } from '/@/hooks/web/useMessage' EditOpBusinessTruck,
GetOpBusinessTruckInfo,
GetTruckCtnList,
BatchDelTruckCtns,
} from './LetterApi'
import { import {
GetCtnSelectList, GetCtnSelectList,
GetPackageSelectList, GetPackageSelectList,
} from '/@/views/operation/seaexport/api/BookingLedger' } from '/@/views/operation/seaexport/api/BookingLedger'
import { useMessage } from '/@/hooks/web/useMessage'
const { notification } = useMessage()
import { HotTable } from '@handsontable/vue3' import { HotTable } from '@handsontable/vue3'
import { registerAllModules } from 'handsontable/registry' import { registerAllModules } from 'handsontable/registry'
registerAllModules() registerAllModules()
import { propTypes } from '/@/utils/propTypes' import { propTypes } from '/@/utils/propTypes'
const props = defineProps({ const props = defineProps({
businessId: propTypes.object, businessId: propTypes.object,
selectId: propTypes.string,
}) })
const spinning = ref(false)
watch(
() => props.selectId,
async (nVal) => {
if (nVal) {
spinning.value = true
list.value.splice(0)
setFieldsValue({})
const res: API.DataResult = await GetOpBusinessTruckInfo({ id: nVal })
if (res.succeeded) {
let ApiData = {
queryCondition: `[{"FieldName":"pid","FieldValue":"${res.data.id}","ConditionalType":1}]`,
pageCondition: {
pageIndex: 1,
pageSize: 99999,
sortConditions: [],
},
}
await setFieldsValue({
...res.data,
})
GetTruckCtnList(ApiData).then((e) => {
list.value.push(...e.data)
spinning.value = false
})
}
} else {
resetFields()
}
},
)
init() init()
// Emits // Emits
const emit = defineEmits(['success', 'register']) const emit = defineEmits(['success', 'register'])
const isUpdate = ref(true)
const loading = ref(false)
const rowId = ref('')
const list = ref<any>([]) const list = ref<any>([])
const { createMessage } = useMessage() const { createMessage } = useMessage()
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({ const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({
@ -83,71 +86,25 @@
showActionButtonGroup: false, showActionButtonGroup: false,
}) })
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => { async function handleSave() {
resetFields() let ApiData: any = {
setModalProps({ confirmLoading: false, loading: true }) truckCtnList: [],
isUpdate.value = !!data?.isUpdate
if (unref(isUpdate)) {
// setModalProps({ confirmLoading: true });
rowId.value = data.record.id
const res: API.DataResult = await GetOpBusinessTruckInfo({ id: unref(rowId) })
if (res.succeeded) {
setFieldsValue({
...res.data,
})
}
} else {
setFieldsValue({ permissionIdentity: unref(2) })
} }
setModalProps({ loading: false }) const values = await validate()
}) Object.keys(values).forEach((item) => {
const getTitle = computed(() => (!unref(isUpdate) ? '新增派车信息' : '编辑派车信息')) if (item == 'businessId' && !values.businessId) {
ApiData.businessId = props.businessId
async function handleSave(exit) {
try {
setModalProps({ confirmLoading: true, loading: true })
let ApiData: any = {
truckCtnList: [],
}
const values = await validate()
Object.keys(values).forEach((item) => {
if (item == 'businessId' && !values.businessId) {
ApiData.businessId = props.businessId
} else {
ApiData[item] = values[item]
}
})
ApiData.truckCtnList = list.value
const res: API.DataResult = await EditOpBusinessTruck(ApiData)
if (res.succeeded) {
createMessage.success(res.message)
emit('success')
//
if (!exit) {
if (unref(isUpdate)) {
await refresh()
} else {
rowId.value = res.data
isUpdate.value = true
await refresh()
}
}
} else { } else {
createMessage.error(res.message) ApiData[item] = values[item]
} }
})
exit && closeModal() ApiData.truckCtnList = list.value
} finally { const res: API.DataResult = await EditOpBusinessTruck(ApiData)
// loading.value = false;
setModalProps({ confirmLoading: false, loading: false })
}
}
async function refresh() {
const res: API.DataResult = await GetOpBusinessTruckInfo({ id: unref(rowId) })
if (res.succeeded) { if (res.succeeded) {
await setFieldsValue({ createMessage.success(res.message)
...res.data, emit('success')
}) } else {
createMessage.error(res.message)
} }
} }
const ctnDict = ref() const ctnDict = ref()
@ -163,6 +120,41 @@
function TableAdd() { function TableAdd() {
list.value.push({ selected: false }) list.value.push({ selected: false })
} }
function FnClickDel() {
let ApiData = { ids: [] }
list.value.forEach((e, i) => {
if (e.selected) {
ApiData.ids.push(e.id)
}
})
BatchDelTruckCtns(ApiData).then(async (e) => {
spinning.value = true
list.value.splice(0)
setFieldsValue({})
const res: API.DataResult = await GetOpBusinessTruckInfo({ id: props.selectId })
if (res.succeeded) {
let ApiData = {
queryCondition: `[{"FieldName":"pid","FieldValue":"${res.data.id}","ConditionalType":1}]`,
pageCondition: {
pageIndex: 1,
pageSize: 99999,
sortConditions: [],
},
}
setFieldsValue({
...res.data,
})
GetTruckCtnList(ApiData).then((e) => {
list.value.push(...e.data)
spinning.value = false
})
}
notification.success({
message: e.message,
duration: 3,
})
})
}
// //
const columns = [ const columns = [
{ {
@ -331,7 +323,6 @@
return item.ctnName === changes[0][3] return item.ctnName === changes[0][3]
}) })
if (item) dict = item[0] if (item) dict = item[0]
console.log(dict)
list.value[changes[0][0]]['ctn'] = dict?.ctnName list.value[changes[0][0]]['ctn'] = dict?.ctnName
list.value[changes[0][0]]['ctnCode'] = dict?.ediCode list.value[changes[0][0]]['ctnCode'] = dict?.ediCode
list.value[changes[0][0]]['ctnId'] = dict?.id list.value[changes[0][0]]['ctnId'] = dict?.id
@ -357,6 +348,3 @@
}, },
} }
</script> </script>
<style lang="less">
@import url('/@/styles/buttonGroup.scss');
</style>

@ -209,26 +209,7 @@ export const columns: BasicColumn[] = [
}, },
] ]
export const searchFormSchema: FormSchema[] = [
{
field: 'toName',
label: 'TO',
component: 'Input',
colProps: { span: 4 },
},
{
field: 'toAttn',
label: 'ATTN',
component: 'Input',
colProps: { span: 4 },
},
{
field: 'fromName',
label: 'FROM',
component: 'Input',
colProps: { span: 4 },
},
]
export const formSchema: FormSchema[] = [ export const formSchema: FormSchema[] = [
{ {
label: '主键Id', label: '主键Id',

@ -2,46 +2,39 @@
<BasicModal <BasicModal
v-bind="$attrs" v-bind="$attrs"
:use-wrapper="true" :use-wrapper="true"
title="电放保函" title="场站入货"
width="70%" width="90%"
@register="registerModal" @register="registerModal"
> >
<BasicTable @register="registerOpBusinessYardTable"> <a-row>
<template #tableTitle> <a-col :span="6">
<div class="buttonGroup"> <BasicTable @register="registerOpBusinessYardTable">
<div class="nav" @click="AddOpBusinessYard"> <template #tableTitle>
<i class="iconfont icon-jiahao2fill"></i>新增 <div class="buttonGroup">
</div> <div class="nav" @click="FnClickAdd">
<a-popconfirm <i class="iconfont icon-jiahao2fill"></i>新建
title="确定要删除所选数据?" </div>
ok-text="确定" <a-popconfirm
cancel-text="取消" title="确定要删除所选数据?"
@confirm="FnClickDel" ok-text="确定"
> cancel-text="取消"
<div class="nav"> <i class="iconfont icon-shanchu"></i>删除 </div> @confirm="FnClickDel"
</a-popconfirm> >
</div> <div class="nav"> <i class="iconfont icon-shanchu"></i>删除 </div>
</template> </a-popconfirm>
<template #bodyCell="{ column, record }"> </div>
<template v-if="column.key === 'action'"> </template>
<TableAction </BasicTable>
:actions="[ </a-col>
{ <a-col :span="18" class="OPCol">
icon: 'clarity:note-edit-line', <OpBusinessYardEdit
tooltip: '编辑', :business-id="businessId"
onClick: FnEditOpBusinessYard.bind(null, record), :select-id="selectId"
}, @success="handleSuccess"
]" />
/> </a-col>
</template> </a-row>
</template>
</BasicTable>
<OpBusinessYardEdit
:business-id="businessId"
@register="registerOpBusinessYardModal"
@success="handleSuccess"
/>
<!--右下角按钮-->
<template #footer> <template #footer>
<span></span> <span></span>
</template> </template>
@ -49,9 +42,9 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue' import { ref } from 'vue'
import { columns, searchFormSchema } from './OpBusinessYardColumns' import { columns } from './OpBusinessYardColumns'
import { BasicModal, useModalInner, useModal } from '/@/components/Modal' import { BasicModal, useModalInner } from '/@/components/Modal'
import { BasicTable, useTable, TableAction } from '/@/components/Table' import { BasicTable, useTable } from '/@/components/Table'
import { GetOpBusinessYardList, BatchDelOpBusinessYard } from './LetterApi' import { GetOpBusinessYardList, BatchDelOpBusinessYard } from './LetterApi'
import OpBusinessYardEdit from './OpBusinessYardEdit.vue' import OpBusinessYardEdit from './OpBusinessYardEdit.vue'
import { useMessage } from '/@/hooks/web/useMessage' import { useMessage } from '/@/hooks/web/useMessage'
@ -59,93 +52,63 @@
// Emits // Emits
const emit = defineEmits(['success', 'register']) const emit = defineEmits(['success', 'register'])
const businessId = ref() const businessId = ref()
const [registerModal] = useModalInner(async (data) => { const selectId = ref()
const [registerModal] = useModalInner((data) => {
businessId.value = data.id businessId.value = data.id
}) })
const [registerOpBusinessYardTable, { reload, getForm, getPaginationRef, getSelectRows }] = const [
useTable({ registerOpBusinessYardTable,
api: async (p) => { { reload, setSelectedRowKeys, clearSelectedRowKeys, getSelectRows },
const res: API.DataResult = await GetOpBusinessYardList(p) ] = useTable({
return new Promise((resolve) => { api: async (p) => {
resolve({ data: [...res.data], total: res.count }) const res: API.DataResult = await GetOpBusinessYardList(p)
}) setSelectedRowKeys([res.data[0].id])
}, selectId.value = res.data[0].id
resizeHeightOffset: 200, return new Promise((resolve) => {
beforeFetch: () => { resolve({ data: [...res.data], total: res.count })
var currentPageInfo: any = getPaginationRef() })
var data = getForm().getFieldsValue() },
const postParam: API.PageRequest = { resizeHeightOffset: 200,
queryCondition: '', beforeFetch: () => {
pageCondition: { const postParam: API.PageRequest = {
pageIndex: currentPageInfo.current, queryCondition: '',
pageSize: currentPageInfo.pageSize, pageCondition: {
sortConditions: [], pageIndex: 1,
}, pageSize: 99999,
} sortConditions: [],
let condition: API.ConditionItem[] = [] },
condition.push({ }
FieldName: 'businessId', let condition: API.ConditionItem[] = []
FieldValue: businessId.value, condition.push({
ConditionalType: 1, FieldName: 'businessId',
}) FieldValue: businessId.value,
if (!!data.toName) { ConditionalType: 1,
condition.push({ })
FieldName: 'toName', postParam.queryCondition = JSON.stringify(condition)
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 return postParam
}, },
columns, rowKey: 'id',
formConfig: { columns,
labelWidth: 120, isTreeTable: false,
schemas: searchFormSchema, pagination: false,
}, striped: true,
isTreeTable: false, showTableSetting: false,
pagination: true, bordered: true,
striped: true, showIndexColumn: false,
useSearchForm: true, autoCreateKey: false,
showTableSetting: true, indexColumnProps: {
bordered: true, fixed: 'left',
showIndexColumn: true, },
indexColumnProps: { canResize: true,
fixed: 'left', rowSelection: {
}, type: 'radio',
canResize: true, onSelect: (e) => {
actionColumn: { selectId.value = e.id
width: 80,
title: '操作',
dataIndex: 'action',
fixed: 'right',
}, },
rowSelection: { type: 'checkbox' }, },
}) })
const [registerOpBusinessYardModal, { openModal }] = useModal()
function AddOpBusinessYard() {
openModal(true, {
isParent: false,
isUpdate: false,
businessId: businessId.value,
})
}
// //
function FnClickDel() { function FnClickDel() {
if (getSelectRows().length) { if (getSelectRows().length) {
@ -165,17 +128,18 @@
notification.warning({ message: '请至少选择一条数据', duration: 3 }) notification.warning({ message: '请至少选择一条数据', duration: 3 })
} }
} }
function FnEditOpBusinessYard(record: Recordable) { function FnClickAdd() {
openModal(true, { clearSelectedRowKeys()
record, selectId.value = ''
isUpdate: true,
})
} }
function handleSuccess() { async function handleSuccess() {
// businessId.value = 0 await reload()
reload()
} }
</script> </script>
<style lang="less"> <style lang="less">
@import url('/@/styles/buttonGroup.scss'); @import url('/@/styles/buttonGroup.scss');
.OPCol {
height: 60vh;
overflow-y: auto;
}
</style> </style>

@ -1,58 +1,41 @@
<template> <template>
<BasicModal <div>
v-bind="$attrs" <div class="buttonGroup">
:use-wrapper="true" <div class="nav" @click="handleSave"> <i class="iconfont icon-jiahao2fill"></i>保存 </div>
:title="getTitle" </div>
width="60%"
@register="registerModal"
@ok="handleSave"
>
<BasicForm @register="registerForm" /> <BasicForm @register="registerForm" />
<!--右下角按钮--> </div>
<template #footer>
<a-button
pre-icon="ant-design:close-outlined"
type="warning"
:loading="loading"
ghost
style="margin-right: 0.8rem"
@click="closeModal"
>取消</a-button
>
<a-button
type="success"
:loading="loading"
pre-icon="ant-design:check-outlined"
style="margin-right: 0.8rem"
@click="handleSave(false)"
>仅保存</a-button
>
<a-button
pre-icon="ant-design:check-circle-outlined"
type="primary"
:loading="loading"
@click="handleSave(true)"
>保存并关闭</a-button
>
</template>
</BasicModal>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed, unref, h } from 'vue' import { ref, watch } from 'vue'
import { BasicModal, useModalInner, useModal } from '/@/components/Modal'
import { BasicForm, useForm } from '/@/components/Form/index' import { BasicForm, useForm } from '/@/components/Form/index'
import { formSchema, BankColumns } from './OpBusinessYardColumns' import { formSchema } from './OpBusinessYardColumns'
import { EditOpBusinessYard, GetOpBusinessYardInfo } from './LetterApi' import { EditOpBusinessYard, GetOpBusinessYardInfo } from './LetterApi'
import { useMessage } from '/@/hooks/web/useMessage' import { useMessage } from '/@/hooks/web/useMessage'
import { propTypes } from '/@/utils/propTypes' import { propTypes } from '/@/utils/propTypes'
const props = defineProps({ const props = defineProps({
businessId: propTypes.object, businessId: propTypes.object,
selectId: propTypes.string,
}) })
watch(
() => props.selectId,
async (nVal) => {
if (nVal) {
console.log(nVal)
const res: API.DataResult = await GetOpBusinessYardInfo({ id: nVal })
if (res.succeeded) {
await setFieldsValue({
...res.data,
})
}
} else {
resetFields()
}
},
)
// Emits // Emits
const emit = defineEmits(['success', 'register']) const emit = defineEmits(['success', 'register'])
const isUpdate = ref(true)
const loading = ref(false)
const rowId = ref('')
const { createMessage } = useMessage() const { createMessage } = useMessage()
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({ const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({
labelWidth: 100, labelWidth: 100,
@ -60,71 +43,25 @@
showActionButtonGroup: false, showActionButtonGroup: false,
}) })
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => { async function handleSave() {
resetFields() let ApiData: any = {
setModalProps({ confirmLoading: false, loading: true }) mainInfo: {},
isUpdate.value = !!data?.isUpdate
if (unref(isUpdate)) {
// setModalProps({ confirmLoading: true });
rowId.value = data.record.id
const res: API.DataResult = await GetOpBusinessYardInfo({ id: unref(rowId) })
if (res.succeeded) {
setFieldsValue({
...res.data,
})
}
} else {
setFieldsValue({ permissionIdentity: unref(2) })
} }
setModalProps({ loading: false }) const values = await validate()
}) console.log(values)
const getTitle = computed(() => (!unref(isUpdate) ? '新增电放保函' : '编辑电放保函')) Object.keys(values).forEach((item) => {
if (item == 'businessId' && !values.businessId) {
async function handleSave(exit) { ApiData.businessId = props.businessId
try {
setModalProps({ confirmLoading: true, loading: true })
let ApiData: any = {
mainInfo: {},
}
const values = await validate()
console.log(values)
Object.keys(values).forEach((item) => {
if (item == 'businessId' && !values.businessId) {
ApiData.businessId = props.businessId
} else {
ApiData[item] = values[item]
}
})
const res: API.DataResult = await EditOpBusinessYard(ApiData)
if (res.succeeded) {
createMessage.success(res.message)
emit('success')
//
if (!exit) {
if (unref(isUpdate)) {
await refresh()
} else {
rowId.value = res.data
isUpdate.value = true
await refresh()
}
}
} else { } else {
createMessage.error(res.message) ApiData[item] = values[item]
} }
})
exit && closeModal() const res: API.DataResult = await EditOpBusinessYard(ApiData)
} finally {
// loading.value = false;
setModalProps({ confirmLoading: false, loading: false })
}
}
async function refresh() {
const res: API.DataResult = await GetOpBusinessYardInfo({ id: unref(rowId) })
if (res.succeeded) { if (res.succeeded) {
await setFieldsValue({ createMessage.success(res.message)
...res.data, emit('success')
}) } else {
createMessage.error(res.message)
} }
} }
</script> </script>

Loading…
Cancel
Save