Table.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <div class="patent-table-list-view height_100" v-DivHeight="getDivHeight">
  3. <el-table :data="tableData" border style="width: 100%" header-row-class-name="custom-table-header" ref="table"
  4. :maxHeight="tableHeight" @sort-change="sortChange" @cell-click="cellClick" :cell-class-name="cellClassName">
  5. <el-table-column label="#" width="100" type="index" align="center" fixed="left">
  6. <template slot-scope="scope">
  7. <div v-if="refresh">
  8. <el-checkbox-group :value="patentNoList" >
  9. <el-checkbox :label="scope.row.patentNo" @change="changeSelect(scope.row)">
  10. <span>{{ (scope.$index + 1) + ((queryParams.current - 1) * queryParams.size) }}</span>
  11. </el-checkbox>
  12. </el-checkbox-group>
  13. <!-- <el-checkbox :label="scope.row.patentNo" @change="changeSelect(scope.row)"
  14. :checked="patentNoList.filter(item => { return item == scope.row.patentNo || item == scope.row.appNo }).length > 0">
  15. <span>{{ (scope.$index + 1) + ((queryParams.current - 1) * queryParams.size) }}</span>
  16. </el-checkbox> -->
  17. </div>
  18. <div v-else>
  19. <span>{{ (scope.$index + 1) + ((queryParams.current - 1) * queryParams.size) }}</span>
  20. </div>
  21. </template>
  22. </el-table-column>
  23. <el-table-column v-for="item in column.filter(item => !item.ifHidden)" :width="['abstractStr'].indexOf(item.value)!=-1?'500':'auto'" min-width="200" :fixed="['patentNo'].indexOf(item.value)!=-1?'left':false"
  24. :render-header="$commonJS.renderHeaderMethods" :key="item.value" :prop="item.field" :label="item.name"
  25. :sortable="(canSort && item.ifSort)?'custom':false" align="center">
  26. <template slot-scope="scope">
  27. <div v-if="['patentNo'].includes(item.value)">
  28. <el-popover placement="right-start" width="500" @show="showPopover(scope.row)" trigger="hover">
  29. <table class="patent-popover-table" v-if="scope.row.showPopover">
  30. <tr>
  31. <td>
  32. <div class="patent-abstract-image text-align_center">
  33. <el-image fit="contain" :src="outside?scope.row.pictureGuid:$commonJS.checkViewer(scope.row.pictureGuid)"
  34. :preview-src-list="[outside?scope.row.pictureGuid:$commonJS.checkViewer(scope.row.pictureGuid)]" style="vertical-align:middle;"
  35. :style="{ width: scope.row.imgWidth ? scope.row.imgWidth : '100%', height: scope.row.imgHeight ? scope.row.imgHeight : '100%' }">
  36. <div slot="error" class="image-slot">
  37. <img src="https://www.patentstar.com.cn/img/Common/nopic.jpg" alt="" style="">
  38. </div>
  39. </el-image>
  40. </div>
  41. </td>
  42. <td>
  43. <p v-html="getView(scope.row, 'abstractStr')"></p>
  44. <el-link v-if="haveTranslatedText(scope.row, 'abstractStr')" type="primary" @click.native="handleChange(scope.row, 'abstractStr')">
  45. <span v-if="!scope.row.change2">切换译文</span>
  46. <span v-else>切换原文</span>
  47. </el-link>
  48. </td>
  49. </tr>
  50. </table>
  51. <template v-if="scope.row.ifSearch" slot="reference">
  52. <el-link type="primary" @click="handleClick(scope.row, scope.$index)">
  53. <span v-html="getView(scope.row, item.value, item.type)"></span>
  54. </el-link>
  55. </template>
  56. <template v-else slot="reference">
  57. <span v-html="getView(scope.row, item.value, item.type)"></span>
  58. <span>(未匹配到专利)</span>
  59. </template>
  60. </el-popover>
  61. </div>
  62. <template v-else-if="item.ifPersonal">
  63. <div>
  64. <span v-html="getCustomView(scope.row,item)"></span>
  65. </div>
  66. </template>
  67. <template v-else-if="item.value === 'title'">
  68. <span v-html="getView(scope.row, 'title')"></span>
  69. <br>
  70. <el-link v-if="haveTranslatedText(scope.row, 'title')" type="primary" @click.native="handleChange(scope.row, 'title')">
  71. <span v-if="!scope.row.change">切换译文</span>
  72. <span v-else>切换原文</span>
  73. </el-link>
  74. </template>
  75. <template v-else-if="item.value === 'abstractStr'">
  76. <span v-html="getView(scope.row, 'abstractStr')"></span>
  77. <br>
  78. <el-link v-if="haveTranslatedText(scope.row, 'abstractStr')" type="primary" @click.native="handleChange(scope.row, 'abstractStr')">
  79. <span v-if="!scope.row.change2">切换译文</span>
  80. <span v-else>切换原文</span>
  81. </el-link>
  82. </template>
  83. <!-- 法律状态 -->
  84. <template v-else-if="item.value === 'legalStatus'">
  85. <span v-html="getView(scope.row, 'legalStatus')"></span>
  86. </template>
  87. <!-- 专利状态 -->
  88. <template v-else-if="item.value === 'simpleStatus'">
  89. <span v-html="getView(scope.row, 'simpleStatus')"></span>
  90. </template>
  91. <!-- 专利类型 -->
  92. <template v-else-if="item.value === 'patentType'">
  93. <span v-html="getView(scope.row, 'patentType')"></span>
  94. </template>
  95. <div v-else v-html="getView(scope.row, item.value, item.type)"></div>
  96. </template>
  97. </el-table-column>
  98. </el-table>
  99. </div>
  100. </template>
  101. <script>
  102. import { projectData, handleData } from '../mixins/index'
  103. import { getTableHeight } from '@/views/components/mixins'
  104. export default {
  105. props:{
  106. canSort:{
  107. type:Boolean,
  108. default:true
  109. }
  110. },
  111. mixins: [projectData, handleData, getTableHeight],
  112. components: {
  113. },
  114. data() {
  115. return {
  116. }
  117. },
  118. watch:{
  119. tableData(){
  120. this.$refs.table.doLayout();
  121. }
  122. },
  123. activated() {
  124. },
  125. computed: {
  126. },
  127. created() {
  128. },
  129. mounted() {
  130. // console.log(this.columnList);
  131. },
  132. methods: {
  133. showPopover(row){
  134. this.$set(row,'showPopover',true)
  135. },
  136. // 排序
  137. sortChange({ column, prop, order }) {
  138. this.$emit('on-sort', { column, prop, order })
  139. },
  140. cellClassName({ row, column, rowIndex, columnIndex }) {
  141. if (this.validationCustomField(column.label)) {
  142. return 'custom-field-cell'
  143. }
  144. },
  145. validationCustomField(label) {
  146. const field = this.column.find(item => item.name === label)
  147. if (field && field.ifPersonal) {
  148. return field
  149. }
  150. return false
  151. },
  152. cellClick(row, column, cell,event){
  153. const field = this.validationCustomField(column.label)
  154. if (field) {
  155. this.$emit('index-setting', row, field)
  156. }
  157. }
  158. },
  159. }
  160. </script>
  161. <style lang="scss">
  162. .patent-popover-table {
  163. tbody,
  164. tr,
  165. td {
  166. height: 100%;
  167. vertical-align: top;
  168. }
  169. p {
  170. padding: 0 !important;
  171. margin: 0 !important;
  172. }
  173. .patent-abstract-image {
  174. padding: 10px;
  175. border: 1px solid #bcc2cc;
  176. border-radius: 4px;
  177. width: 120px;
  178. height: 150px;
  179. line-height: 150px;
  180. img {
  181. width: 100%;
  182. height: 100%;
  183. }
  184. }
  185. }
  186. .patent-table-list-view {
  187. .view-table {
  188. width: 100%;
  189. }
  190. .el-table .cell {
  191. white-space: pre-line !important;
  192. }
  193. .custom-field-cell {
  194. cursor: pointer;
  195. }
  196. }</style>