项目周报完善、机票预定

dev
lh 2 months ago
parent c3c7cfadb4
commit c59f37569f

@ -0,0 +1,76 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FlightBookingVO, FlightBookingForm, FlightBookingQuery } from '@/api/oa/flightBooking/types';
/**
*
* @param query
* @returns {*}
*/
export const listFlightBooking = (query?: FlightBookingQuery): AxiosPromise<FlightBookingVO[]> => {
return request({
url: '/oa/crm/flightBooking/list',
method: 'get',
params: query
});
};
/**
*
* @param bookingId
*/
export const getFlightBooking = (bookingId: string | number): AxiosPromise<FlightBookingVO> => {
return request({
url: '/oa/crm/flightBooking/' + bookingId,
method: 'get'
});
};
/**
*
* @param data
*/
export const addFlightBooking = (data: FlightBookingForm) => {
return request({
url: '/oa//crm/flightBooking',
method: 'post',
data: data
});
};
/**
*
* @param data
*/
export const updateFlightBooking = (data: FlightBookingForm) => {
return request({
url: '/oa//crm/flightBooking',
method: 'put',
data: data
});
};
/**
*
* @param bookingId
*/
export const delFlightBooking = (bookingId: string | number | Array<string | number>) => {
return request({
url: '/oa//crm/flightBooking/' + bookingId,
method: 'delete'
});
};
/**
*
* @param query
* @returns {*}
*/
export function getCrmFlightBookingList(query) {
return request({
url: '/oa//crm/flightBooking/getCrmFlightBookingList',
method: 'get',
params: query
});
}

@ -0,0 +1,201 @@
export interface FlightBookingVO {
/**
* ID
*/
bookingId: string | number;
/**
*
*/
applyCode: string;
/**
* ID
*/
passengerId: string | number;
/**
*
*/
passengerName: string;
/**
*
*/
travelDate: string;
/**
*
*/
departureLocation: string;
/**
*
*/
arrivalLocation: string;
/**
* 1:5 2:5~8 3:8 4:退
*/
flightDiscount: string;
/**
*
*/
flightAmount: number;
/**
* ID
*/
ossId: string | number;
/**
* 1 2 3 4
*/
bookingStatus: string;
/**
*
*/
flowStatus: string;
/**
*
*/
remark: string;
}
export interface FlightBookingForm extends BaseEntity {
/**
* ID
*/
bookingId?: string | number;
/**
*
*/
applyCode?: string;
/**
* ID
*/
passengerId?: string | number;
/**
*
*/
passengerName?: string;
/**
*
*/
travelDate?: string;
/**
*
*/
departureLocation?: string;
/**
*
*/
arrivalLocation?: string;
/**
* 1:5 2:5~8 3:8 4:退
*/
flightDiscount?: string;
/**
*
*/
flightAmount?: number;
/**
* ID
*/
ossId?: string | number;
/**
* 1 2 3 4
*/
bookingStatus?: string;
/**
*
*/
flowStatus?: string;
/**
*
*/
remark?: string;
}
export interface FlightBookingQuery extends PageQuery {
/**
*
*/
applyCode?: string;
/**
* ID
*/
passengerId?: string | number;
/**
*
*/
passengerName?: string;
/**
*
*/
travelDate?: string;
/**
*
*/
departureLocation?: string;
/**
*
*/
arrivalLocation?: string;
/**
* 1:5 2:5~8 3:8 4:退
*/
flightDiscount?: string;
/**
*
*/
flightAmount?: number;
/**
* ID
*/
ossId?: string | number;
/**
* 1 2 3 4
*/
bookingStatus?: string;
/**
*
*/
flowStatus?: string;
/**
*
*/
params?: any;
}

@ -0,0 +1,974 @@
<template>
<div class="p-2">
<el-card shadow="never" style="margin-top: 0">
<!-- <template #header>-->
<!-- <div style="text-align: left; font-weight: bold; font-size: 24px">合同{{ form.contractId ? ' - 修改' : ' - 新增' }}</div>-->
<!-- </template>-->
<!-- 审批按钮组件 -->
<approvalButton
@submitForm="submitForm"
@approvalVerifyOpen="approvalVerifyOpen"
@handleApprovalRecord="handleApprovalRecord"
:buttonLoading="buttonLoading"
:id="form.contractId"
:status="form.flowStatus"
:pageType="routeParams.type"
:mode="false"
/>
</el-card>
<el-card shadow="never" style="margin-top: 0">
<el-form
ref="contractInfoFormRef"
:model="form"
:loading="buttonLoading"
:rules="rules"
label-width="120px"
>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="有无合同" prop="contractFlag">
<el-radio-group v-model="form.contractFlag" :disabled="isFormDisabled">
<el-radio v-for="dict in contract_flag" :key="dict.value" :value="dict.value">{{ dict.label }} </el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="合同编号" prop="contractCode">
<el-input v-model="form.contractCode" placeholder="请输入合同编号" :disabled="isFormDisabled">
<template #append>
<el-button type="primary" @click="generateContractCode" :disabled="isCodeGenerated">生成合同编号 </el-button>
</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="合同名称" prop="contractName">
<el-input v-model="form.contractName" placeholder="请输入合同名称" :disabled="isFormDisabled"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="合同大类" prop="contractCategory">
<el-select v-model="form.contractCategory" placeholder="请选择合同大类" disabled>
<el-option v-for="dict in contract_category" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<!-- <el-col :span="12">-->
<!-- <el-form-item label="合同类型" prop="contractType">-->
<!-- <el-select v-model="form.contractType" placeholder="请选择合同类型">-->
<!-- <el-option v-for="dict in contract_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col :span="12">
<el-form-item label="业务方向" prop="businessDirection">
<el-select v-model="form.businessDirection" placeholder="请选择业务方向" :disabled="isFormDisabled">
<el-option v-for="dict in business_direction" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="部门" prop="contractDeptId">
<el-select v-model="form.contractDeptId" :disabled="isFormDisabled">
<el-option v-for="item in deptInfoList" :key="item.deptId" :label="item.deptName" :value="item.deptId" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="合同签订日期" prop="contractDate">
<el-date-picker clearable v-model="form.contractDate" type="date" value-format="YYYY-MM-DD HH:mm:ss" :disabled="isFormDisabled" placeholder="请选择合同时间">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="合同总价" prop="totalPrice">
<el-input v-model="form.totalPrice" placeholder="根据合同物料自动计算" disabled>
<template #append></template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="甲方公司" prop="oneCustomerId">
<el-select v-model="form.oneCustomerId" placeholder="请选择甲方公司" :disabled="isFormDisabled" filterable>
<el-option v-for="item in customerInfoList" :key="item.customerId" :label="item.customerName" :value="item.customerId" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="乙方公司" prop="twoCustomerId">
<el-select v-model="form.twoCustomerId" placeholder="请选择乙方公司" :disabled="isFormDisabled" filterable>
<el-option v-for="item in customerInfoList" :key="item.customerId" :label="item.customerName" :value="item.customerId" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="甲方授权代表" prop="oneRepresent">
<el-input v-model="form.oneRepresent" placeholder="请输入甲方授权代表" :disabled="isFormDisabled"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="乙方授权代表" prop="twoRepresent">
<el-input v-model="form.twoRepresent" placeholder="请输入乙方授权代表" :disabled="isFormDisabled"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="甲方签字日期" prop="oneDate">
<el-date-picker clearable v-model="form.oneDate" type="date" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择甲方签字日期" :disabled="isFormDisabled">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="乙方签字日期" prop="twoDate">
<el-date-picker clearable v-model="form.twoDate" type="date" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择乙方签字日期" :disabled="isFormDisabled">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="合同状态" prop="contractStatus">
<el-radio-group v-model="form.contractStatus" disabled>
<el-radio v-for="dict in contract_status" :key="dict.value" :value="dict.value">{{ dict.label }} </el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<!-- <el-col :span="12">-->
<!-- <el-form-item label="流程状态" prop="flowStatus">-->
<!-- <el-input v-model="form.flowStatus" placeholder="请输入流程状态" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col :span="12">
<el-form-item label="合同模板标识" prop="contractTemplateFlag">
<el-radio-group v-model="form.contractTemplateFlag" :disabled="isFormDisabled">
<el-radio v-for="dict in contract_template_flag" :key="dict.value" :value="dict.value">{{ dict.label }} </el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="合同负责人" prop="contractManagerId">
<el-select v-model="form.contractManagerId" placeholder="请选择该合同客户经理或签订人" :disabled="isFormDisabled" filterable>
<el-option v-for="item in userInfoList" :key="item.userId" :label="item.nickName" :value="item.userId" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="合同模板" prop="templateId" v-if="form.contractTemplateFlag !== '1'">
<el-select v-model="form.templateId" placeholder="请选择合同模板" :disabled="isFormDisabled" filterable>
<el-option
v-for="item in printTemplateList"
:key="item.templateId"
:label="item.templateName + '-' + item.version"
:value="item.templateId"
/>
</el-select>
</el-form-item>
</el-col>
<!-- <el-col :span="12">
<el-form-item label="合同大写金额" prop="capitalizedAmount">
<el-input v-model="form.capitalizedAmount" placeholder="请输入合同大写金额" />
</el-form-item>
</el-col> -->
<el-col :span="12">
<el-form-item label="附件" prop="ossId">
<!-- <el-button type="primary" plain icon="Upload" @click="handleFile"></el-button>-->
<FileUpload
v-model="ossIdString"
:limit="5"
:fileSize="20"
:fileType="['doc', 'docx', 'pdf', 'xls', 'xlsx']"
:disabled="isFormDisabled"
:isShowTip="true"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" :disabled="isFormDisabled"/>
</el-form-item>
</el-col>
<!-- <el-col :span="12">-->
<!-- <el-form-item label="付款方式" prop="paymentMethod">-->
<!-- <el-input v-model="form.paymentMethod" placeholder="3-3-3-1" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
</el-row>
</el-form>
</el-card>
<!-- 合同物料管理区域 -->
<el-card shadow="never" style="margin-top: 0">
<template #header>
<div style="text-align: left; font-weight: bold; font-size: 18px">合同物料管理</div>
</template>
<!-- 合同物料表格 -->
<div style="margin-bottom: 16px">
<el-button type="primary" icon="Plus" v-if="routeParams.type !== 'view' && routeParams.type != 'approval'" @click="handleAddMaterial"
>新增物料
</el-button>
</div>
<el-table :data="contractMaterialList" v-loading="buttonLoading" border>
<el-table-column label="产品名称" align="center" prop="productName" min-width="120" />
<el-table-column label="规格描述" align="center" prop="specificationDescription" min-width="120" />
<el-table-column label="物料编号" align="center" prop="materialCode" width="120" />
<el-table-column label="物料名称" align="center" prop="materialName" width="120" />
<el-table-column label="销售物料名称" align="center" prop="saleMaterialName" width="120" />
<el-table-column label="数量" align="center" prop="amount" width="80">
<template #default="scope">
{{ scope.row.amount ? Number(scope.row.amount).toFixed(2) : '0.00' }}
</template>
</el-table-column>
<el-table-column label="单位" align="center" prop="unitName" width="60" />
<el-table-column label="未税单价" align="center" prop="beforePrice" width="100">
<template #default="scope">
{{ scope.row.beforePrice ? Number(scope.row.beforePrice).toFixed(2) : '0.00' }}
</template>
</el-table-column>
<el-table-column label="税率(%)" align="center" prop="taxRate" width="80">
<template #default="scope">
{{ scope.row.taxRate ? Number(scope.row.taxRate).toFixed(2) : '0.00' }}
</template>
</el-table-column>
<el-table-column label="含税单价" align="center" prop="includingPrice" width="100">
<template #default="scope">
{{ scope.row.includingPrice ? Number(scope.row.includingPrice).toFixed(2) : '0.00' }}
</template>
</el-table-column>
<el-table-column label="小计" align="center" prop="subtotal" width="80">
<template #default="scope">
{{ scope.row.subtotal ? Number(scope.row.subtotal).toFixed(2) : '0.00' }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" min-width="100" />
<el-table-column label="操作" align="center" fixed="right" width="150" v-if="routeParams.type !== 'view' && routeParams.type != 'approval'">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleEditMaterial(scope.row)"></el-button>
<el-button link type="danger" icon="Delete" @click="handleDeleteMaterial(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<!-- 合同物料编辑对话框 -->
<el-dialog :title="materialDialog.title" v-model="materialDialog.visible" width="800px" append-to-body>
<el-form ref="materialFormRef" :model="materialForm" :rules="materialRules" label-width="120px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="标准物料标识" prop="materialFlag">
<el-radio-group v-model="materialForm.materialFlag">
<el-radio v-for="dict in material_flag" :key="dict.value" :value="dict.value">{{ dict.label }}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料名称" prop="materialName" v-if="materialForm.materialFlag === '1'">
<el-input v-model="materialForm.materialName" placeholder="请点击右侧图标检索物料">
<template #suffix>
<el-icon style="cursor: pointer" @click="openSaleMaterialSelect">
<Search />
</el-icon>
</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料编号" prop="materialCode" v-if="materialForm.materialFlag === '1'">
<el-input v-model="materialForm.materialCode" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="客户名称" prop="customerName" v-if="materialForm.materialFlag === '1'">
<el-input v-model="materialForm.customerName" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="产品名称" prop="productName">
<el-input v-model="materialForm.productName" placeholder="请输入产品名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="规格描述" prop="specificationDescription">
<el-input v-model="materialForm.specificationDescription" placeholder="请输入规格描述" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="数量" prop="amount">
<el-input-number
v-model="materialForm.amount"
placeholder="请输入数量"
style="width: 100%"
@change="calculateSubtotal"
:precision="2"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料单位" prop="unitId">
<el-select v-model="materialForm.unitId" placeholder="请选择物料单位">
<el-option v-for="item in unitInfoList" :key="item.unitId" :label="item.unitName" :value="item.unitId" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="税率(%)" prop="taxRate">
<el-select
v-model="materialForm.taxRate"
placeholder="请选择或输入税率"
style="width: 100%"
@change="calculateBeforePrice"
filterable
allow-create
default-first-option
>
<el-option label="6" :value="6"></el-option>
<el-option label="13" :value="13"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="未税单价" prop="beforePrice">
<el-input-number
v-model="materialForm.beforePrice"
placeholder="自动计算"
style="width: 100%"
:precision="2"
:controls="false"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="含税单价" prop="includingPrice">
<el-input-number
v-model="materialForm.includingPrice"
placeholder="请输入含税单价"
style="width: 100%"
:precision="2"
@change="calculateBeforePrice"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="小计" prop="subtotal">
<el-input-number
v-model="materialForm.subtotal"
placeholder="自动计算"
style="width: 100%"
readonly
:precision="2"
:controls="false"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="materialForm.remark" type="textarea" placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitMaterialForm"> </el-button>
<el-button @click="cancelMaterial"> </el-button>
</div>
</template>
</el-dialog>
<!-- 销售物料选择 -->
<SaleMaterialSelect ref="saleMaterialSelectRef" :multiple="false" @confirm-call-back="saleMaterialSelectCallBack"></SaleMaterialSelect>
<!-- 添加或修改OSS对象存储对话框 -->
<el-dialog v-model="dialog.visible" :title="dialog.title" width="500px" append-to-body>
<el-form ref="ossFormRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="文件名">
<fileUpload v-if="type === 0" v-model="ossFileModel" />
<imageUpload v-if="type === 1" v-model="ossFileModel" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitOss"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
<!-- 提交审批组件 -->
<submitVerify ref="submitVerifyRef" :task-variables="taskVariables" @submit-callback="submitCallback" />
<!-- 审批记录 -->
<approvalRecord ref="approvalRecordRef" />
</div>
</template>
<script setup name="ContractInfoEdit" lang="ts">
import { addContractInfo, contractSubmitAndFlowStart, getContractInfo, updateContractInfo } from '@/api/oa/erp/contractInfo';
import { ContractInfoForm } from '@/api/oa/erp/contractInfo/types';
import { ContractMaterialVO, ContractMaterialForm } from '@/api/oa/erp/contractMaterial/types';
import { getBaseUnitInfoList } from '@/api/oa/base/unitInfo';
import { getRuleGenerateCode } from '@/api/system/codeRule';
import { startWorkFlow } from '@/api/workflow/task';
import { StartProcessBo } from '@/api/workflow/workflowCommon/types';
import SaleMaterialSelect from '@/components/SaleMaterialSelect/index.vue';
import SubmitVerify from '@/components/Process/submitVerify.vue';
import ApprovalRecord from '@/components/Process/approvalRecord.vue';
import ApprovalButton from '@/components/Process/approvalButton.vue';
import { ref } from 'vue';
import { allListDept, listDept } from '@/api/system/dept';
import { getCrmCustomerInfoList } from '@/api/oa/crm/customerInfo';
import { getBasePrintTemplateList } from '@/api/oa/base/printTemplate';
import { getUserList } from '@/api/system/user';
import { CodeRuleEnum, FlowCodeEnum } from '@/enums/OAEnum';
import { getInfo } from '@/api/login';
import FileUpload from '@/components/FileUpload/index.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const route = useRoute();
const router = useRouter();
//
const routeParams = ref<Record<string, any>>({});
const { contract_category, business_direction, contract_flag, contract_type, contract_status, material_flag, contract_template_flag } = toRefs<any>(
proxy?.useDict('contract_category', 'business_direction', 'contract_flag', 'contract_type', 'contract_status', 'material_flag', 'contract_template_flag')
);
const buttonLoading = ref(false);
const contractInfoFormRef = ref<ElFormInstance>();
//
const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>();
const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>();
//
const submitFormData = ref<StartProcessBo>({
businessId: '',
flowCode: 'OAC',
variables: {},
bizExt: {}
});
//
const taskVariables = ref<Record<string, any>>({});
const flowInstanceBizExtBo = ref<Record<string, any>>({});
const type = ref(0);
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
// OSS v-model form
const ossFileModel = ref<string | string[] | undefined>(undefined);
//
const isCodeGenerated = ref(false);
//
const materialFormRef = ref<ElFormInstance>();
//
const contractMaterialList = computed(() => {
return (form.value as any).contractMaterialList || [];
});
/** 查询打印模板下拉框结构 */
const printTemplateList = ref([]);
const getPrintTemplateListSelect = async () => {
const res = await getBasePrintTemplateList(null);
printTemplateList.value = res.data;
};
/** 查询单位信息下拉框结构 */
const unitInfoList = ref([]);
const getUnitInfoListSelect = async () => {
const res = await getBaseUnitInfoList(null);
unitInfoList.value = res.data;
};
/** 查询部门信息下拉框结构 */
const deptInfoList = ref([]);
const getDeptInfoListSelect = async () => {
const params = { deptCategory: '03' } as any;
const res = await allListDept(params);
deptInfoList.value = res.data;
};
/** 查询客户信息下拉框结构 */
const customerInfoList = ref([]);
const getCustomerInfoListSelect = async () => {
const res = await getCrmCustomerInfoList(null);
customerInfoList.value = res.data;
};
/** 查询用户信息下拉框结构 */
const userInfoList = ref([]);
const getUserInfoListSelect = async () => {
const res = await getUserList({ pageNum: 1, pageSize: 1000 });
userInfoList.value = res.data;
};
//
const materialDialog = reactive({
visible: false,
title: ''
});
//
const initMaterialFormData: ContractMaterialForm = {
contractMaterialId: undefined,
materialFlag: '2',
contractId: undefined,
productName: undefined,
specificationDescription: undefined,
materialId: undefined,
relationMaterialId: undefined,
saleMaterialName: undefined,
amount: undefined,
unitId: undefined,
beforePrice: undefined,
taxRate: undefined,
includingPrice: undefined,
subtotal: undefined,
remark: undefined,
activeFlag: '1'
};
const materialForm = ref<ContractMaterialForm>({ ...initMaterialFormData });
//
const materialRules = {
productName: [{ required: true, message: '产品名称不能为空', trigger: 'blur' }],
amount: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
taxRate: [{ required: true, message: '税率不能为空', trigger: 'blur' }]
};
type ContractInfoFormEx = ContractInfoForm & { file?: any };
const initFormData: ContractInfoFormEx = {
contractId: undefined,
contractFlag: '1',
contractCode: undefined,
contractName: undefined,
contractCategory: '1',
contractType: undefined,
businessDirection: undefined,
contractDeptId: undefined,
contractDate: undefined,
totalPrice: 0,
oneCustomerId: undefined,
oneRepresent: undefined,
oneDate: undefined,
twoCustomerId: undefined,
twoRepresent: undefined,
twoDate: undefined,
contractStatus: '1',
flowStatus: undefined,
templateId: undefined,
ossId: undefined,
paymentMethod: undefined,
signatureAppendix: undefined,
taxRate: undefined,
remark: undefined,
contractManagerId: undefined,
capitalizedAmount: undefined,
contractTemplateFlag: '2',
flowCode: undefined,
bizExt: undefined,
variables: undefined,
activeFlag: '1',
contractMaterialList: [],
file: undefined
} as any;
const data = reactive<{ form: ContractInfoFormEx; rules: any }>({
form: { ...initFormData },
rules: {
contractFlag: [{ required: true, message: '有无合同不能为空', trigger: 'blur' }],
contractCode: [{ required: true, message: '合同编号不能为空', trigger: 'blur' }],
contractName: [{ required: true, message: '合同名称不能为空', trigger: 'blur' }],
businessDirection: [{ required: true, message: '业务方向不能为空', trigger: 'blur' }],
contractManagerId: [{ required: true, message: '合同负责人不能为空', trigger: 'blur' }],
contractTemplateFlag: [{ required: true, message: '合同模板标识不能为空', trigger: 'blur' }],
}
});
//
const isFormDisabled = computed(() => {
return routeParams.value.type === 'view' || routeParams.value.type === 'approval';
});
// IDFileUpload
const ossIdString = computed({
get() {
const v = form.value.ossId as any;
return v === undefined || v === null ? '' : String(v);
},
set(val: string) {
form.value.ossId = val || (undefined as any);
}
});
const { form, rules } = toRefs(data);
// contractFlag
watch(
() => form.value.contractFlag,
(newVal) => {
if (newVal === '2') {
// ""
form.value.contractCode = undefined;
isCodeGenerated.value = false;
}
}
);
//
const generateContractCode = async () => {
if (isCodeGenerated.value) return; //
try {
const params = { codeRuleCode: CodeRuleEnum.CONTRACT } as any;
const res = await getRuleGenerateCode(params);
form.value.contractCode = res.msg;
isCodeGenerated.value = true; //
proxy?.$modal.msgSuccess('合同编号生成成功');
} catch (error) {
console.error('生成合同编号失败:', error);
proxy?.$modal.msgError('生成合同编号失败');
}
};
const saleMaterialSelectRef = ref<InstanceType<typeof SaleMaterialSelect>>();
//
const openSaleMaterialSelect = () => {
saleMaterialSelectRef.value.open();
};
//
const saleMaterialSelectCallBack = (data: any) => {
const materialList = data;
if (materialList.length > 0) {
materialForm.value.materialId = materialList[0].materialId;
materialForm.value.materialCode = materialList[0].materialCode;
materialForm.value.materialName = materialList[0].materialName;
materialForm.value.productName = materialList[0].saleMaterialName;
materialForm.value.saleMaterialName = materialList[0].saleMaterialName;
materialForm.value.relationMaterialId = materialList[0].relationMaterialId;
materialForm.value.customerName = materialList[0].customerName;
}
};
/** 取消按钮 */
function cancel() {
dialog.visible = false;
}
/** 文件按钮操作 */
const handleFile = () => {
type.value = 0;
dialog.visible = true;
dialog.title = '上传合同附件';
//
ossFileModel.value = form.value.ossId as any;
};
/** 提交按钮 */
const submitForm = (status: string, mode: boolean) => {
try {
buttonLoading.value = true;
contractInfoFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
// 稿
if (status != 'draft') {
//
form.value.flowCode = FlowCodeEnum.CONTRACT_CODE;
//
form.value.variables = {
contractName: form.value.contractName,
totalPrice: form.value.totalPrice,
businessDirection: form.value.businessDirection,
contractCode: form.value.contractCode
};
//
form.value.bizExt = {
businessTitle: '合同审批',
businessCode: form.value.contractCode
};
form.value.contractStatus = '2';
form.value.flowStatus = 'waiting';
const res = await contractSubmitAndFlowStart(form.value).finally(() => (buttonLoading.value = false));
form.value = res.data;
proxy?.$modal.msgSuccess('操作成功');
proxy?.$tab.closePage();
router.go(-1);
} else {
if (status === 'draft') {
form.value.contractStatus = '1';
form.value.flowStatus = 'draft';
}
if (form.value.contractId) {
await updateContractInfo(form.value).finally(() => (buttonLoading.value = false));
} else {
await addContractInfo(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('暂存成功');
proxy?.$tab.closePage();
router.go(-1);
}
}
});
} finally {
buttonLoading.value = false;
}
};
//
const handleStartWorkFlow = async (data: ContractInfoForm) => {
try {
submitFormData.value.flowCode = 'OAC';
submitFormData.value.businessId = data.contractId;
//
taskVariables.value = {
contractId: data.contractId,
contractName: data.contractName,
totalPrice: data.totalPrice,
businessDirection: data.businessDirection,
contractCode: data.contractCode
};
//
flowInstanceBizExtBo.value = {
businessTitle: '合同审批',
businessCode: data.contractCode
};
submitFormData.value.variables = taskVariables.value;
submitFormData.value.bizExt = flowInstanceBizExtBo.value;
const resp = await startWorkFlow(submitFormData.value);
if (submitVerifyRef.value) {
buttonLoading.value = false;
await submitVerifyRef.value.openDialog(resp.data.taskId);
}
} finally {
buttonLoading.value = false;
router.go(-1);
}
};
// v-model ossId
const submitOss = () => {
// ossId
form.value.ossId = ossFileModel.value as any;
dialog.visible = false;
proxy?.$modal.msgSuccess('附件已更新');
};
// contractId
const handleAddMaterial = () => {
resetMaterialForm();
materialForm.value.contractId = form.value.contractId;
materialDialog.visible = true;
materialDialog.title = '新增合同物料';
};
//
const handleEditMaterial = (row: ContractMaterialVO) => {
resetMaterialForm();
materialForm.value = { ...row };
materialDialog.visible = true;
materialDialog.title = '编辑合同物料';
};
//
const handleDeleteMaterial = async (row: ContractMaterialVO) => {
await proxy?.$modal.confirm('是否确认删除该合同物料?');
try {
// contractMaterialList
if (!(form.value as any).contractMaterialList) {
(form.value as any).contractMaterialList = [];
}
//
const index = (form.value as any).contractMaterialList.findIndex((item: any) => item.contractMaterialId === row.contractMaterialId);
if (index !== -1) {
(form.value as any).contractMaterialList.splice(index, 1);
}
//
calculateTotalPrice();
proxy?.$modal.msgSuccess('删除成功');
} catch (error) {
console.error('删除合同物料失败:', error);
}
};
//
const resetMaterialForm = () => {
materialForm.value = { ...initMaterialFormData };
materialFormRef.value?.resetFields();
};
//
const cancelMaterial = () => {
resetMaterialForm();
materialDialog.visible = false;
};
//
const calculateBeforePrice = () => {
const tax = Number(materialForm.value.taxRate);
const including = Number(materialForm.value.includingPrice);
if (!isNaN(tax) && !isNaN(including)) {
const divisor = 1 + tax / 100;
if (divisor > 0) {
materialForm.value.beforePrice = Number((including / divisor).toFixed(2));
}
}
//
calculateSubtotal();
};
// ×
const calculateSubtotal = () => {
const amount = Number(materialForm.value.amount);
const including = Number(materialForm.value.includingPrice);
if (!isNaN(amount) && !isNaN(including)) {
materialForm.value.subtotal = Number((amount * including).toFixed(2));
}
//
calculateTotalPrice();
};
//
const calculateTotalPrice = () => {
const materialList = (form.value as any).contractMaterialList || [];
const total = materialList.reduce((sum: number, material: any) => {
const subtotal = Number(material.subtotal) || 0;
return sum + subtotal;
}, 0);
form.value.totalPrice = Number(total.toFixed(2));
};
// -
const submitMaterialForm = () => {
materialFormRef.value?.validate((valid: boolean) => {
if (valid) {
// contractMaterialList
if (!(form.value as any).contractMaterialList) {
(form.value as any).contractMaterialList = [];
}
const unitInfo = unitInfoList.value.find((item: any) => item.unitId === materialForm.value.unitId);
const unitName = unitInfo ? unitInfo.unitName : '';
const materialData = {
...materialForm.value,
unitName: unitName
};
if (materialForm.value.contractMaterialId) {
//
const index = (form.value as any).contractMaterialList.findIndex(
(item: any) => item.contractMaterialId === materialForm.value.contractMaterialId
);
if (index !== -1) {
(form.value as any).contractMaterialList[index] = materialData;
}
} else {
//
const newMaterial = {
...materialData,
contractMaterialId: Date.now() // ID
};
(form.value as any).contractMaterialList.push(newMaterial);
}
//
calculateTotalPrice();
proxy?.$modal.msgSuccess('操作成功');
materialDialog.visible = false;
}
});
};
//
const loadSelectOptions = () => {
getUnitInfoListSelect();
getDeptInfoListSelect();
getCustomerInfoListSelect();
getPrintTemplateListSelect();
getUserInfoListSelect();
};
onMounted(async () => {
nextTick(async () => {
//
routeParams.value = route.query;
loadSelectOptions();
const id = routeParams.value.id as string | number;
if (id && (routeParams.value.type === 'update' || routeParams.value.type === 'view' || routeParams.value.type === 'approval')) {
proxy?.$modal.loading('正在加载数据,请稍后...');
const res = await getContractInfo(id);
Object.assign(form.value, res.data);
proxy?.$modal.closeLoading();
//
if (form.value.contractCode) {
isCodeGenerated.value = true;
} else if (form.value.contractFlag === '1') {
//
isCodeGenerated.value = false;
}
} else {
// ID
try {
const userInfoRes = await getInfo();
if (userInfoRes.data?.user?.deptId && !form.value.contractDeptId) {
form.value.contractDeptId = userInfoRes.data.user.deptId;
}
form.value.contractCategory = routeParams.value.contractCategory as string;
} catch (error) {
console.error('获取用户信息失败:', error);
}
//
if (form.value.contractCode) {
isCodeGenerated.value = true;
} else if (form.value.contractFlag === '1') {
//
isCodeGenerated.value = false;
}
}
});
});
//
const handleApprovalRecord = () => {
approvalRecordRef.value.init(form.value.contractId);
};
//
const submitCallback = async () => {
await proxy.$tab.closePage(route);
router.go(-1);
};
//
const approvalVerifyOpen = async () => {
await submitVerifyRef.value.openDialog(routeParams.value.taskId);
};
// ossId
//
watch(
() => form.value.ossId,
(val) => {
if (!dialog.visible) {
ossFileModel.value = val as any;
}
}
);
</script>

