BSTlist.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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="searchData" />
  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", resizable: true,
  82. width: 350},
  83. { title: "项目名称", key: "project_name", align: "center", resizable: true,
  84. width: 350},
  85. { title: "项目简称", key: "abbreviation", align: "center",resizable: true,
  86. width: 350},
  87. // { title: "匹配状态", key: "state", align: "center", minWidth: 140 ,
  88. // render:(h,params)=>{
  89. // return h('span',{},params.row.state===0?'未匹配':params.row.state===2?'匹配完成':'匹配中')
  90. // }},
  91. { title: "制单日期", key: "make_data", align: "center", resizable: true,
  92. width: 350 ,slot:"make_data"},
  93. { title: "操作", key:'',align: "center", minWidth: 150 ,
  94. render: (h, params) => {
  95. return h('div', [
  96. h('a', { style: {
  97. marginRight: '5px'
  98. }, on: {
  99. click: () => {
  100. this.gotoPage(1,params.row)
  101. }
  102. }
  103. }, '编辑'),
  104. h('a', { style: {
  105. marginRight: '5px'
  106. }, on: {
  107. click: () => {
  108. this.gotoPage(2,params.row)
  109. }
  110. }
  111. }, '查看'),
  112. h('a',{ style: {
  113. marginRight: '5px'
  114. }, on: {
  115. click: () => {
  116. this.del(params.row)
  117. }
  118. }},'删除')
  119. ]);
  120. }},
  121. ],
  122. tableData: [],
  123. pageIndex: JSON.parse(localStorage.getItem("pageIndex")) || 1,
  124. pageSize: JSON.parse(localStorage.getItem("pageSize")) || 10,
  125. total: 0,
  126. };
  127. },
  128. mounted() {
  129. if (localStorage.getItem("list")) {
  130. this.list = JSON.parse(localStorage.getItem("list"));
  131. }
  132. if (localStorage.getItem("searchList")) {
  133. this.$nextTick(() => {
  134. this.initData(JSON.parse(localStorage.getItem("searchList")));
  135. });
  136. }
  137. },
  138. methods: {
  139. searchData(){
  140. this.pageIndex = 1;
  141. this.pageSize = 10;
  142. let row = {};
  143. this.list.forEach((e) => {
  144. if (e.serverName == "project_number") {
  145. this.$set(row, "project_number", e.value);
  146. }
  147. if (e.serverName == "project_name") {
  148. this.$set(row, "project_name", e.value);
  149. }
  150. if (e.serverName == "abbreviation") {
  151. this.$set(row, "abbreviation", e.value);
  152. }
  153. // this.$set(对象, key, 数组);
  154. });
  155. localStorage.setItem("searchList", JSON.stringify(row));
  156. this.initData(row);
  157. },
  158. initData(row) {
  159. console.log(row)
  160. this.axios.get('/api/cut_order_list',{params:{
  161. page_index:this.pageIndex,
  162. page_size:this.pageSize,
  163. order_type:2,
  164. ...row
  165. }}).then(res=>{
  166. this.tableData = res.data.data;
  167. this.total = res.data.total;
  168. })
  169. },
  170. del(row){
  171. this.confirmDelete({
  172. content:'是否删除?',
  173. title:'房间删除',
  174. type:'primary',
  175. then:()=>{
  176. this.axios.post('/api/cut_order_delete',{cut_order_id:row.id,order_type:2}).then(()=>{
  177. this.initData()
  178. })
  179. },
  180. cancel:()=>{}
  181. })
  182. },
  183. gotoPage(type,row){
  184. localStorage.setItem("list", JSON.stringify(this.list));
  185. localStorage.setItem("pageSize", this.pageSize);
  186. localStorage.setItem("pageIndex", this.pageIndex);
  187. //1 编辑 2 查看 3 新增
  188. switch(type){
  189. case 1:
  190. case 2:this.$router.push({ path: '/cms/leadMatch/roomList/BSTedit', query: { type:type,cut_order_id:row.id} });
  191. break
  192. case 3:this.$router.push({ path: '/cms/leadMatch/roomList/BSTedit', query: { type:type} });
  193. break
  194. }
  195. },
  196. changeSize (e) {
  197. this.pageSize = e;
  198. if (localStorage.getItem("searchList")) {
  199. this.initData(JSON.parse(localStorage.getItem("searchList")));
  200. }else{
  201. this.initData()
  202. }
  203. },
  204. changePage (e) {
  205. this.pageIndex = e;
  206. if (localStorage.getItem("searchList")) {
  207. this.initData(JSON.parse(localStorage.getItem("searchList")));
  208. }else{
  209. this.initData()
  210. }
  211. },
  212. },
  213. };
  214. </script>
  215. <style scoped lang='scss'>
  216. .weight_memo_content{
  217. height: 80%;
  218. overflow: auto;
  219. }
  220. .content_body_page{
  221. margin-top: 10px;
  222. text-align: center;
  223. }
  224. </style>