|
@@ -1,18 +1,188 @@
|
|
<template>
|
|
<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>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<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>
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
<style lang="scss">
|
|
- .contract-template {
|
|
|
|
- width: 100%;
|
|
|
|
- height: 100%;
|
|
|
|
- display: flex;
|
|
|
|
- align-items: center;
|
|
|
|
- justify-content: center;
|
|
|
|
- }
|
|
|
|
</style>
|
|
</style>
|