@ -0,0 +1,334 @@
<template>
<div class="p-2">
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="100px">
<el-form-item label="机票预订编号" prop="applyCode">
<el-input v-model="queryParams.applyCode" placeholder="请输入机票预订编号" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="乘机人ID" prop="passengerId">
<el-input v-model="queryParams.passengerId" placeholder="请输入乘机人ID" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="乘机人姓名" prop="passengerName">
<el-input v-model="queryParams.passengerName" placeholder="请输入乘机人姓名" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="出行日期" prop="travelDate">
<el-date-picker clearable v-model="queryParams.travelDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择出行日期" />
</el-form-item>
<el-form-item label="出发地点" prop="departureLocation">
<el-input v-model="queryParams.departureLocation" placeholder="请输入出发地点" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="到达地点" prop="arrivalLocation">
<el-input v-model="queryParams.arrivalLocation" placeholder="请输入到达地点" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="机票折扣" prop="flightDiscount">
<el-input v-model="queryParams.flightDiscount" placeholder="请输入机票折扣" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="机票金额" prop="flightAmount">
<el-input v-model="queryParams.flightAmount" placeholder="请输入机票金额" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="附件ID" prop="ossId">
<el-input v-model="queryParams.ossId" placeholder="请输入附件ID" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button>
<el-button icon="Refresh" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['oa:flightBooking:add']"></el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['oa:flightBooking:edit']"
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['oa:flightBooking:remove']"
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['oa:flightBooking:export']"></el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" :columns="columns" :search="true" @queryTable="getList"></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" border :data="flightBookingList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="机票预订ID" align="center" prop="bookingId" v-if="columns[0].visible" />
<el-table-column label="机票预订编号" align="center" prop="applyCode" v-if="columns[2].visible" />
<el-table-column label="乘机人ID" align="center" prop="passengerId" v-if="columns[3].visible" />
<el-table-column label="乘机人姓名" align="center" prop="passengerName" v-if="columns[4].visible" />
<el-table-column label="出行日期" align="center" prop="travelDate" width="180" v-if="columns[5].visible">
<template #default="scope">
<span>{{ parseTime(scope.row.travelDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="出发地点" align="center" prop="departureLocation" v-if="columns[6].visible" />
<el-table-column label="到达地点" align="center" prop="arrivalLocation" v-if="columns[7].visible" />
<el-table-column label="机票折扣" align="center" prop="flightDiscount" v-if="columns[8].visible" />
<el-table-column label="机票金额" align="center" prop="flightAmount" v-if="columns[9].visible" />
<el-table-column label="附件ID" align="center" prop="ossId" v-if="columns[10].visible" />
<el-table-column label="申请状态" align="center" prop="bookingStatus" v-if="columns[11].visible" />
<el-table-column label="流程状态" align="center" prop="flowStatus" v-if="columns[12].visible" />
<el-table-column label="备注" align="center" prop="remark" v-if="columns[13].visible" />
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['oa:flightBooking:edit']"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['oa:flightBooking:remove']"></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card>
<!-- 添加或修改机票预订对话框 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
<el-form ref="flightBookingFormRef" :model="form" :rules="rules" label-width="120px">
<el-form-item label="机票预订编号" prop="applyCode">
<el-input v-model="form.applyCode" placeholder="请输入机票预订编号" />
</el-form-item>
<el-form-item label="乘机人ID" prop="passengerId">
<el-input v-model="form.passengerId" placeholder="请输入乘机人ID" />
</el-form-item>
<el-form-item label="乘机人姓名" prop="passengerName">
<el-input v-model="form.passengerName" placeholder="请输入乘机人姓名" />
</el-form-item>
<el-form-item label="出行日期" prop="travelDate">
<el-date-picker clearable v-model="form.travelDate" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择出行日期">
</el-date-picker>
</el-form-item>
<el-form-item label="出发地点" prop="departureLocation">
<el-input v-model="form.departureLocation" placeholder="请输入出发地点" />
</el-form-item>
<el-form-item label="到达地点" prop="arrivalLocation">
<el-input v-model="form.arrivalLocation" placeholder="请输入到达地点" />
</el-form-item>
<el-form-item label="机票折扣" prop="flightDiscount">
<el-input v-model="form.flightDiscount" placeholder="请输入机票折扣" />
</el-form-item>
<el-form-item label="机票金额" prop="flightAmount">
<el-input v-model="form.flightAmount" placeholder="请输入机票金额" />
</el-form-item>
<el-form-item label="附件ID" prop="ossId">
<el-input v-model="form.ossId" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="FlightBooking" lang="ts">
import { listFlightBooking, getFlightBooking, delFlightBooking, addFlightBooking, updateFlightBooking } from '@/api/oa/crm/flightBooking';
import { FlightBookingVO, FlightBookingQuery, FlightBookingForm } from '@/api/oa/crm/flightBooking/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const flightBookingList = ref<FlightBookingVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const flightBookingFormRef = ref<ElFormInstance>();
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
//
const columns = ref<FieldOption[]>([
{ key: 0, label: `机票预订ID`, visible: true },
{ key: 1, label: `租户编号`, visible: true },
{ key: 2, label: `机票预订编号`, visible: true },
{ key: 3, label: `乘机人ID`, visible: true },
{ key: 4, label: `乘机人姓名`, visible: true },
{ key: 5, label: `出行日期`, visible: true },
{ key: 6, label: `出发地点`, visible: true },
{ key: 7, label: `到达地点`, visible: true },
{ key: 8, label: `机票折扣`, visible: true },
{ key: 9, label: `机票金额`, visible: true },
{ key: 10, label: `附件ID`, visible: true },
{ key: 11, label: `申请状态`, visible: true },
{ key: 12, label: `流程状态`, visible: true },
{ key: 13, label: `备注`, visible: true },
{ key: 14, label: `删除标志`, visible: true },
{ key: 15, label: `创建部门`, visible: true },
{ key: 16, label: `创建者`, visible: true },
{ key: 17, label: `创建时间`, visible: true },
{ key: 18, label: `更新者`, visible: true },
{ key: 19, label: `更新时间`, visible: true }
]);
const initFormData: FlightBookingForm = {
bookingId: undefined,
applyCode: undefined,
passengerId: undefined,
passengerName: undefined,
travelDate: undefined,
departureLocation: undefined,
arrivalLocation: undefined,
flightDiscount: undefined,
flightAmount: undefined,
ossId: undefined,
bookingStatus: undefined,
flowStatus: undefined,
remark: undefined
};
const data = reactive<PageData<FlightBookingForm, FlightBookingQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
applyCode: undefined,
passengerId: undefined,
passengerName: undefined,
travelDate: undefined,
departureLocation: undefined,
arrivalLocation: undefined,
flightDiscount: undefined,
flightAmount: undefined,
ossId: undefined,
bookingStatus: undefined,
flowStatus: undefined,
params: {}
},
rules: {
bookingId: [{ required: true, message: '机票预订ID不能为空', trigger: 'blur' }],
passengerId: [{ required: true, message: '乘机人ID不能为空', trigger: 'blur' }],
travelDate: [{ required: true, message: '出行日期不能为空', trigger: 'blur' }],
departureLocation: [{ required: true, message: '出发地点不能为空', trigger: 'blur' }],
arrivalLocation: [{ required: true, message: '到达地点不能为空', trigger: 'blur' }],
flightDiscount: [{ required: true, message: '机票折扣不能为空', trigger: 'blur' }],
flightAmount: [{ required: true, message: '机票金额不能为空', trigger: 'blur' }]
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询机票预订列表 */
const getList = async () => {
loading.value = true;
const res = await listFlightBooking(queryParams.value);
flightBookingList.value = res.rows;
total.value = res.total;
loading.value = false;
};
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
};
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
flightBookingFormRef.value?.resetFields();
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: FlightBookingVO[]) => {
ids.value = selection.map((item) => item.bookingId);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
/** 新增按钮操作 */
const handleAdd = () => {
reset();
dialog.visible = true;
dialog.title = '添加机票预订';
};
/** 修改按钮操作 */
const handleUpdate = async (row?: FlightBookingVO) => {
reset();
const _bookingId = row?.bookingId || ids.value[0];
const res = await getFlightBooking(_bookingId);
Object.assign(form.value, res.data);
dialog.visible = true;
dialog.title = '修改机票预订';
};
/** 提交按钮 */
const submitForm = () => {
flightBookingFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
if (form.value.bookingId) {
await updateFlightBooking(form.value).finally(() => (buttonLoading.value = false));
} else {
await addFlightBooking(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: FlightBookingVO) => {
const _bookingIds = row?.bookingId || ids.value;
await proxy?.$modal.confirm('是否确认删除机票预订编号为"' + _bookingIds + '"的数据项?').finally(() => (loading.value = false));
await delFlightBooking(_bookingIds);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
'oa/flightBooking/export',
{
...queryParams.value
},
`flightBooking_${new Date().getTime()}.xlsx`
);
};
onMounted(() => {
getList();
});
</script>

@ -207,11 +207,12 @@
<el-table-column label="激活标识" align="center" prop="activeFlag" width="100" v-if="columns[20].visible" />
<el-table-column label="创建时间" align="center" prop="createTime" width="100" v-if="columns[21].visible" />
<el-table-column label="更新时间" align="center" prop="updateTime" width="100" v-if="columns[22].visible" />
<el-table-column label="操作" align="center" fixed="right" width="150" v-if="routeParams.type !== 'view' && routeParams.type != 'approval'">
<!-- <template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleEditMaterial(scope.row)"></el-button>
<el-button link type="danger" icon="Delete" @click="handleDeleteMaterial(scope.row)"></el-button>
</template> -->
<el-table-column label="操作" align="center" fixed="right" width="150">
<template #default="scope">
<el-tooltip content="审批记录" placement="top">
<el-button link type="info" icon="View" @click="handleApprovalRecord(scope.row)"></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination
@ -889,25 +890,30 @@ const openProjectSelect = () => {
//
const projectInfoSelectCallBack = async (data: any) => {
if (data.length > 0) {
proxy?.$modal.loading('正在导出数据,请稍后...');
const res = await getErpProjectReportList({ projectId: data[0].projectId });
// console.log(res.data);
if (res.data.length > 0) {
if (res.data[0].status === '0') {
projectFormRef.value?.resetFields();
projectReportDetailFormRef.value?.resetFields();
proxy?.$modal.closeLoading();
proxy?.$modal.notifyError('该项目周报记录已存在,请在项目周报信息界面维护!');
} else {
projectFormRef.value?.resetFields();
projectReportDetailFormRef.value?.resetFields();
proxy?.$modal.closeLoading();
proxy?.$modal.notifyError('已存在暂存记录,请在项目周报信息界面维护!');
}
} else {
proxy?.$modal.closeLoading();
proxy?.$modal.msgSuccess('选择成功');
Object.assign(form.value, data[0]);
}
} else {
projectFormRef.value?.resetFields();
projectReportDetailFormRef.value?.resetFields();
proxy?.$modal.closeLoading();
proxy?.$modal.msgWarning('请选择项目信息');
}
};
@ -1113,119 +1119,116 @@ const submitProjectReportForm = () => {
};
//
const datePart = ref(''); // YYYY-MM-DD
// -
const getWorkWeek = (dateString) => {
if (!dateString) return '';
const date = new Date(dateString);
if (isNaN(date.getTime())) {
return '';
}
const year = date.getFullYear();
const firstDayOfYear = new Date(year, 0, 1);
// 使
const timeDiff = date.getTime() - firstDayOfYear.getTime();
const days = Math.floor(timeDiff / (24 * 60 * 60 * 1000)) + 1;
//
const firstDayWeek = firstDayOfYear.getDay();
const isoFirstDayWeek = firstDayWeek === 0 ? 7 : firstDayWeek;
const weekNumber = Math.ceil((days + isoFirstDayWeek - 1) / 7);
// 0-1-...6-
const weekday = date.getDay();
const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
return `${weekdays[weekday]}`;
};
//
const initDefaultDate = () => {
if (routeParams.value.type === 'add') {
// fillTime
//
const formatDateTime = (dateStr?: string, includeTime: boolean = true): string => {
if (!dateStr) {
const now = new Date();
// YYYY-MM-DD
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
const dateStr = `${year}-${month}-${day}`;
// HH:mm:ss
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
const timeStr = `${hours}:${minutes}:${seconds}`;
//
datePart.value = dateStr;
//
// fillTime使
if (!projectReportForm.value.fillTime) {
projectReportForm.value.fillTime = `${dateStr} ${timeStr}`;
} else {
// fillTime DateTime
if (projectReportForm.value.fillTime && !projectReportForm.value.fillTime.includes(' ')) {
projectReportForm.value.fillTime = `${projectReportForm.value.fillTime} ${timeStr}`;
}
if (includeTime) {
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
//
projectReportForm.value.currentWorkWeek = getWorkWeek(dateStr);
return `${year}-${month}-${day}`;
}
};
//
const handleDateChange = (selectedDate) => {
if (selectedDate) {
//
//
if (dateStr.includes(' ')) {
return dateStr;
}
//
if (includeTime) {
const now = new Date();
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
const timeStr = `${hours}:${minutes}:${seconds}`;
return `${dateStr} ${hours}:${minutes}:${seconds}`;
}
//
projectReportForm.value.fillTime = `${selectedDate} ${timeStr}`;
return dateStr;
};
//
projectReportForm.value.currentWorkWeek = getWorkWeek(selectedDate);
} else {
//
projectReportForm.value.fillTime = '';
projectReportForm.value.currentWorkWeek = '';
//
const parseDatePart = (dateTimeStr?: string): string => {
if (!dateTimeStr) return '';
const [date] = dateTimeStr.split(' ');
return date || '';
};
// -
const getWorkWeek = (dateString: string): string => {
if (!dateString) return '';
try {
//
const [datePart] = dateString.split(' ');
const date = new Date(datePart);
if (isNaN(date.getTime())) {
console.warn('无效的日期格式:', dateString);
return '';
}
const year = date.getFullYear();
const firstDayOfYear = new Date(year, 0, 1);
// 使
const timeDiff = date.getTime() - firstDayOfYear.getTime();
const days = Math.floor(timeDiff / (24 * 60 * 60 * 1000)) + 1;
//
const firstDayWeek = firstDayOfYear.getDay();
const isoFirstDayWeek = firstDayWeek === 0 ? 7 : firstDayWeek;
const weekNumber = Math.ceil((days + isoFirstDayWeek - 1) / 7);
// 0-1-...6-
const weekday = date.getDay();
const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
return `${weekdays[weekday]}`;
} catch (error) {
console.error('计算工作周失败:', error);
return '';
}
};
// fillTime
watch(
() => projectReportForm.value.fillTime,
(newValue) => {
if (newValue && (routeParams.value.type === 'update' || routeParams.value.type === 'view' || routeParams.value.type === 'approval')) {
//
const [date] = newValue.split(' ');
if (date) {
datePart.value = date;
}
//
const initDefaultDate = () => {
if (routeParams.value.type === 'add') {
// fillTime
if (!projectReportForm.value.fillTime) {
projectReportForm.value.fillTime = formatDateTime();
} else {
// fillTime
projectReportForm.value.fillTime = formatDateTime(projectReportForm.value.fillTime, true);
}
},
{ immediate: true }
);
//
const modifyDatePart = ref('');
//
const handleModifyDateChange = (selectedDate) => {
// fillTime datePart
datePart.value = parseDatePart(projectReportForm.value.fillTime);
//
if (datePart.value) {
projectReportForm.value.currentWorkWeek = getWorkWeek(datePart.value);
}
}
};
// -
const handleDateChange = (selectedDate: string) => {
if (selectedDate) {
// 使
let timeStr = '';
if (detailForm.value.fillTime && detailForm.value.fillTime.includes(' ')) {
const [, time] = detailForm.value.fillTime.split(' ');
if (time) {
timeStr = time;
// fillTime 使
let timeStr = '00:00:00'; //
if (projectReportForm.value.fillTime && projectReportForm.value.fillTime.includes(' ')) {
const [, existingTime] = projectReportForm.value.fillTime.split(' ');
if (existingTime) {
timeStr = existingTime;
} else {
const now = new Date();
const hours = String(now.getHours()).padStart(2, '0');
@ -1240,8 +1243,50 @@ const handleModifyDateChange = (selectedDate) => {
const seconds = String(now.getSeconds()).padStart(2, '0');
timeStr = `${hours}:${minutes}:${seconds}`;
}
//
projectReportForm.value.fillTime = `${selectedDate} ${timeStr}`;
//
projectReportForm.value.currentWorkWeek = getWorkWeek(selectedDate);
} else {
//
projectReportForm.value.fillTime = '';
projectReportForm.value.currentWorkWeek = '';
}
};
//
const modifyDatePart = ref('');
//
const handleModifyDateChange = (selectedDate: string) => {
if (selectedDate) {
// fillTime
let timeStr = '00:00:00'; //
if (detailForm.value.fillTime && detailForm.value.fillTime.includes(' ')) {
const [, existingTime] = detailForm.value.fillTime.split(' ');
if (existingTime) {
timeStr = existingTime;
} else {
const now = new Date();
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
timeStr = `${hours}:${minutes}:${seconds}`;
}
} else {
const now = new Date();
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
timeStr = `${hours}:${minutes}:${seconds}`;
}
//
detailForm.value.fillTime = `${selectedDate} ${timeStr}`;
//
detailForm.value.currentWorkWeek = getWorkWeek(selectedDate);
} else {
@ -1250,9 +1295,14 @@ const handleModifyDateChange = (selectedDate) => {
detailForm.value.currentWorkWeek = '';
}
};
//
const handleApprovalRecord = () => {
approvalRecordRef.value.init(projectReportForm.value.reportDetailId);
const handleApprovalRecord = (row?: ProjectReportDetailVO) => {
if (row) {
approvalRecordRef.value.init(row?.reportDetailId);
} else {
approvalRecordRef.value.init(projectReportForm.value.reportDetailId);
}
};
//
@ -1290,6 +1340,11 @@ const getProjectDetail = async () => {
reportId: form.value.reportId
});
projectReportDetailList.value = res.rows;
// fillTime
projectReportDetailList.value = res.rows.map((item) => ({
...item,
fillTime: formatDateTime(item.fillTime, true)
}));
total.value = res.total;
loading.value = false;
};
@ -1307,6 +1362,7 @@ const shouldCheckApprovalData = computed(() => {
return (routeParams.value.type === 'add' || routeParams.value.type === 'update') && routeParams.value.reportData;
});
//
// checkApprovalData
const checkApprovalData = async () => {
try {
if (!shouldCheckApprovalData.value) return;
@ -1328,14 +1384,17 @@ const checkApprovalData = async () => {
if (res.rows && res.rows.length > 0) {
hasApprovalData.value = true;
//
Object.assign(projectReportForm.value, res.rows[0]);
const approvalData = res.rows[0];
Object.assign(projectReportForm.value, approvalData);
// fillTime
projectReportForm.value.fillTime = formatDateTime(approvalData.fillTime, true);
//
if (projectReportForm.value.fillTime) {
const [date] = projectReportForm.value.fillTime.split(' ');
if (date) {
datePart.value = date;
}
}
datePart.value = parseDatePart(projectReportForm.value.fillTime);
// flowStatus 'waiting'
projectReportForm.value.flowStatus = 'waiting';
} else {
hasApprovalData.value = false;
}
@ -1482,6 +1541,9 @@ onMounted(async () => {
await checkApprovalData();
} else {
Object.assign(projectReportForm.value, reportData);
//
projectReportForm.value.fillTime = formatDateTime(projectReportForm.value.fillTime, true);
datePart.value = parseDatePart(projectReportForm.value.fillTime);
projectReportForm.value.informationNote = undefined;
projectReportForm.value.remark = undefined;
projectReportForm.value.ossId = undefined;
@ -1497,6 +1559,13 @@ onMounted(async () => {
} else {
const reportId = routeParams.value.id;
const res = await listProjectReportDetail({ pageNum: 1, pageSize: 10, reportId: reportId });
if (res.rows && res.rows.length > 0) {
const detailData = res.rows[0];
//
detailData.fillTime = formatDateTime(detailData.fillTime, true);
Object.assign(projectReportForm.value, detailData);
datePart.value = parseDatePart(projectReportForm.value.fillTime);
}
Object.assign(projectReportForm.value, res.rows[0]);
}
proxy?.$modal.closeLoading();
@ -1513,13 +1582,23 @@ onMounted(async () => {
if (reportId && routeParams.value.type === 'view') {
const reportRes = await getProjectReport(reportId);
Object.assign(form.value, reportRes.data);
//
reportDetailRes.data.fillTime = formatDateTime(reportDetailRes.data.fillTime, true);
Object.assign(projectReportForm.value, reportDetailRes.data);
//
datePart.value = parseDatePart(projectReportForm.value.fillTime);
projectReportDetailList.value = [reportDetailRes.data];
}
if (reportId && routeParams.value.type === 'approval') {
const reportRes = await getProjectReport(reportId);
Object.assign(form.value, reportRes.data);
//
reportDetailRes.data.fillTime = formatDateTime(reportDetailRes.data.fillTime, true);
Object.assign(projectReportForm.value, reportDetailRes.data);
//
datePart.value = parseDatePart(projectReportForm.value.fillTime);
}
proxy?.$modal.closeLoading();
}

Loading…
Cancel
Save