放舱通道配置

main
张同海 3 months ago
parent 10f92a1a8b
commit 40c0fc7746

@ -54,6 +54,10 @@ enum Api {
getEnum = '/adminApi/Common/GetSysEnumSelect', getEnum = '/adminApi/Common/GetSysEnumSelect',
getInfoClientSelect = '/adminApi/Common/GetInfoClientSelect', getInfoClientSelect = '/adminApi/Common/GetInfoClientSelect',
// 港口下拉数据
GetClientPortSelectList = '/adminApi/Common/GetPortSelectList',
// 船公司下拉数据
GetCarrierSelectList = '/adminApi/Common/GetCarrierSelectList',
} }
export function getInfoClientSelect(query: { code: string }) { export function getInfoClientSelect(query: { code: string }) {
return request<DataResult>({ return request<DataResult>({
@ -142,9 +146,9 @@ export function UserRefreshToken(data) {
return request<DataResult<CurrentUserViewModel>>({ return request<DataResult<CurrentUserViewModel>>({
url: Api.UserRefreshToken, url: Api.UserRefreshToken,
method: 'get', method: 'get',
headers:{ headers: {
RefreshToken:data.refreshToken RefreshToken: data.refreshToken,
} },
}) })
} }
export function userLogout() { export function userLogout() {
@ -284,7 +288,20 @@ export function changePassword(data: any) {
data, data,
}) })
} }
// 港口下拉数据列表
export function GetClientPortSelectList() {
return request<DataResult>({
url: Api.GetClientPortSelectList,
method: 'get',
})
}
// 船公司下拉
export function GetCarrierSelectList() {
return request<DataResult>({
url: Api.GetCarrierSelectList,
method: 'get',
})
}
/** /**
* api * api
*/ */

@ -1,18 +1,18 @@
<script lang="tsx"> <script lang="tsx">
import type { PropType, Ref } from 'vue'; import type { PropType, Ref } from 'vue'
import { computed, defineComponent, toRefs, unref } from 'vue'; import { computed, defineComponent, toRefs, unref } from 'vue'
import type { FormActionType, FormProps, FormSchema } from '../types/form'; import type { FormActionType, FormProps, FormSchema } from '../types/form'
import type { ValidationRule } from 'ant-design-vue/lib/form/Form'; import type { ValidationRule } from 'ant-design-vue/lib/form/Form'
import type { TableActionType } from '/@/components/Table'; import type { TableActionType } from '/@/components/Table'
import { Col, Divider, Form } from 'ant-design-vue'; import { Col, Divider, Form } from 'ant-design-vue'
import { componentMap } from '../componentMap'; import { componentMap } from '../componentMap'
import { BasicHelp } from '/@/components/Basic'; import { BasicHelp } from '/@/components/Basic'
import { isBoolean, isFunction, isNull } from '/@/utils/is'; import { isBoolean, isFunction, isNull } from '/@/utils/is'
import { getSlot } from '/@/utils/helper/tsxHelper'; import { getSlot } from '/@/utils/helper/tsxHelper'
import { createPlaceholderMessage, setComponentRuleType } from '../helper'; import { createPlaceholderMessage, setComponentRuleType } from '../helper'
import { cloneDeep, upperFirst } from 'lodash-es'; import { cloneDeep, upperFirst } from 'lodash-es'
import { useItemLabelWidth } from '../hooks/useLabelWidth'; import { useItemLabelWidth } from '../hooks/useLabelWidth'
import { useI18n } from '/@/hooks/web/useI18n'; import { useI18n } from '/@/hooks/web/useI18n'
export default defineComponent({ export default defineComponent({
name: 'BasicFormItem', name: 'BasicFormItem',
@ -49,18 +49,18 @@
}, },
}, },
setup(props, { slots }) { setup(props, { slots }) {
const { t } = useI18n(); const { t } = useI18n()
const { schema, formProps } = toRefs(props) as { const { schema, formProps } = toRefs(props) as {
schema: Ref<FormSchema>; schema: Ref<FormSchema>
formProps: Ref<FormProps>; formProps: Ref<FormProps>
}; }
const itemLabelWidthProp = useItemLabelWidth(schema, formProps); const itemLabelWidthProp = useItemLabelWidth(schema, formProps)
const getValues = computed(() => { const getValues = computed(() => {
const { allDefaultValues, formModel, schema } = props; const { allDefaultValues, formModel, schema } = props
const { mergeDynamicData } = props.formProps; const { mergeDynamicData } = props.formProps
return { return {
field: schema.field, field: schema.field,
model: formModel, model: formModel,
@ -70,64 +70,64 @@
...formModel, ...formModel,
} as Recordable, } as Recordable,
schema: schema, schema: schema,
}; }
}); })
const getComponentsProps = computed(() => { const getComponentsProps = computed(() => {
const { schema, tableAction, formModel, formActionType } = props; const { schema, tableAction, formModel, formActionType } = props
let { componentProps = {} } = schema; let { componentProps = {} } = schema
if (isFunction(componentProps)) { if (isFunction(componentProps)) {
componentProps = componentProps({ schema, tableAction, formModel, formActionType }) ?? {}; componentProps = componentProps({ schema, tableAction, formModel, formActionType }) ?? {}
} }
if (schema.component === 'Divider') { if (schema.component === 'Divider') {
componentProps = Object.assign({ type: 'horizontal' }, componentProps, { componentProps = Object.assign({ type: 'horizontal' }, componentProps, {
orientation: 'left', orientation: 'left',
plain: true, plain: true,
}); })
} }
return componentProps as Recordable; return componentProps as Recordable
}); })
const getDisable = computed(() => { const getDisable = computed(() => {
const { disabled: globDisabled } = props.formProps; const { disabled: globDisabled } = props.formProps
const { dynamicDisabled } = props.schema; const { dynamicDisabled } = props.schema
const { disabled: itemDisabled = false } = unref(getComponentsProps); const { disabled: itemDisabled = false } = unref(getComponentsProps)
let disabled = !!globDisabled || itemDisabled; let disabled = !!globDisabled || itemDisabled
if (isBoolean(dynamicDisabled)) { if (isBoolean(dynamicDisabled)) {
disabled = dynamicDisabled; disabled = dynamicDisabled
} }
if (isFunction(dynamicDisabled)) { if (isFunction(dynamicDisabled)) {
disabled = dynamicDisabled(unref(getValues)); disabled = dynamicDisabled(unref(getValues))
} }
return disabled; return disabled
}); })
function getShow(): { isShow: boolean; isIfShow: boolean } { function getShow(): { isShow: boolean; isIfShow: boolean } {
const { show, ifShow } = props.schema; const { show, ifShow } = props.schema
const { showAdvancedButton } = props.formProps; const { showAdvancedButton } = props.formProps
const itemIsAdvanced = showAdvancedButton const itemIsAdvanced = showAdvancedButton
? isBoolean(props.isAdvanced) ? isBoolean(props.isAdvanced)
? props.isAdvanced ? props.isAdvanced
: true : true
: true; : true
let isShow = true; let isShow = true
let isIfShow = true; let isIfShow = true
if (isBoolean(show)) { if (isBoolean(show)) {
isShow = show; isShow = show
} }
if (isBoolean(ifShow)) { if (isBoolean(ifShow)) {
isIfShow = ifShow; isIfShow = ifShow
} }
if (isFunction(show)) { if (isFunction(show)) {
isShow = show(unref(getValues)); isShow = show(unref(getValues))
} }
if (isFunction(ifShow)) { if (isFunction(ifShow)) {
isIfShow = ifShow(unref(getValues)); isIfShow = ifShow(unref(getValues))
} }
isShow = isShow && itemIsAdvanced; isShow = isShow && itemIsAdvanced
return { isShow, isIfShow }; return { isShow, isIfShow }
} }
function handleRules(): ValidationRule[] { function handleRules(): ValidationRule[] {
@ -138,31 +138,31 @@
label, label,
dynamicRules, dynamicRules,
required, required,
} = props.schema; } = props.schema
if (isFunction(dynamicRules)) { if (isFunction(dynamicRules)) {
return dynamicRules(unref(getValues)) as ValidationRule[]; return dynamicRules(unref(getValues)) as ValidationRule[]
} }
let rules: ValidationRule[] = cloneDeep(defRules) as ValidationRule[]; let rules: ValidationRule[] = cloneDeep(defRules) as ValidationRule[]
const { rulesMessageJoinLabel: globalRulesMessageJoinLabel } = props.formProps; const { rulesMessageJoinLabel: globalRulesMessageJoinLabel } = props.formProps
const joinLabel = Reflect.has(props.schema, 'rulesMessageJoinLabel') const joinLabel = Reflect.has(props.schema, 'rulesMessageJoinLabel')
? rulesMessageJoinLabel ? rulesMessageJoinLabel
: globalRulesMessageJoinLabel; : globalRulesMessageJoinLabel
const defaultMsg = createPlaceholderMessage(component) + `${joinLabel ? label : ''}`; const defaultMsg = createPlaceholderMessage(component) + `${joinLabel ? label : ''}`
function validator(rule: any, value: any) { function validator(rule: any, value: any) {
const msg = rule.message || defaultMsg; const msg = rule.message || defaultMsg
if (value === undefined || isNull(value)) { if (value === undefined || isNull(value)) {
// //
return Promise.reject(msg); return Promise.reject(msg)
} else if (Array.isArray(value) && value.length === 0) { } else if (Array.isArray(value) && value.length === 0) {
// //
return Promise.reject(msg); return Promise.reject(msg)
} else if (typeof value === 'string' && value.trim() === '') { } else if (typeof value === 'string' && value.trim() === '') {
// //
return Promise.reject(msg); return Promise.reject(msg)
} else if ( } else if (
typeof value === 'object' && typeof value === 'object' &&
Reflect.has(value, 'checked') && Reflect.has(value, 'checked') &&
@ -173,12 +173,12 @@
value.halfChecked.length === 0 value.halfChecked.length === 0
) { ) {
// tree // tree
return Promise.reject(msg); return Promise.reject(msg)
} }
return Promise.resolve(); return Promise.resolve()
} }
const getRequired = isFunction(required) ? required(unref(getValues)) : required; const getRequired = isFunction(required) ? required(unref(getValues)) : required
/* /*
* 1若设置了required属性又没有其他的rules就创建一个验证规则 * 1若设置了required属性又没有其他的rules就创建一个验证规则
@ -187,49 +187,49 @@
*/ */
if (getRequired) { if (getRequired) {
if (!rules || rules.length === 0) { if (!rules || rules.length === 0) {
rules = [{ required: getRequired, validator }]; rules = [{ required: getRequired, validator }]
} else { } else {
const requiredIndex: number = rules.findIndex((rule) => Reflect.has(rule, 'required')); const requiredIndex: number = rules.findIndex((rule) => Reflect.has(rule, 'required'))
if (requiredIndex === -1) { if (requiredIndex === -1) {
rules.push({ required: getRequired, validator }); rules.push({ required: getRequired, validator })
} }
} }
} }
const requiredRuleIndex: number = rules.findIndex( const requiredRuleIndex: number = rules.findIndex(
(rule) => Reflect.has(rule, 'required') && !Reflect.has(rule, 'validator'), (rule) => Reflect.has(rule, 'required') && !Reflect.has(rule, 'validator'),
); )
if (requiredRuleIndex !== -1) { if (requiredRuleIndex !== -1) {
const rule = rules[requiredRuleIndex]; const rule = rules[requiredRuleIndex]
const { isShow } = getShow(); const { isShow } = getShow()
if (!isShow) { if (!isShow) {
rule.required = false; rule.required = false
} }
if (component) { if (component) {
if (!Reflect.has(rule, 'type')) { if (!Reflect.has(rule, 'type')) {
rule.type = component === 'InputNumber' ? 'number' : 'string'; rule.type = component === 'InputNumber' ? 'number' : 'string'
} }
rule.message = rule.message || defaultMsg; rule.message = rule.message || defaultMsg
if (component.includes('Input') || component.includes('Textarea')) { if (component.includes('Input') || component.includes('Textarea')) {
rule.whitespace = true; rule.whitespace = true
} }
const valueFormat = unref(getComponentsProps)?.valueFormat; const valueFormat = unref(getComponentsProps)?.valueFormat
setComponentRuleType(rule, component, valueFormat); setComponentRuleType(rule, component, valueFormat)
} }
} }
// Maximum input length rule check // Maximum input length rule check
const characterInx = rules.findIndex((val) => val.max); const characterInx = rules.findIndex((val) => val.max)
if (characterInx !== -1 && !rules[characterInx].validator) { if (characterInx !== -1 && !rules[characterInx].validator) {
rules[characterInx].message = rules[characterInx].message =
rules[characterInx].message || rules[characterInx].message ||
t('component.form.maxTip', [rules[characterInx].max] as Recordable); t('component.form.maxTip', [rules[characterInx].max] as Recordable)
} }
return rules; return rules
} }
function renderComponent() { function renderComponent() {
@ -239,109 +239,112 @@
field, field,
changeEvent = 'change', changeEvent = 'change',
valueField, valueField,
} = props.schema; } = props.schema
const isCheck = component && ['Switch', 'Checkbox'].includes(component); const isCheck = component && ['Switch', 'Checkbox'].includes(component)
const eventKey = `on${upperFirst(changeEvent)}`; const eventKey = `on${upperFirst(changeEvent)}`
const on = { const on = {
[eventKey]: (...args: Nullable<Recordable>[]) => { [eventKey]: (...args: Nullable<Recordable>[]) => {
const [e] = args; const [e] = args
if (propsData[eventKey]) { if (propsData[eventKey]) {
propsData[eventKey](...args); propsData[eventKey](...args)
} }
const target = e ? e.target : null; const target = e ? e.target : null
const value = target ? (isCheck ? target.checked : target.value) : e; const value = target ? (isCheck ? target.checked : target.value) : e
props.setFormModel(field, value, props.schema); props.setFormModel(field, value, props.schema)
}, },
}; }
const Comp = componentMap.get(component) as ReturnType<typeof defineComponent>; const Comp = componentMap.get(component) as ReturnType<typeof defineComponent>
const { autoSetPlaceHolder, size } = props.formProps; const { autoSetPlaceHolder, size } = props.formProps
const propsData: Recordable = { const propsData: Recordable = {
allowClear: true, allowClear: true,
getPopupContainer: (trigger: Element) => trigger.parentNode, getPopupContainer: (trigger: Element) => trigger.parentNode,
size, size,
...unref(getComponentsProps), ...unref(getComponentsProps),
disabled: unref(getDisable), disabled: unref(getDisable),
}; }
const isCreatePlaceholder = !propsData.disabled && autoSetPlaceHolder; const isCreatePlaceholder = !propsData.disabled && autoSetPlaceHolder
// RangePicker place is an array // RangePicker place is an array
if (isCreatePlaceholder && component !== 'RangePicker' && component) { if (isCreatePlaceholder && component !== 'RangePicker' && component) {
propsData.placeholder = propsData.placeholder =
unref(getComponentsProps)?.placeholder || createPlaceholderMessage(component); unref(getComponentsProps)?.placeholder || createPlaceholderMessage(component)
} }
propsData.codeField = field; propsData.codeField = field
propsData.formValues = unref(getValues); propsData.formValues = unref(getValues)
const bindValue: Recordable = { const bindValue: Recordable = {
[valueField || (isCheck ? 'checked' : 'value')]: props.formModel[field], [valueField || (isCheck ? 'checked' : 'value')]: props.formModel[field],
}; }
const compAttr: Recordable = { const compAttr: Recordable = {
...propsData, ...propsData,
...on, ...on,
...bindValue, ...bindValue,
}; ...props.schema,
}
if (!renderComponentContent) { if (!renderComponentContent) {
return <Comp {...compAttr} />; return <Comp {...compAttr} />
} }
const compSlot = isFunction(renderComponentContent) const compSlot = isFunction(renderComponentContent)
? { ...renderComponentContent(unref(getValues)) } ? { ...renderComponentContent(unref(getValues)) }
: { : {
default: () => renderComponentContent, default: () => renderComponentContent,
}; }
return <Comp {...compAttr}>{compSlot}</Comp>; return <Comp {...compAttr}>{compSlot}</Comp>
} }
function renderLabelHelpMessage() { function renderLabelHelpMessage() {
const { label, helpMessage, helpComponentProps, subLabel } = props.schema; const { label, helpMessage, helpComponentProps, subLabel, labelSlot } = props.schema
const renderLabel = subLabel ? ( const renderLabel = subLabel ? (
<span> <span>
{label} <span class="text-secondary">{subLabel}</span> {label} <span class="text-secondary">{subLabel}</span>
</span> </span>
) : labelSlot ? (
<span>
{label} {getSlot(slots, labelSlot, unref(getValues))}
</span>
) : ( ) : (
label label
); )
const getHelpMessage = isFunction(helpMessage) const getHelpMessage = isFunction(helpMessage) ? helpMessage(unref(getValues)) : helpMessage
? helpMessage(unref(getValues))
: helpMessage;
if (!getHelpMessage || (Array.isArray(getHelpMessage) && getHelpMessage.length === 0)) { if (!getHelpMessage || (Array.isArray(getHelpMessage) && getHelpMessage.length === 0)) {
return renderLabel; return renderLabel
} }
return ( return (
<span> <span>
{renderLabel} {renderLabel}
<BasicHelp placement="top" class="mx-1" text={getHelpMessage} {...helpComponentProps} /> <BasicHelp placement="top" class="mx-1" text={getHelpMessage} {...helpComponentProps} />
</span> </span>
); )
} }
function renderItem() { function renderItem() {
const { itemProps, slot, render, field, suffix, component } = props.schema; const { itemProps, slot, render, field, suffix, component } = props.schema
const { labelCol, wrapperCol } = unref(itemLabelWidthProp); const { labelCol, wrapperCol } = unref(itemLabelWidthProp)
const { colon } = props.formProps; const { colon } = props.formProps
if (component === 'Divider') { if (component === 'Divider') {
return ( return (
<Col span={24}> <Col span={24}>
<Divider {...unref(getComponentsProps)}>{renderLabelHelpMessage()}</Divider> <Divider {...unref(getComponentsProps)}>{renderLabelHelpMessage()}</Divider>
</Col> </Col>
); )
} else { } else {
const getContent = () => { const getContent = () => {
return slot return slot
? getSlot(slots, slot, unref(getValues)) ? getSlot(slots, slot, unref(getValues))
: render : render
? render(unref(getValues)) ? render(unref(getValues))
: renderComponent(); : renderComponent()
}; }
const showSuffix = !!suffix; const showSuffix = !!suffix
const getSuffix = isFunction(suffix) ? suffix(unref(getValues)) : suffix; const getSuffix = isFunction(suffix) ? suffix(unref(getValues)) : suffix
return ( return (
<Form.Item <Form.Item
@ -359,28 +362,28 @@
{showSuffix && <span class="suffix">{getSuffix}</span>} {showSuffix && <span class="suffix">{getSuffix}</span>}
</div> </div>
</Form.Item> </Form.Item>
); )
} }
} }
return () => { return () => {
const { colProps = {}, colSlot, renderColContent, component } = props.schema; const { colProps = {}, colSlot, renderColContent, component } = props.schema
if (!componentMap.has(component)) { if (!componentMap.has(component)) {
return null; return null
} }
const { baseColProps = {} } = props.formProps; const { baseColProps = {} } = props.formProps
const realColProps = { ...baseColProps, ...colProps }; const realColProps = { ...baseColProps, ...colProps }
const { isIfShow, isShow } = getShow(); const { isIfShow, isShow } = getShow()
const values = unref(getValues); const values = unref(getValues)
const getContent = () => { const getContent = () => {
return colSlot return colSlot
? getSlot(slots, colSlot, values) ? getSlot(slots, colSlot, values)
: renderColContent : renderColContent
? renderColContent(values) ? renderColContent(values)
: renderItem(); : renderItem()
}; }
return ( return (
isIfShow && ( isIfShow && (
@ -388,8 +391,8 @@
{getContent()} {getContent()}
</Col> </Col>
) )
); )
}; }
}, },
}); })
</script> </script>

@ -1,227 +1,235 @@
import type { NamePath, RuleObject } from 'ant-design-vue/lib/form/interface'; import type { NamePath, RuleObject } from 'ant-design-vue/lib/form/interface'
import type { VNode } from 'vue'; import type { VNode } from 'vue'
import type { ButtonProps as AntdButtonProps } from '/@/components/Button'; import type { ButtonProps as AntdButtonProps } from '/@/components/Button'
import type { FormItem } from './formItem'; import type { FormItem } from './formItem'
import type { ColEx, ComponentType } from './index'; import type { ColEx, ComponentType } from './index'
import type { TableActionType } from '/@/components/Table/src/types/table'; import type { TableActionType } from '/@/components/Table/src/types/table'
import type { CSSProperties } from 'vue'; import type { CSSProperties } from 'vue'
import type { RowProps } from 'ant-design-vue/lib/grid/Row'; import type { RowProps } from 'ant-design-vue/lib/grid/Row'
export type FieldMapToTime = [string, [string, string], (string | [string, string])?][]; export type FieldMapToTime = [string, [string, string], (string | [string, string])?][]
export type Rule = RuleObject & { export type Rule = RuleObject & {
trigger?: 'blur' | 'change' | ['change', 'blur']; trigger?: 'blur' | 'change' | ['change', 'blur']
}; }
export interface RenderCallbackParams { export interface RenderCallbackParams {
schema: FormSchema; schema: FormSchema
values: Recordable; values: Recordable
model: Recordable; model: Recordable
field: string; field: string
} }
export interface ButtonProps extends AntdButtonProps { export interface ButtonProps extends AntdButtonProps {
text?: string; text?: string
} }
export interface FormActionType { export interface FormActionType {
submit: () => Promise<void>; submit: () => Promise<void>
setFieldsValue: <T>(values: T) => Promise<void>; setFieldsValue: <T>(values: T) => Promise<void>
resetFields: () => Promise<void>; resetFields: () => Promise<void>
getFieldsValue: () => Recordable; getFieldsValue: () => Recordable
clearValidate: (name?: string | string[]) => Promise<void>; clearValidate: (name?: string | string[]) => Promise<void>
updateSchema: (data: Partial<FormSchema> | Partial<FormSchema>[]) => Promise<void>; updateSchema: (data: Partial<FormSchema> | Partial<FormSchema>[]) => Promise<void>
resetSchema: (data: Partial<FormSchema> | Partial<FormSchema>[]) => Promise<void>; resetSchema: (data: Partial<FormSchema> | Partial<FormSchema>[]) => Promise<void>
setProps: (formProps: Partial<FormProps>) => Promise<void>; setProps: (formProps: Partial<FormProps>) => Promise<void>
removeSchemaByField: (field: string | string[]) => Promise<void>; removeSchemaByField: (field: string | string[]) => Promise<void>
appendSchemaByField: ( appendSchemaByField: (
schema: FormSchema | FormSchema[], schema: FormSchema | FormSchema[],
prefixField: string | undefined, prefixField: string | undefined,
first?: boolean | undefined, first?: boolean | undefined,
) => Promise<void>; ) => Promise<void>
validateFields: (nameList?: NamePath[]) => Promise<any>; validateFields: (nameList?: NamePath[]) => Promise<any>
validate: (nameList?: NamePath[]) => Promise<any>; validate: (nameList?: NamePath[]) => Promise<any>
scrollToField: (name: NamePath, options?: ScrollOptions) => Promise<void>; getFieldList: (nameList?: NamePath[]) => Promise<any>
scrollToField: (name: NamePath, options?: ScrollOptions) => Promise<void>
linkageForm: () => Promise<void>
} }
export type RegisterFn = (formInstance: FormActionType) => void; export type RegisterFn = (formInstance: FormActionType) => void
export type UseFormReturnType = [RegisterFn, FormActionType]; export type UseFormReturnType = [RegisterFn, FormActionType]
export interface FormProps { export interface FormProps {
name?: string; name?: string
layout?: 'vertical' | 'inline' | 'horizontal'; layout?: 'vertical' | 'inline' | 'horizontal'
// Form value // Form value
model?: Recordable; model?: Recordable
// The width of all items in the entire form // The width of all items in the entire form
labelWidth?: number | string; labelWidth?: number | string
// alignment // alignment
labelAlign?: 'left' | 'right'; labelAlign?: 'left' | 'right'
// Row configuration for the entire form // Row configuration for the entire form
rowProps?: RowProps; rowProps?: RowProps
// Submit form on reset // Submit form on reset
submitOnReset?: boolean; submitOnReset?: boolean
// Submit form on form changing // Submit form on form changing
submitOnChange?: boolean; submitOnChange?: boolean
// Col configuration for the entire form // Col configuration for the entire form
labelCol?: Partial<ColEx>; labelCol?: Partial<ColEx>
// Col configuration for the entire form // Col configuration for the entire form
wrapperCol?: Partial<ColEx>; wrapperCol?: Partial<ColEx>
// General row style // General row style
baseRowStyle?: CSSProperties; baseRowStyle?: CSSProperties
// General col configuration // General col configuration
baseColProps?: Partial<ColEx>; baseColProps?: Partial<ColEx>
// Form configuration rules // Form configuration rules
schemas?: FormSchema[]; schemas?: FormSchema[]
// Function values used to merge into dynamic control form items // Function values used to merge into dynamic control form items
mergeDynamicData?: Recordable; mergeDynamicData?: Recordable
// Compact mode for search forms // Compact mode for search forms
compact?: boolean; compact?: boolean
// Blank line span // Blank line span
emptySpan?: number | Partial<ColEx>; emptySpan?: number | Partial<ColEx>
// Internal component size of the form // Internal component size of the form
size?: 'default' | 'small' | 'large'; size?: 'default' | 'small' | 'large'
// Whether to disable // Whether to disable
disabled?: boolean; disabled?: boolean
// Time interval fields are mapped into multiple // Time interval fields are mapped into multiple
fieldMapToTime?: FieldMapToTime; fieldMapToTime?: FieldMapToTime
// Placeholder is set automatically // Placeholder is set automatically
autoSetPlaceHolder?: boolean; autoSetPlaceHolder?: boolean
// Auto submit on press enter on input // Auto submit on press enter on input
autoSubmitOnEnter?: boolean; autoSubmitOnEnter?: boolean
// Check whether the information is added to the label // Check whether the information is added to the label
rulesMessageJoinLabel?: boolean; rulesMessageJoinLabel?: boolean
// Whether to show collapse and expand buttons // Whether to show collapse and expand buttons
showAdvancedButton?: boolean; showAdvancedButton?: boolean
// Whether to focus on the first input box, only works when the first form item is input // Whether to focus on the first input box, only works when the first form item is input
autoFocusFirstItem?: boolean; autoFocusFirstItem?: boolean
// Automatically collapse over the specified number of rows // Automatically collapse over the specified number of rows
autoAdvancedLine?: number; autoAdvancedLine?: number
// Always show lines // Always show lines
alwaysShowLines?: number; alwaysShowLines?: number
// Whether to show the operation button // Whether to show the operation button
showActionButtonGroup?: boolean; showActionButtonGroup?: boolean
// 是否使用高级查询
useAdvancedSearch?: boolean
// 是否使用多单号查询
useNumbersSearch?: boolean
// Reset button configuration // Reset button configuration
resetButtonOptions?: Partial<ButtonProps>; resetButtonOptions?: Partial<ButtonProps>
// Confirm button configuration // Confirm button configuration
submitButtonOptions?: Partial<ButtonProps>; submitButtonOptions?: Partial<ButtonProps>
// Operation column configuration // Operation column configuration
actionColOptions?: Partial<ColEx>; actionColOptions?: Partial<ColEx>
// Show reset button // Show reset button
showResetButton?: boolean; showResetButton?: boolean
// Show confirmation button // Show confirmation button
showSubmitButton?: boolean; showSubmitButton?: boolean
resetFunc?: () => Promise<void>; resetFunc?: () => Promise<void>
submitFunc?: () => Promise<void>; submitFunc?: () => Promise<void>
transformDateFunc?: (date: any) => string; transformDateFunc?: (date: any) => string
colon?: boolean; colon?: boolean
} }
export interface FormSchema { export interface FormSchema {
// Field name // Field name
field: string; field: string
// Event name triggered by internal value change, default change // Event name triggered by internal value change, default change
changeEvent?: string; changeEvent?: string
// Variable name bound to v-model Default value // Variable name bound to v-model Default value
valueField?: string; valueField?: string
// Label name // Label name
label: string | VNode; label?: string | VNode
enLabel?: string | VNode
// Auxiliary text // Auxiliary text
subLabel?: string; subLabel?: string
// Help text on the right side of the text // Help text on the right side of the text
helpMessage?: helpMessage?:
| string | string
| string[] | string[]
| ((renderCallbackParams: RenderCallbackParams) => string | string[]); | ((renderCallbackParams: RenderCallbackParams) => string | string[])
// BaseHelp component props // BaseHelp component props
helpComponentProps?: Partial<HelpComponentProps>; helpComponentProps?: Partial<HelpComponentProps>
// Label width, if it is passed, the labelCol and WrapperCol configured by itemProps will be invalid // Label width, if it is passed, the labelCol and WrapperCol configured by itemProps will be invalid
labelWidth?: string | number; labelWidth?: string | number
// Disable the adjustment of labelWidth with global settings of formModel, and manually set labelCol and wrapperCol by yourself // Disable the adjustment of labelWidth with global settings of formModel, and manually set labelCol and wrapperCol by yourself
disabledLabelWidth?: boolean; disabledLabelWidth?: boolean
// render component // render component
component: ComponentType; component: ComponentType
// Component parameters // Component parameters
componentProps?: componentProps?:
| ((opt: { | ((opt: {
schema: FormSchema; schema: FormSchema
tableAction: TableActionType; tableAction: TableActionType
formActionType: FormActionType; formActionType: FormActionType
formModel: Recordable; formModel: Recordable
}) => Recordable) }) => Recordable)
| object; | object
// Required // Required
required?: boolean | ((renderCallbackParams: RenderCallbackParams) => boolean); required?: boolean | ((renderCallbackParams: RenderCallbackParams) => boolean)
suffix?: string | number | ((values: RenderCallbackParams) => string | number); suffix?: string | number | ((values: RenderCallbackParams) => string | number)
// Validation rules // Validation rules
rules?: Rule[]; rules?: Rule[]
// Check whether the information is added to the label // Check whether the information is added to the label
rulesMessageJoinLabel?: boolean; rulesMessageJoinLabel?: boolean
// Reference formModelItem // Reference formModelItem
itemProps?: Partial<FormItem>; itemProps?: Partial<FormItem>
// col configuration outside formModelItem // col configuration outside formModelItem
colProps?: Partial<ColEx>; colProps?: Partial<ColEx>
// 默认值 // 默认值
defaultValue?: any; defaultValue?: any
// 是否自动处理与时间相关组件的默认值 // 是否自动处理与时间相关组件的默认值
isHandleDateDefaultValue?: boolean; isHandleDateDefaultValue?: boolean
isAdvanced?: boolean; isAdvanced?: boolean
// Matching details components // Matching details components
span?: number; span?: number
ifShow?: boolean | ((renderCallbackParams: RenderCallbackParams) => boolean); ifShow?: boolean | ((renderCallbackParams: RenderCallbackParams) => boolean)
show?: boolean | ((renderCallbackParams: RenderCallbackParams) => boolean); show?: boolean | ((renderCallbackParams: RenderCallbackParams) => boolean)
// Render the content in the form-item tag // Render the content in the form-item tag
render?: (renderCallbackParams: RenderCallbackParams) => VNode | VNode[] | string; render?: (renderCallbackParams: RenderCallbackParams) => VNode | VNode[] | string
// Rendering col content requires outer wrapper form-item // Rendering col content requires outer wrapper form-item
renderColContent?: (renderCallbackParams: RenderCallbackParams) => VNode | VNode[] | string; renderColContent?: (renderCallbackParams: RenderCallbackParams) => VNode | VNode[] | string
renderComponentContent?: renderComponentContent?:
| ((renderCallbackParams: RenderCallbackParams) => any) | ((renderCallbackParams: RenderCallbackParams) => any)
| VNode | VNode
| VNode[] | VNode[]
| string; | string
// Custom slot, in from-item // Custom slot, in from-item
slot?: string; slot?: string
// Custom slot, similar to renderColContent // Custom slot, similar to renderColContent
colSlot?: string; colSlot?: string
// label上的插槽
labelSlot?: string
dynamicDisabled?: boolean | ((renderCallbackParams: RenderCallbackParams) => boolean); dynamicDisabled?: boolean | ((renderCallbackParams: RenderCallbackParams) => boolean)
dynamicRules?: (renderCallbackParams: RenderCallbackParams) => Rule[]; dynamicRules?: (renderCallbackParams: RenderCallbackParams) => Rule[]
} }
export interface HelpComponentProps { export interface HelpComponentProps {
maxWidth: string; maxWidth: string
// Whether to display the serial number // Whether to display the serial number
showIndex: boolean; showIndex: boolean
// Text list // Text list
text: any; text: any
// colour // colour
color: string; color: string
// font size // font size
fontSize: string; fontSize: string
icon: string; icon: string
absolute: boolean; absolute: boolean
// Positioning // Positioning
position: any; position: any
} }

@ -0,0 +1,7 @@
import { intersection } from 'lodash-es'
import { usePermissionStore } from '/@/store/modules/permission'
export function checkPermissions(key) {
const permissionStore = usePermissionStore()
const allCodeList = permissionStore.getPermCodeList as string[]
return !((intersection([key], allCodeList) as string[]).length > 0)
}

@ -0,0 +1,224 @@
import { router } from "/@/router"
import { useMultipleTabStore } from '/@/store/modules/multipleTab'
import { useMessage } from '/@/hooks/web/useMessage'
// 获取表单更改过的字段接口
import { getFormSetInfoByModule } from '/@/views/baseinfo/formset/api'
// 引入表格权限信息包含id和name
import { permissionsInfo } from '/@/hooks/web/usePermission'
import * as XLSX from 'xlsx'
const { createMessage } = useMessage()
// 格式表格时间
export function formatTableData(v) {
if (v) {
v = v.split(' ')[0]
if (v.includes('1900')) v = ''
return v
} else {
return ''
}
}
/* ()
* topath: path
*/
export function closePage(topath) {
const tabStore = useMultipleTabStore()
tabStore.closeTab(router.currentRoute._value, router)
// 有目标路径则跳转
if (topath) {
router.push(topath)
} else {
// 父级路由
const parent = router?.options?.history?.state?.back
// 如果存在父级路由,直接返回父级
if (parent) {
router.push(parent)
} else {
// 否则返回上一级路由
router.back()
}
}
}
/* excel()
* api: params: columes: name: excel
*/
export function exportExcel(api, params = {}, columns = [], name = '未命名') {
if (!api) return createMessage.warning('缺少api')
params['pageCondition']['isExport'] = true
// 过滤出需要显示的列
const cols = columns.filter(item => {
return !item.defaultHidden || item.visible
})
api(params).then(res => {
const { data } = res
const fileData = data.map(row => {
const obj = {}
cols.forEach(item => {
for (var key in row) {
if (item.dataIndex === key) {
obj[item.title] = row[key]
}
}
})
return obj
})
toBlob(fileData, name)
})
}
// 将字符串转换为ArrayBuffer
function s2ab(s) {
const buf = new ArrayBuffer(s.length)
const view = new Uint8Array(buf)
for (let i = 0; i !== s.length; ++i) view[i] = s.charCodeAt(i) & 0xff
return buf
}
/* excel()
* data: columes: name: excel
*/
export function exportExcelByData(data = [], columns = [], name = '未命名') {
// 过滤出需要显示的列
const cols = columns.filter(item => {
return !item.defaultHidden || item.visible
})
const fileData = data.map(row => {
const obj = {}
cols.forEach(item => {
for (var key in row) {
if (item.dataIndex === key) {
obj[item.title] = row[key]
}
}
})
return obj
})
toBlob(fileData, name)
}
function toBlob(fileData, name) {
// 创建工作簿
const workbook = XLSX.utils.book_new()
// 将数据转换为工作表
const worksheet = XLSX.utils.json_to_sheet(fileData)
// 将工作表添加到工作簿
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1')
// 生成Excel的配置
const wbout = XLSX.write(workbook, { bookType: 'xlsx', type: 'binary' })
// 创建二进制对象并创建url
const blob = new Blob([s2ab(wbout)], { type: 'application/octet-stream' })
const url = URL.createObjectURL(blob)
// 创建a标签模拟点击进行下载
const a = document.createElement('a')
a.href = url
a.download = name + '.xlsx'
document.body.appendChild(a)
a.click()
// 清除对象URL
setTimeout(() => {
URL.revokeObjectURL(url)
document.body.removeChild(a)
}, 0)
}
// 更新表单数据
export function updateFormItem(updateSchema, formNo) {
getFormSetInfoByModule({ permissionId: permissionsInfo().permissionId, formNo }).then(res => {
if (res?.data?.content) {
const content = JSON.parse(res.data.content)
console.log(content)
updateSchema(content.columns)
}
})
}
// 返回表格查询的参数 multipleList(需要多选查询的字段名数组)
export function formatParams(params = {}) {
const postData = {
queryCondition: '',
pageCondition: {
pageIndex: params?.page,
pageSize: params?.pageSize,
sortConditions: []
}
}
const conditions = [] as any
for (let key in params) {
// 排除不是分页排序等字段
if (key != 'page' && key != 'pageSize' && key != 'order' && key != 'field') {
if (key == 'advancedSearchParams') {
// 高级查询
conditions.push(params[key])
} else {
// 其他查询
if (Array.isArray(params[key])) {
const isDate = new Date(params[key][0]) as any
// 判定为日期
if (isDate != 'Invalid Date' && isDate.getFullYear() > 1000) {
//替换时分秒 查询用
params[key][0] = params[key][0].substring(0, 11) + "00:00:00";
params[key][1] = params[key][1].substring(0, 11) + "23:59:59";
conditions.push({
FieldName: key,
FieldValue: params[key][0],
ConditionalType: 3
})
conditions.push({
FieldName: key,
FieldValue: params[key][1],
ConditionalType: 5
})
} else {
// 判定为筛选
params[key].forEach(item => {
conditions.push({
FieldName: key,
FieldValue: item,
ConditionalType: 1
})
})
}
} else if (key.includes(':')) {
// or 多个字段查询
const orKeys = key.split(':')
const ConditionalList = { ConditionalList: [] }
if (params[key]) {
orKeys.forEach(item => {
let obj = {
Key: 1,
Value: {
FieldName: item,
FieldValue: params[key],
ConditionalType: 1
}
}
ConditionalList.ConditionalList.push(obj)
})
conditions.push(ConditionalList)
}
} else {
// 其他普通查询
if (params[key] || params[key] === 0) {
conditions.push({
FieldName: key,
FieldValue: params[key],
ConditionalType: 1
})
}
}
}
}
}
// 排序
if (params?.field) {
postData.pageCondition.sortConditions = [{
sortField: params.field,
listSortDirection: params.order == "ascend" ? 0 : 1
}]
} else {
postData.pageCondition.sortConditions = []
}
postData.queryCondition = JSON.stringify(conditions)
return postData
}

@ -0,0 +1,123 @@
<template>
<BasicModal
v-bind="$attrs"
:use-wrapper="true"
:title="getTitle"
width="30%"
@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 { ApiEdit, ApiInfo } from './api'
import { useMessage } from '/@/hooks/web/useMessage'
// 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 }] = 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 ApiInfo({ id: unref(rowId) })
if (res.succeeded) {
setFieldsValue({
...res.data,
})
// console.log('Form', getFieldsValue());
// setFieldsValue({ trainId: unref(res.data.trainId) });
}
// setModalProps({ confirmLoading: false });
} else {
setFieldsValue({ permissionIdentity: unref(2) })
}
setModalProps({ loading: false })
})
const getTitle = computed(() => (!unref(isUpdate) ? '新增放舱通道配置' : '编辑放舱通道配置'))
async function handleSave(exit) {
try {
const values = await validate()
setModalProps({ confirmLoading: true, loading: true })
// TODO custom api
console.log(values)
// loading.value = true;
const res: API.DataResult = await ApiEdit(values)
console.log(res)
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 ApiInfo({ id: unref(rowId) })
if (res.succeeded) {
await setFieldsValue({
...res.data,
})
}
}
</script>

@ -0,0 +1,40 @@
// @ts-ignore
import { request } from '/@/utils/request'
import { DataResult, PageRequest } from '/@/api/model/baseModel'
enum Api {
list = '/adminApi/ReleaseType/GetList',
editORinfo = '/adminApi/ReleaseType/Edit',
del = '/adminApi/ReleaseType/Delete',
}
// 列表 (Auth)
export function ApiList(data: PageRequest) {
return request<DataResult>({
url: Api.list,
method: 'post',
data,
})
}
// 编辑 (Auth)
export function ApiEdit(data: PageRequest) {
return request<DataResult>({
url: Api.editORinfo,
method: 'post',
data,
})
}
// 详情 (Auth)
export function ApiInfo(query) {
return request<DataResult>({
url: Api.editORinfo,
method: 'get',
params: query,
})
}
// 批量删除 (Auth)
export function ApiDel(data: PageRequest) {
return request<DataResult>({
url: Api.del,
method: 'post',
data,
})
}

@ -0,0 +1,170 @@
import { BasicColumn, FormSchema } from '/@/components/Table'
import { GetCarrierSelectList, GetClientPortSelectList } from '/@/api/common'
export const columns: BasicColumn[] = [
{
title: '承运商',
dataIndex: 'carrier',
sorter: true,
width: 150,
},
{
title: '起运港代码',
dataIndex: 'loadingPort',
sorter: true,
width: 200,
},
{
title: '放舱方式名称',
dataIndex: 'releaseTypeName',
sorter: true,
width: 200,
},
]
export const searchFormSchema: FormSchema[] = [
{
label: '承运商',
field: 'carrier',
labelSlot: 'carrierId',
component: 'ApiSelect',
colProps: { span: 6 },
componentProps: ({ formModel }) => {
return {
api: GetCarrierSelectList,
labelField: 'pinYinCode',
showName: 'cnName',
valueField: 'code',
resultField: 'data',
immediate: false,
onChange: (e, obj) => {
console.log(obj)
if (e && obj) {
formModel.carrierId = obj.id
}
if (!e && !obj) {
formModel.carrierId = ''
}
},
}
},
},
{
label: '起运港',
field: 'loadingPort',
component: 'ApiSelect',
colProps: { span: 6 },
componentProps: () => {
return {
api: GetClientPortSelectList,
resultField: 'data',
allowClear: true,
showSearch: true,
labelField: 'portName',
showName: 'portName',
valueField: 'ediCode',
immediate: true,
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
}
},
},
{
field: 'releaseType',
label: '放舱方式',
component: 'Select',
colProps: { span: 6 },
componentProps: {
options: [
{ label: '入货通知', value: 1 },
{ label: '转发BC', value: 2 },
],
},
},
]
export const formSchema: FormSchema[] = [
{
label: '',
field: 'id',
component: 'Input',
defaultValue: '',
show: false,
},
{
label: '承运商',
field: 'carrier',
labelSlot: 'carrierId',
component: 'ApiSelect',
required: false,
dynamicDisabled: false,
colProps: { span: 20 },
componentProps: ({ formModel }) => {
return {
api: GetCarrierSelectList,
labelField: 'pinYinCode',
showName: 'cnName',
valueField: 'code',
resultField: 'data',
immediate: false,
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
onChange: (e, obj) => {
console.log(obj)
if (e && obj) {
formModel.carrierId = obj.id
}
if (!e && !obj) {
formModel.carrierId = ''
}
},
}
},
},
{
label: '委托单位',
field: 'customerId',
component: 'Input',
defaultValue: null,
show: false,
},
{
label: '起运港',
field: 'loadingPort',
component: 'ApiSelect',
required: true,
dynamicDisabled: false,
colProps: { span: 20 },
componentProps: () => {
return {
api: GetClientPortSelectList,
resultField: 'data',
allowClear: true,
showSearch: true,
labelField: 'portName',
showName: 'portName',
valueField: 'ediCode',
immediate: true,
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
}
},
},
{
field: 'releaseType',
label: '放舱方式',
component: 'Select',
required: true,
colProps: { span: 20 },
componentProps: {
options: [
{ label: '入货通知', value: 1 },
{ label: '转发BC', value: 2 },
],
},
},
]

@ -0,0 +1,150 @@
<template>
<div>
<BasicTable class="ds-table" @register="registerTable" @row-dbClick="handleAudit">
<template #toolbar>
<a-button type="primary" @click="handleCreate"> </a-button>
<a-popconfirm
title="确定删除当前选中数据?"
ok-text="是"
cancel-text="否"
@confirm="handleDel"
>
<a-button type="primary" @click="handleCreate"> </a-button>
</a-popconfirm>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{
icon: 'clarity:note-edit-line',
tooltip: '编辑',
onClick: handleAudit.bind(null, record),
},
]"
/>
</template>
</template>
</BasicTable>
<TenantAuditStepModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import { Divider } from 'ant-design-vue'
import { BasicTable, useTable, TableAction, SorterResult } from '/@/components/Table'
import { ApiList, ApiDel } from './api'
import { useModal } from '/@/components/Modal'
import TenantAuditStepModal from './TenantAuditStepModal.vue'
import { columns, searchFormSchema } from './columns'
import { useMessage } from '/@/hooks/web/useMessage'
const { notification } = useMessage()
const [registerModal, { openModal }] = useModal()
const [registerTable, { reload, getForm, getSelectRows, getPaginationRef }] = useTable({
title: '放舱通道配置列表',
api: async (p) => {
const res: API.DataResult = await ApiList(p)
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.carrier) {
condition.push({
FieldName: 'carrier',
FieldValue: data.carrier,
ConditionalType: 1,
})
}
if (!!data.loadingPort) {
condition.push({
FieldName: 'loadingPort',
FieldValue: data.loadingPort,
ConditionalType: 1,
})
}
if (!!data.releaseType) {
condition.push({
FieldName: 'releaseType',
FieldValue: data.releaseType,
ConditionalType: 1,
})
}
postParam.queryCondition = JSON.stringify(condition)
// console.log(postParam);
return postParam
},
columns,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
},
isTreeTable: false,
pagination: true,
striped: true,
useSearchForm: true,
showTableSetting: true,
bordered: true,
showIndexColumn: true,
indexColumnProps: {
width: 60,
},
canResize: true,
resizeHeightOffset: 35,
immediate: true,
actionColumn: {
width: 80,
title: '操作',
dataIndex: 'action',
fixed: 'right',
},
})
function handleDel() {
const select = getSelectRows()
let ApiData: any = {
ids: [],
}
if (select.length === 0) {
notification.warning({ message: '请至少选择一条数据', duration: 3 })
return false
} else {
ApiData.ids = select.map((item) => {
return item.id
})
}
ApiDel(ApiData).then((res) => {
console.log(res)
notification.success({ message: res.message, duration: 3 })
reload()
})
}
function handleCreate() {
openModal(true, {
isParent: false,
isUpdate: false,
})
}
function handleAudit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
})
}
function handleSuccess() {
reload()
}
</script>
Loading…
Cancel
Save