|
|
@@ -0,0 +1,370 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <el-breadcrumb class="heading">
|
|
|
+ <el-breadcrumb-item :to="{ path: '/' }">平台首页</el-breadcrumb-item>
|
|
|
+ <el-breadcrumb-item :to="{ path: this.path }">{{this.pathName}}</el-breadcrumb-item>
|
|
|
+ <el-breadcrumb-item>{{this.pathName2}}</el-breadcrumb-item>
|
|
|
+ </el-breadcrumb>
|
|
|
+ <el-card class="box-card">
|
|
|
+ <div slot="header">
|
|
|
+ <span>
|
|
|
+ <i class="icon icon-file-text"> 编辑信息</i>
|
|
|
+ </span>
|
|
|
+ <span style="float: right;">
|
|
|
+ <el-button type="primary" class="el-button--small" @click="save()" style="margin-left:5px" >保存</el-button>
|
|
|
+ <router-link :to="this.path">
|
|
|
+ <el-button type="primary" class="el-button--small" style="margin-left:5px">返回</el-button>
|
|
|
+ </router-link>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <el-form :model="uploadform" :rules="rules" ref="uploadform" label-width="110px">
|
|
|
+ <div class="el-row">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="文件夹名称" prop="Name">
|
|
|
+ <el-input v-model="uploadform.Name" placeholder="请输入文件夹名称" ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="类型" prop="DocTab">
|
|
|
+ <el-select v-model="uploadform.RangeType" placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="item in DocTaboptions"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="备注">
|
|
|
+ <el-input type="textarea" :rows="2" v-model="uploadform.Remark" placeholder="请输入备注信息" ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </div>
|
|
|
+ </el-form>
|
|
|
+ </el-card>
|
|
|
+
|
|
|
+ <el-dialog title="登录验证" width="80%" :visible.sync="loginDialogVisible" top="5vh" center @close="cancelLogin">
|
|
|
+ <el-form class="login-form" auto-complete="off" ref="user" label-position="top">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="用户" prop="username">
|
|
|
+ <el-input type="text" v-model="AuthorUserName" disabled="true" placeholder="请输入用户名" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="密码" prop="password">
|
|
|
+ <el-input type="password" v-model="password" placeholder="请输入密码" @keyup.enter.native="confirmLogin" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <div style="text-align:center;">
|
|
|
+ <el-button size="small" @click="cancelLogin">取 消</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="confirmLogin">登录</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import axios from 'axios'
|
|
|
+ import uploadajax from '../../../assets/js/uploadajax.js'
|
|
|
+ import {
|
|
|
+ mapGetters
|
|
|
+ } from 'vuex'
|
|
|
+ export default {
|
|
|
+ name: 'editDocument',
|
|
|
+ computed: {
|
|
|
+ ...mapGetters({
|
|
|
+ authUser: 'authUser'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ var CheckDirectoryId = (rule, value, callback) => {
|
|
|
+ if (this.JLDirectoryIds && this.JLDirectoryIds.length < 1) {
|
|
|
+ callback(new Error('请选择文档结构'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ documentId: 0,
|
|
|
+ waituploads: [], // 等待上传的附件列表
|
|
|
+ maintainlogattrlist: [],
|
|
|
+ selfVisible: this.visible, // 避免vue双向绑定警告
|
|
|
+ orgtreeprops: {
|
|
|
+ value: 'id',
|
|
|
+ label: 'ItemName',
|
|
|
+ children: 'children'
|
|
|
+ },
|
|
|
+ orgtreelist: [], // 文档结构
|
|
|
+ JLDirectoryIds: [], // 文档结构Id
|
|
|
+ list: [],
|
|
|
+ // typeList: [], //文档类别列表
|
|
|
+ uploadform: {
|
|
|
+ DirectoryId: '', // 目录结构Id
|
|
|
+ Name: '', // 文档名称
|
|
|
+ VersionInfo: '', // 文档版本
|
|
|
+ NoticeTab: '', // 通知公告标签
|
|
|
+ DocTab: '', // 文件资料标签
|
|
|
+ RangeType: '',
|
|
|
+ ParentId: 0,
|
|
|
+ Type: 1,
|
|
|
+ FileURL: '', // 文档地址
|
|
|
+ ValidityTime: '', // 有效期至
|
|
|
+ Remark: '' // 备注
|
|
|
+ },
|
|
|
+ AuthorUser: '',
|
|
|
+ AuthorUserName: '',
|
|
|
+ loginDialogVisible: false, // 登陆验证弹窗
|
|
|
+ isLoginSucceed: false,
|
|
|
+ acceptUsers: [],
|
|
|
+ username: '',
|
|
|
+ password: '',
|
|
|
+ rules: {
|
|
|
+ JLDirectoryIds: [{
|
|
|
+ required: true,
|
|
|
+ validator: CheckDirectoryId,
|
|
|
+ trigger: 'blur'
|
|
|
+ }],
|
|
|
+ Name: [{
|
|
|
+ required: true,
|
|
|
+ message: '请填写文档名称',
|
|
|
+ trigger: 'blur'
|
|
|
+ }],
|
|
|
+ ValidityTime: [{
|
|
|
+ required: true,
|
|
|
+ message: '请选择有效期至',
|
|
|
+ trigger: 'blur'
|
|
|
+ }],
|
|
|
+ VersionInfo: [{
|
|
|
+ required: false,
|
|
|
+ message: '请填写版本信息',
|
|
|
+ trigger: 'blur'
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ DocTaboptions: [
|
|
|
+ {
|
|
|
+ value: 1,
|
|
|
+ label: '通用'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 2,
|
|
|
+ label: '内部'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 3,
|
|
|
+ label: '外部'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ // 标题设置
|
|
|
+ path: '',
|
|
|
+ pathName: '',
|
|
|
+ pathName2: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+ this.documentId = this.$route.params.opera
|
|
|
+ this.initinfo()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ initinfo () {
|
|
|
+ let _this = this
|
|
|
+ this.$axios.get('/document/geteditinitinfo/' + this.documentId, {})
|
|
|
+ .then(res => {
|
|
|
+ _this.uploadform = res.data.items
|
|
|
+ let list = new Array()
|
|
|
+ if (_this.uploadform.NoticeTab) {
|
|
|
+ _this.path = '/documentmanage/notice'
|
|
|
+ _this.pathName = '通知管理'
|
|
|
+ _this.pathName2 = '编辑通知'
|
|
|
+ }
|
|
|
+ if (_this.uploadform.DocTab) {
|
|
|
+ _this.path = '/documentmanage/files'
|
|
|
+ _this.pathName = '文件管理'
|
|
|
+ _this.pathName2 = '编辑文件'
|
|
|
+ }
|
|
|
+ // 设置文档类别的对应标签值
|
|
|
+ // if (_this.uploadform.NoticeTab) {
|
|
|
+ // list.push("通知公告")
|
|
|
+ // }
|
|
|
+ // if (_this.uploadform.DocTab) {
|
|
|
+ // list.push("文件资料")
|
|
|
+ // }
|
|
|
+ // _this.typeList = list
|
|
|
+ _this.gettreelist(218)
|
|
|
+ _this.getwendanginfo(res.data.items.FileURL)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 文档列表
|
|
|
+ getwendanginfo (iUrl) {
|
|
|
+ let _this = this
|
|
|
+ _this.maintainlogattrlist = []
|
|
|
+ let exArr = iUrl.split('|')
|
|
|
+ let params = {
|
|
|
+ name: exArr[1],
|
|
|
+ url: exArr[0]
|
|
|
+ }
|
|
|
+ _this.maintainlogattrlist.push(params)
|
|
|
+ },
|
|
|
+ // 获取文档结构树
|
|
|
+ gettreelist (pid) {
|
|
|
+ let _this = this
|
|
|
+ let params = {
|
|
|
+ pid: pid + ''
|
|
|
+ }
|
|
|
+ _this.$axios.get('/items/gettreeitemsdetail', {
|
|
|
+ params
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ _this.orgtreelist = window.toolfun_gettreejson(res.data.items, 'Id', 'ParentId', 'Id,ItemName')
|
|
|
+ // 显示原来文档结构
|
|
|
+ let arr = []
|
|
|
+ arr.push(_this.orgtreelist[0].id)
|
|
|
+ arr.push(_this.orgtreelist[0].children[0].id)
|
|
|
+ _this.JLDirectoryIds = arr
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ clickachment (url, uid) {
|
|
|
+ window.open(`http://${url}`)
|
|
|
+ },
|
|
|
+ // 保存编辑信息
|
|
|
+ save () {
|
|
|
+ let _this = this
|
|
|
+ this.$refs['uploadform'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ _this.editdocumentinfo() // 保存编辑信息
|
|
|
+ } else {
|
|
|
+ console.log('error submit!!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 执行保存操作
|
|
|
+ editdocumentinfo () {
|
|
|
+ let _this = this
|
|
|
+ _this.uploadform.DirectoryId = parseInt(_this.JLDirectoryIds[_this.JLDirectoryIds.length - 1])
|
|
|
+ // 设置文档类别的对应标签值
|
|
|
+ // for (let i = 0; i < _this.typeList.length; i++) {
|
|
|
+ // //首先清0
|
|
|
+ // _this.uploadform.NoticeTab = 0
|
|
|
+ // _this.uploadform.DocTab = 0
|
|
|
+ // //再设置
|
|
|
+ // let v = _this.typeList[i]
|
|
|
+ // switch (v) {
|
|
|
+ // case "通知公告": _this.uploadform.NoticeTab = 1
|
|
|
+ // break;
|
|
|
+ // case "文件资料": _this.uploadform.DocTab = 1
|
|
|
+ // break;
|
|
|
+ // default: _this.uploadform.DocTab = 1
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ this.$axios.put('/document/editdocumentinfo/' + _this.documentId, _this.uploadform)
|
|
|
+ .then(function (response) {
|
|
|
+ if (response.data.code === 0) {
|
|
|
+ _this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: response.data.message
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: response.data.message
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(function (error) {
|
|
|
+ console.log(error)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ beforeAvatarUpload (file) {
|
|
|
+ let isLt50m = file.size / 1024 / 1024 / 100 < 1
|
|
|
+ if (!isLt50m) {
|
|
|
+ this.$message.error('上传文件大小不能超过 100MB!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ },
|
|
|
+ // 取消验证
|
|
|
+ cancelLogin () {
|
|
|
+ if (this.isLoginSucceed) {
|
|
|
+ this.isLoginSucceed = false
|
|
|
+ } else {
|
|
|
+ this.AuthorUser = ''
|
|
|
+ }
|
|
|
+ this.loginDialogVisible = false
|
|
|
+ },
|
|
|
+ // 密码验证
|
|
|
+ confirmLogin () {
|
|
|
+ let _this = this
|
|
|
+ let fields = {
|
|
|
+ username: this.username,
|
|
|
+ password: this.password
|
|
|
+ }
|
|
|
+ this.$axios.post('/users/checkUserPwd?RealName=' + this.AuthorUserName, fields)
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ _this.loginDialogVisible = false
|
|
|
+ this.isLoginSucceed = true
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ }
|
|
|
+ _this.password = ''
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+<style lang="scss">
|
|
|
+ .samplesinputmaincard .el-card__header {
|
|
|
+ padding: 5px 10px;
|
|
|
+ font-size: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .samplerecoveope .el-radio {
|
|
|
+ padding: 8px 15px 0 0;
|
|
|
+ margin-left: -2px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .attach-uploader .el-upload {
|
|
|
+ border: 1px dashed #63B8FF;
|
|
|
+ cursor: pointer;
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+ margin-bottom: -17px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .attach-uploader .el-upload:hover {
|
|
|
+ border-color: #25ff25;
|
|
|
+ }
|
|
|
+
|
|
|
+ .attach-uploader-icon {
|
|
|
+ font-size: 25px;
|
|
|
+ color: #63B8FF;
|
|
|
+ width: 50px;
|
|
|
+ height: 50px;
|
|
|
+ line-height: 50px;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .attach-uploader-icon:hover {
|
|
|
+ color: #228B22;
|
|
|
+ }
|
|
|
+
|
|
|
+</style>
|