9 Commits

21 changed files with 3659 additions and 1591 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -42,3 +42,13 @@ export function delDocument(id) {
method: 'delete' method: 'delete'
}) })
} }
// 发布文档
export function pushDoc(id) {
return request({
url: '/document/pushDoc/' + id,
method: 'put'
})
}

View File

@@ -0,0 +1,55 @@
import request from '@/utils/request'
// 查询文档资源分类管理列表
export function listCategory(query) {
return request({
url: '/system/category/list',
method: 'get',
params: query
})
}
// 查询文档资源分类管理详细
export function getCategory(id) {
return request({
url: '/system/category/' + id,
method: 'get'
})
}
// 新增文档资源分类管理
export function addCategory(data) {
return request({
url: '/system/category',
method: 'post',
data: data
})
}
// 修改文档资源分类管理
export function updateCategory(data) {
return request({
url: '/system/category',
method: 'put',
data: data
})
}
// 删除文档资源分类管理
export function delCategory(id) {
return request({
url: '/system/category/' + id,
method: 'delete'
})
}
// 获取文档分类树列表
export function documentTree(query) {
return request({
url: '/system/category/documentTree',
method: 'get',
params: query
})
}

View File

@@ -9,6 +9,15 @@ export function listType(query) {
}) })
} }
// 查询业务字典类型列表(扩展)
export function bizListType(query) {
return request({
url: '/system/dict/type/bizlist',
method: 'get',
params: query
})
}
// 查询字典类型详细 // 查询字典类型详细
export function getType(dictId) { export function getType(dictId) {
return request({ return request({

View File

@@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询讨论列表
export function listDiscussions(query) {
return request({
url: '/discussions/list',
method: 'get',
params: query
})
}
// 查询讨论详细
export function getDiscussions(id) {
return request({
url: '/discussions/' + id,
method: 'get'
})
}
// 新增讨论
export function addDiscussions(data) {
return request({
url: '/discussions',
method: 'post',
data: data
})
}
// 修改讨论
export function updateDiscussions(data) {
return request({
url: '/discussions',
method: 'put',
data: data
})
}
// 删除讨论
export function delDiscussions(id) {
return request({
url: '/discussions/' + id,
method: 'delete'
})
}

44
src/api/tool/replies.js Normal file
View File

@@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询回复列表
export function listReplies(query) {
return request({
url: '/system/replies/list',
method: 'get',
params: query
})
}
// 查询回复详细
export function getReplies(id) {
return request({
url: '/replies/' + id,
method: 'get'
})
}
// 新增回复
export function addReplies(data) {
return request({
url: '/replies',
method: 'post',
data: data
})
}
// 修改回复
export function updateReplies(data) {
return request({
url: '/replies',
method: 'put',
data: data
})
}
// 删除回复
export function delReplies(id) {
return request({
url: '/replies/' + id,
method: 'delete'
})
}

View File

@@ -0,0 +1,327 @@
<template>
<div>
<el-upload class="upload-demo" ref="upload" action="#"
:before-upload="beforeUpload"
:on-change="onChange"
:on-remove="handleRemove"
:multiple="isMultiple"
:on-exceed="handleExceed"
:accept="acceptType"
:limit="limit"
:file-list="fileList"
:auto-upload="true"
:http-request="uploadFile"
show-file-list>
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<div slot="tip" class="el-upload__tip">只能上传{{acceptType}}文件</div>
</el-upload>
<div v-show="progressFlag" class="head-img">
<el-progress :text-inside="true" :stroke-width="14" :percentage="progressPercent" status="success"></el-progress>
</div>
</div>
</template>
<script>
import axios from 'axios'
import {
getToken
} from "@/utils/auth";
export default {
props: {
uploadUrl: {
type: String,
required: true
},
// 是否多选
isMultiple: {
type: Boolean,
default() {
return false
}
},
// 文件类型
type: {
type: Array,
default() {
return []
}
},
//上传类型
acceptType: {
type: String,
required: true
},
// 上传数量
limit: {
type: Number,
default() {
return 1
}
},
// 文件
dataFile: {
type: [Object, Array, String],
default() {
return ''
}
},
},
data() {
return {
fileList: [],
progress: 0,
isUploading: false,
progressFlag: false, //进度条初始值隐藏
progressPercent: 0, //进度条初始值
partSize: 5 * 1024 * 1024,
};
},
watch: {
dataFile: {
handler(newValue, oldValue) {
if (newValue) {
this.fileList = Array.isArray(newValue) ? newValue : [newValue]
} else {
this.fileList = []
}
},
immediate: true
}
},
methods: {
// 上传前
beforeUpload(file) {
/* const fileType = file.type.toLowerCase()
console.info("fileType=======", fileType)
const typeFlag = this.type.some(item => {
return fileType.indexOf(item) != -1
})
if (!typeFlag) {
this.$message.error('上传类型有误,请重新上传')
return false
}*/
},
//文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
onChange(file, fileList) {
this.fileList = fileList;
},
handleRemove(file, fileList) {
this.fileList = fileList;
},
handleExceed(files, fileList) {
this.$message.warning(
"最多之能上传"+ this.limit +"个附件"
);
},
async uploadFile({ data, file }) {
let self = this
//初始化参数
this.progress++
if (file.size < this.partSize) {
let formData = new FormData()
formData.append("file", file)
self.progressFlag = true;
axios({
url: self.uploadUrl,
method: 'post',
data: formData,
headers: {
'Authorization': 'Bearer ' + getToken(),
'Content-Type': 'multipart/form-data'
},
onUploadProgress: progressEvent => {
// progressEvent.loaded:已上传文件大小
// progressEvent.total:被上传文件的总大小
//进度条
self.progressPercent = ((progressEvent.loaded / progressEvent.total) * 100) | 0;
}
}).then(res => {
setTimeout(() => {
if (res.data.code == 200 && self.progressPercent === 100) {
setTimeout(function () {
self.$message({
message: '上传成功!',
type: 'success',
duration: '2000'
});
self.progressFlag = false;
self.progressPercent = 0
self.handleResult(res,file);
}, 500);
} else {
self.$message({
message: '上传失败!',
type: 'error',
duration: '2000'
});
}
}, 1000);
}).catch(error => {
console.error(error)
self.progressFlag = false;
self.progressPercent = 0
self.$refs.upload.clearFiles();
self.$message({
message: '上传失败!',
type: 'error',
duration: '2000'
});
})
} else {
file._shardCount = Math.ceil(file.size / this.partSize) //总片数
file.uploaded = 0
let formData = new FormData()
formData.append('fileName', file.name)
let self = this
//大文件上传初始化,返回uploadId initUpload(formData)
axios({
url: process.env.VUE_APP_BASE_API + "/common/initUpload",
method: 'post',
data: formData,
headers: {
'Authorization': 'Bearer ' + getToken(),
'Content-Type': 'multipart/form-data'
},
}).then(function (res) {
if (res.status == 200) {
//从第0块开始上传
file.uploadId = res.data.uploadId
file.objectKey = res.data
file.chunkId = 0
self.uploadByChunk(file)
} else {
this.progress--
self.$message.error(res.msg)
}
}).catch(error => {
self.progressPercent = 0
self.progressFlag = false;
console.error(error)
})
}
},
//分片上传大文件
uploadByChunk(file) {
this._start = file.chunkId * this.partSize
this._end = Math.min(file.size, this._start + this.partSize)//结束时总大小,和 开始的大小+之前的大小比较
let self = this
let fileData = file.slice(this._start, this._end)
//获取文件块MD5
let reader = new FileReader()
reader.readAsBinaryString(fileData)
let form1 = new FormData()//new一个form的实例可以进行键值对的添加
form1.append('chunkFile', fileData) //slice方法用于切出文件的一部分
form1.append('uploadId', file.uploadId)
form1.append('chunkId', (file.chunkId + 1).toString())
form1.append('shardCount', file._shardCount.toString()) //是否最后一片
self.progressFlag = true;
//上传大文件的Chunk 返回chunk的MD5 uploadChunk(form1)
axios({
url: process.env.VUE_APP_BASE_API + "/common/uploadChunk",
method: 'post',
data: form1,
headers: {
'Authorization': 'Bearer ' + getToken(),
'Content-Type': 'multipart/form-data'
},
onUploadProgress: progressEvent => {
// progressEvent.loaded:已上传文件大小
// progressEvent.total:被上传文件的总大小
//进度条
self.progressPercent = ((progressEvent.loaded / progressEvent.total) * 100) | 0;
}
}).then(response => {
if (response.status == 200) {
//判断返回的MD5值是否一致一致继续传下一块否则重传本块这里目前前后端MD5一直不一致暂时先注释掉有时间了我再研究一下
// self.md5Str[index] === response.msg ||
if (true) {
// this.$message.success('第' + (index + 1).toString() + '块文件上传成功')
file.uploaded++
self.percentageSend(file)
//如果没上传完成,继续上传一下块
file.chunkId++
if (file.chunkId < file._shardCount) {
this.uploadByChunk(file)
}
} else {
//不一致,重新传本块
this.$message.success('第' + (file.chunkId + 1).toString() + '块文件上传不成功,重新上传')
this.uploadByChunk(file.chunkId)
}
} else {
//出错,跳出循环显示错误
this.progress--
this.$message.error(response.msg)
}
})
},
//接收上传的百分值回调
percentageSend(file) {
let self = this
let perNum = Math.floor((file.uploaded / file._shardCount) * 100)
this.progressPercent = perNum
//如果上传完成,合并文件
if (perNum === 100) {
let form2 = new FormData()//new一个form的实例可以进行键值对的添加
form2.append('uploadId', file.uploadId)
form2.append('fileName', file.name)
// 大文件上传完成后合并
// 返回文件访问的URL
axios({
url: process.env.VUE_APP_BASE_API + "/common/mergeFile",
method: 'post',
data: form2,
headers: {
'Authorization': 'Bearer ' + getToken(),
'Content-Type': 'multipart/form-data'
},
}).then(res => {
if (res.status == 200) {
setTimeout(function () {
self.$message({
message: '上传成功!',
type: 'success',
duration: '2000'
});
self.progressFlag = false;
self.progressPercent = 0
self.handleResult(res,file);
}, 500);
} else {
self.$message({
message: '上传失败!',
type: 'error',
duration: '2000'
});
}
})
}
},
resetData() {
this.progress = 0;
},
handleResult(res, file) {
let self = this
const data = {
fileName: file.name,
fileSize: file.size,
fileUrl: res.data.url,
filePath: res.data.filePath,
fileOldName: res.data.originalFilename,
fileNewName: res.data.newFileName,
suffixType: res.data.suffixType
}
self.$emit("handleSuccess", data)
},
/** 清空文件 **/
clearFile(){
this.$refs.upload.clearFiles();
this.fileList = []
}
}
};
</script>

View File

@@ -9,7 +9,7 @@ const baseURL = process.env.VUE_APP_BASE_API
let downloadLoadingInstance; let downloadLoadingInstance;
export default { export default {
name(name, isDelete = true) { downloadByName(name, isDelete) {
var url = baseURL + "/common/download?fileName=" + encodeURIComponent(name) + "&delete=" + isDelete var url = baseURL + "/common/download?fileName=" + encodeURIComponent(name) + "&delete=" + isDelete
axios({ axios({
method: 'get', method: 'get',

View File

@@ -3,103 +3,133 @@
<el-form ref="form" :model="form" :rules="rules" label-width="150px"> <el-form ref="form" :model="form" :rules="rules" label-width="150px">
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<!--<el-form-item label="文档类别" required> <el-form-item label="文件分类" prop="docCategoryId">
<el-select placeholder="请选择"> <treeselect v-model="form.docCategoryId" :options="docCategory" :show-count="true" placeholder="请选择文件分类"/>
<el-option label="管理手册" value=""></el-option>
<el-option label="操作手册" value=""></el-option>
<el-option label="程序文件" value=""></el-option>
<el-option label="需求文档" value=""></el-option>
</el-select>
</el-form-item>-->
<el-form-item label="文档类别" prop="docType">
<el-input v-model="form.docType" placeholder="请输入文档类别" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24">
<el-form-item label="文档编号" prop="docCode">
<el-input v-model="form.docCode" placeholder="请输入文档编号" maxlength="50" show-word-limit/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="文档名称" prop="docName">
<el-input v-model="form.docName" placeholder="请输入文档名称" maxlength="200" show-word-limit/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="文档类别" prop="docType" style="width: 100%">
<el-select v-model="form.docType" placeholder="请选择文档来源" style="width: 100% !important;">
<el-option style="width: 100%"
v-for="dict in dict.type.doc_class"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="文档来源" prop="docSource"> <el-form-item label="文档来源" prop="docSource">
<el-input v-model="form.docSource" placeholder="请输入文档来源" /> <el-select v-model="form.docSource" placeholder="请选择文档来源" style="width: 100%">
<el-option
v-for="dict in dict.type.doc_source"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
<!-- <el-input v-model="form.docSource" placeholder="请输入文档来源" maxlength="50" show-word-limit/>-->
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24" v-if="relatedTool">
<el-form-item label="关联工具" prop="toolId"> <el-form-item label="关联工具" prop="toolId">
<el-input v-model="form.toolId" placeholder="请选择关联工具" @focus="drawer1 = true"/> <el-select
v-model="toolDataInfo"
ref="selectHeadTool"
multiple
value-key="toolId"
filterable
remote
placeholder="请选择关联工具"
@focus="toolSelect">
<el-option
v-for="item in toolDataInfo"
:key="item.toolId"
:label="item.toolName"
:value="item">
</el-option>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="负责人" prop="docPrincipals"> <el-form-item label="负责人" prop="docPrincipals">
<el-input v-model="form.docPrincipals" placeholder="请输入负责人" /> <el-input v-model="form.docPrincipals" placeholder="请输入负责人" maxlength="50" show-word-limit/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="归属部门" prop="docRespDept"> <el-form-item label="归属单位" prop="docRespDept">
<el-input v-model="form.docRespDept" placeholder="请输入归属部门" /> <treeselect v-model="form.docRespDept" :options="deptOptions" :show-count="true" placeholder="请输入归属单位"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="文件" required> <el-form-item label="文件" required>
<el-upload <uploadVue
class="upload-component" :display="editStatus"
ref="upload" :uploadUrl="uploadFileUrl"
:auto-upload="false" :type="['.txt','.doc','.docx','.pdf','.mp4','.zip','.rar','.7z','.png','.jpg','.jpeg']"
:file-list="fileList" :acceptType="acceptType"
:on-change="onChange" :limit="1"
:on-remove="onRemove" :dataFile="dataFile"
:multiple="true" ref="uploadFile"
action="" @handleSuccess="handleUploadSuccess"
> @handleError="handleUploadError"
<el-button size="small" type="primary">点击上传</el-button> />
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>
<div slot="tip" class="el-upload__tip"><el-progress :percentage="progress"></el-progress></div>
</el-upload>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="备注"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" :rows="3" maxlength="500" show-word-limit></el-input> <el-input v-model="form.remark" type="textarea" :rows="3" maxlength="500" show-word-limit></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form><!--el-form--> </el-form><!--el-form-->
<el-dialog title="选择关联工具" :visible.sync="drawer1" width="75%" append-to-body> <tool-selector ref="toolSelect" @selectHandle="selectHandle"></tool-selector>
<div>
<el-table :data="tableData2" @row-click="singleElection" highlight-current-row style="width: 100%">
<!--<el-table-column label="选择" align="center" width="65">
<template slot-scope="scope">
<el-radio :label="scope.row.prop1" v-model="radio" @change.native="getCurrentRow(scope.row)" />
</template>
</el-table-column>-->
<el-table-column align="center" width="55">
<template slot-scope="scope">
<el-radio v-model="templateSelection" :label="scope.row.prop1">&nbsp;</el-radio>
</template>
</el-table-column>
<el-table-column prop="prop1" label="工具编号"></el-table-column>
<el-table-column prop="prop2" label="工具名称"></el-table-column>
<el-table-column prop="prop5" label="工具类别" ></el-table-column>
<el-table-column prop="prop3" label="归属单位" width="180"> </el-table-column>
<el-table-column prop="prop4" label="负责人" width="100" ></el-table-column>
</el-table><!--el-table-->
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="chooseToolConfirm()"> </el-button>
<el-button @click="cancel()"> </el-button>
</div>
</el-dialog><!--el-drawer 流程监控-抽屉-->
</div><!--el-form-border 表单--> </div><!--el-form-border 表单-->
</template> </template>
<script> <script>
import { addDocument, updateDocument } from "@/api/document/document"; import { addDocument, updateDocument, getDocument } from "@/api/document/document";
import axios from 'axios'; import axios from 'axios';
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import { deptTreeSelect } from "@/api/system/user";
import { documentTree } from "@/api/documentCategory/documentCategory.js";
import Treeselect from "@riophae/vue-treeselect";
import uploadProgress from "./uploadProgress";
import uploadVue from '@/components/FileUpload/optimizeUpload.vue'
import ToolSelector from '@/components/tool-selector/index.vue'
export default { export default {
name: 'editDocument', name: 'editDocument',
components: { Treeselect, uploadProgress, uploadVue, ToolSelector},
dicts:['doc_class','doc_source'],
props: { props: {
tooId: { tooId: {
type: String, type: String,
default: "", default: "",
} required: false
},
relatedTool: {
type: Boolean,
default: true,
},
}, },
data(){ data(){
return{ return{
@@ -124,27 +154,50 @@
], ],
// 表单参数 // 表单参数
form: { form: {
docId: undefined,
docCategoryId: undefined,
docCode: '',
docName: '', docName: '',
docType: '', docType: '',
docPrincipals: '', docPrincipals: '',
docRespDept: '', docRespDept: undefined,
docSource: '', docSource: '',
toolId: '' toolId: '',
remark: undefined
}, },
fileList: [], fileList: [],
progress: 0, progress: 0,
// 表单校验 // 表单校验
rules: { rules: {
docCategoryId: [
{ required: true, message: "文档分类不能为空", trigger: "blur" }
],
docCode: [
{ required: true, message: "文档编号不能为空", trigger: "blur" }
],
docName: [
{ required: true, message: "文档名称不能为空", trigger: "blur" }
],
docType: [ docType: [
{ required: true, message: "类别不能为空", trigger: "blur" } { required: true, message: "类别不能为空", trigger: "blur" }
], ],
docSource: [ docSource: [
{ required: true, message: "文档来源不能为空", trigger: "blur" } { required: true, message: "文档来源不能为空", trigger: "blur" }
] ]
} },
docCategory:[],
deptOptions:[],
uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传文件服务器地址
fileData: null,
acceptType: ".txt,.doc,.docx,.pdf,.mp4,.zip,.rar,.7z,.png,.jpg,.jpeg",
editStatus: true,
toolDataInfo: [],
dataFile: [],
} }
}, },
created(){ created(){
this.getDeptTree();
this.getDocumentTree();
}, },
mounted(){ mounted(){
/* this.$nextTick(() => { /* this.$nextTick(() => {
@@ -153,7 +206,8 @@
}, },
methods:{ methods:{
chooseToolConfirm(){ chooseToolConfirm(){
this.form.toolId = this.templateSelection this.$set(this.form, "toolId", this.templateSelection)
this.drawer1 = false;
}, },
singleElection(row) { singleElection(row) {
this.templateSelection = row.prop1 this.templateSelection = row.prop1
@@ -182,24 +236,9 @@
}, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false; this.drawer1 = false;
this.reset(); this.reset();
}, },
onChange(file, fileList) {
// valid the suffix of file
/*let validSuffix = ['pdf', 'docx', 'doc', 'txt', 'eml', 'mp4']
let splits = file.name.split('.')
let suffix = splits[splits.length - 1]
if (!validSuffix.includes(suffix)) {
this.$message.error(`只能上传 ${validSuffix.join(',')} 类型的文件!`)
this.fileList = fileList.filter(item => item.uid !== file.uid)
return
}*/
this.fileList = fileList
},
onRemove(file, fileList) {
this.fileList = fileList.filter(item => item.uid !== file.uid)
},
generateUniqueID() { generateUniqueID() {
// 使用时间戳来生成唯一ID // 使用时间戳来生成唯一ID
const timestamp = new Date().getTime(); const timestamp = new Date().getTime();
@@ -209,82 +248,160 @@
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
let fileName = []
//编辑时走该逻辑
if(this.form.docId && (this.fileList == null || this.fileList.length <= 0 )){
fileName = this.$refs.uploadFile.fileList[0]
this.fileList = this.$refs.uploadFile.fileList
}else{
fileName = this.fileList[0]
this.fileList = this.fileList
}
//判断是否有文件再上传 //判断是否有文件再上传
if (this.fileList.length === 0) { if (this.fileList.length == 0) {
return this.$message.warning('请选取文件后再上传') return this.$message.warning('请选取文件后再上传')
} }
this.fileList.map(file =>{ /*this.fileList.map(file =>{
this.form.docName = file.name this.form.docName = file.name
}) })*/
this.form.toolId = this.toolId if(fileName){
this.$set(this.form,"docUrl", fileName.filePath)
this.$set(this.form,"docStatus", "ysc")
this.$set(this.form,"attachment", fileName)
}
if(this.toolDataInfo && this.toolDataInfo.length > 0){
this.$set(this.form,"toolId", this.toolDataInfo[0].toolId)
}
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.id != undefined) { if (this.form.docId) {
updateDocument(this.form).then(response => { updateDocument(this.form).then(res => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.$emit("submit"); this.$emit("submit");
}); });
} else { } else {
addDocument(this.form).then(response => { addDocument(this.form).then(res => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.confirmSubmit(response.data); // this.confirmSubmit(response.data);
this.$emit("submit"); this.$emit("submit");
}); });
} }
} }
}); });
}, },
testUpdate(docId){ /** 提交按钮 */
// 创建 formData 对象 assembleSubmit: function() {
const formData = new FormData() let self = this
// 将所有 的 upload 组件中的文件对象放入到 FormData 对象中 let fileName = []
this.fileList.forEach((file) => { //编辑时走该逻辑
formData.append('folder', file.raw) if(this.form.docId && (this.fileList == null || this.fileList.length <= 0 )){
}) fileName = this.$refs.uploadFile.fileList[0]
formData.append('docId', '') this.fileList = this.$refs.uploadFile.fileList
formData.append('requestId', this.generateUniqueID()) }else{
axios.post(process.env.VUE_APP_BASE_API + '/document/upload/folder', formData, { fileName = this.fileList[0]
headers: { }
'Content-Type': 'multipart/form-data', //判断是否有文件再上传
'Authorization': 'Bearer ' + getToken(), if (this.fileList.length == 0) {
return this.$message.warning('请选取文件后再上传')
}
/*this.fileList.map(file =>{
this.form.docName = file.name
})*/
if(fileName){
this.$set(this.form,"docUrl", fileName.filePath)
this.$set(this.form,"docStatus", "ysc")
this.$set(this.form,"attachment", fileName)
}
if(this.toolDataInfo && this.toolDataInfo.length > 0){
this.$set(this.form,"toolId", this.toolDataInfo[0].toolId)
}
this.$refs["form"].validate(valid => {
if (valid) {
self.$emit("docSubmitData",self.form)
} }
}).then((response) => {
if(response.data.code===200){
this.$emit("submit");
}else{
// 弹框报错 response.data.message
}
}).catch((error) => {
console.error('Failed to upload file:', error);
}); });
}, },
confirmSubmit(docId) { /** 查询部门下拉树结构 */
// 创建 formData 对象 getDeptTree() {
const formData = new FormData() deptTreeSelect().then(response => {
// 将所有 的 upload 组件中的文件对象放入到 FormData 对象中 this.deptOptions = response.data;
this.fileList.forEach((file) => {
formData.append('files', file.raw)
})
formData.append('docId', docId)
formData.append('requestId', this.generateUniqueID())
//自定义的接口也可以用ajax或者自己封装的接口
axios.post(process.env.VUE_APP_BASE_API + '/document/upload', formData, {
headers: {
'Content-Type': 'multipart/form-data',
'Authorization': 'Bearer ' + getToken(),
}
}).then((response) => {
if(response.data.code===200){
this.$emit("submit");
}else{
// 弹框报错 response.data.message
}
}).catch((error) => {
console.error('Failed to upload file:', error);
}); });
}, },
/** 查询树形下拉树结构 */
getDocumentTree() {
documentTree().then(response => {
this.docCategory = response.data;
});
},
/** 转换部门数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.deptId,
label: node.deptName,
children: node.children
};
},
// flag 为true表示新增
getData(data, flag, index) {
},
getError(message) {
this.$message.error(message);
},
handleUploadSuccess(res) {
this.fileList = []
this.fileList.push(res)
// 处理上传成功后的逻辑
},
handleUploadError(error) {
// 处理上传失败后的逻辑
},
toolSelect(){
this.$refs.selectHeadTool.blur();
this.$nextTick(()=>{
this.$refs.toolSelect.init(null,null,false)
})
},
selectHandle(source,index,data){
this.toolDataInfo = []
let toolInfo = {toolId:data.toolId,toolCode:data.toolCode,toolName:data.toolName}
this.toolDataInfo.push(toolInfo)
},
/**初始化 **/
resetForm() {
this.$refs.form.resetFields();
this.toolDataInfo = []
this.fileList = []
this.$nextTick(()=>{
this.$refs.uploadFile.clearFile();
})
},
editInit(docId, type){
this.$refs.form.resetFields();
this.toolDataInfo = []
this.$nextTick(()=>{
this.$refs.uploadFile.clearFile();
getDocument(docId).then(res => {
this.form = res.data
this.toolDataInfo = []
let toolInfo = {toolId:this.form.toolId,toolName:this.form.toolName}
this.toolDataInfo.push(toolInfo)
this.dataFile = []
let fileData = res.data.attachment
this.$set(fileData, "name", fileData.fileOldName)
this.$set(fileData, "size", fileData.fileSize)
this.dataFile.push(fileData)
});
})
}
} }
} }
</script> </script>

View File

@@ -1,18 +1,78 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-card> <el-card>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<div class="search"> <div class="search">
<div class="sl"> <div class="sl">
<el-form-item label="文档名称" prop="roleName"> <el-form-item label="文档编号" prop="docCode">
<el-input
v-model="queryParams.docCode"
placeholder="请输入文档名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="文档名称" prop="docName">
<el-input <el-input
v-model="queryParams.docName" v-model="queryParams.docName"
placeholder="请输入文档名称" placeholder="请输入文档名称"
clearable clearable
style="width: 240px"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="类别" prop="docType">
<el-select v-model="queryParams.docType" placeholder="请选择">
<el-option
v-for="dict in dict.type.doc_class"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="负责人" prop="docPrincipals">
<el-input
v-model="queryParams.docPrincipals"
placeholder="请输入负责人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="归属单位" prop="docRespDept">
<treeselect v-model="queryParams.docRespDept" :options="deptOptions"
placeholder="请选择归属单位"
:show-count="true" style="width: 150px"/>
</el-form-item>-->
<el-form-item label="来源" prop="docSource">
<el-select v-model="queryParams.docSource" placeholder="请选择" >
<el-option
v-for="dict in dict.type.doc_source"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="状态" prop="docStatus">
<el-select v-model="queryParams.docStatus" placeholder="请选择" >
<el-option
v-for="dict in dict.type.doc_upload_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="dateRange"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
</div> </div>
<div class="sr"> <div class="sr">
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@@ -23,26 +83,21 @@
</el-card> </el-card>
<el-card class="lrtt"> <el-card class="lrtt">
<div class="lt"> <div class="lt">
<el-input <el-input placeholder="请输入..." prefix-icon="el-icon-search"></el-input>
v-model="deptName"
placeholder="请输入部门名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
<div class="divide"></div><!--divide 分隔--> <div class="divide"></div><!--divide 分隔-->
<el-tree <el-tree :data="docCategory" :props="docCategoryProps" @node-click="handleNodeClick">
:data="deptOptions" <span class="custom-tree-node" slot-scope="{ node, data }">
:props="defaultProps" <span>{{ node.label }}</span>
:expand-on-click-node="false" <el-dropdown>
:filter-node-method="filterNode" <span class="el-dropdown-link"><i class="el-icon-more"></i></span>
ref="tree" <el-dropdown-menu slot="dropdown">
node-key="id" <el-dropdown-item @click.native="handleDocCategoryAdd(data)"><i class="el-icon-plus"></i>添加</el-dropdown-item>
default-expand-all <el-dropdown-item v-if="data.types != 'system'" @@click.native="handleDocCategoryUpdate(data)"><i class="el-icon-edit"></i>编辑</el-dropdown-item>
highlight-current <el-dropdown-item v-if="data.types != 'system'" @@click.native="handleDocCategoryDelete(data)"><i class="el-icon-delete"></i>删除</el-dropdown-item>
@node-click="handleNodeClick" </el-dropdown-menu>
/> </el-dropdown>
</span>
</el-tree>
</div><!--lt --> </div><!--lt -->
<div class="rt"> <div class="rt">
<div class="operate"> <div class="operate">
@@ -52,46 +107,76 @@
icon="el-icon-upload2" icon="el-icon-upload2"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['document:add']"
>上传文档</el-button> >上传文档</el-button>
<el-button type="primary" icon="el-icon-position">发布</el-button> <el-button type="primary" icon="el-icon-position" @click="handlePush" v-hasPermi="['document:push']">发布</el-button>
<el-button icon="el-icon-delete" @click="handleDelete">批量删除</el-button> <el-button icon="el-icon-delete" @click="handleDelete" v-hasPermi="['document:batch:remove']">批量删除</el-button>
<el-button icon="el-icon-download" @click="handleOpenExport()" v-hasPermi="['document:export']">导出</el-button>
</div><!--operate 操作按钮--> </div><!--operate 操作按钮-->
<el-table v-loading="loading" :data="docList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="docList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" :selectable="isSelectable"/>
<el-table-column label="文档编号" prop="docCode" width="120" /> <el-table-column label="文档编号" align="center" prop="docCode" width="120" />
<el-table-column label="文档名称" prop="docName" :show-overflow-tooltip="true" /> <el-table-column label="文档名称" align="center" prop="docName" :show-overflow-tooltip="true" />
<el-table-column label="类别" prop="docType" :show-overflow-tooltip="true" width="80" /> <el-table-column label="类别" align="center" prop="docType" :show-overflow-tooltip="true" width="80">
<el-table-column label="负责人" prop="docPrincipals" :show-overflow-tooltip="true" width="80" />
<el-table-column label="归属部门" prop="docRespDept" :show-overflow-tooltip="true" width="150" />
<el-table-column label="来源" prop="docSource" width="100" />
<el-table-column label="关联工具" prop="roleSort" width="100" />
<el-table-column label="上传状态" prop="docUploadProgress" width="100" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag type="success" v-if="scope.row.docStatus == 'ysc'">已上传</el-tag> <dict-tag :options="dict.type.doc_class" :value="scope.row.docType"/>
<el-tag type="danger" v-else>上传失败</el-tag> </template>
</el-table-column>·
<el-table-column label="负责人" align="center" prop="docPrincipals" :show-overflow-tooltip="true" width="80" />
<el-table-column label="归属单位" align="center" prop="docRespDeptName" :show-overflow-tooltip="true" width="80" />
<el-table-column label="来源" align="center" prop="docSource" width="100">
<template slot-scope="scope">
<dict-tag :options="dict.type.doc_source" :value="scope.row.docSource"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column label="关联工具" align="center" prop="toolName" width="100" />
<el-table-column label="上传状态" align="center" prop="docStatus" width="100" >
<template slot-scope="scope">
<dict-tag :options="dict.type.doc_upload_status" :value="scope.row.docStatus"/>
</template>
<!--
<template slot-scope="scope">
<el-tag type="info" v-if="scope.row.docStatus == 'ysc'">已上传</el-tag>
<el-tag type="success" v-else-if="scope.row.docStatus == 'yfb'">已发布</el-tag>
<el-tag type="warning" v-else-if="scope.row.docStatus == 'shz'">审核中</el-tag>
</template>-->
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="180"> <el-table-column label="操作" align="center" width="180">
<template slot-scope="scope" v-if="scope.row.roleId !== 1"> <template slot-scope="scope" v-if="scope.row.roleId !== 1">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
v-if="scope.row.docStatus != 'yfb' && scope.row.docStatus != 'shz'"
@click="handleEdit(scope.row)"
v-hasPermi="['document:edit']"
>编辑</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-view" icon="el-icon-view"
@click="handlePriew(scope.row)" v-if="previewAuth(scope.row)"
@click="handlePreview(scope.row)"
v-hasPermi="['document:preview']"
>预览</el-button> >预览</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
v-if="scope.row.docStatus != 'yfb' && scope.row.docStatus != 'shz'"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['document:remove']"
>删除</el-button> >删除</el-button>
<el-button type="text" icon="el-icon-download">下载</el-button> <el-button type="text" icon="el-icon-download" @click="handleDownload(scope.row)"
v-hasPermi="['document:batch:remove']"
v-loading="loadingDownload">下载</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -106,6 +191,28 @@
</div> </div>
</el-card> </el-card>
<el-dialog :title="docCategoryTitle" :visible.sync="docCategoryOpen" width="50%" append-to-body>
<el-form ref="docCategoryForm" :model="docCategoryForm" :rules="docCategoryRules" label-width="80px">
<el-form-item label="父分类" prop="parentId">
<treeselect v-model="docCategoryForm.parentId" :options="docCategory" :show-count="true" placeholder="如果不选择,默认为顶级节点" />
</el-form-item>
<el-form-item label="分类名称" prop="categoryName">
<el-input v-model="docCategoryForm.categoryName" placeholder="请输入分类名称" maxlength="50" show-word-limit/>
</el-form-item>
<el-form-item label="分类描述" prop="categoryDescription">
<el-input v-model="docCategoryForm.categoryDescription"
type="textarea" :rows="3" maxlength="500" show-word-limit
placeholder="请输入分类描述" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="docCategorySubmitForm"> </el-button>
<el-button @click="docCategoryCancel"> </el-button>
</span>
</el-dialog>
<el-dialog :title="viewDialogTitle" :visible.sync="viewDialogOpen" fullscreen width="500px" append-to-body> <el-dialog :title="viewDialogTitle" :visible.sync="viewDialogOpen" fullscreen width="500px" append-to-body>
<i-frame :src="previewUrl" /> <i-frame :src="previewUrl" />
</el-dialog> </el-dialog>
@@ -115,28 +222,63 @@
<span class="title">新增文档资源</span> <span class="title">新增文档资源</span>
<div class="drawer-head-btn"> <div class="drawer-head-btn">
<el-button type="primary" @click="$refs.editDocumentRef.submitForm()"> </el-button> <el-button type="primary" @click="$refs.editDocumentRef.submitForm()"> </el-button>
<el-button @click="$refs.editDocumentRef.cancel()"> </el-button> <el-button @click="docCancel()"> </el-button>
</div><!--drawer-head-btn 抽屉顶部按钮区域--> </div><!--drawer-head-btn 抽屉顶部按钮区域-->
</template> </template>
<edit-document ref="editDocumentRef" @submit="editDocumentSubmit"/> <edit-document ref="editDocumentRef" @submit="editDocumentSubmit"/>
</el-drawer> </el-drawer>
<upload-progress/>
<!-- 工具导出对话框 -->
<el-drawer :visible.sync="exportDrawerOpen" size="75%" :show-close="false">
<template #title>
<span class="title">导出</span>
<div class="drawer-head-btn">
<el-button type="primary" @click="handleExport">提交</el-button>
<el-button @click="exportDrawerOpen=false">取消</el-button>
</div><!--drawer-head-btn 抽屉顶部按钮区域-->
</template>
<div class="el-form-border">
<el-form ref="form" label-width="200px">
<el-row>
<el-col :span="24">
<el-form-item label="选择需要导出的字段信息">
<el-checkbox-group v-model="checkList">
<el-checkbox label="docCode">文档编号</el-checkbox>
<el-checkbox label="docName">文档名称</el-checkbox>
<el-checkbox label="docType">类别</el-checkbox>
<el-checkbox label="docPrincipals">负责人</el-checkbox>
<el-checkbox label="docRespDeptName">归属单位</el-checkbox>
<el-checkbox label="docSource">来源</el-checkbox>
<el-checkbox label="toolName">关联工具</el-checkbox>
<el-checkbox label="docStatus">上传状态</el-checkbox>
<el-checkbox label="createTime">创建时间</el-checkbox>
</el-checkbox-group>
</el-form-item>
</el-col>
</el-row>
</el-form><!--el-form-->
</div><!--el-form-border 表单-->
</el-drawer><!--el-drawer 导出抽屉-->
<!-- <upload-progress/>-->
</div> </div>
</template> </template>
<script> <script>
import { listDocument, getDocument, delDocument, addDocument, updateDocument } from "@/api/document/document"; import { listDocument, getDocument, delDocument, addDocument, updateDocument,pushDoc } from "@/api/document/document";
import { deptTreeSelect } from "@/api/system/user"; import { deptTreeSelect } from "@/api/system/user";
import { documentTree,addCategory,updateCategory,delCategory,getCategory } from "@/api/documentCategory/documentCategory.js";
import { Base64 } from 'js-base64'; import { Base64 } from 'js-base64';
import iFrame from "@/components/iFrame/index" import iFrame from "@/components/iFrame/index"
import editDocument from "./editDocument"; import editDocument from "./editDocument";
import uploadProgress from "./uploadProgress"; import uploadProgress from "./uploadProgress";
import { w3cwebsocket as WebSocket } from 'websocket'; import { w3cwebsocket as WebSocket } from 'websocket';
import Treeselect from "@riophae/vue-treeselect";
export default { export default {
name: "Document", name: "Document",
components: { iFrame, editDocument, uploadProgress }, components: { iFrame, editDocument, uploadProgress, Treeselect},
dicts:['doc_class','doc_source','doc_upload_status'],
data() { data() {
return { return {
// 遮罩层 // 遮罩层
@@ -157,6 +299,12 @@ export default {
children: "children", children: "children",
label: "label" label: "label"
}, },
// 文档树
docCategory: undefined,
docCategoryProps: {
children: "children",
label: "label"
},
// 总条数 // 总条数
total: 0, total: 0,
// 表格数据 // 表格数据
@@ -176,7 +324,13 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
docName: undefined docName: '',
docCode: '',
docType: '',
docPrincipals: '',
docSource: '',
docStatus: '',
docCategoryId: '',
}, },
// 表单参数 // 表单参数
form: { form: {
@@ -194,12 +348,41 @@ export default {
docSource: [ docSource: [
{ required: true, message: "文档来源不能为空", trigger: "blur" } { required: true, message: "文档来源不能为空", trigger: "blur" }
] ]
} },
docCategoryRules: {
categoryName: [
{ required: true, message: "分类名称不能为空", trigger: "blur" }
],
createBy: [
{ required: true, message: "创建人名称不能为空", trigger: "blur" }
],
createById: [
{ required: true, message: "创建人id不能为空", trigger: "blur" }
],
createTime: [
{ required: true, message: "创建时间不能为空", trigger: "blur" }
],
},
docCategoryTitle: "",
docCategoryOpen: false,
// 文档资源参数
docCategoryForm: {
categoryName: null,
categoryDescription: null,
parentId: null
},
loadingDownload: false,
acceptType: "zip,rar,7z",
//导出属性
columnList: ['docCode', 'docName', 'docType', 'docPrincipals', 'docRespDeptName', 'docSource', 'toolName', 'docStatus', 'createTime'],
checkList: [],
exportDrawerOpen: false,
}; };
}, },
created() { created() {
this.getList(); this.getList();
this.getDeptTree(); this.getDeptTree();
this.getDocumentTree();
}, },
methods: { methods: {
/** 查询部门下拉树结构 */ /** 查询部门下拉树结构 */
@@ -208,6 +391,12 @@ export default {
this.deptOptions = response.data; this.deptOptions = response.data;
}); });
}, },
/** 查询树形下拉树结构 */
getDocumentTree() {
documentTree().then(response => {
this.docCategory = response.data;
});
},
// 筛选节点 // 筛选节点
filterNode(value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true;
@@ -215,18 +404,22 @@ export default {
}, },
// 节点单击事件 // 节点单击事件
handleNodeClick(data) { handleNodeClick(data) {
this.queryParams.toolRespDept = data.id; this.queryParams.docCategoryId = data.id;
this.handleQuery(); this.handleQuery();
}, },
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.loading = true; let self = this
self.loading = true;
listDocument(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listDocument(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.docList = response.rows; self.docList = response.rows;
this.total = response.total; self.total = response.total;
this.loading = false; self.loading = false;
} }
); ).catch(err=>{
console.error("getList=======", err)
self.loading = false;
});
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
@@ -236,15 +429,24 @@ export default {
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = [];
this.queryParams.docCategoryId = '';
this.resetForm("queryForm"); this.resetForm("queryForm");
this.handleQuery(); this.handleQuery();
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.open = true this.open = true
this.$nextTick(()=>{
this.$refs.editDocumentRef.resetForm();
})
}, },
handlePriew(row){ handleEdit(row){
console.log('mmmmmmmmmmm',process.env.VUE_APP_BASE_API + row.docUrl) this.open = true
this.$nextTick(()=>{
this.$refs.editDocumentRef.editInit(row.docId, "edit");
})
},
handlePreview(row){
this.previewUrl = process.env.VUE_APP_TOOL_TECH_FILE_VIEW_API + '/onlinePreview?url=' + encodeURIComponent(Base64.encode(process.env.VUE_APP_BASE_API + row.docUrl)); this.previewUrl = process.env.VUE_APP_TOOL_TECH_FILE_VIEW_API + '/onlinePreview?url=' + encodeURIComponent(Base64.encode(process.env.VUE_APP_BASE_API + row.docUrl));
this.viewDialogTitle = '文档在线预览' this.viewDialogTitle = '文档在线预览'
this.viewDialogOpen = true; this.viewDialogOpen = true;
@@ -267,8 +469,134 @@ export default {
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch((err) => {console.error(err)});
} },
/** 新增按钮操作 */
handleDocCategoryAdd(data) {
this.docCategoryOpen = true;
// this.docCategoryForm.parentId = data.id;
this.$nextTick(() => {
this.resetDocCategoryForm();
this.docCategoryForm.parentId = data.id;
})
this.docCategoryTitle = "添加文档资源分类";
},
/** 删除按钮操作 */
handleDocCategoryDelete(row) {
this.$modal.confirm('是否删除该项数据?').then(function() {
return delCategory(row.id);
}).then(() => {
this.getDocumentTree();
this.$modal.msgSuccess("删除成功");
}).catch((err) => {
console.error("err============", err)
});
},
/** 修改按钮操作 */
handleDocCategoryUpdate(row) {
this.resetDocCategoryForm();
const id = row.id;
getCategory(id).then(response => {
this.docCategoryForm = response.data;
this.docCategoryOpen = true;
this.docCategoryTitle = "修改文档资源分类";
});
},
/** 提交按钮 */
docCategorySubmitForm() {
this.$refs["docCategoryForm"].validate(valid => {
if (valid) {
if (this.docCategoryForm.id != null) {
updateCategory(this.docCategoryForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.docCategoryOpen = false;
this.getDocumentTree();
});
} else {
this.$set(this.docCategoryForm, "type", "user")
addCategory(this.docCategoryForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.docCategoryOpen = false;
this.getDocumentTree();
});
}
}
});
},
// 取消按钮
docCategoryCancel() {
this.docCategoryOpen = false;
this.resetDocCategoryForm();
},
/** 重置 **/
resetDocCategoryForm(){
this.$refs.docCategoryForm.resetFields();
},
/**
* 处理下载
* **/
handleDownload(row){
let self = this
self.loadingDownload = true
this.$download.resource(row.docUrl);
setTimeout(()=>{
self.loadingDownload = false
},1000)
},
/** 删除按钮操作 */
handlePush(row) {
const docIds = row.docId || this.ids;
this.$modal.confirm('是否确认发布?').then(function() {
return pushDoc(docIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("发布成功");
}).catch((err) => {
console.error(err)
});
},
docCancel(){
this.$refs.editDocumentRef.resetForm();
this.open = false
},
previewAuth(row){
if(row.docUrl == null || row.docUrl == '' || row.docUrl == undefined){
return false
}
let extension = this.getExtension(row.docUrl);
const acceptedExtensions = this.acceptType.toLowerCase().split(',');
if(acceptedExtensions.includes(extension)){
return false
}
return true
},
getExtension(filePath) {
// 分割字符串,以 '.' 为分隔符
const parts = filePath.split('.');
// 取最后一个部分作为后缀名
const extension = parts.pop();
return extension;
},
isSelectable(row) {
return row.docStatus !== 'yfb' && row.docStatus !== 'shz';
},
/** 导出按钮操作 */
handleOpenExport() {
if (this.checkList.length<1) {
this.checkList = JSON.parse(JSON.stringify(this.columnList))
}
this.exportDrawerOpen = true
},
/** 导出按钮操作 */
handleExport() {
let excludeFields = this.columnList.filter(item=>!this.checkList.includes(item))
this.download('/document/export', {
...this.queryParams,
downloadCheck:false,
excludeFields:excludeFields,
}, `文档资源信息数据_${new Date().getTime()}.xlsx`)
},
} }
}; };
</script> </script>

