wenbobowen 4 lat temu
rodzic
commit
5f72df5d51

+ 202 - 0
src/components/input/editor.vue

@@ -0,0 +1,202 @@
+<template>
+  <div>
+    <article :id="id" :style="styles">
+      <a id="edit-btn" href="javascript:;" @click="() => styleHandle('bold')">加粗</a>
+      <a id="edit-btn" href="javascript:;" @click="() => styleHandle('italic')">italic</a>
+      <a id="edit-btn" href="javascript:;" @click="() => styleHandle('enableInlineTableEditing')">表格</a>
+      <a id="edit-btn" href="javascript:;" @click="() => styleHandle('backColor', '#666')">背景颜色</a>
+      <a id="edit-btn" href="javascript:;" @click="() => insertTable()">插入表格</a>
+      <div :id="'editor_'+id" contenteditable="true" style="display:inline-block;border:1px solid #eee; width:200px; height:200px" class="editor" v-html="value">
+        <p>12321</p>
+      </div>
+      <!-- <div :id="'tinymce_'+id" class="editor" contenteditable="true" style="display:inline-block;border:1px solid #eee; width:300px; height:200px">
+        <p>12321</p>
+      </div> -->
+      <div id="menu">
+        <div class="menu" @click.stop="getCursorPosition">功能1</div>
+        <div class="menu">功能2</div>
+        <div class="menu">功能3</div>
+        <div class="menu">功能4</div>
+        <div class="menu">功能5</div>
+      </div>
+    </article>
+  </div>
+</template>
+<script>
+export default {
+  props: {
+    id: {
+      type: String,
+      default: '',
+      required: true
+    },
+    value: {
+      type: String,
+      default: '',
+      required: false
+    },
+    height: {
+      type: Number,
+      default: 200,
+      required: false
+    },
+    styles: {
+      type: Object,
+      default: () => {
+        return { }
+      },
+      required: false
+    }
+  },
+  data() {
+    return {
+      inputValue: '',
+      edit: false,
+      init: {
+        auto_focus: true,
+        language_url: '/tinymce/langs/zh_CN.js',
+        language: 'zh_CN',
+        skin_url: '/tinymce/skins/ui/oxide', // 编辑器需要一个skin才能正常工作,所以要设置一个skin_url指向之前复制出来的skin文件
+        height: this.height,
+        browser_spellcheck: true, // 拼写检查
+        branding: false, // 去水印
+        elementpath: false, // 禁用编辑器底部的状态栏
+        statusbar: false, // 隐藏编辑器底部的状态栏
+        paste_data_images: true, // 允许粘贴图像
+        menubar: false, // 隐藏最上方menu
+        fontsize_formats: '14px 16px 18px 20px 24px 26px 28px 30px 32px 36px', // 字体大小
+        file_picker_types: 'image',
+        images_upload_credentials: true,
+        plugins: 'lists table textcolor wordcount contextmenu', // 引入插件
+        toolbar: 'bold italic underline strikethrough | fontsizeselect | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent table | undo redo | removeformat formatselect',
+        table_toolbar: 'tableprops | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol | tablemergecells tablesplitcells'
+      }
+    }
+  },
+  watch: {
+    value: {
+      handler(newV, oldV) {
+        this.inputValue = newV
+      },
+      immediate: true
+    }
+  },
+  mounted() {
+    const editor = document.getElementById(`editor_${this.id}`)
+    editor.oncontextmenu = function(e) {
+      console.log(11111)
+      // 取消默认的浏览器自带右键 很重要!!
+      e.preventDefault()
+
+      // 获取我们自定义的右键菜单
+      var menu = document.querySelector('#menu')
+      console.log(e)
+      // 根据事件对象中鼠标点击的位置,进行定位
+      menu.style.left = e.clientX + 'px'
+      menu.style.top = e.clientY + 'px'
+
+      // 改变自定义菜单的宽,让它显示出来
+      menu.style.width = '125px'
+    }
+    editor.onclick = function(e) {
+      console.log(2222, e)
+      console.log('第几列', e.target.cellIndex + 1, '第几行', e.target.parentNode.rowIndex + 1)
+      const ForeColor = document.queryCommandValue('ForeColor') // 字体颜色
+      const FontSize = document.queryCommandValue('FontSize') // 字体大小
+      const bold = document.queryCommandValue('bold') // 是否加粗
+      const italic = document.queryCommandValue('italic')
+      const BackgroundColor = document.queryCommandValue('BackColor')
+      console.log(ForeColor, FontSize, bold, italic, BackgroundColor, 111)
+      console.log('这是table', e.path[3])
+      const tableBox = e.path[3]
+      console.log(tableBox)
+      // 必须保存一下不然下面会变
+      // const idx = e.target.cellIndex
+      //  在一行添加一行
+      // tableBox.insertRow(e.target.parentNode.rowIndex)
+      // 插入一列
+      console.log(tableBox.rows)
+      for (let i = 0; i < tableBox.rows.length; i++) {
+        console.log(i, e.target.cellIndex)
+        // 在之后插入一列
+        // tableBox.rows[i].insertCell(e.target.cellIndex+1)
+        // 在之前一列
+        // 在之前一列插入
+        // tableBox.rows[i].insertCell(idx)
+        console.log(tableBox.rows[i])
+      }
+      // tableBox.rows[e.target.parentNode.rowIndex].insertCell()
+      // 用户触发click事件就可以关闭了,因为绑定在window上,按事件冒泡处理,不会影响菜单的功能
+      document.querySelector('#menu').style.width = 0
+    }
+  },
+  methods: {
+    changeText(e) { // 富文本内容改变
+      this.inputValue = e
+      this.$emit('update:value', this.inputValue)
+      this.$emit('change', this.inputValue)
+    },
+    styleHandle(aCommandName, val) {
+      // const editor = document.getElementById('cc')
+      document.execCommand(aCommandName, false, val)
+    },
+    insertTable() {
+      const HTML = `<table border='1' border-collapse: collapse; style='border-color: #666;width:90%'>
+      <tr>
+        <td><span>123</span></td>
+        <td>1</td>
+        <td>3</td>
+      </tr>
+      <tr>
+        <td><span>1233</span></td>
+        <td>4</td>
+        <td>5</td>
+      </tr>
+      <tr>
+        <td><span>1235</span></td>
+        <td>6</td>
+        <td>7</td>
+      </tr>
+      </table>`
+
+      document.execCommand('insertHTML', false, HTML)
+    },
+    getCursorPosition(event) {
+      const editEl = event.target
+      // return console.log(editEl);
+      console.log(event)
+      if (editEl.selectionStart || editEl.selectionStart === 0) {
+        console.log(3333)
+        // 非IE浏览器
+        this.cursorPosition = editEl.selectionStart
+      } else {
+        console.log(4444)
+        // IE
+        const range = document.selection.createRange()
+        range.moveStart('character', -editEl.value.length)
+        this.cursorPosition = range.text.length
+      }
+      console.log(this.cursorPosition)
+    }
+  }
+}
+</script>
+<style scoped lang="scss">
+.editor {
+  border: 1px solid #666;
+}
+#menu{
+  width: 0; /*设置为0 隐藏自定义菜单*/
+  height: 125px;
+  overflow: hidden; /*隐藏溢出的元素*/
+  box-shadow: 0 1px 1px #888,1px 0 1px #ccc;
+  position: absolute; /*自定义菜单相对与body元素进行定位*/
+}
+.menu{
+  width: 130px;
+  height: 25px;
+  line-height: 25px;
+  padding: 0 10px;
+  cursor: pointer;
+}
+</style>

+ 40 - 114
src/components/input/normalArea.vue

@@ -1,23 +1,19 @@
 <template>
   <div>
-    <article :id="id" :style="styles">
-      <!-- <a href="javascript:;" id="edit-btn" @click="() => styleHandle('bold')">加粗</a>
-      <a href="javascript:;" id="edit-btn" @click="() => styleHandle('enableInlineTableEditing')">表格</a>
-      <a href="javascript:;" id="edit-btn" @click="() => styleHandle('backColor', 'red')">背景颜色</a>
-      <a href="javascript:;" id="edit-btn" @click="() => insertTable()">插入表格</a>
-      <div id="cc" class="editor" contenteditable="true" style="display:inline-block;border:1px solid #eee; width:200px; height:200px">
-        <p>12321</p>
-      </div>
-      <div id="csc" class="editor" contenteditable="true" style="display:inline-block;border:1px solid #eee; width:300px; height:200px">
-        <p>12321</p>
-      </div>
-      <div id="menu">
-        <div class="menu" @click.stop="getCursorPosition">功能1</div>
-        <div class="menu">功能2</div>
-        <div class="menu">功能3</div>
-        <div class="menu">功能4</div>
-        <div class="menu">功能5</div>
-      </div> -->
+    <article :id="id" :style="styles" class="article" :class="fullScreen ? 'fullScreen' : ''">
+      <!-- <textEditor :id="id" :value="inputValue" /> -->
+      <span v-show="fullScreen" class="changeSizeBtn" @click="changeSize">
+        <svg-icon
+          icon-class="icon-sx"
+          class="icon"
+        />
+      </span>
+      <span v-show="!fullScreen" class="changeSizeBtn" @click="changeSize">
+        <svg-icon
+          icon-class="icon-qp"
+          class="icon"
+        />
+      </span>
       <editor :id="'tinymce_'+id" ref="editor" v-model="inputValue" :init="init" @input="changeText" />
     </article>
   </div>
