lijingjia 2 months ago
commit d5bceb2f15

@ -78,7 +78,9 @@
setModalProps({ loading: false })
})
const getTitle = computed(() => (!unref(isUpdate) ? '新增EDI设置' : '编辑EDI设置'))
const getTitle = computed(() =>
!unref(isUpdate) ? '新增订舱货物状态管理' : '编辑订舱货物状态管理',
)
async function handleSave(exit) {
try {

@ -265,19 +265,27 @@
data: 'unit',
type: 'dropdown',
source: async (query, process) => {
if (unitDict.value && unitDict.value.length) {
const dict = unitDict.value.map((item) => {
return item.value + '-' + item.name
})
process(dict)
} else {
const results = await feeUnitDict()
unitDict.value = results
const dict = results.map((item) => {
return item.value + '-' + item.name
})
process(dict)
}
// if (unitDict.value && unitDict.value.length) {
// const dict = unitDict.value.map((item) => {
// return item.value + '-' + item.name
// })
// process(dict)
// } else {
// const results = await feeUnitDict()
// unitDict.value = results
// const dict = results.map((item) => {
// return item.value + '-' + item.name
// })
// process(dict)
// }
const results = [
{ label: '20GP', name: '20GP', value: '22G0' },
{ label: '40GP', name: '40GP', value: '42G0' },
]
const dict = results.map((res) => {
return res.label
})
process(dict)
},
},
{

@ -417,7 +417,7 @@ export const searchFormSchema: FormSchema[] = [
label: '客户属性',
field: 'clientTag',
component: 'ApiSelect',
colProps: { span: 8 },
colProps: { span: 4 },
componentProps: () => {
return {
api: () => {
@ -515,6 +515,19 @@ export const searchFormSchema: FormSchema[] = [
}
},
},
{
field: 'auditStatus',
label: '审批状态',
component: 'Select',
colProps: { span: 4 },
componentProps: {
options: [
{ label: '待审批', value: 0 },
{ label: '审核通过', value: 1 },
{ label: '驳回', value: 2 },
],
},
},
]
export const formSchema: FormSchema[] = [

@ -0,0 +1,131 @@
<template>
<BasicModal
v-bind="$attrs"
:use-wrapper="true"
:title="getTitle"
width="80%"
@register="registerModal"
@ok="handleSave"
>
<!-- 费用模版表单 -->
<BasicForm @register="registerForm" />
<!-- 费用字段表格 -->
<FeeField ref="feeField"></FeeField>
<!--右下角按钮-->
<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 FeeField from './feeField.vue'
//
import { formSchema } from './columns'
//
import { ApiEdit, ApiInfo } from './api'
//
import { useMessage } from '/@/hooks/web/useMessage'
const props = defineProps({
customerName: { type: String },
customerId: { type: String },
})
// Emits
const emit = defineEmits(['success', 'register'])
const isUpdate = ref(true)
const detailId = ref()
// loading
const loading = ref(false)
const rowId = ref('')
const { createMessage } = useMessage()
const [registerForm, { resetFields, setFieldsValue, getFieldsValue, 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 })
rowId.value = data.record.id
const res: API.DataResult = await ApiInfo({ id: unref(rowId) })
if (res.succeeded) {
setFieldsValue({
...res.data,
})
feeField.value.SetData(res.data.details)
feeField.value.condition = res.data.condition
detailId.value = res.data.id
}
} else {
detailId.value = ''
setFieldsValue({
customerName: props.customerName,
customerId: props.customerId,
})
feeField.value.SetData([])
feeField.value.condition = ''
}
setModalProps({ loading: false })
},
)
const getTitle = computed(() => (!unref(isUpdate) ? '新增' : '编辑'))
//
const feeField = ref()
async function handleSave(exit) {
try {
const values = await validate()
const feeList = feeField.value.validate()
values['details'] = feeList
values['condition'] = feeField.value.condition
values['isShared'] = true
loading.value = true
setModalProps({ confirmLoading: true, loading: true })
const res: API.DataResult = await ApiEdit(values)
loading.value = false
if (res.succeeded) {
createMessage.success(res.message)
emit('success')
} else {
createMessage.error(res.message)
}
exit && closeModal()
} finally {
loading.value = false
setModalProps({ confirmLoading: false, loading: false })
}
}
</script>

@ -0,0 +1,60 @@
// @ts-ignore
import { request } from '/@/utils/request'
import { DataResult, PageRequest } from '/@/api/model/baseModel'
enum Api {
list = '/feeApi/FeeCustTemplate/GetList',
edit = '/feeApi/FeeCustTemplate/Edit',
info = '/feeApi/FeeCustTemplate/Edit',
delete = '/feeApi/FeeCustTemplate/Delete',
GetColumns = '/mainApi/Common/GetColumnsByClient',
DeleteDetails = '/feeApi/FeeCustTemplate/DeleteDetails',
}
// 根据表明 查询数据
export function getColumns(query: { id: string }) {
return request<DataResult>({
url: Api.GetColumns,
method: 'get',
params: query,
})
}
// 列表 (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.edit,
method: 'post',
data,
})
}
// 详情 (Auth)
export function ApiInfo(query) {
return request<DataResult>({
url: Api.info,
method: 'get',
params: query,
})
}
// 删除 (Auth)
export function ApiDel(data: PageRequest) {
return request<DataResult>({
url: Api.delete,
method: 'post',
data
})
}
// 根据ID删除明细 (Auth)
export function DeleteDetails(data: PageRequest) {
return request<DataResult>({
url: Api.DeleteDetails,
method: 'post',
data
})
}

