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;
}
);
}
}
This diff is collapsed.
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