固定资产项目前端文件
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

577 lines
18 KiB

2 years ago
import { HttpClient } from '@angular/common/http'
2 years ago
import { Injectable } from '@angular/core'
2 years ago
import { JwResponse } from 'app/types'
2 years ago
import { Utils } from 'app/utils'
2 years ago
import { of, tap } from 'rxjs'
import { AuthDTO } from './api.dto'
2 years ago
import { PermissionService } from 'app/shared/permission/permission.service'
import { NzSafeAny } from 'ng-zorro-antd/core/types'
2 years ago
export interface UserGroupTreeItem {
name: string
id: string
parentId: string
children: UserGroupTreeItem[]
}
@Injectable({
providedIn: 'root',
})
export class ApiService {
constructor(
private http: HttpClient,
private permission: PermissionService,
) {}
AUTH_KEY_NAME = 'auth'
2 years ago
get authInfo(): AuthDTO | null {
let authInfo: AuthDTO | null = null
try {
const strData = localStorage.getItem(this.AUTH_KEY_NAME)
if (strData) {
authInfo = JSON.parse(strData)
}
} catch (error) {}
return authInfo
2 years ago
}
2 years ago
getAuthInfo() {
return of(Boolean(this.authInfo))
}
removeAuthData() {
localStorage.removeItem(this.AUTH_KEY_NAME)
2 years ago
}
upload(data: FormData) {
return this.http.post<JwResponse>('/api/common/upload', data)
2 years ago
}
login(data: {}) {
return this.http.post<JwResponse>('/api/oauth/login', data).pipe(
tap((res) => {
localStorage.setItem(this.AUTH_KEY_NAME, JSON.stringify(res.body))
}),
)
2 years ago
}
logout() {
return this.http.post<JwResponse>('/api/oauth/logout', null)
2 years ago
}
2 years ago
getHomeTodocountData() {
return this.http.post<JwResponse>('/api/flowable/task/todoListCount', null)
}
getHomeData() {
return this.http.post<JwResponse>('/api/home/data', null)
}
getOrgTree() {
return this.http.post<JwResponse>('/api/umsOrganization/tree', null)
2 years ago
}
saveOrg(data: NzSafeAny) {
if (Utils.isEmpty(data.organizationId)) {
return this.http.post<JwResponse>('/api/umsOrganization/add', data)
}
return this.http.post<JwResponse>('/api/umsOrganization/update', data)
2 years ago
}
deleteOrg(id: number) {
return this.http.post<JwResponse>('/api/umsOrganization/delete', [id])
2 years ago
}
getUserPage(data: {}) {
return this.http.post<JwResponse>('/api/umsUser/list', data)
2 years ago
}
2 years ago
getUserDetail(id: number) {
return this.http.post<JwResponse>(`/api/umsUser/query?userId=${id}`, null)
}
2 years ago
deleteUser(ids: number[]) {
return this.http.post<JwResponse>(`/api/umsUser/delete`, ids)
2 years ago
}
2 years ago
saveSelfAccount(data: NzSafeAny) {
return this.http.post<JwResponse>('/api/umsUser/update/selfInfo', data)
}
savePassword(data: NzSafeAny) {
return this.http.post<JwResponse>('/api/umsUser/update/selfPassword', data)
}
saveUser(data: NzSafeAny) {
if (Utils.isEmpty(data.userId)) {
return this.http.post<JwResponse>('/api/umsUser/add', data)
2 years ago
}
return this.http.post<JwResponse>('/api/umsUser/update', data)
2 years ago
}
2 years ago
getMenus() {
return this.http.post<JwResponse>('/api/umsMenu/listAll', null)
}
2 years ago
getRolePage(data: {}) {
return this.http.post<JwResponse>('/api/umsRole/list', data)
}
getRoleDetail(id: number) {
return this.http.post<JwResponse>(`/api/umsRole/query?roleId=${id}`, null)
}
deleteRole(ids: number[]) {
return this.http.post<JwResponse>(`/api/umsRole/delete`, ids)
}
saveRole(data: NzSafeAny) {
if (Utils.isEmpty(data.roleId)) {
return this.http.post<JwResponse>('/api/umsRole/add', data)
}
return this.http.post<JwResponse>('/api/umsRole/update', data)
}
2 years ago
2 years ago
getBasicFinancialCategory(data: {}) {
return this.http.post<JwResponse>('/api/eamBasicFinancialCategory/list', data)
}
2 years ago
getAssetPage(data: {}) {
return this.http.post<JwResponse>('/api/eamAsset/list', data)
}
2 years ago
/**
* r入库/退
* @param data
* @returns
*/
getAeamBusinessStorageList(data: {}) {
return this.http.post<JwResponse>('/api/eamBusinessStorage/warehouse/list', data)
}
/**
* //
* @param data
* @returns
*/
getAssetStroagePage(data: {}) {
return this.http.post<JwResponse>('/api/eamAsset/warehouse/list', data)
}
/**
*
* @param ids
* @returns
*/
2 years ago
getAssetListByIds(ids: number[]) {
return this.http.post<JwResponse>('/api/eamAsset/queryByIds', ids)
}
2 years ago
/**
*
* @param ids
* @returns
*/
getAssetStorageListByIds(ids: number[]) {
return this.http.post<JwResponse>('/api/eamAsset/warehouse/listByIds', ids)
}
getAssetLog(data: {}) {
return this.http.post<JwResponse>('/api/eamAssetLog/list', data)
}
2 years ago
getAssetRepairLog(data: {}, id: number) {
return this.http.post<JwResponse>(`/api/eamAsset/repair/list?id=${id}`, data)
}
2 years ago
copyAsset(num: number, id: number) {
return this.http.post<JwResponse>(`/api/eamAsset/copyByNum?num=${num}&id=${id}`, null)
}
deleteAsset(ids: number[]) {
return this.http.post<JwResponse>('/api/eamAsset/delete', ids)
}
uploadAsset(data: FormData) {
return this.http.post<JwResponse>('/api/eamAsset/importData', data)
}
confirmAsset(ids: number[]) {
return this.http.post<JwResponse>('/api/eamAsset/confirm', ids)
}
assetQrcode(id: number) {
return this.http.post<JwResponse>(`/api/qr/generate?id=${id}`, null, {
observe: 'response',
responseType: 'blob' as 'json',
})
}
downloadAssetTemplate() {
return this.http.post<JwResponse>(`/api/eamAsset/importTemplate`, null, {
observe: 'response',
responseType: 'blob' as 'json',
})
}
exportAsset(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamAsset/export`, ids, {
observe: 'response',
responseType: 'blob' as 'json',
})
}
saveAsset(data: NzSafeAny) {
if (Utils.isEmpty(data.assetId)) {
return this.http.post<JwResponse>('/api/eamAsset/add', data)
}
return this.http.post<JwResponse>('/api/eamAsset/update', data)
}
2 years ago
getAlertBorrow(data: {}) {
return this.http.post<JwResponse>('/api/eamAsset/warning/borrow', data)
}
getAlertMaintenance(data: {}) {
return this.http.post<JwResponse>('/api/eamAsset/warning/maintenance', data)
}
getAlertSafety(data: {}) {
return this.http.post<JwResponse>('/api/eamAsset/warning/safety', data)
}
getAlertSafetyUp(data: {}) {
return this.http.post<JwResponse>('/api/eamAsset/warning/up', data)
}
getAlertSafetyDown(data: {}) {
return this.http.post<JwResponse>('/api/eamAsset/warning/down', data)
}
getBasicPositionPage(data: {}) {
return this.http.post<JwResponse>('/api/eamBasicPosition/list', data)
2 years ago
}
2 years ago
getBasicPositionTree() {
return this.http.post<JwResponse>('/api/eamBasicPosition/tree', null)
}
saveBasicPosition(data: NzSafeAny) {
if (Utils.isEmpty(data.positionId)) {
return this.http.post<JwResponse>('/api/eamBasicPosition/add', data)
2 years ago
}
return this.http.post<JwResponse>('/api/eamBasicPosition/update', data)
2 years ago
}
deleteBasicPosition(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBasicPosition/delete`, ids)
2 years ago
}
getBasicMaintenanceVendorPage(data: {}) {
return this.http.post<JwResponse>('/api/eamBasicMaintenanceVendor/list', data)
2 years ago
}
saveBasicMaintenanceVendor(data: NzSafeAny) {
if (Utils.isEmpty(data.maintenanceVendorId)) {
return this.http.post<JwResponse>('/api/eamBasicMaintenanceVendor/add', data)
}
return this.http.post<JwResponse>('/api/eamBasicMaintenanceVendor/update', data)
2 years ago
}
deleteBasicMaintenanceVendor(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBasicMaintenanceVendor/delete`, ids)
2 years ago
}
getBasicManufacturersVendorPage(data: {}) {
return this.http.post<JwResponse>('/api/eamBasicManufacturersVendor/list', data)
2 years ago
}
saveBasicManufacturersVendor(data: NzSafeAny) {
if (Utils.isEmpty(data.manufacturersVendorId)) {
return this.http.post<JwResponse>('/api/eamBasicManufacturersVendor/add', data)
}
return this.http.post<JwResponse>('/api/eamBasicManufacturersVendor/update', data)
2 years ago
}
deleteBasicManufacturersVendor(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBasicManufacturersVendor/delete`, ids)
2 years ago
}
getBasicSupplierVendorPage(data: {}) {
return this.http.post<JwResponse>('/api/eamBasicSupplierVendor/list', data)
}
saveBasicSupplierVendor(data: NzSafeAny) {
if (Utils.isEmpty(data.supplierVendorId)) {
return this.http.post<JwResponse>('/api/eamBasicSupplierVendor/add', data)
2 years ago
}
return this.http.post<JwResponse>('/api/eamBasicSupplierVendor/update', data)
2 years ago
}
deleteBasicSupplierVendor(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBasicSupplierVendor/delete`, ids)
2 years ago
}
getBasicWarehousePage(data: {}) {
return this.http.post<JwResponse>('/api/eamBasicWarehouse/list', data)
2 years ago
}
saveBasicWarehouse(data: NzSafeAny) {
if (Utils.isEmpty(data.warehouseId)) {
return this.http.post<JwResponse>('/api/eamBasicWarehouse/add', data)
}
return this.http.post<JwResponse>('/api/eamBasicWarehouse/update', data)
2 years ago
}
deleteBasicWarehouse(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBasicWarehouse/delete`, ids)
2 years ago
}
2 years ago
categoryTree: NzSafeAny[] = []
getBasicCategoryTree(force?: boolean) {
if (this.categoryTree.length > 0 && !force) {
return of({
body: this.categoryTree,
} as JwResponse)
}
return this.http.post<JwResponse>('/api/eamBasicCategory/tree', null).pipe(
tap((res) => {
this.categoryTree = res.body
}),
)
2 years ago
}
addBasicCategoryTree(data: {}) {
return this.http.post<JwResponse>('/api/eamBasicCategory/add', data)
2 years ago
}
updateBasicCategoryTree(data: {}) {
return this.http.post<JwResponse>('/api/eamBasicCategory/update', data)
2 years ago
}
deleteBasicCategory(ids: number[]) {
return this.http.post<JwResponse>('/api/eamBasicCategory/delete', ids)
2 years ago
}
2 years ago
getStocktakingPlanPage(data: {}) {
return this.http.post<JwResponse>('/api/eamStocktakingPlan/list', data)
}
saveStocktakingPlan(data: NzSafeAny) {
if (Utils.isEmpty(data.stocktakingJobId)) {
return this.http.post<JwResponse>('/api/eamStocktakingPlan/add', data)
}
return this.http.post<JwResponse>('/api/eamStocktakingPlan/update', data)
}
deleteStocktakingPlan(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamStocktakingPlan/delete`, ids)
}
createStocktakingJobByPlan(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamStocktakingPlan/job`, ids)
}
getStocktakingJobDetailPage(data: {}) {
return this.http.post<JwResponse>('/api/eamStocktakingDetails/list', data)
}
saveStocktakingJobDetail(data: NzSafeAny) {
if (Utils.isEmpty(data.id)) {
return this.http.post<JwResponse>('/api/eamStocktakingDetails/add', data)
}
return this.http.post<JwResponse>('/api/eamStocktakingDetails/update', data)
}
deleteStocktakingDetail(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamStocktakingDetails/delete`, ids)
}
getStocktakingJobPage(data: {}) {
return this.http.post<JwResponse>('/api/eamStocktakingJob/list', data)
2 years ago
}
saveStocktakingJob(data: NzSafeAny) {
if (Utils.isEmpty(data.stocktakingJobId)) {
return this.http.post<JwResponse>('/api/eamStocktakingJob/add', data)
2 years ago
}
return this.http.post<JwResponse>('/api/eamStocktakingJob/update', data)
2 years ago
}
deleteStocktakingJob(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamStocktakingJob/delete`, ids)
2 years ago
}
beginStocktakingJob(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamStocktakingJob/start`, ids)
2 years ago
}
stopStocktakingJob(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamStocktakingJob/complete`, ids)
2 years ago
}
getBusinessStoragePage(data: {}) {
return this.http.post<JwResponse>('/api/eamBusinessStorage/list', data)
}
saveBusinessStorage(data: NzSafeAny) {
if (Utils.isEmpty(data.id)) {
Reflect.deleteProperty(data, 'id')
return this.http.post<JwResponse>('/api/eamBusinessStorage/add', data)
}
return this.http.post<JwResponse>('/api/eamBusinessStorage/update', data)
}
deleteBusinessStorage(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBusinessStorage/delete`, ids)
}
confirmBusinessStorage(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBusinessStorage/confirm`, ids)
}
getBusinessCollectionPage(data: {}) {
return this.http.post<JwResponse>('/api/eamBusinessCollection/list', data)
}
saveBusinessCollection(data: NzSafeAny) {
if (Utils.isEmpty(data.id)) {
return this.http.post<JwResponse>('/api/eamBusinessCollection/add', data)
}
return this.http.post<JwResponse>('/api/eamBusinessCollection/update', data)
}
deleteBusinessCollection(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBusinessCollection/delete`, ids)
}
confirmBusinessCollection(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBusinessCollection/confirm`, ids)
}
2 years ago
getBusinessRetirementPage(data: {}) {
return this.http.post<JwResponse>('/api/eamBusinessRetirement/list', data)
}
saveBusinessRetirement(data: NzSafeAny) {
if (Utils.isEmpty(data.id)) {
return this.http.post<JwResponse>('/api/eamBusinessRetirement/add', data)
}
return this.http.post<JwResponse>('/api/eamBusinessRetirement/update', data)
}
deleteBusinessRetirement(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBusinessRetirement/delete`, ids)
}
confirmBusinessRetirement(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBusinessRetirement/confirm`, ids)
}
cleanBusinessRetirement(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBusinessRetirement/clean`, ids)
}
getBusinessReturnInventoryPage(data: {}) {
return this.http.post<JwResponse>('/api/eamBusinessReturnInventory/list', data)
}
saveBusinessReturnInventory(data: NzSafeAny) {
if (Utils.isEmpty(data.id)) {
return this.http.post<JwResponse>('/api/eamBusinessReturnInventory/add', data)
}
return this.http.post<JwResponse>('/api/eamBusinessReturnInventory/update', data)
}
deleteBusinessReturnInventory(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBusinessReturnInventory/delete`, ids)
}
confirmBusinessReturnInventory(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBusinessReturnInventory/confirm`, ids)
}
getBusinessBorrowPage(data: {}) {
return this.http.post<JwResponse>('/api/eamBusinessBorrow/list', data)
}
saveBusinessBorrow(data: NzSafeAny) {
if (Utils.isEmpty(data.id)) {
return this.http.post<JwResponse>('/api/eamBusinessBorrow/add', data)
}
return this.http.post<JwResponse>('/api/eamBusinessBorrow/update', data)
}
deleteBusinessBorrow(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBusinessBorrow/delete`, ids)
}
confirmBusinessBorrow(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBusinessBorrow/confirm`, ids)
}
getBusinessRevertPage(data: {}) {
return this.http.post<JwResponse>('/api/eamBusinessReturn/list', data)
}
saveBusinessRevert(data: NzSafeAny) {
if (Utils.isEmpty(data.id)) {
return this.http.post<JwResponse>('/api/eamBusinessReturn/add', data)
}
return this.http.post<JwResponse>('/api/eamBusinessReturn/update', data)
}
deleteBusinessRevert(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBusinessReturn/delete`, ids)
}
confirmBusinessRevert(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBusinessReturn/confirm`, ids)
}
getBusinessAllocatePage(data: {}) {
return this.http.post<JwResponse>('/api/eamBusinessAllocate/list', data)
}
saveBusinessAllocate(data: NzSafeAny) {
if (Utils.isEmpty(data.id)) {
return this.http.post<JwResponse>('/api/eamBusinessAllocate/add', data)
}
return this.http.post<JwResponse>('/api/eamBusinessAllocate/update', data)
}
deleteBusinessAllocate(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBusinessAllocate/delete`, ids)
}
confirmBusinessAllocate(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBusinessAllocate/confirm`, ids)
}
getBusinessTransferPage(data: {}) {
return this.http.post<JwResponse>('/api/eamBusinessTransfer/list', data)
}
saveBusinessTransfer(data: NzSafeAny) {
if (Utils.isEmpty(data.id)) {
return this.http.post<JwResponse>('/api/eamBusinessTransfer/add', data)
}
return this.http.post<JwResponse>('/api/eamBusinessTransfer/update', data)
}
deleteBusinessTransfer(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBusinessTransfer/delete`, ids)
}
confirmBusinessTransfer(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamBusinessTransfer/confirm`, ids)
}
getRepairTypePage(data: {}) {
return this.http.post<JwResponse>('/api/eamRepairType/list', data)
}
saveRepairType(data: NzSafeAny) {
if (Utils.isEmpty(data.repairTypeId)) {
return this.http.post<JwResponse>('/api/eamRepairType/add', data)
}
return this.http.post<JwResponse>('/api/eamRepairType/update', data)
}
deleteRepairType(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamRepairType/delete`, ids)
}
getRepairPage(data: {}) {
return this.http.post<JwResponse>('/api/eamRepair/list', data)
}
saveRepair(data: NzSafeAny) {
if (Utils.isEmpty(data.id)) {
return this.http.post<JwResponse>('/api/eamRepair/add', data)
}
return this.http.post<JwResponse>('/api/eamRepair/update', data)
}
deleteRepair(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamRepair/delete`, ids)
}
getRepairFaultPage(data: {}) {
return this.http.post<JwResponse>('/api/eamRepairFault/list', data)
}
saveRepairFault(data: NzSafeAny) {
if (Utils.isEmpty(data.faultId)) {
return this.http.post<JwResponse>('/api/eamRepairFault/add', data)
}
return this.http.post<JwResponse>('/api/eamRepairFault/update', data)
}
deleteRepairFault(ids: number[]) {
return this.http.post<JwResponse>(`/api/eamRepairFault/delete`, ids)
}
2 years ago
// flow
getFlowForms(data: {}) {
return this.http.post<JwResponse>(`/api/flForm/all`, data)
}
2 years ago
getFlowRecord(deployId: string, procInsId: string) {
return this.http.get<JwResponse>(`/api/flowable/task/flowRecord?deployId=${deployId}&procInsId=${procInsId}`)
}
2 years ago
setFlowFormsAssignee(data: {}) {
return this.http.post<JwResponse>(`/api/flForm/assignee`, null, {
params: data,
})
}
getMyApplyAssetFlow(data: {}) {
return this.http.post<JwResponse>(`/api/flowable/task/myProcess`, data)
}
2 years ago
deleteAssetFlow(data: {}) {
2 years ago
return this.http.delete<JwResponse>(`/api/flowable/task/delete`, data)
2 years ago
}
getMyTodoAssetFlow(data: {}) {
return this.http.post<JwResponse>(`/api/flowable/task/todoList`, data)
}
getMyFinishedAssetFlow(data: {}) {
return this.http.post<JwResponse>(`/api/flowable/task/finishedList`, data)
}
2 years ago
revokeProcessFlow(data: {}) {
return this.http.post<JwResponse>(`/api/flowable/task/revokeProcess`, data)
}
rejectProcessFlow(data: {}) {
return this.http.post<JwResponse>(`/api/flowable/task/reject`, data)
}
completeProcessFlow(data: {}) {
return this.http.post<JwResponse>(`/api/flowable/task/complete`, data)
}
cancelFlow(data: {}) {
return this.http.post<JwResponse>(`/api/flowable/task/stopProcess`, data)
}
2 years ago
startFlow(json: {}, form_key: string) {
return this.http.post<JwResponse>(`/api/flowable/definition/start/${form_key}`, json)
}
2 years ago
}