@ -0,0 +1,159 @@
import { ref } from 'vue'
import { BasicColumn, FormSchema } from '/@/components/Table'
// 引入字典数据
import { getDictOption } from '/@/utils/dictUtil'
// 下拉框数据接口
import { GetClientListByCode } from '/@/api/common'
// 往来单位下拉框数据
const companyDict = ref([])
let businessType: any = [
{ value: 1, label: '海运出口' },
{ value: 2, label: '海运进口' },
]
export const columns: BasicColumn[] = [
{
title: '模板名称',
dataIndex: 'name',
width: 200,
},
{
title: '业务类型',
dataIndex: 'businessTypeText',
width: 200,
},
{
title: '结算对象',
dataIndex: 'customerName',
width: 200,
},
{
title: '说明',
dataIndex: 'description',
width: 200,
},
{
title: '录入日期',
dataIndex: 'createTime',
width: 200,
},
{
title: '备注',
dataIndex: 'note',
width: 200,
},
]
export const searchFormSchema: FormSchema[] = [
{
field: 'name',
label: '模板名称',
component: 'Input',
colProps: { span: 6 },
},
]
export const formSchema: FormSchema[] = [
{
label: '主键Id',
field: 'id',
component: 'Input',
defaultValue: '',
show: false,
},
{
field: 'name',
label: '模板名称',
component: 'Input',
required: true,
colProps: { span: 8 },
},
{
field: 'businessType',
label: '业务类型',
component: 'Select',
required: true,
colProps: { span: 8 },
componentProps: () => {
return {
options: businessType,
}
},
},
// {
// field: 'customerType',
// label: '客户类别',
// defaultValue: '',
// component: 'ApiSelect',
// colProps: { span: 5 },
// componentProps: ({ formModel }) => {
// return {
// api: () => {
// return new Promise((resolve) => {
// getDictOption('djy_cust_prop').then((res) => {
// console.log(res, 111111111111111)
// resolve(res)
// })
// })
// },
// labelField: 'label',
// valueField: 'value',
// resultField: 'data',
// filterOption: (input: string, option: any) => {
// return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
// },
// onChange: (v: string, obj) => {
// GetClientListByCode({ code: v }).then((res) => {
// const { data } = res
// data.forEach((item) => {
// item['label'] = item.shortName
// item['value'] = item.codeName
// })
// companyDict.value = data
// })
// },
// }
// },
// },
{
field: 'customerId',
label: '结算对象',
defaultValue: '',
component: 'Input',
show: false,
colProps: { span: 8 },
},
{
field: 'customerName',
label: '结算对象',
component: 'Input',
defaultValue: '',
dynamicDisabled: true,
colProps: { span: 8 },
},
// {
// label: '',
// field: 'customerId',
// component: 'Input',
// defaultValue: '',
// show: false,
// },
// {
// label: '',
// field: 'customerType',
// component: 'Input',
// defaultValue: '',
// show: false,
// },
{
field: 'description',
label: '模板说明',
component: 'Input',
colProps: { span: 8 },
},
{
field: 'note',
label: '备注',
component: 'Input',
colProps: { span: 16 },
},
]

