Commit 8ff3197c authored by wangqinghua's avatar wangqinghua

知识库 update

parent 11057c2e
......@@ -25,17 +25,18 @@
<div nz-col nzSpan="8" class="text-right">
</div>
</div>
<nz-table #basicTable [nzData]="dataSet">
<nz-table #basicTable [nzData]="dataSet" [nzLoading]="loading" [nzShowPagination]="true"
[nzTotal]="totalNum" [nzPageIndex]="pageNum" [nzPageSize]="pageCount"
(nzPageIndexChange)="change($event)">
<thead>
<tr>
<th>文件名称</th>
<th nzWidth="80%">文件名称</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td>{{data.name}}</td>
<td>{{data.comment}}</td>
<td class="handle main-color">
<span (click)="download(data)">下载</span>
</td>
......@@ -43,4 +44,4 @@
</tbody>
</nz-table>
<!--导入文件-->
<smart-upload #smartUpload></smart-upload>
<smart-upload #smartUpload (done)="getList()"></smart-upload>
import {Component, OnInit, ViewChild} from '@angular/core';
import {UploadComponent} from '../../work/modal/upload/upload.component';
import {pageSize} from '../../app.constants';
import {WorkService} from '../../work/work.service';
import {NzMessageService} from 'ng-zorro-antd';
import {CommonService} from '../../shared/common/common.service';
@Component({
selector: 'smart-common-problem',
......@@ -10,11 +14,46 @@ export class CommonProblemComponent implements OnInit {
@ViewChild('smartUpload') smartUpload: UploadComponent;
dataSet = [];
pageNum = 1;
pageCount = pageSize;
totalNum;
loading = false;
constructor() {
constructor(private workSer: WorkService, private message: NzMessageService,
private commonSer: CommonService) {
}
ngOnInit() {
this.getList();
}
change($event) {
this.pageNum = $event;
this.getList();
}
getList() {
this.loading = true;
const data = {
pageNum: this.pageNum,
pageCount: this.pageCount,
obj:{
flag:0
}
};
this.workSer.knowledgedFindPage(data).subscribe(
(res) => {
if (res.errCode == 10000) {
if (res.data) {
this.dataSet = res.data.data;
this.totalNum = res.data.totalNum;
}
} else {
this.message.info(res.errMsg);
}
this.loading = false;
}
);
}
//导入
......@@ -23,8 +62,12 @@ export class CommonProblemComponent implements OnInit {
}
//下载
download(data) {
download(item) {
this.workSer.knowledgedDownload(item.id).subscribe(
(data) => {
this.commonSer.downloadFile(item.name, data);
}
);
}
}
......@@ -25,17 +25,18 @@
<div nz-col nzSpan="8" class="text-right">
</div>
</div>
<nz-table #basicTable [nzData]="dataSet">
<nz-table #basicTable [nzData]="dataSet" [nzLoading]="loading" [nzShowPagination]="true"
[nzTotal]="totalNum" [nzPageIndex]="pageNum" [nzPageSize]="pageCount"
(nzPageIndexChange)="change($event)">
<thead>
<tr>
<th>文件名称</th>
<th nzWidth="80%">文件名称</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td>{{data.name}}</td>
<td>{{data.comment}}</td>
<td class="handle main-color">
<span (click)="download(data)">下载</span>
</td>
......@@ -43,4 +44,4 @@
</tbody>
</nz-table>
<!--导入文件-->
<smart-upload #smartUpload></smart-upload>
<smart-upload #smartUpload (done)="getDone()"></smart-upload>
import {Component, OnInit, ViewChild} from '@angular/core';
import {UploadComponent} from '../../work/modal/upload/upload.component';
import {pageSize} from '../../app.constants';
import {WorkService} from '../../work/work.service';
import {NzMessageService} from 'ng-zorro-antd';
import {CommonService} from '../../shared/common/common.service';
@Component({
selector: 'smart-information-tech',
templateUrl: './information-tech.component.html',
styles: []
selector: 'smart-information-tech',
templateUrl: './information-tech.component.html',
styles: []
})
export class InformationTechComponent implements OnInit {
@ViewChild('smartUpload') smartUpload: UploadComponent;
@ViewChild('smartUpload') smartUpload: UploadComponent;
dataSet = [];
dataSet = [];
pageNum = 1;
pageCount = pageSize;
totalNum;
loading = false;
constructor() {
}
constructor(private workSer: WorkService, private message: NzMessageService,
private commonSer: CommonService) {
}
ngOnInit() {
}
ngOnInit() {
console.log('init');
this.getList();
}
//导入
importFile() {
this.smartUpload.showModal('上传信息技术文件');
}
change($event) {
console.log('change');
this.pageNum = $event;
this.getList();
}
//下载
download(data) {
getDone() {
console.log('done');
this.pageNum = 1;
this.getList();
}
}
getList() {
this.loading = true;
const data = {
pageNum: this.pageNum,
pageCount: this.pageCount,
obj: {
flag: 1
}
};
this.workSer.knowledgedFindPage(data).subscribe(
(res) => {
if (res.errCode == 10000) {
if (res.data) {
this.dataSet = res.data.data;
this.totalNum = res.data.totalNum;
}
} else {
this.message.info(res.errMsg);
}
this.loading = false;
}
);
}
//导入
importFile() {
this.smartUpload.showModal('上传信息技术文件');
}
//下载
download(item) {
this.workSer.knowledgedDownload(item.id).subscribe(
(data) => {
this.commonSer.downloadFile(item.name, data);
}
);
}
}
......@@ -25,17 +25,18 @@
<div nz-col nzSpan="8" class="text-right">
</div>
</div>
<nz-table #basicTable [nzData]="dataSet">
<nz-table #basicTable [nzData]="dataSet" [nzLoading]="loading" [nzShowPagination]="true"
[nzTotal]="totalNum" [nzPageIndex]="pageNum" [nzPageSize]="pageCount"
(nzPageIndexChange)="change($event)">
<thead>
<tr>
<th>文件名称</th>
<th nzWidth="80%">文件名称</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td>{{data.name}}</td>
<td>{{data.comment}}</td>
<td class="handle main-color">
<span (click)="download(data)">下载</span>
</td>
......@@ -43,4 +44,4 @@
</tbody>
</nz-table>
<!--导入文件-->
<smart-upload #smartUpload></smart-upload>
<smart-upload #smartUpload (done)="getList()"></smart-upload>
import {Component, OnInit, ViewChild} from '@angular/core';
import {UploadComponent} from '../../work/modal/upload/upload.component';
import {pageSize} from '../../app.constants';
import {WorkService} from '../../work/work.service';
import {NzMessageService} from 'ng-zorro-antd';
import {CommonService} from '../../shared/common/common.service';
@Component({
selector: 'smart-management-system',
......@@ -10,11 +14,46 @@ export class ManagementSystemComponent implements OnInit {
@ViewChild('smartUpload') smartUpload: UploadComponent;
dataSet = [];
pageNum = 1;
pageCount = pageSize;
totalNum;
loading = false;
constructor() {
constructor(private workSer: WorkService, private message: NzMessageService,
private commonSer: CommonService) {
}
ngOnInit() {
this.getList();
}
change($event) {
this.pageNum = $event;
this.getList();
}
getList() {
this.loading = true;
const data = {
pageNum: this.pageNum,
pageCount: this.pageCount,
obj:{
flag:2
}
};
this.workSer.knowledgedFindPage(data).subscribe(
(res) => {
if (res.errCode == 10000) {
if (res.data) {
this.dataSet = res.data.data;
this.totalNum = res.data.totalNum;
}
} else {
this.message.info(res.errMsg);
}
this.loading = false;
}
);
}
//导入
......@@ -23,8 +62,12 @@ export class ManagementSystemComponent implements OnInit {
}
//下载
download(data) {
download(item) {
this.workSer.knowledgedDownload(item.id).subscribe(
(data) => {
this.commonSer.downloadFile(item.name, data);
}
);
}
}
......@@ -66,6 +66,10 @@ export class NavbarComponent implements OnInit ,AfterViewChecked{
const sub = this.appSer.theme.subscribe(value=>{
this.theme = value;
})
const data = {
token:''
}
}
/**
......
......@@ -107,7 +107,6 @@ export class CommonService implements OnInit {
*/
downloadFile(title, data: Response) {
const blob = new Blob([data], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;'});
const ie = navigator.userAgent.match(/MSIE\s([\d.]+)/),
ie11 = navigator.userAgent.match(/Trident\/7.0/) && navigator.userAgent.match(/rv:11/),
ieEDGE = navigator.userAgent.match(/Edge/g),
......
......@@ -18,7 +18,7 @@ export class UploadComponent implements OnInit {
fileList: UploadFile[] = [];
constructor(private message: NzMessageService, private workSer: WorkService,
private systemSer: SystemService,private overAllSer:OverAllService) {
private systemSer: SystemService, private overAllSer: OverAllService) {
}
ngOnInit() {
......@@ -59,9 +59,12 @@ export class UploadComponent implements OnInit {
if (this.title == '上传组织文件') {
this.orgUpload();
}
if(this.title == '上传XML模版'){
if (this.title == '上传XML模版') {
this.xmlpload();
}
if (this.title == '上传常见问题文件' || this.title == '上传信息技术文件' || this.title == '上传管理制度文件') {
this.knowladgeUpload();
}
}
//上传资产文件
......@@ -145,4 +148,30 @@ export class UploadComponent implements OnInit {
}
);
}
//知识库里面的文件
knowladgeUpload() {
let flag;
if (this.title == '上传常见问题文件') flag = 0;
if (this.title == '上传信息技术文件') flag = 1;
if (this.title == '上传管理制度文件') flag = 2;
const formData = new FormData();
this.fileList.forEach((file: any) => {
formData.append('file', file);
});
this.workSer.importKnowladage(formData, flag).subscribe(
(res) => {
if (res.errCode == 10000) {
this.isVisible = false;
this.fileList = [];
this.done.emit();
this.message.success('上传成功');
} else {
this.message.error(res.errMsg);
}
this.isOkLoading = false;
}
);
}
}
import { Injectable } from '@angular/core';
import {Injectable} from '@angular/core';
import {Observable} from 'rxjs/Rx';
import {SERVER_API_URL} from '../app.constants';
import {HttpClient} from '@angular/common/http';
......@@ -10,183 +10,198 @@ export class WorkService {
}
//事件转派
transfer(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/sysevent/transfer' ,data);
transfer(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/sysevent/transfer', data);
}
//修改事件
update(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/sysevent/update' ,data);
update(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/sysevent/update', data);
}
//删除事件
deleteEvent(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/sysevent/delete' ,data);
deleteEvent(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/sysevent/delete', data);
}
//查找事件列表
find(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/sysevent/find' ,data);
find(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/sysevent/find', data);
}
//根据事件编号查询
findByNo(params): Observable<any>{
return this.http.get(SERVER_API_URL + '/sysevent/findTransferAndInventory/' +params);
findByNo(params): Observable<any> {
return this.http.get(SERVER_API_URL + '/sysevent/findTransferAndInventory/' + params);
}
//添加事件
create(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/sysevent/create' ,data);
create(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/sysevent/create', data);
}
//事件信息流转记录查询接口
transferInfo(params): Observable<any>{
return this.http.get(SERVER_API_URL + '/sysevent/transferInfo/' +params);
transferInfo(params): Observable<any> {
return this.http.get(SERVER_API_URL + '/sysevent/transferInfo/' + params);
}
//处理事件
deal(data): Observable<any>{
return this.http.put(SERVER_API_URL + '/sysevent/deal' ,data);
deal(data): Observable<any> {
return this.http.put(SERVER_API_URL + '/sysevent/deal', data);
}
//事件确认
confirmEvent(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/sysevent/confirm' ,data);
confirmEvent(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/sysevent/confirm', data);
}
//查询事件, 操作人, 流转记录, 资产
findTransferAndInventory(params): Observable<any>{
return this.http.get(SERVER_API_URL + '/sysevent/findTransferAndInventory/' +params);
findTransferAndInventory(params): Observable<any> {
return this.http.get(SERVER_API_URL + '/sysevent/findTransferAndInventory/' + params);
}
//修改巡检计划
updatePlan(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/plan/update' ,data);
updatePlan(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/plan/update', data);
}
//删除计划
deletePlan(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/plan/delete' ,data);
deletePlan(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/plan/delete', data);
}
//查找单个计划
findPlan(params): Observable<any>{
return this.http.get(SERVER_API_URL + '/plan/find/' +params);
findPlan(params): Observable<any> {
return this.http.get(SERVER_API_URL + '/plan/find/' + params);
}
//查询列表
findPlanList(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/plan/find' ,data);
findPlanList(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/plan/find', data);
}
//添加巡检计划
createPlan(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/plan/create' ,data);
createPlan(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/plan/create', data);
}
//修改资产分类
updateType(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/inventory/updateType' ,data);
updateType(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/inventory/updateType', data);
}
//查询所有父级资产类型
findByParentType(): Observable<any>{
return this.http.get(SERVER_API_URL + '/inventory/findByParentType' );
findByParentType(): Observable<any> {
return this.http.get(SERVER_API_URL + '/inventory/findByParentType');
}
//根据父级类型查询子级
findByParentidCount(params): Observable<any>{
return this.http.get(SERVER_API_URL + '/inventory/findByParentidCount/' +params);
findByParentidCount(params): Observable<any> {
return this.http.get(SERVER_API_URL + '/inventory/findByParentidCount/' + params);
}
//创建资产分类
createType(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/inventory/createType' ,data);
createType(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/inventory/createType', data);
}
//根据主键id查询资产类型
findType(params): Observable<any>{
return this.http.get(SERVER_API_URL + '/inventory/findType/' +params);
findType(params): Observable<any> {
return this.http.get(SERVER_API_URL + '/inventory/findType/' + params);
}
//根据资产类型id 查询没有配置主机的资产
selectByInventoryTypeidAndHostidNull(params): Observable<any>{
return this.http.get(SERVER_API_URL + '/inventory/selectByInventoryTypeidAndHostidNull/' ,params);
selectByInventoryTypeidAndHostidNull(params): Observable<any> {
return this.http.get(SERVER_API_URL + '/inventory/selectByInventoryTypeidAndHostidNull/', params);
}
//设置资产匹配的主机
updateHostid(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/inventory/updateHostid' ,data);
updateHostid(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/inventory/updateHostid', data);
}
//根据type查找
findByType(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/syseventType/findByType' ,data);
findByType(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/syseventType/findByType', data);
}
//创建资产
createInventory(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/inventory/createInventory' ,data);
createInventory(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/inventory/createInventory', data);
}
//修改资产
updateInventory(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/inventory/updateInventory' ,data);
updateInventory(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/inventory/updateInventory', data);
}
//根据资产类型id查询资产
findInventory(params): Observable<any>{
return this.http.get(SERVER_API_URL + '/inventory/findInventory/' +params);
findInventory(params): Observable<any> {
return this.http.get(SERVER_API_URL + '/inventory/findInventory/' + params);
}
//删除资产(可批量)
deleteInventory(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/inventory/deleteInventory' ,data);
deleteInventory(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/inventory/deleteInventory', data);
}
//导入资产
importInventory(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/inventory/import' ,data);
importInventory(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/inventory/import', data);
}
//导入知识库
importKnowladage(data, params): Observable<any> {
return this.http.post(SERVER_API_URL + '/knowledge/import/' + params, data);
}
//知识库翻页
knowledgedFindPage(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/knowledge/findPage', data);
}
//下载
knowledgedDownload(params): Observable<any> {
return this.http.get(SERVER_API_URL + '/knowledge/download/' + params,{responseType: 'blob'});
}
//根据资产类型id查询资产
selectByPrimaryKey(params): Observable<any>{
return this.http.get(SERVER_API_URL + '/inventory/selectByPrimaryKey/' +params);
selectByPrimaryKey(params): Observable<any> {
return this.http.get(SERVER_API_URL + '/inventory/selectByPrimaryKey/' + params);
}
//删除资产分类
deleteType(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/inventory/deleteType' ,data);
deleteType(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/inventory/deleteType', data);
}
//根据type查找
findParamsByType(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/syseventType/findByType' ,data);
findParamsByType(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/syseventType/findByType', data);
}
//添加类型
createTypeByparams(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/syseventType/create' ,data);
createTypeByparams(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/syseventType/create', data);
}
//修改分类
updateTypeByparams(data): Observable<any>{
return this.http.put(SERVER_API_URL + '/syseventType/update' ,data);
updateTypeByparams(data): Observable<any> {
return this.http.put(SERVER_API_URL + '/syseventType/update', data);
}
//删除分类
deleteTypeByparams(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/syseventType/delete' ,data);
deleteTypeByparams(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/syseventType/delete', data);
}
//查找当前事件编号前缀
getEventNoPre(): Observable<any>{
return this.http.get(SERVER_API_URL + '/sysevent/getEventNoPre' );
getEventNoPre(): Observable<any> {
return this.http.get(SERVER_API_URL + '/sysevent/getEventNoPre');
}
//修改事件编号前缀
updateEventNoPre(data): Observable<any>{
return this.http.put(SERVER_API_URL + '/sysevent/updateEventNoPre',data );
updateEventNoPre(data): Observable<any> {
return this.http.put(SERVER_API_URL + '/sysevent/updateEventNoPre', data);
}
/**
......@@ -195,14 +210,14 @@ export class WorkService {
* @param url 地址
* @returns {Observable<any>}
*/
downloadTemplate(pararmsType,paramsId): Observable<any>{
return this.http.get( SERVER_API_URL + "/api/download/file/" + pararmsType +"/"+ paramsId,{responseType: 'blob'});
downloadTemplate(pararmsType, paramsId): Observable<any> {
return this.http.get(SERVER_API_URL + '/api/download/file/' + pararmsType + '/' + paramsId, {responseType: 'blob'});
}
/**
* 批量下载资产文件
*/
getExportUrl(data): Observable<any>{
return this.http.post( SERVER_API_URL + "/inventory/getExportUrl" ,data);
getExportUrl(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/inventory/getExportUrl', data);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment