szh-new
lijingjia 7 months ago
parent 6015da4997
commit feb4fc4955

@ -66,7 +66,17 @@ enum Api {
// 费用名称下拉数据 // 费用名称下拉数据
GetFeeCodeSelectList = '/mainApi/ClientCommon/GetFeeCodeSelectList', GetFeeCodeSelectList = '/mainApi/ClientCommon/GetFeeCodeSelectList',
// 获取箱型下拉数据 // 获取箱型下拉数据
GetCtnSelectList = '/mainApi/ClientCommon/GetCtnSelectList' GetCtnSelectList = '/mainApi/ClientCommon/GetCtnSelectList',
// 保证类型下拉数据
GetPackageSelectList = '/mainApi/ClientCommon/GetPackageSelectList'
}
// 包装下拉数据列表
export function GetPackageSelectList() {
return request<DataResult>({
url: Api.GetPackageSelectList,
method: 'get'
})
} }
// 箱型数据下拉列表 // 箱型数据下拉列表

@ -3,6 +3,7 @@
v-bind="$attrs" v-bind="$attrs"
v-model:value="state" v-model:value="state"
:options="getOptions" :options="getOptions"
:showSearch="true"
@dropdown-visible-change="handleFetch" @dropdown-visible-change="handleFetch"
@change="handleChange" @change="handleChange"
> >
@ -142,6 +143,7 @@
} }
function handleChange(_, ...args) { function handleChange(_, ...args) {
emit('change', _, ...args)
emitData.value = args emitData.value = args
} }

@ -56,15 +56,15 @@ export const columns: BasicColumn[] = [
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
{ {
field: 'codeName', field: 'code',
label: '箱型', label: '箱型',
colProps: { span: 6 }, colProps: { span: 6 },
component: 'ApiSelect', component: 'ApiSelect',
componentProps: () => { componentProps: () => {
return { return {
api: GetCtnSelectList, api: GetCtnSelectList,
labelField: 'shortName', labelField: 'ctnName',
valueField: 'codeName', valueField: 'ediCode',
resultField: 'data' resultField: 'data'
} }
} }
@ -90,16 +90,20 @@ export const formSchema: FormSchema[] = [
label: '箱型', label: '箱型',
component: 'ApiSelect', component: 'ApiSelect',
colProps: { span: 12 }, colProps: { span: 12 },
componentProps: ({ formModel }) => { required: true,
componentProps: ({ formModel, formActionType }) => {
return { return {
api: GetCtnSelectList, api: GetCtnSelectList,
params: {},
labelField: 'ctnName', labelField: 'ctnName',
valueField: 'ediCode', valueField: 'ediCode',
resultField: 'data', resultField: 'data',
onChange: (v, obj) => { onChange: (v, obj) => {
if (obj) { if (obj) {
formModel['code'] = obj.ediCode
formModel['linkId'] = obj.id formModel['linkId'] = obj.id
} }
formActionType.clearValidate()
} }
} }
} }

@ -67,10 +67,10 @@
}, },
} }
let condition: API.ConditionItem[] = [] let condition: API.ConditionItem[] = []
if (!!data.codeName) { if (!!data.code) {
condition.push({ condition.push({
FieldName: 'codeName', FieldName: 'code',
FieldValue: data.codeName, FieldValue: data.code,
ConditionalType: 1, ConditionalType: 1,
}) })
} }

@ -0,0 +1,37 @@
/*
* @Description: api
* @Author: lijj
* @Date: 2024-04-25 15:48:33
*/
import { request } from '/@/utils/request'
import { DataResult, PageRequest } from '/@/api/model/baseModel'
enum Api {
list = '/mainApi/CodePackage/GetCodePackageList',
edit = '/mainApi/CodePackage/EditCodePackage',
info = '/mainApi/CodePackage/GetCodePackageInfo'
}
// 列表 (Auth)
export function GetCodePackageList(data: PageRequest) {
return request<DataResult>({
url: Api.list,
method: 'post',
data
})
}
// 编辑 (Auth)
export function EditCodePackage(data: PageRequest) {
return request<DataResult>({
url: Api.edit,
method: 'post',
data
})
}
// 详情 (Auth)
export function GetCodePackageInfo(query) {
return request<DataResult>({
url: Api.info,
method: 'get',
params: query
})
}