@ -0,0 +1,895 @@
<template>
<div class="fee-field">
<div class="flex">
<span class="title">费用字段</span>
<div>
<a-button type="link" @click="OpenSetCondition">
<span class="iconfont icon-jichupeizhi"></span>
设置方案条件
</a-button>
<a-button type="link" @click="addRow">
<span class="iconfont icon-new_document"></span>
添加
</a-button>
<a-popconfirm
title="确定删除当前选中数据?"
ok-text="是"
cancel-text="否"
@confirm="deleteRow"
>
<a-button type="link">
<span class="iconfont icon-shanchu21"></span>
删除
</a-button>
</a-popconfirm>
</div>
</div>
<a-spin :spinning="loading">
<div style="position: relative">
<input class="ds-tb-check" type="checkbox" v-model="allCheck" :indeterminate="someCheck" />
<hot-table ref="hotTb" :data="list" :settings="settings">
<img v-show="!list.length" src="../../../assets/images/nodata.png" alt="" />
</hot-table>
</div>
</a-spin>
<AdvancedSearch
ref="advanceSearch"
:schemas="SetConditionSchemas"
@toSearch="toSearch"
title="方案条件"
:IsApi="false"
:IsApiData="Rcondition"
/>
</div>
</template>
<script lang="ts" setup>
import {
ref,
onMounted,
defineProps,
watch,
nextTick,
defineComponent,
defineExpose,
watchEffect,
inject,
} from 'vue'
//
import { GetFeeCodeSelectList, GetFeeCurrencySelectList } from '/@/api/common'
import { getColumns, DeleteDetails } from './api'
// import { GetFeeTemplateDetailList, BatchDelFeeTemplateDetail } from '../api'
//
import { feeUnitDict } from '/@/hooks/dict/index'
//
// import { getDictOption } from '/@/utils/dictUtil'
import AdvancedSearch from '/@/components/Form/src/components/AdvancedSearch.vue'
import { useMessage } from '/@/hooks/web/useMessage'
import { HotTable, HotColumn } from '@handsontable/vue3'
import { registerAllModules } from 'handsontable/registry'
import 'handsontable/dist/handsontable.full.min.css'
defineComponent({
HotTable,
HotColumn,
})
registerAllModules()
const { createMessage, notification } = useMessage()
const props = defineProps({})
// -----------------------------------------
let Arr = ref([
{
value: '0',
label: 'Equal',
},
{
value: '1',
label: 'Like',
},
{
value: '2',
label: 'GreaterThan',
},
{
value: '3',
label: 'GreaterThanOrEqual',
},
{
value: '4',
label: 'LessThan',
},
{
value: '5',
label: 'LessThanOrEqual',
},
{
value: '6',
label: 'In',
},
{
value: '7',
label: 'NotIn',
},
{
value: '8',
label: 'LikeLeft',
},
{
value: '9',
label: 'LikeRight',
},
{
value: '10',
label: 'NoEqual',
},
{
value: '11',
label: 'IsNullOrEmpty',
},
{
value: '12',
label: 'IsNot',
},
{
value: '13',
label: 'NoLike',
},
{
value: '14',
label: 'EqualNull',
},
{
value: '15',
label: 'InLike',
},
])
const SetConditionSchemas = ref<any>([])
const advanceSearch = ref()
//
function OpenSetCondition() {
advanceSearch.value.init(ReverseCondition(condition.value))
}
let condition = ref('')
let Rcondition = ref()
const toSearch = (params) => {
let RData = JSON.stringify(params)
RData = RData.replaceAll('"logicalOperator":"0"', '"logicalOperator":"and"')
RData = RData.replaceAll('"logicalOperator":"1"', '"logicalOperator":"or"')
Arr.value.forEach((item) => {
RData = RData.replaceAll(`"operator":${item.value},`, `"operator":"${item.label}",`)
})
condition.value = RData
// props.fetch({ advanced: params })
}
const ReverseCondition = (params) => {
let RData = ''
if (params) {
params = JSON.parse(params)
RData = JSON.stringify(params)
RData = RData.replaceAll('"logicalOperator":"and"', '"logicalOperator":"0"')
RData = RData.replaceAll('"logicalOperator":"or"', '"logicalOperator":"1"')
Arr.value.forEach((item) => {
RData = RData.replaceAll(`"operator":"${item.label}",`, `"operator":${item.value},`)
})
}
return RData
// props.fetch({ advanced: params })
}
// -----------------------------------------
//
const currencyDict = ref([])
//
let customerTypeDict = []
//
const allCheck = ref(false)
//
const someCheck = ref(false)
//
let grouping = []
//
let unitDict = []
//
const list = ref([])
//
const feeDict = ref([])
//
const companyDict = ref([])
// tableDom
const hotTb = ref(null)
//
const validate = () => {
return list.value
}
const SetData = (data) => {
list.value.splice(0)
data.forEach((item) => {
list.value.push(item)
})
}
const loading = ref(false)
//
const addRow = () => {
list.value.push({})
}
//
const columns = [
{
data: 'selected',
type: 'checkbox',
title: ' ',
width: 32,
className: 'htCenter',
readOnly: false,
},
// {
// title: '',
// width: 130,
// data: 'customerName',
// type: 'dropdown',
// source: async (query, process) => {
// //
// const rowIndex = hotTb.value.hotInstance.getActiveEditor().row
// const code = list.value[rowIndex]?.customerType || null
// GetClientListByCode({ code }).then((res) => {
// const { data } = res
// data.forEach((item) => {
// item['label'] = item.shortName
// item['value'] = item.codeName
// })
// companyDict.value = data
// const dict = data.map((item) => {
// return item.codeName + '-' + item.shortName
// })
// process(dict)
// })
// },
// },
{
title: '费用名称',
width: 130,
data: 'feeName',
type: 'dropdown',
// (process)
source: async (query, process) => {
const res = feeDict.value.length ? feeDict.value : (await GetFeeCodeSelectList())?.data
if (!feeDict.value.length) feeDict.value = res
const dict = res.map((res) => {
return res.code + '-' + res.name
})
process(dict)
},
},
{
title: '单位标准',
width: 130,
data: 'unit',
type: 'dropdown',
source: async (query, process) => {
// if (unitDict.value && unitDict.value.length) {
// const dict = unitDict.value.map((item) => {
// return item.value + '-' + item.name
// })
// process(dict)
// } else {
// const results = await feeUnitDict()
// unitDict.value = results
// const dict = results.map((item) => {
// return item.value + '-' + item.name
// })
// process(dict)
// }
const results = [
{ label: '20GP', name: '20GP', value: '22G0' },
{ label: '40GP', name: '40GP', value: '42G0' },
]
const dict = results.map((res) => {
return res.label
})
process(dict)
},
},
{
title: '费用类型',
width: 80,
data: 'feeTypeName',
type: 'dropdown',
source: async (query, process) => {
if (currencyDict.value.length) {
process(currencyDict.value)
} else {
const results = [
{ label: '应收', value: 1 },
{ label: '应付', value: 2 },
]
const dict = results.map((res) => {
return res.label
})
process(dict)
}
},
},
{
title: '是否箱型',
width: 100,
data: 'isCtn',
type: 'checkbox',
},
{
title: '币别',
width: 80,
data: 'currency',
type: 'dropdown',
source: async (query, process) => {
if (currencyDict.value.length) {
process(currencyDict.value)
} else {
const results = await GetFeeCurrencySelectList()
const dict = results.data?.map((res) => {
return res.codeName
})
currencyDict.value = dict
process(dict)
}
},
},
{
title: '单价',
width: 120,
data: 'unitPrice',
type: 'numeric',
format: '0.00',
},
{
title: '汇率',
width: 120,
data: 'exchangeRate',
type: 'numeric',
},
{
title: '税率',
width: 120,
data: 'taxRate',
type: 'numeric',
},
{
title: '财务税率',
width: 100,
data: 'accTaxRate',
type: 'numeric',
},
{
title: '税额',
width: 120,
data: 'tax',
type: 'numeric',
},
{
title: '含税单价',
width: 120,
data: 'taxUnitPrice',
type: 'numeric',
},
{
title: '是否开票',
width: 120,
data: 'isInvoice',
type: 'checkbox',
},
{
title: '是否垫付',
width: 100,
data: 'isAdvancedPay',
type: 'checkbox',
},
// {
// title: '',
// width: 130,
// data: 'feeEnName',
// type: 'dropdown',
// source: async (query, process) => {
// const res = feeDict.value.length ? feeDict.value : (await GetFeeCodeSelectList())?.data
// if (!feeDict.value.length) feeDict.value = res
// const dict = res.map((res) => {
// return res.enName
// })
// process(dict)
// },
// },
// {
// title: '',
// width: 130,
// data: 'customerTypeText',
// type: 'dropdown',
// source: async (query, process) => {
// const results = await getDictOption('djy_cust_prop')
// const dict = results.map((item) => {
// return item.value + '-' + item.name
// })
// process(dict)
// },
// },
// {
// title: '',
// width: 120,
// data: 'quantity',
// type: 'numeric',
// format: '0',
// },
// {
// title: '',
// width: 120,
// data: 'noTaxPrice',
// type: 'numeric',
// readOnly: true,
// },
// {
// title: '',
// width: 120,
// data: 'noTaxAmount',
// type: 'numeric',
// format: '0.00',
// readOnly: true,
// },
// {
// title: '',
// width: 120,
// data: 'amount',
// type: 'numeric',
// },
// {
// title: '',
// width: 120,
// data: 'note',
// },
// {
// title: '',
// width: 100,
// data: 'accTaxAmount',
// readOnly: true,
// },
// {
// title: '',
// width: 100,
// data: 'accAmount',
// readOnly: true,
// },
// {
// title: '',
// width: 100,
// data: 'isOpen',
// type: 'checkbox',
// },
// {
// title: 'FRT',
// width: 120,
// data: 'feeFrt',
// type: 'dropdown',
// source: ['PP', 'CC'],
// },
// {
// title: '',
// width: 100,
// data: 'createByName',
// readOnly: true,
// },
// {
// title: '',
// width: 100,
// data: 'createTime',
// readOnly: true,
// },
// {
// title: '',
// width: 100,
// data: 'settlementAmount',
// readOnly: true,
// },
// {
// title: '',
// width: 100,
// data: 'invoiceAmount',
// readOnly: true,
// },
// {
// title: '',
// width: 100,
// data: 'debitNo',
// readOnly: true,
// },
// {
// title: '',
// width: 100,
// data: 'updateByName',
// readOnly: true,
// },
// {
// title: '',
// width: 100,
// data: 'updateTime',
// readOnly: true,
// },
// {
// title: '',
// width: 100,
// data: 'orderInvoiceAmount',
// readOnly: true,
// },
// {
// title: '',
// width: 100,
// data: 'debitNo',
// readOnly: true,
// },
// {
// title: '',
// width: 100,
// data: 'auditOperator',
// readOnly: true,
// },
// {
// title: '',
// width: 100,
// data: 'auditDate',
// readOnly: true,
// },
]
//
const settings = {
height: 300,
width: '100%',
autoWrapRow: true,
autoWrapCol: true,
//
rowHeights: 32,
fixedColumnsLeft: 1,
//
enterMoves: 'row',
columnSorting: true,
//
// columnSorting: {
// column: 2, //
// sortOrder: ['asc', 'desc'] //
// },
//
afterValidate: function (isValid, value, row, prop, source) {
if (!isValid) {
hotTb.value.hotInstance.setDataAtRowProp(row, prop, '')
// if (/^noTaxPrice|unitPrice|noTaxAmount|taxRate|exchangeRate$/.test(prop)) {
// if (!isNaN(value)) {
// hotTb.value.hotInstance.setDataAtRowProp(row, prop, value.toFixed(2))
// }
// }
}
},
columns: columns,
// ()
licenseKey: 'non-commercial-and-evaluation',
//
afterChange(changes, source) {
//
if (source === 'edit' || source === 'Autofill.fill' || source === 'CopyPaste.paste') {
let dict = {}
changes.forEach((res) => {
//
if (changes[0][1] === 'feeTypeName') {
const res = [
{ label: '应收', value: 1 },
{ label: '应付', value: 2 },
]
const item = res.filter((item) => {
return item.label === changes[0][3]
})
if (item) dict = item[0]
list.value[changes[0][0]]['feeType'] = dict?.value
list.value[changes[0][0]]['feeTypeName'] = dict?.label
}
//
if (changes[0][1] === 'customerName') {
const item = companyDict.value.filter((item) => {
return changes[0][3].includes(item.label)
})
if (item) dict = item[0]
list.value[changes[0][0]]['customerId'] = dict.id
list.value[changes[0][0]]['customerName'] = changes[0][3].split('-')[1]
}
//
if (res[1] === 'feeName') {
//
const item = feeDict.value.filter((item) => {
return changes[0][3].includes(item.name)
})
if (item) dict = item[0]
// feeType
list.value[res[0]]['feeName'] = changes[0][3].split('-')[1]
list.value[res[0]]['feeCode'] = dict['code']
list.value[res[0]]['feeId'] = dict['id']
list.value[res[0]]['unit'] = dict['defaultUnit']
list.value[res[0]]['currency'] = dict['defaultCurrency']
list.value[res[0]]['taxRate'] = dict['taxRate']
list.value[res[0]]['isInvoice'] = dict['isInvoice']
list.value[res[0]]['isAdvancedPay'] = dict['isAdvancedPay']
// list.value[res[0]]['feeEnName'] = dict['enName']
// list.value[res[0]]['unitText'] = dict['defaultUnitName']
// list.value[res[0]]['customerTypeText'] = dict['defaultDebitName']
// list.value[res[0]]['customerType'] = dict['defaultDebit']
// list.value[res[0]]['isOpen'] = dict['isOpen']
// list.value[res[0]]['feeFrt'] = dict['feeFrt']
}
})
//
if (changes[0][1] === 'unit') {
const item = unitDict.value.filter((item) => {
return changes[0][3].includes(item.name)
})
if (item) dict = item[0]
list.value[changes[0][0]]['unit'] = dict?.value
// list.value[changes[0][0]]['unitText'] = changes[0][3].split('-')[1]
//
// const text = list.value[changes[0][0]]['unitText']
// if (text == '') {
// list.value[changes[0][0]]['quantity'] = 1
// } else if (text == '') {
// list.value[changes[0][0]]['quantity'] = props.details.pkgs
// } else if (text == '') {
// list.value[changes[0][0]]['quantity'] = props.details.kgs
// } else if (text == '') {
// list.value[changes[0][0]]['quantity'] = props.details.cbm
// } else if (text == '') {
// let r = props.details.kgs
// const k = (props.details.pkgs || 0) / 1000
// if (k > r) {
// r = k
// }
// list.value[changes[0][0]]['quantity'] = r
}
// //
// if (changes[0][1] === 'currencyName') {
// const item = currencyDict.value.filter((item) => {
// return item.name === changes[0][3]
// })
// if (item) dict = item[0]
// list.value[changes[0][0]]['currency'] = dict?.codeName
// }
// ============================
// //
// if (changes[0][1] === 'feeEnName') {
// }
// //
// if (changes[0][1] === 'customerTypeText') {
// getDictOption('djy_cust_prop').then((res) => {
// const item = res.filter((item) => {
// return changes[0][3].includes(item.name)
// })
// if (item) dict = item[0]
// list.value[changes[0][0]]['customerType'] = dict?.value
// list.value[changes[0][0]]['customerTypeText'] = changes[0][3].split('-')[1]
// })
// }
// //
// const index = changes[0][0]
// //
// if (changes[0][1] === 'noTaxPrice') {
// //
// list.value[index].unitPrice = Number(
// (changes[0][3] || 0) * ((list.value[index].taxRate || 0) / 100 + 1),
// ).toFixed(6)
// //
// list.value[index].amount = Number(
// (list.value[index].unitPrice || 0) * (list.value[index].quantity || 0),
// ).toFixed(6)
// //
// list.value[index].noTaxAmount = Number(
// (changes[0][3] || 0) * (list.value[index].quantity || 0),
// ).toFixed(6)
// }
// //
// if (changes[0][1] === 'unitPrice') {
// //
// list.value[index].noTaxPrice = Number(
// (changes[0][3] || 0) / ((list.value[index].taxRate || 0) / 100 + 1),
// ).toFixed(6)
// //
// list.value[index].amount = Number(
// (changes[0][3] || 0) * (list.value[index].quantity || 0),
// ).toFixed(6)
// //
// list.value[index].noTaxAmount = Number(
// (list.value[index].noTaxPrice || 0) * (list.value[index].quantity || 0),
// ).toFixed(6)
// }
// //
// if (changes[0][1] === 'quantity') {
// //
// list.value[index].amount = Number(
// (changes[0][3] || 0) * (list.value[index].unitPrice || 0),
// ).toFixed(6)
// //
// list.value[index].noTaxAmount = Number(
// (changes[0][3] || 0) * (list.value[index].noTaxPrice || 0),
// ).toFixed(6)
// }
// //
// if (changes[0][1] === 'taxRate') {
// //
// list.value[index].noTaxPrice = Number(
// (list.value[index].unitPrice || 0) / ((changes[0][3] || 0) / 100 + 1),
// ).toFixed(6)
// //
// list.value[index].noTaxAmount = Number(
// (list.value[index].noTaxPrice || 0) * (list.value[index].quantity || 0),
// ).toFixed(6)
// }
}
},
}
defineExpose({
validate,
SetData,
condition,
})
//
const row = {
selected: false,
feeStatus: '1',
feeStatusText: '录入状态',
id: '',
businessId: '',
feeCode: '',
feeName: '',
feeEnName: '',
quantity: 1,
exchangeRate: 1,
feeType: props.tbType == 'receive' ? 1 : 2,
}
onMounted(() => {
const hot = hotTb.value.hotInstance
hot.addHook('afterOnCellMouseDown', function (event, coords, TD) {})
//
hot.addHook('beforeKeyDown', function (event) {
// 'Enter'
if (event.key === 'ArrowDown') {
if (hot.getSelected()[0][0] == list.value.length - 1 && !hot.getActiveEditor()?._opened) {
list.value.push(JSON.parse(JSON.stringify(row)))
nextTick(() => {
hot.selectCell(list.value.length - 1, 4)
})
return false
}
}
})
SetConditionSchemas.value.splice(0)
getColumns({ tableViewName: 'op_sea_export' }).then((res) => {
res.data.forEach((item) => {
SetConditionSchemas.value.push({
field: item.dbColumnName,
label: item.columnDescription,
})
})
})
})
watch(
list.value,
(val) => {
let a = 0
let b = 0
val.forEach((item) => {
if (item.selected) {
a += 1
} else {
b += 1
}
})
if (a == 0) {
allCheck.value = false
}
if (b == 0) {
allCheck.value = true
}
if (a != 0 && b != 0) {
someCheck.value = true
} else {
someCheck.value = false
}
},
{
deep: true,
},
)
//
const deleteRow = async () => {
// list.value.forEach((item: any, index) => {
// if (item.selected) {
// list.value.splice(index, 1)
// }
// })
const ids = []
list.value.forEach((item: any, index) => {
if (item.selected) {
ids.push(item.id)
}
})
if (ids.length) {
loading.value = true
const data = await DeleteDetails({ ids })
loading.value = false
createMessage.success(data.message)
}
const res = list.value.filter((item) => {
return !item.selected
})
list.value = res
hotTb.value.hotInstance.loadData(res)
}
// idid
// watch(
// () => props.id,
// (v) => {
// // list.value.splice(0)
// // const postData = {
// // pageCondition: {
// // pageIndex: 1,
// // pageSize: 1000,
// // sortConditions: [],
// // },
// // queryCondition: JSON.stringify([
// // { FieldName: 'TemplateId', FieldValue: v, ConditionalType: 1 },
// // ]),
// // }
// // if (v) {
// // const res = await GetFeeTemplateDetailList(postData)
// // list.value = res.data
// // hotTb.value.hotInstance.loadData(res.data)
// // }
// },
// )
watchEffect(() => {
//
if (allCheck.value) {
list.value.forEach((item) => {
item.selected = true
})
} else {
//
list.value.forEach((item) => {
item.selected = false
})
}
})
</script>
<style lang="scss">
.fee-field {
.flex {
margin-top: 10px;
margin-block: 8px;
padding: 15px 6px 0 6px;
border-top: 0.7px solid #d9d9d9;
.title {
font-size: 12px;
font-weight: 700;
letter-spacing: 1px;
line-height: 30px;
color: rgba(51, 56, 61, 1);
text-align: left;
}
// justify-content: space-between;
}
.ant-select {
width: 100%;
text-align: left;
}
.active-td {
border: 1px solid blue;
}
}
.handsontableInput {
line-height: 30px;
}
</style>

@ -0,0 +1,147 @@
<template>
<div>
<BasicTable class="ds-table" @register="registerTable" @row-dbClick="handleAudit">
<template #tableTitle>
<span class="title">自动费用模板</span>
<a-button type="link" @click="handleCreate">
<span class="iconfont icon-new_document"></span>
添加
</a-button>
<a-popconfirm
title="确定删除当前选中数据?"
ok-text="是"
cancel-text="否"
@confirm="handleDelete"
>
<a-button type="link">
<span class="iconfont icon-shanchu21"></span>
删除
</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"
:customerName="props.customerName"
:customerId="props.clientId"
/>
</div>
</template>
<script lang="ts" setup>
import { defineComponent, onMounted, ref } from '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 { formatParams } from '/@/hooks/web/common'
import { useMessage } from '/@/hooks/web/useMessage'
const { notification } = useMessage()
const props = defineProps({
clientId: { type: String },
customerName: { type: String },
})
const [registerModal, { openModal }] = useModal()
const [registerTable, { reload, getSelectRows, getForm, 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: (p) => {
p['isShared'] = 1
p['customerId'] = props.clientId
return formatParams(p, ['isShared'])
},
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 handleCreate() {
openModal(true, {
customerId: props.clientId,
isUpdate: false,
})
}
function handleAudit(record: Recordable) {
openModal(true, {
record,
// record: { clientId: props.clientId, ...record },
isUpdate: true,
})
}
//
async function handleDelete(record: Recordable) {
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 handleSuccess() {
reload()
}
</script>
<style lang="less" scoped>
.ds-table-detail {
margin-top: -16px;
.title {
font-size: 12px;
font-weight: 700;
letter-spacing: 1px;
line-height: 15.84px;
color: rgba(51, 56, 61, 1);
text-align: left;
}
}
</style>

@ -7,33 +7,45 @@
import { request } from '/@/utils/request'
import { DataResult, PageRequest } from '/@/api/model/baseModel'
enum Api {
list = '/mainApi/Print/GetOpenPrintTemplateList',
modalList = '/mainApi/Print/GetOpenPrintModuleList',
edit = '/mainApi/PrintTemplate//EditSysPrintModule',
// list = '/mainApi/Print/GetOpenPrintTemplateList',
// modalList = '/mainApi/Print/GetOpenPrintModuleList',
// edit = '/mainApi/PrintTemplate//EditSysPrintModule',
// temEidt = '/mainApi/PrintTemplate/EditSysPrintTemplate',
// temInfo = '/mainApi/PrintTemplate/GetSysPrintTemplateInfo',
// info = '/mainApi/PrintTemplate/GetSysPrintModuleInfo',
// delete = '/mainApi/ClientParam/BatchDelClientParam',
// GetTenantParamDataSelectList = '/mainApi/ClientParam/GetTenantParamDataSelectList',
// GetOpenSqlPrintInfo = '/printApi/OpenPrint/GetOpenSqlPrintInfo',
// DownLoadSqlPrintFile = '/printApi/OpenPrint/DownLoadSqlPrintFile'
// ---------------------------
list = '/mainApi/PrintTemplate/GetPrintModuleList',
modalList = '/mainApi/PrintTemplate/GetSysPrintTemplateList',
edit = '/mainApi/PrintTemplate/EditSysPrintModule',
temEidt = '/mainApi/PrintTemplate/EditSysPrintTemplate',
temInfo = '/mainApi/PrintTemplate/GetSysPrintTemplateInfo',
info = '/mainApi/PrintTemplate/GetSysPrintModuleInfo',
delete = '/mainApi/ClientParam/BatchDelClientParam',
delete = '/mainApi/PrintTemplate/BatchDelPrintTemplate',
GetTenantParamDataSelectList = '/mainApi/ClientParam/GetTenantParamDataSelectList',
GetOpenSqlPrintInfo = '/printApi/OpenPrint/GetOpenSqlPrintInfo',
DownLoadSqlPrintFile = '/printApi/OpenPrint/DownLoadSqlPrintFile'
}
// 模版列表 (Auth)
export function GetSysPrintTemplateList(data) {
// 模块列表
export function GetPrintModuleList(data) {
return request<DataResult>({
url: Api.list,
method: 'post',
data
})
}
// 模块列表
export function GetPrintModuleList(params) {
// 模版列表 (Auth)
export function GetSysPrintTemplateList(data) {
return request<DataResult>({
url: Api.modalList,
method: 'get',
params
method: 'post',
data
})
}
// 模块编辑 (Auth)
export function EditSysPrintModule(data: PageRequest) {
return request<DataResult>({

@ -1,38 +1,39 @@
/*
* @Description:
* @Description:
* @Author: lijj
* @Date: 2024-04-25 15:48:33
*/
import { BasicColumn, FormSchema } from '/@/components/Table'
import { GetPrintModuleList } from './api'
import { GetCarrierSelectList } from '/@/api/common'
import { max } from 'lodash'
export const columns: BasicColumn[] = [
{
title: '模版名称',
dataIndex: 'templateName',
width: 200
width: 200,
},
{
title: '打印类型',
dataIndex: 'printType',
width: 120
width: 120,
},
{
title: '船公司',
dataIndex: 'carrierName',
width: 150
width: 150,
},
{
title: '入口参数',
dataIndex: 'inParamColumn',
width: 200
width: 200,
},
{
title: '备注',
dataIndex: 'note',
width: 200
}
width: 200,
},
]
export const searchFormSchema: FormSchema[] = [
@ -40,7 +41,7 @@ export const searchFormSchema: FormSchema[] = [
field: 'templateName',
label: '模版名称',
colProps: { span: 6 },
component: 'Input'
component: 'Input',
},
]
export const formSchema: FormSchema[] = [
@ -49,27 +50,27 @@ export const formSchema: FormSchema[] = [
field: 'id',
component: 'Input',
defaultValue: '',
show: false
show: false,
},
{
field: 'moduleName',
label: '模块名称',
required: true,
component: 'Input',
colProps: { span: 12 }
colProps: { span: 12 },
},
{
field: 'moduleCode',
label: '模块编码',
required: true,
component: 'Input',
colProps: { span: 12 }
colProps: { span: 12 },
},
{
field: 'sortNo',
label: '排序',
component: 'Input',
colProps: { span: 12 }
colProps: { span: 12 },
},
{
field: 'disable',
@ -81,9 +82,9 @@ export const formSchema: FormSchema[] = [
componentProps: {
options: [
{ label: '禁用', value: 1 },
{ label: '启用', value: 0 }
]
}
{ label: '启用', value: 0 },
],
},
},
{
field: 'note',
@ -91,33 +92,32 @@ export const formSchema: FormSchema[] = [
component: 'InputTextArea',
colProps: { span: 24 },
componentProps: {
autoSize: { minRows: 5, maxRows: 5 }
}
}
autoSize: { minRows: 5, maxRows: 5 },
},
},
]
export const temFormSchema: FormSchema[] = [
{
label: '',
field: 'id',
component: 'Input',
defaultValue: '',
show: false
show: false,
},
{
field: 'templateName',
label: '模版名称',
required: true,
component: 'Input',
colProps: { span: 12 }
colProps: { span: 12 },
},
{
field: 'templateCode',
label: '模版编码',
required: true,
component: 'Input',
colProps: { span: 12 }
colProps: { span: 12 },
},
{
label: '',
@ -150,9 +150,9 @@ export const temFormSchema: FormSchema[] = [
formModel.carrierId = null
formModel.carrierName = null
}
}
},
}
}
},
},
{
field: 'printType',
@ -180,7 +180,7 @@ export const temFormSchema: FormSchema[] = [
field: 'moduleCode',
label: '',
component: 'Input',
show: false
show: false,
},
{
label: '所属模块',
@ -203,7 +203,7 @@ export const temFormSchema: FormSchema[] = [
},
onChange: (v, obj) => {
if (obj) formModel.moduleCode = obj.moduleCode
}
},
}
},
},
@ -211,13 +211,13 @@ export const temFormSchema: FormSchema[] = [
field: 'templateName',
label: '',
component: 'Input',
show: false
show: false,
},
{
field: 'moduleId',
label: '',
component: 'Input',
show: false
show: false,
},
{
field: 'isUseDataSource',
@ -229,9 +229,9 @@ export const temFormSchema: FormSchema[] = [
componentProps: {
options: [
{ label: '是', value: 1 },
{ label: '否', value: 0 }
]
}
{ label: '否', value: 0 },
],
},
},
{
field: 'sqlModel',
@ -241,7 +241,7 @@ export const temFormSchema: FormSchema[] = [
colProps: { span: 6 },
show: ({ values }) => {
return values.isUseDataSource && values.id
}
},
},
{
field: 'downModel',
@ -251,7 +251,7 @@ export const temFormSchema: FormSchema[] = [
colProps: { span: 6 },
show: ({ values }) => {
return values.isUseDataSource && values.id
}
},
},
{
field: 'sourceSql',
@ -260,11 +260,11 @@ export const temFormSchema: FormSchema[] = [
colProps: { span: 24 },
componentProps: {
autoSize: { minRows: 3, maxRows: 20 },
disTrans: true
disTrans: true,
},
show: ({ values }) => {
return values.isUseDataSource
}
},
},
{
field: 'inParamColumn',
@ -273,7 +273,7 @@ export const temFormSchema: FormSchema[] = [
colProps: { span: 12 },
show: ({ values }) => {
return values.isUseDataSource
}
},
},
{
field: 'groupBy',
@ -282,7 +282,7 @@ export const temFormSchema: FormSchema[] = [
colProps: { span: 12 },
show: ({ values }) => {
return values.isUseDataSource
}
},
},
{
field: 'columnView',
@ -290,11 +290,11 @@ export const temFormSchema: FormSchema[] = [
component: 'InputTextArea',
colProps: { span: 24 },
componentProps: {
autoSize: { minRows: 3, maxRows: 20 }
autoSize: { minRows: 3, maxRows: 20 },
},
show: ({ values }) => {
return values.isUseDataSource
}
},
},
{
field: 'printJsonContent',
@ -303,7 +303,7 @@ export const temFormSchema: FormSchema[] = [
colProps: { span: 24 },
componentProps: {
autoSize: { minRows: 5, maxRows: 20 },
disTrans: true
}
}
]
disTrans: true,
},
},
]

@ -1,34 +1,33 @@
<template>
<div class="ds-print-tem">
<BasicTable
class="ds-table-detail"
@register="registerTable"
>
<BasicTable class="ds-table-detail" @register="registerTable">
<template #left>
<div class="opt">
<a-button
type="link"
@click="handleCreate"
>
<a-button type="link" @click="handleCreate">
<span class="iconfont icon-new_document"></span>
添加模块
</a-button>
<a-spin :spinning="mloading">
<div class="list-box">
<div v-for="item in modelList" :key="item.id" class="item">
<span :class="{active: item.id == moduleId}" @click="toggleTable(item)"><span class="count">{{ item.templateCount }}</span><span>{{ item.moduleName }}</span></span>
<span style="float: right" class="iconfont icon-bianji1" @click="handleEdit(item)"></span>
<span :class="{ active: item.id == moduleId }" @click="toggleTable(item)"
><span class="count">{{ item.templateCount }}</span
><span>{{ item.moduleName }}</span></span
>
<span
style="float: right"
class="iconfont icon-bianji1"
@click="handleEdit(item)"
></span>
</div>
<img v-if="modelList.length == 0" src="../../../assets/images/nodata1.png" alt="">
<img v-if="modelList.length == 0" src="../../../assets/images/nodata1.png" alt="" />
</div>
</a-spin>
</div>
</template>
<template #tableTitle>
<h4 style="margin: 0 10px 0 -5px;">
打印模版列表
</h4>
<h4 style="margin: 0 10px 0 -5px"> 打印模版列表 </h4>
<a-button type="link" @click="createTem">
<span class="iconfont icon-tianjia"></span>
新建
@ -51,9 +50,9 @@
title: '是否要删除此条数据?',
okText: '是',
cancelText: '否',
confirm: handleDelete.bind(null, record)
}
}
confirm: handleDelete.bind(null, record),
},
},
]"
/>
</template>
@ -83,19 +82,31 @@
//
const [registerTemModal, { openModal: openModal2 }] = useModal()
const mloading = ref(false)
//
const modelList = ref<any>([])
//
const initModel = () => {
modelList.value.splice(0)
mloading.value = true
GetPrintModuleList().then(res => {
modelList.value = res.data
mloading.value = false
}).catch(() => {
mloading.value = false
})
let ApiData = {
queryCondition: '[]',
pageCondition: { pageIndex: 1, pageSize: 999, sortConditions: [] },
}
GetPrintModuleList(ApiData)
.then((res) => {
res.data.forEach((item) => {
modelList.value.push(item)
})
moduleId.value = res.data[0].id
reload()
mloading.value = false
})
.catch(() => {
mloading.value = false
})
}
initModel()
//
const modelList = ref([])
const [registerTable, { reload, getForm, getPaginationRef }] = useTable({
api: async (p) => {
const res: API.DataResult = await GetSysPrintTemplateList(p)
@ -122,6 +133,7 @@
showIndexColumn: true,
canResize: true,
resizeHeightOffset: 15,
immediate: false,
actionColumn: {
width: 80,
title: '操作',
@ -165,7 +177,7 @@
//
async function handleDelete(record: Recordable) {
const res: API.DataResult = await BatchDelClientParam({
id: '',
id: moduleId.value,
ids: [record.id],
})
if (res.succeeded) {
@ -187,55 +199,57 @@
</script>
<style lang="less">
.ds-print-tem {
padding-right: 5px;
.opt {
padding: 10px;
}
.vben-basic-table-title {
justify-content: space-between;
}
.list-box {
border: 1px solid #E8EBED;
border-radius: 2px;
margin: 6px 10px 0;
width: 210px;
padding: 16px 20px;
img {
margin: 20px 0 40px;
.ds-print-tem {
padding-right: 5px;
.opt {
padding: 10px;
}
.item {
cursor: pointer;
.vben-basic-table-title {
justify-content: space-between;
}
}
.count {
width: 32px;
height: 20px;
border-radius: 2px;
background: #F5F9FC;
display: inline-block;
color: #257AFA;
text-align: center;
line-height: 19px;
margin-right: 8px;
margin-bottom: 8px;
}
.icon-bianji1 {
margin-top: 3px;
color: #257AFA;
display: none;
}
.item:hover {
.icon-bianji1 {
display: block;
.list-box {
border: 1px solid #e8ebed;
border-radius: 2px;
margin: 6px 10px 0;
width: 210px;
padding: 16px 20px;
img {
margin: 20px 0 40px;
}
.item {
cursor: pointer;
}
}
}
.active {
span {color: #257AFA;}
.count {
background: #257AFA;
color: #ffffff;
width: 32px;
height: 20px;
border-radius: 2px;
background: #f5f9fc;
display: inline-block;
color: #257afa;
text-align: center;
line-height: 19px;
margin-right: 8px;
margin-bottom: 8px;
}
.icon-bianji1 {
margin-top: 3px;
color: #257afa;
display: none;
}
.item:hover {
.icon-bianji1 {
display: block;
}
}
.active {
span {
color: #257afa;
}
.count {
background: #257afa;
color: #ffffff;
}
}
}
}
</style>
</style>

Loading…
Cancel
Save