Merge branch 'dev' of http://60.209.125.238:20010/lijingjia/ds-wms-client-web into dev
commit
85ff828b96
@ -1,109 +0,0 @@
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
:use-wrapper="true"
|
||||
title="表单设置"
|
||||
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(true)"
|
||||
>
|
||||
确定
|
||||
</a-button>
|
||||
</template>
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, unref, h } from 'vue'
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal'
|
||||
import { BasicForm, useForm } from '/@/components/Form/index'
|
||||
// import { formSchema } from './columns'
|
||||
import { editCodeGoodsType, getCodeGoodsTypeInfo } from './api'
|
||||
import { useMessage } from '/@/hooks/web/useMessage'
|
||||
import { Icon } from '/@/components/Icon'
|
||||
import { useModal } from '/@/components/Modal'
|
||||
const props = defineProps({
|
||||
schemaArr: { type: Array },
|
||||
})
|
||||
let formSchema = props.schemaArr
|
||||
const [register, { openModal }] = useModal()
|
||||
// 声明Emits
|
||||
const emit = defineEmits(['contentOk', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const loading = ref(false)
|
||||
const [registerForm, { resetFields, setFieldsValue, updateSchema, 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)) {
|
||||
let obj = {}
|
||||
JSON.parse(data.record.content).forEach((e) => {
|
||||
obj[`${e.field}-defaultValue`] = e.defaultValue
|
||||
obj[`${e.field}-required`] = e.required
|
||||
obj[`${e.field}-show`] = e.show
|
||||
})
|
||||
setFieldsValue(obj)
|
||||
setModalProps({ confirmLoading: false })
|
||||
} else {
|
||||
setFieldsValue({ permissionIdentity: unref(2) })
|
||||
}
|
||||
setModalProps({ loading: false })
|
||||
})
|
||||
|
||||
async function handleSave(exit) {
|
||||
try {
|
||||
const values = await validate()
|
||||
setModalProps({ confirmLoading: true, loading: true })
|
||||
// TODO custom api
|
||||
console.log(values)
|
||||
let Arr = []
|
||||
Object.keys(values).forEach((e) => {
|
||||
let type = true
|
||||
Arr.forEach((item) => {
|
||||
if (item.field == e.split('-')[0]) {
|
||||
item[e.split('-')[1]] = values[e]
|
||||
type = false
|
||||
}
|
||||
})
|
||||
if (type) {
|
||||
let obj = {
|
||||
field: e.split('-')[0],
|
||||
}
|
||||
obj[e.split('-')[1]] = values[e]
|
||||
Arr.push(obj)
|
||||
}
|
||||
|
||||
// console.log()
|
||||
})
|
||||
emit('contentOk', JSON.stringify(Arr))
|
||||
|
||||
exit && closeModal()
|
||||
} finally {
|
||||
// loading.value = false;
|
||||
setModalProps({ confirmLoading: false, loading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
@ -1,229 +0,0 @@
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
:use-wrapper="true"
|
||||
:title="getTitle"
|
||||
width="35%"
|
||||
@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>
|
||||
<Modal v-if="ModalType" :schema-arr="schemaArr" @register="register" @contentOk="contentOk" />
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, unref, h } from 'vue'
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal'
|
||||
import { BasicForm, useForm } from '/@/components/Form/index'
|
||||
import { formSchema } from './columns'
|
||||
import { editCodeGoodsType, getCodeGoodsTypeInfo, getColumnsByClient } from './api'
|
||||
import { useMessage } from '/@/hooks/web/useMessage'
|
||||
import { Icon } from '/@/components/Icon'
|
||||
import { useModal } from '/@/components/Modal'
|
||||
import Modal from './Modal.vue'
|
||||
const [register, { openModal }] = useModal()
|
||||
// 声明Emits
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const loading = ref(false)
|
||||
const rowId = ref('')
|
||||
const schemaArr = ref([])
|
||||
const ModalType = ref(false)
|
||||
const { createMessage } = useMessage()
|
||||
const [registerForm, { resetFields, setFieldsValue, updateSchema, 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 getCodeGoodsTypeInfo({ 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) })
|
||||
}
|
||||
updateSchema({
|
||||
field: 'setting',
|
||||
label: '',
|
||||
component: 'Input',
|
||||
colProps: { span: 2 },
|
||||
// 通过函数渲染一个 Input
|
||||
render: ({ model, field }) => {
|
||||
return h(Icon, {
|
||||
icon: 'ant-design:setting-filled',
|
||||
style: { marginLeft: '10px', cursor: 'pointer' },
|
||||
// value: model[field],
|
||||
// onChange: (e: ChangeEvent) => {
|
||||
// model[field] = e.target.value
|
||||
// },
|
||||
onClick: async (e) => {
|
||||
if (model.columnView) {
|
||||
schemaArr.value = []
|
||||
let schemaA = []
|
||||
const res: API.DataResult = await getColumnsByClient({
|
||||
tableViewName: model.columnView,
|
||||
})
|
||||
// const res: API.DataResult = await getCodeGoodsTypeInfo({ id: unref(rowId) })
|
||||
if (res.succeeded) {
|
||||
res.data.forEach((e) => {
|
||||
schemaA.push(
|
||||
...[
|
||||
{
|
||||
field: `divider-${e.dbColumnName}`,
|
||||
component: 'Divider',
|
||||
label: e.columnDescription,
|
||||
colProps: {
|
||||
span: 24,
|
||||
},
|
||||
},
|
||||
{
|
||||
field: `${e.dbColumnName}-defaultValue`,
|
||||
label: '默认值',
|
||||
component: 'Input',
|
||||
colProps: { span: 8 },
|
||||
defaultValue: '',
|
||||
},
|
||||
{
|
||||
field: `${e.dbColumnName}-required`,
|
||||
label: '是否必填',
|
||||
component: 'RadioButtonGroup',
|
||||
defaultValue: false,
|
||||
colProps: { span: 8 },
|
||||
componentProps: {
|
||||
options: [
|
||||
{ label: '是', value: true },
|
||||
{ label: '否', value: false },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
field: `${e.dbColumnName}-show`,
|
||||
label: '是否显示',
|
||||
component: 'RadioButtonGroup',
|
||||
defaultValue: false,
|
||||
colProps: { span: 8 },
|
||||
componentProps: {
|
||||
options: [
|
||||
{ label: '是', value: true },
|
||||
{ label: '否', value: false },
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
)
|
||||
// schemaA.push({
|
||||
// field: e.dbColumnName,
|
||||
// label: e.columnDescription,
|
||||
// defaultValue: '',
|
||||
// show: true,
|
||||
// required: false,
|
||||
// })
|
||||
})
|
||||
schemaArr.value = schemaA
|
||||
}
|
||||
ModalType.value = true
|
||||
setTimeout(() => {
|
||||
openModal(true, {
|
||||
record: model,
|
||||
isUpdate: model.content ? true : false,
|
||||
})
|
||||
}, 300)
|
||||
} else {
|
||||
createMessage.warning('请先选择中文视图名')
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
})
|
||||
setModalProps({ loading: false })
|
||||
})
|
||||
function contentOk(data) {
|
||||
console.log(data)
|
||||
setFieldsValue({
|
||||
content: data,
|
||||
})
|
||||
}
|
||||
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 editCodeGoodsType(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)
|
||||
}
|
||||
ModalType.value = false
|
||||
exit && closeModal()
|
||||
} finally {
|
||||
// loading.value = false;
|
||||
setModalProps({ confirmLoading: false, loading: false })
|
||||
}
|
||||
}
|
||||
async function refresh() {
|
||||
const res: API.DataResult = await getCodeGoodsTypeInfo({ id: unref(rowId) })
|
||||
if (res.succeeded) {
|
||||
await setFieldsValue({
|
||||
...res.data,
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
@ -0,0 +1,181 @@
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
:use-wrapper="true"
|
||||
title="编辑表单复制模板"
|
||||
width="50%"
|
||||
@register="registerModal"
|
||||
@ok="handleSave"
|
||||
>
|
||||
<a-form v-model="formData" class="copy-form-model" layout="vertical">
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="12">
|
||||
<a-form-item label="模版名称" name="templateName">
|
||||
<a-input v-model:value="formData.templateName" placeholder="请输入" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="权限模块名称">
|
||||
<a-input v-model:value="formData.permissionName" disabled placeholder="请输入" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="排序号">
|
||||
<a-input v-model:value="formData.orderNo" placeholder="请输入" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="表单号">
|
||||
<a-input v-model:value="formData.formNo" disabled placeholder="请输入" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="是否可用">
|
||||
<a-radio-group v-model:value="formData.status" button-style="solid">
|
||||
<a-radio-button :value="0">禁用</a-radio-button>
|
||||
<a-radio-button :value="1">启用</a-radio-button>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="是否公共表示">
|
||||
<a-radio-group v-model:value="formData.isPublic" button-style="solid">
|
||||
<a-radio-button :value="true">是</a-radio-button>
|
||||
<a-radio-button :value="false">否</a-radio-button>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-form-item label="表单设置">
|
||||
<a-checkbox-group v-model:value="checkedList" style="width: 100%">
|
||||
<a-row>
|
||||
<a-col
|
||||
v-for="(item, index) in plainOptions"
|
||||
v-show="item.field != 'id'"
|
||||
:span="6"
|
||||
:key="index">
|
||||
<a-checkbox :value="item.field">{{ item.label }}</a-checkbox>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-checkbox-group>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
||||
<!--右下角按钮-->
|
||||
<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, unref, reactive, defineEmits } from 'vue'
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal'
|
||||
import { EditFormCopy, getCodeGoodsTypeInfo } from '../api'
|
||||
import { useMessage } from '/@/hooks/web/useMessage'
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const loading = ref(false)
|
||||
const rowId = ref('')
|
||||
const form = ref()
|
||||
const checkedList = ref()
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
templateName: '',
|
||||
permissionId: '',
|
||||
permissionName: '',
|
||||
isPublic: '',
|
||||
copyFields: '',
|
||||
formNo: '',
|
||||
orderNo: '',
|
||||
status: '',
|
||||
content: ''
|
||||
})
|
||||
const plainOptions = ref([])
|
||||
const { createMessage } = useMessage()
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
setModalProps({ confirmLoading: false, loading: true })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
if (unref(isUpdate)) {
|
||||
rowId.value = data.record.id
|
||||
const res: API.DataResult = await getCodeGoodsTypeInfo({ id: unref(rowId) })
|
||||
if (res?.data?.content) {
|
||||
const content = JSON.parse(res.data.content)
|
||||
plainOptions.value = content.columns
|
||||
}
|
||||
formData.id = res.data.id
|
||||
formData.templateName = res.data.templateName
|
||||
formData.permissionId = res.data.permissionId
|
||||
formData.permissionName = res.data.permissionName
|
||||
formData.isPublic = res.data.isPublic
|
||||
formData.formNo = res.data.formNo
|
||||
formData.orderNo = res.data.orderNo
|
||||
formData.status = res.data.status
|
||||
formData.content = res.data.content
|
||||
if (res.data.copyFields) {
|
||||
checkedList.value = res.data.copyFields.split(',')
|
||||
}
|
||||
}
|
||||
setModalProps({ loading: false })
|
||||
})
|
||||
|
||||
async function handleSave(exit) {
|
||||
try {
|
||||
setModalProps({ confirmLoading: true, loading: true })
|
||||
// TODO custom api
|
||||
if (checkedList.value && checkedList.value.length) {
|
||||
formData.copyFields = String(checkedList.value)
|
||||
}
|
||||
loading.value = true
|
||||
const res: API.DataResult = await EditFormCopy(formData)
|
||||
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>
|
||||
|
||||
<style lang="scss">
|
||||
.copy-form-model {
|
||||
.ant-form-item-label {
|
||||
padding-bottom: 0;
|
||||
label {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* @Description: 费用管理 -> 币别设置接口
|
||||
* @Author: lijj
|
||||
* @Date: 2024-04-25 15:48:33
|
||||
*/
|
||||
|
||||
import { request } from '/@/utils/request'
|
||||
import { DataResult, PageRequest } from '/@/api/model/baseModel'
|
||||
enum Api {
|
||||
list = '/feeApi/FeeCurrency/GetFeeCurrencyList',
|
||||
edit = '/feeApi/FeeCurrency/EditFeeCurrency',
|
||||
info = '/feeApi/FeeCurrency/GetFeeCurrencyInfo'
|
||||
}
|
||||
// 列表 (Auth)
|
||||
export function getFeeCurrencyList(data: PageRequest) {
|
||||
return request<DataResult>({
|
||||
url: Api.list,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
// 编辑 (Auth)
|
||||
export function editFeeCurrency(data: PageRequest) {
|
||||
return request<DataResult>({
|
||||
url: Api.edit,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
// 详情 (Auth)
|
||||
export function getFeeCurrencyInfo(query) {
|
||||
return request<DataResult>({
|
||||
url: Api.info,
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* @Description: 币别设置tsx
|
||||
* @Author: lijj
|
||||
* @Date: 2024-04-25 15:48:33
|
||||
*/
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table'
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '币别代码',
|
||||
dataIndex: 'codeName',
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
title: '英文名称',
|
||||
dataIndex: 'name',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
title: '中文描述名称',
|
||||
dataIndex: 'description',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
title: '对人民币汇率',
|
||||
dataIndex: 'defaultRate',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
title: '财务软件代码',
|
||||
dataIndex: 'financeSoftCode',
|
||||
width: 200
|
||||
}
|
||||
]
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'codeName',
|
||||
label: '币别代码',
|
||||
component: 'Input',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
]
|
||||
export const formSchema: FormSchema[] = [
|
||||
{
|
||||
label: '',
|
||||
field: 'id',
|
||||
component: 'Input',
|
||||
defaultValue: '',
|
||||
show: false
|
||||
},
|
||||
{
|
||||
field: 'codeName',
|
||||
label: '币别代码',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
colProps: { span: 12 }
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
label: '英文名称',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
colProps: { span: 12 }
|
||||
},
|
||||
{
|
||||
field: 'description',
|
||||
label: '中文描述名称',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
colProps: { span: 12 },
|
||||
},
|
||||
{
|
||||
field: 'defaultRate',
|
||||
label: '对人民币汇率',
|
||||
component: 'Input',
|
||||
colProps: { span: 12 }
|
||||
},
|
||||
{
|
||||
field: 'financeSoftCode',
|
||||
label: '财务软件代码',
|
||||
required: true,
|
||||
component: 'Input',
|
||||
colProps: { span: 12 }
|
||||
}
|
||||
]
|
@ -0,0 +1,110 @@
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
:use-wrapper="true"
|
||||
:title="getTitle"
|
||||
:form-schema="formSchema"
|
||||
width="50%"
|
||||
@register="registerModal"
|
||||
@ok="handleSave"
|
||||
>
|
||||
<!-- 币别表单 -->
|
||||
<BasicForm @register="registerForm" />
|
||||
<!--右下角按钮-->
|
||||
<template #footer>
|
||||
<a-button
|
||||
pre-icon="ant-design:close-outlined"
|
||||
type="warning"
|
||||
:loading="loading"
|
||||
ghost
|
||||
style="margin-right: 0.8rem"
|
||||
@click="closeModal"
|
||||
>
|
||||
取消
|
||||
</a-button>
|
||||
<a-button
|
||||
type="success"
|
||||
:loading="loading"
|
||||
pre-icon="ant-design:check-outlined"
|
||||
style="margin-right: 0.8rem"
|
||||
@click="handleSave(false)"
|
||||
>
|
||||
仅保存
|
||||
</a-button>
|
||||
<a-button
|
||||
pre-icon="ant-design:check-circle-outlined"
|
||||
type="primary"
|
||||
:loading="loading"
|
||||
@click="handleSave(true)"
|
||||
>
|
||||
保存并关闭
|
||||
</a-button>
|
||||
</template>
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, unref } from 'vue'
|
||||
// 弹窗组件
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal'
|
||||
import { BasicForm, useForm } from '/@/components/Form/index'
|
||||
// 币别字段数据
|
||||
import { formSchema } from '../columns'
|
||||
// 币别相关接口
|
||||
import { editFeeCurrency, getFeeCurrencyInfo } from '../api'
|
||||
// 提升消息混入
|
||||
import { useMessage } from '/@/hooks/web/useMessage'
|
||||
// 声明Emits
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
// 按钮loading
|
||||
const loading = ref(false)
|
||||
const rowId = ref('')
|
||||
const { createMessage } = useMessage()
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] =
|
||||
useForm({
|
||||
labelWidth: 100,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal, updateFormField }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false, loading: true })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
if (unref(isUpdate)) {
|
||||
setModalProps({ confirmLoading: true });
|
||||
updateFormField(updateSchema)
|
||||
rowId.value = data.record.id
|
||||
const res: API.DataResult = await getFeeCurrencyInfo({ id: unref(rowId) })
|
||||
if (res.succeeded) {
|
||||
setFieldsValue({
|
||||
...res.data,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
setFieldsValue({ permissionIdentity: unref(2) })
|
||||
}
|
||||
setModalProps({ loading: false })
|
||||
})
|
||||
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增币别' : '编辑币别'))
|
||||
|
||||
async function handleSave(exit) {
|
||||
try {
|
||||
const values = await validate()
|
||||
loading.value = true
|
||||
setModalProps({ confirmLoading: true, loading: true })
|
||||
const res: API.DataResult = await editFeeCurrency(values)
|
||||
loading.value = false
|
||||
if (res.succeeded) {
|
||||
createMessage.success(res.message)
|
||||
emit('success')
|
||||
} else {
|
||||
createMessage.error(res.message)
|
||||
}
|
||||
exit && closeModal()
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false, loading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
@ -0,0 +1,121 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #toolbar>
|
||||
<a-button type="primary" @click="handleCreate"> 新建币别 </a-button>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'userName'">
|
||||
<span style="color: #0d84ff" @click="handleEdit(record)">{{ record.userName }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
icon: 'clarity:note-edit-line',
|
||||
tooltip: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<Modal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { defineComponent, onMounted, ref } from 'vue'
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'
|
||||
import { getFeeCurrencyList, ApiImport } from './api'
|
||||
import { useModal } from '/@/components/Modal'
|
||||
import Modal from './components/Modal.vue'
|
||||
import { columns, searchFormSchema } from './columns'
|
||||
const dictOptions = ref<any[]>([])
|
||||
const [registerModal, { openModal }] = useModal()
|
||||
const [registerPermissionModal, { openModal: openPermissionModal }] = useModal()
|
||||
const [registerTable, { reload, getForm, getPaginationRef }] = useTable({
|
||||
title: '币别设置',
|
||||
// api: getSysDictTypeList,
|
||||
api: async (p) => {
|
||||
const res: API.DataResult = await getFeeCurrencyList(p)
|
||||
// console.log(items);
|
||||
return new Promise((resolve) => {
|
||||
resolve({ data: [...res.data], total: res.count })
|
||||
})
|
||||
},
|
||||
beforeFetch: () => {
|
||||
var currentPageInfo: any = getPaginationRef()
|
||||
var data = getForm().getFieldsValue()
|
||||
const postParam: API.PageRequest = {
|
||||
queryCondition: '',
|
||||
pageCondition: {
|
||||
pageIndex: currentPageInfo.current,
|
||||
pageSize: currentPageInfo.pageSize,
|
||||
sortConditions: [],
|
||||
},
|
||||
}
|
||||
let condition: API.ConditionItem[] = []
|
||||
if (!!data.UserName) {
|
||||
condition.push({
|
||||
FieldName: 'UserName',
|
||||
FieldValue: data.UserName,
|
||||
ConditionalType: 1,
|
||||
})
|
||||
}
|
||||
if (!!data.UserCode) {
|
||||
condition.push({
|
||||
FieldName: 'UserCode',
|
||||
FieldValue: data.UserCode,
|
||||
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,
|
||||
canResize: false,
|
||||
actionColumn: {
|
||||
width: 80,
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
fixed: 'right',
|
||||
},
|
||||
})
|
||||
|
||||
function handleCreate() {
|
||||
openModal(true, {
|
||||
isParent: false,
|
||||
isUpdate: false,
|
||||
})
|
||||
}
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
})
|
||||
}
|
||||
function handleDelete(record: Recordable) {
|
||||
console.log(record)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
//初始化字典选项
|
||||
})
|
||||
function handleSuccess() {
|
||||
reload()
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue