list.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <div>
  3. <Toptitle title="房间列表">
  4. <slot name="titleButton"> </slot>
  5. </Toptitle>
  6. <div class="weight_memo_content">
  7. <div>
  8. <Topsearch :list="list" @init="initData" @searchData="initData" />
  9. </div>
  10. <div
  11. style="
  12. text-align: right;
  13. margin: 10px;
  14. border-top: 1px solid #f4f4f4;
  15. padding-top: 10px;
  16. "
  17. >
  18. <Button type="primary" size="small" style="margin-right: 10px" @click="gotoPage(3)"
  19. >新增</Button
  20. >
  21. </div>
  22. <Table :columns="tableColumns" border :data="tableData">
  23. <template slot="make_data" slot-scope="{row}">
  24. <span>{{func.replaceDate(row.crt_time)}}</span>
  25. </template>
  26. </Table>
  27. </div>
  28. <div class="content_body_page">
  29. <Page :page-size-opts="[10, 20, 30, 40,100]"
  30. @on-page-size-change='changeSize'
  31. @on-change='changePage'
  32. :current='pageIndex'
  33. show-total
  34. show-elevator
  35. :total="total"
  36. show-sizer
  37. :page-size='pageSize' />
  38. </div>
  39. </div>
  40. </template>
  41. <script>
  42. export default {
  43. data() {
  44. return {
  45. list: [
  46. {
  47. title: "项目编号",
  48. name: "Input",
  49. value: "",
  50. placeholder: "请输入项目编号",
  51. serverName: "project_number",
  52. },
  53. {
  54. title: "项目名称",
  55. name: "Input",
  56. value: "",
  57. placeholder: "请输入项目名称",
  58. serverName: "project_name",
  59. },
  60. {
  61. title: "项目简称",
  62. name: "Input",
  63. value: "",
  64. placeholder: "请输入项目简称",
  65. serverName: "abbreviation",
  66. },
  67. {
  68. title: "匹配状态",
  69. name: "Select",
  70. value: "",
  71. placeholder: "请选择",
  72. serverName: "state",
  73. option: [
  74. { label: "匹配完成", value: 2 },
  75. { label: "未匹配", value: 0 },
  76. { label: "匹配中", value: 1 },
  77. ]
  78. },
  79. ],
  80. tableColumns: [
  81. { title: "项目编码", key: "project_number", align: "center", minWidth: 140 },
  82. { title: "项目名称", key: "project_name", align: "center", minWidth: 140 },
  83. { title: "项目简称", key: "abbreviation", align: "center", minWidth: 140 },
  84. { title: "匹配状态", key: "state", align: "center", minWidth: 140 ,
  85. render:(h,params)=>{
  86. return h('span',{},params.row.state===0?'未匹配':params.row.state===2?'匹配完成':'匹配中')
  87. }},
  88. { title: "制单日期", key: "make_data", align: "center", minWidth: 140 ,slot:"make_data"},
  89. { title: "操作", key:'',align: "center", minWidth: 140 ,
  90. render: (h, params) => {
  91. return h('div', [
  92. h('a', { style: {
  93. marginRight: '5px'
  94. }, on: {
  95. click: () => {
  96. this.gotoPage(1,params.row)
  97. }
  98. }
  99. }, '编辑'),
  100. h('a', { style: {
  101. marginRight: '5px'
  102. }, on: {
  103. click: () => {
  104. this.gotoPage(2,params.row)
  105. }
  106. }
  107. }, '查看'),
  108. h('a',{ style: {
  109. marginRight: '5px'
  110. }, on: {
  111. click: () => {
  112. this.del(params.row)
  113. }
  114. }},'删除')
  115. ]);
  116. }},
  117. ],
  118. tableData: [],
  119. pageIndex: 1,
  120. pageSize: 10,
  121. total: 0,
  122. };
  123. },
  124. methods: {
  125. initData(row) {
  126. console.log(row)
  127. this.axios.get('/api/cut_order_list',{params:{
  128. page_index:this.pageIndex,
  129. page_size:this.pageSize,
  130. ...row
  131. }}).then(res=>{
  132. this.tableData = res.data.data;
  133. this.total = res.data.total;
  134. })
  135. },
  136. del(row){
  137. console.log(row)
  138. this.axios.post('/api/cut_order_delete',{cut_order_id:row.id,order_type:2}).then(()=>{
  139. this.initData()
  140. })
  141. },
  142. gotoPage(type,row){
  143. //1 编辑 2 查看 3 新增
  144. switch(type){
  145. case 1:
  146. case 2:this.$router.push({ path: '/cms/leadMatch/roomList/edit', query: { type:type,cut_order_id:row.id} });
  147. break
  148. case 3:this.$router.push({ path: '/cms/leadMatch/roomList/edit', query: { type:type} });
  149. break
  150. }
  151. },
  152. changeSize (e) {
  153. this.pageSize = e;
  154. this.initData()
  155. },
  156. changePage (e) {
  157. this.pageIndex = e;
  158. this.initData()
  159. },
  160. },
  161. };
  162. </script>
  163. <style scoped lang='scss'>
  164. .weight_memo_content{
  165. height: 650px;
  166. overflow: auto;
  167. }
  168. .content_body_page{
  169. margin-top: 10px;
  170. text-align: center;
  171. }
  172. </style>