list.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <div>
  3. <Toptitle title="深化单列表"></Toptitle>
  4. <div class="content">
  5. <Form :label-width='120' class="form_content">
  6. <FormItem label='金螳螂ID:'>
  7. <Input clearable v-model="searchData.jtl_id"/>
  8. </FormItem>
  9. <FormItem label='项目编码:'>
  10. <Input clearable v-model="searchData.order_no"/>
  11. </FormItem>
  12. <FormItem label='项目名称:'>
  13. <Input clearable v-model="searchData.project_title"/>
  14. </FormItem>
  15. <FormItem label='项目简称:'>
  16. <Input clearable v-model="searchData.abbreviation"/>
  17. </FormItem>
  18. <FormItem :label-width='40'>
  19. <Button type="primary" @click="initData(searchData)">搜索</Button>
  20. </FormItem>
  21. </Form>
  22. <div class="before_table">
  23. <Button type="primary" @click="handleSet(1,null)">新增</Button>
  24. </div>
  25. <Table :data='tableData' :columns='tableColumns' border max-height='550'>
  26. <template slot="set" slot-scope="{row}">
  27. <a @click="handleSet(2,row)" style="margin-right:10px">编辑</a>
  28. <a @click="handleSet(3,row)" style="margin-right:10px">查看</a>
  29. <a @click="handleSet(4,row)">删除</a>
  30. </template>
  31. </Table>
  32. </div>
  33. <div class="content_body_page">
  34. <Page
  35. :page-size-opts="[10, 20, 30, 40, 100]"
  36. @on-page-size-change="changeSize"
  37. @on-change="changePage"
  38. :current="pageIndex"
  39. show-total
  40. show-elevator
  41. :total="total"
  42. show-sizer
  43. :page-size="pageSize"
  44. />
  45. </div>
  46. </div>
  47. </template>
  48. <script>
  49. export default {
  50. data(){
  51. return{
  52. pageIndex:1,
  53. pageSize:10,
  54. total:0,
  55. tableData:[],
  56. tableColumns:[
  57. {title:'金螳螂ID',align:'center',minWidth:120,key:'jtl_id'},
  58. {title:'项目编号',align:'center',minWidth:120,key:'order_no'},
  59. {title:'项目名称',align:'center',minWidth:120,key:'project_title'},
  60. {title:'项目简称',align:'center',minWidth:120,key:'abbreviation'},
  61. {title:'操作',align:'center',minWidth:120,key:'set',slot:'set'}
  62. ],
  63. searchData:{
  64. jtl_id:'',
  65. order_no:'',
  66. project_title:'',
  67. abbreviation:'',
  68. }
  69. }
  70. },
  71. mounted(){
  72. this.initData();
  73. },
  74. methods:{
  75. initData(row){
  76. this.axios.post('/api/contract_deep_list',{...row,page_size:this.pageSize,page_index:this.pageIndex}).then(res=>{
  77. this.tableData = res.data.data;
  78. this.total = res.data.total;
  79. })
  80. },
  81. changePage(e){
  82. this.pageIndex = e;
  83. this.initData(this.searchData);
  84. },
  85. changeSize(e){
  86. this.pageIndex = 1;
  87. this.pageSize = e;
  88. this.initData(this.searchData);
  89. },
  90. handleSet(type,row){
  91. //type 1新增 2编辑 3查看 4删除
  92. switch(type){
  93. case 1:
  94. this.$router.push({path:'/cms/Agreement/deepen/edit',query:{type}})
  95. break;
  96. case 2:
  97. case 3:
  98. this.$router.push({path:'/cms/Agreement/deepen/edit',query:{type,order_no:row.order_no}})
  99. break;
  100. case 4:
  101. this.confirmDelete({
  102. content: '确认删除么?',
  103. then: () => {
  104. this.axios.post('/api/contract_deep_del', { order_no: row.order_no}).then(res => {
  105. if (res.code == 200) {
  106. this.$Message.success(res.msg)
  107. this.initData(this.searchData)
  108. }
  109. })
  110. }
  111. })
  112. break;
  113. }
  114. }
  115. },
  116. beforeRouteLeave(to, from, next) {
  117. if (
  118. to.path == "/cms/Agreement/deepen/edit"
  119. ) {
  120. next();
  121. } else {
  122. from.meta.keepAlive = false;
  123. next();
  124. }
  125. }
  126. }
  127. </script>
  128. <style lang="scss" scoped>
  129. .content{
  130. height:85%;
  131. overflow: auto;
  132. }
  133. .form_content{
  134. margin-top: 15px;
  135. display: flex;
  136. flex-wrap: wrap;
  137. }
  138. .before_table{
  139. display: flex;
  140. flex-direction: row-reverse;
  141. margin-bottom:10px;
  142. }
  143. .content_body_page{
  144. text-align: center;
  145. margin-top:10px;
  146. }
  147. </style>