完成合同管理模块和公共参数模块
This commit is contained in:
@@ -34,7 +34,7 @@ export interface Category {
|
|||||||
key?: number;
|
key?: number;
|
||||||
//
|
//
|
||||||
merchantCode?: string;
|
merchantCode?: string;
|
||||||
value?: number;
|
value?: any;
|
||||||
// 子菜单
|
// 子菜单
|
||||||
children?: Category[];
|
children?: Category[];
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,8 @@ export interface Category {
|
|||||||
*/
|
*/
|
||||||
export interface CategoryParam extends PageParam {
|
export interface CategoryParam extends PageParam {
|
||||||
title?: string;
|
title?: string;
|
||||||
categoryId?: string;
|
categoryId?: number;
|
||||||
|
parentId?: number;
|
||||||
// 商户编号
|
// 商户编号
|
||||||
merchantCode?: string;
|
merchantCode?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ export interface TowerModel {
|
|||||||
//
|
//
|
||||||
merchantCode?: string;
|
merchantCode?: string;
|
||||||
value?: number;
|
value?: number;
|
||||||
|
index?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
106
src/api/tower/param/place/index.ts
Normal file
106
src/api/tower/param/place/index.ts
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
|
import type { TowerPlace, TowerPlaceParam } from './model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询检查/保养部位
|
||||||
|
*/
|
||||||
|
export async function pageTowerPlace(params: TowerPlaceParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<TowerPlace>>>(
|
||||||
|
'/tower/tower-place/page',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询检查/保养部位列表
|
||||||
|
*/
|
||||||
|
export async function listTowerPlace(params?: TowerPlaceParam) {
|
||||||
|
const res = await request.get<ApiResult<TowerPlace[]>>('/tower/tower-place', {
|
||||||
|
params
|
||||||
|
});
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加检查/保养部位
|
||||||
|
*/
|
||||||
|
export async function addTowerPlace(data: TowerPlace) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-place',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改检查/保养部位
|
||||||
|
*/
|
||||||
|
export async function updateTowerPlace(data: TowerPlace) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>('/tower/tower-place', data);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除检查/保养部位
|
||||||
|
*/
|
||||||
|
export async function removeTowerPlace(id?: number) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-place/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除检查/保养部位
|
||||||
|
*/
|
||||||
|
export async function removeBatchTowerPlace(data: (number | undefined)[]) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-place/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查IP是否存在
|
||||||
|
*/
|
||||||
|
export async function checkExistence(
|
||||||
|
field: string,
|
||||||
|
value: string,
|
||||||
|
id?: number
|
||||||
|
) {
|
||||||
|
const res = await request.get<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-place/existence',
|
||||||
|
{
|
||||||
|
params: { field, value, id }
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
53
src/api/tower/param/place/model/index.ts
Normal file
53
src/api/tower/param/place/model/index.ts
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
import type { PageParam } from '@/api';
|
||||||
|
import { TowerPlaceStandard } from '@/api/tower/param/standard/model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查/保养部位
|
||||||
|
*/
|
||||||
|
export interface TowerPlace {
|
||||||
|
// 参数ID
|
||||||
|
placeId?: number;
|
||||||
|
// 部位编码
|
||||||
|
placeCode?: string;
|
||||||
|
// 设备类型
|
||||||
|
equipmentType?: string;
|
||||||
|
// 部位名称
|
||||||
|
name?: string;
|
||||||
|
// 检查标准
|
||||||
|
standard?: TowerPlaceStandard[];
|
||||||
|
// 部位类型
|
||||||
|
type?: string;
|
||||||
|
// 推送目标系统
|
||||||
|
pushSystem?: string;
|
||||||
|
// 其它项目对应值
|
||||||
|
other_param?: string;
|
||||||
|
// 附件
|
||||||
|
files?: string;
|
||||||
|
// 是否默认显示
|
||||||
|
isShow?: boolean;
|
||||||
|
// 用户ID
|
||||||
|
userId?: string;
|
||||||
|
// 排序
|
||||||
|
sortNumber?: number;
|
||||||
|
// 备注
|
||||||
|
comments?: string;
|
||||||
|
// 状态
|
||||||
|
status?: number;
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string;
|
||||||
|
// 更新时间
|
||||||
|
updateTime?: string;
|
||||||
|
//
|
||||||
|
key?: number;
|
||||||
|
value?: number;
|
||||||
|
index?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索条件
|
||||||
|
*/
|
||||||
|
export interface TowerPlaceParam extends PageParam {
|
||||||
|
name?: string;
|
||||||
|
placeCode?: string;
|
||||||
|
equipmentType?: string;
|
||||||
|
}
|
||||||
112
src/api/tower/param/safety/index.ts
Normal file
112
src/api/tower/param/safety/index.ts
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
|
import type { TowerSafety, TowerSafetyParam } from './model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询安全巡检部位
|
||||||
|
*/
|
||||||
|
export async function pageTowerSafety(params: TowerSafetyParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<TowerSafety>>>(
|
||||||
|
'/tower/tower-safety/page',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询安全巡检部位列表
|
||||||
|
*/
|
||||||
|
export async function listTowerSafety(params?: TowerSafetyParam) {
|
||||||
|
const res = await request.get<ApiResult<TowerSafety[]>>(
|
||||||
|
'/tower/tower-safety',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加安全巡检部位
|
||||||
|
*/
|
||||||
|
export async function addTowerSafety(data: TowerSafety) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-safety',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改安全巡检部位
|
||||||
|
*/
|
||||||
|
export async function updateTowerSafety(data: TowerSafety) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-safety',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除安全巡检部位
|
||||||
|
*/
|
||||||
|
export async function removeTowerSafety(id?: number) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-safety/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除安全巡检部位
|
||||||
|
*/
|
||||||
|
export async function removeBatchTowerSafety(data: (number | undefined)[]) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-safety/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查IP是否存在
|
||||||
|
*/
|
||||||
|
export async function checkExistence(
|
||||||
|
field: string,
|
||||||
|
value: string,
|
||||||
|
id?: number
|
||||||
|
) {
|
||||||
|
const res = await request.get<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-safety/existence',
|
||||||
|
{
|
||||||
|
params: { field, value, id }
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
52
src/api/tower/param/safety/model/index.ts
Normal file
52
src/api/tower/param/safety/model/index.ts
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全巡检部位
|
||||||
|
*/
|
||||||
|
export interface TowerSafety {
|
||||||
|
// 参数ID
|
||||||
|
placeSafetyId?: number;
|
||||||
|
// 部位编码
|
||||||
|
placeCode?: string;
|
||||||
|
// 设备类型
|
||||||
|
equipmentType?: string;
|
||||||
|
// 部位名称
|
||||||
|
name?: string;
|
||||||
|
// 检查标准
|
||||||
|
checkStandard?: string;
|
||||||
|
// 部位类型
|
||||||
|
type?: string;
|
||||||
|
// 推送目标系统
|
||||||
|
pushSystem?: string;
|
||||||
|
// 其它项目对应值
|
||||||
|
other_param?: string;
|
||||||
|
// 附件
|
||||||
|
files?: string;
|
||||||
|
// 是否默认显示
|
||||||
|
isShow?: boolean;
|
||||||
|
// 用户ID
|
||||||
|
userId?: string;
|
||||||
|
// 排序
|
||||||
|
sortNumber?: number;
|
||||||
|
// 备注
|
||||||
|
comments?: string;
|
||||||
|
// 状态
|
||||||
|
status?: number;
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string;
|
||||||
|
// 更新时间
|
||||||
|
updateTime?: string;
|
||||||
|
//
|
||||||
|
key?: number;
|
||||||
|
value?: number;
|
||||||
|
index?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 型号分类搜索条件
|
||||||
|
*/
|
||||||
|
export interface TowerSafetyParam extends PageParam {
|
||||||
|
name?: string;
|
||||||
|
placeCode?: string;
|
||||||
|
equipmentType?: string;
|
||||||
|
}
|
||||||
114
src/api/tower/param/standard/index.ts
Normal file
114
src/api/tower/param/standard/index.ts
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
|
import type { TowerPlaceStandard, TowerPlaceStandardParam } from './model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询检查标准
|
||||||
|
*/
|
||||||
|
export async function pageTowerPlaceStandard(params: TowerPlaceStandardParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<TowerPlaceStandard>>>(
|
||||||
|
'/tower/tower-place-standard/page',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询检查标准列表
|
||||||
|
*/
|
||||||
|
export async function listTowerPlaceStandard(params?: TowerPlaceStandardParam) {
|
||||||
|
const res = await request.get<ApiResult<TowerPlaceStandard[]>>(
|
||||||
|
'/tower/tower-place-standard',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加检查标准
|
||||||
|
*/
|
||||||
|
export async function addTowerPlaceStandard(data: TowerPlaceStandard) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-place-standard',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改检查标准
|
||||||
|
*/
|
||||||
|
export async function updateTowerPlaceStandard(data: TowerPlaceStandard) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-place-standard',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除检查标准
|
||||||
|
*/
|
||||||
|
export async function removeTowerPlaceStandard(id?: number) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-place-standard/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除检查标准
|
||||||
|
*/
|
||||||
|
export async function removeBatchTowerPlaceStandard(
|
||||||
|
data: (number | undefined)[]
|
||||||
|
) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-place-standard/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查IP是否存在
|
||||||
|
*/
|
||||||
|
export async function checkExistence(
|
||||||
|
field: string,
|
||||||
|
value: string,
|
||||||
|
id?: number
|
||||||
|
) {
|
||||||
|
const res = await request.get<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-place-standard/existence',
|
||||||
|
{
|
||||||
|
params: { field, value, id }
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
22
src/api/tower/param/standard/model/index.ts
Normal file
22
src/api/tower/param/standard/model/index.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查标准
|
||||||
|
*/
|
||||||
|
export interface TowerPlaceStandard {
|
||||||
|
id?: number;
|
||||||
|
// 关联部位ID
|
||||||
|
placeId?: number;
|
||||||
|
// 检查标准
|
||||||
|
standard?: string;
|
||||||
|
// 附件
|
||||||
|
files?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索条件
|
||||||
|
*/
|
||||||
|
export interface TowerPlaceStandardParam extends PageParam {
|
||||||
|
id?: number;
|
||||||
|
placeId?: number;
|
||||||
|
}
|
||||||
@@ -1,8 +1,22 @@
|
|||||||
import type { PageParam } from '@/api';
|
import type { PageParam } from '@/api';
|
||||||
|
import { ProjectOrder } from "@/api/tower/project/order/model";
|
||||||
|
import { ProjectPlace } from "@/api/tower/project/place/model";
|
||||||
|
|
||||||
|
interface FileItem {
|
||||||
|
uid: number;
|
||||||
|
name?: string;
|
||||||
|
status?: string;
|
||||||
|
response?: Response;
|
||||||
|
thumbUrl?: string;
|
||||||
|
downloadUrl?: string;
|
||||||
|
url: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Project {
|
export interface Project {
|
||||||
projectId?: number;
|
projectId?: number;
|
||||||
projectName?: string;
|
projectName?: string;
|
||||||
|
projectImage?: string;
|
||||||
|
files?: FileItem[];
|
||||||
companyName?: string;
|
companyName?: string;
|
||||||
customerName?: string;
|
customerName?: string;
|
||||||
projectRegion?: string;
|
projectRegion?: string;
|
||||||
@@ -24,6 +38,8 @@ export interface Project {
|
|||||||
userId?: number;
|
userId?: number;
|
||||||
comments?: string;
|
comments?: string;
|
||||||
sortNumber?: number;
|
sortNumber?: number;
|
||||||
|
orders?: ProjectOrder[];
|
||||||
|
places?: ProjectPlace[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
128
src/api/tower/project/order/index.ts
Normal file
128
src/api/tower/project/order/index.ts
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
|
import type {
|
||||||
|
ProjectOrder,
|
||||||
|
ProjectOrderParam
|
||||||
|
} from '@/api/tower/project/order/model/index';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询合同预定设备清单
|
||||||
|
*/
|
||||||
|
export async function pageProjectOrder(params: ProjectOrderParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<ProjectOrder>>>(
|
||||||
|
'/tower/tower-project-order/page',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询合同预定设备清单列表
|
||||||
|
*/
|
||||||
|
export async function listProjectOrder(params?: ProjectOrderParam) {
|
||||||
|
const res = await request.get<ApiResult<ProjectOrder[]>>(
|
||||||
|
'/tower/tower-project-order',
|
||||||
|
{
|
||||||
|
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 getProjectOrder(id: number) {
|
||||||
|
const res = await request.get<ApiResult<ProjectOrder>>(
|
||||||
|
'/tower/tower-project-order/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加合同预定设备清单
|
||||||
|
*/
|
||||||
|
export async function addProjectOrder(data: ProjectOrder) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-project-order',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改合同预定设备清单
|
||||||
|
*/
|
||||||
|
export async function updateProjectOrder(data: ProjectOrder) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-project-order',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除合同预定设备清单
|
||||||
|
*/
|
||||||
|
export async function removeProjectOrder(id?: number) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-project-order/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除合同预定设备清单
|
||||||
|
*/
|
||||||
|
export async function removeBatchProjectOrder(data: (number | undefined)[]) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-project-order/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查IP是否存在
|
||||||
|
*/
|
||||||
|
export async function checkExistence(
|
||||||
|
field: string,
|
||||||
|
value: string,
|
||||||
|
id?: number
|
||||||
|
) {
|
||||||
|
const res = await request.get<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-project-order/existence',
|
||||||
|
{
|
||||||
|
params: { field, value, id }
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
46
src/api/tower/project/order/model/index.ts
Normal file
46
src/api/tower/project/order/model/index.ts
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同预定设备清单
|
||||||
|
*/
|
||||||
|
export interface ProjectOrder {
|
||||||
|
// 合同预定设备清单id
|
||||||
|
projectOrderId?: number;
|
||||||
|
equipmentName?: string;
|
||||||
|
equipmentModel?: string;
|
||||||
|
equipmentNum?: number;
|
||||||
|
key?: string;
|
||||||
|
unit?: string;
|
||||||
|
startTime?: string;
|
||||||
|
endTime?: string;
|
||||||
|
year?: string;
|
||||||
|
documenter?: string;
|
||||||
|
userId?: number;
|
||||||
|
username?: string;
|
||||||
|
nickname?: string;
|
||||||
|
avatar?: string;
|
||||||
|
email?: string;
|
||||||
|
phone?: string;
|
||||||
|
projectId?: number;
|
||||||
|
comments?: string;
|
||||||
|
status?: string;
|
||||||
|
createTime?: string;
|
||||||
|
isEdit?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同预定设备清单搜索条件
|
||||||
|
*/
|
||||||
|
export interface ProjectOrderParam extends PageParam {
|
||||||
|
projectOrderId?: number;
|
||||||
|
userId?: number;
|
||||||
|
projectId?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UserItem {
|
||||||
|
key: string;
|
||||||
|
isEdit?: boolean;
|
||||||
|
number?: string;
|
||||||
|
name?: string;
|
||||||
|
department?: string;
|
||||||
|
}
|
||||||
128
src/api/tower/project/place/index.ts
Normal file
128
src/api/tower/project/place/index.ts
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
|
import type {
|
||||||
|
ProjectPlace,
|
||||||
|
ProjectPlaceParam
|
||||||
|
} from '@/api/tower/project/place/model/index';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询检查/保养部位配置
|
||||||
|
*/
|
||||||
|
export async function pageProjectPlace(params: ProjectPlaceParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<ProjectPlace>>>(
|
||||||
|
'/tower/tower-project-place/page',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询检查/保养部位配置列表
|
||||||
|
*/
|
||||||
|
export async function listProjectPlace(params?: ProjectPlaceParam) {
|
||||||
|
const res = await request.get<ApiResult<ProjectPlace[]>>(
|
||||||
|
'/tower/tower-project-place',
|
||||||
|
{
|
||||||
|
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 getProjectPlace(id: number) {
|
||||||
|
const res = await request.get<ApiResult<ProjectPlace>>(
|
||||||
|
'/tower/tower-project-place/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加检查/保养部位配置
|
||||||
|
*/
|
||||||
|
export async function addProjectPlace(data: ProjectPlace) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-project-place',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改检查/保养部位配置
|
||||||
|
*/
|
||||||
|
export async function updateProjectPlace(data: ProjectPlace) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-project-place',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除检查/保养部位配置
|
||||||
|
*/
|
||||||
|
export async function removeProjectPlace(id?: number) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-project-place/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除检查/保养部位配置
|
||||||
|
*/
|
||||||
|
export async function removeBatchProjectPlace(data: (number | undefined)[]) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-project-place/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查IP是否存在
|
||||||
|
*/
|
||||||
|
export async function checkExistence(
|
||||||
|
field: string,
|
||||||
|
value: string,
|
||||||
|
id?: number
|
||||||
|
) {
|
||||||
|
const res = await request.get<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-project-place/existence',
|
||||||
|
{
|
||||||
|
params: { field, value, id }
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
23
src/api/tower/project/place/model/index.ts
Normal file
23
src/api/tower/project/place/model/index.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查/保养部位配置
|
||||||
|
*/
|
||||||
|
export interface ProjectPlace {
|
||||||
|
id?: number;
|
||||||
|
projectId?: number;
|
||||||
|
placeId?: number;
|
||||||
|
comments?: string;
|
||||||
|
status?: string;
|
||||||
|
createTime?: string;
|
||||||
|
isEdit?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索条件
|
||||||
|
*/
|
||||||
|
export interface ProjectPlaceParam extends PageParam {
|
||||||
|
id?: number;
|
||||||
|
placeId?: number;
|
||||||
|
projectId?: number;
|
||||||
|
}
|
||||||
128
src/api/tower/project/user/index.ts
Normal file
128
src/api/tower/project/user/index.ts
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
|
import type {
|
||||||
|
ProjectUser,
|
||||||
|
ProjectUserParam
|
||||||
|
} from '@/api/tower/project/user/model/index';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询项目成员
|
||||||
|
*/
|
||||||
|
export async function pageProjectUser(params: ProjectUserParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<ProjectUser>>>(
|
||||||
|
'/tower/tower-project-user/page',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询项目成员列表
|
||||||
|
*/
|
||||||
|
export async function listProjectUser(params?: ProjectUserParam) {
|
||||||
|
const res = await request.get<ApiResult<ProjectUser[]>>(
|
||||||
|
'/tower/tower-project-user',
|
||||||
|
{
|
||||||
|
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 getProjectUser(id: number) {
|
||||||
|
const res = await request.get<ApiResult<ProjectUser>>(
|
||||||
|
'/tower/tower-project-user/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加项目成员
|
||||||
|
*/
|
||||||
|
export async function addProjectUser(data: ProjectUser) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-project-user',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改项目成员
|
||||||
|
*/
|
||||||
|
export async function updateProjectUser(data: ProjectUser) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-project-user',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除项目成员
|
||||||
|
*/
|
||||||
|
export async function removeProjectUser(id?: number) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-project-user/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除项目成员
|
||||||
|
*/
|
||||||
|
export async function removeBatchProjectUser(data: (number | undefined)[]) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-project-user/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查IP是否存在
|
||||||
|
*/
|
||||||
|
export async function checkExistence(
|
||||||
|
field: string,
|
||||||
|
value: string,
|
||||||
|
id?: number
|
||||||
|
) {
|
||||||
|
const res = await request.get<ApiResult<unknown>>(
|
||||||
|
'/tower/tower-project-user/existence',
|
||||||
|
{
|
||||||
|
params: { field, value, id }
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
35
src/api/tower/project/user/model/index.ts
Normal file
35
src/api/tower/project/user/model/index.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目成员
|
||||||
|
*/
|
||||||
|
export interface ProjectUser {
|
||||||
|
// 项目成员id
|
||||||
|
id?: number;
|
||||||
|
role?: number;
|
||||||
|
userId?: number;
|
||||||
|
username?: string;
|
||||||
|
nickname?: string;
|
||||||
|
avatar?: string;
|
||||||
|
email?: string;
|
||||||
|
phone?: string;
|
||||||
|
projectId?: number;
|
||||||
|
status?: string;
|
||||||
|
createTime?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目成员搜索条件
|
||||||
|
*/
|
||||||
|
export interface ProjectUserParam extends PageParam {
|
||||||
|
userId?: number;
|
||||||
|
projectId?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UserItem {
|
||||||
|
key: string;
|
||||||
|
isEdit?: boolean;
|
||||||
|
number?: string;
|
||||||
|
name?: string;
|
||||||
|
department?: string;
|
||||||
|
}
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
|
|
||||||
// 表格数据源
|
// 表格数据源
|
||||||
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
||||||
where.isStaff = true
|
where.isStaff = true;
|
||||||
return pageUsers({
|
return pageUsers({
|
||||||
...where,
|
...where,
|
||||||
...orders,
|
...orders,
|
||||||
|
|||||||
@@ -27,10 +27,11 @@
|
|||||||
import SelectData from './components/select-data.vue';
|
import SelectData from './components/select-data.vue';
|
||||||
import { User } from '@/api/system/user/model';
|
import { User } from '@/api/system/user/model';
|
||||||
|
|
||||||
withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
value?: any;
|
value?: any;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
index?: number;
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
placeholder: '请选择'
|
placeholder: '请选择'
|
||||||
@@ -54,6 +55,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onChange = (row) => {
|
const onChange = (row) => {
|
||||||
|
row.index = Number(props.index);
|
||||||
emit('done', row);
|
emit('done', row);
|
||||||
};
|
};
|
||||||
// 查询租户列表
|
// 查询租户列表
|
||||||
|
|||||||
57
src/components/TowerEquipmentType/index.vue
Normal file
57
src/components/TowerEquipmentType/index.vue
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<!-- 选择下拉框 -->
|
||||||
|
<template>
|
||||||
|
<a-select
|
||||||
|
show-search
|
||||||
|
optionFilterProp="label"
|
||||||
|
:options="data"
|
||||||
|
allow-clear
|
||||||
|
:value="value"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
@update:value="updateValue"
|
||||||
|
@blur="onBlur"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { listCategory } from '@/api/goods/category';
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { Category } from '@/api/goods/category/model';
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'update:value', value: string): void;
|
||||||
|
(e: 'blur'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
value?: string;
|
||||||
|
placeholder?: string;
|
||||||
|
dictCode?: string;
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
placeholder: '请选择分类'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const data = ref<Category[]>([]);
|
||||||
|
|
||||||
|
// 字典数据
|
||||||
|
listCategory({ parentId: 0 }).then((list) => {
|
||||||
|
data.value = list.map((d) => {
|
||||||
|
return {
|
||||||
|
value: d.title,
|
||||||
|
label: d.title,
|
||||||
|
text: d.title
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/* 更新选中数据 */
|
||||||
|
const updateValue = (value: string) => {
|
||||||
|
emit('update:value', value);
|
||||||
|
};
|
||||||
|
/* 失去焦点 */
|
||||||
|
const onBlur = () => {
|
||||||
|
emit('blur');
|
||||||
|
};
|
||||||
|
</script>
|
||||||
146
src/components/TowerPlaceSelect/components/select-data.vue
Normal file
146
src/components/TowerPlaceSelect/components/select-data.vue
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
<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 === 'customerLogo'">
|
||||||
|
<a-image
|
||||||
|
v-if="record.customerAvatar"
|
||||||
|
:src="FILE_THUMBNAIL + record.customerAvatar"
|
||||||
|
:preview="false"
|
||||||
|
:width="45"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<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 { pageTowerModel } from '@/api/tower/model';
|
||||||
|
import { FILE_THUMBNAIL } from '@/config/setting';
|
||||||
|
import { EleProTable } from 'ele-admin-pro';
|
||||||
|
import { TowerModel, TowerModelParam } from '@/api/tower/model/model';
|
||||||
|
import { pageTowerPlace } from "@/api/tower/param/place";
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
// 弹窗是否打开
|
||||||
|
visible: boolean;
|
||||||
|
// 标题
|
||||||
|
title?: string;
|
||||||
|
// 修改回显的数据
|
||||||
|
data?: TowerModel | null;
|
||||||
|
selection?: TowerModel[];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done', data: TowerModel): 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',
|
||||||
|
title: '序号',
|
||||||
|
width: 48,
|
||||||
|
align: 'center',
|
||||||
|
fixed: 'left',
|
||||||
|
hideInSetting: true,
|
||||||
|
customRender: ({ index }) => index + (tableRef.value?.tableIndex ?? 0)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '部位编号',
|
||||||
|
dataIndex: 'placeCode'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '设备类型',
|
||||||
|
dataIndex: 'equipmentType'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '部位名称',
|
||||||
|
dataIndex: 'name'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
align: 'center'
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
// 表格数据源
|
||||||
|
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
||||||
|
// 搜索条件
|
||||||
|
if (searchText.value) {
|
||||||
|
where.keywords = searchText.value;
|
||||||
|
}
|
||||||
|
return pageTowerPlace({
|
||||||
|
...where,
|
||||||
|
...orders,
|
||||||
|
page,
|
||||||
|
limit
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 搜索 */
|
||||||
|
const reload = (where?: TowerModelParam) => {
|
||||||
|
tableRef?.value?.reload({ page: 1, where });
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 自定义行属性 */
|
||||||
|
const customRow = (record: TowerModel) => {
|
||||||
|
return {
|
||||||
|
// 行点击事件
|
||||||
|
onClick: () => {
|
||||||
|
updateVisible(false);
|
||||||
|
emit('done', record);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="less"></style>
|
||||||
65
src/components/TowerPlaceSelect/index.vue
Normal file
65
src/components/TowerPlaceSelect/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 { TowerModel } from '@/api/tower/model/model';
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
value?: any;
|
||||||
|
customerType?: string;
|
||||||
|
placeholder?: string;
|
||||||
|
index?: number;
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
placeholder: '请选择数据'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done', TowerModel): void;
|
||||||
|
(e: 'clear'): void;
|
||||||
|
(e: 'multiple', any): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 是否显示编辑弹窗
|
||||||
|
const showEdit = ref(false);
|
||||||
|
// 当前编辑数据
|
||||||
|
const current = ref<TowerModel | null>(null);
|
||||||
|
|
||||||
|
/* 打开编辑弹窗 */
|
||||||
|
const openEdit = (row?: TowerModel) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showEdit.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onChange = (row) => {
|
||||||
|
// 第几行
|
||||||
|
row.index = Number(props.index);
|
||||||
|
emit('done', row);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -26,13 +26,14 @@
|
|||||||
import { BulbOutlined } from '@ant-design/icons-vue';
|
import { BulbOutlined } from '@ant-design/icons-vue';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import SelectData from './components/select-data.vue';
|
import SelectData from './components/select-data.vue';
|
||||||
import { Customer } from '@/api/oa/customer/model';
|
import { TowerModel } from '@/api/tower/model/model';
|
||||||
|
|
||||||
withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
value?: any;
|
value?: any;
|
||||||
customerType?: string;
|
customerType?: string;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
index?: number;
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
placeholder: '请选择数据'
|
placeholder: '请选择数据'
|
||||||
@@ -40,7 +41,7 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'done', Customer): void;
|
(e: 'done', TowerModel): void;
|
||||||
(e: 'clear'): void;
|
(e: 'clear'): void;
|
||||||
(e: 'multiple', any): void;
|
(e: 'multiple', any): void;
|
||||||
}>();
|
}>();
|
||||||
@@ -48,16 +49,17 @@
|
|||||||
// 是否显示编辑弹窗
|
// 是否显示编辑弹窗
|
||||||
const showEdit = ref(false);
|
const showEdit = ref(false);
|
||||||
// 当前编辑数据
|
// 当前编辑数据
|
||||||
const current = ref<Customer | null>(null);
|
const current = ref<TowerModel | null>(null);
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
/* 打开编辑弹窗 */
|
||||||
const openEdit = (row?: Customer) => {
|
const openEdit = (row?: TowerModel) => {
|
||||||
current.value = row ?? null;
|
current.value = row ?? null;
|
||||||
showEdit.value = true;
|
showEdit.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const onChange = (row) => {
|
const onChange = (row) => {
|
||||||
console.log(row);
|
// 第几行
|
||||||
|
row.index = Number(props.index);
|
||||||
emit('done', row);
|
emit('done', row);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -29,11 +29,6 @@
|
|||||||
v-model:value="form.name"
|
v-model:value="form.name"
|
||||||
@done="chooseEquipmentName"
|
@done="chooseEquipmentName"
|
||||||
/>
|
/>
|
||||||
<!-- <DictSelect-->
|
|
||||||
<!-- dict-code="DeviceAssignment"-->
|
|
||||||
<!-- placeholder="请选择设备"-->
|
|
||||||
<!-- v-model:value="form.name"-->
|
|
||||||
<!-- />-->
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="出厂编号" name="factoryNo">
|
<a-form-item label="出厂编号" name="factoryNo">
|
||||||
<a-input
|
<a-input
|
||||||
@@ -67,11 +62,6 @@
|
|||||||
v-model:value="form.model"
|
v-model:value="form.model"
|
||||||
@done="chooseEquipmentModel"
|
@done="chooseEquipmentModel"
|
||||||
/>
|
/>
|
||||||
<!-- <DictSelect-->
|
|
||||||
<!-- dict-code="EquipmentModel"-->
|
|
||||||
<!-- placeholder="请选择设备型号"-->
|
|
||||||
<!-- v-model:value="form.model"-->
|
|
||||||
<!-- />-->
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="出厂日期" name="factoryDate">
|
<a-form-item label="出厂日期" name="factoryDate">
|
||||||
<a-date-picker
|
<a-date-picker
|
||||||
@@ -96,11 +86,6 @@
|
|||||||
:customer-type="`产权单位`"
|
:customer-type="`产权单位`"
|
||||||
@done="chooseCompanyName"
|
@done="chooseCompanyName"
|
||||||
/>
|
/>
|
||||||
<!-- <DictSelect-->
|
|
||||||
<!-- dict-code="propertyCompany"-->
|
|
||||||
<!-- placeholder="请选择产权单位"-->
|
|
||||||
<!-- v-model:value="form.company"-->
|
|
||||||
<!-- />-->
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col
|
<a-col
|
||||||
|
|||||||
282
src/views/tower/param/place/components/place-edit.vue
Normal file
282
src/views/tower/param/place/components/place-edit.vue
Normal file
@@ -0,0 +1,282 @@
|
|||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<template>
|
||||||
|
<ele-modal
|
||||||
|
:width="750"
|
||||||
|
:visible="visible"
|
||||||
|
:confirm-loading="loading"
|
||||||
|
:title="isUpdate ? '修改部位' : '新建部位'"
|
||||||
|
:body-style="{ paddingBottom: '8px' }"
|
||||||
|
@update:visible="updateVisible"
|
||||||
|
@ok="save"
|
||||||
|
>
|
||||||
|
<a-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
:label-col="styleResponsive ? { md: 6, sm: 6, xs: 24 } : { flex: '90px' }"
|
||||||
|
:wrapper-col="
|
||||||
|
styleResponsive ? { md: 18, sm: 20, xs: 24 } : { flex: '1' }
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<a-row :gutter="16">
|
||||||
|
<a-col
|
||||||
|
v-bind="styleResponsive ? { md: 22, sm: 24, xs: 24 } : { span: 12 }"
|
||||||
|
>
|
||||||
|
<a-form-item label="设备类型" name="equipmentType">
|
||||||
|
<TowerEquipmentType
|
||||||
|
v-model:value="form.equipmentType"
|
||||||
|
valueField="label"
|
||||||
|
placeholder="请选择设备类型"
|
||||||
|
class="ele-fluid"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="部位名称" name="name">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入部位名称"
|
||||||
|
v-model:value="form.name"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="推送系统目标" name="pushSystem">
|
||||||
|
<DictSelect
|
||||||
|
dict-code="PushSystem"
|
||||||
|
placeholder="推送系统目标"
|
||||||
|
v-model:value="form.pushSystem"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="其他项目对应的值" name="otherParam">
|
||||||
|
<a-textarea
|
||||||
|
:rows="3"
|
||||||
|
:maxlength="200"
|
||||||
|
placeholder="其他项目对应的值"
|
||||||
|
v-model:value="form.otherParam"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="部位类型" name="type">
|
||||||
|
<a-checkbox-group
|
||||||
|
v-model:value="placeType"
|
||||||
|
:options="typeOptions"
|
||||||
|
@change="onChangeType"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="默认是否显示" name="isShow">
|
||||||
|
<a-switch
|
||||||
|
checked-children="是"
|
||||||
|
un-checked-children="否"
|
||||||
|
:checked="form.isShow"
|
||||||
|
@update:checked="updateHideValue"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
<StandardList :place-id="form.placeId" v-model:value="form.standard" />
|
||||||
|
</a-form>
|
||||||
|
</ele-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import { message } from 'ant-design-vue/es';
|
||||||
|
import type { FormInstance, Rule } from 'ant-design-vue/es/form';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
|
import useFormData from '@/utils/use-form-data';
|
||||||
|
import StandardList from './standard-list.vue';
|
||||||
|
import type { TowerPlace } from '@/api/tower/param/place/model';
|
||||||
|
import { addTowerPlace, updateTowerPlace } from '@/api/tower/param/place';
|
||||||
|
import DictSelect from '@/views/search/components/apps/components/dict-select.vue';
|
||||||
|
import { createCode } from '@/utils/common';
|
||||||
|
import { listTowerPlaceStandard } from '@/api/tower/param/standard';
|
||||||
|
|
||||||
|
// 是否开启响应式布局
|
||||||
|
const themeStore = useThemeStore();
|
||||||
|
const { styleResponsive } = storeToRefs(themeStore);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done'): void;
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
// 弹窗是否打开
|
||||||
|
visible: boolean;
|
||||||
|
// 修改回显的数据
|
||||||
|
data?: TowerPlace | null;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const formRef = ref<FormInstance | null>(null);
|
||||||
|
// 是否是修改
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
// 提交状态
|
||||||
|
const loading = ref(false);
|
||||||
|
const typeOptions = ['巡检部位', '保养部位'];
|
||||||
|
const placeType = ref<string[]>([]);
|
||||||
|
|
||||||
|
// 表单数据
|
||||||
|
const { form, resetFields, assignFields } = useFormData<TowerPlace>({
|
||||||
|
name: '',
|
||||||
|
placeCode: `BW${createCode()}`,
|
||||||
|
placeId: undefined,
|
||||||
|
equipmentType: undefined,
|
||||||
|
standard: [],
|
||||||
|
type: undefined,
|
||||||
|
isShow: true,
|
||||||
|
status: 0,
|
||||||
|
sortNumber: 100
|
||||||
|
});
|
||||||
|
|
||||||
|
// 表单验证规则
|
||||||
|
const rules = reactive<Record<string, Rule[]>>({
|
||||||
|
equipmentType: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请选择设备类型',
|
||||||
|
type: 'string',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
name: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入设备名称',
|
||||||
|
type: 'string',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
model: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入部位',
|
||||||
|
type: 'string',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
type: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请选择部位类型',
|
||||||
|
type: 'string',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
sortNumber: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入排序号',
|
||||||
|
type: 'number',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const updateHideValue = (isShow) => {
|
||||||
|
if (isShow) {
|
||||||
|
form.isShow = true;
|
||||||
|
}
|
||||||
|
if (!isShow) {
|
||||||
|
form.isShow = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const onChangeType = (e) => {
|
||||||
|
if (e[0] == '巡检部位') {
|
||||||
|
form.type = '巡检';
|
||||||
|
}
|
||||||
|
if (e[0] == '保养部位') {
|
||||||
|
form.type = '保养';
|
||||||
|
}
|
||||||
|
if (placeType.value.length == 2) {
|
||||||
|
form.type = '巡检和保养';
|
||||||
|
}
|
||||||
|
console.log(form.type);
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 保存编辑 */
|
||||||
|
const save = () => {
|
||||||
|
if (!formRef.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(() => {
|
||||||
|
loading.value = true;
|
||||||
|
console.log(form.type);
|
||||||
|
const categoryForm = {
|
||||||
|
...form,
|
||||||
|
isShow: form.isShow ? 1 : 0
|
||||||
|
};
|
||||||
|
const saveOrUpdate = isUpdate.value ? updateTowerPlace : addTowerPlace;
|
||||||
|
saveOrUpdate(categoryForm)
|
||||||
|
.then((msg) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.success(msg);
|
||||||
|
updateVisible(false);
|
||||||
|
emit('done');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 更新visible */
|
||||||
|
const updateVisible = (value: boolean) => {
|
||||||
|
emit('update:visible', value);
|
||||||
|
};
|
||||||
|
|
||||||
|
const reload = () => {
|
||||||
|
// 加载检查标准
|
||||||
|
listTowerPlaceStandard({ placeId: form.placeId }).then((list) => {
|
||||||
|
form.standard = list;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
reload();
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(visible) => {
|
||||||
|
if (visible) {
|
||||||
|
if (props.data) {
|
||||||
|
assignFields({
|
||||||
|
...props.data
|
||||||
|
});
|
||||||
|
// 是否默认显示
|
||||||
|
form.isShow = false;
|
||||||
|
if (Number(props.data.isShow) == 1) {
|
||||||
|
form.isShow = true;
|
||||||
|
}
|
||||||
|
placeType.value = [];
|
||||||
|
if (props.data.type == '巡检和保养') {
|
||||||
|
placeType.value[0] = '巡检部位';
|
||||||
|
placeType.value[1] = '保养部位';
|
||||||
|
}
|
||||||
|
if (props.data.type == '巡检') {
|
||||||
|
placeType.value[0] = '巡检部位';
|
||||||
|
}
|
||||||
|
if (props.data.type == '保养') {
|
||||||
|
placeType.value[0] = '保养部位';
|
||||||
|
}
|
||||||
|
reload();
|
||||||
|
isUpdate.value = true;
|
||||||
|
} else {
|
||||||
|
isUpdate.value = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resetFields();
|
||||||
|
formRef.value?.clearValidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less">
|
||||||
|
.tab-pane {
|
||||||
|
min-height: 300px;
|
||||||
|
}
|
||||||
|
.ml-10 {
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
166
src/views/tower/param/place/components/standard-list.vue
Normal file
166
src/views/tower/param/place/components/standard-list.vue
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
<template>
|
||||||
|
<a-spin :spinning="loading">
|
||||||
|
<a-button type="primary" style="margin-bottom: 10px" @click="add">
|
||||||
|
<span>新增检查标准</span>
|
||||||
|
</a-button>
|
||||||
|
<a-table
|
||||||
|
size="middle"
|
||||||
|
row-key="projectOrderId"
|
||||||
|
:pagination="false"
|
||||||
|
:data-source="list"
|
||||||
|
:columns="columns"
|
||||||
|
>
|
||||||
|
<template #bodyCell="{ column, record, index }">
|
||||||
|
<template v-if="column.key === 'standard'">
|
||||||
|
<a-space direction="vertical">
|
||||||
|
<a-textarea
|
||||||
|
:rows="4"
|
||||||
|
style="width: 500px"
|
||||||
|
:maxlength="200"
|
||||||
|
placeholder="请输入检查/保养标准"
|
||||||
|
v-model:value="record.standard"
|
||||||
|
/>
|
||||||
|
<a-image :src="record.files" v-if="record.files" :width="80" />
|
||||||
|
<a-upload
|
||||||
|
v-else
|
||||||
|
v-model:file-list="record.file"
|
||||||
|
name="file"
|
||||||
|
action="https://file.wsdns.cn/api/file/image"
|
||||||
|
:headers="{ Authorization: token }"
|
||||||
|
@click="onIndex(index)"
|
||||||
|
@change="onFile1"
|
||||||
|
>
|
||||||
|
<a-button>
|
||||||
|
<upload-outlined />
|
||||||
|
上传附件
|
||||||
|
</a-button>
|
||||||
|
</a-upload>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="column.key === 'action'">
|
||||||
|
<a-space>
|
||||||
|
<a class="ele-text-danger" @click="remove(record, index)">删除</a>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</a-spin>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import type { ColumnsType } from 'ant-design-vue/es/table';
|
||||||
|
import { TowerPlaceStandard } from '@/api/tower/param/standard/model';
|
||||||
|
import { TOKEN_STORE_NAME } from '@/config/setting';
|
||||||
|
import { removeTowerPlaceStandard } from '@/api/tower/param/standard';
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
value?: TowerPlaceStandard[];
|
||||||
|
placeId?: number;
|
||||||
|
placeholder?: string;
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
placeholder: '请选择数据'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
interface FileItem {
|
||||||
|
uid: string;
|
||||||
|
name?: string;
|
||||||
|
status?: string;
|
||||||
|
response?: Response;
|
||||||
|
thumbUrl?: string;
|
||||||
|
downloadUrl?: string;
|
||||||
|
url: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface FileInfo {
|
||||||
|
file: FileItem;
|
||||||
|
fileList: FileItem[];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 已添加成员
|
||||||
|
const list = ref<any[]>([]);
|
||||||
|
// 请求状态
|
||||||
|
const loading = ref(false);
|
||||||
|
// token
|
||||||
|
const token = localStorage.getItem(TOKEN_STORE_NAME);
|
||||||
|
const file1 = ref<FileItem[]>();
|
||||||
|
const index = ref<number>(0);
|
||||||
|
|
||||||
|
// 列
|
||||||
|
const columns = reactive<ColumnsType>([
|
||||||
|
{
|
||||||
|
key: 'index',
|
||||||
|
align: 'center',
|
||||||
|
width: 48,
|
||||||
|
customRender: ({ index }) => index + 1,
|
||||||
|
fixed: 'left'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '检查/保养标准',
|
||||||
|
dataIndex: 'standard',
|
||||||
|
key: 'standard'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
align: 'center',
|
||||||
|
width: 70
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
/* 添加 */
|
||||||
|
const add = () => {
|
||||||
|
list.value.push({
|
||||||
|
placeId: props.placeId,
|
||||||
|
isEdit: true,
|
||||||
|
standard: '',
|
||||||
|
files: '',
|
||||||
|
file: ref<FileItem[]>()
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// /* 编辑 */
|
||||||
|
// const edit = (_row: any, index: number) => {
|
||||||
|
// list.value[index].isEdit = true;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// /* 完成编辑 */
|
||||||
|
// const done = (_row: any, index: number) => {
|
||||||
|
// list.value[index].isEdit = false;
|
||||||
|
// };
|
||||||
|
|
||||||
|
// 保存当前id
|
||||||
|
const onIndex = (e) => {
|
||||||
|
index.value = e;
|
||||||
|
};
|
||||||
|
|
||||||
|
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;
|
||||||
|
list.value[index.value].files = file.response.url;
|
||||||
|
}
|
||||||
|
return file;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 删除 */
|
||||||
|
const remove = (_row: any, index: number) => {
|
||||||
|
removeTowerPlaceStandard(_row.id);
|
||||||
|
list.value.splice(index, 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.value,
|
||||||
|
(value) => {
|
||||||
|
if (value) {
|
||||||
|
list.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
258
src/views/tower/param/place/index.vue
Normal file
258
src/views/tower/param/place/index.vue
Normal file
@@ -0,0 +1,258 @@
|
|||||||
|
<template>
|
||||||
|
<div class="ele-body">
|
||||||
|
<a-card :bordered="false">
|
||||||
|
<!-- 表格 -->
|
||||||
|
<ele-pro-table
|
||||||
|
ref="tableRef"
|
||||||
|
row-key="placeId"
|
||||||
|
:columns="columns"
|
||||||
|
:datasource="datasource"
|
||||||
|
:customRow="customRow"
|
||||||
|
v-model:selection="selection"
|
||||||
|
:need-page="false"
|
||||||
|
:expand-icon-column-index="1"
|
||||||
|
:scroll="{ x: 1200 }"
|
||||||
|
cache-key="paramPlace"
|
||||||
|
>
|
||||||
|
<template #toolbar>
|
||||||
|
<a-space>
|
||||||
|
<a-button type="primary" class="ele-btn-icon" @click="openEdit()">
|
||||||
|
<template #icon>
|
||||||
|
<plus-outlined />
|
||||||
|
</template>
|
||||||
|
<span>新建</span>
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
danger
|
||||||
|
type="primary"
|
||||||
|
class="ele-btn-icon"
|
||||||
|
:disabled="selection.length === 0"
|
||||||
|
@click="removeBatch"
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<DeleteOutlined />
|
||||||
|
</template>
|
||||||
|
<span>批量删除</span>
|
||||||
|
</a-button>
|
||||||
|
<!-- 搜索表单 -->
|
||||||
|
<a-input-search
|
||||||
|
allow-clear
|
||||||
|
v-model:value="searchText"
|
||||||
|
placeholder="请输入搜索关键词"
|
||||||
|
@search="search"
|
||||||
|
@pressEnter="search"
|
||||||
|
/>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'isShow'">
|
||||||
|
<a-switch
|
||||||
|
:checked="record.isShow === 1"
|
||||||
|
checked-children="是"
|
||||||
|
un-checked-children="否"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<a-space>
|
||||||
|
<a @click="openEdit(record)">修改</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-popconfirm
|
||||||
|
placement="topRight"
|
||||||
|
title="确定要删除此记录吗?"
|
||||||
|
@confirm="remove(record)"
|
||||||
|
>
|
||||||
|
<a class="ele-text-danger">删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</ele-pro-table>
|
||||||
|
</a-card>
|
||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<PlaceEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { createVNode, ref } from 'vue';
|
||||||
|
import { message } from 'ant-design-vue/es';
|
||||||
|
import {
|
||||||
|
ExclamationCircleOutlined,
|
||||||
|
PlusOutlined
|
||||||
|
} from '@ant-design/icons-vue';
|
||||||
|
import type {
|
||||||
|
DatasourceFunction,
|
||||||
|
ColumnItem
|
||||||
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
|
import { messageLoading } from 'ele-admin-pro/es';
|
||||||
|
import type { EleProTable } from 'ele-admin-pro/es';
|
||||||
|
import type {
|
||||||
|
TowerPlace,
|
||||||
|
TowerPlaceParam
|
||||||
|
} from '@/api/tower/param/place/model';
|
||||||
|
import {
|
||||||
|
listTowerPlace,
|
||||||
|
removeBatchTowerPlace,
|
||||||
|
removeTowerPlace
|
||||||
|
} from '@/api/tower/param/place';
|
||||||
|
import PlaceEdit from './components/place-edit.vue';
|
||||||
|
import { Modal } from 'ant-design-vue';
|
||||||
|
import { removeBatchProject } from '@/api/tower/project';
|
||||||
|
|
||||||
|
// 表格实例
|
||||||
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
|
|
||||||
|
// 表格列配置
|
||||||
|
const columns = ref<ColumnItem[]>([
|
||||||
|
{
|
||||||
|
key: 'index',
|
||||||
|
title: '序号',
|
||||||
|
width: 60,
|
||||||
|
align: 'center',
|
||||||
|
fixed: 'left',
|
||||||
|
hideInSetting: true,
|
||||||
|
customRender: ({ index }) => index + (tableRef.value?.tableIndex ?? 0)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '部位编码',
|
||||||
|
dataIndex: 'placeCode',
|
||||||
|
key: 'placeCode',
|
||||||
|
showSorterTooltip: false,
|
||||||
|
ellipsis: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '设备类型',
|
||||||
|
dataIndex: 'equipmentType',
|
||||||
|
key: 'equipmentType',
|
||||||
|
showSorterTooltip: false,
|
||||||
|
ellipsis: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '部位名称',
|
||||||
|
dataIndex: 'name',
|
||||||
|
key: 'name',
|
||||||
|
showSorterTooltip: false,
|
||||||
|
ellipsis: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '检查/保养标准',
|
||||||
|
dataIndex: 'standard',
|
||||||
|
key: 'standard',
|
||||||
|
showSorterTooltip: false,
|
||||||
|
ellipsis: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '部位类型',
|
||||||
|
dataIndex: 'type',
|
||||||
|
key: 'type',
|
||||||
|
showSorterTooltip: false,
|
||||||
|
ellipsis: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '是否默认显示',
|
||||||
|
dataIndex: 'isShow',
|
||||||
|
key: 'isShow'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
width: 200,
|
||||||
|
align: 'center'
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
// 当前编辑数据
|
||||||
|
const current = ref<TowerPlace | null>(null);
|
||||||
|
const searchText = ref('');
|
||||||
|
// 是否显示编辑弹窗
|
||||||
|
const showEdit = ref(false);
|
||||||
|
// 表格选中数据
|
||||||
|
const selection = ref<TowerPlace[]>([]);
|
||||||
|
|
||||||
|
// 表格数据源
|
||||||
|
const datasource: DatasourceFunction = ({ where }) => {
|
||||||
|
if (searchText.value) {
|
||||||
|
where.keywords = searchText.value;
|
||||||
|
}
|
||||||
|
return listTowerPlace({ ...where });
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 刷新表格 */
|
||||||
|
const reload = (where?: TowerPlaceParam) => {
|
||||||
|
selection.value = [];
|
||||||
|
tableRef?.value?.reload({ where });
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开编辑弹窗 */
|
||||||
|
const openEdit = (row?: TowerPlace | null, id?: number) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showEdit.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const search = (searchText) => {
|
||||||
|
reload({ keywords: searchText });
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 删除单个 */
|
||||||
|
const remove = (row: TowerPlace) => {
|
||||||
|
const hide = messageLoading('请求中..', 0);
|
||||||
|
removeTowerPlace(row.placeId)
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 批量删除 */
|
||||||
|
const removeBatch = () => {
|
||||||
|
console.log(selection.value);
|
||||||
|
if (!selection.value.length) {
|
||||||
|
message.error('请至少选择一条数据');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要删除选中的记录吗?',
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
maskClosable: true,
|
||||||
|
onOk: () => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
removeBatchTowerPlace(selection.value.map((d) => d.placeId))
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 自定义行属性 */
|
||||||
|
const customRow = (record: TowerPlace) => {
|
||||||
|
return {
|
||||||
|
// 行点击事件
|
||||||
|
onClick: () => {
|
||||||
|
// console.log(record);
|
||||||
|
},
|
||||||
|
// 行双击事件
|
||||||
|
onDblclick: () => {
|
||||||
|
openEdit(record);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'TowerPlace'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
195
src/views/tower/param/safety/components/model-edit.vue
Normal file
195
src/views/tower/param/safety/components/model-edit.vue
Normal file
@@ -0,0 +1,195 @@
|
|||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<template>
|
||||||
|
<ele-modal
|
||||||
|
:width="500"
|
||||||
|
:visible="visible"
|
||||||
|
:confirm-loading="loading"
|
||||||
|
:title="isUpdate ? '修改部位' : '新建部位'"
|
||||||
|
:body-style="{ paddingBottom: '8px' }"
|
||||||
|
@update:visible="updateVisible"
|
||||||
|
@ok="save"
|
||||||
|
>
|
||||||
|
<a-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
:label-col="styleResponsive ? { md: 6, sm: 6, xs: 24 } : { flex: '90px' }"
|
||||||
|
:wrapper-col="
|
||||||
|
styleResponsive ? { md: 18, sm: 20, xs: 24 } : { flex: '1' }
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<a-row :gutter="16">
|
||||||
|
<a-col
|
||||||
|
v-bind="styleResponsive ? { md: 22, sm: 24, xs: 24 } : { span: 12 }"
|
||||||
|
>
|
||||||
|
<a-form-item label="设备名称" name="name">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入设备名称"
|
||||||
|
v-model:value="form.name"
|
||||||
|
@pressEnter="save"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="部位" name="model">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入部位"
|
||||||
|
v-model:value="form.model"
|
||||||
|
@pressEnter="save"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="使用年限" name="yearLife">
|
||||||
|
<a-input-number
|
||||||
|
:min="0"
|
||||||
|
style="width: 200px"
|
||||||
|
placeholder="请输入设备使用年限"
|
||||||
|
v-model:value="form.yearLife"
|
||||||
|
/>
|
||||||
|
<span class="ml-10">年</span>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</ele-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import { message } from 'ant-design-vue/es';
|
||||||
|
import type { FormInstance, Rule } from 'ant-design-vue/es/form';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
|
import useFormData from '@/utils/use-form-data';
|
||||||
|
import type { TowerModel } from '@/api/tower/model/model';
|
||||||
|
import { addTowerModel, updateTowerModel } from '@/api/tower/model';
|
||||||
|
|
||||||
|
// 是否开启响应式布局
|
||||||
|
const themeStore = useThemeStore();
|
||||||
|
const { styleResponsive } = storeToRefs(themeStore);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done'): void;
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
// 弹窗是否打开
|
||||||
|
visible: boolean;
|
||||||
|
// 修改回显的数据
|
||||||
|
data?: TowerModel | null;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const formRef = ref<FormInstance | null>(null);
|
||||||
|
// 是否是修改
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
// 提交状态
|
||||||
|
const loading = ref(false);
|
||||||
|
|
||||||
|
// 表单数据
|
||||||
|
const { form, resetFields, assignFields } = useFormData<TowerModel>({
|
||||||
|
name: '',
|
||||||
|
modelId: undefined,
|
||||||
|
model: undefined,
|
||||||
|
image: '',
|
||||||
|
status: 0,
|
||||||
|
yearLife: undefined,
|
||||||
|
sortNumber: 100
|
||||||
|
});
|
||||||
|
|
||||||
|
// 表单验证规则
|
||||||
|
const rules = reactive<Record<string, Rule[]>>({
|
||||||
|
name: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入设备名称',
|
||||||
|
type: 'string',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
model: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入部位',
|
||||||
|
type: 'string',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
yearLife: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入设备使用年限',
|
||||||
|
type: 'number',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
sortNumber: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入排序号',
|
||||||
|
type: 'number',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
/* 保存编辑 */
|
||||||
|
const save = () => {
|
||||||
|
if (!formRef.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(() => {
|
||||||
|
loading.value = true;
|
||||||
|
const categoryForm = {
|
||||||
|
...form
|
||||||
|
};
|
||||||
|
const saveOrUpdate = isUpdate.value ? updateTowerModel : addTowerModel;
|
||||||
|
saveOrUpdate(categoryForm)
|
||||||
|
.then((msg) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.success(msg);
|
||||||
|
updateVisible(false);
|
||||||
|
emit('done');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 更新visible */
|
||||||
|
const updateVisible = (value: boolean) => {
|
||||||
|
emit('update:visible', value);
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(visible) => {
|
||||||
|
if (visible) {
|
||||||
|
if (props.data) {
|
||||||
|
assignFields({
|
||||||
|
...props.data
|
||||||
|
});
|
||||||
|
isUpdate.value = true;
|
||||||
|
} else {
|
||||||
|
isUpdate.value = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resetFields();
|
||||||
|
formRef.value?.clearValidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less">
|
||||||
|
.tab-pane {
|
||||||
|
min-height: 300px;
|
||||||
|
}
|
||||||
|
.ml-10 {
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
185
src/views/tower/param/safety/index.vue
Normal file
185
src/views/tower/param/safety/index.vue
Normal file
@@ -0,0 +1,185 @@
|
|||||||
|
<template>
|
||||||
|
<div class="ele-body">
|
||||||
|
<a-card :bordered="false">
|
||||||
|
<!-- 表格 -->
|
||||||
|
<ele-pro-table
|
||||||
|
ref="tableRef"
|
||||||
|
row-key="modelId"
|
||||||
|
:columns="columns"
|
||||||
|
:datasource="datasource"
|
||||||
|
:customRow="customRow"
|
||||||
|
:need-page="false"
|
||||||
|
:expand-icon-column-index="1"
|
||||||
|
:scroll="{ x: 1200 }"
|
||||||
|
cache-key="towerModel"
|
||||||
|
>
|
||||||
|
<template #toolbar>
|
||||||
|
<a-space>
|
||||||
|
<a-button type="primary" class="ele-btn-icon" @click="openEdit()">
|
||||||
|
<template #icon>
|
||||||
|
<plus-outlined />
|
||||||
|
</template>
|
||||||
|
<span>新建</span>
|
||||||
|
</a-button>
|
||||||
|
<!-- 搜索表单 -->
|
||||||
|
<a-input-search
|
||||||
|
allow-clear
|
||||||
|
v-model:value="searchText"
|
||||||
|
placeholder="请输入搜索关键词"
|
||||||
|
@search="search"
|
||||||
|
@pressEnter="search"
|
||||||
|
/>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<a-space>
|
||||||
|
<a @click="openEdit(record)">修改</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-popconfirm
|
||||||
|
placement="topRight"
|
||||||
|
title="确定要删除此记录吗?"
|
||||||
|
@confirm="remove(record)"
|
||||||
|
>
|
||||||
|
<a class="ele-text-danger">删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</ele-pro-table>
|
||||||
|
</a-card>
|
||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<ModelEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { message } from 'ant-design-vue/es';
|
||||||
|
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type {
|
||||||
|
DatasourceFunction,
|
||||||
|
ColumnItem
|
||||||
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
|
import { messageLoading, toDateString } from 'ele-admin-pro/es';
|
||||||
|
import type { EleProTable } from 'ele-admin-pro/es';
|
||||||
|
import type { TowerModel, TowerModelParam } from '@/api/tower/model/model';
|
||||||
|
import { listTowerModel, removeTowerModel } from '@/api/tower/model';
|
||||||
|
import ModelEdit from '@/views/tower/model/components/model-edit.vue';
|
||||||
|
import { TowerEquipment } from "@/api/tower/equipment/model";
|
||||||
|
|
||||||
|
// 表格实例
|
||||||
|
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: 'name',
|
||||||
|
key: 'name',
|
||||||
|
showSorterTooltip: false,
|
||||||
|
ellipsis: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '设备型号',
|
||||||
|
dataIndex: 'model',
|
||||||
|
key: 'model',
|
||||||
|
showSorterTooltip: false,
|
||||||
|
ellipsis: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '使用年限',
|
||||||
|
dataIndex: 'yearLife',
|
||||||
|
key: 'yearLife',
|
||||||
|
showSorterTooltip: false,
|
||||||
|
ellipsis: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '创建时间',
|
||||||
|
dataIndex: 'createTime',
|
||||||
|
sorter: true,
|
||||||
|
showSorterTooltip: false,
|
||||||
|
ellipsis: true,
|
||||||
|
width: 180,
|
||||||
|
customRender: ({ text }) => toDateString(text)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
width: 200,
|
||||||
|
align: 'center'
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
// 当前编辑数据
|
||||||
|
const current = ref<TowerModel | null>(null);
|
||||||
|
const searchText = ref('');
|
||||||
|
// 是否显示编辑弹窗
|
||||||
|
const showEdit = ref(false);
|
||||||
|
|
||||||
|
// 表格数据源
|
||||||
|
const datasource: DatasourceFunction = ({ where }) => {
|
||||||
|
if (searchText.value) {
|
||||||
|
where.keywords = searchText.value;
|
||||||
|
}
|
||||||
|
return listTowerModel({ ...where });
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 刷新表格 */
|
||||||
|
const reload = (where?: TowerModelParam) => {
|
||||||
|
tableRef?.value?.reload({ where });
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开编辑弹窗 */
|
||||||
|
const openEdit = (row?: TowerModel | null, id?: number) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showEdit.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const search = (searchText) => {
|
||||||
|
reload({ keywords: searchText });
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 删除单个 */
|
||||||
|
const remove = (row: TowerModel) => {
|
||||||
|
const hide = messageLoading('请求中..', 0);
|
||||||
|
removeTowerModel(row.modelId)
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 自定义行属性 */
|
||||||
|
const customRow = (record: TowerModel) => {
|
||||||
|
return {
|
||||||
|
// 行点击事件
|
||||||
|
onClick: () => {
|
||||||
|
// console.log(record);
|
||||||
|
},
|
||||||
|
// 行双击事件
|
||||||
|
onDblclick: () => {
|
||||||
|
openEdit(record);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'TowerModel'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
265
src/views/tower/project/components/equipment-list.vue
Normal file
265
src/views/tower/project/components/equipment-list.vue
Normal file
@@ -0,0 +1,265 @@
|
|||||||
|
<template>
|
||||||
|
<a-spin :spinning="loading">
|
||||||
|
<a-button type="primary" style="margin-bottom: 10px" @click="add">
|
||||||
|
<span>添加</span>
|
||||||
|
</a-button>
|
||||||
|
<a-table
|
||||||
|
size="middle"
|
||||||
|
row-key="projectOrderId"
|
||||||
|
:pagination="false"
|
||||||
|
:data-source="list"
|
||||||
|
:columns="columns"
|
||||||
|
>
|
||||||
|
<template #bodyCell="{ column, record, index }">
|
||||||
|
<template v-if="column.key === 'equipmentName'">
|
||||||
|
<TowerSelectModel
|
||||||
|
v-if="record.isEdit"
|
||||||
|
:placeholder="`请选择设备名称`"
|
||||||
|
v-model:value="record.equipmentName"
|
||||||
|
:index="index"
|
||||||
|
@done="chooseEquipmentName"
|
||||||
|
/>
|
||||||
|
<div v-else>{{ record.equipmentName }}</div>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="column.key === 'equipmentModel'">
|
||||||
|
<TowerSelectModel
|
||||||
|
v-if="record.isEdit"
|
||||||
|
:placeholder="`请选择设备型号`"
|
||||||
|
v-model:value="record.equipmentModel"
|
||||||
|
@done="chooseEquipmentModel"
|
||||||
|
/>
|
||||||
|
<div v-else>{{ record.equipmentModel }}</div>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="column.key === 'equipmentNum'">
|
||||||
|
<a-input
|
||||||
|
v-if="record.isEdit"
|
||||||
|
v-model:value="record.equipmentNum"
|
||||||
|
placeholder="请输入预定数量"
|
||||||
|
/>
|
||||||
|
<div v-else>{{ record.equipmentNum }}</div>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="column.key === 'unit'">
|
||||||
|
<a-input
|
||||||
|
v-if="record.isEdit"
|
||||||
|
v-model:value="record.unit"
|
||||||
|
placeholder="请输入单位"
|
||||||
|
/>
|
||||||
|
<div v-else>{{ record.unit }}</div>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="column.key === 'startTime'">
|
||||||
|
<a-date-picker
|
||||||
|
v-if="record.isEdit"
|
||||||
|
placeholder="预计进场时间"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
v-model:value="record.startTime"
|
||||||
|
/>
|
||||||
|
<div v-else>{{ record.startTime }}</div>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="column.key === 'endTime'">
|
||||||
|
<a-date-picker
|
||||||
|
v-if="record.isEdit"
|
||||||
|
placeholder="预计退场时间"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
v-model:value="record.endTime"
|
||||||
|
/>
|
||||||
|
<div v-else>{{ record.endTime }}</div>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="column.key === 'year'">
|
||||||
|
<a-input-number
|
||||||
|
v-if="record.isEdit"
|
||||||
|
v-model:value="record.year"
|
||||||
|
placeholder="出厂年限"
|
||||||
|
/>
|
||||||
|
<div v-else>{{ record.year }}</div>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="column.key === 'documenter'">
|
||||||
|
<SelectStaff
|
||||||
|
v-if="record.isEdit"
|
||||||
|
:placeholder="`对应资料员`"
|
||||||
|
:index="index"
|
||||||
|
v-model:value="record.documenter"
|
||||||
|
@done="chooseDocumenter"
|
||||||
|
/>
|
||||||
|
<div v-else>{{ record.documenter }}</div>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="column.key === 'comments'">
|
||||||
|
<a-input
|
||||||
|
v-if="record.isEdit"
|
||||||
|
v-model:value="record.comments"
|
||||||
|
placeholder="备注"
|
||||||
|
/>
|
||||||
|
<div v-else>{{ record.comments }}</div>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="column.key === 'action'">
|
||||||
|
<a-space>
|
||||||
|
<a v-if="record.isEdit" @click="done(record, index)">完成</a>
|
||||||
|
<a v-else @click="edit(record, index)">修改</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-popconfirm
|
||||||
|
title="确定要删除此记录吗?"
|
||||||
|
@confirm="remove(record, index)"
|
||||||
|
>
|
||||||
|
<a class="ele-text-danger">删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</a-spin>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import { uuid } from 'ele-admin-pro/es';
|
||||||
|
import type { ColumnsType } from 'ant-design-vue/es/table';
|
||||||
|
import { ProjectOrder } from '@/api/tower/project/order/model';
|
||||||
|
import { removeProjectOrder } from '@/api/tower/project/order';
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
value?: ProjectOrder[];
|
||||||
|
projectId?: number;
|
||||||
|
placeholder?: string;
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
placeholder: '请选择数据'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// 已添加成员
|
||||||
|
const list = ref<ProjectOrder[]>([]);
|
||||||
|
// 请求状态
|
||||||
|
const loading = ref(false);
|
||||||
|
|
||||||
|
// 列
|
||||||
|
const columns = reactive<ColumnsType>([
|
||||||
|
{
|
||||||
|
key: 'index',
|
||||||
|
align: 'center',
|
||||||
|
width: 30,
|
||||||
|
customRender: ({ index }) => index + 1,
|
||||||
|
fixed: 'left'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '设备名称',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'equipmentName',
|
||||||
|
key: 'equipmentName'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '规格型号',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'equipmentModel',
|
||||||
|
key: 'equipmentModel'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '签订数量',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'equipmentNum',
|
||||||
|
key: 'equipmentNum',
|
||||||
|
width: 80
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '单位',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'unit',
|
||||||
|
key: 'unit',
|
||||||
|
width: 60
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '预计进场时间',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'startTime',
|
||||||
|
key: 'startTime'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '预计进场时间',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'endTime',
|
||||||
|
key: 'endTime'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '出厂年限',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'year',
|
||||||
|
key: 'year',
|
||||||
|
width: 80
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '对应资料员',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'documenter',
|
||||||
|
key: 'documenter'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '备注',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'comments',
|
||||||
|
key: 'comments'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
align: 'center',
|
||||||
|
width: 100
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
/* 添加 */
|
||||||
|
const add = () => {
|
||||||
|
list.value.push({
|
||||||
|
projectId: props.projectId,
|
||||||
|
key: uuid(8),
|
||||||
|
isEdit: true,
|
||||||
|
equipmentNum: 1,
|
||||||
|
unit: '台',
|
||||||
|
startTime: undefined,
|
||||||
|
endTime: undefined,
|
||||||
|
year: undefined,
|
||||||
|
documenter: undefined,
|
||||||
|
comments: undefined
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const chooseEquipmentName = (data) => {
|
||||||
|
list.value[data.index].equipmentName = data.name;
|
||||||
|
list.value[data.index].equipmentModel = data.model;
|
||||||
|
list.value[data.index].year = data.yearLife;
|
||||||
|
};
|
||||||
|
|
||||||
|
const chooseEquipmentModel = (data) => {
|
||||||
|
list.value[data.index].equipmentName = data.name;
|
||||||
|
list.value[data.index].equipmentModel = data.model;
|
||||||
|
list.value[data.index].year = data.yearLife;
|
||||||
|
};
|
||||||
|
|
||||||
|
const chooseDocumenter = (data) => {
|
||||||
|
list.value[data.index].documenter = data.nickname;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 编辑 */
|
||||||
|
const edit = (_row: any, index: number) => {
|
||||||
|
list.value[index].isEdit = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 完成编辑 */
|
||||||
|
const done = (_row: any, index: number) => {
|
||||||
|
list.value[index].isEdit = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 删除 */
|
||||||
|
const remove = (_row: any, index: number) => {
|
||||||
|
console.log(_row);
|
||||||
|
removeProjectOrder(_row.projectOrderId);
|
||||||
|
list.value.splice(index, 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.value,
|
||||||
|
(value) => {
|
||||||
|
if (value) {
|
||||||
|
list.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
136
src/views/tower/project/components/inspect-list.vue
Normal file
136
src/views/tower/project/components/inspect-list.vue
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
<template>
|
||||||
|
<a-spin :spinning="loading">
|
||||||
|
<a-space style="margin-bottom: 10px">
|
||||||
|
<TowerPlaceSelect
|
||||||
|
:placeholder="`选择检查部位`"
|
||||||
|
@done="chooseEquipmentName"
|
||||||
|
/>
|
||||||
|
<span>设备名称</span>
|
||||||
|
<div style="width: 200px">
|
||||||
|
<TowerEquipmentType
|
||||||
|
v-model:value="searchText"
|
||||||
|
valueField="label"
|
||||||
|
placeholder="请选择设备名称"
|
||||||
|
class="ele-fluid"
|
||||||
|
@change="onSearch"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</a-space>
|
||||||
|
<a-table
|
||||||
|
size="middle"
|
||||||
|
row-key="id"
|
||||||
|
:pagination="false"
|
||||||
|
:data-source="list"
|
||||||
|
:columns="columns"
|
||||||
|
>
|
||||||
|
<template #bodyCell="{ column, record, index }">
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<a-space>
|
||||||
|
<a class="ele-text-danger" @click="remove(record, index)">移除</a>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</a-spin>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import type { ColumnsType } from 'ant-design-vue/es/table';
|
||||||
|
import { ProjectPlace } from '@/api/tower/project/place/model';
|
||||||
|
import {
|
||||||
|
addProjectPlace,
|
||||||
|
removeProjectPlace
|
||||||
|
} from '@/api/tower/project/place';
|
||||||
|
import { message } from 'ant-design-vue';
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
value?: ProjectPlace[];
|
||||||
|
projectId?: number;
|
||||||
|
placeholder?: string;
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
placeholder: '请选择数据'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done'): void;
|
||||||
|
(e: 'search', text): void;
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 已添加成员
|
||||||
|
const list = ref<ProjectPlace[]>([]);
|
||||||
|
// 请求状态
|
||||||
|
const loading = ref(false);
|
||||||
|
// 搜索内容
|
||||||
|
const searchText = ref(undefined);
|
||||||
|
|
||||||
|
// 列
|
||||||
|
const columns = reactive<ColumnsType>([
|
||||||
|
{
|
||||||
|
key: 'index',
|
||||||
|
title: '序号',
|
||||||
|
align: 'center',
|
||||||
|
width: 48,
|
||||||
|
customRender: ({ index }) => index + 1,
|
||||||
|
fixed: 'left'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '部位编码',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'placeCode',
|
||||||
|
key: 'placeCode'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '设备名称',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'equipmentType',
|
||||||
|
key: 'equipmentType'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '检查部位',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'name',
|
||||||
|
key: 'name'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
align: 'center',
|
||||||
|
width: 100
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
const chooseEquipmentName = (data) => {
|
||||||
|
addProjectPlace({
|
||||||
|
projectId: props.projectId,
|
||||||
|
placeId: data.placeId
|
||||||
|
}).then((msg) => {
|
||||||
|
message.success(msg);
|
||||||
|
emit('done');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const onSearch = () => {
|
||||||
|
emit('search', searchText.value);
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 删除 */
|
||||||
|
const remove = (_row: any, index: number) => {
|
||||||
|
removeProjectPlace(_row.id).then(() => {
|
||||||
|
list.value.splice(index, 1);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.value,
|
||||||
|
(value) => {
|
||||||
|
if (value) {
|
||||||
|
list.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
137
src/views/tower/project/components/maintenance-list.vue
Normal file
137
src/views/tower/project/components/maintenance-list.vue
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
<template>
|
||||||
|
<a-spin :spinning="loading">
|
||||||
|
<a-space style="margin-bottom: 10px">
|
||||||
|
<TowerPlaceSelect
|
||||||
|
:placeholder="`选择保养部位`"
|
||||||
|
@done="chooseEquipmentName"
|
||||||
|
/>
|
||||||
|
<span>设备名称</span>
|
||||||
|
<div style="width: 200px">
|
||||||
|
<TowerEquipmentType
|
||||||
|
v-model:value="searchText"
|
||||||
|
valueField="label"
|
||||||
|
placeholder="请选择设备名称"
|
||||||
|
class="ele-fluid"
|
||||||
|
@change="onSearch"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</a-space>
|
||||||
|
<a-table
|
||||||
|
size="middle"
|
||||||
|
row-key="id"
|
||||||
|
:pagination="false"
|
||||||
|
:data-source="list"
|
||||||
|
:columns="columns"
|
||||||
|
>
|
||||||
|
<template #bodyCell="{ column, record, index }">
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<a-space>
|
||||||
|
<a class="ele-text-danger" @click="remove(record, index)">移除</a>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</a-spin>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import type { ColumnsType } from 'ant-design-vue/es/table';
|
||||||
|
import { ProjectOrder } from '@/api/tower/project/order/model';
|
||||||
|
import {
|
||||||
|
addProjectPlace,
|
||||||
|
removeProjectPlace
|
||||||
|
} from '@/api/tower/project/place';
|
||||||
|
import { message } from 'ant-design-vue';
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
value?: ProjectOrder[];
|
||||||
|
projectId?: number;
|
||||||
|
placeholder?: string;
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
placeholder: '请选择数据'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done'): void;
|
||||||
|
(e: 'search', text): void;
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 已添加成员
|
||||||
|
const list = ref<ProjectOrder[]>([]);
|
||||||
|
// 请求状态
|
||||||
|
const loading = ref(false);
|
||||||
|
// 搜索内容
|
||||||
|
const searchText = ref(undefined);
|
||||||
|
|
||||||
|
// 列
|
||||||
|
const columns = reactive<ColumnsType>([
|
||||||
|
{
|
||||||
|
key: 'index',
|
||||||
|
title: '序号',
|
||||||
|
align: 'center',
|
||||||
|
width: 48,
|
||||||
|
customRender: ({ index }) => index + 1,
|
||||||
|
fixed: 'left'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '部位编码',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'placeCode',
|
||||||
|
key: 'placeCode'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '设备名称',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'equipmentType',
|
||||||
|
key: 'equipmentType'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '保养部位',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'name',
|
||||||
|
key: 'name'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
align: 'center',
|
||||||
|
width: 100
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
const chooseEquipmentName = (data) => {
|
||||||
|
console.log(data);
|
||||||
|
addProjectPlace({
|
||||||
|
projectId: props.projectId,
|
||||||
|
placeId: data.placeId
|
||||||
|
}).then((msg) => {
|
||||||
|
message.success(msg);
|
||||||
|
emit('done');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const onSearch = () => {
|
||||||
|
emit('search', searchText.value);
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 删除 */
|
||||||
|
const remove = (_row: any, index: number) => {
|
||||||
|
removeProjectPlace(_row.id).then(() => {
|
||||||
|
list.value.splice(index, 1);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.value,
|
||||||
|
(value) => {
|
||||||
|
if (value) {
|
||||||
|
list.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<!-- 用户编辑弹窗 -->
|
<!-- 用户编辑弹窗 -->
|
||||||
<template>
|
<template>
|
||||||
<ele-modal
|
<ele-modal
|
||||||
width="80%"
|
width="90%"
|
||||||
:visible="visible"
|
:visible="visible"
|
||||||
:maskClosable="false"
|
:maskClosable="false"
|
||||||
:maxable="maxable"
|
:maxable="maxable"
|
||||||
@@ -26,15 +26,17 @@
|
|||||||
<div class="upload-image">
|
<div class="upload-image">
|
||||||
<ele-image-upload
|
<ele-image-upload
|
||||||
v-model:value="images"
|
v-model:value="images"
|
||||||
:item-style="{ width: '360px', height: '240px' }"
|
:limit="6"
|
||||||
:limit="1"
|
:drag="true"
|
||||||
|
:item-style="{ width: '120px', height: '90px' }"
|
||||||
|
:upload-handler="uploadHandler"
|
||||||
@upload="onUpload"
|
@upload="onUpload"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<a-form-item label="主管部门" name="competentDepartment">
|
<a-form-item label="主管部门" name="competentDepartment">
|
||||||
<a-input
|
<DictSelect
|
||||||
allow-clear
|
dict-code="Department"
|
||||||
placeholder="请输入主管部门"
|
placeholder="请选择主管部门"
|
||||||
v-model:value="form.competentDepartment"
|
v-model:value="form.competentDepartment"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@@ -64,12 +66,20 @@
|
|||||||
@done="chooseCompanyName"
|
@done="chooseCompanyName"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="项目地址" name="projectRegion">
|
<a-form-item label="项目地址" name="region">
|
||||||
|
<a-input-group compact>
|
||||||
<a-input
|
<a-input
|
||||||
allow-clear
|
disabled
|
||||||
placeholder="请输入项目地址"
|
style="width: calc(100% - 32px)"
|
||||||
v-model:value="form.projectRegion"
|
v-model:value="form.projectRegion"
|
||||||
|
placeholder="所属区域"
|
||||||
/>
|
/>
|
||||||
|
<a-tooltip title="选择位置">
|
||||||
|
<a-button @click="openMapPicker">
|
||||||
|
<template #icon><EnvironmentOutlined /></template>
|
||||||
|
</a-button>
|
||||||
|
</a-tooltip>
|
||||||
|
</a-input-group>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="经度" name="longitude">
|
<a-form-item label="经度" name="longitude">
|
||||||
<a-input
|
<a-input
|
||||||
@@ -115,7 +125,6 @@
|
|||||||
<TowerCompany
|
<TowerCompany
|
||||||
:placeholder="`请选择承租单位`"
|
:placeholder="`请选择承租单位`"
|
||||||
v-model:value="form.customerName"
|
v-model:value="form.customerName"
|
||||||
:customer-type="`empty`"
|
|
||||||
@done="chooseCustomerName"
|
@done="chooseCustomerName"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@@ -141,10 +150,11 @@
|
|||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="汽吊规格" name="truckCraneSpecs">
|
<a-form-item label="汽吊规格" name="truckCraneSpecs">
|
||||||
<a-input
|
<DictSelect
|
||||||
allow-clear
|
dict-code="TruckCraneSpecs"
|
||||||
placeholder="请输入汽吊规格"
|
multiple="multiple"
|
||||||
v-model:value="form.truckCraneSpecs"
|
v-model:value="form.truckCraneSpecs"
|
||||||
|
placeholder="选择汽吊规格"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
@@ -164,7 +174,6 @@
|
|||||||
@done="chooseDirector"
|
@done="chooseDirector"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="项目可见范围" name="title" />
|
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col
|
<a-col
|
||||||
v-bind="styleResponsive ? { md: 8, sm: 24, xs: 24 } : { span: 8 }"
|
v-bind="styleResponsive ? { md: 8, sm: 24, xs: 24 } : { span: 8 }"
|
||||||
@@ -176,6 +185,10 @@
|
|||||||
v-model:value="form.projectDirector"
|
v-model:value="form.projectDirector"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col
|
||||||
|
v-bind="styleResponsive ? { md: 8, sm: 24, xs: 24 } : { span: 8 }"
|
||||||
|
>
|
||||||
<a-form-item label="业务负责人" name="salesman">
|
<a-form-item label="业务负责人" name="salesman">
|
||||||
<SelectUser
|
<SelectUser
|
||||||
:placeholder="`请选择业务负责人`"
|
:placeholder="`请选择业务负责人`"
|
||||||
@@ -188,79 +201,133 @@
|
|||||||
</a-card>
|
</a-card>
|
||||||
|
|
||||||
<a-divider style="height: 8px" />
|
<a-divider style="height: 8px" />
|
||||||
<a-card title="项目联系人" :bordered="false">
|
<a-card title="项目成员" :bordered="false">
|
||||||
<a-row :gutter="16">
|
<div class="content">
|
||||||
<a-col
|
<a-space style="margin-bottom: 15px" v-if="isUpdate">
|
||||||
v-bind="styleResponsive ? { md: 8, sm: 24, xs: 24 } : { span: 8 }"
|
<SelectStaff :placeholder="`添加可见成员`" @done="onViewUsers" />
|
||||||
|
<SelectStaff
|
||||||
|
:placeholder="`添加项目联系人`"
|
||||||
|
@done="onContactUsers"
|
||||||
/>
|
/>
|
||||||
<a-col
|
</a-space>
|
||||||
v-bind="
|
<table
|
||||||
styleResponsive ? { md: 12, sm: 24, xs: 24 } : { span: 16 }
|
class="ele-table ele-table-border ele-table-stripe ele-table-medium"
|
||||||
"
|
>
|
||||||
/>
|
<thead>
|
||||||
<a-col
|
<tr>
|
||||||
v-bind="styleResponsive ? { md: 6, sm: 24, xs: 24 } : { span: 8 }"
|
<th>类型</th>
|
||||||
/>
|
<th>姓名</th>
|
||||||
</a-row>
|
<th>手机号码</th>
|
||||||
|
<th>加入时间</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr v-for="user in projectUsers">
|
||||||
|
<td>
|
||||||
|
<a-tag color="green" v-if="user.role === 10"
|
||||||
|
>可见成员</a-tag
|
||||||
|
>
|
||||||
|
<a-tag color="orange" v-if="user.role === 20"
|
||||||
|
>项目联系人</a-tag
|
||||||
|
>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a-avatar :src="user.avatar">
|
||||||
|
<template #icon>
|
||||||
|
<user-outlined />
|
||||||
|
</template>
|
||||||
|
</a-avatar>
|
||||||
|
<span style="padding-left: 5px">{{ user.nickname }}</span>
|
||||||
|
</td>
|
||||||
|
<td>{{ user.phone }}</td>
|
||||||
|
<td>{{ user.createTime }}</td>
|
||||||
|
<td>
|
||||||
|
<div v-if="user.role !== 30">
|
||||||
|
<a @click="removeUser(user)" v-if="user.status === 0">
|
||||||
|
移除
|
||||||
|
</a>
|
||||||
|
<a v-else>待确认</a>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
|
||||||
<a-divider style="height: 8px" />
|
<a-divider style="height: 8px" />
|
||||||
<a-card title="合同签订设备清单" :bordered="false">
|
<a-card title="合同签订设备清单" :bordered="false">
|
||||||
<a-row :gutter="16">
|
<EquipmentList
|
||||||
<a-col
|
:project-id="form.projectId"
|
||||||
v-bind="styleResponsive ? { md: 8, sm: 24, xs: 24 } : { span: 8 }"
|
v-model:value="form.orders"
|
||||||
/>
|
/>
|
||||||
<a-col
|
|
||||||
v-bind="
|
|
||||||
styleResponsive ? { md: 12, sm: 24, xs: 24 } : { span: 16 }
|
|
||||||
"
|
|
||||||
/>
|
|
||||||
<a-col
|
|
||||||
v-bind="styleResponsive ? { md: 6, sm: 24, xs: 24 } : { span: 8 }"
|
|
||||||
/>
|
|
||||||
</a-row>
|
|
||||||
</a-card>
|
</a-card>
|
||||||
|
|
||||||
<a-divider style="height: 8px" />
|
<a-divider style="height: 8px" />
|
||||||
<a-card title="检查/保养部位配置" :bordered="false">
|
<a-card title="检查/保养部位配置" :bordered="false">
|
||||||
<a-row :gutter="16">
|
<a-tabs v-model:activeKey="activeKey" type="card" @change="onChange">
|
||||||
<a-col
|
<a-tab-pane key="1" tab="检查部位">
|
||||||
v-bind="styleResponsive ? { md: 8, sm: 24, xs: 24 } : { span: 8 }"
|
<InspectList
|
||||||
|
:project-id="form.projectId"
|
||||||
|
v-model:value="form.places"
|
||||||
|
@done="reload"
|
||||||
|
@search="onSearch"
|
||||||
/>
|
/>
|
||||||
<a-col
|
</a-tab-pane>
|
||||||
v-bind="
|
<a-tab-pane key="2" tab="保养部位" force-render>
|
||||||
styleResponsive ? { md: 12, sm: 24, xs: 24 } : { span: 16 }
|
<MaintenanceList
|
||||||
"
|
:project-id="form.projectId"
|
||||||
|
v-model:value="form.places"
|
||||||
|
@done="reload"
|
||||||
|
@search="onSearch"
|
||||||
/>
|
/>
|
||||||
<a-col
|
</a-tab-pane>
|
||||||
v-bind="styleResponsive ? { md: 6, sm: 24, xs: 24 } : { span: 8 }"
|
</a-tabs>
|
||||||
/>
|
|
||||||
</a-row>
|
|
||||||
</a-card>
|
</a-card>
|
||||||
</a-form>
|
</a-form>
|
||||||
|
<!-- 地图位置选择弹窗 -->
|
||||||
|
<ele-map-picker
|
||||||
|
:need-city="true"
|
||||||
|
:dark-mode="darkMode"
|
||||||
|
v-model:visible="showMap"
|
||||||
|
:center="[108.374959, 22.767024]"
|
||||||
|
:search-type="1"
|
||||||
|
:zoom="12"
|
||||||
|
@done="onDone"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</ele-modal>
|
</ele-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, reactive, watch, computed } from 'vue';
|
import { ref, reactive, watch } from 'vue';
|
||||||
import { Form, message } from 'ant-design-vue';
|
import { Form, message } from 'ant-design-vue';
|
||||||
import { assignObject, toDateString } from 'ele-admin-pro';
|
import { assignObject } from 'ele-admin-pro';
|
||||||
import { addProject, updateProject } from '@/api/tower/project';
|
import { addProject, updateProject } from '@/api/tower/project';
|
||||||
import type { Project } from '@/api/tower/project/model';
|
import type { Project } from '@/api/tower/project/model';
|
||||||
import { useUserStore } from '@/store/modules/user';
|
|
||||||
import { useThemeStore } from '@/store/modules/theme';
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { UploadOutlined } from '@/layout/menu-icons';
|
import { EnvironmentOutlined } from '@ant-design/icons-vue';
|
||||||
import {
|
|
||||||
addTowerEquipment,
|
|
||||||
updateTowerEquipment
|
|
||||||
} from '@/api/tower/equipment';
|
|
||||||
import { FormInstance } from 'ant-design-vue/es/form';
|
import { FormInstance } from 'ant-design-vue/es/form';
|
||||||
import { Customer } from '@/api/oa/customer/model';
|
import { Customer } from '@/api/oa/customer/model';
|
||||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||||
import DictSelect from '@/views/search/components/dict-select.vue';
|
import DictSelect from '@/views/search/components/dict-select.vue';
|
||||||
import { User } from '@/api/system/user/model';
|
import { User } from '@/api/system/user/model';
|
||||||
|
import { uploadFile } from '@/api/system/file';
|
||||||
|
import { FILE_SERVER } from '@/config/setting';
|
||||||
|
import EquipmentList from './equipment-list.vue';
|
||||||
|
import InspectList from './inspect-list.vue';
|
||||||
|
import MaintenanceList from './maintenance-list.vue';
|
||||||
|
import { CenterPoint } from 'ele-admin-pro/es/ele-map-picker/types';
|
||||||
|
import {
|
||||||
|
addProjectUser,
|
||||||
|
listProjectUser,
|
||||||
|
removeProjectUser
|
||||||
|
} from '@/api/tower/project/user';
|
||||||
|
import { ProjectUser } from '@/api/tower/project/user/model';
|
||||||
|
import { listProjectOrder } from '@/api/tower/project/order';
|
||||||
|
import { listProjectPlace } from '@/api/tower/project/place';
|
||||||
|
|
||||||
// 是否是修改
|
// 是否是修改
|
||||||
const isUpdate = ref(false);
|
const isUpdate = ref(false);
|
||||||
@@ -285,56 +352,25 @@
|
|||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
// 是否显示最大化切换按钮
|
// 是否显示最大化切换按钮
|
||||||
const maxable = ref(true);
|
const maxable = ref(true);
|
||||||
// 当期时间
|
|
||||||
const dayTime = toDateString(new Date());
|
|
||||||
// 已上传数据
|
// 已上传数据
|
||||||
const images = ref<ItemType[]>([]);
|
const images = ref<ItemType[]>([]);
|
||||||
// 类型 single|multiple
|
// 是否显示地图选择弹窗
|
||||||
// const type = ref<string>('single');
|
const showMap = ref(false);
|
||||||
// 日期范围选择
|
const activeKey = ref<string>('1');
|
||||||
const dateRange = ref<[string, string]>(['', '']);
|
const keywords = ref<string>();
|
||||||
|
// 项目成员
|
||||||
// 穿梭框数据
|
const projectUsers = ref<ProjectUser[]>([]);
|
||||||
const breakfast = ref<any[]>();
|
// 省市区
|
||||||
const targetKeys1 = ref<any[]>([]);
|
const city = ref<string[]>([]);
|
||||||
const selectedKeys1 = ref<any[]>();
|
const { darkMode } = storeToRefs(themeStore);
|
||||||
const lunch = ref<any[]>();
|
|
||||||
const targetKeys2 = ref<any[]>([]);
|
|
||||||
const selectedKeys2 = ref<any[]>();
|
|
||||||
const dinner = ref<any[]>();
|
|
||||||
const targetKeys3 = ref<any[]>([]);
|
|
||||||
const selectedKeys3 = ref<any[]>();
|
|
||||||
const selectedGoodsIds = ref<any[]>([]);
|
|
||||||
|
|
||||||
const formRef = ref<FormInstance | null>(null);
|
const formRef = ref<FormInstance | null>(null);
|
||||||
|
|
||||||
// 合并选中的项目
|
|
||||||
const onChange1 = () => {
|
|
||||||
selectedGoodsIds.value = [
|
|
||||||
...targetKeys1.value,
|
|
||||||
...targetKeys2.value,
|
|
||||||
...targetKeys3.value
|
|
||||||
];
|
|
||||||
};
|
|
||||||
const onChange2 = () => {
|
|
||||||
selectedGoodsIds.value = [
|
|
||||||
...targetKeys1.value,
|
|
||||||
...targetKeys2.value,
|
|
||||||
...targetKeys3.value
|
|
||||||
];
|
|
||||||
};
|
|
||||||
const onChange3 = () => {
|
|
||||||
selectedGoodsIds.value = [
|
|
||||||
...targetKeys1.value,
|
|
||||||
...targetKeys2.value,
|
|
||||||
...targetKeys3.value
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
// 用户信息
|
// 用户信息
|
||||||
const form = reactive<Project>({
|
const form = reactive<Project>({
|
||||||
projectId: undefined,
|
projectId: undefined,
|
||||||
projectName: '',
|
projectName: '',
|
||||||
|
projectImage: '',
|
||||||
|
files: undefined,
|
||||||
companyName: '',
|
companyName: '',
|
||||||
customerName: '',
|
customerName: '',
|
||||||
projectRegion: '',
|
projectRegion: '',
|
||||||
@@ -355,7 +391,8 @@
|
|||||||
status: 0,
|
status: 0,
|
||||||
userId: 0,
|
userId: 0,
|
||||||
comments: '',
|
comments: '',
|
||||||
sortNumber: 100
|
sortNumber: 100,
|
||||||
|
orders: []
|
||||||
});
|
});
|
||||||
|
|
||||||
/* 更新visible */
|
/* 更新visible */
|
||||||
@@ -381,6 +418,14 @@
|
|||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
projectStatus: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
type: 'string',
|
||||||
|
message: '请选择项目状态',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
progress: [
|
progress: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
@@ -423,8 +468,6 @@
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
const { resetFields, validate, validateInfos } = useForm(form, rules);
|
|
||||||
|
|
||||||
const chooseCompanyName = (data: Customer) => {
|
const chooseCompanyName = (data: Customer) => {
|
||||||
form.companyName = data.customerName;
|
form.companyName = data.customerName;
|
||||||
};
|
};
|
||||||
@@ -445,6 +488,116 @@
|
|||||||
form.salesman = data.nickname;
|
form.salesman = data.nickname;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 添加可见成员
|
||||||
|
const onViewUsers = (data: User) => {
|
||||||
|
console.log(data.userId);
|
||||||
|
addProjectUser({
|
||||||
|
userId: data.userId,
|
||||||
|
projectId: props.data?.projectId,
|
||||||
|
role: 10
|
||||||
|
})
|
||||||
|
.then((msg) => {
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 添加项目联系人
|
||||||
|
const onContactUsers = (data: User) => {
|
||||||
|
console.log(data.userId);
|
||||||
|
addProjectUser({
|
||||||
|
userId: data.userId,
|
||||||
|
projectId: props.data?.projectId,
|
||||||
|
role: 20
|
||||||
|
})
|
||||||
|
.then((msg) => {
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 移除成员
|
||||||
|
const removeUser = (data: ProjectUser) => {
|
||||||
|
removeProjectUser(data.id)
|
||||||
|
.then((msg) => {
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 地图选择后回调 */
|
||||||
|
const onDone = (location: CenterPoint) => {
|
||||||
|
console.log(location);
|
||||||
|
city.value = [
|
||||||
|
`${location.city?.province}`,
|
||||||
|
`${location.city?.city}`,
|
||||||
|
`${location.city?.district}`
|
||||||
|
];
|
||||||
|
form.projectRegion = `${location.city?.city} ${location.city?.district}`;
|
||||||
|
// form.province = `${location.city?.province}`;
|
||||||
|
// form.city = `${location.city?.city}`;
|
||||||
|
// form.region = `${location.city?.district}`;
|
||||||
|
form.projectAddress = `${location.address}`;
|
||||||
|
form.latitude = `${location.lat}`;
|
||||||
|
form.longitude = `${location.lng}`;
|
||||||
|
showMap.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开位置选择 */
|
||||||
|
const openMapPicker = () => {
|
||||||
|
showMap.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 上传事件 */
|
||||||
|
const uploadHandler = (file: File) => {
|
||||||
|
const item: ItemType = {
|
||||||
|
file,
|
||||||
|
uid: (file as any).uid,
|
||||||
|
name: file.name
|
||||||
|
};
|
||||||
|
if (!file.type.startsWith('image')) {
|
||||||
|
message.error('只能选择图片');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (file.size / 1024 / 1024 > 2) {
|
||||||
|
message.error('大小不能超过 2MB');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
onUpload(item);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 上传文件
|
||||||
|
const onUpload = (item) => {
|
||||||
|
const { file } = item;
|
||||||
|
uploadFile(file)
|
||||||
|
.then((data) => {
|
||||||
|
images.value.push({
|
||||||
|
uid: data.id,
|
||||||
|
url: FILE_SERVER + data.path,
|
||||||
|
status: 'done'
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const onSearch = (text) => {
|
||||||
|
keywords.value = text;
|
||||||
|
reload();
|
||||||
|
};
|
||||||
|
|
||||||
|
const { resetFields, validate, validateInfos } = useForm(form, rules);
|
||||||
|
|
||||||
/* 保存编辑 */
|
/* 保存编辑 */
|
||||||
const save = () => {
|
const save = () => {
|
||||||
if (!formRef.value) {
|
if (!formRef.value) {
|
||||||
@@ -455,7 +608,9 @@
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const formData = {
|
const formData = {
|
||||||
...form
|
...form,
|
||||||
|
projectImage: JSON.stringify(images.value),
|
||||||
|
truckCraneSpecs: JSON.stringify(form.truckCraneSpecs)
|
||||||
};
|
};
|
||||||
const saveOrUpdate = isUpdate.value ? updateProject : addProject;
|
const saveOrUpdate = isUpdate.value ? updateProject : addProject;
|
||||||
saveOrUpdate(formData)
|
saveOrUpdate(formData)
|
||||||
@@ -473,10 +628,50 @@
|
|||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
};
|
};
|
||||||
|
|
||||||
const reload = () => {
|
const onChange = () => {
|
||||||
loading.value = true;
|
if (activeKey.value == '1') {
|
||||||
|
keywords.value = '巡检';
|
||||||
|
}
|
||||||
|
if (activeKey.value == '2') {
|
||||||
|
keywords.value = '保养';
|
||||||
|
}
|
||||||
|
reload();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const reload = () => {
|
||||||
|
loading.value = true;
|
||||||
|
// 加载项目成员
|
||||||
|
listProjectUser({
|
||||||
|
projectId: props.data?.projectId
|
||||||
|
}).then((data) => {
|
||||||
|
projectUsers.value = data;
|
||||||
|
});
|
||||||
|
// 加载项目合同预定设备清单
|
||||||
|
listProjectOrder({ projectId: props.data?.projectId })
|
||||||
|
.then((data) => {
|
||||||
|
console.log(data);
|
||||||
|
form.orders = data.map((d) => {
|
||||||
|
return {
|
||||||
|
...d,
|
||||||
|
isEdit: false
|
||||||
|
};
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
// 加载检查/保养部位配置
|
||||||
|
listProjectPlace({
|
||||||
|
projectId: props.data?.projectId,
|
||||||
|
keywords: keywords.value
|
||||||
|
})
|
||||||
|
.then((data) => {
|
||||||
|
form.places = data;
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
};
|
||||||
reload();
|
reload();
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
@@ -485,6 +680,21 @@
|
|||||||
if (visible) {
|
if (visible) {
|
||||||
if (props.data) {
|
if (props.data) {
|
||||||
assignObject(form, props.data);
|
assignObject(form, props.data);
|
||||||
|
|
||||||
|
images.value = [];
|
||||||
|
if (props.data.projectImage) {
|
||||||
|
const arr = JSON.parse(props.data.projectImage);
|
||||||
|
arr.map((d) => {
|
||||||
|
images.value.push({
|
||||||
|
uid: d.uid,
|
||||||
|
url: d.url,
|
||||||
|
status: 'done'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (props.data.truckCraneSpecs) {
|
||||||
|
form.truckCraneSpecs = JSON.parse(props.data.truckCraneSpecs);
|
||||||
|
}
|
||||||
reload();
|
reload();
|
||||||
isUpdate.value = true;
|
isUpdate.value = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -496,8 +706,6 @@
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
<style lang="less"></style>
|
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
.tab-pane {
|
.tab-pane {
|
||||||
min-height: 300px;
|
min-height: 300px;
|
||||||
@@ -515,5 +723,6 @@
|
|||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user