whx 1 년 전
부모
커밋
b8d0bed4ce

+ 2 - 1
virgo.wzfrontend/console/public/index.html

@@ -6,7 +6,8 @@
 		<link rel="icon" href="https://file-node.oss-cn-shanghai.aliyuncs.com/youji/3156449b8a1a4874981b2a76d5947721">
 		<link rel="stylesheet" type="text/css" href="<%= BASE_URL %>reset.css" />
 		<link rel="stylesheet" href="//at.alicdn.com/t/c/font_4358860_7ta6ukcxj3a.css">
-		<title>有极</title>
+		<title>有极</title>
+		<script src="<%= BASE_URL %>jquery.js"></script>
 	</head>
 	<body id="body">
 		<noscript>

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2 - 0
virgo.wzfrontend/console/public/jquery.js


+ 1 - 2
virgo.wzfrontend/console/src/components/common/svgIcon.vue

@@ -49,8 +49,7 @@
 				this.svgName = this.name;
 			} else {
 				this.svgName = 'nofile';
-			}
-			console.log(this.svgName);
+			}
 		},
 		computed: {
 			iconName() {

+ 92 - 0
virgo.wzfrontend/console/src/components/document/preview.vue

@@ -0,0 +1,92 @@
+<template>
+	<div class="hui-flex hui-dialog">
+		<div class="hui-flex-box">
+			<div class="document-look" v-html="html"></div>
+		</div>
+	</div>
+</template>
+
+<script>
+	import {
+		getContractTemplateById
+	} from '@/httpApi/contract'
+	export default {
+		props: ['templateId'],
+		data() {
+			return {
+				html: ''
+			}
+		},
+		created() {
+			this.$nextTick(() => {
+				if (this.templateId) return this.initTemplate(this.templateId);
+				if (this.documentId) this.initDocument();
+			})
+		},
+		methods: {
+			initTemplate(templateId) {
+				getContractTemplateById(templateId).then(res => {
+					if (res.state) {
+						this.html = res.data.html;
+						this.$nextTick(() => {
+							this.reloadHtml();
+						})
+					}
+				})
+			},
+			reloadHtml() {
+				let td = $('td');
+				for (let i = 0; i < td.length; i++) {
+					if ($(td[i]).text()) {
+						$(td[i]).css({
+							padding: '16px 0'
+						})
+					}
+				}
+			},
+			initDocument() {
+
+			}
+		},
+	}
+</script>
+
+<style lang="scss">
+	.document-look {
+		width: 100%;
+		height: 100%;
+		padding: 20px 30px;
+		overflow: auto;
+
+		&::-webkit-scrollbar-thumb {
+			background: #D9DEE6;
+		}
+
+		table {
+			margin: 0 auto;
+			width: 1163px;
+
+			tr {
+				td {
+					background: #F8F9FB;
+					color: #222222;
+					border: 1px solid #CECFD3;
+					text-align: center;
+
+					div {
+						width: 100%;
+						height: 100%;
+
+						span {
+							width: 100%;
+							height: 100%;
+							display: flex;
+							align-items: center;
+							justify-content: center;
+						}
+					}
+				}
+			}
+		}
+	}
+</style>

+ 55 - 0
virgo.wzfrontend/console/src/components/work/contract/common/documentUpload.vue

@@ -0,0 +1,55 @@
+<template>
+	<div class="document-upload">
+		<el-upload :action="action" name="uploadFile" ref="upload" :headers="headers" accept=".xlsx"
+			:on-success="successFile" :before-upload="beforeUpload" :on-error="errorUpload" :show-file-list="false"
+			:on-progress="progress">
+			<div class="bim-update-button">
+				<i class="el-icon-plus"></i>
+			</div>
+		</el-upload>
+	</div>
+</template>
+
+<script>
+	import config from '@/config';
+	import {
+		getToken
+	} from '@/uitls/auth';
+	export default {
+		data() {
+			return {
+				action: config.baseURL + '/file/filenode/-1',
+				headers: {}
+			};
+		},
+		created() {
+			this.headers.token = getToken();
+		},
+		methods: {
+			beforeUpload() {
+				this.$loading();
+			},
+			progress(e) {
+				let percent = e.percent >= 100 ? 99 : parseInt(e.percent)
+				this.$loading({
+					percent: (percent + '%')
+				});
+			},
+			reloadUpload() {
+				this.$refs['upload'].$children[0].$refs.input.click();
+			},
+			errorUpload() {
+				this.$loading.close();
+				this.$message.error('上传失败');
+			},
+			successFile(data) {
+				this.$emit('changeFile', data.data)
+				this.$loading.close();
+			},
+		}
+	};
+</script>
+
+<style lang="scss">
+	.document-upload {}
+</style>

+ 41 - 0
virgo.wzfrontend/console/src/components/work/contract/common/tagTree.vue

@@ -0,0 +1,41 @@
+<template>
+	<div class="tag-tree">
+		<el-tree :data="treeData" :props="defaultProps" :expand-on-click-node="false" @node-click="nodeClick">
+		</el-tree>
+	</div>
+</template>
+
+<script>
+	import {
+		getTagList
+	} from '@/httpApi/contract'
+	export default {
+		data() {
+			return {
+				treeData: [],
+				defaultProps: {
+					children: 'children',
+					label: 'name'
+				},
+			}
+		},
+		created() {
+			this.init();
+		},
+		methods: {
+			init() {
+				getTagList(this.$store.getters.organization.id, this.$store.getters.project.id).then(res => {
+					if (res.state) {
+						this.treeData = res.data;
+					}
+				})
+			},
+			nodeClick(item) {
+				this.$emit('treeclick', item);
+			}
+		},
+	}
+</script>
+
+<style>
+</style>

+ 6 - 4
virgo.wzfrontend/console/src/components/work/contract/tag/detail.vue

@@ -3,12 +3,12 @@
 		<div class="hui-detail-title">基础信息</div>
 		<div class="hui-detail-content">
 			<div class="hui-detail-item">
-				<div class="hui-detail-label">标签名称</div>
+				<div class="hui-detail-label">分类名称</div>
 				<div class="hui-detail-value">{{detail.name}}</div>
 			</div>
 			<div class="hui-detail-item">
-				<div class="hui-detail-label">标签描述</div>
-				<div class="hui-detail-value"> {{detail.remark}}</div>
+				<div class="hui-detail-label">分类描述</div>
+				<div class="hui-detail-value"> {{detail.description}}</div>
 			</div>
 		</div>
 	</div>
@@ -20,7 +20,9 @@
 		data() {
 			return {}
 		},
-		created() {}
+		created() {
+			
+		}
 	}
 </script>
 <style lang="scss">

+ 5 - 8
virgo.wzfrontend/console/src/components/work/contract/tag/edit.vue

@@ -2,11 +2,11 @@
 	<div class="hui-flex hui-dialog">
 		<div class="hui-flex-box hui-dialog-content">
 			<el-form ref="tagFrom" :model="tagFrom" label-position="top">
-				<el-form-item label="标签名称">
-					<el-input type="text" v-model="tagFrom.name" placeholder="请输入标签名称"></el-input>
+				<el-form-item label="分类名称" class="hui-textarea">
+					<el-input type="text" v-model="tagFrom.name" placeholder="请输入分类名称"></el-input>
 				</el-form-item>
-				<el-form-item label="标签描述" class="hui-textarea">
-					<el-input type="textarea" v-model="tagFrom.remark" placeholder="请输入标签描述" resize="none">
+				<el-form-item label="分类描述" class="hui-textarea">
+					<el-input type="textarea" v-model="tagFrom.description" placeholder="请输入分类描述" resize="none">
 					</el-input>
 				</el-form-item>
 			</el-form>
@@ -29,7 +29,7 @@
 			return {
 				tagFrom: {
 					name: '',
-					remark: '',
+					description: '',
 					organizationId: '',
 					projectId: '',
 					parentId: -1,
@@ -47,9 +47,6 @@
 		},
 		methods: {
 			submit() {
-				this.$message.success('操作成功');
-				this.$emit('callback', 'init');
-				return
 				if (this.isUpdate) {
 					updateTag(this.tagFrom).then(this.successFunc)
 				} else {

+ 74 - 4
virgo.wzfrontend/console/src/httpApi/contract.js

@@ -1,4 +1,5 @@
 import request from '@/axios'
+import config from '@/config'
 /* 
  * 获取组织项目合同标签列表
  * 
@@ -6,7 +7,7 @@ import request from '@/axios'
  */
 export function getTagList(organizationId, projectId) {
 	return request({
-		url: `/manager/role/${organizationId}/${projectId}`,
+		url: `/file/category/category/${organizationId}/${projectId}`,
 		method: 'get'
 	})
 }
@@ -17,7 +18,7 @@ export function getTagList(organizationId, projectId) {
  */
 export function insertTag(data) {
 	return request({
-		url: `/manager/role`,
+		url: `/file/category/category`,
 		method: 'post',
 		data: data
 	})
@@ -29,7 +30,7 @@ export function insertTag(data) {
  */
 export function updateTag(data) {
 	return request({
-		url: `/manager/role`,
+		url: `/file/category/category`,
 		method: 'put',
 		data: data
 	})
@@ -41,7 +42,76 @@ export function updateTag(data) {
  */
 export function deleteTag(id) {
 	return request({
-		url: `/manager/role/${id}`,
+		url: `/file/category/category/${id}`,
 		method: 'delete'
 	})
+}
+/* 
+ * 获取合同模板列表
+ * 
+ * 
+ */
+export function getContractTemplateList(data) {
+	return request({
+		url: `/file/template/${data.categoryId}/${data.currPage}/${data.pageSize}`,
+		method: 'get'
+	})
+}
+/* 
+ * 上传模板
+ * 
+ * 
+ */
+export function uploadContractTemplate(data) {
+	return request({
+		url: `/file/template/import`,
+		method: 'post',
+		data: data
+	})
+}
+/* 
+ * 更新模板
+ * 
+ * 
+ */
+export function updateContractTemplate(data) {
+	return request({
+		url: `/file/template/update`,
+		method: 'put',
+		data: data
+	})
+}
+/* 
+ * 删除模板
+ * 
+ * 
+ */
+export function deleteContractTemplate(id) {
+	return request({
+		url: `/file/template/${id}`,
+		method: 'delete'
+	})
+}
+/* 
+ * 获取模板详情
+ * 
+ * 
+ */
+export function getContractTemplateById(id) {
+	return request({
+		url: `/file/template/${id}`,
+		method: 'get'
+	})
+}
+/* 
+ * 获取模板留
+ * 
+ * 
+ */
+export function getContractTemplateRaw(id) {
+	return request({
+		url: `/file/template/raw/${id}`,
+		method: 'get',
+		responseType: 'arraybuffer'
+	})
 }

+ 25 - 0
virgo.wzfrontend/console/src/uitls/index.js

@@ -457,4 +457,29 @@ export function constData(documentElement) {
 			'上传图片') obj[name][id] = elem.innerText == null ? '' : elem.innerText;
 	}
 	return obj;
+}
+/* 
+ * 下载文件
+ * 
+ */
+export function downloadFileDom(data, fileName) {
+	let blob = new Blob([data], {
+		type: 'application/octet-stream'
+	}); // 转化为blob对象
+	if (typeof window.navigator.msSaveBlob !== 'undefined') {
+		window.navigator.msSaveBlob(blob, fileName);
+	} else {
+		var blobURL = window.URL.createObjectURL(blob); // 将blob对象转为一个URL
+		var tempLink = document.createElement('a'); // 创建一个a标签
+		tempLink.style.display = 'none';
+		tempLink.href = blobURL;
+		tempLink.setAttribute('download', fileName); // 给a标签添加下载属性
+		if (typeof tempLink.download === 'undefined') {
+			tempLink.setAttribute('target', '_blank');
+		}
+		document.body.appendChild(tempLink); // 将a标签添加到body当中
+		tempLink.click(); // 启动下载
+		document.body.removeChild(tempLink); // 下载完毕删除a标签
+		window.URL.revokeObjectURL(blobURL);
+	}
 }

+ 7 - 10
virgo.wzfrontend/console/src/views/work/contract/tag.vue

@@ -1,15 +1,15 @@
 <template>
 	<div class="hui-flex hui-content">
 		<div class="hui-content-title">
-			<div class="hui-title-item active">标签管理</div>
+			<div class="hui-title-item active">分类管理</div>
 		</div>
 		<div class="hui-flex-box hui-flex hui-table">
 			<div class="hui-content-insert">
-				<el-button type="primary" size="medium" @click="insertTag({})">新建标签</el-button>
+				<el-button type="primary" size="medium" @click="insertTag({})">新建分类</el-button>
 			</div>
 			<div class="hui-flex-box">
 				<el-table :data="treeData" row-key="id" border height="100%">
-					<el-table-column label="标签名称" prop="name"></el-table-column>
+					<el-table-column label="分类名称" prop="name"></el-table-column>
 					<el-table-column label="操作" width="240">
 						<template slot-scope="scope">
 							<div class="hui-table-operation">
@@ -17,7 +17,7 @@
 									详情
 								</span>
 								<span class="table-operation" @click="insertTag(scope.row)">
-									添加子标签
+									添加子分类
 								</span>
 								<span class="table-operation" @click="updateTag(scope.row)">
 									编辑
@@ -38,7 +38,7 @@
 			<edit v-if="visible" @callback="callback" :isUpdate="isUpdate" :part="part">
 			</edit>
 		</el-dialog>
-		<el-drawer title="标签详情" :visible.sync="drawer" :size="400" :append-to-body="true">
+		<el-drawer title="分类详情" :visible.sync="drawer" :size="400" :append-to-body="true">
 			<detail v-if="drawer" :detail="part"></detail>
 		</el-drawer>
 	</div>
@@ -51,7 +51,6 @@
 	} from '@/httpApi/contract'
 	import edit from '@/components/work/contract/tag/edit'
 	import detail from '@/components/work/contract/tag/detail'
-	import avatar from '@/components/common/avatar'
 	export default {
 		data() {
 			return {
@@ -66,8 +65,7 @@
 			this.init();
 		},
 		methods: {
-			init() {
-				return;
+			init() {
 				getTagList(this.$store.getters.organization.id, this.$store.getters.project.id).then(res => {
 					if (res.state) {
 						this.treeData = res.data;
@@ -93,7 +91,7 @@
 				this.visible = true;
 			},
 			deleteTag(val) {
-				this.$confirm('确定要删除该标签?', () => {
+				this.$confirm('确定要删除该分类?', () => {
 					deleteTag(val.id).then(res => {
 						if (res.state) {
 							this.$message.success('操作成功');
@@ -109,7 +107,6 @@
 		},
 		components: {
 			edit,
-			avatar,
 			detail
 		},
 	}

+ 179 - 9
virgo.wzfrontend/console/src/views/work/contract/template.vue

@@ -1,18 +1,188 @@
 <template>
-	<div class="contract-template">
-		<empty description="合同模板"></empty>
+	<div class="hui-flex">
+		<div class="hui-flex-box yui-tree-box">
+			<div class="hui-left-tree">
+				<div class="hui-left-tree-title">
+					<svg-icon name="zhuangshi" width="16" height="20"></svg-icon>
+					<span class="hui-left-tree-sub">合同分类</span>
+				</div>
+				<div class="hui-left-tree-content">
+					<tag-tree @treeclick="treeclick"></tag-tree>
+				</div>
+			</div>
+			<div class="hui-tree-content">
+				<div class="hui-flex hui-content box-background">
+					<div class="hui-content-title">
+						<div class="hui-title-item active">合同模板</div>
+					</div>
+					<div class="hui-flex-box hui-flex hui-table">
+						<div class="hui-content-insert">
+							<el-button type="primary" size="medium" :disabled="categoryId === -1" @click="upload">
+								<i class="iconfont huifont-shangchuan"></i>上传合同模板
+							</el-button>
+							<document-upload ref="upload" v-show="false" @changeFile="changeFile"></document-upload>
+						</div>
+						<div class="hui-flex-box">
+							<el-table :data="tableData" row-key="id" border height="100%">
+								<el-table-column label="序号" width="50">
+									<template slot-scope="scope">
+										<div style="text-align: center;">{{scope.$index + 1}}</div>
+									</template>
+								</el-table-column>
+								<el-table-column label="合同名称" prop="name"></el-table-column>
+								<el-table-column label="模板字段" width="100">
+									<template slot-scope="scope">
+										<el-button size="small" type="primary" @click="setField(scope.row)">
+											设置
+										</el-button>
+									</template>
+								</el-table-column>
+								<el-table-column label="操作" width="240">
+									<template slot-scope="scope">
+										<div class="hui-table-operation">
+											<span class="table-operation" @click="reloadUpload(scope.row)">
+												重新上传
+											</span>
+											<span class="table-operation" @click="download(scope.row)">
+												下载
+											</span>
+											<span class="table-operation" @click="preview(scope.row)">
+												预览
+											</span>
+											<span class="table-operation" @click="deleteItem(scope.row)">
+												删除
+											</span>
+										</div>
+									</template>
+								</el-table-column>
+								<template slot="empty">
+									<empty description="暂无数据"></empty>
+								</template>
+							</el-table>
+						</div>
+						<div class="hui-content-pagination">
+							<el-pagination :page-size="pageSize" :pager-count="9" layout="prev, pager, next"
+								:total="totalCount" @current-change="currentChange">
+							</el-pagination>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+		<el-dialog title="预览" :visible.sync="detailsDialogVisible" width="80%" class="document-dialog"
+			:append-to-body="true">
+			<preview v-if="detailsDialogVisible" :templateId="templateId" @close="detailsDialogVisible = false">
+			</preview>
+		</el-dialog>
 	</div>
 </template>
 
 <script>
+	import {
+		getContractTemplateList,
+		uploadContractTemplate,
+		updateContractTemplate,
+		deleteContractTemplate,
+		getContractTemplateRaw
+	} from '@/httpApi/contract'
+	import {
+		downloadFileDom
+	} from '@/uitls'
+	import tagTree from '@/components/work/contract/common/tagTree'
+	import documentUpload from '@/components/work/contract/common/documentUpload'
+	import preview from '@/components/document/preview'
+	export default {
+		data() {
+			return {
+				tableData: [],
+				currPage: 1,
+				pageSize: 10,
+				totalCount: 0,
+				categoryId: -1,
+				templateId: '',
+				detailsDialogVisible: false
+			}
+		},
+		created() {
+			this.init();
+		},
+		methods: {
+			init() {
+				getContractTemplateList({
+					categoryId: this.categoryId,
+					currPage: this.currPage,
+					pageSize: this.pageSize
+				}).then(res => {
+					if (res.state) {
+						this.tableData = res.data.dataList;
+					}
+				})
+			},
+			currentChange(currPage) {
+				this.currPage = currPage;
+				this.init();
+			},
+			treeclick(item) {
+				this.categoryId = item.id;
+				this.currPage = 1;
+				this.init();
+			},
+			upload() {
+				this.templateId = '';
+				this.$refs.upload.reloadUpload();
+			},
+			setField() {
+
+			},
+			reloadUpload(item) {
+				this.templateId = item.id;
+				this.$refs.upload.reloadUpload();
+			},
+			download(item) {
+				getContractTemplateRaw(item.id).then(res => {
+					downloadFileDom(res, item.name);
+				})
+			},
+			preview(item) {
+				this.templateId = item.id;
+				this.detailsDialogVisible = true;
+			},
+			deleteItem(item) {
+				this.$confirm('确定要删除该模板文件?', () => {
+					deleteContractTemplate(item.id).then(this.successFunc)
+				});
+			},
+			changeFile(data) {
+				let postData = {
+					categoryId: this.categoryId,
+					name: data.name,
+					fileNode: {
+						id: data.id,
+						name: data.name
+					}
+				}
+				if (this.templateId) postData['id'] = this.templateId;
+				this.templateId ? updateContractTemplate(postData).then(this.successFunc) : uploadContractTemplate(
+					postData).then(this.successFunc);
+			},
+			successFunc(res) {
+				if (res.state) {
+					this.$message({
+						type: 'success',
+						message: '操作成功'
+					})
+					this.init();
+				}
+				this.$loading.close();
+			},
+		},
+		components: {
+			tagTree,
+			documentUpload,
+			preview
+		},
+	}
 </script>
 
 <style lang="scss">
-	.contract-template {
-		width: 100%;
-		height: 100%;
-		display: flex;
-		align-items: center;
-		justify-content: center;
-	}
 </style>

+ 3 - 2
virgo.wzfrontend/console/src/views/work/organization/user.vue

@@ -64,8 +64,9 @@
 							</el-table-column>
 							<el-table-column label="权限">
 								<template slot-scope="scope">
-									<el-button size="small" type="primary"
-										@click="updateUser(scope.row,2,'设置权限')">设置</el-button>
+									<el-button size="small" type="primary" @click="updateUser(scope.row,2,'设置权限')">
+										设置
+									</el-button>
 								</template>
 							</el-table-column>
 							<el-table-column label="操作" width="150">