发票代码 页面

feature-JimuReport-1106-yjl
张同海 1 month ago
parent 1ea762bcad
commit af1d880b9c

@ -0,0 +1,114 @@
<template>
<BasicModal
v-bind="$attrs"
:use-wrapper="true"
:title="getTitle"
width="50%"
@register="registerModal"
@ok="handleSave"
>
<BasicForm @register="registerForm" />
<!--右下角按钮-->
<template #footer>
<a-button
pre-icon="ant-design:close-outlined"
type="warning"
:loading="loading"
ghost
style="margin-right: 0.8rem"
@click="closeModal"
>取消</a-button
>
<a-button
type="success"
:loading="loading"
pre-icon="ant-design:check-outlined"
style="margin-right: 0.8rem"
@click="handleSave(false)"
>仅保存</a-button
>
<a-button
pre-icon="ant-design:check-circle-outlined"
type="primary"
:loading="loading"
@click="handleSave(true)"
>保存并关闭</a-button
>
</template>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, unref } from 'vue'
import { BasicModal, useModalInner } from '/@/components/Modal'
import { BasicForm, useForm } from '/@/components/Form/index'
import { formSchema } from './columns'
import { 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)) {
rowId.value = data.record.id
const res: API.DataResult = await ApiInfo({ id: unref(rowId) })
if (res.succeeded) {
setFieldsValue({
...res.data,
})
}
} else {
setFieldsValue({ permissionIdentity: unref(2) })
}
setModalProps({ loading: false })
})
const getTitle = computed(() => (!unref(isUpdate) ? '新增发票代码' : '编辑发票代码'))
async function handleSave(exit) {
try {
const values = await validate()
setModalProps({ confirmLoading: true, loading: true })
const res: API.DataResult = await ApiEdit(values)
if (res.succeeded) {
// createMessage.success(res.message)
createMessage.success('成功')
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 {
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,41 @@
// @ts-ignore
import { request } from '/@/utils/request'
import { DataResult, PageRequest } from '/@/api/model/baseModel'
enum Api {
list = '/mainApi/CodeInvoice/GetList',
edit = '/mainApi/CodeInvoice/Edit',
info = '/mainApi/CodeInvoice/Edit',
del = '/mainApi/CodeInvoice/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.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.del,
method: 'post',
data,
})
}

@ -0,0 +1,414 @@
import { ref } from 'vue'
import { BasicColumn, FormSchema } from '/@/components/Table'
import { Tag } from 'ant-design-vue'
import { GetFeeCurrencySelectList } from '/@/api/common'
import { getDictOption } from '/@/utils/dictUtil'
const identificationList = ref([])
getDictOption('identification').then((res) => {
identificationList.value = res
})
export const columns: BasicColumn[] = [
{
title: '编码',
dataIndex: 'code',
sorter: true,
width: 150,
},
{
title: '名称',
dataIndex: 'name',
sorter: true,
width: 200,
},
{
title: '税目',
dataIndex: 'taxCategory',
sorter: true,
width: 200,
},
{
title: '税率',
dataIndex: 'taxRate',
sorter: true,
width: 200,
},
{
title: '零税率标识',
dataIndex: 'identification',
sorter: true,
width: 200,
customRender: ({ record }) => {
let name = ''
identificationList.value.some((item: any) => {
if (record.identification == item.value) {
name = item.name
return true
}
})
return name
},
},
{
title: '税收分类编码',
dataIndex: 'taxClassificationCode',
sorter: true,
width: 200,
},
{
title: '税收分类名称',
dataIndex: 'taxClassificationName',
sorter: true,
width: 200,
},
{
title: '是否含税',
dataIndex: 'isIncludingTax',
sorter: true,
width: 80,
customRender: ({ text }) => {
if (text === true) {
return <Tag color="success"></Tag>
} else if (text === false) {
return <Tag color="error"></Tag>
}
return text
},
},
{
title: '是否享受优惠政策',
dataIndex: 'hasPreferentialPolicy',
sorter: true,
width: 150,
customRender: ({ text }) => {
if (text === true) {
return <Tag color="success"></Tag>
} else if (text === false) {
return <Tag color="error"></Tag>
}
return text
},
},
{
title: '优惠政策说明',
dataIndex: 'preferentialPolicyDescription',
sorter: true,
width: 200,
},
{
title: '是否默认商品名',
dataIndex: 'isDefault',
sorter: true,
width: 150,
customRender: ({ text }) => {
if (text === true) {
return <Tag color="success"></Tag>
} else if (text === false) {
return <Tag color="error"></Tag>
}
return text
},
},
{
title: '默认币别',
dataIndex: 'defaultCurrency',
sorter: true,
width: 150,
},
{
title: '规格型号',
dataIndex: 'specification',
sorter: true,
width: 150,
},
{
title: '单位',
dataIndex: 'unit',
sorter: true,
width: 150,
},
]
export const searchFormSchema: FormSchema[] = [
{
field: 'code',
label: '编码',
component: 'Input',
colProps: { span: 6 },
},
{
field: 'name',
label: '名称',
component: 'Input',
colProps: { span: 6 },
},
{
field: 'taxCategory',
label: '税目',
component: 'Input',
colProps: { span: 6 },
},
{
field: 'taxRate',
label: '税率',
component: 'InputNumber',
colProps: { span: 6 },
},
{
field: 'identification',
label: '零税率标识',
component: 'ApiSelect',
colProps: { span: 6 },
componentProps: ({ formActionType }) => {
return {
api: () => {
return new Promise((resolve) => {
getDictOption('identification').then((res) => {
res.forEach((item) => {
item.value = parseInt(item.value)
})
resolve(res)
})
})
},
labelField: 'label',
valueField: 'value',
resultField: 'data',
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
}
},
},
{
field: 'taxClassificationCode',
label: '税收分类编码',
component: 'Input',
colProps: { span: 6 },
},
{
field: 'taxClassificationName',
label: '税收分类名称',
component: 'Input',
colProps: { span: 6 },
},
{
field: 'isIncludingTax',
label: '是否含税',
component: 'Switch',
colProps: { span: 6 },
componentProps: {
checkedChildren: '是',
checkedValue: true,
unCheckedChildren: '否',
unCheckedValue: false,
},
},
{
field: 'hasPreferentialPolicy',
label: '是否享受优惠政策',
component: 'Switch',
colProps: { span: 6 },
componentProps: {
checkedChildren: '是',
checkedValue: true,
unCheckedChildren: '否',
unCheckedValue: false,
},
},
{
field: 'preferentialPolicyDescription',
label: '优惠政策说明',
component: 'InputTextArea',
colProps: { span: 6 },
componentProps: {
rows: 2,
},
},
{
field: 'isDefault',
label: '是否默认商品名',
component: 'Switch',
colProps: { span: 6 },
componentProps: {
checkedChildren: '是',
checkedValue: true,
unCheckedChildren: '否',
unCheckedValue: false,
},
},
{
field: 'defaultCurrency',
label: '默认币别',
component: 'ApiSelect',
colProps: { span: 6 },
componentProps: () => {
return {
api: GetFeeCurrencySelectList,
labelField: 'name',
valueField: 'codeName',
resultField: 'data',
}
},
},
{
field: 'specification',
label: '规格型号',
component: 'Input',
colProps: { span: 6 },
},
{
field: 'unit',
label: '单位',
component: 'Input',
colProps: { span: 6 },
},
]
export const formSchema: FormSchema[] = [
{
label: '',
field: 'id',
component: 'Input',
defaultValue: '',
show: false,
},
{
field: 'code',
label: '编码',
required: true,
component: 'Input',
colProps: { span: 6 },
},
{
field: 'name',
label: '名称',
required: true,
component: 'Input',
colProps: { span: 6 },
},
{
field: 'taxCategory',
label: '税目',
component: 'Input',
colProps: { span: 6 },
},
{
field: 'taxRate',
label: '税率',
component: 'InputNumber',
colProps: { span: 6 },
},
{
field: 'identification',
label: '零税率标识',
component: 'ApiSelect',
colProps: { span: 6 },
componentProps: ({ formActionType }) => {
return {
api: () => {
return new Promise((resolve) => {
getDictOption('identification').then((res) => {
res.forEach((item) => {
item.value = parseInt(item.value)
})
resolve(res)
})
})
},
labelField: 'label',
valueField: 'value',
resultField: 'data',
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
}
},
},
{
field: 'taxClassificationCode',
label: '税收分类编码',
component: 'Input',
colProps: { span: 6 },
},
{
field: 'taxClassificationName',
label: '税收分类名称',
component: 'Input',
colProps: { span: 6 },
},
{
field: 'isIncludingTax',
label: '是否含税',
component: 'Switch',
colProps: { span: 6 },
componentProps: {
checkedChildren: '是',
checkedValue: true,
unCheckedChildren: '否',
unCheckedValue: false,
},
defaultValue: false,
},
{
field: 'hasPreferentialPolicy',
label: '是否享受优惠政策',
component: 'Switch',
colProps: { span: 6 },
componentProps: {
checkedChildren: '是',
checkedValue: true,
unCheckedChildren: '否',
unCheckedValue: false,
},
defaultValue: false,
},
{
field: 'preferentialPolicyDescription',
label: '优惠政策说明',
component: 'InputTextArea',
colProps: { span: 6 },
componentProps: {
rows: 2,
},
},
{
field: 'isDefault',
label: '是否默认商品名',
component: 'Switch',
colProps: { span: 6 },
componentProps: {
checkedChildren: '是',
checkedValue: true,
unCheckedChildren: '否',
unCheckedValue: false,
},
defaultValue: false,
},
{
field: 'defaultCurrency',
label: '默认币别',
component: 'ApiSelect',
colProps: { span: 6 },
componentProps: () => {
return {
api: GetFeeCurrencySelectList,
labelField: 'name',
valueField: 'codeName',
resultField: 'data',
}
},
},
{
field: 'specification',
label: '规格型号',
component: 'Input',
colProps: { span: 6 },
},
{
field: 'unit',
label: '单位',
component: 'Input',
colProps: { span: 6 },
},
]

@ -0,0 +1,153 @@
<template>
<div>
<BasicTable class="ds-table" @register="registerTable" @row-dbClick="handleAudit">
<template #tableTitle>
<a-button type="link" @click="handleCreate" :disabled="checkPermissions('op:ctn:add')">
<span class="iconfont icon-new_document"></span>
添加
</a-button>
<a-popconfirm
title="确定删除当前选中数据?"
ok-text="是"
cancel-text="否"
@confirm="handleDel"
>
<a-button type="link" :disabled="checkPermissions('op:ctn:del')">
<span class="iconfont icon-shanchu21"></span>
删除
</a-button>
</a-popconfirm>
<Divider type="vertical" />
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{
icon: 'clarity:note-edit-line',
tooltip: '编辑',
onClick: handleAudit.bind(null, record),
disabled: checkPermissions('op:ctn:edit'),
},
]"
/>
</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 { checkPermissions } from '/@/hooks/Permissions/index'
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 }] = 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) => {
var data = getForm().getFieldsValue()
const postParam: API.PageRequest = {
queryCondition: '',
pageCondition: {
pageIndex: p.page,
pageSize: p.pageSize,
sortConditions: [],
},
}
if (p.field) {
postParam.pageCondition.sortConditions = [
{
sortField: p.field,
listSortDirection: p.order == 'ascend' ? 0 : 1,
},
]
} else {
postParam.pageCondition.sortConditions = []
}
let condition: API.ConditionItem[] = []
if (!!data.CtnName) {
condition.push({
FieldName: 'CtnName',
FieldValue: data.CtnName,
ConditionalType: 1,
})
}
postParam.queryCondition = JSON.stringify(condition)
return postParam
},
columns,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
},
isTreeTable: false,
pagination: true,
striped: true,
useSearchForm: true,
showTableSetting: true,
bordered: true,
showIndexColumn: true,
indexColumnProps: {
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) {
if (!checkPermissions('op:ctn:edit')) {
openModal(true, {
record,
isUpdate: true,
})
}
}
function handleSuccess() {
reload()
}
</script>
Loading…
Cancel
Save