Commit fcfec653 by Jony.L

算力资源订单管理 隐藏无用的搜索栏、调整字段、开票功能

parent c43550c0
...@@ -60,5 +60,10 @@ export const ResourceOrderApi = { ...@@ -60,5 +60,10 @@ export const ResourceOrderApi = {
// 导出算力资源订单 Excel // 导出算力资源订单 Excel
exportResourceOrder: async (params) => { exportResourceOrder: async (params) => {
return await request.download({ url: `/compute/resource-order/export-excel`, params }) return await request.download({ url: `/compute/resource-order/export-excel`, params })
},
// 开具发票
issueInvoice: async (data: any) => {
return await request.put({ url: `/compute/resource-order/issue-invoice`, data })
} }
} }
\ No newline at end of file
<template>
<Dialog v-model="dialogVisible" title="上传发票" width="45%">
<el-form ref="formRef" :model="formData" label-width="100px">
<el-form-item label="发票地址" prop="invoiceUrl">
<UploadFile v-model="formData.invoiceUrl" :file-type="['pdf']" :limit="1" />
<p class="upload-tips">
请上传 大小不超过 <span class="red-text">5MB</span> 格式为
<span class="red-text">pdf</span>
的文件
</p>
</el-form-item>
</el-form>
<template #footer>
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
<el-button @click="dialogVisible = false">取 消</el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { ResourceOrderApi } from "@/api/compute/resourceorder";
import { UploadFile } from '@/components/UploadFile';
const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗
const dialogVisible = ref(false) // 弹窗是否展示
const formRef = ref() // 表单 Ref
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
/** 提交表单 */
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
const submitForm = async () => {
// 提交请求
formLoading.value = true
try {
const data = unref(formData)
await ResourceOrderApi.issueInvoice(data)
message.success(t('common.updateSuccess'))
dialogVisible.value = false
// 发送操作成功的事件
emit('success', true)
} catch (error) {
console.error(error);
}finally {
formLoading.value = false
}
}
const formData = ref({
id: undefined, // 订单编号
invoiceStatus: undefined,
invoiceUrl: ''
})
const open = async (row: any) => {
resetForm()
// 设置数据
formData.value.id = row.id
formData.value.invoiceStatus = row.invoiceStatus
formData.value.invoiceUrl = row.invoiceUrl
dialogVisible.value = true
}
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined, // 订单编号
invoiceStatus: undefined,
invoiceUrl: ''
}
formRef.value?.resetFields()
}
</script>
<style scoped lang="scss">
.red-text {
color: red;
}
.upload-tips {
font-size: 12px;
color: #666;
margin-top: 5px;
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment