This commit is contained in:
zmj 2024-03-16 14:28:12 +08:00
parent ac2f9cdc83
commit 5f1d295a5a
11 changed files with 986 additions and 1 deletions

26
src/api/zjzx_invoice.ts Normal file
View File

@ -0,0 +1,26 @@
import request from '@/utils/request'
// 造价咨询--开票台账列表
export function apiZjzxInvoiceLists(params: any) {
return request.get({ url: '/zjzx_finance.zjzx_invoice/lists', params })
}
// 添加造价咨询--开票台账
export function apiZjzxInvoiceAdd(params: any) {
return request.post({ url: '/zjzx_finance.zjzx_invoice/add', params })
}
// 编辑造价咨询--开票台账
export function apiZjzxInvoiceEdit(params: any) {
return request.post({ url: '/zjzx_finance.zjzx_invoice/edit', params })
}
// 删除造价咨询--开票台账
export function apiZjzxInvoiceDelete(params: any) {
return request.post({ url: '/zjzx_finance.zjzx_invoice/delete', params })
}
// 造价咨询--开票台账详情
export function apiZjzxInvoiceDetail(params: any) {
return request.get({ url: '/zjzx_finance.zjzx_invoice/detail', params })
}

26
src/api/zjzx_refund.ts Normal file
View File

@ -0,0 +1,26 @@
import request from '@/utils/request'
// 造价咨询--到账台账列表
export function apiZjzxRefundLists(params: any) {
return request.get({ url: '/zjzx_finance.zjzx_refund/lists', params })
}
// 添加造价咨询--到账台账
export function apiZjzxRefundAdd(params: any) {
return request.post({ url: '/zjzx_finance.zjzx_refund/add', params })
}
// 编辑造价咨询--到账台账
export function apiZjzxRefundEdit(params: any) {
return request.post({ url: '/zjzx_finance.zjzx_refund/edit', params })
}
// 删除造价咨询--到账台账
export function apiZjzxRefundDelete(params: any) {
return request.post({ url: '/zjzx_finance.zjzx_refund/delete', params })
}
// 造价咨询--到账台账详情
export function apiZjzxRefundDetail(params: any) {
return request.get({ url: '/zjzx_finance.zjzx_refund/detail', params })
}

View File

@ -0,0 +1,26 @@
import request from '@/utils/request'
// 造价咨询--项目结算列表
export function apiZjzxSettlementLists(params: any) {
return request.get({ url: '/zjzx_finance.zjzx_settlement/lists', params })
}
// 添加造价咨询--项目结算
export function apiZjzxSettlementAdd(params: any) {
return request.post({ url: '/zjzx_finance.zjzx_settlement/add', params })
}
// 编辑造价咨询--项目结算
export function apiZjzxSettlementEdit(params: any) {
return request.post({ url: '/zjzx_finance.zjzx_settlement/edit', params })
}
// 删除造价咨询--项目结算
export function apiZjzxSettlementDelete(params: any) {
return request.post({ url: '/zjzx_finance.zjzx_settlement/delete', params })
}
// 造价咨询--项目结算详情
export function apiZjzxSettlementDetail(params: any) {
return request.get({ url: '/zjzx_finance.zjzx_settlement/detail', params })
}

View File

@ -24,6 +24,7 @@ import { apiCostProjectLists } from '@/api/cost_project'
import { apiTaskTypeLists } from '@/api/task_type'
import {apiSupervisionMaterialEquipmentInfoLists}from "@/api/supervision_material_equipment_info"
import { apiConsultProjectLists} from '@/api/consult_project'
import { apiZjzxInvoiceLists } from '@/api/zjzx_invoice'
@ -392,6 +393,33 @@ export const consult_project:Iconfig = {
]
}
export const zjzx_invoice:Iconfig = {
fetchFn: apiZjzxInvoiceLists,
dictData:"zjzx_invoice_type",
serchList: [
{
label: '开票编号',
value: "invoice_code"
},
{
label: '发票类型',
value: "invoice_type",
select:'zjzx_invoice_type'
},
{
label:"开票单位名称",
value:'apply_company',
},
],
tableList: [
{ project_name: "项目名称" },
{ invoice_code: "开票编号" },
{ invoice_type_text: "发票类型" },
{ apply_amount: "开票申请金额" },
]
}

View File

@ -122,4 +122,3 @@ const handleDelete = async (id: number | any[]) => {
getLists()
</script>

View File

@ -0,0 +1,177 @@
<template>
<div class="edit-popup">
<popup ref="popupRef" :title="popupTitle" :async="true" width="550px" @confirm="handleSubmit"
@close="handleClose">
<el-form ref="formRef" :model="formData" label-width="125px" :rules="formRules">
<el-form-item label="项目名称" prop="project_id">
<el-input v-model="formData.project_name" readonly @click="showDialog = true" clearable
placeholder="点击选择项目" />
</el-form-item>
<el-form-item label="开票编号" prop="invoice_code">
<el-input v-model="formData.invoice_code" clearable placeholder="请输入开票编号" />
</el-form-item>
<el-form-item label="发票类型" prop="invoice_type">
<el-select class="flex-1" v-model="formData.invoice_type" clearable placeholder="请选择发票类型">
<el-option v-for="(item, index) in dictData.zjzx_invoice_type" :key="index" :label="item.name"
:value="parseInt(item.value)" />
</el-select>
</el-form-item>
<el-form-item label="开票申请金额" prop="apply_amount">
<el-input v-model="formData.apply_amount" clearable placeholder="请输入开票申请金额" type="number" />
</el-form-item>
<el-form-item label="开票单位名称" prop="apply_company">
<el-input v-model="formData.apply_company" clearable placeholder="请输入开票单位名称" />
</el-form-item>
<el-form-item label="纳税人识别号">
<el-input v-model="formData.apply_company_number" clearable placeholder="请输入纳税人识别号" />
</el-form-item>
<el-form-item label="开票单位注册地址">
<el-input v-model="formData.apply_company_address" clearable placeholder="请输入开票单位注册地址" />
</el-form-item>
<el-form-item label="开票单位电话">
<el-input v-model="formData.apply_company_telephone" clearable placeholder="请输入开票单位电话" />
</el-form-item>
<el-form-item label="开户银行">
<el-input v-model="formData.apply_company_bank" clearable placeholder="请输入开户银行" />
</el-form-item>
<el-form-item label="开户账号">
<el-input v-model="formData.apply_company_account" clearable placeholder="请输入开户账号" />
</el-form-item>
<el-form-item label="开票联系人">
<el-input v-model="formData.apply_contact" clearable placeholder="请输入开票联系人" />
</el-form-item>
<el-form-item label="对应付款方式">
<el-input v-model="formData.pay_type" clearable placeholder="请输入对应付款方式" />
</el-form-item>
<el-form-item label="开票内容">
<el-input v-model="formData.invoice_content" clearable placeholder="请输入开票内容" />
</el-form-item>
<createUserLable :formData="formData"></createUserLable>
</el-form>
<el-dialog v-model="showDialog" title="选择项目" width="70%">
<dialogTable :config="cost_project" @customEvent="customEvent">
</dialogTable>
</el-dialog>
</popup>
</div>
</template>
<script lang="ts" setup name="zjzxInvoiceEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiZjzxInvoiceAdd, apiZjzxInvoiceEdit } from '@/api/zjzx_invoice'
import { cost_project } from "@/components/dialogTable/dialogTableConfig"
import type { PropType } from 'vue'
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({})
}
})
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add')
const showDialog = ref(false)
//
const popupTitle = computed(() => {
return mode.value == 'edit' ? '编辑造价咨询--开票台账' : '新增造价咨询--开票台账'
})
//
const formData = reactive({
id: '',
project_id: '',
project_name: "",
invoice_code: '',
invoice_type: '',
apply_amount: '',
apply_company: '',
apply_company_number: '',
apply_company_address: '',
apply_company_telephone: '',
apply_company_bank: '',
apply_company_account: '',
apply_contact: '',
pay_type: '',
invoice_content: '',
create_user: '',
create_time: '',
})
const customEvent = (e) => {
formData.project_id = e.id
formData.project_name = e.project_name
showDialog.value = false
}
//
const formRules = reactive<any>({
project_id: [{
required: true,
message: '请选择项目',
trigger: ['blur']
}],
invoice_code: [{
required: true,
message: '请输入开票编号',
trigger: ['blur']
}],
invoice_type: [{
required: true,
message: '请选择发票类型',
trigger: ['blur']
}],
apply_amount: [{
required: true,
message: '请输入开票申请金额',
trigger: ['blur']
}],
})
//
const setFormData = async (data: Record<any, any>) => {
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
}
}
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData, }
mode.value == 'edit'
? await apiZjzxInvoiceEdit(data)
: await apiZjzxInvoiceAdd(data)
popupRef.value?.close()
emit('success')
}
//
const open = (type = 'add') => {
mode.value = type
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
})
</script>

View File

@ -0,0 +1,133 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" inline>
<el-form-item label="项目名称" prop="project_id">
<select-remote :formData="queryParams" model="project_id"
:api="apiCostProjectDatas"></select-remote>
</el-form-item>
<el-form-item label="开票编号" prop="invoice_code">
<el-input class="w-[280px]" v-model="queryParams.invoice_code" clearable placeholder="请输入开票编号" />
</el-form-item>
<el-form-item label="发票类型" prop="invoice_type">
<el-select class="w-[280px]" v-model="queryParams.invoice_type" clearable placeholder="请选择发票类型">
<el-option v-for="(item, index) in dictData.zjzx_invoice_type" :key="index" :label="item.name"
:value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="开票单位名称" prop="apply_company">
<el-input class="w-[280px]" v-model="queryParams.apply_company" clearable placeholder="请输入开票单位名称" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<el-button v-perms="['zjzx_finance.zjzx_invoice/add']" type="primary" @click="handleAdd">
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button>
<el-button v-perms="['zjzx_finance.zjzx_invoice/delete']" :disabled="!selectData.length"
@click="handleDelete(selectData)">
删除
</el-button>
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="项目名称" prop="project_name" show-overflow-tooltip />
<el-table-column label="开票编号" prop="invoice_code" show-overflow-tooltip />
<el-table-column label="发票类型" prop="invoice_type">
<template #default="{ row }">
<dict-value :options="dictData.zjzx_invoice_type" :value="row.invoice_type" />
</template>
</el-table-column>
<el-table-column label="开票申请金额" prop="apply_amount" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button v-perms="['zjzx_finance.zjzx_invoice/edit']" type="primary" link
@click="handleEdit(row)">
编辑
</el-button>
<el-button v-perms="['zjzx_finance.zjzx_invoice/delete']" type="danger" link
@click="handleDelete(row.id)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
</el-card>
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
</div>
</template>
<script lang="ts" setup name="zjzxInvoiceLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiZjzxInvoiceLists, apiZjzxInvoiceDelete, apiZjzxInvoiceDetail } from '@/api/zjzx_invoice'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import { apiCostProjectDatas } from "@/api/cost_project";
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
//
const queryParams = reactive({
project_id: '',
invoice_code: '',
invoice_type: '',
apply_company: ''
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('zjzx_invoice_type')
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiZjzxInvoiceLists,
params: queryParams
})
//
const handleAdd = async () => {
showEdit.value = true
await nextTick()
editRef.value?.open('add')
}
//
const handleEdit = async (data: any) => {
let res = await apiZjzxInvoiceDetail({ id: data.id })
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
editRef.value?.setFormData(res)
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')
await apiZjzxInvoiceDelete({ id })
getLists()
}
getLists()
</script>

View File

@ -0,0 +1,187 @@
<template>
<div class="edit-popup">
<popup ref="popupRef" :title="popupTitle" :async="true" width="550px" @confirm="handleSubmit"
@close="handleClose">
<el-form ref="formRef" :model="formData" label-width="110px" :rules="formRules">
<el-form-item label="项目名称" prop="project_id">
<el-input v-model="formData.project_name" readonly @click="showDialog = true" clearable
placeholder="点击选择项目" />
</el-form-item>
<el-form-item label="开票编号" prop="invoice_id">
<el-input v-model="formData.invoice_code" clearable placeholder="点击选择开票台账"
@click="showDialog1 = true" />
</el-form-item>
<el-form-item label="本次到账金额" prop="amount">
<el-input v-model="formData.amount" clearable placeholder="请输入本次到账金额" />
</el-form-item>
<el-form-item label="到账日期" prop="date">
<el-date-picker class="flex-1 !flex" v-model="formData.date" clearable value-format="YYYY-MM-DD"
placeholder="选择到账日期">
</el-date-picker>
</el-form-item>
<el-form-item label="说明" prop="remark">
<el-input v-model="formData.remark" clearable placeholder="请输入说明" type="textarea" />
</el-form-item>
<createUserLable :formData="formData"></createUserLable>
</el-form>
<el-dialog v-model="showDialog" title="选择项目" width="70%">
<dialogTable :config="cost_project" @customEvent="customEvent">
</dialogTable>
</el-dialog>
<div v-if="showDialog1">
<el-dialog v-model="showDialog1" title="选择开票编号" width="70%">
<dialogTable :config="zjzx_invoice" :query="{ project_id: formData.project_id }"
@customEvent="customEvent1">
</dialogTable>
</el-dialog>
</div>
</popup>
</div>
</template>
<script lang="ts" setup name="zjzxRefundEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiZjzxRefundAdd, apiZjzxRefundEdit, apiZjzxRefundDetail } from '@/api/zjzx_refund'
import type { PropType } from 'vue'
import { cost_project, zjzx_invoice } from "@/components/dialogTable/dialogTableConfig"
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({})
}
})
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add')
const showDialog = ref(false)
const showDialog1 = ref(false)
//
const popupTitle = computed(() => {
return mode.value == 'edit' ? '编辑造价咨询--到账台账' : '新增造价咨询--到账台账'
})
//
const formData = reactive({
id: '',
project_id: '',
project_name: "",
invoice_id: '',
invoice_code: '',
amount: '',
date: '',
remark: '',
create_user: '',
create_time: '',
})
const customEvent = (e) => {
formData.project_id = e.id
formData.project_name = e.project_name
showDialog.value = false
formData.invoice_id = ''
formData.invoice_code = ''
}
const customEvent1 = (e) => {
formData.invoice_id = e.id
formData.invoice_code = e.invoice_code
showDialog1.value = false
}
//
const formRules = reactive<any>({
project_id: [{
required: true,
message: '请输入项目id',
trigger: ['blur']
}],
invoice_id: [{
required: true,
message: '请输入开票id',
trigger: ['blur']
}],
amount: [{
required: true,
message: '请输入本次到账金额',
trigger: ['blur']
}],
date: [{
required: true,
message: '请输入到账日期',
trigger: ['blur']
}],
remark: [{
required: true,
message: '请输入说明',
trigger: ['blur']
}],
create_user: [{
required: true,
message: '请输入登记人',
trigger: ['blur']
}],
create_time: [{
required: true,
message: '请输入登记时间',
trigger: ['blur']
}]
})
//
const setFormData = async (data: Record<any, any>) => {
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
}
}
}
const getDetail = async (row: Record<string, any>) => {
const data = await apiZjzxRefundDetail({
id: row.id
})
setFormData(data)
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData, }
mode.value == 'edit'
? await apiZjzxRefundEdit(data)
: await apiZjzxRefundAdd(data)
popupRef.value?.close()
emit('success')
}
//
const open = (type = 'add') => {
mode.value = type
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>

View File

@ -0,0 +1,125 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" inline>
<el-form-item label="项目名称" prop="project_id">
<select-remote :formData="queryParams" model="invoce_id" :api="apiCostProjectDatas"></select-remote>
</el-form-item>
<!-- <el-form-item label="开票id" prop="invoce_id">
<select-remote :formData="queryParams" model="invoce_id" :api="apiCostProjectDatas"></select-remote>
</el-form-item> -->
<el-form-item label="登记人" prop="create_user">
<el-input class="w-[280px]" v-model="queryParams.create_user" clearable placeholder="请输入登记人" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<el-button v-perms="['zjzx_finance.zjzx_refund/add']" type="primary" @click="handleAdd">
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button>
<el-button v-perms="['zjzx_finance.zjzx_refund/delete']" :disabled="!selectData.length"
@click="handleDelete(selectData)">
删除
</el-button>
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="项目名称" prop="project_name" show-overflow-tooltip />
<el-table-column label="开票编号" prop="invoice_code" show-overflow-tooltip />
<el-table-column label="合同名称" prop="contract_name" show-overflow-tooltip />
<el-table-column label="合同类型" prop="contract_type" show-overflow-tooltip />
<el-table-column label="本次到账金额" prop="amount" show-overflow-tooltip />
<el-table-column label="到账日期" prop="date" show-overflow-tooltip />
<el-table-column label="甲方公司" prop="part_a" show-overflow-tooltip />
<el-table-column label="乙方公司" prop="part_b" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button v-perms="['zjzx_finance.zjzx_refund/edit']" type="primary" link
@click="handleEdit(row)">
编辑
</el-button>
<el-button v-perms="['zjzx_finance.zjzx_refund/delete']" type="danger" link
@click="handleDelete(row.id)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
</el-card>
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
</div>
</template>
<script lang="ts" setup name="zjzxRefundLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiZjzxRefundLists, apiZjzxRefundDelete, apiZjzxRefundDetail } from '@/api/zjzx_refund'
import { apiCostProjectDatas } from "@/api/cost_project";
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
//
const queryParams = reactive({
project_id: '',
invoce_id: '',
create_user: ''
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('')
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiZjzxRefundLists,
params: queryParams
})
//
const handleAdd = async () => {
showEdit.value = true
await nextTick()
editRef.value?.open('add')
}
//
const handleEdit = async (data: any) => {
let res = await apiZjzxRefundDetail({ id: data.id })
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
editRef.value?.setFormData(res)
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')
await apiZjzxRefundDelete({ id })
getLists()
}
getLists()
</script>

View File

@ -0,0 +1,139 @@
<template>
<div class="edit-popup">
<popup ref="popupRef" :title="popupTitle" :async="true" width="550px" @confirm="handleSubmit"
@close="handleClose">
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
<el-form-item label="项目名称" prop="project_id">
<el-input v-model="formData.project_name" readonly @click="showDialog = true" clearable
placeholder="点击选择项目" />
</el-form-item>
<el-form-item label="结算金额">
<el-input v-model="formData.amount" clearable placeholder="请输入结算金额" type="number" />
</el-form-item>
<el-form-item label="结算日期" prop="date">
<el-date-picker class="flex-1 !flex" v-model="formData.date" clearable value-format="YYYY-MM-DD"
placeholder="选择到账日期">
</el-date-picker>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="formData.remark" clearable placeholder="请输入备注" type="textarea" />
</el-form-item>
<el-form-item label="附件">
<upload-annex :formData="formData"></upload-annex>
</el-form-item>
</el-form>
<el-dialog v-model="showDialog" title="选择项目" width="70%">
<dialogTable :config="cost_project" @customEvent="customEvent">
</dialogTable>
</el-dialog>
</popup>
</div>
</template>
<script lang="ts" setup name="zjzxSettlementEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiZjzxSettlementAdd, apiZjzxSettlementEdit } from '@/api/zjzx_settlement'
import { cost_project } from "@/components/dialogTable/dialogTableConfig"
import type { PropType } from 'vue'
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({})
}
})
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add')
const showDialog = ref(false)
//
const popupTitle = computed(() => {
return mode.value == 'edit' ? '编辑造价咨询--项目结算' : '新增造价咨询--项目结算'
})
//
const formData = reactive({
id: '',
project_id: '',
project_name: "",
amount: '',
date: '',
remark: '',
annex: [],
})
const customEvent = (e) => {
formData.project_id = e.id
formData.project_name = e.project_name
showDialog.value = false
}
//
const formRules = reactive<any>({
project_id: [{
required: true,
message: '请输入项目id',
trigger: ['blur']
}],
amount: [{
required: true,
message: '请输入结算金额',
trigger: ['blur']
}],
date: [{
required: true,
message: '请输入结算日期',
trigger: ['blur']
}],
})
//
const setFormData = async (data: Record<any, any>) => {
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
}
}
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData, }
mode.value == 'edit'
? await apiZjzxSettlementEdit(data)
: await apiZjzxSettlementAdd(data)
popupRef.value?.close()
emit('success')
}
//
const open = (type = 'add') => {
mode.value = type
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
})
</script>

View File

@ -0,0 +1,119 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" inline>
<el-form-item label="项目名称" prop="project_id">
<select-remote :formData="queryParams" model="invoce_id" :api="apiCostProjectDatas"></select-remote>
</el-form-item>
<el-form-item label="结算日期" prop="date">
<el-input class="w-[280px]" v-model="queryParams.date" clearable placeholder="请输入结算日期" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<el-button v-perms="['zjzx_finance.zjzx_settlement/add']" type="primary" @click="handleAdd">
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button>
<el-button v-perms="['zjzx_finance.zjzx_settlement/delete']" :disabled="!selectData.length"
@click="handleDelete(selectData)">
删除
</el-button>
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="项目名称" prop="project_name" show-overflow-tooltip />
<el-table-column label="项目编号" prop="project_num" show-overflow-tooltip />
<el-table-column label="合同名称" prop="contract_name" show-overflow-tooltip />
<el-table-column label="合同类型" prop="contract_type" show-overflow-tooltip />
<el-table-column label="结算金额" prop="amount" show-overflow-tooltip />
<el-table-column label="结算日期" prop="date" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button v-perms="['zjzx_finance.zjzx_settlement/edit']" type="primary" link
@click="handleEdit(row)">
编辑
</el-button>
<el-button v-perms="['zjzx_finance.zjzx_settlement/delete']" type="danger" link
@click="handleDelete(row.id)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
</el-card>
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
</div>
</template>
<script lang="ts" setup name="zjzxSettlementLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiZjzxSettlementLists, apiZjzxSettlementDelete, apiZjzxSettlementDetail } from '@/api/zjzx_settlement'
import { apiCostProjectDatas } from "@/api/cost_project";
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
//
const queryParams = reactive({
project_id: '',
date: ''
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('')
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiZjzxSettlementLists,
params: queryParams
})
//
const handleAdd = async () => {
showEdit.value = true
await nextTick()
editRef.value?.open('add')
}
//
const handleEdit = async (data: any) => {
let res = await apiZjzxSettlementDetail({ id: data.id })
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
editRef.value?.setFormData(res)
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')
await apiZjzxSettlementDelete({ id })
getLists()
}
getLists()
</script>