Merge branch 'dev' of http://60.209.125.238:20010/lijingjia/ds-wms-client-web into dev
commit
7c5fbe6119
@ -0,0 +1,124 @@
|
||||
<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 { BankformSchema } from './columns'
|
||||
|
||||
import { editBank, getBankInfo } from '/@/api/system/org'
|
||||
import { useMessage } from '/@/hooks/web/useMessage'
|
||||
// 声明Emits
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const loading = ref(false)
|
||||
const rowId = ref('')
|
||||
const linkId = ref('')
|
||||
const { createMessage } = useMessage()
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({
|
||||
labelWidth: 100,
|
||||
schemas: BankformSchema,
|
||||
showActionButtonGroup: false,
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
console.log(data, 1111111111)
|
||||
|
||||
// initData().then(async () => {
|
||||
setModalProps({ confirmLoading: false, loading: true })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
linkId.value = data.linkId ? data.linkId : ''
|
||||
if (unref(isUpdate)) {
|
||||
rowId.value = data.record.id ? data.record.id : data.record.value
|
||||
const res: API.DataResult = await getBankInfo({ 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 })
|
||||
values.linkId = values.linkId ? values.linkId : linkId.value
|
||||
const res: API.DataResult = await editBank(values)
|
||||
|
||||
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 getBankInfo({ id: unref(rowId) })
|
||||
if (res.succeeded) {
|
||||
await setFieldsValue({
|
||||
...res.data,
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue