|
@@ -0,0 +1,637 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <Navbar title="创建评论" />
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <div class="form-group">
|
|
|
|
|
+ <label for="exampleInputEmail2">接收人</label>
|
|
|
|
|
+ <a-select
|
|
|
|
|
+ v-model:value="userIds"
|
|
|
|
|
+ mode="multiple"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ placeholder="选择抄送人"
|
|
|
|
|
+ :options="options"
|
|
|
|
|
+ :filter-option="false"
|
|
|
|
|
+ auto-clear-search-value
|
|
|
|
|
+ @change="handleChange"
|
|
|
|
|
+ @search="listInGroupCompanyByCondition"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="form-group">
|
|
|
|
|
+ <label for="exampleInputEmail2">
|
|
|
|
|
+ 主题:
|
|
|
|
|
+ </label>
|
|
|
|
|
+ <input
|
|
|
|
|
+ v-model="theme"
|
|
|
|
|
+ autocomplete="off"
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ class="form-control"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="form-group">
|
|
|
|
|
+ <label for="exampleInputEmail2">评论内容</label>
|
|
|
|
|
+ <div id="summernote" />
|
|
|
|
|
+ <!-- <textarea style="width: 100%;"
|
|
|
|
|
+ id="hcqk"
|
|
|
|
|
+ class="form-control"
|
|
|
|
|
+ rows="5"
|
|
|
|
|
+ v-model="content"></textarea> -->
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <input
|
|
|
|
|
+ ref="fileInput"
|
|
|
|
|
+ autocomplete="off"
|
|
|
|
|
+ type="file"
|
|
|
|
|
+ class="form-control file-input"
|
|
|
|
|
+ @change="onFileChanges"
|
|
|
|
|
+ />
|
|
|
|
|
+ <label for="attachment">
|
|
|
|
|
+ <a
|
|
|
|
|
+ role="button"
|
|
|
|
|
+ class="btn btn-primary btn-sm"
|
|
|
|
|
+ @click="clickButton"
|
|
|
|
|
+ >
|
|
|
|
|
+ <i class="fa fa-upload" />
|
|
|
|
|
+ 上传附件
|
|
|
|
|
+ </a>
|
|
|
|
|
+ </label>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div style="margin-top: 10px">
|
|
|
|
|
+ <ul class="list-group">
|
|
|
|
|
+ <li v-for="item in files" :key="item" class="list-group-item">
|
|
|
|
|
+ <span class="badge" @click="download(item)">下载</span>
|
|
|
|
|
+ <span class="badge" @click="removeFile(item)">删除</span>
|
|
|
|
|
+ {{ item }}
|
|
|
|
|
+ </li>
|
|
|
|
|
+ </ul>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <!-- <div>
|
|
|
|
|
+ <div style="margin-top: 10px">
|
|
|
|
|
+ <button type="text" class="btn btn-default" @click="photograph">
|
|
|
|
|
+ 确认
|
|
|
|
|
+ </button>
|
|
|
|
|
+ <button type="text" class="btn btn-default" @click="back">
|
|
|
|
|
+ 取消
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div> -->
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <Loading v-if="loading" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+<script>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+import UpladFile from '../../common/UpladFile.js';
|
|
|
|
|
+
|
|
|
|
|
+import Common from '../../common/Common.js';
|
|
|
|
|
+import { Notify } from 'pc-component-v3';
|
|
|
|
|
+import { DownloadService } from 'pc-component-v3';
|
|
|
|
|
+import { message } from 'ant-design-vue';
|
|
|
|
|
+import UserResource from '../../api/base/UserResource.js';
|
|
|
|
|
+
|
|
|
|
|
+export default {
|
|
|
|
|
+ components: {
|
|
|
|
|
+ UpladFile,
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ props: {
|
|
|
|
|
+
|
|
|
|
|
+ traceId: {
|
|
|
|
|
+ type: String,
|
|
|
|
|
+ default: null,
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ windowNo: {
|
|
|
|
|
+ type: String,
|
|
|
|
|
+ default: null,
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ data: function () {
|
|
|
|
|
+ return {
|
|
|
|
|
+ // traceId: null,
|
|
|
|
|
+ content: '',
|
|
|
|
|
+ images: [],
|
|
|
|
|
+ className: 'com.leanwo.prodog.system.model.CurdWindowComment',
|
|
|
|
|
+ files: [],
|
|
|
|
|
+ traceConfigDto: {},
|
|
|
|
|
+ summernoteInitSuccess: false, // summernote初始化成功
|
|
|
|
|
+ loading: false,
|
|
|
|
|
+ options: [],
|
|
|
|
|
+ userIds: [],
|
|
|
|
|
+ theme: '',
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ mounted: function () {
|
|
|
|
|
+ var _self = this;
|
|
|
|
|
+ $('.input-tan').focus(function () {
|
|
|
|
|
+ document.activeElement.blur();
|
|
|
|
|
+ });
|
|
|
|
|
+ this.initData();
|
|
|
|
|
+ // this.getTraceConfig();
|
|
|
|
|
+ $('#summernote').summernote({
|
|
|
|
|
+ toolbar: [
|
|
|
|
|
+ [
|
|
|
|
|
+ 'insert',
|
|
|
|
|
+ [
|
|
|
|
|
+ 'link',
|
|
|
|
|
+ 'picture',
|
|
|
|
|
+ 'video',
|
|
|
|
|
+ 'audio',
|
|
|
|
|
+ 'hr',
|
|
|
|
|
+ 'table', //插件
|
|
|
|
|
+ 'fontname',
|
|
|
|
|
+ 'fontsize',
|
|
|
|
|
+ 'color',
|
|
|
|
|
+ 'bold',
|
|
|
|
|
+ 'italic',
|
|
|
|
|
+ 'underline',
|
|
|
|
|
+ 'strikethrough',
|
|
|
|
|
+ 'clear', //字体样式
|
|
|
|
|
+ 'style',
|
|
|
|
|
+ 'ol',
|
|
|
|
|
+ 'ul',
|
|
|
|
|
+ 'paragraph',
|
|
|
|
|
+ 'height', //段落样式
|
|
|
|
|
+ 'fullscreen',
|
|
|
|
|
+ 'codeview',
|
|
|
|
|
+ 'undo',
|
|
|
|
|
+ 'redo',
|
|
|
|
|
+ 'help', //Misc
|
|
|
|
|
+ ],
|
|
|
|
|
+ ],
|
|
|
|
|
+ ],
|
|
|
|
|
+ height: 400,
|
|
|
|
|
+ minHeight: 300,
|
|
|
|
|
+ maxHeight: 500,
|
|
|
|
|
+ focus: true,
|
|
|
|
|
+ lang: 'zh-CN',
|
|
|
|
|
+ callbacks: {
|
|
|
|
|
+ onImageUpload: function (files, editor, $editable) {
|
|
|
|
|
+ _self.sendFile(files[0], editor, $editable);
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ _self.summernoteInitSuccess = true;
|
|
|
|
|
+
|
|
|
|
|
+ this.listInGroupCompanyByCondition(null);
|
|
|
|
|
+ },
|
|
|
|
|
+ beforeUnmount: function () {
|
|
|
|
|
+ if (this.summernoteInitSuccess == true) {
|
|
|
|
|
+ $('#summernote').summernote('destroy');
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据姓名获取抄送人用户集合
|
|
|
|
|
+ */
|
|
|
|
|
+ listInGroupCompanyByCondition: function (search) {
|
|
|
|
|
+ let _self = this;
|
|
|
|
|
+ const searchQueryParam = {
|
|
|
|
|
+ range: {
|
|
|
|
|
+ start: 0,
|
|
|
|
|
+ length: 100,
|
|
|
|
|
+ },
|
|
|
|
|
+ conditional: search,
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // console.log('copyUserIds:' + _self.copyUserIds);
|
|
|
|
|
+ //修复审批节点选择人员显示文件编码bug
|
|
|
|
|
+ // var selectList = [];
|
|
|
|
|
+ // if (this.copyUserIds != undefined
|
|
|
|
|
+ // && this.copyUserList != undefined
|
|
|
|
|
+ // && this.copyUserList.length > 0
|
|
|
|
|
+ // && this.copyUserIds.length > 0) {
|
|
|
|
|
+ // this.copyUserList.forEach(function (value, index) {
|
|
|
|
|
+ // var id = value.id;
|
|
|
|
|
+ // _self.copyUserIds.forEach(function (item) {
|
|
|
|
|
+ // if (item == id) {
|
|
|
|
|
+ // selectList.push(value);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // });
|
|
|
|
|
+ // });
|
|
|
|
|
+ // }
|
|
|
|
|
+ var userDtos = [];
|
|
|
|
|
+ UserResource.listInGroupCompanyByCondition(searchQueryParam).then(successData => {
|
|
|
|
|
+ if (successData != null && successData.resultList != null) {
|
|
|
|
|
+ successData.resultList.forEach(function (user) {
|
|
|
|
|
+ var userDto = {};
|
|
|
|
|
+
|
|
|
|
|
+ user.text = user.name + '(';
|
|
|
|
|
+ if(user.organizations != null && user.organizations.length > 0){
|
|
|
|
|
+ let isFirst = true;
|
|
|
|
|
+ user.organizations.forEach(item => {
|
|
|
|
|
+ if(isFirst === true){
|
|
|
|
|
+ user.text += item.organizationName;
|
|
|
|
|
+ isFirst = false;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ user.text += (',' + item.organizationName);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ user.text += ')';
|
|
|
|
|
+
|
|
|
|
|
+ userDto.value = user.id;
|
|
|
|
|
+ userDto.label = user.text;
|
|
|
|
|
+ userDtos.push(userDto);
|
|
|
|
|
+ });
|
|
|
|
|
+ _self.options = userDtos;
|
|
|
|
|
+ console.log(_self.options);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ _self.options = [];
|
|
|
|
|
+ console.log(_self.options);
|
|
|
|
|
+ }
|
|
|
|
|
+ }, errorData => {
|
|
|
|
|
+ Common.processException(errorData);
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ handleChange(value) {
|
|
|
|
|
+ let _self = this;
|
|
|
|
|
+ console.log(this.userIds);
|
|
|
|
|
+ _self.listInGroupCompanyByCondition(null);
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 点击上传按钮事件
|
|
|
|
|
+ * @return {[type]} [description]
|
|
|
|
|
+ */
|
|
|
|
|
+ clickButton: function () {
|
|
|
|
|
+ $(this.$refs.fileInput).click();
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 初始化数据
|
|
|
|
|
+ * @author GuoZhiBo 20171201
|
|
|
|
|
+ */
|
|
|
|
|
+ initData: function () {
|
|
|
|
|
+ var _self = this;
|
|
|
|
|
+ // this.traceId = Number(this.$route.params.traceId);
|
|
|
|
|
+ console.log(_self.traceId);
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 监听文件改变事件
|
|
|
|
|
+ * @author GuoZhiBo 20171201
|
|
|
|
|
+ */
|
|
|
|
|
+ onFileChange(e) {
|
|
|
|
|
+ var _self = this;
|
|
|
|
|
+ var files = e.target.files || e.dataTransfer.files;
|
|
|
|
|
+ if (!files.length) return;
|
|
|
|
|
+ _self.uploadImage(files[0]);
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 上传图片
|
|
|
|
|
+ * @author GuoZhiBo 20171201
|
|
|
|
|
+ */
|
|
|
|
|
+ uploadImage: function (selectedFile) {
|
|
|
|
|
+ var _self = this;
|
|
|
|
|
+ if (selectedFile == undefined) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!/image\/\w+/.test(selectedFile.type)) {
|
|
|
|
|
+ Notify.error('提示', '请确保文件为图像类型!');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ UpladFile.photoCompress(
|
|
|
|
|
+ selectedFile,
|
|
|
|
|
+ {
|
|
|
|
|
+ quality: 0.2,
|
|
|
|
|
+ },
|
|
|
|
|
+ function (base64Codes) {
|
|
|
|
|
+ var bl = UpladFile.convertBase64UrlToBlob(base64Codes);
|
|
|
|
|
+ var rst = new FormData();
|
|
|
|
|
+ rst.append('images', bl, 'file_' + Date.parse(new Date()) + '.jpg');
|
|
|
|
|
+ rst.append('className', 'com.leanwo.prodog.system.model.CurdWindowComment');
|
|
|
|
|
+ _self.loading=true;
|
|
|
|
|
+ $.ajax({
|
|
|
|
|
+ url: Common.getApiURL('file/imageUpload'),
|
|
|
|
|
+ type: 'post',
|
|
|
|
|
+ beforeSend: function (request) {
|
|
|
|
|
+ Common.addTokenToRequest(request);
|
|
|
|
|
+ },
|
|
|
|
|
+ data: rst,
|
|
|
|
|
+ contentType: false,
|
|
|
|
|
+ processData: false,
|
|
|
|
|
+ success: function (data) {
|
|
|
|
|
+ _self.loading=false;
|
|
|
|
|
+ if (data.errorCode == 0) {
|
|
|
|
|
+ if (data.datas) {
|
|
|
|
|
+ var imageName = data.datas[0];
|
|
|
|
|
+ _self.addImg(imageName);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ message.error(data.errorMessage);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ error: function (XMLHttpRequest, textStatus, errorThrown) {
|
|
|
|
|
+ _self.loading=false;
|
|
|
|
|
+ Common.processException(XMLHttpRequest, textStatus, errorThrown);
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ return rst.file;
|
|
|
|
|
+ },
|
|
|
|
|
+ );
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 添加图片
|
|
|
|
|
+ * @author GuoZhiBo 20171201
|
|
|
|
|
+ */
|
|
|
|
|
+ addImg: function (imageName) {
|
|
|
|
|
+ var _self = this;
|
|
|
|
|
+ _self.images.push(imageName);
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取图片地址
|
|
|
|
|
+ * @param {String} item 图片名称
|
|
|
|
|
+ * @return {String} 图片URL地址
|
|
|
|
|
+ */
|
|
|
|
|
+ getImageSrc: function (item) {
|
|
|
|
|
+ var _self = this;
|
|
|
|
|
+ if (item != undefined && item != null) {
|
|
|
|
|
+ return Common.getResourceUrl(
|
|
|
|
|
+ 'image',
|
|
|
|
|
+ 'com.leanwo.prodog.system.model.CurdWindowComment',
|
|
|
|
|
+ item,
|
|
|
|
|
+ );
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return '';
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取图片路径供外部调用
|
|
|
|
|
+ * @return {Array} 图片地址
|
|
|
|
|
+ */
|
|
|
|
|
+ getImages: function () {
|
|
|
|
|
+ return this.images;
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 删除图片
|
|
|
|
|
+ *@author GuoZhiBo 20171201
|
|
|
|
|
+ */
|
|
|
|
|
+ deleteImg(index) {
|
|
|
|
|
+ var _self = this;
|
|
|
|
|
+ _self.images.splice(index, 1);
|
|
|
|
|
+ },
|
|
|
|
|
+ //----------文件------------
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 删除文件
|
|
|
|
|
+ * @param {String} item 文件Name
|
|
|
|
|
+ */
|
|
|
|
|
+ removeFile: function (index) {
|
|
|
|
|
+ var _self = this;
|
|
|
|
|
+ _self.files.splice(index, 1);
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 选择文件发生改变
|
|
|
|
|
+ * @param {[type]} e [description]
|
|
|
|
|
+ * @return {[type]} [description]
|
|
|
|
|
+ */
|
|
|
|
|
+ onFileChanges: function (e) {
|
|
|
|
|
+ var files = e.target.files || e.dataTransfer.files;
|
|
|
|
|
+ if (!files.length) return;
|
|
|
|
|
+ this.uploadFile(files[0]);
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 上传文件
|
|
|
|
|
+ * @param {File} selectedFile 选择的文件
|
|
|
|
|
+ */
|
|
|
|
|
+ uploadFile: function (selectedFile) {
|
|
|
|
|
+ var _self = this;
|
|
|
|
|
+ if (selectedFile == undefined) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ var size = undefined;
|
|
|
|
|
+ if (
|
|
|
|
|
+ _self.traceConfigDto.commentAttachmentSize != undefined &&
|
|
|
|
|
+ _self.traceConfigDto.commentAttachmentSize != null
|
|
|
|
|
+ ) {
|
|
|
|
|
+ size = _self.traceConfigDto.commentAttachmentSize;
|
|
|
|
|
+ }
|
|
|
|
|
+ //当系统没有配置附件大小时默认8m
|
|
|
|
|
+ if (size == undefined) {
|
|
|
|
|
+ size = 8;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (selectedFile.size != undefined && selectedFile.size != null) {
|
|
|
|
|
+ if (selectedFile.size / 1024 <= 1024 * size) {
|
|
|
|
|
+ var formData = new FormData();
|
|
|
|
|
+ formData.append('files', selectedFile);
|
|
|
|
|
+ formData.append('className', _self.className);
|
|
|
|
|
+ _self.loading=true;
|
|
|
|
|
+ $.ajax({
|
|
|
|
|
+ url: Common.getApiURL('file/classFileUpload'),
|
|
|
|
|
+ type: 'post',
|
|
|
|
|
+ beforeSend: function (request) {
|
|
|
|
|
+ Common.addTokenToRequest(request);
|
|
|
|
|
+ },
|
|
|
|
|
+ data: formData,
|
|
|
|
|
+ contentType: false,
|
|
|
|
|
+ processData: false,
|
|
|
|
|
+ success: function (data) {
|
|
|
|
|
+ _self.loading=false;
|
|
|
|
|
+ if (data.errorCode == 0) {
|
|
|
|
|
+ if (data.datas) {
|
|
|
|
|
+ var fileName = data.datas[0];
|
|
|
|
|
+ _self.files.push(fileName);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ message.error(data.errorMessage);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ error: function (XMLHttpRequest, textStatus, errorThrown) {
|
|
|
|
|
+ _self.loading=false;
|
|
|
|
|
+ Common.processException(XMLHttpRequest, textStatus, errorThrown);
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Notify.error(
|
|
|
|
|
+ '提示',
|
|
|
|
|
+ '文件大小不能超过' + size + 'M,可在任务配置功能中配置!',
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Notify.error('提示', '上传的文件为空!');
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取任务管理配置
|
|
|
|
|
+ */
|
|
|
|
|
+ getTraceConfig: function () {
|
|
|
|
|
+ var _self = this;
|
|
|
|
|
+ $.ajax({
|
|
|
|
|
+ url: Common.getApiURL('TraceConfigResource/queryTraceConfigDto'),
|
|
|
|
|
+ type: 'get',
|
|
|
|
|
+ dataType: 'json',
|
|
|
|
|
+ beforeSend: function (request) {
|
|
|
|
|
+ Common.addTokenToRequest(request);
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ success: function (data) {
|
|
|
|
|
+ _self.traceConfigDto = data;
|
|
|
|
|
+ },
|
|
|
|
|
+ error: function (XMLHttpRequest, textStatus, errorThrown) {
|
|
|
|
|
+ Common.processException(XMLHttpRequest, textStatus, errorThrown);
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取文件地址
|
|
|
|
|
+ * @param {String} item 图片名称
|
|
|
|
|
+ * @return {String} 图片URL地址
|
|
|
|
|
+ */
|
|
|
|
|
+ getFileSrc: function (item) {
|
|
|
|
|
+ var _self = this;
|
|
|
|
|
+ if (item != undefined && item != null) {
|
|
|
|
|
+ return Common.getResourceUrl('file', _self.className, item);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return '';
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 下载文件
|
|
|
|
|
+ * @param {String} fileName 文件名
|
|
|
|
|
+ * @return {void}
|
|
|
|
|
+ */
|
|
|
|
|
+ download: function (fileName) {
|
|
|
|
|
+ var _self = this;
|
|
|
|
|
+ DownloadService.fileDownload(_self.className, fileName);
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ //内容图片上传
|
|
|
|
|
+ sendFile: function (file, editor, $editable) {
|
|
|
|
|
+ var _self = this;
|
|
|
|
|
+ UpladFile.photoCompress(
|
|
|
|
|
+ file,
|
|
|
|
|
+ {
|
|
|
|
|
+ quality: 1,
|
|
|
|
|
+ },
|
|
|
|
|
+ function (base64Codes) {
|
|
|
|
|
+ var bl = UpladFile.convertBase64UrlToBlob(base64Codes);
|
|
|
|
|
+ var rst = new FormData();
|
|
|
|
|
+ rst.append('images', bl, 'file_' + Date.parse(new Date()) + '.jpg');
|
|
|
|
|
+ rst.append('className', _self.className);
|
|
|
|
|
+ $.ajax({
|
|
|
|
|
+ url: Common.getApiURL('file/imageUpload'),
|
|
|
|
|
+ type: 'post',
|
|
|
|
|
+ data: rst,
|
|
|
|
|
+ contentType: false,
|
|
|
|
|
+ processData: false,
|
|
|
|
|
+ beforeSend: function (request) {
|
|
|
|
|
+ Common.addTokenToRequest(request);
|
|
|
|
|
+ },
|
|
|
|
|
+ success: function (data) {
|
|
|
|
|
+ if (data.errorCode == 0) {
|
|
|
|
|
+ if (data.datas) {
|
|
|
|
|
+ var imageName = data.datas[0];
|
|
|
|
|
+ $('#summernote').summernote(
|
|
|
|
|
+ 'insertImage',
|
|
|
|
|
+ Common.getResourceUrl('image', _self.className, imageName),
|
|
|
|
|
+ 'image name',
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ message.error(data.errorMessage);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ error: function () {
|
|
|
|
|
+ Notify.error('提示', '上传失败!');
|
|
|
|
|
+ return;
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ return rst.file;
|
|
|
|
|
+ },
|
|
|
|
|
+ );
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 保存评论表数据
|
|
|
|
|
+ * @author GuoZhiBo 20171201
|
|
|
|
|
+ */
|
|
|
|
|
+ photograph: function () {
|
|
|
|
|
+ var _self = this;
|
|
|
|
|
+ _self.content = $('#summernote').summernote('code');
|
|
|
|
|
+ if (_self.content != '' && _self.content != null) {
|
|
|
|
|
+ var traceComment = {
|
|
|
|
|
+ traceId: _self.traceId,
|
|
|
|
|
+ content: _self.content,
|
|
|
|
|
+ attachments: _self.files.join(','),
|
|
|
|
|
+ carbonCopyUserIds: _self.userIds.join(','),
|
|
|
|
|
+ windowNo: _self.windowNo,
|
|
|
|
|
+ };
|
|
|
|
|
+ _self.loading=true;
|
|
|
|
|
+ $.ajax({
|
|
|
|
|
+ url: Common.getApiURL('CurdWindowCommentResource/saveCurdWindowComment'),
|
|
|
|
|
+ type: 'post',
|
|
|
|
|
+ contentType: 'application/json',
|
|
|
|
|
+ beforeSend: function (request) {
|
|
|
|
|
+ Common.addTokenToRequest(request);
|
|
|
|
|
+ },
|
|
|
|
|
+ data: JSON.stringify(traceComment),
|
|
|
|
|
+ success: function (data) {
|
|
|
|
|
+ _self.loading=false;
|
|
|
|
|
+ // _self.back();
|
|
|
|
|
+ },
|
|
|
|
|
+ error: function (XMLHttpRequest, textStatus, errorThrown) {
|
|
|
|
|
+ _self.loading=false;
|
|
|
|
|
+ Common.processException(XMLHttpRequest, textStatus, errorThrown);
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Notify.error('提示', '请填写评论内容!');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ back: function () {
|
|
|
|
|
+ history.back();
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ // 获取通知(供外部调用)
|
|
|
|
|
+ getNotification: function () {
|
|
|
|
|
+ var _self = this;
|
|
|
|
|
+ var contentText = _self.content;
|
|
|
|
|
+ if(contentText.indexOf('<img src=') != -1 || _self.files.length > 0) {
|
|
|
|
|
+ contentText = '您有份文件评论,请在“待审阅”中查看。';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ var regex = /<[^>]+>/g;
|
|
|
|
|
+ contentText = contentText.replace(regex, '');
|
|
|
|
|
+ }
|
|
|
|
|
+ console.log(contentText);
|
|
|
|
|
+ var notification = {
|
|
|
|
|
+ userIds: _self.userIds,
|
|
|
|
|
+ theme: _self.theme,
|
|
|
|
|
+ contentText: contentText,
|
|
|
|
|
+ };
|
|
|
|
|
+ return notification;
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+};
|
|
|
|
|
+</script>
|
|
|
|
|
+<style scoped>
|
|
|
|
|
+.mui-divs3 {
|
|
|
|
|
+ margin-top: 10px;
|
|
|
|
|
+}
|
|
|
|
|
+.file-input {
|
|
|
|
|
+ width: 0.1px;
|
|
|
|
|
+ height: 0.1px;
|
|
|
|
|
+ opacity: 0;
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ z-index: -1;
|
|
|
|
|
+}
|
|
|
|
|
+.badge {
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ background-color: #428bca;
|
|
|
|
|
+ color: white;
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|