@@ -27,9 +23,11 @@ import tinymce from 'tinymce/tinymce'
 import Editor from '@tinymce/tinymce-vue'
 import 'tinymce/themes/silver/theme'
 import 'tinymce/icons/default/icons'
+// import textEditor from './editor'
 export default {
   components: {
     Editor
+    // textEditor
   },
   props: {
     id: {
@@ -57,6 +55,7 @@ export default {
   },
   data() {
     return {
+      fullScreen: false,
       inputValue: '',
       edit: false,
       init: {
@@ -90,47 +89,6 @@ export default {
   },
   mounted() {
     tinymce.init({ selector: `#tinymce_${this.id}` })
-    // const editor = document.getElementById('cc')
-    // editor.oncontextmenu=function(e){
-    //   console.log(11111)
-    //   //取消默认的浏览器自带右键 很重要!!
-    //   e.preventDefault();
-
-    //   //获取我们自定义的右键菜单
-    //   var menu=document.querySelector("#menu");
-    //   console.log(e)
-    //   //根据事件对象中鼠标点击的位置,进行定位
-    //   menu.style.left=e.clientX+'px';
-    //   menu.style.top=e.clientY+'px';
-
-    //   //改变自定义菜单的宽,让它显示出来
-    //   menu.style.width='125px';
-    // }
-    // window.onclick=function(e){
-    //   console.log(2222, e)
-    //   console.log('第几列', e.target.cellIndex+1, '第几行', e.target.parentNode.rowIndex+1)
-    //   console.log('这是table', e.path[3])
-    //   const tableBox = e.path[3]
-    //   console.log(tableBox)
-    //   // 必须保存一下不然下面会变
-    //   const idx = e.target.cellIndex
-    //   //  在一行添加一行
-    //   // tableBox.insertRow(e.target.parentNode.rowIndex)
-    //   // 插入一列
-    //   console.log(tableBox.rows)
-    //   for(let i=0; i<tableBox.rows.length; i++) {
-    //     console.log(i, e.target.cellIndex)
-    //      // 在之后插入一列
-    //     // tableBox.rows[i].insertCell(e.target.cellIndex+1)
-    //     // 在之前一列
-    //     // 在之前一列插入
-    //     // tableBox.rows[i].insertCell(idx)
-    //     console.log(tableBox.rows[i])
-    //   }
-    //   // tableBox.rows[e.target.parentNode.rowIndex].insertCell()
-    //   //用户触发click事件就可以关闭了,因为绑定在window上,按事件冒泡处理,不会影响菜单的功能
-    // document.querySelector('#menu').style.width=0;
-    // }
   },
   methods: {
     changeText(e) { // 富文本内容改变
@@ -138,67 +96,35 @@ export default {
       this.$emit('update:value', this.inputValue)
       this.$emit('change', this.inputValue)
     },
-    styleHandle(aCommandName, val) {
-      // const editor = document.getElementById('cc')
-      document.execCommand(aCommandName, false, val)
-    },
-    insertTable() {
-      const HTML = `<table border="1" border-collapse: collapse; style="border-color: #666;width:90%">
-      <tr>
-        <td><span>123</span></td>
-        <td>1</td>
-        <td>3</td>
-      </tr>
-      <tr>
-        <td><span>1233</span></td>
-        <td>4</td>
-        <td>5</td>
-      </tr>
-      <tr>
-        <td><span>1235</span></td>
-        <td>6</td>
-        <td>7</td>
-      </tr>
-      </table>`
-
-      document.execCommand('insertHTML', false, HTML)
-    },
-    getCursorPosition(event) {
-      const editEl = event.target
-      // return console.log(editEl);
-      console.log(event)
-      if (editEl.selectionStart || editEl.selectionStart === 0) {
-        console.log(3333)
-        // 非IE浏览器
-        this.cursorPosition = editEl.selectionStart
-      } else {
-        console.log(4444)
-        // IE
-        const range = document.selection.createRange()
-        range.moveStart('character', -editEl.value.length)
-        this.cursorPosition = range.text.length
-      }
-      console.log(this.cursorPosition)
+    changeSize() {
+      this.fullScreen = !this.fullScreen
     }
   }
 }
 </script>
 <style scoped lang="scss">
-.editor {
-  border: 1px solid #666;
+.article {
+  position: relative;
+  .changeSizeBtn {
+    position: absolute;
+    top: 25px;
+    right: 20px;
+    z-index: 1000;
+  }
 }
-#menu{
-  width: 0; /*设置为0 隐藏自定义菜单*/
-  height: 125px;
-  overflow: hidden; /*隐藏溢出的元素*/
-  box-shadow: 0 1px 1px #888,1px 0 1px #ccc;
-  position: absolute; /*自定义菜单相对与body元素进行定位*/
+.fullScreen {
+  position: absolute;
+  top: -15px;
+  bottom: 0;
+  left: 225px;
+  right: 0;
+  z-index: 1000;
+  height: 100vh!important;
+  /deep/.tox-tinymce {
+    height: 100vh!important;
+  }
 }
-.menu{
-  width: 130px;
-  height: 25px;
-  line-height: 25px;
-  padding: 0 10px;
-  cursor: pointer;
+.editor {
+  border: 1px solid #666;
 }
 </style>

+ 38 - 4
src/components/input/textArea.vue

@@ -11,7 +11,19 @@
         {{ emptyText }}
         <el-button type="text" @click="ImmediateAddition">{{ inputButton }}</el-button>
       </div>
-      <div v-show="edit">
+      <div v-show="edit" class="editArticle" :class="fullScreen ? 'fullScreen' : ''">
+        <span v-show="fullScreen" class="changeSizeBtn" @click="changeSize">
+          <svg-icon
+            icon-class="icon-sx"
+            class="icon"
+          />
+        </span>
+        <span v-show="!fullScreen" class="changeSizeBtn" @click="changeSize">
+          <svg-icon
+            icon-class="icon-qp"
+            class="icon"
+          />
+        </span>
         <el-tooltip effect="dark" content="单击‘编辑’" placement="bottom">
           <editor v-model="inputValue" :class="'tinymce_'+id" :init="init" @input="changeText" />
         </el-tooltip>
@@ -75,6 +87,7 @@ export default {
   },
   data() {
     return {
+      fullScreen: false,
       loading: false,
       inputValue: '',
       edit: false,
@@ -152,14 +165,35 @@ export default {
         const reg = new RegExp(/<\/?p[^>]*>/gi)
         return val.replace(reg, '')
       }
+    },
+    changeSize() {
+      this.fullScreen = !this.fullScreen
     }
   }
 }
 </script>
 <style scoped lang="scss">
-// article {
-//   padding: 0 30px 20px 30px;
-// }
+.editArticle {
+  position: relative;
+  .changeSizeBtn {
+    position: absolute;
+    top: 10px;
+    right: 20px;
+    z-index: 1000;
+  }
+}
+.fullScreen {
+  position: absolute;
+  top: 0px;
+  bottom: 0;
+  left: 225px;
+  right: 0;
+  z-index: 1000;
+  height: 100vh!important;
+  /deep/.tox-tinymce {
+    height: 100vh!important;
+  }
+}
 .text-edit {
   color: #666666;
   font-size: 14px;

+ 3 - 0
src/icons/svg/icon-qp.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14">
+  <path id="全屏" d="M183.792,170.667a.875.875,0,0,1,.875.875v12.25a.875.875,0,0,1-.875.875h-12.25a.875.875,0,0,1-.875-.875v-12.25a.875.875,0,0,1,.875-.875Zm0,.875h-12.25v12.25h12.25Zm-4.165,7.466,2.239,2.24v-1.568a.437.437,0,0,1,.875,0V182.3a.438.438,0,0,1-.437.438h-2.625a.437.437,0,0,1,0-.875h1.569l-2.24-2.24a.437.437,0,1,1,.618-.62Zm-3.973-6.416a.437.437,0,1,1,0,.875h-1.569l2.24,2.24a.437.437,0,1,1-.618.619l-2.241-2.241v1.569a.437.437,0,1,1-.875,0v-2.625a.437.437,0,0,1,.438-.438Z" transform="translate(-170.667 -170.667)" fill="#444"/>
+</svg>

+ 3 - 0
src/icons/svg/icon-sx.svg

@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14">
+  <path id="路径_438" data-name="路径 438" d="M9.325,10.637H5.387a.438.438,0,0,0,0,.875H8.275L5.3,14.488l.613.612,2.975-2.975v2.887a.438.438,0,1,0,.875,0V11.075a.449.449,0,0,0-.438-.438Zm5.688-1.75H12.125L15.1,5.912,14.488,5.3,11.512,8.275V5.387a.438.438,0,0,0-.875,0V9.325a.449.449,0,0,0,.438.438h3.938a.413.413,0,0,0,.438-.438A.438.438,0,0,0,15.012,8.887ZM16.5,3.2H3.9a.7.7,0,0,0-.7.7V16.5a.7.7,0,0,0,.7.7H16.5a.7.7,0,0,0,.7-.7V3.9A.7.7,0,0,0,16.5,3.2Zm-.176.875v12.25H4.075V4.075Z" transform="translate(-3.2 -3.2)" fill="#444"/>
+</svg>

+ 6 - 0
src/styles/PublicStyle/index.scss

@@ -74,6 +74,12 @@
   width: 85px;
 }
 // 任务状态控制
+.public_btn4 .el-input--suffix .el-input__inner { // 任务状态控制
+  padding-right: 10px;
+  padding-left: 10px;
+  width: 103px;
+}
+// 任务状态控制
 
 .status_color { // 迭代状态样式修改(颜色)
   /deep/ input {

+ 0 - 1
src/views/projectManage/bugList/details/statusChange.vue

@@ -62,7 +62,6 @@
     </el-dialog>
   </div>
 </template>
-
 <script>
 import '@/styles/PublicStyle/index.scss'
 import { bugUpdate } from '@/api/defectManage'

+ 31 - 1
src/views/projectManage/requirement/list/index.vue

@@ -219,11 +219,16 @@
             <span class="stylus-hover" @click="getToRequirementDetails(scope.row.id)">{{ scope.row.name }}</span>
           </template>
         </el-table-column>
-        <el-table-column label="状态" prop="statusName" min-width="150" align="center">
+        <el-table-column label="状态" prop="statusName" width="150" align="center">
           <template slot-scope="scope">
             <el-select
               v-if="nowTab === 'charts'"
               v-model="scope.row.status"
+              :class="{
+                'status0':scope.row.status===0,
+                'status1':scope.row.status > 0 && scope.row.status <100,
+                'status2':scope.row.status===100
+              }"
               :size="size"
               placeholder=""
               @change="(e) => statusChange(e, scope.row.id)"
@@ -892,6 +897,31 @@ export default {
 
 </style>
 <style scoped lang="scss">
+@mixin setStatus($color) {
+  input {
+    color:$color;
+    border: 1px solid $color;
+  }
+  /deep/.el-select__caret{
+    color:$color;
+  }
+  /deep/.el-input__inner{
+    color:$color;
+    border-color: $color;
+  }
+  /deep/.el-input__inner:focus {
+    border-color: $color;
+  }
+}
+.status0 {
+	@include setStatus(#409EFF)
+}
+.status1{
+	@include setStatus(#FF8952)
+}
+.status2 {
+	@include setStatus(#7ED321)
+}
 .stylus-head {
   position: relative;
 }