打印模版迭代

szh-new
lijingjia 3 months ago
parent a023e8ef06
commit ad2ee42a31

@ -185,10 +185,7 @@
}
//
const copyHandle = async () => {
if (copyFlag.value) return
copyFlag.value = true
await props.copy()
copyFlag.value = false
}
//
const toPage = (v) => {
@ -223,18 +220,12 @@
}
//
const saveHandle = async () => {
if (saveFlag.value) return
saveFlag.value = true
await props.save()
saveFlag.value = false
}
const submitFlag = ref(false)
//
const submitHandle = async () => {
if (submitFlag.value) return
submitFlag.value = true
await props.submit()
submitFlag.value = false
}
return {
t,

@ -68,9 +68,9 @@
const data = props.formSchema
const columns = data.map((item: FormSchema) => {
const res = {
defaultValue: item.defaultValue || '',
field: item.field || '',
label: item.label || '',
defaultValue: item.defaultValue || null,
field: item.field || null,
label: item.label || null,
required: item.required || false,
colProps: item.colProps || { span: 24 },
component: item.component,

@ -151,8 +151,7 @@
? rulesMessageJoinLabel
: globalRulesMessageJoinLabel
const defaultMsg = createPlaceholderMessage(component) + `${joinLabel ? label : ''}`
function validator(rule: any, value: any) {
async function validator(rule: any, value: any) {
const msg = rule.message || defaultMsg
if (value === undefined || isNull(value)) {
//
@ -187,12 +186,12 @@
*/
if (getRequired) {
if (!rules || rules.length === 0) {
rules = [{ required: getRequired, validator }]
// rules = [{ required: getRequired, validator }]
} else {
const requiredIndex: number = rules.findIndex((rule) => Reflect.has(rule, 'required'))
if (requiredIndex === -1) {
rules.push({ required: getRequired, validator })
// rules.push({ required: getRequired, validator })
}
}
}

@ -123,9 +123,9 @@
const addFormToSet = () => {
const columns = props.formSchema.map((item: FormSchema) => {
const res = {
defaultValue: item.defaultValue || '',
field: item.field || '',
label: item.label || '',
defaultValue: item.defaultValue || null,
field: item.field || null,
label: item.label || null,
required: item.required || false,
colProps: item.colProps || { span: 24 },
component: item.component

@ -985,7 +985,6 @@ export const formSchema: FormSchema[] = [
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
onChange: (e, obj) => {
console.log(obj)
if (e && obj) {
formModel.customerService = obj.value
formModel.customerServiceName = obj.label

@ -51,14 +51,15 @@
const loading = ref(false)
const rowId = ref('')
const { createMessage } = useMessage()
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema, getFieldsValue }] = useForm({
labelWidth: 100,
schemas: formSchema,
showActionButtonGroup: false,
})
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
const [registerModal, { setModalProps, closeModal, updateFormField }] = useModalInner(async (data) => {
resetFields()
setModalProps({ confirmLoading: false, loading: true })
updateFormField(updateSchema)
isUpdate.value = !!data?.isUpdate
if (unref(isUpdate)) {
// setModalProps({ confirmLoading: true });
@ -67,7 +68,7 @@
// getFieldList()
if (res.succeeded) {
setFieldsValue({
...res.data,
...res.data
})
// console.log('Form', getFieldsValue());
// setFieldsValue({ trainId: unref(res.data.trainId) });
@ -82,6 +83,8 @@
const getTitle = computed(() => (!unref(isUpdate) ? '新增航线信息' : '编辑航线信息'))
async function handleSave(exit) {
console.log(getFieldsValue())
return
try {
const values = await validate()
setModalProps({ confirmLoading: true, loading: true })

@ -88,7 +88,7 @@ export const formSchema: FormSchema[] = [
label: '',
field: 'id',
component: 'Input',
defaultValue: '',
defaultValue: null,
show: false,
},
{
@ -97,6 +97,7 @@ export const formSchema: FormSchema[] = [
component: 'Input',
required: true,
colProps: { span: 12 },
defaultValue: null,
dynamicDisabled: ({ values }) => {
return !!values.id
},
@ -106,13 +107,14 @@ export const formSchema: FormSchema[] = [
label: '航线中文名称',
component: 'Input',
required: true,
defaultValue: null,
colProps: { span: 12 },
},
{
field: 'laneEnName',
label: '航线英文名称',
component: 'Input',
defaultValue: null,
colProps: { span: 12 },
},
{
@ -120,6 +122,7 @@ export const formSchema: FormSchema[] = [
label: '默认操作员',
component: 'ApiSelect',
colProps: { span: 12 },
defaultValue: null,
componentProps: ({ formModel }) => {
return {
api: GetCustomerServiceList,
@ -150,6 +153,7 @@ export const formSchema: FormSchema[] = [
label: '默认单证',
component: 'ApiSelect',
colProps: { span: 12 },
defaultValue: null,
componentProps: ({ formModel }) => {
return {
api: GetVouchingClerkList,
@ -180,6 +184,7 @@ export const formSchema: FormSchema[] = [
label: '默认客服',
component: 'ApiSelect',
colProps: { span: 12 },
defaultValue: null,
componentProps: ({ formModel }) => {
return {
api: GetCustomerServiceList,
@ -209,6 +214,7 @@ export const formSchema: FormSchema[] = [
field: 'ediCode',
label: 'EDI代码',
component: 'Input',
defaultValue: null,
colProps: { span: 12 },
},
{
@ -216,6 +222,7 @@ export const formSchema: FormSchema[] = [
label: '备注',
component: 'InputTextArea',
colProps: { span: 12 },
defaultValue: null,
componentProps: {
rows: 2,
},

@ -5,7 +5,16 @@
-->
<template>
<a-spin :spinning="logLoading">
<div class="info-header">
<a-timeline style="margin-left: 89px; margin-top: 20px;">
<a-timeline-item v-for="item in logList" :key="item.id">
<div style="position: relative;">
<div class="ds-journal-timer">{{ item.createTime }}</div>
<div>{{ item.createUserName }}</div>
<div><span style="color: #7A8798;">操作了 </span><span style="color: #257AFA;">{{ item.sourceName }}</span></div>
</div>
</a-timeline-item>
</a-timeline>
<!-- <div class="info-header">
<span style="width: 30%; display: inline-block">修改人</span>
<span style="width: 35%; display: inline-block">修改时间</span>
<span style="width: 35%; display: inline-block">功能模块</span>
@ -16,7 +25,7 @@
<span style="width: 35%; display: inline-block">{{ item.createTime }}</span>
<span style="width: 35%; display: inline-block">{{ item.sourceName }}</span>
</div>
</div>
</div> -->
</a-spin>
</template>
@ -53,6 +62,17 @@
</script>
<style scoped>
.ds-journal-timer {
position: absolute;
left: -115px;
width: 78px;
height: 20px;
border-radius: 2px;
background: #F5F9FC;
color: #257AFA;
line-height: 20px;
text-align: center;
}
.info-header {
background: #F5F9FC;
padding: 10px;

@ -94,7 +94,7 @@ export const basicInfoFormSchema: FormSchema[] = [
labelSlot: 'customerName',
field: 'customerName',
component: 'ApiSelect',
required: false,
required: true,
dynamicDisabled: false,
colProps: { span: 5 },
componentProps: ({ formModel, formActionType }) => {
@ -230,9 +230,10 @@ export const basicInfoFormSchema: FormSchema[] = [
labelSlot: 'carrierId',
component: 'ApiSelect',
required: false,
defaultValue: null,
dynamicDisabled: false,
colProps: { span: 5 },
componentProps: ({ formModel }) => {
componentProps: ({ formModel, formActionType }) => {
return {
api: GetCarrierSelectList,
labelField: 'pinYinCode',

@ -92,7 +92,7 @@
import { useRoute } from 'vue-router'
import { Divider } from 'ant-design-vue';
//
import { updateFormItem } from '/@/hooks/web/common'
// import { updateFormItem } from '/@/hooks/web/common'
const route = useRoute()
//
const source = ref(route.query.source || 'edit')
@ -119,7 +119,12 @@
showActionButtonGroup: false,
size: 'small',
})
updateFormItem(updateSchema, 10)
console.log(basicInfoFormSchema)
// updateFormItem(updateSchema, 10)
setTimeout(() => {
console.log(basicInfoFormSchema)
}, 100)
// //
const RefChilrenRef = ref('')
//
@ -175,7 +180,7 @@
watch(
() => props.details,
(v) => {
setFieldsValue(v)
if (v) setFieldsValue(v)
formData.customerNo = v.customerNo
formData.shippingSpaceType = v.shippingSpaceType
formData.bookingType = v.bookingType

@ -270,10 +270,14 @@
watch(
() => props.details,
(nval) => {
setFieldsValueL({
...nval
})
setFieldsValueR(nval)
if (nval) {
setFieldsValueL({
...nval
})
setFieldsValueR({
...nval
})
}
},
{ deep: true }
)

@ -14,7 +14,9 @@ enum Api {
temInfo = '/mainApi/PrintTemplate/GetSysPrintTemplateInfo',
info = '/mainApi/PrintTemplate/GetSysPrintModuleInfo',
delete = '/mainApi/ClientParam/BatchDelClientParam',
GetTenantParamDataSelectList = '/mainApi/ClientParam/GetTenantParamDataSelectList'
GetTenantParamDataSelectList = '/mainApi/ClientParam/GetTenantParamDataSelectList',
GetOpenSqlPrintInfo = '/printApi/OpenPrint/GetOpenSqlPrintInfo'
}
// 模版列表 (Auth)
export function GetSysPrintTemplateList(data) {
@ -68,9 +70,9 @@ export function GetSysPrintTemplateInfo(params) {
}
// 删除 (Auth)
export function BatchDelClientParam(data: PageRequest) {
export function GetOpenSqlPrintInfo(data: PageRequest) {
return request<DataResult>({
url: Api.delete,
url: Api.GetOpenSqlPrintInfo,
method: 'post',
data
})
@ -82,4 +84,13 @@ export function GetTenantParamDataSelectList(query) {
method: 'get',
params: query
})
}
// sql打印模版
export function BatchDelClientParam(data: PageRequest) {
return request<DataResult>({
url: Api.delete,
method: 'post',
data
})
}

@ -248,6 +248,16 @@ export const temFormSchema: FormSchema[] = [
]
}
},
{
field: 'sqlModel',
label: ' ',
slot: 'sqlModel',
component: 'Input',
colProps: { span: 12 },
show: ({ values }) => {
return values.isUseDataSource && values.id
}
},
{
field: 'sourceSql',
label: '数据源',

@ -12,6 +12,9 @@
<template #isUseDataSource="{ model, field }">
<a-switch v-model:checked="model[field]" /> <span class="switch-tex">{{ model[field] ? '是' : '否' }}</span>
</template>
<template #sqlModel="{ model }">
<a-button key="submit" type="primary" :loading="loading" @click="sqlPrint(model)">sql</a-button>
</template>
</BasicForm>
<!--右下角按钮-->
<template #footer>
@ -50,10 +53,11 @@
//
import { BasicModal, useModalInner } from '/@/components/Modal'
import { BasicForm, useForm } from '/@/components/Form/index'
import { useUserStore } from '/@/store/modules/user'
//
import { temFormSchema } from '../columns'
//
import { EditSysPrintTemplate, GetSysPrintTemplateInfo } from '../api'
import { EditSysPrintTemplate, GetSysPrintTemplateInfo, GetOpenSqlPrintInfo } from '../api'
//
import { useMessage } from '/@/hooks/web/useMessage'
// Emits
@ -90,6 +94,25 @@
setModalProps({ loading: false })
})
// sql
const sqlPrint = (model) => {
console.log(model)
const userStore = useUserStore()
if (!model.inParamColumn) {
return createMessage.warning('请先填写入口参数!')
}
const postData = {
"tenantId": userStore.getUserInfo.tenantId,
"templateId": model.id,
"paramJsonStr": model.inParamColumn,
"printType": "1"
}
GetOpenSqlPrintInfo(postData).then(res => {
if (res.succeeded) {
return createMessage.success('打印成功!')
}
})
}
const getTitle = computed(() => (!unref(isUpdate) ? '新增' : '编辑'))
async function handleSave(exit) {

Loading…
Cancel
Save