SimilarItem.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <div class="similar-item-box">
  3. <div class="menu-title">
  4. 相似用户({{ gorseQo.itemId }})
  5. <div class="icon icon-back" @click="backBtn">
  6. <i title="返回"></i>
  7. </div>
  8. </div>
  9. <div class="block_box" style="margin-top: 0">
  10. <div class="title">信息</div>
  11. <div >
  12. <el-form label-width="50px">
  13. <el-form-item label="时间">{{ item.createTime }}</el-form-item>
  14. <el-form-item label="类别">
  15. <template v-for="(tag,index) in item.categoriesArr">
  16. <el-tag :key="index">{{ tag }}</el-tag>
  17. </template>
  18. </el-form-item>
  19. <el-form-item label="标签">
  20. <template v-for="(tag,index) in item.labelsArr">
  21. <el-tag :key="index">{{ tag }}</el-tag>
  22. </template>
  23. </el-form-item>
  24. <el-form-item label="描述">
  25. {{ item.description }}
  26. </el-form-item>
  27. </el-form>
  28. </div>
  29. </div>
  30. <div class="block_box">
  31. <div class="title">Related Items</div>
  32. <el-form :inline="true" class="demo-form-inline">
  33. <el-form-item label="categories">
  34. <el-select v-model="gorseQo.category" @change="getSimilarItem">
  35. <el-option value="" label="无"></el-option>
  36. <el-option :key="item.id" :value="item.name" :label="item.name"
  37. v-for="item in categoryList"></el-option>
  38. </el-select>
  39. </el-form-item>
  40. </el-form>
  41. <div style="padding-top: 0">
  42. <el-table :data="list" style="width: 100%">
  43. <el-table-column type="index" label="行号" width="60"></el-table-column>
  44. <el-table-column prop="ItemId" label="fid"></el-table-column>
  45. <el-table-column prop="labels" label="类别">
  46. <div slot-scope="scope">
  47. <template v-for="(tag,index) in scope.row.Categories">
  48. <el-tag :key="index" v-if="index < 5">{{ tag }}</el-tag>
  49. </template>
  50. <el-tag v-if="scope.row.Categories.length > 5">...</el-tag>
  51. </div>
  52. </el-table-column>
  53. <el-table-column prop="labels" label="标签">
  54. <div slot-scope="scope">
  55. <template v-for="(tag,index) in scope.row.Labels">
  56. <el-tag :key="index" v-if="index < 5">{{ tag }}</el-tag>
  57. </template>
  58. <el-tag v-if="scope.row.Labels.length > 5">...</el-tag>
  59. </div>
  60. </el-table-column>
  61. <el-table-column prop="Comment" label="描述">
  62. <template slot-scope="scope" v-if="scope.row.Comment">
  63. {{ scope.row.Comment.substring(0, 100) }}
  64. </template>
  65. </el-table-column>
  66. <el-table-column prop="Score" label="Score" width="100">
  67. <template slot-scope="scope">
  68. {{ scope.row.Score.toFixed(5) }}
  69. </template>
  70. </el-table-column>
  71. <el-table-column prop="Timestamp" label="创建时间" width="200"></el-table-column>
  72. </el-table>
  73. </div>
  74. </div>
  75. </div>
  76. </template>
  77. <script>
  78. import request from '@/utils/request';
  79. var _this;
  80. export default {
  81. name: "similarItem",
  82. data() {
  83. return {
  84. qo: "",
  85. gorseQo: {
  86. itemId: '',
  87. category: '',
  88. n: 10
  89. },
  90. item: {},
  91. list: [],
  92. categoryList: []
  93. }
  94. },
  95. mounted() {
  96. _this = this;
  97. _this.qo = _this.$route.query.qo;
  98. _this.gorseQo.itemId = _this.$route.query.itemId;
  99. _this.queryCategoryList();
  100. _this.queryItem();
  101. _this.getSimilarItem();
  102. },
  103. methods: {
  104. queryCategoryList() {
  105. request({
  106. url: '/category/query_list',
  107. method: 'post',
  108. data: {}
  109. }).then(res => {
  110. _this.categoryList = res.data;
  111. });
  112. },
  113. queryItem() {
  114. request({
  115. url: '/entrys/query_unique',
  116. method: 'post',
  117. data: {
  118. EQS_fid: _this.gorseQo.itemId
  119. }
  120. }).then(res => {
  121. res.data.labelsArr = res.data.labels ? res.data.labels.split(',') : [];
  122. res.data.categoriesArr = res.data.categories ? res.data.categories.split(',') : [];
  123. _this.item = res.data;
  124. });
  125. },
  126. getSimilarItem() {
  127. request({
  128. url: '/gorse/get_similar_item',
  129. method: 'post',
  130. data: _this.gorseQo
  131. }).then(res => {
  132. _this.list = res.data;
  133. });
  134. },
  135. backBtn() {
  136. this.$router.push({
  137. path: "entrysManage", query: {
  138. qo: _this.qo
  139. }
  140. });
  141. },
  142. }
  143. }
  144. </script>
  145. <style src="../../../css/back.css" scoped></style>
  146. <style scoped lang="scss">
  147. .similar-item-box {
  148. height: 100%;
  149. overflow-y: auto;
  150. }
  151. .block_box {
  152. margin: 25px;
  153. background: #FFFFFF;
  154. border-radius: 3px;
  155. .title {
  156. border-bottom: 1px solid #ccc;
  157. padding: 15px 25px;
  158. }
  159. > div {
  160. padding: 25px;
  161. }
  162. }
  163. .demo-form-inline {
  164. padding: 25px 25px 0 25px;
  165. }
  166. </style>