list.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <div>
  3. <Toptitle title="匹配列表">
  4. <slot name="titleButton"> </slot>
  5. </Toptitle>
  6. <div class="match_list">
  7. <Row style="padding:10px 0">
  8. <Col span="5">
  9. <span>金螳螂ID:</span>
  10. <span>
  11. <Input clearable v-model="SearchInfo.jtl_id" style="width:140px" />
  12. </span>
  13. </Col>
  14. <Col span="5">
  15. <span>项目编号:</span>
  16. <span>
  17. <Input clearable v-model="SearchInfo.order_no" style="width:140px" />
  18. </span>
  19. </Col>
  20. <Col span="5">
  21. <span>项目名称:</span>
  22. <span>
  23. <Input clearable v-model="SearchInfo.abbreviation" style="width:140px" />
  24. </span>
  25. </Col>
  26. <Col span="5">
  27. <span>项目简称:</span>
  28. <span>
  29. <Input clearable v-model="SearchInfo.project_title" style="width:140px" />
  30. </span>
  31. </Col>
  32. <Col span="2" offset="2">
  33. <Button @click="initData(1)" type="primary" style="margin-right: 10px" size='small'
  34. >搜索</Button
  35. >
  36. </Col>
  37. </Row>
  38. <Table :columns="tableColumns" border :max-height="500" :data="tableData">
  39. <template slot="setSlot" slot-scope="{ row, index }">
  40. <a @click="handleSet(row, index, 1)" style="margin: 0 5px">匹配</a>
  41. <a @click="handleSet(row, index, 2)">查看</a>
  42. </template>
  43. </Table>
  44. <div class="total">总计<span>{{total}}</span>条数据</div>
  45. </div>
  46. <div class="content_body_page">
  47. <Page
  48. :page-size-opts="[10, 20, 30, 40, 100]"
  49. @on-page-size-change="changeSize"
  50. @on-change="changePage"
  51. :current="page_index"
  52. show-total
  53. show-elevator
  54. :total="total"
  55. show-sizer
  56. :page-size="page_size"
  57. />
  58. </div>
  59. </div>
  60. </template>
  61. <script>
  62. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  63. // 例如:import 《组件名称》 from '《组件路径》';
  64. export default {
  65. name: "matchList",
  66. components: {},
  67. props: {},
  68. // import引入的组件需要注入到对象中才能使用
  69. data() {
  70. // 这里存放数据
  71. return {
  72. SearchInfo: {
  73. project_short_title: "",
  74. project_name: "",
  75. project_number: "",
  76. matching_status: "",
  77. },
  78. tableColumns: [
  79. {
  80. title: "金螳螂ID",
  81. align: "center",
  82. key: "jtl_id",
  83. resizable: true,
  84. width: 350
  85. },
  86. {
  87. title: "项目编号",
  88. align: "center",
  89. key: "order_no",
  90. resizable: true,
  91. width: 350
  92. },
  93. {
  94. title: "项目名称",
  95. align: "center",
  96. key: "abbreviation",
  97. resizable: true,
  98. width: 350
  99. },
  100. {
  101. title: "项目简称",
  102. align: "center",
  103. key: "project_title",
  104. resizable: true,
  105. width: 350
  106. },
  107. { title: "操作", align: "center", minWidth: 150, slot: "setSlot" },
  108. ],
  109. tableData: [],
  110. page_index: 1,
  111. page_size: 10,
  112. total: null,
  113. };
  114. },
  115. // 生命周期 - 创建完成(可以访问当前this实例)
  116. created() {},
  117. // 生命周期 - 挂载完成(可以访问DOM元素)
  118. mounted() {
  119. this.initData();
  120. },
  121. methods: {
  122. initData(page) {
  123. if(page){
  124. this.page_index = 1
  125. }
  126. this.axios({
  127. method: "post",
  128. url: "/api/contract_match_list",
  129. params: { ...this.SearchInfo,page_index:this.page_index,page_size:this.page_size},
  130. }).then((res) => {
  131. if (res.code == 200) {
  132. this.tableData = res.data.data;
  133. this.total = res.data.total;
  134. }
  135. });
  136. },
  137. handleSet(row, index, type) {
  138. switch (type) {
  139. case 1:
  140. this.$router.push({
  141. path: "/cms/Agreement/match/matching",
  142. query: {
  143. type,
  144. order_no:row.order_no
  145. },
  146. });
  147. break;
  148. case 2:
  149. this.$router.push({
  150. path: "/cms/Agreement/match/check",
  151. query: {
  152. type,
  153. order_no:row.order_no
  154. },
  155. });
  156. break;
  157. }
  158. },
  159. changeSize(e) {
  160. this.page_size = e;
  161. this.initData();
  162. },
  163. changePage(e) {
  164. this.page_index = e;
  165. this.initData();
  166. },
  167. },
  168. // 监听属性 类似于data概念
  169. computed: {},
  170. // 监控data中的数据变化
  171. watch: {},
  172. beforeRouteLeave(to, from, next) {
  173. if (
  174. to.path == "/cms/Agreement/match/matching" || to.path == "/cms/Agreement/match/check"
  175. ) {
  176. next();
  177. } else {
  178. from.meta.keepAlive = false;
  179. next();
  180. }
  181. },
  182. beforeCreate() {}, // 生命周期 - 创建之前
  183. beforeMount() {}, // 生命周期 - 挂载之前
  184. beforeUpdate() {}, // 生命周期 - 更新之前
  185. updated() {}, // 生命周期 - 更新之后
  186. beforeDestroy() {}, // 生命周期 - 销毁之前
  187. destroyed() {}, // 生命周期 - 销毁完成
  188. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  189. };
  190. </script>
  191. <style lang="scss" scoped>
  192. span{
  193. font-size: 15px;
  194. }
  195. .total{
  196. margin-top:10px;
  197. }
  198. .total>span{
  199. color: #d9001b;
  200. font-size: 14px;
  201. }
  202. .content_body_page {
  203. display: flex;
  204. justify-content: center;
  205. padding-top: 20px;
  206. }
  207. .match_list{
  208. height:80%;
  209. overflow: hidden;
  210. }
  211. /deep/ .ivu-col{
  212. display: flex;
  213. margin: 5px;
  214. align-items: center;
  215. }
  216. /deep/ .ivu-col-span-6{
  217. flex: auto;
  218. }
  219. </style>