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

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

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

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

@ -6,6 +6,7 @@ import { useComponentRegister } from '/@/components/Form'
useComponentRegister('Space', Space)
const optionsStore = useOptionsStore()
import { getOptions } from '/@/hooks/dict'
import { getDictOption } from '/@/utils/dictUtil'
export const columns: BasicColumn[] = [
{
title: '车队名称',
@ -427,10 +428,20 @@ export const formSchema: FormSchema[] = [
{
label: '结算方式',
field: 'payType',
component: 'Select',
defaultValue: '',
colProps: {
span: 6,
component: 'ApiSelect',
required: false,
dynamicDisabled: false,
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',
component: 'Select',
defaultValue: '',
colProps: {
span: 6,
label: '派车状态',
component: 'ApiSelect',
dynamicDisabled: false,
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',
component: 'Select',
label: '调度人员名称',
component: 'ApiSelect',
defaultValue: '',
colProps: {
span: 6,
colProps: { 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"
:use-wrapper="true"
title="派车信息"
width="70%"
width="90%"
@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"
/>
<!--右下角按钮-->
<a-row>
<a-col :span="6">
<BasicTable @register="registerOpBusinessTruckTable">
<template #tableTitle>
<div class="buttonGroup">
<div class="nav" @click="FnClickAdd">
<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>
</BasicTable>
</a-col>
<a-col :span="18" class="OPCol">
<OpBusinessTruckEdit
:business-id="businessId"
:select-id="selectId"
@success="handleSuccess"
/>
</a-col>
</a-row>
<template #footer>
<span></span>
</template>
@ -49,7 +42,7 @@
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import { columns, searchFormSchema } from './OpBusinessTruckColumns'
import { columns } from './OpBusinessYardColumns'
import { BasicModal, useModalInner, useModal } from '/@/components/Modal'
import { BasicTable, useTable, TableAction } from '/@/components/Table'
import { GetOpBusinessTruckList, BatchDelOpBusinessTruck } from './LetterApi'
@ -59,93 +52,65 @@
// Emits
const emit = defineEmits(['success', 'register'])
const businessId = ref()
const [registerModal] = useModalInner(async (data) => {
const selectId = ref()
const [registerModal] = useModalInner((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)
const [
registerOpBusinessTruckTable,
{ reload, setSelectedRowKeys, clearSelectedRowKeys, getSelectRows },
] = useTable({
api: async (p) => {
const res: API.DataResult = await GetOpBusinessTruckList(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
},
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',
return postParam
},
rowKey: 'id',
columns,
isTreeTable: false,
pagination: false,
striped: true,
showTableSetting: false,
bordered: true,
showIndexColumn: false,
autoCreateKey: false,
indexColumnProps: {
fixed: 'left',
},
canResize: true,
clickToRowSelect: false,
rowSelection: {
type: 'radio',
onSelect: (e) => {
console.log(e)
selectId.value = e.id
},
rowSelection: { type: 'checkbox' },
})
},
})
const [registerOpBusinessTruckModal, { openModal }] = useModal()
function AddOpBusinessTruck() {
openModal(true, {
isParent: false,
isUpdate: false,
businessId: businessId.value,
})
}
//
function FnClickDel() {
if (getSelectRows().length) {
@ -165,17 +130,18 @@
notification.warning({ message: '请至少选择一条数据', duration: 3 })
}
}
function FnEditOpBusinessTruck(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
})
function FnClickAdd() {
clearSelectedRowKeys()
selectId.value = ''
}
function handleSuccess() {
// businessId.value = 0
reload()
async function handleSuccess() {
await reload()
}
</script>
<style lang="less">
@import url('/@/styles/buttonGroup.scss');
.OPCol {
height: 60vh;
overflow-y: auto;
}
</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>
<BasicModal
v-bind="$attrs"
:use-wrapper="true"
:title="getTitle"
width="60%"
@register="registerModal"
@ok="handleSave"
>
<a-spin :spinning="spinning">
<div class="buttonGroup">
<div class="nav" @click="handleSave"> <i class="iconfont icon-jiahao2fill"></i>保存 </div>
</div>
<BasicForm @register="registerForm" />
<div>
<div class="buttonGroup">
@ -22,59 +18,66 @@
</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>
</a-spin>
</template>
<script lang="ts" setup>
import { ref, computed, unref, h } from 'vue'
import { BasicModal, useModalInner, useModal } from '/@/components/Modal'
import { ref, watch } from 'vue'
import { BasicForm, useForm } from '/@/components/Form/index'
import { formSchema, BankColumns } from './OpBusinessTruckColumns'
import { EditOpBusinessTruck, GetOpBusinessTruckInfo } from './LetterApi'
import { useMessage } from '/@/hooks/web/useMessage'
import { formSchema } from './OpBusinessTruckColumns'
import {
EditOpBusinessTruck,
GetOpBusinessTruckInfo,
GetTruckCtnList,
BatchDelTruckCtns,
} from './LetterApi'
import {
GetCtnSelectList,
GetPackageSelectList,
} from '/@/views/operation/seaexport/api/BookingLedger'
import { useMessage } from '/@/hooks/web/useMessage'
const { notification } = useMessage()
import { HotTable } from '@handsontable/vue3'
import { registerAllModules } from 'handsontable/registry'
registerAllModules()
import { propTypes } from '/@/utils/propTypes'
const props = defineProps({
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()
// 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({
@ -83,71 +86,25 @@
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) })
async function handleSave() {
let ApiData: any = {
truckCtnList: [],
}
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()
}
}
const values = await validate()
Object.keys(values).forEach((item) => {
if (item == 'businessId' && !values.businessId) {
ApiData.businessId = props.businessId
} else {
createMessage.error(res.message)
ApiData[item] = values[item]
}
exit && closeModal()
} finally {
// loading.value = false;
setModalProps({ confirmLoading: false, loading: false })
}
}
async function refresh() {
const res: API.DataResult = await GetOpBusinessTruckInfo({ id: unref(rowId) })
})
ApiData.truckCtnList = list.value
const res: API.DataResult = await EditOpBusinessTruck(ApiData)
if (res.succeeded) {
await setFieldsValue({
...res.data,
})
createMessage.success(res.message)
emit('success')
} else {
createMessage.error(res.message)
}
}
const ctnDict = ref()
@ -163,6 +120,41 @@
function TableAdd() {
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 = [
{
@ -331,7 +323,6 @@
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
@ -357,6 +348,3 @@
},
}
</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[] = [
{
label: '主键Id',

@ -2,46 +2,39 @@
<BasicModal
v-bind="$attrs"
:use-wrapper="true"
title="电放保函"
width="70%"
title="场站入货"
width="90%"
@register="registerModal"
>
<BasicTable @register="registerOpBusinessYardTable">
<template #tableTitle>
<div class="buttonGroup">
<div class="nav" @click="AddOpBusinessYard">
<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: FnEditOpBusinessYard.bind(null, record),
},
]"
/>
</template>
</template>
</BasicTable>
<OpBusinessYardEdit
:business-id="businessId"
@register="registerOpBusinessYardModal"
@success="handleSuccess"
/>
<!--右下角按钮-->
<a-row>
<a-col :span="6">
<BasicTable @register="registerOpBusinessYardTable">
<template #tableTitle>
<div class="buttonGroup">
<div class="nav" @click="FnClickAdd">
<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>
</BasicTable>
</a-col>
<a-col :span="18" class="OPCol">
<OpBusinessYardEdit
:business-id="businessId"
:select-id="selectId"
@success="handleSuccess"
/>
</a-col>
</a-row>
<template #footer>
<span></span>
</template>
@ -49,9 +42,9 @@
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import { columns, searchFormSchema } from './OpBusinessYardColumns'
import { BasicModal, useModalInner, useModal } from '/@/components/Modal'
import { BasicTable, useTable, TableAction } from '/@/components/Table'
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'
@ -59,93 +52,63 @@
// Emits
const emit = defineEmits(['success', 'register'])
const businessId = ref()
const [registerModal] = useModalInner(async (data) => {
const selectId = ref()
const [registerModal] = useModalInner((data) => {
businessId.value = data.id
})
const [registerOpBusinessYardTable, { reload, getForm, getPaginationRef, getSelectRows }] =
useTable({
api: async (p) => {
const res: API.DataResult = await GetOpBusinessYardList(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)
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
},
columns,
formConfig: {
labelWidth: 120,
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',
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
},
rowSelection: { type: 'checkbox' },
})
},
})
const [registerOpBusinessYardModal, { openModal }] = useModal()
function AddOpBusinessYard() {
openModal(true, {
isParent: false,
isUpdate: false,
businessId: businessId.value,
})
}
//
function FnClickDel() {
if (getSelectRows().length) {
@ -165,17 +128,18 @@
notification.warning({ message: '请至少选择一条数据', duration: 3 })
}
}
function FnEditOpBusinessYard(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
})
function FnClickAdd() {
clearSelectedRowKeys()
selectId.value = ''
}
function handleSuccess() {
// businessId.value = 0
reload()
async function handleSuccess() {
await reload()
}
</script>
<style lang="less">
@import url('/@/styles/buttonGroup.scss');
.OPCol {
height: 60vh;
overflow-y: auto;
}
</style>

@ -1,58 +1,41 @@
<template>
<BasicModal
v-bind="$attrs"
:use-wrapper="true"
:title="getTitle"
width="60%"
@register="registerModal"
@ok="handleSave"
>
<div>
<div class="buttonGroup">
<div class="nav" @click="handleSave"> <i class="iconfont icon-jiahao2fill"></i>保存 </div>
</div>
<BasicForm @register="registerForm" />
<!--右下角按钮-->
<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>
</div>
</template>
<script lang="ts" setup>
import { ref, computed, unref, h } from 'vue'
import { BasicModal, useModalInner, useModal } from '/@/components/Modal'
import { ref, watch } from 'vue'
import { BasicForm, useForm } from '/@/components/Form/index'
import { formSchema, BankColumns } from './OpBusinessYardColumns'
import { formSchema } from './OpBusinessYardColumns'
import { EditOpBusinessYard, GetOpBusinessYardInfo } from './LetterApi'
import { useMessage } from '/@/hooks/web/useMessage'
import { propTypes } from '/@/utils/propTypes'
const props = defineProps({
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
const emit = defineEmits(['success', 'register'])
const isUpdate = ref(true)
const loading = ref(false)
const rowId = ref('')
const { createMessage } = useMessage()
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({
labelWidth: 100,
@ -60,71 +43,25 @@
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 GetOpBusinessYardInfo({ id: unref(rowId) })
if (res.succeeded) {
setFieldsValue({
...res.data,
})
}
} else {
setFieldsValue({ permissionIdentity: unref(2) })
async function handleSave() {
let ApiData: any = {
mainInfo: {},
}
setModalProps({ loading: false })
})
const getTitle = computed(() => (!unref(isUpdate) ? '新增电放保函' : '编辑电放保函'))
async function handleSave(exit) {
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()
}
}
const values = await validate()
console.log(values)
Object.keys(values).forEach((item) => {
if (item == 'businessId' && !values.businessId) {
ApiData.businessId = props.businessId
} else {
createMessage.error(res.message)
ApiData[item] = values[item]
}
exit && closeModal()
} finally {
// loading.value = false;
setModalProps({ confirmLoading: false, loading: false })
}
}
async function refresh() {
const res: API.DataResult = await GetOpBusinessYardInfo({ id: unref(rowId) })
})
const res: API.DataResult = await EditOpBusinessYard(ApiData)
if (res.succeeded) {
await setFieldsValue({
...res.data,
})
createMessage.success(res.message)
emit('success')
} else {
createMessage.error(res.message)
}
}
</script>

Loading…
Cancel
Save