View File

@@ -124,7 +124,7 @@ export default {
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss"> <style rel="stylesheet/scss" lang="scss" scoped>
.login { .login {
display: flex; display: flex;
justify-content: center; justify-content: center;

View File

@@ -146,7 +146,7 @@ export default {
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss"> <style rel="stylesheet/scss" lang="scss" scoped>
.register { .register {
display: flex; display: flex;
justify-content: center; justify-content: center;

View File

@@ -0,0 +1,392 @@
<template>
<div class="app-container">
<el-card>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="字典名称" prop="dictType">
<el-select v-model="queryParams.dictType">
<el-option
v-for="item in typeOptions"
:key="item.dictId"
:label="item.dictName"
:value="item.dictType"
/>
</el-select>
</el-form-item>
<el-form-item label="字典标签" prop="dictLabel">
<el-input
v-model="queryParams.dictLabel"
placeholder="请输入字典标签"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="数据状态" clearable>
<el-option
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="lrtt">
<div class="rt">
<div class="operate">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:dict:add']"
>新增</el-button>
<el-button
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:dict:edit']"
>修改</el-button>
<el-button
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:dict:remove']"
>删除</el-button>
<el-button
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:dict:export']"
>导出</el-button>
<el-button
plain
icon="el-icon-close"
size="mini"
@click="handleClose"
>关闭</el-button>
</div>
<el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="字典编码" align="center" prop="dictCode" />
<el-table-column label="字典标签" align="center" prop="dictLabel">
<template slot-scope="scope">
<span v-if="(scope.row.listClass == '' || scope.row.listClass == 'default') && (scope.row.cssClass == '' || scope.row.cssClass == null)">{{ scope.row.dictLabel }}</span>
<el-tag v-else :type="scope.row.listClass == 'primary' ? '' : scope.row.listClass" :class="scope.row.cssClass">{{ scope.row.dictLabel }}</el-tag>
</template>
</el-table-column>
<el-table-column label="字典键值" align="center" prop="dictValue" />
<el-table-column label="字典排序" align="center" prop="dictSort" />
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:dict:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:dict:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</el-card>
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="字典类型">
<el-input v-model="form.dictType" :disabled="true" />
</el-form-item>
<el-form-item label="数据标签" prop="dictLabel">
<el-input v-model="form.dictLabel" placeholder="请输入数据标签" />
</el-form-item>
<el-form-item label="数据键值" prop="dictValue">
<el-input v-model="form.dictValue" placeholder="请输入数据键值" />
</el-form-item>
<el-form-item label="样式属性" prop="cssClass">
<el-input v-model="form.cssClass" placeholder="请输入样式属性" />
</el-form-item>
<el-form-item label="显示排序" prop="dictSort">
<el-input-number v-model="form.dictSort" controls-position="right" :min="0" />
</el-form-item>
<el-form-item label="回显样式" prop="listClass">
<el-select v-model="form.listClass">
<el-option
v-for="item in listClassOptions"
:key="item.value"
:label="item.label + '(' + item.value + ')'"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data";
import { optionselect as getDictOptionselect, getType } from "@/api/system/dict/type";
export default {
name: "Data",
dicts: ['sys_normal_disable'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 字典表格数据
dataList: [],
// 默认字典类型
defaultDictType: "",
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 数据标签回显样式
listClassOptions: [
{
value: "default",
label: "默认"
},
{
value: "primary",
label: "主要"
},
{
value: "success",
label: "成功"
},
{
value: "info",
label: "信息"
},
{
value: "warning",
label: "警告"
},
{
value: "danger",
label: "危险"
}
],
// 类型数据字典
typeOptions: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
dictType: undefined,
dictLabel: undefined,
status: undefined
},
// 表单参数
form: {},
// 表单校验
rules: {
dictLabel: [
{ required: true, message: "数据标签不能为空", trigger: "blur" }
],
dictValue: [
{ required: true, message: "数据键值不能为空", trigger: "blur" }
],
dictSort: [
{ required: true, message: "数据顺序不能为空", trigger: "blur" }
]
}
};
},
created() {
const dictId = this.$route.params && this.$route.params.dictId;
this.getType(dictId);
this.getTypeList();
},
methods: {
/** 查询字典类型详细 */
getType(dictId) {
getType(dictId).then(response => {
this.queryParams.dictType = response.data.dictType;
this.defaultDictType = response.data.dictType;
this.getList();
});
},
/** 查询字典类型列表 */
getTypeList() {
getDictOptionselect().then(response => {
this.typeOptions = response.data;
});
},
/** 查询字典数据列表 */
getList() {
this.loading = true;
listData(this.queryParams).then(response => {
this.dataList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
dictCode: undefined,
dictLabel: undefined,
dictValue: undefined,
cssClass: undefined,
listClass: 'default',
dictSort: 0,
status: "0",
remark: undefined
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 返回按钮操作 */
handleClose() {
const obj = { path: "/system/dict" };
this.$tab.closeOpenPage(obj);
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.queryParams.dictType = this.defaultDictType;
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加字典数据";
this.form.dictType = this.queryParams.dictType;
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.dictCode)
this.single = selection.length!=1
this.multiple = !selection.length
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const dictCode = row.dictCode || this.ids
getData(dictCode).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改字典数据";
});
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.dictCode != undefined) {
updateData(this.form).then(response => {
this.$store.dispatch('dict/removeDict', this.queryParams.dictType);
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addData(this.form).then(response => {
this.$store.dispatch('dict/removeDict', this.queryParams.dictType);
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const dictCodes = row.dictCode || this.ids;
this.$modal.confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?').then(function() {
return delData(dictCodes);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
this.$store.dispatch('dict/removeDict', this.queryParams.dictType);
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/dict/data/export', {
...this.queryParams
}, `data_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@@ -0,0 +1,341 @@
<template>
<div class="app-container">
<el-card>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="字典名称" prop="dictName">
<el-input
v-model="queryParams.dictName"
placeholder="请输入字典名称"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="字典类型" prop="dictType">
<el-input
v-model="queryParams.dictType"
placeholder="请输入字典类型"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select
v-model="queryParams.status"
placeholder="字典状态"
clearable
style="width: 240px"
>
<el-option
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="dateRange"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="lrtt">
<div class="rt">
<div class="operate">
<!--
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:dict:add']"
>新增</el-button>
<el-button
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:dict:edit']"
>修改</el-button>
<el-button
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:dict:remove']"
>删除</el-button>-->
<!--
<el-button
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:dict:export']"
>导出</el-button>-->
<el-button
plain
icon="el-icon-refresh"
size="mini"
@click="handleRefreshCache"
v-hasPermi="['system:dict:remove']"
>刷新缓存</el-button>
</div>
<el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="字典编号" align="center" prop="dictId" />
<el-table-column label="字典名称" align="center" prop="dictName" :show-overflow-tooltip="true" />
<el-table-column label="字典类型" align="center" :show-overflow-tooltip="true">
<template slot-scope="scope">
<router-link :to="'/system/dict-data/index/' + scope.row.dictId" class="link-type">
<span>{{ scope.row.dictType }}</span>
</router-link>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<!--
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:dict:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:dict:remove']"
>删除</el-button>
</template>
</el-table-column>
-->
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</el-card>
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="字典名称" prop="dictName">
<el-input v-model="form.dictName" placeholder="请输入字典名称" />
</el-form-item>
<el-form-item label="字典类型" prop="dictType">
<el-input v-model="form.dictType" placeholder="请输入字典类型" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { bizListType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type";
export default {
name: "Dict",
dicts: ['sys_normal_disable'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 字典表格数据
typeList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 日期范围
dateRange: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
dictName: undefined,
dictType: undefined,
status: undefined
},
// 表单参数
form: {},
// 表单校验
rules: {
dictName: [
{ required: true, message: "字典名称不能为空", trigger: "blur" }
],
dictType: [
{ required: true, message: "字典类型不能为空", trigger: "blur" }
]
}
};
},
created() {
this.getList();
},
methods: {
/** 查询字典类型列表 */
getList() {
this.loading = true;
bizListType(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.typeList = response.rows;
this.total = response.total;
this.loading = false;
}
);
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
dictId: undefined,
dictName: undefined,
dictType: undefined,
status: "0",
remark: undefined
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加字典类型";
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.dictId)
this.single = selection.length!=1
this.multiple = !selection.length
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const dictId = row.dictId || this.ids
getType(dictId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改字典类型";
});
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.dictId != undefined) {
updateType(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addType(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const dictIds = row.dictId || this.ids;
this.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?').then(function() {
return delType(dictIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/dict/type/export', {
...this.queryParams
}, `type_${new Date().getTime()}.xlsx`)
},
/** 刷新缓存按钮操作 */
handleRefreshCache() {
refreshCache().then(() => {
this.$modal.msgSuccess("刷新成功");
this.$store.dispatch('dict/cleanDict');
});
}
}
};
</script>

View File

@@ -80,13 +80,14 @@
@click="handleDelete" @click="handleDelete"
v-hasPermi="['system:dict:remove']" v-hasPermi="['system:dict:remove']"
>删除</el-button> >删除</el-button>
<!--
<el-button <el-button
plain plain
icon="el-icon-download" icon="el-icon-download"
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['system:dict:export']" v-hasPermi="['system:dict:export']"
>导出</el-button> >导出</el-button>-->
<el-button <el-button
plain plain
icon="el-icon-refresh" icon="el-icon-refresh"

View File

@@ -79,13 +79,14 @@
@click="handleDelete" @click="handleDelete"
v-hasPermi="['system:role:remove']" v-hasPermi="['system:role:remove']"
>删除</el-button> >删除</el-button>
<!--
<el-button <el-button
plain plain
icon="el-icon-download" icon="el-icon-download"
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['system:role:export']" v-hasPermi="['system:role:export']"
>导出</el-button> >导出</el-button>-->
</div> </div>
<el-table v-loading="loading" :data="roleList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="roleList" @selection-change="handleSelectionChange">
@@ -285,14 +286,16 @@ export default {
value: "1", value: "1",
label: "全部数据权限" label: "全部数据权限"
}, },
/*
{ {
value: "2", value: "2",
label: "自定数据权限" label: "自定数据权限"
}, },*/
{ {
value: "3", value: "3",
label: "本部门数据权限" label: "本部门数据权限"
}, }
/*,
{ {
value: "4", value: "4",
label: "本部门及以下数据权限" label: "本部门及以下数据权限"
@@ -300,7 +303,7 @@ export default {
{ {
value: "5", value: "5",
label: "仅本人数据权限" label: "仅本人数据权限"
} }*/
], ],
// 菜单列表 // 菜单列表
menuOptions: [], menuOptions: [],

View File

@@ -101,6 +101,7 @@
@click="handleDelete" @click="handleDelete"
v-hasPermi="['system:user:remove']" v-hasPermi="['system:user:remove']"
>删除</el-button> >删除</el-button>
<!--
<el-button <el-button
plain plain
icon="el-icon-upload2" icon="el-icon-upload2"
@@ -114,7 +115,7 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['system:user:export']" v-hasPermi="['system:user:export']"
>导出</el-button> >导出</el-button>-->
</div> </div>
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" /> <el-table-column type="selection" width="50" align="center" />
@@ -261,7 +262,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="角色"> <el-form-item label="角色" prop="roleIds">
<el-select v-model="form.roleIds" multiple placeholder="请选择角色"> <el-select v-model="form.roleIds" multiple placeholder="请选择角色">
<el-option <el-option
v-for="item in roleOptions" v-for="item in roleOptions"
@@ -411,6 +412,9 @@ export default {
nickName: [ nickName: [
{ required: true, message: "用户昵称不能为空", trigger: "blur" } { required: true, message: "用户昵称不能为空", trigger: "blur" }
], ],
deptId: [
{ required: true, message: "归属部门不能为空", trigger: "blur" }
],
password: [ password: [
{ required: true, message: "用户密码不能为空", trigger: "blur" }, { required: true, message: "用户密码不能为空", trigger: "blur" },
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }, { min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' },
@@ -429,7 +433,10 @@ export default {
message: "请输入正确的手机号码", message: "请输入正确的手机号码",
trigger: "blur" trigger: "blur"
} }
] ],
roleIds: [
{ required: true, message: "角色不能为空", trigger: "blur" }
],
} }
}; };
}, },

View File

@@ -1,8 +1,8 @@
<template> <template>
<el-dialog title="新增文档" :visible.sync="visible" width="85%" append-to-body> <el-dialog title="新增附件信息" :visible.sync="visible" width="85%" append-to-body>
<edit-document ref="editDocumentRef" :toolId="toolId" @submit="editDocumentSubmit"/> <edit-document ref="editDocumentRef" :toolId="toolId" @docSubmitData="editDocumentSubmit" :relatedTool="false"/>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="$refs.editDocumentRef.submitForm()"> </el-button> <el-button type="primary" @click="submitForm()"> </el-button>
<el-button @click="cancel()"> </el-button> <el-button @click="cancel()"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
@@ -26,7 +26,7 @@ export default {
*/ */
toolId: { toolId: {
type: String, type: String,
default: true default: ''
} }
}, },
computed: { computed: {
@@ -45,13 +45,19 @@ export default {
} }
}, },
methods: { methods: {
editDocumentSubmit(){ editDocumentSubmit(data){
this.$emit('callback') this.$emit("addFileData", data)
this.visible = false this.visible = false
}, },
cancel() { cancel() {
this.$refs.editDocumentRef.cancel() this.$refs.editDocumentRef.cancel()
this.visible = false this.visible = false
},
submitForm(){
this.$refs.editDocumentRef.assembleSubmit()
},
resetForm(){
this.$refs.editDocumentRef.resetForm()
} }
} }
} }

View File

@@ -1,7 +1,7 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-card> <el-card>
<el-form label-width="80px" ref="queryForm"> <el-form :model="queryParams" label-width="80px" ref="queryForm">
<div class="grab" id="add"> <div class="grab" id="add">
<div class="search"> <div class="search">
<div class="sl"> <div class="sl">
@@ -50,7 +50,7 @@
</div> </div>
<div class="sr"> <div class="sr">
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh-left" @click="reset">重置</el-button> <el-button icon="el-icon-refresh-left" @click="resetQuery">重置</el-button>
</div> </div>
</div><!--search 默认查询--> </div><!--search 默认查询-->
</div><!--grab--> </div><!--grab-->
@@ -58,7 +58,7 @@
</el-card><!--el-card--> </el-card><!--el-card-->
<el-card class="lrtt"> <el-card class="lrtt">
<div class="lt"> <div class="lt" v-hasPermi="['tool:org:tree']">
<el-input <el-input
v-model="deptName" v-model="deptName"
placeholder="请输入部门名称" placeholder="请输入部门名称"
@@ -87,10 +87,9 @@
plain plain
icon="el-icon-plus" icon="el-icon-plus"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['system:user:add']"
>工具发布</el-button> >工具发布</el-button>
<el-button icon="el-icon-delete" @click="handleDelete(selection)">批量删除</el-button> <el-button icon="el-icon-delete" @click="handleDelete(selection)" v-hasPermi="['tool:batch:remove']">批量删除</el-button>
<el-button icon="el-icon-download" @click="handleOpenExport()">导出</el-button> <el-button icon="el-icon-download" @click="handleOpenExport()" v-hasPermi="['tool:export']">导出</el-button>
</div><!--operate 操作按钮--> </div><!--operate 操作按钮-->
<el-table v-loading="loading" :data="toolList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="toolList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" :selectable="selectable"/> <el-table-column type="selection" width="50" align="center" :selectable="selectable"/>
@@ -120,7 +119,7 @@
class-name="small-padding fixed-width" class-name="small-padding fixed-width"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" icon="el-icon-info" v-if="scope.row.recordStatus==='done'" @click="applyUse(scope.row)">申请使用</el-button> <el-button type="text" icon="el-icon-info" v-if="scope.row.recordStatus=='done'" @click="applyUse(scope.row)">申请使用</el-button>
<el-button type="text" icon="el-icon-info" @click="handleDetail(scope.row)">详情</el-button> <el-button type="text" icon="el-icon-info" @click="handleDetail(scope.row)">详情</el-button>
<el-button type="text" icon="el-icon-download" v-if="scope.row.downloadStatus">下载</el-button> <el-button type="text" icon="el-icon-download" v-if="scope.row.downloadStatus">下载</el-button>
<el-dropdown size="mini" v-if="selectable(scope.row)" @command="(command) => handleCommand(command, scope.row)"> <el-dropdown size="mini" v-if="selectable(scope.row)" @command="(command) => handleCommand(command, scope.row)">
@@ -192,11 +191,13 @@
</el-drawer> </el-drawer>
<!-- 工具详情对话框 --> <!-- 工具详情对话框 -->
<el-drawer :visible.sync="detailDrawerOpen" :modal-append-to-body="false" size="85%" class="no-padding"> <el-drawer :visible.sync="detailDrawerOpen" :modal-append-to-body="false" size="85%" class="no-padding" @close="handleCloseDetail()">
<template #title> <template #title>
<span>工具名称</span> <span>工具名称</span>
</template> </template>
<tool-detail ref="toolDetailRef" :toolDetail="toolDetail"/> <template v-if="detailOpen">
<tool-detail ref="toolDetailRef" :toolDetail="toolDetail"/>
</template>
</el-drawer><!--el-drawer 详情-抽屉--> </el-drawer><!--el-drawer 详情-抽屉-->
</div><!--app-container--> </div><!--app-container-->
@@ -251,6 +252,7 @@ export default {
addDrawerOpen: false, addDrawerOpen: false,
exoportDrawerOpen: false, exoportDrawerOpen: false,
detailDrawerOpen: false, detailDrawerOpen: false,
detailOpen: false,
detailActiveName: 'first', detailActiveName: 'first',
// 部门名称 // 部门名称
deptName: undefined, deptName: undefined,
@@ -436,6 +438,7 @@ export default {
}, },
handleDetail(row){ handleDetail(row){
this.detailDrawerOpen = true this.detailDrawerOpen = true
this.detailOpen = true
this.toolDetail = row this.toolDetail = row
}, },
// 更多操作触发 // 更多操作触发
@@ -482,9 +485,6 @@ export default {
downloadCheck:false, downloadCheck:false,
excludeFields:excludeFields, excludeFields:excludeFields,
}, `工具信息数据_${new Date().getTime()}.xlsx`) }, `工具信息数据_${new Date().getTime()}.xlsx`)
},
handleUseApply(){
}, },
// 文件上传中处理 // 文件上传中处理
handleFileUploadProgress(event, file, fileList) { handleFileUploadProgress(event, file, fileList) {
@@ -537,6 +537,16 @@ export default {
}, },
selectable(row,index){ selectable(row,index){
return row.recordStatus==='draft'&&row.createBy==this.userInfo.userId return row.recordStatus==='draft'&&row.createBy==this.userInfo.userId
},
/** 关闭详情 **/
handleCloseDetail(){
console.info("1111111111")
this.detailDrawerOpen = false;
this.detailOpen = false;
this.$refs.toolDetailRef.$destroy(); // 销毁组件
this.$nextTick(() => {
this.$refs.toolDetailRef = null; // 清空引用
});
} }
} }
}; };

View File

@@ -28,17 +28,20 @@
</div><!--el-form-border 表单--> </div><!--el-form-border 表单-->
</el-tab-pane><!--el-tab-pane--> </el-tab-pane><!--el-tab-pane-->
<el-tab-pane label="关联文件" name="second"> <el-tab-pane label="关联文件" name="second">
<div class="operate">
<el-button type="primary" icon="el-icon-upload2" @click="handleAdd">上传</el-button>
<el-button icon="el-icon-delete">删除</el-button>
</div><!--operate 操作按钮-->
<el-table :data="docList" style="width: 100%"> <el-table :data="docList" style="width: 100%">
<el-table-column type="selection" width="50" align="center"> </el-table-column>
<el-table-column label="文档名称" prop="docName" :show-overflow-tooltip="true" /> <el-table-column label="文档名称" prop="docName" :show-overflow-tooltip="true" />
<el-table-column label="类别" prop="docType" :show-overflow-tooltip="true" width="80" /> <el-table-column label="类别" prop="docType" :show-overflow-tooltip="true" width="80" >
<template slot-scope="scope">
<dict-tag :options="dict.type.doc_class" :value="scope.row.docType"/>
</template>
</el-table-column>
<el-table-column label="负责人" prop="docPrincipals" :show-overflow-tooltip="true" width="80" /> <el-table-column label="负责人" prop="docPrincipals" :show-overflow-tooltip="true" width="80" />
<el-table-column label="归属部门" prop="docRespDept" :show-overflow-tooltip="true" width="150" /> <el-table-column label="归属单位" align="center" prop="docRespDeptName" :show-overflow-tooltip="true" width="80" />
<el-table-column label="来源" prop="docSource" width="100" /> <el-table-column label="来源" prop="docSource" width="100" >
<template slot-scope="scope">
<dict-tag :options="dict.type.doc_source" :value="scope.row.docSource"/>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
@@ -52,19 +55,69 @@
icon="el-icon-view" icon="el-icon-view"
@click="handlePriew(scope.row)" @click="handlePriew(scope.row)"
>预览</el-button> >预览</el-button>
<el-button <el-button type="text" icon="el-icon-download" @click="handleDownload(scope.row)" v-loading="loadingDownload">下载</el-button>
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
<el-button type="text" icon="el-icon-download">下载</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table><!--el-table--> </el-table><!--el-table-->
</el-tab-pane><!--el-tab-pane--> </el-tab-pane><!--el-tab-pane-->
</el-tabs><!--el-tabs--> </el-tabs><!--el-tabs-->
</div><!--fl 左侧页签--> </div><!--fl 左侧页签-->
<div class="fr">
<div class="tboper">
<div class="tit">评论</div>
</div><!--tboper 标题与操作按钮-->
<div class="pltextarea">
<el-input v-model="discussionContent" type="textarea" placeholder="请输入您的意见" :rows="4" maxlength="1000" show-word-limit></el-input>
<div class="plbtn"><el-button @click="handleDiscussions">发布</el-button></div>
</div><!--pltextarea-->
<div class="pllist">
<template v-if="discussionsList && discussionsList.length > 0">
<div class="list" v-for="(item,index) in discussionsList" :key="item.id">
<div class="luser"><span class="xuser">{{getFirstChar(item.nickName)}}</span></div>
<div class="ltext">
<div class="nt"><span class="name">{{item.nickName}}</span><span class="time">{{ parseTime(item.createTime, '{y}-{m}-{d} {h}:{i}') }}</span></div>
<div class="te">{{item.content}}</div>
<div class="hb">
<a class="btn" @click="toggleReplyForm(index)">
<i class="el-icon-chat-line-round"></i>回复
</a>
</div>
<div class="pltextarea" v-if="showReplyForm[index]">
<el-input type="textarea" v-model="replyContent[index]" placeholder="请输入您的意见" :rows="2" maxlength="1000" show-word-limit></el-input>
<div class="plbtn">
<el-button @click="cancelReply(index)">取消</el-button>
<el-divider direction="vertical"></el-divider>
<el-button @click="submitReply(index, item)">发布</el-button>
</div>
</div>
<!--第二层级-->
<template v-if="item.repliesList && item.repliesList.length > 0">
<div class="list" v-for="(repItem,repIdex) in item.repliesList" :key="repItem.id">
<div class="luser"><span class="xuser">{{getFirstChar(repItem.nickName)}}</span></div>
<div class="ltext">
<div class="nt"><span class="name">{{repItem.nickName}}</span><span class="time">{{ parseTime(repItem.createTime, '{y}-{m}-{d} {h}:{i}') }}</span></div>
<div class="te">{{repItem.content}}</div>
<!-- <div class="hb"><a class="btn" @click="toggleReplyFormSon(index,repIdex)"><i class="el-icon-chat-line-round"></i>回复</a></div>
<div class="pltextarea" v-if="item.showReplyFormSon[repIdex]">
<el-input type="textarea" v-model="item.replyContentSon[repIdex]" placeholder="请输入您的意见" :rows="2" maxlength="1000" show-word-limit></el-input>
<div class="plbtn">
<el-button @click="cancelReplySon(index,repIdex)">取消</el-button>
<el-divider direction="vertical"></el-divider>
<el-button @click="submitReplySon(index,repIdex, item)">发布</el-button>
</div>
</div>-->
</div>
</div>
</template>
</div>
</div>
</template>
</div>
</div>
<el-dialog :title="viewDialogTitle" :visible.sync="viewDialogOpen" fullscreen width="500px" append-to-body>
<i-frame :src="previewUrl" />
</el-dialog>
<!-- 上传 --> <!-- 上传 -->
<AddDoc :show.sync="open" :toolId="toolDetail.toolId" @callback="getDocList"/> <AddDoc :show.sync="open" :toolId="toolDetail.toolId" @callback="getDocList"/>
</div><!--fbox1 左右分栏--> </div><!--fbox1 左右分栏-->
@@ -72,13 +125,18 @@
<script> <script>
import { listDocument, getDocument, delDocument, addDocument, updateDocument } from "@/api/document/document"; import { listDocument, getDocument, delDocument, addDocument, updateDocument } from "@/api/document/document";
import { listDiscussions, addDiscussions } from "@/api/tool/discussions.js";
import { listReplies, addReplies} from "@/api/tool/replies.js";
import AddDoc from './AddDoc' import AddDoc from './AddDoc'
import editDocument from "../document/editDocument"; import editDocument from "../document/editDocument";
import { Base64 } from 'js-base64'; import { Base64 } from 'js-base64';
import iFrame from "@/components/iFrame/index"
export default { export default {
name: 'toolDetail', name: 'toolDetail',
components: { editDocument, AddDoc }, components: { editDocument, AddDoc, iFrame },
dicts:['sys_normal_disable','tool_type'], dicts:['sys_normal_disable','tool_type','doc_class','doc_source'],
props: { props: {
toolDetail: { toolDetail: {
type: Object, type: Object,
@@ -99,10 +157,26 @@
viewDialogOpen: false, viewDialogOpen: false,
title: '新增文档', title: '新增文档',
open: false, open: false,
loadingDownload: false,
discussionContent: null, // 评论内容
repliesContent: null, // 回复内容
// 评论列表
discussionsList: [],
// 回复列表
repliesList: [],
showReplyForm: [],
replyContent: [],
} }
}, },
created(){ created(){
this.getDocList() this.getDocList()
this.getDiscussionsList()
},
watch: {
discussionsList(newList) {
this.showReplyForm = new Array(newList.length).fill(false);
this.replyContent = new Array(newList.length).fill('');
}
}, },
methods:{ methods:{
getDocList() { getDocList() {
@@ -136,7 +210,164 @@
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {});
} },
/**
* 处理下载
* **/
handleDownload(row){
let self = this
self.loadingDownload = true
this.$download.resource(row.docUrl);
setTimeout(()=>{
self.loadingDownload = false
},1000)
},
getDiscussionsList() {
let self = this
listDiscussions({businessId:this.toolDetail.toolId}).then(res => {
self.discussionsList = res.rows
self.discussionsList.forEach(item => {
if(item.repliesList && item.repliesList.length > 0){
self.$set(item, 'showReplyFormSon', new Array(item.repliesList.length).fill(false))
self.$set(item, 'replyContentSon', new Array(item.repliesList.length).fill(''))
}else{
self.$set(item, 'showReplyFormSon', false)
self.$set(item, 'replyContentSon', '')
}
});
});
},
/** 评论 **/
handleDiscussions(){
let self = this
if (this.discussionContent == '' || this.discussionContent == null || this.discussionContent == undefined) {
self.$message({
message: '内容不能为空',//提示的信息
type:'warning',  //类型是成功
duration:1200,  //显示时间, 毫秒。设为 0 则不会自动关闭建议1200
});
return;
}
let data = {
businessId: this.toolDetail.toolId,
content: this.discussionContent,
type: "tool",
}
self.$modal.confirm('是否确认发布?').then(()=> {
addDiscussions(data).then(res => {
this.discussionContent = null
self.$message({
message: '发布成功',//提示的信息
type:'success',  //类型是成功
duration:1200,  //显示时间, 毫秒。设为 0 则不会自动关闭建议1200
});
self.getDiscussionsList()
}).catch(err =>{
this.discussionContent = null
console.error("handleDiscussions==err==", err)
self.$modal.msgError("发布失败");
});
})
},
getFirstChar(value) {
if(!value){return ''}
return value.charAt(0);
},
toggleReplyForm(index) {
this.$set(this.showReplyForm, index, !this.showReplyForm[index]);
},
cancelReply(index) {
this.$set(this.showReplyForm, index, false);
this.$set(this.replyContent, index, '');
},
/** 回复 **/
submitReply(index, item) {
let self = this
const content = this.replyContent[index];
if (content == '' || content == null || content == undefined) {
self.$message({
message: '回复内容不能为空',//提示的信息
type:'warning',  //类型是成功
duration:1200,  //显示时间, 毫秒。设为 0 则不会自动关闭建议1200
});
return;
}
let data = {
"discussionId": item.id,
"content": content,
}
self.$modal.confirm('是否确认发布?').then(()=> {
addReplies(data).then(res => {
self.$message({
message: '发布成功',//提示的信息
type:'success',  //类型是成功
duration:1200,  //显示时间, 毫秒。设为 0 则不会自动关闭建议1200
});
self.cancelReply(index)
self.getDiscussionsList()
}).catch(err =>{
console.error("handleDiscussions==err==", err)
self.$modal.msgError("发布失败");
});
})
// 清空回复内容并隐藏表单
this.replyContent[index] = '';
this.showReplyForm[index] = false;
},
/** 第二级 **/
toggleReplyFormSon(parentIndex, repIndex) {
const parentItem = this.discussionsList[parentIndex];
this.$set(parentItem.showReplyFormSon, repIndex, !parentItem.showReplyFormSon[repIndex]);
// this.$set(this.showReplyFormSon, index, !this.showReplyFormSon[index]);
},
/** 第二级,取消回复 **/
cancelReplySon(parentIndex, repIndex) {
const parentItem = this.discussionsList[parentIndex];
this.$set(parentItem.showReplyFormSon, repIndex, false);
this.$set(parentItem.replyContentSon, repIndex, '');
},
/** 第二级回复 **/
submitReplySon(parentIndex, repIndex, repItem) {
let self = this
const parentItem = this.discussionsList[parentIndex];
const content = parentItem.replyContentSon[repIndex];
if (content.trim() == '' || content == null || content == undefined) {
self.$message({
message: '回复内容不能为空',//提示的信息
type:'warning',  //类型是成功
duration:1200,  //显示时间, 毫秒。设为 0 则不会自动关闭建议1200
});
return;
}
let data = {
"discussionId": repItem.id,
"content": content,
}
self.$modal.confirm('是否确认发布?').then(()=> {
addReplies(data).then(res => {
self.$message({
message: '发布成功',//提示的信息
type:'success',  //类型是成功
duration:1200,  //显示时间, 毫秒。设为 0 则不会自动关闭建议1200
});
self.cancelReplySon(parentIndex, repIndex)
self.getDiscussionsList()
}).catch(err =>{
console.error("submitReplySon==err==", err)
self.$modal.msgError("发布失败");
});
})
// 清空回复内容并隐藏表单
this.$set(parentItem.replyContentSon, repIndex, '');
this.$set(parentItem.showReplyFormSon, repIndex, false);
},
} }
} }
</script> </script>

View File

@@ -157,16 +157,28 @@
关联附件 关联附件
</div> </div>
<div class="operate"> <div class="operate">
<el-button type="primary" icon="el-icon-upload2" @click="handleDocAdd">上传</el-button> <el-button type="primary" icon="el-icon-upload2" v-if="editStatus" @click="handleDocAdd">上传</el-button>
<el-button icon="el-icon-delete">删除</el-button> <!-- <el-button icon="el-icon-delete">删除</el-button>-->
</div><!--operate 操作按钮--> </div><!--operate 操作按钮-->
<el-table :data="docList" style="width: 100%"> <el-table :data="docList" style="width: 100%">
<el-table-column type="selection" width="50" align="center"> </el-table-column> <!-- <el-table-column type="selection" width="50" align="center"> </el-table-column>-->
<el-table-column label="文档名称" prop="docName" :show-overflow-tooltip="true" /> <el-table-column label="文档名称" prop="docName" :show-overflow-tooltip="true" />
<el-table-column label="类别" prop="docType" :show-overflow-tooltip="true" width="80" /> <el-table-column label="类别" prop="docType" :show-overflow-tooltip="true" width="80" >
<template slot-scope="scope">
<dict-tag :options="dict.type.doc_class" :value="scope.row.docType"/>
</template>
</el-table-column>
<el-table-column label="负责人" prop="docPrincipals" :show-overflow-tooltip="true" width="80" /> <el-table-column label="负责人" prop="docPrincipals" :show-overflow-tooltip="true" width="80" />
<el-table-column label="归属部门" prop="docRespDept" :show-overflow-tooltip="true" width="150" /> <el-table-column label="归属部门" prop="docRespDept" :show-overflow-tooltip="true" width="150" >
<el-table-column label="来源" prop="docSource" width="100" /> <template slot-scope="scope">
{{convertDeptName(scope.row)}}
</template>
</el-table-column>
<el-table-column label="来源" prop="docSource" width="100" >
<template slot-scope="scope">
<dict-tag :options="dict.type.doc_source" :value="scope.row.docSource"/>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
@@ -178,15 +190,17 @@
size="mini" size="mini"
type="text" type="text"
icon="el-icon-view" icon="el-icon-view"
@click="handlePriew(scope.row)" v-if="isShowOperation(scope.row)"
@click="handlePreview(scope.row)"
>预览</el-button> >预览</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
v-if="editStatus"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
>删除</el-button> >删除</el-button>
<el-button type="text" icon="el-icon-download">下载</el-button> <el-button type="text" icon="el-icon-download" v-if="isShowOperation(scope.row)" @click="handleDownload(scope.row)" v-loading="loadingDownload">下载</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table><!--el-table--> </el-table><!--el-table-->
@@ -225,7 +239,7 @@
</div> </div>
</el-form> </el-form>
<!-- 上传 --> <!-- 上传 -->
<add-doc :show.sync="addDocShow" toolId="1111"/> <add-doc :show.sync="addDocShow" ref="addDocRef" @addFileData="addFileData"/>
</div><!--el-form-border 表单--> </div><!--el-form-border 表单-->
<div v-show="activeName==='log'"> <div v-show="activeName==='log'">
<workflow-logs :procInstId = "pListData.procInstId"></workflow-logs> <workflow-logs :procInstId = "pListData.procInstId"></workflow-logs>
@@ -260,10 +274,16 @@
></monitor-drawer> ></monitor-drawer>
<tool-selector ref="toolSelect" @selectHandle="selectHandle"></tool-selector> <tool-selector ref="toolSelect" @selectHandle="selectHandle"></tool-selector>
<bl-user-selector ref="peopleSelect" :type="'single'" :isCheck="true" :open="toolPrincipalsChoose" @cancel="toolPrincipalsChoose=false" @submit="submitPeople"></bl-user-selector> <bl-user-selector ref="peopleSelect" :type="'single'" :isCheck="true" :open="toolPrincipalsChoose" @cancel="toolPrincipalsChoose=false" @submit="submitPeople"></bl-user-selector>
<el-dialog :title="viewDialogTitle" :visible.sync="viewDialogOpen" fullscreen width="500px" append-to-body>
<i-frame :src="previewUrl" />
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listDocument } from "@/api/document/document"; import iFrame from "@/components/iFrame/index"
import { listDocument,delDocument } from "@/api/document/document";
import processcode from "@/views/workflowList/processcode/index.vue"; import processcode from "@/views/workflowList/processcode/index.vue";
import { import {
workflowprocesskey, workflowprocesskey,
@@ -278,15 +298,17 @@ import { deptTreeSelect } from "@/api/system/user";
import { addTool, checkToolExist, getInfoByBpmcId, updateTool } from '@/api/tool/tool' import { addTool, checkToolExist, getInfoByBpmcId, updateTool } from '@/api/tool/tool'
import blUserSelector from '@/components/user-selector/src/user-selector.vue' import blUserSelector from '@/components/user-selector/src/user-selector.vue'
import ToolSelector from '@/components/tool-selector/index.vue' import ToolSelector from '@/components/tool-selector/index.vue'
import { Base64 } from 'js-base64'
// PDF本地文件预览 // PDF本地文件预览
export default { export default {
dicts: ['sys_normal_disable','tool_type'], dicts: ['sys_normal_disable','tool_type','doc_source','doc_class'],
components: { components: {
ToolSelector, ToolSelector,
blUserSelector, blUserSelector,
Treeselect, AddDoc, Treeselect, AddDoc,
WorkflowLogs, WorkflowLogs,
processcode, processcode,
iFrame
}, },
name: "Borrow_doc", name: "Borrow_doc",
props: ['data'], props: ['data'],
@@ -392,6 +414,10 @@ export default {
flowStepLoading : false, flowStepLoading : false,
// 默认密码 // 默认密码
initPassword: undefined, initPassword: undefined,
viewDialogTitle: "",
viewDialogOpen: false,
previewUrl: '',
loadingDownload: false,
}; };
}, },
computed: {}, computed: {},
@@ -445,6 +471,7 @@ export default {
getInfoByBpmcId(procInstId).then(async (res) => { getInfoByBpmcId(procInstId).then(async (res) => {
let formData = res.data; let formData = res.data;
formData.type = _this.form.type formData.type = _this.form.type
// _this.docList = formData.documentList
formData.association = JSON.parse(res.data.association) formData.association = JSON.parse(res.data.association)
_this.form = formData _this.form = formData
_this.getDocumentList(res.data.toolId) _this.getDocumentList(res.data.toolId)
@@ -547,6 +574,7 @@ export default {
formData.editStatus = _this.editStatus formData.editStatus = _this.editStatus
formData.association = JSON.stringify(_this.form.association) formData.association = JSON.stringify(_this.form.association)
if (formData.toolId) { if (formData.toolId) {
this.$set(formData,'documentList',_this.docList)
updateTool(formData).then((res) => { updateTool(formData).then((res) => {
if (res.code===200) { if (res.code===200) {
_this.$message({ _this.$message({
@@ -582,6 +610,7 @@ export default {
review: _this.attributeModelBool('approve'), review: _this.attributeModelBool('approve'),
}; };
formData.editStatus = _this.editStatus formData.editStatus = _this.editStatus
this.$set(formData,'documentList',_this.docList)
addTool(formData).then((res) => { addTool(formData).then((res) => {
if (res.code===200) { if (res.code===200) {
_this.form.toolId = res.data.businessKey; _this.form.toolId = res.data.businessKey;
@@ -725,6 +754,7 @@ export default {
formData.recordStatus = 'doing' formData.recordStatus = 'doing'
} }
formData.editStatus = _this.editStatus formData.editStatus = _this.editStatus
this.$set(formData,'documentList',_this.docList)
addTool(formData).then((res) => { addTool(formData).then((res) => {
if (res.code===200) { if (res.code===200) {
_this.$message({ _this.$message({
@@ -747,21 +777,25 @@ export default {
this.$refs.monitorDrawer.init(this.pListData.procInstId); this.$refs.monitorDrawer.init(this.pListData.procInstId);
}); });
}, },
handleDelete(dataList,index){ handleDelete(row){
dataList.splice(index,1) this.docList.splice(row,1)
}, },
/** /**
* 新增上传附件 * 新增上传附件
*/ */
handleDocAdd() { handleDocAdd() {
this.addDocShow = true this.addDocShow = true
this.$nextTick(() => {
this.$refs.addDocRef.resetForm()
})
}, },
getDocumentList(toolId) { getDocumentList(toolId) {
this.loading = true this.loading = true
this.docQueryParams.toolId = toolId this.docQueryParams.toolId = toolId
listDocument(this.docQueryParams).then(response => { this.$set(this.docQueryParams,'isDeleted',"0")
this.docList = response.rows; listDocument(this.docQueryParams).then(res => {
this.total = response.total; this.docList = res.rows;
this.total = res.total;
this.loading = false; this.loading = false;
} }
); );
@@ -790,7 +824,58 @@ export default {
list.push({toolId:itme.toolId,toolName:itme.toolName}) list.push({toolId:itme.toolId,toolName:itme.toolName})
}) })
this.form.association = list this.form.association = list
} },
/** 添加关联附件数据**/
addFileData(dataInfo){
let document = JSON.parse(JSON.stringify(dataInfo))
this.docList.push(document)
},
findDeptInTree(tree, id) {
for (const node of tree) {
if (node.id == id) {
return node;
}
if (node.children && node.children.length > 0) {
const found = this.findDeptInTree(node.children, id);
if (found) {
return found;
}
}
}
return null;
},
/** 获取部门名称 **/
convertDeptName(row){
let foundDept = this.findDeptInTree(this.deptOptions, row.docRespDept);
if(foundDept){
return foundDept.label
}
return null
},
isShowOperation(row){
let self = this
if(row.docId == null || row.docId == undefined || row.docId == ''){
return false
}
return true
},
handlePreview(row){
this.previewUrl = process.env.VUE_APP_TOOL_TECH_FILE_VIEW_API + '/onlinePreview?url=' + encodeURIComponent(Base64.encode(process.env.VUE_APP_BASE_API + row.docUrl));
this.viewDialogTitle = '文档在线预览'
this.viewDialogOpen = true;
},
/**
* 处理下载
* **/
handleDownload(row){
let self = this
self.loadingDownload = true
this.$download.resource(row.docUrl);
setTimeout(()=>{
self.loadingDownload = false
},1000)
},
}, },
}; };
</script> </script>