release-v1.0 #1
@ -876,7 +876,6 @@ body .el-form-border .el-form-item .el-cascader ,
|
||||
body .el-form-border .el-form-item .el-select,
|
||||
body .el-form-border .el-form-item .el-date-editor{
|
||||
width: 100%;
|
||||
max-width: 340px;
|
||||
}
|
||||
body .el-form-border .el-form-item .el-checkbox-group .el-checkbox{
|
||||
min-width: 200px;
|
||||
|
@ -42,3 +42,13 @@ export function delDocument(id) {
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 发布文档
|
||||
export function pushDoc(id) {
|
||||
return request({
|
||||
url: '/document/pushDoc/' + id,
|
||||
method: 'put'
|
||||
})
|
||||
}
|
||||
|
@ -33,22 +33,6 @@ export default {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
headers: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
extraData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
onSuccess: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
},
|
||||
onError: {
|
||||
type: Function,
|
||||
default: () => {}
|
||||
},
|
||||
// 是否多选
|
||||
isMultiple: {
|
||||
type: Boolean,
|
||||
@ -75,6 +59,13 @@ export default {
|
||||
return 1
|
||||
}
|
||||
},
|
||||
// 文件
|
||||
dataFile: {
|
||||
type: [Object, Array, String],
|
||||
default() {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -86,6 +77,18 @@ export default {
|
||||
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) {
|
||||
@ -99,67 +102,6 @@ export default {
|
||||
return false
|
||||
}*/
|
||||
},
|
||||
/* //上传函数
|
||||
submitUpload(file) {
|
||||
//重新命名 方便setTimeout函数 --因为setTimeout函数在vue内部中无效
|
||||
var that = this;
|
||||
// that.$refs.upload.submit();
|
||||
//判断上传文件数量
|
||||
if (this.fileList.length == 0) {
|
||||
that.$message({
|
||||
message: '请选择导入的文件',
|
||||
type: 'warning',
|
||||
duration: '2000'
|
||||
});
|
||||
return;
|
||||
}
|
||||
//创建FormData();主要用于发送表单数据
|
||||
let paramFormData = new FormData();
|
||||
//遍历 fileList
|
||||
that.fileList.forEach(file => {
|
||||
paramFormData.append("file", file.raw);
|
||||
});
|
||||
//修改progressFlag值
|
||||
that.progressFlag = true;
|
||||
//axios 发出请求
|
||||
axios({
|
||||
url: that.uploadUrl,
|
||||
method: 'post',
|
||||
data: paramFormData,
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + getToken(),
|
||||
'Content-Type': 'multipart/form-data'
|
||||
},
|
||||
onUploadProgress: progressEvent => {
|
||||
// progressEvent.loaded:已上传文件大小
|
||||
// progressEvent.total:被上传文件的总大小
|
||||
//进度条
|
||||
that.progressPercent = ((progressEvent.loaded / progressEvent.total) * 100) | 0;
|
||||
}
|
||||
}).then(res => {
|
||||
console.info("res===========", res)
|
||||
if (res.data.code == 200 && that.progressPercent === 100) {
|
||||
setTimeout(function () {
|
||||
that.$message({
|
||||
message: '上传成功!',
|
||||
type: 'success',
|
||||
duration: '2000'
|
||||
});
|
||||
that.progressFlag = false;
|
||||
that.progressPercent = 0
|
||||
}, 500);
|
||||
}
|
||||
}).catch(error => {
|
||||
that.progressFlag = false;
|
||||
that.progressPercent = 0
|
||||
that.$refs.upload.clearFiles();
|
||||
that.$message({
|
||||
message: '上传失败!',
|
||||
type: 'error',
|
||||
duration: '2000'
|
||||
});
|
||||
})
|
||||
},*/
|
||||
//文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
|
||||
onChange(file, fileList) {
|
||||
this.fileList = fileList;
|
||||
@ -205,6 +147,7 @@ export default {
|
||||
});
|
||||
self.progressFlag = false;
|
||||
self.progressPercent = 0
|
||||
self.handleResult(res,file);
|
||||
}, 500);
|
||||
} else {
|
||||
self.$message({
|
||||
@ -227,7 +170,6 @@ export default {
|
||||
});
|
||||
})
|
||||
} else {
|
||||
console.info("111111111111")
|
||||
file._shardCount = Math.ceil(file.size / this.partSize) //总片数
|
||||
file.uploaded = 0
|
||||
let formData = new FormData()
|
||||
@ -244,7 +186,6 @@ export default {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
},
|
||||
}).then(function (res) {
|
||||
console.info("res=====initUpload=======", res)
|
||||
if (res.status == 200) {
|
||||
//从第0块开始上传
|
||||
file.uploadId = res.data.uploadId
|
||||
@ -272,12 +213,6 @@ export default {
|
||||
//获取文件块MD5
|
||||
let reader = new FileReader()
|
||||
reader.readAsBinaryString(fileData)
|
||||
// 读取成功后的回调
|
||||
// reader.onloadend = function(e) {
|
||||
// 用hex_md5生成md5值,与OSS的算法对应,并转换为大写,不是直接md5-js的算法
|
||||
// self.md5Str[index] = (CryptoJS(this.result)).toLocaleUpperCase()
|
||||
// self.md5Str[index] = CryptoJS.MD5(e.target.result)
|
||||
// }
|
||||
let form1 = new FormData()//new一个form的实例,可以进行键值对的添加,
|
||||
form1.append('chunkFile', fileData) //slice方法用于切出文件的一部分
|
||||
form1.append('uploadId', file.uploadId)
|
||||
@ -300,7 +235,6 @@ export default {
|
||||
self.progressPercent = ((progressEvent.loaded / progressEvent.total) * 100) | 0;
|
||||
}
|
||||
}).then(response => {
|
||||
console.info("response=======uploadChunk=====", response)
|
||||
if (response.status == 200) {
|
||||
//判断返回的MD5值是否一致,一致继续传下一块,否则重传本块(这里目前前后端MD5一直不一致,暂时先注释掉,有时间了我再研究一下)
|
||||
// self.md5Str[index] === response.msg ||
|
||||
@ -345,9 +279,8 @@ export default {
|
||||
'Authorization': 'Bearer ' + getToken(),
|
||||
'Content-Type': 'multipart/form-data'
|
||||
},
|
||||
}).then(response => {
|
||||
console.info("response====mergeFile========", response)
|
||||
if (response.status == 200) {
|
||||
}).then(res => {
|
||||
if (res.status == 200) {
|
||||
setTimeout(function () {
|
||||
self.$message({
|
||||
message: '上传成功!',
|
||||
@ -356,6 +289,7 @@ export default {
|
||||
});
|
||||
self.progressFlag = false;
|
||||
self.progressPercent = 0
|
||||
self.handleResult(res,file);
|
||||
}, 500);
|
||||
} else {
|
||||
self.$message({
|
||||
@ -364,13 +298,30 @@ export default {
|
||||
duration: '2000'
|
||||
});
|
||||
}
|
||||
console.info("file===============", file)
|
||||
})
|
||||
}
|
||||
},
|
||||
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>
|
||||
|
@ -9,7 +9,7 @@ const baseURL = process.env.VUE_APP_BASE_API
|
||||
let downloadLoadingInstance;
|
||||
|
||||
export default {
|
||||
name(name, isDelete = true) {
|
||||
downloadByName(name, isDelete) {
|
||||
var url = baseURL + "/common/download?fileName=" + encodeURIComponent(name) + "&delete=" + isDelete
|
||||
axios({
|
||||
method: 'get',
|
||||
|
@ -3,8 +3,8 @@
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="150px">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="文件分类" prop="docCode">
|
||||
<treeselect v-model="form.categoryId" :options="docCategory" :show-count="true" placeholder="请选择文件分类"/>
|
||||
<el-form-item label="文件分类" prop="docCategoryId">
|
||||
<treeselect v-model="form.docCategoryId" :options="docCategory" :show-count="true" placeholder="请选择文件分类"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
@ -21,20 +21,51 @@
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24">
|
||||
<el-form-item label="文档类别" prop="docType">
|
||||
<el-input v-model="form.docType" placeholder="请输入文档类别" maxlength="50" show-word-limit/>
|
||||
<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-form-item label="文档来源" prop="docSource">
|
||||
<el-input v-model="form.docSource" placeholder="请输入文档来源" maxlength="50" show-word-limit/>
|
||||
<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-col>
|
||||
<el-col :span="24">
|
||||
<el-col :span="24" v-if="relatedTool">
|
||||
<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-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="负责人" prop="docPrincipals">
|
||||
@ -43,75 +74,39 @@
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="归属单位" prop="docRespDept">
|
||||
<treeselect v-model="form.docRespDept" :options="deptOptions" :show-count="true" placeholder="请输入归属单位" />
|
||||
<treeselect v-model="form.docRespDept" :options="deptOptions" :show-count="true" placeholder="请输入归属单位"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="文件" required>
|
||||
<uploadVue
|
||||
:display="editStatus"
|
||||
:uploadUrl="uploadFileUrl"
|
||||
:type="['.txt','.doc','.docx','.pdf','.mp4','.zip','.rar','.7z','.png','.jpg','.jpeg']"
|
||||
:acceptType="acceptType"
|
||||
:limit="1"
|
||||
:onSuccess="handleUploadSuccess"
|
||||
:onError="handleUploadError"
|
||||
:dataFile="dataFile"
|
||||
ref="uploadFile"
|
||||
@handleSuccess="handleUploadSuccess"
|
||||
@handleError="handleUploadError"
|
||||
/>
|
||||
<!-- <uploadVue-->
|
||||
<!-- <upload-progress/>
|
||||
<el-upload
|
||||
class="upload-component"
|
||||
ref="upload"
|
||||
:auto-upload="false"
|
||||
:file-list="fileList"
|
||||
:on-change="onChange"
|
||||
:on-remove="onRemove"
|
||||
:multiple="true"
|
||||
action=""
|
||||
>
|
||||
<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-col>
|
||||
<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-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form><!--el-form-->
|
||||
|
||||
<el-dialog title="选择关联工具" :visible.sync="drawer1" width="75%" append-to-body>
|
||||
<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"></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 流程监控-抽屉-->
|
||||
<tool-selector ref="toolSelect" @selectHandle="selectHandle"></tool-selector>
|
||||
|
||||
</div><!--el-form-border 表单-->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { addDocument, updateDocument } from "@/api/document/document";
|
||||
import { addDocument, updateDocument, getDocument } from "@/api/document/document";
|
||||
import axios from 'axios';
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { deptTreeSelect } from "@/api/system/user";
|
||||
@ -119,15 +114,22 @@
|
||||
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 {
|
||||
name: 'editDocument',
|
||||
components: { Treeselect, uploadProgress, uploadVue},
|
||||
components: { Treeselect, uploadProgress, uploadVue, ToolSelector},
|
||||
dicts:['doc_class','doc_source'],
|
||||
props: {
|
||||
tooId: {
|
||||
type: String,
|
||||
default: "",
|
||||
}
|
||||
required: false
|
||||
},
|
||||
relatedTool: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
data(){
|
||||
return{
|
||||
@ -152,19 +154,24 @@
|
||||
],
|
||||
// 表单参数
|
||||
form: {
|
||||
categoryId: undefined,
|
||||
docId: undefined,
|
||||
docCategoryId: undefined,
|
||||
docCode: '',
|
||||
docName: '',
|
||||
docType: '',
|
||||
docPrincipals: '',
|
||||
docRespDept: undefined,
|
||||
docSource: '',
|
||||
toolId: ''
|
||||
toolId: '',
|
||||
remark: undefined
|
||||
},
|
||||
fileList: [],
|
||||
progress: 0,
|
||||
// 表单校验
|
||||
rules: {
|
||||
docCategoryId: [
|
||||
{ required: true, message: "文档分类不能为空", trigger: "blur" }
|
||||
],
|
||||
docCode: [
|
||||
{ required: true, message: "文档编号不能为空", trigger: "blur" }
|
||||
],
|
||||
@ -182,7 +189,10 @@
|
||||
deptOptions:[],
|
||||
uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传文件服务器地址
|
||||
fileData: null,
|
||||
acceptType: ".txt,.doc,.docx,.pdf,.mp4,.zip,.rar,.7z,.png,.jpg,.jpeg"
|
||||
acceptType: ".txt,.doc,.docx,.pdf,.mp4,.zip,.rar,.7z,.png,.jpg,.jpeg",
|
||||
editStatus: true,
|
||||
toolDataInfo: [],
|
||||
dataFile: [],
|
||||
}
|
||||
},
|
||||
created(){
|
||||
@ -229,21 +239,6 @@
|
||||
this.drawer1 = false;
|
||||
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() {
|
||||
// 使用时间戳来生成唯一ID
|
||||
const timestamp = new Date().getTime();
|
||||
@ -253,80 +248,81 @@
|
||||
},
|
||||
/** 提交按钮 */
|
||||
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('请选取文件后再上传')
|
||||
}
|
||||
this.fileList.map(file =>{
|
||||
/*this.fileList.map(file =>{
|
||||
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 => {
|
||||
if (valid) {
|
||||
if (this.form.id != undefined) {
|
||||
updateDocument(this.form).then(response => {
|
||||
if (this.form.docId) {
|
||||
updateDocument(this.form).then(res => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.$emit("submit");
|
||||
});
|
||||
} else {
|
||||
addDocument(this.form).then(response => {
|
||||
addDocument(this.form).then(res => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.confirmSubmit(response.data);
|
||||
// this.confirmSubmit(response.data);
|
||||
this.$emit("submit");
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
testUpdate(docId){
|
||||
// 创建 formData 对象
|
||||
const formData = new FormData()
|
||||
// 将所有 的 upload 组件中的文件对象放入到 FormData 对象中
|
||||
this.fileList.forEach((file) => {
|
||||
formData.append('folder', file.raw)
|
||||
})
|
||||
formData.append('docId', '')
|
||||
formData.append('requestId', this.generateUniqueID())
|
||||
axios.post(process.env.VUE_APP_BASE_API + '/document/upload/folder', formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
'Authorization': 'Bearer ' + getToken(),
|
||||
/** 提交按钮 */
|
||||
assembleSubmit: function() {
|
||||
let self = this
|
||||
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]
|
||||
}
|
||||
//判断是否有文件再上传
|
||||
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 对象
|
||||
const formData = new FormData()
|
||||
// 将所有 的 upload 组件中的文件对象放入到 FormData 对象中
|
||||
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);
|
||||
});
|
||||
},
|
||||
/** 查询部门下拉树结构 */
|
||||
@ -354,20 +350,57 @@
|
||||
},
|
||||
// flag 为true表示新增
|
||||
getData(data, flag, index) {
|
||||
console.info("data============", data)
|
||||
console.info("flag============", flag)
|
||||
console.info("index============", index)
|
||||
},
|
||||
getError(message) {
|
||||
this.$message.error(message);
|
||||
},
|
||||
handleUploadSuccess(response) {
|
||||
alert('File uploaded successfully');
|
||||
handleUploadSuccess(res) {
|
||||
this.fileList = []
|
||||
this.fileList.push(res)
|
||||
// 处理上传成功后的逻辑
|
||||
},
|
||||
handleUploadError(error) {
|
||||
alert('Failed to upload file');
|
||||
// 处理上传失败后的逻辑
|
||||
},
|
||||
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)
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,45 +48,63 @@
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
>上传文档</el-button>
|
||||
<el-button type="primary" icon="el-icon-position">发布</el-button>
|
||||
<el-button type="primary" icon="el-icon-position" @click="handlePush">发布</el-button>
|
||||
<el-button icon="el-icon-delete" @click="handleDelete">批量删除</el-button>
|
||||
</div><!--operate 操作按钮-->
|
||||
|
||||
<el-table v-loading="loading" :data="docList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="文档编号" prop="docCode" width="120" />
|
||||
<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="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" >
|
||||
<el-table-column type="selection" width="55" align="center" :selectable="isSelectable"/>
|
||||
<el-table-column label="文档编号" align="center" prop="docCode" width="120" />
|
||||
<el-table-column label="文档名称" align="center" prop="docName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="类别" align="center" prop="docType" :show-overflow-tooltip="true" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="success" v-if="scope.row.docStatus == 'ysc'">已上传</el-tag>
|
||||
<el-tag type="danger" v-else>上传失败</el-tag>
|
||||
<dict-tag :options="dict.type.doc_class" :value="scope.row.docType"/>
|
||||
</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>
|
||||
</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="docUploadProgress" width="100" >
|
||||
<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">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="180">
|
||||
<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)"
|
||||
>编辑</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-view"
|
||||
@click="handlePriew(scope.row)"
|
||||
v-if="previewAuth(scope.row)"
|
||||
@click="handlePreview(scope.row)"
|
||||
>预览</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
v-if="scope.row.docStatus != 'yfb' && scope.row.docStatus != 'shz'"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</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-loading="loadingDownload">下载</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -132,7 +150,7 @@
|
||||
<span class="title">新增文档资源</span>
|
||||
<div class="drawer-head-btn">
|
||||
<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 抽屉顶部按钮区域-->
|
||||
</template>
|
||||
<edit-document ref="editDocumentRef" @submit="editDocumentSubmit"/>
|
||||
@ -143,7 +161,7 @@
|
||||
</template>
|
||||
|
||||
<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 { documentTree,addCategory,updateCategory,delCategory,getCategory } from "@/api/documentCategory/documentCategory.js";
|
||||
|
||||
@ -153,10 +171,10 @@ import editDocument from "./editDocument";
|
||||
import uploadProgress from "./uploadProgress";
|
||||
import { w3cwebsocket as WebSocket } from 'websocket';
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
|
||||
export default {
|
||||
name: "Document",
|
||||
components: { iFrame, editDocument, uploadProgress, Treeselect},
|
||||
dicts:['doc_class','doc_source'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
@ -243,6 +261,8 @@ export default {
|
||||
categoryDescription: null,
|
||||
parentId: null
|
||||
},
|
||||
loadingDownload: false,
|
||||
acceptType: "zip,rar,7z",
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@ -297,9 +317,17 @@ export default {
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.open = true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.editDocumentRef.resetForm();
|
||||
})
|
||||
},
|
||||
handlePriew(row){
|
||||
console.log('mmmmmmmmmmm',process.env.VUE_APP_BASE_API + row.docUrl)
|
||||
handleEdit(row){
|
||||
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.viewDialogTitle = '文档在线预览'
|
||||
this.viewDialogOpen = true;
|
||||
@ -322,11 +350,10 @@ export default {
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}).catch((err) => {console.info(err)});
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleDocCategoryAdd(data) {
|
||||
console.info("data================", data)
|
||||
this.docCategoryOpen = true;
|
||||
// this.docCategoryForm.parentId = data.id;
|
||||
this.$nextTick(() => {
|
||||
@ -385,6 +412,54 @@ export default {
|
||||
/** 重置 **/
|
||||
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';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<el-dialog title="新增文档" :visible.sync="visible" width="85%" append-to-body>
|
||||
<edit-document ref="editDocumentRef" :toolId="toolId" @submit="editDocumentSubmit"/>
|
||||
<el-dialog title="新增附件信息" :visible.sync="visible" width="85%" append-to-body>
|
||||
<edit-document ref="editDocumentRef" :toolId="toolId" @docSubmitData="editDocumentSubmit" :relatedTool="false"/>
|
||||
<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>
|
||||
</div>
|
||||
</el-dialog>
|
||||
@ -26,7 +26,7 @@ export default {
|
||||
*/
|
||||
toolId: {
|
||||
type: String,
|
||||
default: true
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -45,13 +45,19 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
editDocumentSubmit(){
|
||||
this.$emit('callback')
|
||||
editDocumentSubmit(data){
|
||||
this.$emit("addFileData", data)
|
||||
this.visible = false
|
||||
},
|
||||
cancel() {
|
||||
this.$refs.editDocumentRef.cancel()
|
||||
this.visible = false
|
||||
},
|
||||
submitForm(){
|
||||
this.$refs.editDocumentRef.assembleSubmit()
|
||||
},
|
||||
resetForm(){
|
||||
this.$refs.editDocumentRef.resetForm()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,17 +28,20 @@
|
||||
</div><!--el-form-border 表单-->
|
||||
</el-tab-pane><!--el-tab-pane-->
|
||||
<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-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="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="docRespDept" :show-overflow-tooltip="true" width="150" />
|
||||
<el-table-column label="来源" prop="docSource" width="100" />
|
||||
<el-table-column label="归属单位" align="center" prop="docRespDeptName" :show-overflow-tooltip="true" width="80" />
|
||||
<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">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
@ -52,19 +55,81 @@
|
||||
icon="el-icon-view"
|
||||
@click="handlePriew(scope.row)"
|
||||
>预览</el-button>
|
||||
<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>
|
||||
<el-button type="text" icon="el-icon-download" @click="handleDownload(scope.row)" v-loading="loadingDownload">下载</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table><!--el-table-->
|
||||
</el-tab-pane><!--el-tab-pane-->
|
||||
</el-tabs><!--el-tabs-->
|
||||
</div><!--fl 左侧页签-->
|
||||
<div class="fr">
|
||||
<div class="tboper">
|
||||
<div class="tit">评论</div>
|
||||
</div><!--tboper 标题与操作按钮-->
|
||||
<div class="pltextarea">
|
||||
<el-input type="textarea" placeholder="请输入您的意见" :rows="4" maxlength="1000" show-word-limit></el-input>
|
||||
<div class="plbtn"><el-button>发布</el-button></div>
|
||||
</div><!--pltextarea-->
|
||||
<div class="pllist">
|
||||
<div class="list">
|
||||
<div class="luser"><span class="xuser">张</span></div>
|
||||
<div class="ltext">
|
||||
<div class="nt"><span class="name">张鑫辉</span><span class="time">05/01 12:00</span></div>
|
||||
<div class="te">这个工具可以!</div>
|
||||
<div class="hb"><a class="btn"><i class="el-icon-chat-line-round"></i>回复</a></div>
|
||||
<div class="pltextarea">
|
||||
<el-input type="textarea" placeholder="请输入您的意见" :rows="2" maxlength="1000" show-word-limit></el-input>
|
||||
<div class="plbtn"><el-button>取消</el-button><el-divider direction="vertical"></el-divider><el-button>发布</el-button></div>
|
||||
</div><!--pltextarea-->
|
||||
</div>
|
||||
</div><!--list-->
|
||||
<div class="list">
|
||||
<div class="luser"><span class="xuser">钱</span></div>
|
||||
<div class="ltext">
|
||||
<div class="nt"><span class="name">钱多多</span><span class="time">05/01 12:00</span></div>
|
||||
<div class="te">好用!</div>
|
||||
<div class="hb"><a class="btn"><i class="el-icon-chat-line-round"></i>回复</a></div>
|
||||
<div class="list">
|
||||
<div class="luser"><span class="xuser">赵</span></div>
|
||||
<div class="ltext">
|
||||
<div class="nt"><span class="name">赵宇</span><span class="time">05/01 12:00</span></div>
|
||||
<div class="te">希望再选代一下,还有待完善的地方。</div>
|
||||
<div class="hb"><a class="btn"><i class="el-icon-chat-line-round"></i>回复</a></div>
|
||||
</div>
|
||||
</div><!--list-->
|
||||
<div class="list">
|
||||
<div class="luser"><span class="xuser">李</span></div>
|
||||
<div class="ltext">
|
||||
<div class="nt"><span class="name">李志</span><span class="time">05/01 12:00</span></div>
|
||||
<div class="te">很好的解决了我的问题,感谢!</div>
|
||||
<div class="hb"><a class="btn"><i class="el-icon-chat-line-round"></i>回复</a></div>
|
||||
</div>
|
||||
</div><!--list-->
|
||||
</div>
|
||||
</div><!--list-->
|
||||
<div class="list">
|
||||
<div class="luser"><span class="xuser">赵</span></div>
|
||||
<div class="ltext">
|
||||
<div class="nt"><span class="name">赵宇</span><span class="time">05/01 12:00</span></div>
|
||||
<div class="te">希望再选代一下,还有待完善的地方。</div>
|
||||
<div class="hb"><a class="btn"><i class="el-icon-chat-line-round"></i>回复</a></div>
|
||||
</div>
|
||||
</div><!--list-->
|
||||
<div class="list">
|
||||
<div class="luser"><span class="xuser">李</span></div>
|
||||
<div class="ltext">
|
||||
<div class="nt"><span class="name">李志</span><span class="time">05/01 12:00</span></div>
|
||||
<div class="te">很好的解决了我的问题,感谢!</div>
|
||||
<div class="hb"><a class="btn"><i class="el-icon-chat-line-round"></i>回复</a></div>
|
||||
</div>
|
||||
</div><!--list-->
|
||||
</div><!--pllist-->
|
||||
</div><!--fl 右侧评论-->
|
||||
|
||||
<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"/>
|
||||
</div><!--fbox1 左右分栏-->
|
||||
@ -75,10 +140,12 @@
|
||||
import AddDoc from './AddDoc'
|
||||
import editDocument from "../document/editDocument";
|
||||
import { Base64 } from 'js-base64';
|
||||
import iFrame from "@/components/iFrame/index"
|
||||
|
||||
export default {
|
||||
name: 'toolDetail',
|
||||
components: { editDocument, AddDoc },
|
||||
dicts:['sys_normal_disable','tool_type'],
|
||||
components: { editDocument, AddDoc, iFrame },
|
||||
dicts:['sys_normal_disable','tool_type','doc_class','doc_source'],
|
||||
props: {
|
||||
toolDetail: {
|
||||
type: Object,
|
||||
@ -99,6 +166,7 @@
|
||||
viewDialogOpen: false,
|
||||
title: '新增文档',
|
||||
open: false,
|
||||
loadingDownload: false,
|
||||
}
|
||||
},
|
||||
created(){
|
||||
@ -136,7 +204,18 @@
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 处理下载
|
||||
* **/
|
||||
handleDownload(row){
|
||||
let self = this
|
||||
self.loadingDownload = true
|
||||
this.$download.resource(row.docUrl);
|
||||
setTimeout(()=>{
|
||||
self.loadingDownload = false
|
||||
},1000)
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -157,16 +157,28 @@
|
||||
关联附件
|
||||
</div>
|
||||
<div class="operate">
|
||||
<el-button type="primary" icon="el-icon-upload2" @click="handleDocAdd">上传</el-button>
|
||||
<el-button icon="el-icon-delete">删除</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>-->
|
||||
</div><!--operate 操作按钮-->
|
||||
<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="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="docRespDept" :show-overflow-tooltip="true" width="150" />
|
||||
<el-table-column label="来源" prop="docSource" width="100" />
|
||||
<el-table-column label="归属部门" prop="docRespDept" :show-overflow-tooltip="true" width="150" >
|
||||
<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">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
@ -178,15 +190,17 @@
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-view"
|
||||
@click="handlePriew(scope.row)"
|
||||
v-if="isShowOperation(scope.row)"
|
||||
@click="handlePreview(scope.row)"
|
||||
>预览</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
v-if="editStatus"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</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>
|
||||
</el-table-column>
|
||||
</el-table><!--el-table-->
|
||||
@ -225,7 +239,7 @@
|
||||
</div>
|
||||
</el-form>
|
||||
<!-- 上传 -->
|
||||
<add-doc :show.sync="addDocShow" toolId="1111"/>
|
||||
<add-doc :show.sync="addDocShow" ref="addDocRef" @addFileData="addFileData"/>
|
||||
</div><!--el-form-border 表单-->
|
||||
<div v-show="activeName==='log'">
|
||||
<workflow-logs :procInstId = "pListData.procInstId"></workflow-logs>
|
||||
@ -260,10 +274,16 @@
|
||||
></monitor-drawer>
|
||||
<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>
|
||||
|
||||
|
||||
<el-dialog :title="viewDialogTitle" :visible.sync="viewDialogOpen" fullscreen width="500px" append-to-body>
|
||||
<i-frame :src="previewUrl" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<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 {
|
||||
workflowprocesskey,
|
||||
@ -278,15 +298,17 @@ import { deptTreeSelect } from "@/api/system/user";
|
||||
import { addTool, checkToolExist, getInfoByBpmcId, updateTool } from '@/api/tool/tool'
|
||||
import blUserSelector from '@/components/user-selector/src/user-selector.vue'
|
||||
import ToolSelector from '@/components/tool-selector/index.vue'
|
||||
import { Base64 } from 'js-base64'
|
||||
// PDF本地文件预览
|
||||
export default {
|
||||
dicts: ['sys_normal_disable','tool_type'],
|
||||
dicts: ['sys_normal_disable','tool_type','doc_source','doc_class'],
|
||||
components: {
|
||||
ToolSelector,
|
||||
blUserSelector,
|
||||
Treeselect, AddDoc,
|
||||
WorkflowLogs,
|
||||
processcode,
|
||||
iFrame
|
||||
},
|
||||
name: "Borrow_doc",
|
||||
props: ['data'],
|
||||
@ -392,6 +414,10 @@ export default {
|
||||
flowStepLoading : false,
|
||||
// 默认密码
|
||||
initPassword: undefined,
|
||||
viewDialogTitle: "",
|
||||
viewDialogOpen: false,
|
||||
previewUrl: '',
|
||||
loadingDownload: false,
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
@ -445,6 +471,7 @@ export default {
|
||||
getInfoByBpmcId(procInstId).then(async (res) => {
|
||||
let formData = res.data;
|
||||
formData.type = _this.form.type
|
||||
// _this.docList = formData.documentList
|
||||
formData.association = JSON.parse(res.data.association)
|
||||
_this.form = formData
|
||||
_this.getDocumentList(res.data.toolId)
|
||||
@ -547,6 +574,7 @@ export default {
|
||||
formData.editStatus = _this.editStatus
|
||||
formData.association = JSON.stringify(_this.form.association)
|
||||
if (formData.toolId) {
|
||||
this.$set(formData,'documentList',_this.docList)
|
||||
updateTool(formData).then((res) => {
|
||||
if (res.code===200) {
|
||||
_this.$message({
|
||||
@ -582,6 +610,7 @@ export default {
|
||||
review: _this.attributeModelBool('approve'),
|
||||
};
|
||||
formData.editStatus = _this.editStatus
|
||||
this.$set(formData,'documentList',_this.docList)
|
||||
addTool(formData).then((res) => {
|
||||
if (res.code===200) {
|
||||
_this.form.toolId = res.data.businessKey;
|
||||
@ -725,6 +754,7 @@ export default {
|
||||
formData.recordStatus = 'doing'
|
||||
}
|
||||
formData.editStatus = _this.editStatus
|
||||
this.$set(formData,'documentList',_this.docList)
|
||||
addTool(formData).then((res) => {
|
||||
if (res.code===200) {
|
||||
_this.$message({
|
||||
@ -747,21 +777,25 @@ export default {
|
||||
this.$refs.monitorDrawer.init(this.pListData.procInstId);
|
||||
});
|
||||
},
|
||||
handleDelete(dataList,index){
|
||||
dataList.splice(index,1)
|
||||
handleDelete(row){
|
||||
this.docList.splice(row,1)
|
||||
},
|
||||
/**
|
||||
* 新增上传附件
|
||||
*/
|
||||
handleDocAdd() {
|
||||
this.addDocShow = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addDocRef.resetForm()
|
||||
})
|
||||
},
|
||||
getDocumentList(toolId) {
|
||||
this.loading = true
|
||||
this.docQueryParams.toolId = toolId
|
||||
listDocument(this.docQueryParams).then(response => {
|
||||
this.docList = response.rows;
|
||||
this.total = response.total;
|
||||
this.$set(this.docQueryParams,'isDeleted',"0")
|
||||
listDocument(this.docQueryParams).then(res => {
|
||||
this.docList = res.rows;
|
||||
this.total = res.total;
|
||||
this.loading = false;
|
||||
}
|
||||
);
|
||||
@ -790,7 +824,58 @@ export default {
|
||||
list.push({toolId:itme.toolId,toolName:itme.toolName})
|
||||
})
|
||||
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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user