@ -0,0 +1,163 @@
/*
* @Description: tsx
* @Author: lijj
* @Date: 2024-04-25 15:48:33
*/
import { BasicColumn, FormSchema } from '/@/components/Table'
import { GetCarrierlist } from '/@/views/operation/seaexport/api/BookingLedger'
// 引入字典数据
import { getDictOption } from '/@/utils/dictUtil'
// 包装下拉数据
import { GetPackageSelectList } from '/@/api/common'
// 模块字典
const modulesDict = await getDictOption('modules')
export const columns: BasicColumn[] = [
{
title: '包装',
dataIndex: 'packageName',
width: 150
},
{
title: '模块',
dataIndex: 'module',
width: 200,
customRender: ({ text }) => {
const data = modulesDict.filter(item => {
return item.value == text
})
if (data && data.length) {
return data[0].label
} else {
return ''
}
}
},
{
title: '船公司',
dataIndex: 'carrierName',
width: 200
},
{
title: '映射名称',
dataIndex: 'mapName',
width: 150
},
{
title: '映射代码',
dataIndex: 'mapCode',
width: 150
},
{
title: '备注',
dataIndex: 'note',
width: 200
}
]
export const searchFormSchema: FormSchema[] = [
{
field: 'code',
label: '包装',
colProps: { span: 6 },
component: 'ApiSelect',
componentProps: () => {
return {
api: GetPackageSelectList,
labelField: 'ctnName',
valueField: 'ediCode',
resultField: 'data'
}
}
},
]
export const formSchema: FormSchema[] = [
{
label: '',
field: 'id',
component: 'Input',
defaultValue: '',
show: false
},
{
label: '',
field: 'linkId',
component: 'Input',
defaultValue: '',
show: false
},
{
field: 'code',
label: '包装',
component: 'ApiSelect',
colProps: { span: 12 },
componentProps: ({ formModel, formActionType }) => {
return {
api: GetPackageSelectList,
labelField: 'packageName',
valueField: 'ediCode',
showSearch: true,
resultField: 'data',
onChange: (v, obj) => {
if (obj) {
formModel['packageName'] = obj.packageName
formModel['linkId'] = obj.id
}
}
}
}
},
{
field: 'module',
label: '模块',
required: true,
component: 'Select',
colProps: { span: 12 },
componentProps: () => {
return {
options: modulesDict,
allowClear: true,
showSearch: true,
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
}
}
},
{
field: 'carrierId',
label: '船公司',
component: 'ApiSelect',
colProps: { span: 12 },
componentProps: ({ formActionType, formModel }) => {
return {
api: GetCarrierlist,
labelField: 'shortName',
valueField: 'id',
resultField: 'data',
onChange: (v, obj) => {
// formActionType.validateFields(['code'])
}
}
}
},
{
field: 'mapName',
label: '映射名称',
required: true,
component: 'Input',
colProps: { span: 12 }
},
{
field: 'mapCode',
label: '映射代码',
required: true,
component: 'Input',
colProps: { span: 12 }
},
{
field: 'note',
label: '备注',
component: 'InputTextArea',
colProps: { span: 24 }
}
]

@ -0,0 +1,110 @@
<template>
<BasicModal
v-bind="$attrs"
:use-wrapper="true"
:title="getTitle"
:form-schema="formSchema"
width="50%"
@register="registerModal"
@ok="handleSave"
>
<!-- 包装表单 -->
<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>
</template>
<script lang="ts" setup>
import { ref, computed, unref } from 'vue'
//
import { BasicModal, useModalInner } from '/@/components/Modal'
import { BasicForm, useForm } from '/@/components/Form/index'
//
import { formSchema } from '../columns'
//
import { EditCodePackage, GetCodePackageInfo } from '../api'
//
import { useMessage } from '/@/hooks/web/useMessage'
// Emits
const emit = defineEmits(['success', 'register'])
const isUpdate = ref(true)
// loading
const loading = ref(false)
const rowId = ref('')
const { createMessage } = useMessage()
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] =
useForm({
labelWidth: 100,
schemas: formSchema,
showActionButtonGroup: false,
})
const [registerModal, { setModalProps, closeModal, updateFormField }] = useModalInner(async (data) => {
resetFields()
setModalProps({ confirmLoading: false, loading: true })
isUpdate.value = !!data?.isUpdate
if (unref(isUpdate)) {
setModalProps({ confirmLoading: true });
updateFormField(updateSchema)
rowId.value = data.record.id
const res: API.DataResult = await GetCodePackageInfo({ 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 {
const values = await validate()
loading.value = true
setModalProps({ confirmLoading: true, loading: true })
const res: API.DataResult = await EditCodePackage(values)
loading.value = false
if (res.succeeded) {
createMessage.success(res.message)
emit('success')
} else {
createMessage.error(res.message)
}
exit && closeModal()
} finally {
setModalProps({ confirmLoading: false, loading: false })
}
}
</script>

@ -0,0 +1,124 @@
<template>
<div>
<BasicTable @register="registerTable">
<template #toolbar>
<a-button type="primary" @click="handleCreate"> </a-button>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'userName'">
<span style="color: #0d84ff" @click="handleEdit(record)">{{ record.userName }}</span>
</template>
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{
icon: 'clarity:note-edit-line',
tooltip: '编辑',
onClick: handleEdit.bind(null, record),
}
]"
/>
</template>
</template>
</BasicTable>
<Modal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup>
import { onMounted } from 'vue'
import { BasicTable, useTable, TableAction } from '/@/components/Table'
import { GetCodePackageList } from './api'
import { useModal } from '/@/components/Modal'
import Modal from './components/Modal.vue'
import { columns, searchFormSchema } from './columns'
import { useMessage } from '/@/hooks/web/useMessage'
const { notification } = useMessage()
const [registerModal, { openModal }] = useModal()
const [registerTable, { reload, getForm, getPaginationRef }] = useTable({
title: '包装映射信息表',
// api: getSysDictTypeList,
api: async (p) => {
const res: API.DataResult = await GetCodePackageList(p)
console.log(res)
// console.log(items);
return new Promise((resolve) => {
resolve({ data: [...res.data], total: res.count })
})
},
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[] = []
if (!!data.code) {
condition.push({
FieldName: 'code',
FieldValue: data.code,
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,
canResize: false,
actionColumn: {
width: 80,
title: '操作',
dataIndex: 'action',
fixed: 'right',
},
})
function handleCreate() {
openModal(true, {
isParent: false,
isUpdate: false,
})
}
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
})
}
//
// async function handleDelete(record: Recordable) {
// console.log(record)
// const res: API.DataResult = await BatchDelMappingCtn({
// id: '',
// ids: [record.id],
// })
// if (res.succeeded) {
// notification.success({ message: res.message, duration: 3 })
// reload()
// } else {
// notification.error({ message: res.message, duration: 3 })
// }
// }
onMounted(() => {
//
})
function handleSuccess() {
reload()
}
</script>
Loading…
Cancel
Save