splitPage.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <!-- 权要拆分类型等 -->
  3. <div>
  4. <div style="display: flex; justify-content: space-between;margin:20px 0px 20px 0 ;">
  5. <el-button-group>
  6. <el-button @click="merge">合并</el-button>
  7. <el-button @click="split">拆分</el-button>
  8. </el-button-group>
  9. <div>
  10. <el-select placeholder="请选择拆分类型" v-model="splitType" style="margin-left: 50px;" @change="splitTypeSelect($event)">
  11. <el-option label="仅拆主权要" value="0"></el-option>
  12. <el-option label="全部拆分" value="1"></el-option>
  13. </el-select>
  14. <el-select placeholder="请选择拆分符号" v-model="splitBy" style="margin-left: 10px;" @change="splitBySelect($event)">
  15. <el-option label="逗号拆分" value="0"></el-option>
  16. <el-option label="分号拆分" value="1"></el-option>
  17. <el-option label="逗号和分号拆分" value="2"></el-option>
  18. </el-select>
  19. <el-select placeholder="请选择显示类型" v-model="showType" style="margin-left: 10px;" @change="typeSelect($event)">
  20. <el-option label="全部显示" value="0"></el-option>
  21. <el-option label="仅显示主权要" value="1"></el-option>
  22. </el-select>
  23. </div>
  24. <div>
  25. <el-button @click="keep" type="primary">保存</el-button>
  26. </div>
  27. </div>
  28. <template>
  29. <el-table :data="tableData" border ref="table" :span-method="objectSpanMethod" v-loading="loading"
  30. style="width: 100%" :height="tableHeight">
  31. <el-table-column prop="pRightName" label="权要" width="180" align="center">
  32. <template slot-scope="scope">
  33. <el-tooltip class="item" effect="dark" :content="scope.row.pContent" placement="top">
  34. <span>{{ scope.row.pRightName }}</span>
  35. </el-tooltip>
  36. </template>
  37. </el-table-column>
  38. <el-table-column prop="content" label="特征" width="300" align="center">
  39. <template slot-scope="scope">
  40. <el-checkbox-group v-model="checkList">
  41. <el-checkbox :label="scope.row.id" @change="getRow(scope)" style="display: flex;align-items: center;">
  42. <el-input type="textarea" style="width:250px" autosize v-model="scope.row.content">
  43. {{ scope.row.content.trim() }}</el-input>
  44. </el-checkbox>
  45. </el-checkbox-group>
  46. </template>
  47. </el-table-column>
  48. <el-table-column prop="explainText" label="解释(可粘贴图片)" align="center">
  49. <template slot-scope="scope">
  50. <div style="width:100%;outline: #dcdfe6;border:1px solid #DCDFE6;border-radius:5px" id="preview"
  51. contenteditable="true" v-html="scope.row.explainText" @input="saveValue($event.target.innerHTML)"
  52. @click="saveValue($event.target.innerHTML)" @blur="getValue(scope.row, 'explainText')"
  53. v-on:paste="handlePaste($event, scope.row, 'explainText')">
  54. </div>
  55. </template>
  56. </el-table-column>
  57. <!-- <el-table-column prop="littleDirection" label="回避设计方向(可粘贴图片)" align="center">
  58. <template slot-scope="scope">
  59. <div style="width:100%;outline: #dcdfe6;border:1px solid #DCDFE6;border-radius:5px" id="preview"
  60. contenteditable="true" v-html="scope.row.littleDirection" @input="saveValue($event.target.innerHTML)"
  61. @click="saveValue($event.target.innerHTML)" @blur="getValue(scope.row, 'littleDirection')"
  62. v-on:paste="handlePaste($event, scope.row, 'littleDirection')">
  63. </div>
  64. </template>
  65. </el-table-column> -->
  66. </el-table>
  67. </template>
  68. </div>
  69. </template>
  70. <script>
  71. export default {
  72. props: {
  73. // 数据源
  74. tableData: {
  75. type: Array,
  76. default: () => {
  77. return []
  78. }
  79. },
  80. // 是否可读
  81. isRead: {
  82. type: Boolean,
  83. default: true
  84. },
  85. //拆分下拉框的数据
  86. splitSelect: {
  87. type: Object,
  88. default: () => {
  89. return {
  90. splitType: 0,
  91. splitBy: 2,
  92. showType: 0,
  93. }
  94. }
  95. },
  96. // 栏位参数
  97. column: {
  98. type: Array,
  99. default: () => {
  100. return []
  101. }
  102. }
  103. },
  104. data() {
  105. return {
  106. splitType: "0",//拆分类型0仅拆主权要,1全部拆分
  107. splitBy: "2",//拆分符号0逗号拆分,1分号拆分,2逗号和分号拆分
  108. showType: "0",//显示类型0全部显示1仅显示主权要
  109. typeArr: [1],//显示权要还是全部显示
  110. // 表格的loading
  111. loading: false,
  112. // 表格的高度
  113. tableHeight: 0,
  114. // 勾选中的特征
  115. checkList:[],
  116. }
  117. },
  118. mounted() {
  119. },
  120. methods: {
  121. //
  122. // 保存
  123. keep(){},
  124. // 选择拆分类型
  125. splitTypeSelect(val) {
  126. this.splitType = val
  127. },
  128. // 选择拆分符号
  129. splitBySelect(val) {
  130. this.splitBy = val
  131. },
  132. // 选择显示类型
  133. typeSelect(val) {
  134. this.typeArr = []
  135. if (val == 1) {
  136. this.typeArr.push(1)
  137. } else {
  138. this.typeArr.push(1, 0)
  139. }
  140. // this.tableData = this.tableData1.filter(item => {
  141. // return this.typeArr.includes(item.pType)
  142. // })
  143. // this.getSpanArr(this.tableData)
  144. // this.keep()
  145. },
  146. // 特征等合并
  147. merge() {
  148. // console.log(this.checkList,this.row);
  149. if (this.row.length > 1) {
  150. var str = ''
  151. var str1 = ''
  152. var str2 = ''
  153. var str3 = ''
  154. for (let i = 0; i < this.row.length - 1; i++) {
  155. if (this.row[i].rightId != this.row[i + 1].rightId) {
  156. this.$alert("不能跨权要合并特征", "提示", {
  157. type: 'warning',
  158. confirmButtonText: '确定',
  159. })
  160. return false
  161. } else {
  162. let Index_rowArr = this.row.sort((a, b) => {
  163. return a.$index - b.$index
  164. })
  165. // console.log(this.Index_row,Index_rowArr);
  166. if (Index_rowArr[i + 1].$index - Index_rowArr[i].$index != 1) {
  167. this.$alert("非相邻不能合并特征", "提示", {
  168. type: 'warning',
  169. confirmButtonText: '确定',
  170. })
  171. return false
  172. }
  173. }
  174. }
  175. this.row.forEach((rowItem, rowIndex) => {
  176. // console.log(rowItem,rowIndex);
  177. if (rowIndex < this.row.length - 1) {
  178. str = str + rowItem.content.trim()
  179. str1 = str1 + rowItem.contentOut.trim()
  180. str2 = str2 + rowItem.littleDirection
  181. str3 = str3 + rowItem.explainText
  182. let Index1 = this.tableData1.findIndex(item => { return rowItem.id == item.id })
  183. if (Index1 != -1) {
  184. this.tableData1.splice(Index1, 1)
  185. }
  186. } else if (rowIndex == this.row.length - 1) {
  187. str = str + rowItem.content.trim()
  188. str1 = str1 + rowItem.contentOut.trim()
  189. str2 = str2 + rowItem.littleDirection
  190. str3 = str3 + rowItem.explainText
  191. }
  192. let Index2 = this.tableData1.findIndex(item => { return item.id == rowItem.id })
  193. if (Index2 != -1) {
  194. this.tableData1[Index2].content = str
  195. this.tableData1[Index2].contentOut = str1
  196. this.tableData1[Index2].littleDirection = str2
  197. this.tableData1[Index2].explainText = str3
  198. }
  199. })
  200. this.TypeSelect(this.Type)
  201. this.row = []
  202. this.checkList = []
  203. }
  204. },
  205. // 拆分
  206. split() {
  207. //不能同时拆分
  208. if (this.row.length > 0) {
  209. if (this.row.length > 1) {
  210. this.$alert("不能同时拆分多个特征", "提示", {
  211. type: 'warning',
  212. confirmButtonText: '确定',
  213. })
  214. return false
  215. }
  216. var rowId = Math.floor((Math.random() * 9999) + 1000);
  217. this.row.forEach((rowItem, rowIndex) => {
  218. var splitAdd = {
  219. id: rowItem.id + rowId + "a",
  220. content: '',
  221. contentOut: '',
  222. littleDirection: '',
  223. explainText: '',
  224. rightName: rowItem.rightName,
  225. featuresOrder: rowItem.featuresOrder,
  226. splitBy: rowItem.splitBy,
  227. splitType: rowItem.splitType,
  228. signPatentNo: rowItem.signPatentNo,
  229. rightId: rowItem.rightId,
  230. rightType: rowItem.rightType,
  231. isFinal: rowItem.isFinal,
  232. partnerId: rowItem.partnerId,
  233. reportId: rowItem.reportId,
  234. pRightName: rowItem.pRightName,
  235. pSignPatentNo: rowItem.pSignPatentNo,
  236. pContentOut: rowItem.pContentOut,
  237. pContent: rowItem.pContent,
  238. pReportId: rowItem.pReportId,
  239. pPatentId: rowItem.pPatentId,
  240. pType: rowItem.pType,
  241. pSort: rowItem.pSort,
  242. }
  243. let Index2 = this.tableData1.findIndex(item => { return rowItem.id == item.id })
  244. this.tableData1.splice(Index2 + 1, 0, splitAdd)
  245. })
  246. this.TypeSelect(this.Type)
  247. this.row = []
  248. this.checkList = []
  249. }
  250. },
  251. },
  252. }
  253. </script>
  254. <style lang="scss" scoped></style>