matchList.vue 5.7 KB

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