完善合同管理;
新增结算管理
This commit is contained in:
@@ -7,15 +7,15 @@ export interface Contract {
|
||||
// 合同id
|
||||
contractId?: any;
|
||||
// 项目id
|
||||
projectId: any;
|
||||
projectId?: any;
|
||||
// 承租方
|
||||
companyId: any;
|
||||
companyId?: any;
|
||||
// 出租方
|
||||
customerId: any;
|
||||
customerId?: any;
|
||||
// 业务负责人
|
||||
customerContact?: string;
|
||||
// 合同编号
|
||||
contactNumber: string;
|
||||
contactNumber?: string;
|
||||
// 签订日期
|
||||
signDate?: string;
|
||||
// 开始日期
|
||||
@@ -30,6 +30,10 @@ export interface Contract {
|
||||
isInStock?: number;
|
||||
// 是否自动结算
|
||||
autoSettle?: number;
|
||||
// 结算方式
|
||||
settleMethod?: number;
|
||||
// 跨月结算日期
|
||||
extendMonthDate?: number;
|
||||
userId?: any;
|
||||
|
||||
}
|
||||
@@ -42,5 +46,12 @@ export interface ContractParam extends PageParam {
|
||||
createTimeStart?: string;
|
||||
createTimeEnd?: string;
|
||||
betweenTime?: any;
|
||||
|
||||
}
|
||||
|
||||
export const ContractSettleMethod = [
|
||||
'跨月结算',
|
||||
'自然月结算',
|
||||
'按日结算',
|
||||
'系数结算-跨月',
|
||||
'系数结算-自然月',
|
||||
]
|
||||
|
||||
133
src/api/tower/contractSettle/equipment/index.ts
Normal file
133
src/api/tower/contractSettle/equipment/index.ts
Normal file
@@ -0,0 +1,133 @@
|
||||
import request from '@/utils/request';
|
||||
import type {ApiResult, PageResult} from '@/api';
|
||||
import type {ContractSettleEquipment, ContractSettleEquipmentParam} from './model';
|
||||
|
||||
/**
|
||||
* 分页查询合同设备
|
||||
*/
|
||||
export async function pageContract(params: ContractSettleEquipmentParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ContractSettleEquipment>>>(
|
||||
'/tower/tower-contract-settle-equipment/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询合同设备列表
|
||||
*/
|
||||
export async function listContractSettleEquipment(params?: ContractSettleEquipmentParam) {
|
||||
const res = await request.get<ApiResult<ContractSettleEquipment[]>>(
|
||||
'/tower/tower-contract-settle-equipment',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询合同设备
|
||||
*/
|
||||
export async function getContractSettleEquipment(id: number) {
|
||||
const res = await request.get<ApiResult<ContractSettleEquipment>>(
|
||||
'/tower/tower-contract-settle-equipment/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加合同设备
|
||||
*/
|
||||
export async function addContractSettleEquipment(data: ContractSettleEquipment) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/tower/tower-contract-settle-equipment',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改合同设备
|
||||
*/
|
||||
export async function updateContractSettleEquipment(data: ContractSettleEquipment) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/tower/tower-contract-settle-equipment',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改合同设备
|
||||
*/
|
||||
export async function updateBatchContractSettleEquipment(data: ContractSettleEquipment[]) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/tower/tower-contract-settle-equipment/batch',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量添加合同设备
|
||||
*/
|
||||
export async function addBatchContractSettleEquipment(data: ContractSettleEquipment[]) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/tower/tower-contract-settle-equipment/batch',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除合同设备
|
||||
*/
|
||||
export async function removeContractSettleEquipment(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/tower/tower-contract-settle-equipment/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除合同设备
|
||||
*/
|
||||
export async function removeBatchContractSettleEquipment(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/tower/tower-contract-settle-equipment/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
39
src/api/tower/contractSettle/equipment/model/index.ts
Normal file
39
src/api/tower/contractSettle/equipment/model/index.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 合同
|
||||
*/
|
||||
export interface ContractSettleEquipment {
|
||||
contractSettleId?: any;
|
||||
// 合同id
|
||||
contractId: any;
|
||||
// 设备名
|
||||
equipmentName: string;
|
||||
// 规格
|
||||
equipmentModel: string;
|
||||
// 进场编号
|
||||
factoryNo: any;
|
||||
// 自编号
|
||||
equipmentNo: any;
|
||||
// 租期
|
||||
rentMonth: any;
|
||||
// 租金
|
||||
rentAmount: any;
|
||||
// 进退场费
|
||||
inOutAmount: any;
|
||||
// 劳务费
|
||||
workerAmount: any;
|
||||
// 其他费用
|
||||
otherAmount: any;
|
||||
// 备注
|
||||
remark?: any;
|
||||
userId?: any;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 合同搜索条件
|
||||
*/
|
||||
export interface ContractSettleEquipmentParam extends PageParam {
|
||||
contractId?: string;
|
||||
}
|
||||
133
src/api/tower/contractSettle/rule/index.ts
Normal file
133
src/api/tower/contractSettle/rule/index.ts
Normal file
@@ -0,0 +1,133 @@
|
||||
import request from '@/utils/request';
|
||||
import type {ApiResult, PageResult} from '@/api';
|
||||
import type {ContractSettleRule, ContractSettleRuleParam} from './model';
|
||||
|
||||
/**
|
||||
* 分页查询合同设备
|
||||
*/
|
||||
export async function pageContract(params: ContractSettleRuleParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ContractSettleRule>>>(
|
||||
'/tower/tower-contract-settle-rule/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询合同设备列表
|
||||
*/
|
||||
export async function listContractSettleRule(params?: ContractSettleRuleParam) {
|
||||
const res = await request.get<ApiResult<ContractSettleRule[]>>(
|
||||
'/tower/tower-contract-settle-rule',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询合同设备
|
||||
*/
|
||||
export async function getContractSettleRule(id: number) {
|
||||
const res = await request.get<ApiResult<ContractSettleRule>>(
|
||||
'/tower/tower-contract-settle-rule/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加合同设备
|
||||
*/
|
||||
export async function addContractSettleRule(data: ContractSettleRule) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/tower/tower-contract-settle-rule',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改合同设备
|
||||
*/
|
||||
export async function updateContractSettleRule(data: ContractSettleRule) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/tower/tower-contract-settle-rule',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改合同设备
|
||||
*/
|
||||
export async function updateBatchContractSettleRule(data: ContractSettleRule[]) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/tower/tower-contract-settle-rule/batch',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量添加合同设备
|
||||
*/
|
||||
export async function addBatchContractSettleRule(data: ContractSettleRule[]) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/tower/tower-contract-settle-rule/batch',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除合同设备
|
||||
*/
|
||||
export async function removeContractSettleRule(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/tower/tower-contract-settle-rule/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除合同设备
|
||||
*/
|
||||
export async function removeBatchContractSettleRule(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/tower/tower-contract-settle-rule/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
18
src/api/tower/contractSettle/rule/model/index.ts
Normal file
18
src/api/tower/contractSettle/rule/model/index.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 合同
|
||||
*/
|
||||
export interface ContractSettleRule {
|
||||
contractSettleRuleId?: any;
|
||||
contractId: any;
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 合同搜索条件
|
||||
*/
|
||||
export interface ContractSettleRuleParam extends PageParam {
|
||||
contractId?: string;
|
||||
}
|
||||
119
src/api/tower/settle/index.ts
Normal file
119
src/api/tower/settle/index.ts
Normal file
@@ -0,0 +1,119 @@
|
||||
import request from '@/utils/request';
|
||||
import type {ApiResult, PageResult} from '@/api';
|
||||
import type {Settle, SettleParam} from './model';
|
||||
|
||||
/**
|
||||
* 分页查询结算
|
||||
*/
|
||||
export async function pageSettle(params: SettleParam) {
|
||||
const res = await request.get<ApiResult<PageResult<Settle>>>(
|
||||
'/tower/tower-settle/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询合同列表
|
||||
*/
|
||||
export async function listSettle(params?: SettleParam) {
|
||||
const res = await request.get<ApiResult<Settle[]>>(
|
||||
'/tower/tower-settle',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询合同
|
||||
*/
|
||||
export async function getSettle(id: number) {
|
||||
const res = await request.get<ApiResult<Settle>>(
|
||||
'/tower/tower-settle/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加合同
|
||||
*/
|
||||
export async function addSettle(data: Settle) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/tower/tower-settle',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改合同
|
||||
*/
|
||||
export async function updateSettle(data: Settle) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/tower/tower-settle',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改合同
|
||||
*/
|
||||
export async function updateBatchSettle(data: Settle[]) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/tower/tower-settle/batch',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除合同
|
||||
*/
|
||||
export async function removeSettle(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/tower/tower-settle/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除合同
|
||||
*/
|
||||
export async function removeBatchSettle(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/tower/tower-settle/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
27
src/api/tower/settle/model/index.ts
Normal file
27
src/api/tower/settle/model/index.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 合同
|
||||
*/
|
||||
export interface Settle {
|
||||
settleId?: any;
|
||||
settleNo?: any;
|
||||
status?: any;
|
||||
contractId?: any;
|
||||
startDate?: any;
|
||||
endDate?: string;
|
||||
settleMethod?: number;
|
||||
extendMonthDate?: number;
|
||||
totalAmount?: number;
|
||||
userId?: any;
|
||||
contactNumber?: any;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 合同搜索条件
|
||||
*/
|
||||
export interface SettleParam extends PageParam {
|
||||
settleNo?: string;
|
||||
contractId?: string;
|
||||
}
|
||||
129
src/api/tower/settleDetail/index.ts
Normal file
129
src/api/tower/settleDetail/index.ts
Normal file
@@ -0,0 +1,129 @@
|
||||
import request from '@/utils/request';
|
||||
import type {ApiResult, PageResult} from '@/api';
|
||||
import type {SettleDetail, SettleDetailParam} from './model';
|
||||
|
||||
/**
|
||||
* 分页查询结算
|
||||
*/
|
||||
export async function pageSettleDetail(params: SettleDetailParam) {
|
||||
const res = await request.get<ApiResult<PageResult<SettleDetail>>>(
|
||||
'/tower/tower-settle-detail/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询合同列表
|
||||
*/
|
||||
export async function listSettleDetail(params?: SettleDetailParam) {
|
||||
const res = await request.get<ApiResult<SettleDetail[]>>(
|
||||
'/tower/tower-settle-detail',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询合同
|
||||
*/
|
||||
export async function getSettleDetail(id: number) {
|
||||
const res = await request.get<ApiResult<SettleDetail>>(
|
||||
'/tower/tower-settle-detail/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加合同
|
||||
*/
|
||||
export async function addSettleDetail(data: SettleDetail) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/tower/tower-settle-detail',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改合同
|
||||
*/
|
||||
export async function updateSettleDetail(data: SettleDetail) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/tower/tower-settle-detail',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改合同
|
||||
*/
|
||||
export async function updateBatchSettleDetail(data: SettleDetail[]) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/tower/tower-settle-detail/batch',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
export async function addBatchSettleDetail(data: SettleDetail[]) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/tower/tower-settle-detail/batch',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除合同
|
||||
*/
|
||||
export async function removeSettleDetail(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/tower/tower-settle-detail/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除合同
|
||||
*/
|
||||
export async function removeBatchSettleDetail(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/tower/tower-settle-detail/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
33
src/api/tower/settleDetail/model/index.ts
Normal file
33
src/api/tower/settleDetail/model/index.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 合同
|
||||
*/
|
||||
export interface SettleDetail {
|
||||
settleDetailId?: any;
|
||||
settleId?: any;
|
||||
type?: any;
|
||||
settleCostType?: string;
|
||||
equipmentName?: string;
|
||||
equipmentModel?: string;
|
||||
factoryNo?: string;
|
||||
startDate?: any;
|
||||
endDate?: any;
|
||||
monthAmount?: any;
|
||||
taxRate?: any;
|
||||
singleAmount?: any;
|
||||
num?: any;
|
||||
unit?: string;
|
||||
remark?: string;
|
||||
userId?: any;
|
||||
days?: any;
|
||||
dailyAmount?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* 合同搜索条件
|
||||
*/
|
||||
export interface SettleDetailParam extends PageParam {
|
||||
settleId?: string;
|
||||
type?: string;
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="750"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:title="title"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="modelId"
|
||||
:datasource="datasource"
|
||||
:columns="columns"
|
||||
:customRow="customRow"
|
||||
:striped="true"
|
||||
:pagination="false"
|
||||
>
|
||||
<template #toolbar>
|
||||
<a-input-search
|
||||
allow-clear
|
||||
v-model:value="searchText"
|
||||
placeholder="请输入搜索关键词"
|
||||
style="width: 200px"
|
||||
@search="reload"
|
||||
@pressEnter="reload"
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a-button type="link">选择</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from "vue";
|
||||
import {
|
||||
ColumnItem,
|
||||
DatasourceFunction
|
||||
} from "ele-admin-pro/es/ele-pro-table/types";
|
||||
import { pageProject } from "@/api/tower/project";
|
||||
import { FILE_THUMBNAIL } from "@/config/setting";
|
||||
import { EleProTable } from "ele-admin-pro";
|
||||
import { TowerModel, TowerModelParam } from "@/api/tower/model/model";
|
||||
import { Contract, ContractParam } from "@/api/tower/contract/model";
|
||||
import { pageContract } from "@/api/tower/contract";
|
||||
import { message } from "ant-design-vue";
|
||||
|
||||
defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 标题
|
||||
title?: string;
|
||||
// 修改回显的数据
|
||||
data?: Contract | null;
|
||||
selection?: Contract[];
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: "done", data: Contract): void;
|
||||
(e: "update:visible", visible: boolean): void;
|
||||
}>();
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit("update:visible", value);
|
||||
};
|
||||
|
||||
// 搜索内容
|
||||
const searchText = ref(null);
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
key: "index",
|
||||
width: 48,
|
||||
align: "center",
|
||||
fixed: "left",
|
||||
hideInSetting: true,
|
||||
customRender: ({ index }) => index + (tableRef.value?.tableIndex ?? 0)
|
||||
},
|
||||
{
|
||||
title: "合同编号",
|
||||
dataIndex: "contractNumber"
|
||||
},
|
||||
{
|
||||
title: "项目名称",
|
||||
dataIndex: "projectName"
|
||||
},
|
||||
{
|
||||
title: "业务负责人",
|
||||
dataIndex: "customerContact"
|
||||
},
|
||||
{
|
||||
title: "签订日期",
|
||||
dataIndex: "signDate"
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
key: "action",
|
||||
align: "center"
|
||||
}
|
||||
]);
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
||||
// 搜索条件
|
||||
if (searchText.value) {
|
||||
where.keywords = searchText.value;
|
||||
}
|
||||
return pageContract({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: ContractParam) => {
|
||||
tableRef?.value?.reload({ page: 1, where });
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: Contract) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
updateVisible(false);
|
||||
if (!record.settleMethod) {
|
||||
message.warning("请先设置合同结算方式");
|
||||
return;
|
||||
}
|
||||
emit("done", record);
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
<style lang="less"></style>
|
||||
65
src/components/TowerContractSelectModel/index.vue
Normal file
65
src/components/TowerContractSelectModel/index.vue
Normal file
@@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-input-group compact>
|
||||
<a-input
|
||||
disabled
|
||||
style="width: calc(100% - 32px)"
|
||||
v-model:value="value"
|
||||
:placeholder="placeholder"
|
||||
/>
|
||||
<a-button @click="openEdit">
|
||||
<template #icon><BulbOutlined class="ele-text-warning" /></template>
|
||||
</a-button>
|
||||
</a-input-group>
|
||||
<!-- 选择弹窗 -->
|
||||
<SelectData
|
||||
v-model:visible="showEdit"
|
||||
:data="current"
|
||||
:title="placeholder"
|
||||
:customer-type="customerType"
|
||||
@done="onChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { BulbOutlined } from '@ant-design/icons-vue';
|
||||
import { ref } from 'vue';
|
||||
import SelectData from './components/select-data.vue';
|
||||
import { Contract } from "@/api/tower/contract/model";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
value?: any;
|
||||
customerType?: string;
|
||||
placeholder?: string;
|
||||
index?: number;
|
||||
}>(),
|
||||
{
|
||||
placeholder: '请选择数据'
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done', Contract): void;
|
||||
(e: 'clear'): void;
|
||||
(e: 'multiple', any): void;
|
||||
}>();
|
||||
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 当前编辑数据
|
||||
const current = ref<Contract | null>(null);
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: Contract) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
const onChange = (row) => {
|
||||
// 第几行
|
||||
row.index = Number(props.index);
|
||||
emit('done', row);
|
||||
};
|
||||
</script>
|
||||
161
src/components/TowerEquipmentModel/components/select-data.vue
Normal file
161
src/components/TowerEquipmentModel/components/select-data.vue
Normal file
@@ -0,0 +1,161 @@
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="750"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:title="title"
|
||||
:footer="null"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="companyId"
|
||||
:datasource="datasource"
|
||||
:columns="columns"
|
||||
:customRow="customRow"
|
||||
:pagination="false"
|
||||
>
|
||||
<template #toolbar>
|
||||
<a-input-search
|
||||
allow-clear
|
||||
v-model:value="searchText"
|
||||
placeholder="请输入搜索关键词"
|
||||
style="width: 200px"
|
||||
@search="reload"
|
||||
@pressEnter="reload"
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a-button type="link">选择</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import {
|
||||
ColumnItem,
|
||||
DatasourceFunction
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import { EleProTable } from 'ele-admin-pro';
|
||||
import { TowerEquipment, TowerEquipmentParam } from "@/api/tower/equipment/model";
|
||||
import { pageTowerEquipment } from "@/api/tower/equipment";
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 标题
|
||||
title?: string;
|
||||
// 修改回显的数据
|
||||
data?: TowerEquipment | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done', data: TowerEquipment): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 搜索内容
|
||||
const searchText = ref(null);
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: 'ID',
|
||||
dataIndex: 'id'
|
||||
},
|
||||
{
|
||||
title: '设备名称',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
showSorterTooltip: false,
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '设备型号',
|
||||
key: 'model',
|
||||
showSorterTooltip: false,
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '出场编号',
|
||||
dataIndex: 'factoryNo',
|
||||
key: 'factoryNo',
|
||||
showSorterTooltip: false,
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '设备编号',
|
||||
dataIndex: 'equipmentNo',
|
||||
key: 'equipmentNo',
|
||||
showSorterTooltip: false,
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '制造单位',
|
||||
dataIndex: 'manufactor',
|
||||
key: 'manufactor',
|
||||
showSorterTooltip: false,
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '产权单位',
|
||||
dataIndex: 'company',
|
||||
key: 'company',
|
||||
showSorterTooltip: false,
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
align: 'center'
|
||||
}
|
||||
]);
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
||||
where = {};
|
||||
// 搜索条件
|
||||
if (searchText.value) {
|
||||
where.keywords = searchText.value;
|
||||
}
|
||||
where.isStaff = true;
|
||||
return pageTowerEquipment({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: TowerEquipmentParam) => {
|
||||
tableRef?.value?.reload({ page: 1, where });
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: TowerEquipment) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
updateVisible(false);
|
||||
emit('done', record);
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
<style lang="less"></style>
|
||||
61
src/components/TowerEquipmentModel/index.vue
Normal file
61
src/components/TowerEquipmentModel/index.vue
Normal file
@@ -0,0 +1,61 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-input-group compact>
|
||||
<a-input
|
||||
disabled
|
||||
style="width: calc(100% - 32px)"
|
||||
v-model:value="value"
|
||||
:placeholder="placeholder"
|
||||
/>
|
||||
<a-button @click="openEdit">
|
||||
<template #icon><BulbOutlined class="ele-text-warning" /></template>
|
||||
</a-button>
|
||||
</a-input-group>
|
||||
<!-- 选择弹窗 -->
|
||||
<SelectData
|
||||
v-model:visible="showEdit"
|
||||
:data="current"
|
||||
:title="placeholder"
|
||||
:customer-type="customerType"
|
||||
@done="onChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { BulbOutlined } from '@ant-design/icons-vue';
|
||||
import { ref } from 'vue';
|
||||
import SelectData from './components/select-data.vue';
|
||||
import { Customer } from '@/api/oa/customer/model';
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
value?: any;
|
||||
customerType?: string;
|
||||
placeholder?: string;
|
||||
}>(),
|
||||
{
|
||||
placeholder: '请选择数据'
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done', Customer): void;
|
||||
(e: 'clear'): void;
|
||||
}>();
|
||||
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 当前编辑数据
|
||||
const current = ref<Customer | null>(null);
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: Customer) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
const onChange = (row) => {
|
||||
emit('done', row);
|
||||
};
|
||||
</script>
|
||||
@@ -102,3 +102,16 @@
|
||||
margin-top: .5rem;
|
||||
margin-bottom: .5rem;
|
||||
}
|
||||
|
||||
.ml-05{
|
||||
margin-left: .5rem;
|
||||
}
|
||||
|
||||
.mr-05{
|
||||
margin-right: .5rem;
|
||||
}
|
||||
|
||||
.mx-05{
|
||||
margin-left: .5rem;
|
||||
margin-right: .5rem;
|
||||
}
|
||||
|
||||
@@ -108,10 +108,10 @@
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="产权单位" name="companyName">
|
||||
<TowerCompany
|
||||
:placeholder="`请选择租赁单位`"
|
||||
<DictSelect
|
||||
:placeholder="'请选择产权单位'"
|
||||
v-model:value="form.companyName"
|
||||
:customer-type="`产权单位`"
|
||||
:dict-code="'PropertyCompany'"
|
||||
@done="chooseCompanyName"
|
||||
/>
|
||||
</a-form-item>
|
||||
|
||||
@@ -265,7 +265,6 @@ import { ref, reactive, watch, computed } from "vue";
|
||||
import { Form, message } from "ant-design-vue";
|
||||
import { assignObject } from "ele-admin-pro";
|
||||
import { updateContract, addContract } from "@/api/tower/contract";
|
||||
import type { Customer } from "@/api/oa/customer/model";
|
||||
import { useUserStore } from "@/store/modules/user";
|
||||
import { Contract } from "@/api/tower/contract/model";
|
||||
import dayjs from "dayjs";
|
||||
@@ -279,8 +278,8 @@ import {
|
||||
import { ContractEquipment } from "@/api/tower/contractEquipment/model";
|
||||
import { TowerModel } from "@/api/tower/model/model";
|
||||
import { listTowerModel } from "@/api/tower/model";
|
||||
import { addBatchContractFile } from "@/api/tower/contractFile";
|
||||
import { addBatchContractEquipment } from "@/api/tower/contractEquipment";
|
||||
import { addBatchContractFile, listContractFile } from "@/api/tower/contractFile";
|
||||
import { addBatchContractEquipment, listContractEquipment } from "@/api/tower/contractEquipment";
|
||||
|
||||
const userStore = useUserStore();
|
||||
// 当前用户信息
|
||||
@@ -295,7 +294,7 @@ const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: Customer | null;
|
||||
data?: Contract | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -400,7 +399,7 @@ const delFile = index => {
|
||||
};
|
||||
|
||||
const getContractFileList = async () => {
|
||||
|
||||
contractFileList.value = await listContractFile({contactId: props.data?.contractId})
|
||||
};
|
||||
|
||||
const equipmentList = ref<TowerModel[]>([]);
|
||||
@@ -410,7 +409,7 @@ const getEquipmentList = async () => {
|
||||
|
||||
const contractEquipmentList = ref<ContractEquipment[]>([]);
|
||||
const getContractEquipmentList = async () => {
|
||||
|
||||
contractEquipmentList.value = await listContractEquipment({contactId: props.data?.contractId})
|
||||
};
|
||||
|
||||
const chooseEquipmentName = (res, index) => {
|
||||
@@ -454,7 +453,6 @@ const save = () => {
|
||||
const data = {
|
||||
...form
|
||||
};
|
||||
console.log(contractEquipmentList.value)
|
||||
for (let i = 0; i < contractEquipmentList.value.length; i++) {
|
||||
if (!contractEquipmentList.value[i].equipmentName) {
|
||||
console.log(contractEquipmentList.value[i].equipmentName)
|
||||
@@ -546,6 +544,7 @@ watch(
|
||||
assignObject(form, props.data);
|
||||
isUpdate.value = true;
|
||||
getContractFileList();
|
||||
getContractEquipmentList();
|
||||
projectName.value = props.data.projectName;
|
||||
customerName.value = props.data.customerName;
|
||||
companyName.value = props.data.companyName;
|
||||
|
||||
448
src/views/tower/contract/components/contract-settle.vue
Normal file
448
src/views/tower/contract/components/contract-settle.vue
Normal file
@@ -0,0 +1,448 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="'90%'"
|
||||
:visible="visible"
|
||||
:confirm-loading="loading"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
:title="'合同结算设置'"
|
||||
:body-style="{ paddingBottom: '8px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
:label-col="{ md: { span: 6 }, sm: { span: 20 }, xs: { span: 24 } }"
|
||||
:wrapper-col="{ md: { span: 24 }, sm: { span: 20 }, xs: { span: 24 } }"
|
||||
>
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="12">
|
||||
<a-form-item label="结算方式">
|
||||
<a-select placeholder="必选项" style="width: 250px" size="small"
|
||||
v-model:value="contract.settleMethod">
|
||||
<a-select-option v-for="(item, index) in ContractSettleMethod" :key="index" :value="index">
|
||||
{{ item }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12" v-if="[0, 3].indexOf(contract.settleMethod) > -1">
|
||||
<span>每月</span>
|
||||
<a-select placeholder="必选项" style="width: 250px" size="small"
|
||||
v-model:value="contract.extendMonthDate">
|
||||
<a-select-option v-for="item in dateList" :key="item" :value="item">
|
||||
{{ item }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<span>号</span>
|
||||
<span class="ml-05">至下月</span>
|
||||
<span class="ml-05" v-if="contract.extendMonthDate">{{ contract.extendMonthDate - 1 }}号</span>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-tabs v-model:activeKey="activeKey">
|
||||
<a-tab-pane :key="0" tab="结算规则设置">
|
||||
<template #default>
|
||||
<a-button type="primary" @click.native="showSelectEquip = true">添加结算设备</a-button>
|
||||
<a-table ref="contractEquipmentSettleTableRef"
|
||||
row-key="contractSettleId" :dataSource="settleEquipmentList" :columns="equipmentColumns">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.key === 'rentMonth'">
|
||||
<a-input v-model:value="record.rentMonth" type="number" />
|
||||
</template>
|
||||
<template v-if="column.key === 'rentAmount'">
|
||||
<a-input v-model:value="record.rentAmount" type="number" />
|
||||
</template>
|
||||
<template v-if="column.key === 'rentAmountSum'">
|
||||
<span>{{ record.rentMonth * record.rentAmount }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'inOutAmount'">
|
||||
<a-input v-model:value="record.inOutAmount" type="number" />
|
||||
</template>
|
||||
<template v-if="column.key === 'workerAmount'">
|
||||
<a-input v-model:value="record.workerAmount" type="number" />
|
||||
</template>
|
||||
<template v-if="column.key === 'workerAmountSum'">
|
||||
<span>{{ record.rentMonth * record.workerAmount }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'otherAmount'">
|
||||
<a-input v-model:value="record.otherAmount" type="number" />
|
||||
</template>
|
||||
<template v-if="column.key === 'remark'">
|
||||
<a-input v-model:value="record.remark" />
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<div class="flex justify-center items-center">
|
||||
<close-circle-outlined style="font-size: 1.5rem; color: pink;cursor: pointer"
|
||||
@click.native="delEquipment(index)" />
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
<template #summary>
|
||||
<a-table-summary-row>
|
||||
<a-table-summary-cell>合计</a-table-summary-cell>
|
||||
<a-table-summary-cell />
|
||||
<a-table-summary-cell />
|
||||
<a-table-summary-cell />
|
||||
<a-table-summary-cell />
|
||||
<a-table-summary-cell />
|
||||
<a-table-summary-cell />
|
||||
<a-table-summary-cell>
|
||||
{{ totals.rentAmountSum }}
|
||||
</a-table-summary-cell>
|
||||
<a-table-summary-cell />
|
||||
<a-table-summary-cell />
|
||||
<a-table-summary-cell>
|
||||
{{ totals.workerAmountSum }}
|
||||
</a-table-summary-cell>
|
||||
<a-table-summary-cell />
|
||||
<a-table-summary-cell />
|
||||
</a-table-summary-row>
|
||||
</template>
|
||||
</a-table>
|
||||
</template>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane :key="1" tab="结算周期设置">
|
||||
<template #default>
|
||||
<a-button type="primary" @click.native="addRule">新增</a-button>
|
||||
<a-table ref="contractRuleSettleTableRef"
|
||||
row-key="contractSettleId" :dataSource="settleRuleList" :columns="ruleColumns">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.key === 'startDate'">
|
||||
<a-date-picker
|
||||
class="ele-fluid"
|
||||
placeholder="请选择开始日期"
|
||||
v-model:value="record.startDate"
|
||||
valueFormat="YYYY-MM-DD"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="column.key === 'endDate'">
|
||||
<a-date-picker
|
||||
class="ele-fluid"
|
||||
placeholder="请选择结束日期"
|
||||
v-model:value="record.endDate"
|
||||
valueFormat="YYYY-MM-DD"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<div class="flex justify-center items-center">
|
||||
<close-circle-outlined style="font-size: 1.5rem; color: pink;cursor: pointer"
|
||||
@click.native="delRule(index)" />
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</template>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
|
||||
<SelectData
|
||||
v-model:visible="showSelectEquip"
|
||||
:data="null"
|
||||
title="选择设备"
|
||||
@done="onSelectEquip"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch, computed } from "vue";
|
||||
import { Form, message } from "ant-design-vue";
|
||||
import { assignObject, EleProTable } from "ele-admin-pro";
|
||||
import { useUserStore } from "@/store/modules/user";
|
||||
import { Contract, ContractSettleMethod } from "@/api/tower/contract/model";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
import {
|
||||
PlusOutlined,
|
||||
UnorderedListOutlined,
|
||||
CloseCircleOutlined
|
||||
} from "@ant-design/icons-vue";
|
||||
import { TowerModel } from "@/api/tower/model/model";
|
||||
import { listTowerModel } from "@/api/tower/model";
|
||||
import { ContractSettleEquipment } from "@/api/tower/contractSettle/equipment/model";
|
||||
import { ColumnItem } from "ele-admin-pro/es/ele-pro-table/types";
|
||||
import SelectData from "@/components/TowerEquipmentModel/components/select-data.vue";
|
||||
import { ContractSettleRule } from "@/api/tower/contractSettle/rule/model";
|
||||
import { updateContract } from "@/api/tower/contract";
|
||||
import { addBatchContractSettleEquipment, listContractSettleEquipment } from "@/api/tower/contractSettle/equipment";
|
||||
import { addBatchContractSettleRule, listContractSettleRule } from "@/api/tower/contractSettle/rule";
|
||||
|
||||
|
||||
const userStore = useUserStore();
|
||||
// 当前用户信息
|
||||
const loginUser = computed(() => userStore.info ?? {});
|
||||
|
||||
const now = dayjs().format("YYYY-MM-DD HH:mm:ss");
|
||||
|
||||
const dateList = ref<number[]>([]);
|
||||
const activeKey = ref(0);
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: Contract | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: "done"): void;
|
||||
(e: "update:visible", visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxable = ref(true);
|
||||
|
||||
const showSelectEquip = ref<Boolean>(false);
|
||||
|
||||
const onSelectEquip = data => {
|
||||
addEquipment(data);
|
||||
};
|
||||
|
||||
const contract = reactive<Contract>({
|
||||
contractId: undefined,
|
||||
settleMethod: undefined,
|
||||
extendMonthDate: undefined
|
||||
});
|
||||
|
||||
const contractEquipmentSettleTableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
const equipmentColumns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: "序号",
|
||||
key: "index",
|
||||
width: 48,
|
||||
align: "center",
|
||||
fixed: "left",
|
||||
hideInSetting: true,
|
||||
customRender: ({ index }) => index + (contractEquipmentSettleTableRef.value?.tableIndex ?? 1)
|
||||
},
|
||||
{
|
||||
title: "设备名",
|
||||
dataIndex: "equipmentName",
|
||||
key: "equipmentName"
|
||||
},
|
||||
{
|
||||
title: "规格",
|
||||
dataIndex: "equipmentModel",
|
||||
key: "equipmentModel"
|
||||
},
|
||||
{
|
||||
title: "进场编号",
|
||||
dataIndex: "factoryNo",
|
||||
key: "factoryNo"
|
||||
},
|
||||
{
|
||||
title: "自编号",
|
||||
dataIndex: "equipmentNo",
|
||||
key: "equipmentNo"
|
||||
},
|
||||
{
|
||||
title: "计划租期(月)",
|
||||
dataIndex: "rentMonth",
|
||||
key: "rentMonth"
|
||||
},
|
||||
{
|
||||
title: "租金(元)",
|
||||
dataIndex: "rentAmount",
|
||||
key: "rentAmount"
|
||||
},
|
||||
{
|
||||
title: "租金小计(元)",
|
||||
dataIndex: "rentAmountSum",
|
||||
key: "rentAmountSum"
|
||||
},
|
||||
{
|
||||
title: "进退场费(元)",
|
||||
dataIndex: "inOutAmount",
|
||||
key: "inOutAmount"
|
||||
},
|
||||
{
|
||||
title: "劳务费用(元)",
|
||||
dataIndex: "workerAmount",
|
||||
key: "workerAmount"
|
||||
},
|
||||
{
|
||||
title: "劳务小计(元)",
|
||||
dataIndex: "workerAmountSum",
|
||||
key: "workerAmountSum"
|
||||
},
|
||||
{
|
||||
title: "其他费用(元)",
|
||||
dataIndex: "otherAmount",
|
||||
key: "otherAmount"
|
||||
},
|
||||
{
|
||||
title: "备注",
|
||||
dataIndex: "remark",
|
||||
key: "remark"
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "action",
|
||||
key: "action"
|
||||
}
|
||||
]);
|
||||
const settleEquipmentList = ref<ContractSettleEquipment[]>([]);
|
||||
const getSettleEquipmentList = async () => {
|
||||
settleEquipmentList.value = await listContractSettleEquipment({ contractId: contract.contractId });
|
||||
};
|
||||
const addEquipment = data => {
|
||||
settleEquipmentList.value = [...settleEquipmentList.value, {
|
||||
contractSettleId: 0,
|
||||
contractId: props.data?.contractId,
|
||||
equipmentName: data.name,
|
||||
equipmentModel: data.model,
|
||||
factoryNo: data.factoryNo,
|
||||
equipmentNo: data.equipmentNo,
|
||||
rentMonth: 0,
|
||||
rentAmount: 0,
|
||||
inOutAmount: 0,
|
||||
workerAmount: 0,
|
||||
otherAmount: 0,
|
||||
remark: "",
|
||||
userId: loginUser.value.userId
|
||||
}];
|
||||
};
|
||||
|
||||
const delEquipment = index => {
|
||||
settleEquipmentList.value.splice(index, 1);
|
||||
};
|
||||
|
||||
const contractRuleSettleTableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
const settleRuleList = ref<ContractSettleRule[]>([]);
|
||||
const getSettleRuleList = async () => {
|
||||
settleRuleList.value = await listContractSettleRule({ contractId: contract.contractId });
|
||||
};
|
||||
|
||||
const ruleColumns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: "序号",
|
||||
key: "index",
|
||||
width: 48,
|
||||
align: "center",
|
||||
fixed: "left",
|
||||
hideInSetting: true,
|
||||
customRender: ({ index }) => index + (contractRuleSettleTableRef.value?.tableIndex ?? 1)
|
||||
},
|
||||
{
|
||||
title: "设备名",
|
||||
dataIndex: "equipmentName",
|
||||
key: "equipmentName"
|
||||
},
|
||||
{
|
||||
title: "结算开始日期",
|
||||
dataIndex: "startDate",
|
||||
key: "startDate"
|
||||
},
|
||||
{
|
||||
title: "结算结束日期",
|
||||
dataIndex: "endDate",
|
||||
key: "endDate"
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "action",
|
||||
key: "action"
|
||||
}
|
||||
]);
|
||||
const addRule = () => {
|
||||
settleRuleList.value.push({
|
||||
contractId: props.data?.contractId,
|
||||
startDate: "",
|
||||
endDate: ""
|
||||
});
|
||||
};
|
||||
|
||||
const delRule = index => {
|
||||
settleRuleList.value.splice(index, 1);
|
||||
};
|
||||
|
||||
const totals = computed(() => {
|
||||
let rentAmountSum = 0;
|
||||
let workerAmountSum = 0;
|
||||
|
||||
settleEquipmentList.value.forEach(({ rentMonth, rentAmount, workerAmount }) => {
|
||||
rentAmountSum += rentMonth * rentAmount;
|
||||
workerAmountSum += rentMonth * workerAmount;
|
||||
});
|
||||
return { rentAmountSum, workerAmountSum };
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit("update:visible", value);
|
||||
};
|
||||
|
||||
const equipmentList = ref<TowerModel[]>([]);
|
||||
const getEquipmentList = async () => {
|
||||
equipmentList.value = await listTowerModel();
|
||||
};
|
||||
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!contract.settleMethod) {
|
||||
message.error("请选择结算方式");
|
||||
return;
|
||||
}
|
||||
if (settleEquipmentList.value.length === 0) {
|
||||
message.error("请至少设置一条结算规则");
|
||||
return;
|
||||
}
|
||||
if (settleRuleList.value.length === 0) {
|
||||
message.error("请至少设置一条结算周期");
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < settleRuleList.value.length; i++) {
|
||||
if (!settleRuleList.value[i].startDate) {
|
||||
message.error("请选择结算开始日期");
|
||||
return;
|
||||
}
|
||||
if (!settleRuleList.value[i].endDate) {
|
||||
message.error("请选择结算结束日期");
|
||||
return;
|
||||
}
|
||||
}
|
||||
loading.value = true;
|
||||
updateContract(contract);
|
||||
addBatchContractSettleEquipment(settleEquipmentList.value);
|
||||
addBatchContractSettleRule(settleRuleList.value);
|
||||
loading.value = false;
|
||||
// message.success(res.message);
|
||||
updateVisible(false);
|
||||
emit("done");
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
for (let i = 2; i < 28; i++) dateList.value.push(i);
|
||||
getEquipmentList();
|
||||
if (props.data) {
|
||||
loading.value = false;
|
||||
assignObject(contract, props.data);
|
||||
getSettleEquipmentList();
|
||||
getSettleRuleList();
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<style lang="less">
|
||||
.title {
|
||||
font-weight: bold;
|
||||
font-size: 1.1rem;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #dcdfe6;
|
||||
color: #494949;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
@@ -4,7 +4,7 @@
|
||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="customerId"
|
||||
row-key="contractId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
v-model:selection="selection"
|
||||
@@ -29,6 +29,7 @@
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a @click="openSettle(record)">合同结算设置</a>
|
||||
<a @click="openEdit(record)">修改</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
@@ -45,6 +46,7 @@
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<ContractEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
<ContractSettle v-model:visible="showSettle" :data="current" @done="reload" />
|
||||
<!-- 合同详情弹窗 -->
|
||||
<ContractInfo v-model:visible="showInfo" :data="current" @done="reload" />
|
||||
<!-- 批量转移弹窗 -->
|
||||
@@ -68,6 +70,7 @@
|
||||
import { toDateString } from 'ele-admin-pro';
|
||||
import Search from './components/search.vue';
|
||||
import ContractEdit from './components/contract-edit.vue';
|
||||
import ContractSettle from './components/contract-settle.vue';
|
||||
import ContractInfo from './components/contract-info.vue';
|
||||
import {
|
||||
pageContract,
|
||||
@@ -75,21 +78,20 @@
|
||||
removeBatchContract
|
||||
} from '@/api/tower/contract';
|
||||
import { timeAgo } from 'ele-admin-pro';
|
||||
import type { Customer, CustomerParam } from '@/api/oa/customer/model';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import { Contract, ContractParam } from "@/api/tower/contract/model";
|
||||
|
||||
const userStore = useUserStore();
|
||||
// 当前用户信息
|
||||
const loginUser = computed(() => userStore.info ?? {});
|
||||
const customerType = localStorage.getItem('customerType');
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<Customer[]>([]);
|
||||
const selection = ref<Contract[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<Customer | null>(null);
|
||||
const current = ref<Contract | null>(null);
|
||||
|
||||
// 是否显示资产详情
|
||||
const showInfo = ref(false);
|
||||
@@ -107,9 +109,6 @@
|
||||
filters
|
||||
}) => {
|
||||
if (filters) {
|
||||
where.progress = filters.progress;
|
||||
where.customerSource = filters.customerSource;
|
||||
where.customerType = filters.customerType;
|
||||
where.status = filters.status;
|
||||
}
|
||||
return pageContract({
|
||||
@@ -170,33 +169,39 @@
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: CustomerParam) => {
|
||||
const reload = (where?: ContractParam) => {
|
||||
console.log(where);
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: Customer) => {
|
||||
const openEdit = (row?: Contract) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
const showSettle = ref<Boolean>(false)
|
||||
const openSettle = (row?: Contract) => {
|
||||
current.value = row ?? null;
|
||||
showSettle.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 打开用户详情弹窗 */
|
||||
const openInfo = (row?: Customer) => {
|
||||
const openInfo = (row?: Contract) => {
|
||||
current.value = row ?? null;
|
||||
showInfo.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: Customer) => {
|
||||
const remove = (row: Contract) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeContract(row.customerId)
|
||||
removeContract(row.contractId)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
@@ -230,7 +235,7 @@
|
||||
removeBatchContract(
|
||||
selection.value.map((d) => {
|
||||
if (loginUser.value.userId === d.userId) {
|
||||
return d.customerId;
|
||||
return d.contractId;
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
@@ -45,14 +45,11 @@
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="产权单位" name="companyId">
|
||||
<a-select
|
||||
<DictSelect
|
||||
:placeholder="'请选择产权单位'"
|
||||
v-model:value="form.companyId"
|
||||
:options="companyList"
|
||||
:field-names="{
|
||||
label: 'companyName',
|
||||
value: 'companyId',
|
||||
options: 'children'
|
||||
}"
|
||||
:dict-code="'PropertyCompany'"
|
||||
@done="chooseCompanyName"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="出厂日期" name="factoryDate">
|
||||
@@ -145,301 +142,304 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject } from 'ele-admin-pro';
|
||||
import { addTowerFall, updateTowerFall } from '@/api/tower/fall';
|
||||
import { TowerFall } from '@/api/tower/fall/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { UploadOutlined } from '@ant-design/icons-vue';
|
||||
import DictSelect from '@/views/search/components/dict-select.vue';
|
||||
import { FormInstance } from 'ant-design-vue/es/form';
|
||||
import { TOKEN_STORE_NAME } from '@/config/setting';
|
||||
import { Warehouse } from '@/api/tower/warehouse/model';
|
||||
import { User } from '@/api/user/model';
|
||||
import { Organization } from '@/api/system/organization/model';
|
||||
import { Customer } from '@/api/oa/customer/model';
|
||||
import { Company } from '@/api/system/company/model';
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
import { ref, reactive, watch } from "vue";
|
||||
import { Form, message } from "ant-design-vue";
|
||||
import { assignObject } from "ele-admin-pro";
|
||||
import { addTowerFall, updateTowerFall } from "@/api/tower/fall";
|
||||
import { TowerFall } from "@/api/tower/fall/model";
|
||||
import { useThemeStore } from "@/store/modules/theme";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { UploadOutlined } from "@ant-design/icons-vue";
|
||||
import DictSelect from "@/views/search/components/dict-select.vue";
|
||||
import { FormInstance } from "ant-design-vue/es/form";
|
||||
import { TOKEN_STORE_NAME } from "@/config/setting";
|
||||
import { Warehouse } from "@/api/tower/warehouse/model";
|
||||
import { User } from "@/api/user/model";
|
||||
import { Organization } from "@/api/system/organization/model";
|
||||
import { Customer } from "@/api/oa/customer/model";
|
||||
import { Company } from "@/api/system/company/model";
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: TowerFall | null;
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: TowerFall | null;
|
||||
|
||||
companyList: Company[] | null;
|
||||
}>();
|
||||
companyList: Company[] | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
(e: "done"): void;
|
||||
(e: "update:visible", visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxable = ref(true);
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxable = ref(true);
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
|
||||
interface FileItem {
|
||||
uid: string;
|
||||
name?: string;
|
||||
status?: string;
|
||||
response?: Response;
|
||||
thumbUrl?: string;
|
||||
downloadUrl?: string;
|
||||
url: string;
|
||||
}
|
||||
interface FileItem {
|
||||
uid: string;
|
||||
name?: string;
|
||||
status?: string;
|
||||
response?: Response;
|
||||
thumbUrl?: string;
|
||||
downloadUrl?: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
interface FileInfo {
|
||||
file: FileItem;
|
||||
fileList: FileItem[];
|
||||
}
|
||||
interface FileInfo {
|
||||
file: FileItem;
|
||||
fileList: FileItem[];
|
||||
}
|
||||
|
||||
// 文件上传
|
||||
const file1 = ref<FileItem[]>();
|
||||
const file2 = ref<FileItem[]>();
|
||||
const file3 = ref<FileItem[]>();
|
||||
const file4 = ref<FileItem[]>();
|
||||
const file5 = ref<FileItem[]>();
|
||||
const file6 = ref<FileItem[]>();
|
||||
const file7 = ref<FileItem[]>();
|
||||
// 文件上传
|
||||
const file1 = ref<FileItem[]>();
|
||||
const file2 = ref<FileItem[]>();
|
||||
const file3 = ref<FileItem[]>();
|
||||
const file4 = ref<FileItem[]>();
|
||||
const file5 = ref<FileItem[]>();
|
||||
const file6 = ref<FileItem[]>();
|
||||
const file7 = ref<FileItem[]>();
|
||||
|
||||
// token
|
||||
const token = localStorage.getItem(TOKEN_STORE_NAME);
|
||||
// token
|
||||
const token = localStorage.getItem(TOKEN_STORE_NAME);
|
||||
|
||||
// 表单信息
|
||||
const form = reactive<TowerFall>({
|
||||
id: undefined,
|
||||
code: undefined,
|
||||
companyId: undefined,
|
||||
model: undefined,
|
||||
factory: '',
|
||||
factoryDate: '',
|
||||
discardDate: undefined,
|
||||
file1: '[]',
|
||||
file2: '[]',
|
||||
file3: '[]',
|
||||
file4: '[]',
|
||||
users: '',
|
||||
status: undefined,
|
||||
comments: '',
|
||||
userId: undefined,
|
||||
deleted: undefined,
|
||||
tenantId: undefined,
|
||||
createTime: undefined
|
||||
});
|
||||
// 表单信息
|
||||
const form = reactive<TowerFall>({
|
||||
id: undefined,
|
||||
code: undefined,
|
||||
companyId: undefined,
|
||||
model: undefined,
|
||||
factory: "",
|
||||
factoryDate: "",
|
||||
discardDate: undefined,
|
||||
file1: "[]",
|
||||
file2: "[]",
|
||||
file3: "[]",
|
||||
file4: "[]",
|
||||
users: "",
|
||||
status: undefined,
|
||||
comments: "",
|
||||
userId: undefined,
|
||||
deleted: undefined,
|
||||
tenantId: undefined,
|
||||
createTime: undefined
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit("update:visible", value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
code: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请输入防坠器编号',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
model: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请输入设备型号',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
factory: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请输入制造厂家',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
factoryDate: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请输入出厂日期',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
discardDate: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请输入报废日期',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const { resetFields } = useForm(form, rules);
|
||||
|
||||
// const onFactoryDate = () => {
|
||||
// form.scrapDate = form.factoryDate;
|
||||
// };
|
||||
|
||||
const onFile1 = (info: FileInfo) => {
|
||||
let resFileList = [...info.fileList];
|
||||
file1.value = resFileList.map((file) => {
|
||||
if (file.response) {
|
||||
// Component will show file.url as link
|
||||
file.url = file.response.url;
|
||||
}
|
||||
return file;
|
||||
});
|
||||
form.file1 = JSON.stringify(file1.value);
|
||||
};
|
||||
const onFile2 = (info: FileInfo) => {
|
||||
let resFileList = [...info.fileList];
|
||||
file2.value = resFileList.map((file) => {
|
||||
if (file.response) {
|
||||
// Component will show file.url as link
|
||||
file.url = file.response.url;
|
||||
}
|
||||
return file;
|
||||
});
|
||||
form.file2 = JSON.stringify(file2.value);
|
||||
};
|
||||
const onFile3 = (info: FileInfo) => {
|
||||
let resFileList = [...info.fileList];
|
||||
file3.value = resFileList.map((file) => {
|
||||
if (file.response) {
|
||||
// Component will show file.url as link
|
||||
file.url = file.response.url;
|
||||
}
|
||||
return file;
|
||||
});
|
||||
form.file3 = JSON.stringify(file3.value);
|
||||
};
|
||||
const onFile4 = (info: FileInfo) => {
|
||||
let resFileList = [...info.fileList];
|
||||
file4.value = resFileList.map((file) => {
|
||||
if (file.response) {
|
||||
// Component will show file.url as link
|
||||
file.url = file.response.url;
|
||||
}
|
||||
return file;
|
||||
});
|
||||
form.file4 = JSON.stringify(file4.value);
|
||||
};
|
||||
|
||||
const chooseFallName = (data) => {
|
||||
form.name = data.name;
|
||||
form.model = data.model;
|
||||
};
|
||||
|
||||
const chooseFallModel = (data) => {
|
||||
form.name = data.name;
|
||||
form.model = data.model;
|
||||
};
|
||||
|
||||
const chooseWarehouse = (data: Warehouse) => {
|
||||
console.log(data);
|
||||
form.warehouse = data.warehouseName;
|
||||
form.currentLocation = data.address;
|
||||
};
|
||||
|
||||
const chooseUsers = (data: User) => {
|
||||
form.users = data.nickname;
|
||||
};
|
||||
|
||||
const chooseOrganization = (data: Organization) => {
|
||||
form.organization = data.organizationName;
|
||||
};
|
||||
|
||||
const chooseCompanyName = (data: Customer) => {
|
||||
form.company = data.customerName;
|
||||
};
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
code: [
|
||||
{
|
||||
required: true,
|
||||
type: "string",
|
||||
message: "请输入防坠器编号",
|
||||
trigger: "blur"
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const formData = {
|
||||
...form
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateTowerFall : addTowerFall;
|
||||
saveOrUpdate(formData)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
],
|
||||
model: [
|
||||
{
|
||||
required: true,
|
||||
type: "string",
|
||||
message: "请输入设备型号",
|
||||
trigger: "blur"
|
||||
}
|
||||
],
|
||||
factory: [
|
||||
{
|
||||
required: true,
|
||||
type: "string",
|
||||
message: "请输入制造厂家",
|
||||
trigger: "blur"
|
||||
}
|
||||
],
|
||||
factoryDate: [
|
||||
{
|
||||
required: true,
|
||||
type: "string",
|
||||
message: "请输入出厂日期",
|
||||
trigger: "blur"
|
||||
}
|
||||
],
|
||||
discardDate: [
|
||||
{
|
||||
required: true,
|
||||
type: "string",
|
||||
message: "请输入报废日期",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
if (props.data) {
|
||||
assignObject(form, props.data);
|
||||
if (props.data.file1) {
|
||||
file1.value = JSON.parse(props.data.file1);
|
||||
}
|
||||
if (props.data.file2) {
|
||||
file2.value = JSON.parse(props.data.file2);
|
||||
}
|
||||
if (props.data.file3) {
|
||||
file3.value = JSON.parse(props.data.file3);
|
||||
}
|
||||
if (props.data.file4) {
|
||||
file4.value = JSON.parse(props.data.file4);
|
||||
}
|
||||
if (props.data.file5) {
|
||||
file5.value = JSON.parse(props.data.file5);
|
||||
}
|
||||
if (props.data.file6) {
|
||||
file6.value = JSON.parse(props.data.file6);
|
||||
}
|
||||
if (props.data.file7) {
|
||||
file7.value = JSON.parse(props.data.file7);
|
||||
}
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
const { resetFields } = useForm(form, rules);
|
||||
|
||||
// const onFactoryDate = () => {
|
||||
// form.scrapDate = form.factoryDate;
|
||||
// };
|
||||
|
||||
const onFile1 = (info: FileInfo) => {
|
||||
let resFileList = [...info.fileList];
|
||||
file1.value = resFileList.map((file) => {
|
||||
if (file.response) {
|
||||
// Component will show file.url as link
|
||||
file.url = file.response.url;
|
||||
}
|
||||
return file;
|
||||
});
|
||||
form.file1 = JSON.stringify(file1.value);
|
||||
};
|
||||
const onFile2 = (info: FileInfo) => {
|
||||
let resFileList = [...info.fileList];
|
||||
file2.value = resFileList.map((file) => {
|
||||
if (file.response) {
|
||||
// Component will show file.url as link
|
||||
file.url = file.response.url;
|
||||
}
|
||||
return file;
|
||||
});
|
||||
form.file2 = JSON.stringify(file2.value);
|
||||
};
|
||||
const onFile3 = (info: FileInfo) => {
|
||||
let resFileList = [...info.fileList];
|
||||
file3.value = resFileList.map((file) => {
|
||||
if (file.response) {
|
||||
// Component will show file.url as link
|
||||
file.url = file.response.url;
|
||||
}
|
||||
return file;
|
||||
});
|
||||
form.file3 = JSON.stringify(file3.value);
|
||||
};
|
||||
const onFile4 = (info: FileInfo) => {
|
||||
let resFileList = [...info.fileList];
|
||||
file4.value = resFileList.map((file) => {
|
||||
if (file.response) {
|
||||
// Component will show file.url as link
|
||||
file.url = file.response.url;
|
||||
}
|
||||
return file;
|
||||
});
|
||||
form.file4 = JSON.stringify(file4.value);
|
||||
};
|
||||
|
||||
const chooseFallName = (data) => {
|
||||
form.name = data.name;
|
||||
form.model = data.model;
|
||||
};
|
||||
|
||||
const chooseFallModel = (data) => {
|
||||
form.name = data.name;
|
||||
form.model = data.model;
|
||||
};
|
||||
|
||||
const chooseWarehouse = (data: Warehouse) => {
|
||||
console.log(data);
|
||||
form.warehouse = data.warehouseName;
|
||||
form.currentLocation = data.address;
|
||||
};
|
||||
|
||||
const chooseUsers = (data: User) => {
|
||||
form.users = data.nickname;
|
||||
};
|
||||
|
||||
const chooseOrganization = (data: Organization) => {
|
||||
form.organization = data.organizationName;
|
||||
};
|
||||
|
||||
const chooseCompanyName = (data: Customer) => {
|
||||
form.company = data.customerName;
|
||||
};
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const formData = {
|
||||
...form
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateTowerFall : addTowerFall;
|
||||
saveOrUpdate(formData)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit("done");
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
if (props.data) {
|
||||
assignObject(form, props.data);
|
||||
if (props.data.file1) {
|
||||
file1.value = JSON.parse(props.data.file1);
|
||||
}
|
||||
if (props.data.file2) {
|
||||
file2.value = JSON.parse(props.data.file2);
|
||||
}
|
||||
if (props.data.file3) {
|
||||
file3.value = JSON.parse(props.data.file3);
|
||||
}
|
||||
if (props.data.file4) {
|
||||
file4.value = JSON.parse(props.data.file4);
|
||||
}
|
||||
if (props.data.file5) {
|
||||
file5.value = JSON.parse(props.data.file5);
|
||||
}
|
||||
if (props.data.file6) {
|
||||
file6.value = JSON.parse(props.data.file6);
|
||||
}
|
||||
if (props.data.file7) {
|
||||
file7.value = JSON.parse(props.data.file7);
|
||||
}
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
resetFields();
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<style lang="less"></style>
|
||||
|
||||
<style lang="less">
|
||||
.tab-pane {
|
||||
min-height: 300px;
|
||||
}
|
||||
.ml-10 {
|
||||
margin-left: 5px;
|
||||
}
|
||||
.upload-text {
|
||||
margin-right: 70px;
|
||||
}
|
||||
.tab-pane {
|
||||
min-height: 300px;
|
||||
}
|
||||
|
||||
.ml-10 {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.upload-text {
|
||||
margin-right: 70px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="租赁单位" name="companyName">
|
||||
<TowerCompany
|
||||
<SelectCompany
|
||||
:placeholder="`请选择租赁单位`"
|
||||
v-model:value="form.companyName"
|
||||
:customer-type="`产权单位`"
|
||||
@@ -122,7 +122,7 @@
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="承租单位" name="customerName">
|
||||
<TowerCompany
|
||||
<SelectCustomer
|
||||
:placeholder="`请选择承租单位`"
|
||||
v-model:value="form.customerName"
|
||||
@done="chooseCustomerName"
|
||||
@@ -412,11 +412,11 @@
|
||||
});
|
||||
|
||||
const chooseCompanyName = (data: Customer) => {
|
||||
form.companyName = data.customerName;
|
||||
form.companyName = data.companyName;
|
||||
};
|
||||
|
||||
const chooseCustomerName = (data: Customer) => {
|
||||
form.customerName = data.customerName;
|
||||
form.customerName = data.name;
|
||||
};
|
||||
|
||||
const chooseDismantlingCompany = (data: Customer) => {
|
||||
|
||||
175
src/views/tower/settle/components/editTable/table0.vue
Normal file
175
src/views/tower/settle/components/editTable/table0.vue
Normal file
@@ -0,0 +1,175 @@
|
||||
<template>
|
||||
<a-table ref="tableRef0"
|
||||
row-key="contractSettleId" :dataSource="dataList" :columns="columns">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.key === 'startDate'">
|
||||
<a-date-picker
|
||||
class="ele-fluid"
|
||||
placeholder="请选择开始日期"
|
||||
v-model:value="record.startDate"
|
||||
valueFormat="YYYY-MM-DD"
|
||||
@change="changeDate($event, index)"
|
||||
@ok="changeDate($event, index)"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="column.key === 'endDate'">
|
||||
<a-date-picker
|
||||
class="ele-fluid"
|
||||
placeholder="请选择结束日期"
|
||||
v-model:value="record.endDate"
|
||||
valueFormat="YYYY-MM-DD"
|
||||
@change="changeDate($event, index)"
|
||||
@ok="changeDate($event, index)"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="column.key === 'settleCycle'">
|
||||
<span v-if="record.startDate && record.endDate">
|
||||
{{ Math.floor(record.days / 30) }}月
|
||||
{{ record.days - (Math.floor(record.days / 30) * 30) }}天
|
||||
</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'monthAmount'">
|
||||
<a-input v-model:value="record.monthAmount" type="number" @change="changeDate($event, index)" />
|
||||
</template>
|
||||
<template v-if="column.key === 'dailyAmount'">
|
||||
<span v-if="record.monthAmount">{{ record.dailyAmount }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'amountWithTax'">
|
||||
<span v-if="record.monthAmount">{{ (record.dailyAmount * record.days).toFixed(2) }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'tax'">
|
||||
<span v-if="record.monthAmount">{{ (record.dailyAmount * record.days * (record.taxRate / 100)).toFixed(2) }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'amountWithoutTax'">
|
||||
<span
|
||||
v-if="record.monthAmount">{{ ((record.dailyAmount * record.days) - (record.dailyAmount * record.days * (record.taxRate / 100))).toFixed(2)
|
||||
}}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'remark'">
|
||||
<a-input v-model:value="record.remark" />
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<div class="flex justify-center items-center">
|
||||
<close-circle-outlined style="font-size: 1.5rem; color: pink;cursor: pointer"
|
||||
@click.native="del(index)" />
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, watch } from "vue";
|
||||
import { SettleDetail } from "@/api/tower/settleDetail/model";
|
||||
import { ColumnItem } from "ele-admin-pro/es/ele-pro-table/types";
|
||||
import { assignObject, EleProTable } from "ele-admin-pro";
|
||||
import {
|
||||
CloseCircleOutlined
|
||||
} from "@ant-design/icons-vue";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
const props = defineProps<{
|
||||
dataSource: SettleDetail[]
|
||||
}>();
|
||||
const tableRef0 = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: "序号",
|
||||
key: "index",
|
||||
width: 48,
|
||||
align: "center",
|
||||
fixed: "left",
|
||||
hideInSetting: true,
|
||||
customRender: ({ index }) => index + (tableRef0.value?.tableIndex ?? 1)
|
||||
},
|
||||
{
|
||||
title: "设备名",
|
||||
dataIndex: "equipmentName",
|
||||
key: "equipmentName"
|
||||
},
|
||||
{
|
||||
title: "设备型号",
|
||||
dataIndex: "equipmentModel",
|
||||
key: "equipmentModel"
|
||||
},
|
||||
{
|
||||
title: "出场编号",
|
||||
dataIndex: "factoryNo",
|
||||
key: "factoryNo"
|
||||
},
|
||||
{
|
||||
title: "结算开始日期",
|
||||
dataIndex: "startDate",
|
||||
key: "startDate"
|
||||
},
|
||||
{
|
||||
title: "结算结束日期",
|
||||
dataIndex: "endDate",
|
||||
key: "endDate"
|
||||
},
|
||||
{
|
||||
title: "实际结算周期",
|
||||
dataIndex: "settleCycle",
|
||||
key: "settleCycle"
|
||||
},
|
||||
{
|
||||
title: "月租金(元)",
|
||||
dataIndex: "monthAmount",
|
||||
key: "monthAmount"
|
||||
},
|
||||
{
|
||||
title: "日租金(元)",
|
||||
dataIndex: "dailyAmount",
|
||||
key: "dailyAmount"
|
||||
},
|
||||
{
|
||||
title: "本期租金含税金额(元)",
|
||||
dataIndex: "amountWithTax",
|
||||
key: "amountWithTax"
|
||||
},
|
||||
{
|
||||
title: "税金(元)",
|
||||
dataIndex: "tax",
|
||||
key: "tax"
|
||||
},
|
||||
{
|
||||
title: "不含税总价(元)",
|
||||
dataIndex: "amountWithoutTax",
|
||||
key: "amountWithoutTax"
|
||||
},
|
||||
{
|
||||
title: "备注",
|
||||
dataIndex: "remark",
|
||||
key: "remark"
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "action",
|
||||
key: "action"
|
||||
}
|
||||
]);
|
||||
|
||||
const dataList = ref<SettleDetail[]>([]);
|
||||
|
||||
const changeDate = (data, index) => {
|
||||
if (dataList.value[index].startDate && dataList.value[index].endDate) {
|
||||
dataList.value[index].days = dayjs(dataList.value[index].endDate).diff(dayjs(dataList.value[index].startDate), "day");
|
||||
if (dataList.value[index].monthAmount) dataList.value[index].dailyAmount = (dataList.value[index].monthAmount / 30).toFixed(8);
|
||||
}
|
||||
};
|
||||
|
||||
const del = (index: number) => {
|
||||
dataList.value.splice(index, 1);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.dataSource,
|
||||
(dataSource) => {
|
||||
dataList.value = dataSource;
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
defineExpose({ dataList })
|
||||
</script>
|
||||
145
src/views/tower/settle/components/editTable/table1.vue
Normal file
145
src/views/tower/settle/components/editTable/table1.vue
Normal file
@@ -0,0 +1,145 @@
|
||||
<template>
|
||||
<a-table ref="tableRef0"
|
||||
row-key="contractSettleId" :dataSource="dataList" :columns="columns">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.key === 'singleAmount'">
|
||||
<a-input v-model:value="record.singleAmount" type="number" />
|
||||
</template>
|
||||
<template v-if="column.key === 'num'">
|
||||
<a-input v-model:value="record.num" type="number" />
|
||||
</template>
|
||||
<template v-if="column.key === 'sumAmount'">
|
||||
<span v-if="record.singleAmount && record.num">
|
||||
{{ (record.singleAmount * record.num).toFixed(2) }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'amountWithTax'">
|
||||
<span v-if="record.singleAmount && record.num">{{ (record.singleAmount * record.num).toFixed(2) }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'tax'">
|
||||
<span v-if="record.singleAmount && record.num">{{ (record.singleAmount * record.num * (record.taxRate / 100)).toFixed(2)
|
||||
}}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'amountWithoutTax'">
|
||||
<span
|
||||
v-if="record.singleAmount && record.num">{{ ((record.singleAmount * record.num) - (record.singleAmount * record.num * (record.taxRate / 100))).toFixed(2)
|
||||
}}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'remark'">
|
||||
<a-input v-model:value="record.remark" />
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<div class="flex justify-center items-center">
|
||||
<close-circle-outlined style="font-size: 1.5rem; color: pink;cursor: pointer"
|
||||
@click.native="del(index)" />
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, watch } from "vue";
|
||||
import { SettleDetail } from "@/api/tower/settleDetail/model";
|
||||
import { ColumnItem } from "ele-admin-pro/es/ele-pro-table/types";
|
||||
import { assignObject, EleProTable } from "ele-admin-pro";
|
||||
import {
|
||||
CloseCircleOutlined
|
||||
} from "@ant-design/icons-vue";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
const props = defineProps<{
|
||||
dataSource: SettleDetail[]
|
||||
}>();
|
||||
const tableRef0 = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: "序号",
|
||||
key: "index",
|
||||
width: 48,
|
||||
align: "center",
|
||||
fixed: "left",
|
||||
hideInSetting: true,
|
||||
customRender: ({ index }) => index + (tableRef0.value?.tableIndex ?? 1)
|
||||
},
|
||||
{
|
||||
title: "设备名",
|
||||
dataIndex: "equipmentName",
|
||||
key: "equipmentName"
|
||||
},
|
||||
{
|
||||
title: "设备型号",
|
||||
dataIndex: "equipmentModel",
|
||||
key: "equipmentModel"
|
||||
},
|
||||
{
|
||||
title: "出场编号",
|
||||
dataIndex: "factoryNo",
|
||||
key: "factoryNo"
|
||||
},
|
||||
{
|
||||
title: "费用类型",
|
||||
dataIndex: "settleCostType",
|
||||
key: "settleCostType"
|
||||
},
|
||||
{
|
||||
title: "单价",
|
||||
dataIndex: "singleAmount",
|
||||
key: "singleAmount"
|
||||
},
|
||||
{
|
||||
title: "次数",
|
||||
dataIndex: "num",
|
||||
key: "num"
|
||||
},
|
||||
{
|
||||
title: "进退场小计(元)",
|
||||
dataIndex: "sumAmount",
|
||||
key: "sumAmount"
|
||||
},
|
||||
{
|
||||
title: "含税金额(元)",
|
||||
dataIndex: "amountWithTax",
|
||||
key: "amountWithTax"
|
||||
},
|
||||
{
|
||||
title: "税金(元)",
|
||||
dataIndex: "tax",
|
||||
key: "tax"
|
||||
},
|
||||
{
|
||||
title: "不含税总价(元)",
|
||||
dataIndex: "amountWithoutTax",
|
||||
key: "amountWithoutTax"
|
||||
},
|
||||
{
|
||||
title: "备注",
|
||||
dataIndex: "remark",
|
||||
key: "remark"
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "action",
|
||||
key: "action"
|
||||
}
|
||||
]);
|
||||
|
||||
const dataList = ref<SettleDetail[]>([]);
|
||||
|
||||
const del = (index: number) => {
|
||||
dataList.value.splice(index, 1);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.dataSource,
|
||||
(dataSource) => {
|
||||
dataList.value = dataSource;
|
||||
console.log(dataList.value)
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
defineExpose({ dataList })
|
||||
|
||||
</script>
|
||||
178
src/views/tower/settle/components/editTable/table2.vue
Normal file
178
src/views/tower/settle/components/editTable/table2.vue
Normal file
@@ -0,0 +1,178 @@
|
||||
<template>
|
||||
<a-table ref="tableRef0"
|
||||
row-key="contractSettleId" :dataSource="dataList" :columns="columns">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.key === 'startDate'">
|
||||
<a-date-picker
|
||||
class="ele-fluid"
|
||||
placeholder="请选择开始日期"
|
||||
v-model:value="record.startDate"
|
||||
valueFormat="YYYY-MM-DD"
|
||||
@change="changeDate($event, index)"
|
||||
@ok="changeDate($event, index)"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="column.key === 'endDate'">
|
||||
<a-date-picker
|
||||
class="ele-fluid"
|
||||
placeholder="请选择结束日期"
|
||||
v-model:value="record.endDate"
|
||||
valueFormat="YYYY-MM-DD"
|
||||
@change="changeDate($event, index)"
|
||||
@ok="changeDate($event, index)"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="column.key === 'settleCycle'">
|
||||
<span v-if="record.startDate && record.endDate">
|
||||
{{ Math.floor(record.days / 30) }}月
|
||||
{{ record.days - (Math.floor(record.days / 30) * 30) }}天
|
||||
</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'monthAmount'">
|
||||
<a-input v-model:value="record.monthAmount" type="number" @change="changeDate($event, index)" />
|
||||
</template>
|
||||
<template v-if="column.key === 'dailyAmount'">
|
||||
<span v-if="record.monthAmount">{{ record.dailyAmount }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'amountWithTax'">
|
||||
<span v-if="record.monthAmount">{{ (record.dailyAmount * record.days).toFixed(2) }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'tax'">
|
||||
<span v-if="record.monthAmount">{{ (record.dailyAmount * record.days * (record.taxRate / 100)).toFixed(2) }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'amountWithoutTax'">
|
||||
<span
|
||||
v-if="record.monthAmount">{{ ((record.dailyAmount * record.days) - (record.dailyAmount * record.days * (record.taxRate / 100))).toFixed(2)
|
||||
}}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'remark'">
|
||||
<a-input v-model:value="record.remark" />
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<div class="flex justify-center items-center">
|
||||
<close-circle-outlined style="font-size: 1.5rem; color: pink;cursor: pointer"
|
||||
@click.native="del(index)" />
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, watch } from "vue";
|
||||
import { SettleDetail } from "@/api/tower/settleDetail/model";
|
||||
import { ColumnItem } from "ele-admin-pro/es/ele-pro-table/types";
|
||||
import { assignObject, EleProTable } from "ele-admin-pro";
|
||||
import {
|
||||
CloseCircleOutlined
|
||||
} from "@ant-design/icons-vue";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
const props = defineProps<{
|
||||
dataSource: SettleDetail[]
|
||||
}>();
|
||||
const tableRef0 = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: "序号",
|
||||
key: "index",
|
||||
width: 48,
|
||||
align: "center",
|
||||
fixed: "left",
|
||||
hideInSetting: true,
|
||||
customRender: ({ index }) => index + (tableRef0.value?.tableIndex ?? 1)
|
||||
},
|
||||
{
|
||||
title: "设备名",
|
||||
dataIndex: "equipmentName",
|
||||
key: "equipmentName"
|
||||
},
|
||||
{
|
||||
title: "设备型号",
|
||||
dataIndex: "equipmentModel",
|
||||
key: "equipmentModel"
|
||||
},
|
||||
{
|
||||
title: "出场编号",
|
||||
dataIndex: "factoryNo",
|
||||
key: "factoryNo"
|
||||
},
|
||||
{
|
||||
title: "结算开始日期",
|
||||
dataIndex: "startDate",
|
||||
key: "startDate"
|
||||
},
|
||||
{
|
||||
title: "结算结束日期",
|
||||
dataIndex: "endDate",
|
||||
key: "endDate"
|
||||
},
|
||||
{
|
||||
title: "实际结算周期",
|
||||
dataIndex: "settleCycle",
|
||||
key: "settleCycle"
|
||||
},
|
||||
{
|
||||
title: "月工资(元)",
|
||||
dataIndex: "monthAmount",
|
||||
key: "monthAmount"
|
||||
},
|
||||
{
|
||||
title: "日工资(元)",
|
||||
dataIndex: "dailyAmount",
|
||||
key: "dailyAmount"
|
||||
},
|
||||
{
|
||||
title: "含税金额(元)",
|
||||
dataIndex: "amountWithTax",
|
||||
key: "amountWithTax"
|
||||
},
|
||||
{
|
||||
title: "税金(元)",
|
||||
dataIndex: "tax",
|
||||
key: "tax"
|
||||
},
|
||||
{
|
||||
title: "不含税金额(元)",
|
||||
dataIndex: "amountWithoutTax",
|
||||
key: "amountWithoutTax"
|
||||
},
|
||||
{
|
||||
title: "备注",
|
||||
dataIndex: "remark",
|
||||
key: "remark"
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "action",
|
||||
key: "action"
|
||||
}
|
||||
]);
|
||||
|
||||
const dataList = ref<SettleDetail[]>([]);
|
||||
|
||||
const changeDate = (data, index) => {
|
||||
if (dataList.value[index].startDate && dataList.value[index].endDate) {
|
||||
dataList.value[index].days = dayjs(dataList.value[index].endDate).diff(dayjs(dataList.value[index].startDate), "day");
|
||||
console.log(dataList.value[index].days)
|
||||
if (dataList.value[index].monthAmount) dataList.value[index].dailyAmount = (dataList.value[index].monthAmount / 30).toFixed(8);
|
||||
}
|
||||
};
|
||||
|
||||
const del = (index: number) => {
|
||||
dataList.value.splice(index, 1);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.dataSource,
|
||||
(dataSource) => {
|
||||
dataList.value = dataSource;
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
|
||||
defineExpose({ dataList })
|
||||
|
||||
</script>
|
||||
168
src/views/tower/settle/components/editTable/table3.vue
Normal file
168
src/views/tower/settle/components/editTable/table3.vue
Normal file
@@ -0,0 +1,168 @@
|
||||
<template>
|
||||
<a-table ref="tableRef0"
|
||||
row-key="contractSettleId" :dataSource="dataList" :columns="columns">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.key === 'settleCostType'">
|
||||
<a-select placeholder="请先选择费用类型" style="width: 250px" size="small"
|
||||
v-model:value="record.settleCostType">
|
||||
<a-select-option v-for="(item, index) in dictList" :key="index" :value="item.dictDataName">
|
||||
{{ item.dictDataName }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</template>
|
||||
<template v-if="column.key === 'singleAmount'">
|
||||
<a-input v-model:value="record.singleAmount" type="number" />
|
||||
</template>
|
||||
<template v-if="column.key === 'num'">
|
||||
<a-input v-model:value="record.num" type="number" />
|
||||
</template>
|
||||
<template v-if="column.key === 'unit'">
|
||||
<a-input v-model:value="record.unit" />
|
||||
</template>
|
||||
<template v-if="column.key === 'sumAmount'">
|
||||
<span v-if="record.singleAmount && record.num">
|
||||
{{ (record.singleAmount * record.num).toFixed(2) }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'amountWithTax'">
|
||||
<span v-if="record.singleAmount && record.num">{{ (record.singleAmount * record.num).toFixed(2) }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'tax'">
|
||||
<span
|
||||
v-if="record.singleAmount && record.num">{{ (record.singleAmount * record.num * (record.taxRate / 100)).toFixed(2)
|
||||
}}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'amountWithoutTax'">
|
||||
<span
|
||||
v-if="record.singleAmount && record.num">{{ ((record.singleAmount * record.num) - (record.singleAmount * record.num * (record.taxRate / 100))).toFixed(2)
|
||||
}}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'remark'">
|
||||
<a-input v-model:value="record.remark" />
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<div class="flex justify-center items-center">
|
||||
<close-circle-outlined style="font-size: 1.5rem; color: pink;cursor: pointer"
|
||||
@click.native="del(index)" />
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, watch } from "vue";
|
||||
import { SettleDetail } from "@/api/tower/settleDetail/model";
|
||||
import { ColumnItem } from "ele-admin-pro/es/ele-pro-table/types";
|
||||
import { assignObject, EleProTable } from "ele-admin-pro";
|
||||
import {
|
||||
CloseCircleOutlined
|
||||
} from "@ant-design/icons-vue";
|
||||
import dayjs from "dayjs";
|
||||
import { DictDataParam } from "@/api/system/dict-data/model";
|
||||
import { listDictData } from "@/api/system/dict-data";
|
||||
|
||||
const props = defineProps<{
|
||||
dataSource: SettleDetail[]
|
||||
}>();
|
||||
const tableRef0 = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
const dictList = ref<DictDataParam[]>([]);
|
||||
const getDictList = async () => {
|
||||
dictList.value = await listDictData({ dictId: 146 });
|
||||
};
|
||||
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: "序号",
|
||||
key: "index",
|
||||
width: 48,
|
||||
align: "center",
|
||||
fixed: "left",
|
||||
hideInSetting: true,
|
||||
customRender: ({ index }) => index + (tableRef0.value?.tableIndex ?? 1)
|
||||
},
|
||||
{
|
||||
title: "设备名",
|
||||
dataIndex: "equipmentName",
|
||||
key: "equipmentName"
|
||||
},
|
||||
{
|
||||
title: "设备型号",
|
||||
dataIndex: "equipmentModel",
|
||||
key: "equipmentModel"
|
||||
},
|
||||
{
|
||||
title: "出场编号",
|
||||
dataIndex: "factoryNo",
|
||||
key: "factoryNo"
|
||||
},
|
||||
{
|
||||
title: "费用类型",
|
||||
dataIndex: "settleCostType",
|
||||
key: "settleCostType"
|
||||
},
|
||||
{
|
||||
title: "单价",
|
||||
dataIndex: "singleAmount",
|
||||
key: "singleAmount"
|
||||
},
|
||||
{
|
||||
title: "数量",
|
||||
dataIndex: "num",
|
||||
key: "num"
|
||||
},
|
||||
{
|
||||
title: "单位",
|
||||
dataIndex: "unit",
|
||||
key: "unit"
|
||||
},
|
||||
{
|
||||
title: "含税金额(元)",
|
||||
dataIndex: "amountWithTax",
|
||||
key: "amountWithTax"
|
||||
},
|
||||
{
|
||||
title: "税金(元)",
|
||||
dataIndex: "tax",
|
||||
key: "tax"
|
||||
},
|
||||
{
|
||||
title: "不含税总价(元)",
|
||||
dataIndex: "amountWithoutTax",
|
||||
key: "amountWithoutTax"
|
||||
},
|
||||
{
|
||||
title: "备注",
|
||||
dataIndex: "remark",
|
||||
key: "remark"
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "action",
|
||||
key: "action"
|
||||
}
|
||||
]);
|
||||
|
||||
const dataList = ref<SettleDetail[]>([]);
|
||||
|
||||
const del = (index: number) => {
|
||||
dataList.value.splice(index, 1);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.dataSource,
|
||||
(dataSource) => {
|
||||
dataList.value = dataSource;
|
||||
console.log(dataList.value);
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
getDictList();
|
||||
});
|
||||
|
||||
defineExpose({ dataList })
|
||||
|
||||
</script>
|
||||
168
src/views/tower/settle/components/editTable/table4.vue
Normal file
168
src/views/tower/settle/components/editTable/table4.vue
Normal file
@@ -0,0 +1,168 @@
|
||||
<template>
|
||||
<a-table ref="tableRef0"
|
||||
row-key="contractSettleId" :dataSource="dataList" :columns="columns">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.key === 'settleCostType'">
|
||||
<a-select placeholder="请先选择费用类型" style="width: 250px" size="small"
|
||||
v-model:value="record.settleCostType">
|
||||
<a-select-option v-for="(item, index) in dictList" :key="index" :value="item.dictDataName">
|
||||
{{ item.dictDataName }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</template>
|
||||
<template v-if="column.key === 'singleAmount'">
|
||||
<a-input v-model:value="record.singleAmount" type="number" />
|
||||
</template>
|
||||
<template v-if="column.key === 'num'">
|
||||
<a-input v-model:value="record.num" type="number" />
|
||||
</template>
|
||||
<template v-if="column.key === 'unit'">
|
||||
<a-input v-model:value="record.unit" />
|
||||
</template>
|
||||
<template v-if="column.key === 'sumAmount'">
|
||||
<span v-if="record.singleAmount && record.num">
|
||||
{{ (record.singleAmount * record.num).toFixed(2) }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'amountWithTax'">
|
||||
<span v-if="record.singleAmount && record.num">{{ (record.singleAmount * record.num).toFixed(2) }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'tax'">
|
||||
<span
|
||||
v-if="record.singleAmount && record.num">{{ (record.singleAmount * record.num * (record.taxRate / 100)).toFixed(2)
|
||||
}}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'amountWithoutTax'">
|
||||
<span
|
||||
v-if="record.singleAmount && record.num">{{ ((record.singleAmount * record.num) - (record.singleAmount * record.num * (record.taxRate / 100))).toFixed(2)
|
||||
}}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'remark'">
|
||||
<a-input v-model:value="record.remark" />
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<div class="flex justify-center items-center">
|
||||
<close-circle-outlined style="font-size: 1.5rem; color: pink;cursor: pointer"
|
||||
@click.native="del(index)" />
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, watch } from "vue";
|
||||
import { SettleDetail } from "@/api/tower/settleDetail/model";
|
||||
import { ColumnItem } from "ele-admin-pro/es/ele-pro-table/types";
|
||||
import { assignObject, EleProTable } from "ele-admin-pro";
|
||||
import {
|
||||
CloseCircleOutlined
|
||||
} from "@ant-design/icons-vue";
|
||||
import dayjs from "dayjs";
|
||||
import { DictDataParam } from "@/api/system/dict-data/model";
|
||||
import { listDictData } from "@/api/system/dict-data";
|
||||
|
||||
const props = defineProps<{
|
||||
dataSource: SettleDetail[]
|
||||
}>();
|
||||
const tableRef0 = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
const dictList = ref<DictDataParam[]>([]);
|
||||
const getDictList = async () => {
|
||||
dictList.value = await listDictData({ dictId: 147 });
|
||||
};
|
||||
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: "序号",
|
||||
key: "index",
|
||||
width: 48,
|
||||
align: "center",
|
||||
fixed: "left",
|
||||
hideInSetting: true,
|
||||
customRender: ({ index }) => index + (tableRef0.value?.tableIndex ?? 1)
|
||||
},
|
||||
{
|
||||
title: "设备名",
|
||||
dataIndex: "equipmentName",
|
||||
key: "equipmentName"
|
||||
},
|
||||
{
|
||||
title: "设备型号",
|
||||
dataIndex: "equipmentModel",
|
||||
key: "equipmentModel"
|
||||
},
|
||||
{
|
||||
title: "出场编号",
|
||||
dataIndex: "factoryNo",
|
||||
key: "factoryNo"
|
||||
},
|
||||
{
|
||||
title: "费用类型",
|
||||
dataIndex: "settleCostType",
|
||||
key: "settleCostType"
|
||||
},
|
||||
{
|
||||
title: "单价",
|
||||
dataIndex: "singleAmount",
|
||||
key: "singleAmount"
|
||||
},
|
||||
{
|
||||
title: "数量",
|
||||
dataIndex: "num",
|
||||
key: "num"
|
||||
},
|
||||
{
|
||||
title: "单位",
|
||||
dataIndex: "unit",
|
||||
key: "unit"
|
||||
},
|
||||
{
|
||||
title: "含税金额(元)",
|
||||
dataIndex: "amountWithTax",
|
||||
key: "amountWithTax"
|
||||
},
|
||||
{
|
||||
title: "税金(元)",
|
||||
dataIndex: "tax",
|
||||
key: "tax"
|
||||
},
|
||||
{
|
||||
title: "不含税总价(元)",
|
||||
dataIndex: "amountWithoutTax",
|
||||
key: "amountWithoutTax"
|
||||
},
|
||||
{
|
||||
title: "备注",
|
||||
dataIndex: "remark",
|
||||
key: "remark"
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "action",
|
||||
key: "action"
|
||||
}
|
||||
]);
|
||||
|
||||
const dataList = ref<SettleDetail[]>([]);
|
||||
|
||||
const del = (index: number) => {
|
||||
dataList.value.splice(index, 1);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.dataSource,
|
||||
(dataSource) => {
|
||||
dataList.value = dataSource;
|
||||
console.log(dataList.value);
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
getDictList();
|
||||
});
|
||||
|
||||
defineExpose({ dataList })
|
||||
|
||||
</script>
|
||||
205
src/views/tower/settle/components/search.vue
Normal file
205
src/views/tower/settle/components/search.vue
Normal file
@@ -0,0 +1,205 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
<span>新增</span>
|
||||
</a-button>
|
||||
<a-button
|
||||
danger
|
||||
type="primary"
|
||||
class="ele-btn-icon"
|
||||
v-if="selection.length > 0"
|
||||
@click="removeBatch"
|
||||
>
|
||||
<template #icon>
|
||||
<DeleteOutlined />
|
||||
</template>
|
||||
<span>批量删除</span>
|
||||
</a-button>
|
||||
<!-- <a-button @click="batchMove" v-if="selection.length > 0">-->
|
||||
<!-- <template #icon>-->
|
||||
<!-- <UserSwitchOutlined />-->
|
||||
<!-- </template>-->
|
||||
<!-- 批量转移-->
|
||||
<!-- </a-button>-->
|
||||
<a-input-search
|
||||
allow-clear
|
||||
placeholder="请输入关键词"
|
||||
v-model:value="searchText"
|
||||
@pressEnter="search"
|
||||
@search="search"
|
||||
/>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {
|
||||
PlusOutlined,
|
||||
DeleteOutlined,
|
||||
UploadOutlined,
|
||||
DownloadOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import type { CustomerParam } from '@/api/oa/customer/model';
|
||||
import { ref, watch } from 'vue';
|
||||
import { utils, read } from 'xlsx';
|
||||
// import { assignObject } from 'ele-admin-pro';
|
||||
import { message } from 'ant-design-vue/es';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: CustomerParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
|
||||
// 表单数据
|
||||
const { where } = useSearch<CustomerParam>({
|
||||
name: '',
|
||||
creditCode: '',
|
||||
keywords: '',
|
||||
userId: undefined
|
||||
});
|
||||
// 下来选项
|
||||
// 搜索内容
|
||||
const searchText = ref('');
|
||||
|
||||
/* 搜索 */
|
||||
const search = () => {
|
||||
where.keywords = searchText.value;
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
// 新增
|
||||
const add = () => {
|
||||
emit('add');
|
||||
};
|
||||
|
||||
// 导入数据的列
|
||||
const importTitle = ref<string[]>(['A', 'B', 'C', 'D', 'E', 'F', 'G']);
|
||||
// 导入的数据
|
||||
const importData = ref<Record<string, any>[]>([]);
|
||||
// 导入数据二维数组形式
|
||||
const importDataAoa = ref<(string | number)[][]>([]);
|
||||
|
||||
/* 导入本地 excel 文件 */
|
||||
const importBatch = (file: File) => {
|
||||
if (
|
||||
![
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
].includes(file.type)
|
||||
) {
|
||||
message.error('只能选择 excel 文件');
|
||||
return false;
|
||||
}
|
||||
if (file.size / 1024 / 1024 > 20) {
|
||||
message.error('大小不能超过 20MB');
|
||||
return false;
|
||||
}
|
||||
const reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
const data = new Uint8Array(e.target?.result as any);
|
||||
const workbook = read(data, { type: 'array' });
|
||||
const sheetNames = workbook.SheetNames;
|
||||
const worksheet = workbook.Sheets[sheetNames[0]];
|
||||
// 解析成二维数组
|
||||
const aoa = utils.sheet_to_json<string[]>(worksheet, { header: 1 });
|
||||
// 生成表格需要的数据
|
||||
let list: Record<string, any>[] = [];
|
||||
let maxCols = 0;
|
||||
let title: string[] = [];
|
||||
aoa.forEach((d) => {
|
||||
if (d.length > maxCols) {
|
||||
maxCols = d.length;
|
||||
}
|
||||
const row = {};
|
||||
for (let i = 0; i < d.length; i++) {
|
||||
const key = getCharByIndex(i);
|
||||
row[key] = d[i];
|
||||
row['__colspan__' + key] = 1;
|
||||
row['__rowspan__' + key] = 1;
|
||||
}
|
||||
list.push(row);
|
||||
});
|
||||
for (let i = 0; i < maxCols; i++) {
|
||||
title.push(getCharByIndex(i));
|
||||
}
|
||||
importTitle.value = title;
|
||||
importData.value = list;
|
||||
importDataAoa.value = aoa;
|
||||
};
|
||||
console.log(importData.value);
|
||||
console.log(importDataAoa.value);
|
||||
reader.readAsArrayBuffer(file);
|
||||
return false;
|
||||
};
|
||||
/* 生成Excel列字母序号 */
|
||||
const getCharByIndex = (index: number) => {
|
||||
const chars = [
|
||||
'A',
|
||||
'B',
|
||||
'C',
|
||||
'D',
|
||||
'E',
|
||||
'F',
|
||||
'G',
|
||||
'H',
|
||||
'I',
|
||||
'J',
|
||||
'K',
|
||||
'L',
|
||||
'M',
|
||||
'N',
|
||||
'O',
|
||||
'P',
|
||||
'Q',
|
||||
'R',
|
||||
'S',
|
||||
'T',
|
||||
'U',
|
||||
'V',
|
||||
'W',
|
||||
'X',
|
||||
'Y',
|
||||
'Z'
|
||||
];
|
||||
if (index < chars.length) {
|
||||
return chars[index];
|
||||
}
|
||||
const n = parseInt(String(index / chars.length));
|
||||
const m = index % chars.length;
|
||||
return chars[n] + chars[m];
|
||||
};
|
||||
|
||||
// 转移
|
||||
// const batchMove = () => {
|
||||
// emit('batchMove');
|
||||
// };
|
||||
|
||||
// 批量删除
|
||||
const removeBatch = () => {
|
||||
emit('remove');
|
||||
};
|
||||
|
||||
const onClear = () => {
|
||||
where.userId = undefined;
|
||||
search();
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
504
src/views/tower/settle/components/settle-edit.vue
Normal file
504
src/views/tower/settle/components/settle-edit.vue
Normal file
@@ -0,0 +1,504 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="'90%'"
|
||||
:visible="visible"
|
||||
:confirm-loading="loading"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
:title="isUpdate ? '编辑结算' : '添加结算'"
|
||||
:body-style="{ paddingBottom: '8px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
:label-col="{ md: { span: 6 }, sm: { span: 20 }, xs: { span: 24 } }"
|
||||
:wrapper-col="{ md: { span: 24 }, sm: { span: 20 }, xs: { span: 24 } }"
|
||||
>
|
||||
<a-card title="填报人信息" :bordered="false">
|
||||
<a-row :gutter="16">
|
||||
<a-col :md="12" :sm="24" :xs="24">
|
||||
<a-form-item label="填报人">
|
||||
<a-input disabled v-model:value="loginUser.username" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :md="12" :sm="24" :xs="24">
|
||||
<a-form-item label="填报时间">
|
||||
<a-input disabled v-model:value="now" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
<a-card title="结算信息" :bordered="false">
|
||||
<a-row :gutter="16">
|
||||
<a-col :md="8" :sm="24" :xs="24">
|
||||
<a-form-item label="结算项目" v-bind="validateInfos.contractId">
|
||||
<TowerContractSelectModel
|
||||
:placeholder="`请选择结算项目`"
|
||||
v-model:value="contactNumber"
|
||||
@done="chooseContract"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="结算单号" v-bind="validateInfos.settleNo">
|
||||
<a-input v-model:value="form.settleNo" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :md="8" :sm="24" :xs="24">
|
||||
<a-form-item label="本期开始日期" v-bind="validateInfos.startDate">
|
||||
<a-date-picker
|
||||
class="ele-fluid"
|
||||
placeholder="请选择开始日期"
|
||||
v-model:value="form.startDate"
|
||||
valueFormat="YYYY-MM-DD"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="结算方式">
|
||||
<a-select placeholder="请先选择项目" style="width: 250px" size="small" :disabled="!form.contractId"
|
||||
v-model:value="form.settleMethod">
|
||||
<a-select-option v-for="(item, index) in ContractSettleMethod" :key="index" :value="index">
|
||||
{{ item }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :md="8" :sm="24" :xs="24">
|
||||
<a-form-item label="本期结束日期" v-bind="validateInfos.endDate">
|
||||
<a-date-picker
|
||||
class="ele-fluid"
|
||||
placeholder="请选择开始日期"
|
||||
v-model:value="form.endDate"
|
||||
valueFormat="YYYY-MM-DD"
|
||||
/>
|
||||
</a-form-item>
|
||||
<div v-if="[0, 3].indexOf(form.settleMethod) > -1">
|
||||
<span>每月</span>
|
||||
<a-select placeholder="必选项" style="width: 250px" size="small"
|
||||
v-model:value="form.extendMonthDate">
|
||||
<a-select-option v-for="item in dateList" :key="item" :value="item">
|
||||
{{ item }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<span>号</span>
|
||||
<span class="ml-05">至下月</span>
|
||||
<span class="ml-05" v-if="form.extendMonthDate">{{ form.extendMonthDate - 1 }}号</span>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
</a-form>
|
||||
<a-card>
|
||||
<a-tabs v-model:activeKey="activeKey">
|
||||
<a-tab-pane :key="0" tab="租金结算">
|
||||
<template #default>
|
||||
<div class="flex justify-between items-center">
|
||||
<div class="flex-1">
|
||||
<a-button :disabled="!form.contractId || contractEquipmentList.length === 0" type="primary"
|
||||
@click.native="doShowSelectEquipment(0)">
|
||||
选择结算设备
|
||||
</a-button>
|
||||
<a-button class="mx-05" :disabled="!form.contractId || contractEquipmentList.length === 0"
|
||||
type="primary" @click.native="oneKetAddEquipment(0)">一键加载结算设备
|
||||
</a-button>
|
||||
<a-button :disabled="!form.startDate || !form.startDate" type="primary"
|
||||
@click.native="onyKeyAsyncDate(0)">同步结算起止日期
|
||||
</a-button>
|
||||
</div>
|
||||
<a-input style="width: 300px" v-model:value="taxRate[0]" @change="changeTaxRate($event, 0)">
|
||||
<template #prefix>税率</template>
|
||||
<template #addonAfter>%</template>
|
||||
</a-input>
|
||||
</div>
|
||||
<table0 :data-source="dataSource[0]" />
|
||||
</template>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane :key="1" tab="进退场费">
|
||||
<template #default>
|
||||
<div class="flex justify-between items-center">
|
||||
<div class="flex-1">
|
||||
<a-button :disabled="!form.contractId || contractEquipmentList.length === 0" type="primary"
|
||||
@click.native="doShowSelectEquipment(1)">
|
||||
选择结算设备
|
||||
</a-button>
|
||||
<a-button class="mx-05" :disabled="!form.contractId || contractEquipmentList.length === 0"
|
||||
type="primary" @click.native="oneKetAddEquipment(1)">一键加载结算设备
|
||||
</a-button>
|
||||
<a-button :disabled="!form.startDate || !form.startDate" type="primary"
|
||||
@click.native="onyKeyAsyncDate(1)">同步结算起止日期
|
||||
</a-button>
|
||||
</div>
|
||||
<a-input style="width: 300px" v-model:value="taxRate[1]" @change="changeTaxRate($event, 1)">
|
||||
<template #prefix>税率</template>
|
||||
<template #addonAfter>%</template>
|
||||
</a-input>
|
||||
</div>
|
||||
<table1 :data-source="dataSource[1]" />
|
||||
</template>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane :key="2" tab="操作人员工资结算">
|
||||
<template #default>
|
||||
<div class="flex justify-between items-center">
|
||||
<div class="flex-1">
|
||||
<a-button :disabled="!form.contractId || contractEquipmentList.length === 0" type="primary"
|
||||
@click.native="doShowSelectEquipment(2)">
|
||||
选择结算设备
|
||||
</a-button>
|
||||
<a-button class="mx-05" :disabled="!form.contractId || contractEquipmentList.length === 0"
|
||||
type="primary" @click.native="oneKetAddEquipment(2)">一键加载结算设备
|
||||
</a-button>
|
||||
<a-button :disabled="!form.startDate || !form.startDate" type="primary"
|
||||
@click.native="onyKeyAsyncDate(2)">同步结算起止日期
|
||||
</a-button>
|
||||
</div>
|
||||
<a-input style="width: 300px" v-model:value="taxRate[2]" @change="changeTaxRate($event, 2)">
|
||||
<template #prefix>税率</template>
|
||||
<template #addonAfter>%</template>
|
||||
</a-input>
|
||||
</div>
|
||||
<table2 :data-source="dataSource[2]" />
|
||||
</template>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane :key="3" tab="其他费用清单">
|
||||
<template #default>
|
||||
<div class="flex justify-between items-center">
|
||||
<div class="flex-1">
|
||||
<a-button :disabled="!form.contractId || contractEquipmentList.length === 0" type="primary"
|
||||
@click.native="doShowSelectEquipment(3)">
|
||||
选择结算设备
|
||||
</a-button>
|
||||
<a-button class="mx-05" :disabled="!form.contractId || contractEquipmentList.length === 0"
|
||||
type="primary" @click.native="oneKetAddEquipment(3)">一键加载结算设备
|
||||
</a-button>
|
||||
<a-button :disabled="!form.startDate || !form.startDate" type="primary"
|
||||
@click.native="onyKeyAsyncDate(3)">同步结算起止日期
|
||||
</a-button>
|
||||
</div>
|
||||
<a-input style="width: 300px" v-model:value="taxRate[3]" @change="changeTaxRate($event, 3)">
|
||||
<template #prefix>税率</template>
|
||||
<template #addonAfter>%</template>
|
||||
</a-input>
|
||||
</div>
|
||||
<table3 :data-source="dataSource[3]" />
|
||||
</template>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane :key="4" tab="扣除项">
|
||||
<template #default>
|
||||
<div class="flex justify-between items-center">
|
||||
<div class="flex-1">
|
||||
<a-button :disabled="!form.contractId || contractEquipmentList.length === 0" type="primary"
|
||||
@click.native="doShowSelectEquipment(4)">
|
||||
选择结算设备
|
||||
</a-button>
|
||||
<a-button class="mx-05" :disabled="!form.contractId || contractEquipmentList.length === 0"
|
||||
type="primary" @click.native="oneKetAddEquipment(4)">一键加载结算设备
|
||||
</a-button>
|
||||
<a-button :disabled="!form.startDate || !form.startDate" type="primary"
|
||||
@click.native="onyKeyAsyncDate(4)">同步结算起止日期
|
||||
</a-button>
|
||||
</div>
|
||||
<a-input style="width: 300px" v-model:value="taxRate[4]" @change="changeTaxRate($event, 4)">
|
||||
<template #prefix>税率</template>
|
||||
<template #addonAfter>%</template>
|
||||
</a-input>
|
||||
</div>
|
||||
<table4 :data-source="dataSource[4]" />
|
||||
</template>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</a-card>
|
||||
</ele-modal>
|
||||
<ele-modal
|
||||
:width="'80%'"
|
||||
:visible="showSelectEquipment"
|
||||
:maskClosable="false"
|
||||
title="选择设备"
|
||||
:body-style="{ paddingBottom: '8px' }"
|
||||
@update:visible="showSelectEquipment"
|
||||
@cancel="showSelectEquipment = false"
|
||||
@ok="showSelectEquipment = false"
|
||||
>
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="8">设备名称</a-col>
|
||||
<a-col :span="8">设备型号</a-col>
|
||||
<a-col :span="8">操作</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="16" class="my-05" v-for="(item, index) in contractEquipmentList" :key="index">
|
||||
<a-col :span="8">{{ item.equipmentName }}</a-col>
|
||||
<a-col :span="8">{{ item.equipmentModel }}</a-col>
|
||||
<a-col :span="8">
|
||||
<a-button type="link" @click.native="selectEquipment(item)">选择</a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch, computed } from "vue";
|
||||
import { Form, message } from "ant-design-vue";
|
||||
import { assignObject, EleProTable } from "ele-admin-pro";
|
||||
import { useUserStore } from "@/store/modules/user";
|
||||
import { Contract, ContractSettleMethod } from "@/api/tower/contract/model";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
import { Settle } from "@/api/tower/settle/model";
|
||||
import { addSettle, updateSettle } from "@/api/tower/settle";
|
||||
import { ContractEquipment, ContractEquipmentParam } from "@/api/tower/contractEquipment/model";
|
||||
import { SettleDetail } from "@/api/tower/settleDetail/model";
|
||||
import Table0 from "@/views/tower/settle/components/editTable/table0.vue";
|
||||
import { listContractSettleEquipment } from "@/api/tower/contractSettle/equipment";
|
||||
import { ContractSettleEquipment } from "@/api/tower/contractSettle/equipment/model";
|
||||
import Table1 from "@/views/tower/settle/components/editTable/table1.vue";
|
||||
import Table2 from "@/views/tower/settle/components/editTable/table2.vue";
|
||||
import Table3 from "@/views/tower/settle/components/editTable/table3.vue";
|
||||
import Table4 from "@/views/tower/settle/components/editTable/table4.vue";
|
||||
import { addBatchSettleDetail, addSettleDetail, listSettleDetail } from "@/api/tower/settleDetail";
|
||||
|
||||
const userStore = useUserStore();
|
||||
// 当前用户信息
|
||||
const loginUser = computed(() => userStore.info ?? {});
|
||||
|
||||
const now = dayjs().format("YYYY-MM-DD HH:mm:ss");
|
||||
const dateList = ref<number[]>([]);
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: Settle | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: "done"): void;
|
||||
(e: "update:visible", visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxable = ref(true);
|
||||
const activeKey = ref(0);
|
||||
// 用户信息
|
||||
const form = reactive<Settle>({
|
||||
settleId: undefined,
|
||||
settleNo: `JS-${dayjs().format("YYYY-MM-DD")}`,
|
||||
status: undefined,
|
||||
contractId: undefined,
|
||||
startDate: "",
|
||||
endDate: "",
|
||||
settleMethod: undefined,
|
||||
extendMonthDate: undefined,
|
||||
userId: loginUser.value.userId
|
||||
});
|
||||
|
||||
const taxRate = ref([0, 0, 0, 0, 0]);
|
||||
|
||||
const dataSource = ref<Array<SettleDetail>[]>([
|
||||
<SettleDetail[]>[],
|
||||
<SettleDetail[]>[],
|
||||
<SettleDetail[]>[],
|
||||
<SettleDetail[]>[],
|
||||
<SettleDetail[]>[]
|
||||
]);
|
||||
|
||||
const getDataSource = async () => {
|
||||
const res = await listSettleDetail({ settleId: form.settleId });
|
||||
dataSource.value.forEach((item, index) => {
|
||||
dataSource.value[index] = <SettleDetail[]>[];
|
||||
});
|
||||
res.forEach(item => {
|
||||
if ((item.type === 0 || item.type === 2)) {
|
||||
const days = dayjs(item.endDate).diff(dayjs(item.startDate), "day");
|
||||
item.dailyAmount = (item.monthAmount / 30).toFixed(2);
|
||||
item = { ...item, ...{ days } };
|
||||
}
|
||||
dataSource.value[item.type].push(item);
|
||||
taxRate.value[item.type] = parseFloat(item.taxRate);
|
||||
});
|
||||
};
|
||||
|
||||
const contractEquipmentList = ref<ContractSettleEquipment[]>([]);
|
||||
const getContractEquipmentList = async () => {
|
||||
const contractEquipmentParam = <ContractSettleEquipment>{
|
||||
contractId: form.contractId
|
||||
};
|
||||
contractEquipmentList.value = await listContractSettleEquipment(contractEquipmentParam);
|
||||
};
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit("update:visible", value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
contractId: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择项目",
|
||||
trigger: "blur"
|
||||
}
|
||||
],
|
||||
startDate: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择开始日期",
|
||||
trigger: "blur"
|
||||
}
|
||||
],
|
||||
endDate: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择结束日期",
|
||||
trigger: "blur"
|
||||
}
|
||||
],
|
||||
settleNo: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入结算单号",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const contactNumber = ref<string | undefined>("");
|
||||
const chooseContract = (res: Contract) => {
|
||||
contactNumber.value = res.contactNumber;
|
||||
form.contractId = res.contractId;
|
||||
form.settleMethod = res.settleMethod;
|
||||
form.startDate = res.startDate;
|
||||
form.endDate = res.endDate;
|
||||
getContractEquipmentList();
|
||||
};
|
||||
|
||||
const { resetFields, validate, validateInfos } = useForm(form, rules);
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
validate()
|
||||
.then(async () => {
|
||||
loading.value = true;
|
||||
const data = {
|
||||
...form
|
||||
};
|
||||
let totalAmount = 0;
|
||||
dataSource.value.forEach(data => {
|
||||
data.forEach(item => {
|
||||
if ((item.type === 0 || item.type === 2) && item.dailyAmount && item.days) totalAmount += item.dailyAmount * item.days;
|
||||
else if ((item.type === 1 || item.type === 3) && item.singleAmount && item.num) totalAmount += item.singleAmount * item.num;
|
||||
else if (item.type === 4 && item.singleAmount && item.num) totalAmount -= item.singleAmount * item.num;
|
||||
});
|
||||
});
|
||||
data.totalAmount = totalAmount;
|
||||
// 转字符串
|
||||
const saveOrUpdate = isUpdate.value ? updateSettle : addSettle;
|
||||
const res = await saveOrUpdate(data).catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
const settleId = res.data;
|
||||
const detailList = <SettleDetail[]>[];
|
||||
dataSource.value.forEach((data, dataIndex) => {
|
||||
data.forEach((item, index) => {
|
||||
item.settleId = settleId;
|
||||
detailList.push(item);
|
||||
});
|
||||
});
|
||||
await addBatchSettleDetail(detailList);
|
||||
loading.value = false;
|
||||
message.success(res.message);
|
||||
updateVisible(false);
|
||||
emit("done");
|
||||
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
|
||||
const showSelectEquipment = ref<Boolean>(false);
|
||||
const selectEquipmentType = ref<number>(0);
|
||||
const doShowSelectEquipment = (index: number) => {
|
||||
selectEquipmentType.value = index;
|
||||
showSelectEquipment.value = true;
|
||||
};
|
||||
const selectEquipment = (data: ContractSettleEquipment) => {
|
||||
addDataSource(data, selectEquipmentType.value);
|
||||
showSelectEquipment.value = false;
|
||||
};
|
||||
|
||||
const oneKetAddEquipment = index => {
|
||||
contractEquipmentList.value.forEach(data => {
|
||||
addDataSource(data, index);
|
||||
});
|
||||
};
|
||||
|
||||
const addDataSource = (data: ContractSettleEquipment, index) => {
|
||||
let days = 0;
|
||||
if (form.startDate && form.endDate) days = dayjs(form.endDate).diff(dayjs(form.startDate), "day");
|
||||
dataSource.value[index].push({
|
||||
settleDetailId: 0,
|
||||
settleId: 0,
|
||||
type: index,
|
||||
settleCostType: index === 1 ? "进退场费" : "",
|
||||
equipmentName: data.equipmentName,
|
||||
equipmentModel: data.equipmentModel,
|
||||
// factoryNo: data.factoryNo,
|
||||
startDate: form.startDate ?? "",
|
||||
endDate: form.endDate ?? "",
|
||||
monthAmount: 0,
|
||||
taxRate: taxRate.value[index],
|
||||
singleAmount: 0,
|
||||
num: 0,
|
||||
unit: "",
|
||||
remark: "",
|
||||
userId: loginUser.value.userId,
|
||||
days,
|
||||
dailyAmount: 0
|
||||
});
|
||||
};
|
||||
|
||||
const onyKeyAsyncDate = index => {
|
||||
dataSource.value[index].forEach((item, dataIndex) => {
|
||||
dataSource.value[index][dataIndex].startDate = form.startDate;
|
||||
dataSource.value[index][dataIndex].endDate = form.endDate;
|
||||
});
|
||||
};
|
||||
|
||||
const changeTaxRate = ({ target: { value } }, index) => {
|
||||
dataSource.value[index].forEach((item, dataIndex) => {
|
||||
dataSource.value[index][dataIndex].taxRate = parseFloat(value);
|
||||
});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
for (let i = 2; i < 28; i++) dateList.value.push(i);
|
||||
if (visible) {
|
||||
if (props.data) {
|
||||
loading.value = false;
|
||||
assignObject(form, props.data);
|
||||
isUpdate.value = true;
|
||||
contactNumber.value = props.data.contactNumber;
|
||||
getDataSource();
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
contactNumber.value = "";
|
||||
resetFields();
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<style lang="less">
|
||||
.title {
|
||||
font-weight: bold;
|
||||
font-size: 1.1rem;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #dcdfe6;
|
||||
color: #494949;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
148
src/views/tower/settle/components/settle-info.vue
Normal file
148
src/views/tower/settle/components/settle-info.vue
Normal file
@@ -0,0 +1,148 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
width="75%"
|
||||
:visible="visible"
|
||||
:confirm-loading="loading"
|
||||
:title="'合同详情'"
|
||||
:maxable="true"
|
||||
:body-style="{ paddingBottom: '8px' }"
|
||||
@update:visible="updateVisible"
|
||||
:footer="null"
|
||||
>
|
||||
<a-form
|
||||
:label-col="{ md: { span: 4 }, sm: { span: 24 } }"
|
||||
:wrapper-col="{ md: { span: 19 }, sm: { span: 24 } }"
|
||||
>
|
||||
<div class="base-form" style="margin-bottom: 20px">
|
||||
<a-descriptions bordered>
|
||||
<a-descriptions-item label="合同名称">
|
||||
{{ customer.customerName }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="社会统一信用代码">
|
||||
{{ customer.customerCode }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="跟进状态">
|
||||
<div color="blue" v-for="(d, index) in progress" :key="index">
|
||||
<span v-if="d.value == customer.progress">{{ d.label }}</span>
|
||||
</div>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="联系人">
|
||||
{{ customer.customerContacts }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="联系电话">
|
||||
{{ customer.customerMobile }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="座机电话">
|
||||
{{ customer.customerPhone }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="合同类型">
|
||||
<div color="blue" v-for="(d, index) in customerType" :key="index">
|
||||
<span v-if="d.value == customer.customerType">{{ d.value }}</span>
|
||||
</div>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="联系地址">
|
||||
{{ customer.customerAddress }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="备注">
|
||||
{{ customer.comments }}
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
<!-- <a-descriptions-->
|
||||
<!-- title="其他信息"-->
|
||||
<!-- :column="1"-->
|
||||
<!-- bordered-->
|
||||
<!-- style="margin-top: 30px"-->
|
||||
<!-- >-->
|
||||
<!-- <a-descriptions-item label="相关项目">-->
|
||||
<!-- {{ customer.comments }}-->
|
||||
<!-- </a-descriptions-item>-->
|
||||
<!-- </a-descriptions>-->
|
||||
</div>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form } from 'ant-design-vue';
|
||||
import { assignObject } from 'ele-admin-pro';
|
||||
import type { Customer } from '@/api/oa/customer/model';
|
||||
import { FILE_SERVER } from '@/config/setting';
|
||||
import { getDictionaryOptions } from '@/utils/common';
|
||||
|
||||
const useForm = Form.useForm;
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: Customer | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 用户信息
|
||||
const customer = reactive<Customer>({
|
||||
customerCode: '',
|
||||
customerName: '',
|
||||
customerType: undefined,
|
||||
customerMobile: '',
|
||||
customerAvatar: '',
|
||||
customerPhone: '',
|
||||
customerContacts: '',
|
||||
customerAddress: '',
|
||||
comments: '',
|
||||
progress: '',
|
||||
status: '0',
|
||||
sortNumber: 100,
|
||||
customerId: 0
|
||||
});
|
||||
|
||||
// 请求状态
|
||||
const loading = ref(true);
|
||||
|
||||
const { resetFields } = useForm(customer);
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
/* 打开外部链接 */
|
||||
// const openUrl = (record) => {
|
||||
// window.open(record.panel);
|
||||
// };
|
||||
|
||||
/* 获取字典数据 */
|
||||
const customerType = getDictionaryOptions('customerType');
|
||||
const progress = getDictionaryOptions('customerFollowStatus');
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
if (props.data) {
|
||||
loading.value = false;
|
||||
assignObject(customer, props.data);
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<style lang="less">
|
||||
.tab-pane {
|
||||
min-height: 100px;
|
||||
}
|
||||
.card-head {
|
||||
display: flex;
|
||||
height: 40px;
|
||||
align-items: center;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
</style>
|
||||
264
src/views/tower/settle/index.vue
Normal file
264
src/views/tower/settle/index.vue
Normal file
@@ -0,0 +1,264 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<div class="ele-body">
|
||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="settleId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
v-model:selection="selection"
|
||||
tool-class="ele-toolbar-form"
|
||||
:scroll="{ x: 800 }"
|
||||
class="sys-org-table"
|
||||
>
|
||||
<template #toolbar>
|
||||
<search
|
||||
@search="reload"
|
||||
:selection="selection"
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
@batchMove="openMove"
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'createTime'">
|
||||
<a-tooltip :title="`${toDateString(record.createTime)}`">
|
||||
{{ timeAgo(record.createTime) }}
|
||||
</a-tooltip>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a @click="openEdit(record)">修改</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
title="确定要删除此记录吗?"
|
||||
@confirm="remove(record)"
|
||||
>
|
||||
<a class="ele-text-danger">删除</a>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<SettleEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
<!-- 合同详情弹窗 -->
|
||||
<SettleInfo v-model:visible="showInfo" :data="current" @done="reload" />
|
||||
<!-- 批量转移弹窗 -->
|
||||
<!-- <CustomerMove v-model:visible="showMove" :data="selection" @done="batchMove" />-->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, createVNode, ref } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import {
|
||||
ExclamationCircleOutlined,
|
||||
UserOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import { toDateString } from 'ele-admin-pro';
|
||||
import Search from './components/search.vue';
|
||||
import SettleEdit from './components/settle-edit.vue';
|
||||
import SettleInfo from './components/settle-info.vue';
|
||||
import { timeAgo } from 'ele-admin-pro';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import { pageSettle, removeBatchSettle, removeSettle } from "@/api/tower/settle";
|
||||
import { Settle, SettleParam } from "@/api/tower/settle/model";
|
||||
|
||||
const userStore = useUserStore();
|
||||
// 当前用户信息
|
||||
const loginUser = computed(() => userStore.info ?? {});
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<Settle[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<Settle | null>(null);
|
||||
|
||||
// 是否显示资产详情
|
||||
const showInfo = ref(false);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 是否显示批量移动弹窗
|
||||
const showMove = ref(false);
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
limit,
|
||||
where,
|
||||
orders,
|
||||
filters
|
||||
}) => {
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
}
|
||||
return pageSettle({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
key: 'index',
|
||||
width: 48,
|
||||
align: 'center',
|
||||
fixed: 'left',
|
||||
hideInSetting: true,
|
||||
customRender: ({ index }) => index + (tableRef.value?.tableIndex ?? 0)
|
||||
},
|
||||
{
|
||||
title: '结算状态',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
},
|
||||
{
|
||||
title: '项目名称',
|
||||
dataIndex: 'projectName'
|
||||
},
|
||||
{
|
||||
title: '合同编号',
|
||||
dataIndex: 'contactNumber'
|
||||
},
|
||||
{
|
||||
title: '结算开始日期',
|
||||
dataIndex: 'endDate'
|
||||
},
|
||||
{
|
||||
title: '结算结束日期',
|
||||
dataIndex: 'endDate'
|
||||
},
|
||||
{
|
||||
title: '本次结算总额',
|
||||
dataIndex: 'totalAmount'
|
||||
},
|
||||
{
|
||||
title: '制单日期',
|
||||
dataIndex: 'createTime'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 200,
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: SettleParam) => {
|
||||
console.log(where);
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: Settle) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
const showSettle = ref<Boolean>(false)
|
||||
const openSettle = (row?: Settle) => {
|
||||
current.value = row ?? null;
|
||||
showSettle.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 打开用户详情弹窗 */
|
||||
const openInfo = (row?: Settle) => {
|
||||
current.value = row ?? null;
|
||||
showInfo.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: Settle) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeSettle(row.settleId)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
/* 批量转移 */
|
||||
const batchMove = (userId) => {
|
||||
console.log(userId, '批量转移0000');
|
||||
console.log(selection.value);
|
||||
};
|
||||
|
||||
/* 批量删除 */
|
||||
const removeBatch = () => {
|
||||
if (!selection.value.length) {
|
||||
message.error('请至少选择一条数据');
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除选中的记录吗?',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeBatchSettle(
|
||||
selection.value.map((d) => {
|
||||
if (loginUser.value.userId === d.userId) {
|
||||
return d.settleId;
|
||||
}
|
||||
})
|
||||
)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'Accessory'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.sys-org-table :deep(.ant-table-body) {
|
||||
overflow: auto !important;
|
||||
overflow: overlay !important;
|
||||
}
|
||||
|
||||
.sys-org-table :deep(.ant-table-pagination.ant-pagination) {
|
||||
padding: 0 4px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user