list.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <div>
  3. <slot name="add"></slot>
  4. <div class="container normal-panel normal-margin">
  5. <!-- 表格主题 -->
  6. <tableLayout :layout="tablecols" :data="pateList" :opwidth="200" :custom="true" :height="tableHieght">
  7. <template v-slot:customcol="scope">
  8. <div v-if="scope.column.columnname === 'classname'">
  9. <el-input v-if="act_cus === scope.column.data.sat_notice_classid" size="mini" v-model="scope.column.data.classname" placeholder="输入版块名称"></el-input>
  10. <p v-else>{{ scope.column.data.classname }} <i class="el-icon-edit"></i></p>
  11. </div>
  12. <!-- <div v-else-if="scope.column.columnname === 'color'">
  13. <el-color-picker :disabled="act_cus !== scope.column.data.sat_notice_classid" v-model="scope.column.data.fcolor"></el-color-picker>
  14. </div>
  15. <div v-else-if="scope.column.columnname === 'isused'">
  16. <el-switch
  17. :disabled="act_cus !== scope.column.data.sat_notice_classid"
  18. v-model="scope.column.data.fisused"
  19. active-color="#ff4949"
  20. inactive-color="#ccc"
  21. :active-value="1"
  22. :inactive-value="0">
  23. </el-switch>
  24. </div> -->
  25. <div v-else-if="scope.column.columnname === 'issecret'">
  26. <el-switch
  27. :disabled="act_cus !== scope.column.data.sat_notice_classid"
  28. v-model="scope.column.data.issecret"
  29. active-color="#ff4949"
  30. inactive-color="#ccc"
  31. :active-value="1"
  32. :inactive-value="0">
  33. </el-switch>
  34. </div>
  35. <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
  36. </template>
  37. <template v-slot:opreation="scope">
  38. <el-button v-if="act_cus === scope.data.sat_notice_classid" size="mini" type="text" class="table-button" icon="el-icon-delete" @click="updatePate(scope.data)">保 存</el-button>
  39. <slot v-else name="edit" :data="scope"></slot>
  40. <slot name="del" :data="scope"></slot>
  41. </template>
  42. </tableLayout>
  43. <div style="margin-top:16px;text-align:right">
  44. <el-pagination
  45. background
  46. small
  47. @size-change="handleSizeChange"
  48. @current-change="handleCurrentChange"
  49. :current-page="currentPage"
  50. :page-size="params.content.pageSize"
  51. layout="total, prev, pager, next, jumper"
  52. :total="total">
  53. </el-pagination>
  54. </div>
  55. </div>
  56. </div>
  57. </template>
  58. <script>
  59. export default {
  60. data () {
  61. return {
  62. color1: '#409EFF',
  63. pateList:[],
  64. formInline:{},
  65. params:{
  66. "classname": "webmanage.saletool.notice.noticeclass",
  67. "method": "queryNoticeClass",
  68. "content": {
  69. "pageNumber": 1,
  70. "pageSize": 10,
  71. "where":{
  72. "condition":""
  73. }
  74. }
  75. },
  76. act_cus:0,
  77. total:0,
  78. currentPage:0,
  79. }
  80. },
  81. methods:{
  82. // 查询版块
  83. queryTypeList () {
  84. this.$api.requested(this.params).then((res)=>{
  85. this.pateList = res.data
  86. this.total = res.total
  87. this.currentPage = res.pageNumber
  88. }).catch((err) => {
  89. console.log(err)
  90. })
  91. },
  92. handleSizeChange(val) {
  93. // console.log(`每页 ${val} 条`);
  94. this.params.content.pageSize = val
  95. this.queryTypeList()
  96. },
  97. handleCurrentChange(val) {
  98. // console.log(`当前页: ${val}`);
  99. this.params.content.pageNumber = val
  100. this.queryTypeList()
  101. },
  102. // 点击行编辑
  103. cellClick (row) {
  104. this.act_cus = row.sat_notice_classid
  105. },
  106. // 插入新增行
  107. addPate () {
  108. this.act_cus = 0
  109. this.pateList.unshift({
  110. sat_notice_classid:0,
  111. classname:"",
  112. // issystem:0,
  113. // fisused:1,
  114. issecret:0,
  115. fcolor:'#ccc',
  116. })
  117. },
  118. // 新增或更新版块
  119. updatePate (row) {
  120. this.$api.requested({
  121. "classname": "webmanage.saletool.notice.noticeclass",
  122. "method": "insertormodify_noticeclass",
  123. "content": row
  124. }).then((res)=>{
  125. this.tool.showMessage(res)
  126. res.code === 1?this.act_cus = 0:''
  127. this.queryTypeList()
  128. })
  129. },
  130. },
  131. mounted () {
  132. this.queryTypeList()
  133. },
  134. created () {
  135. this.tablecols = this.tool.tabelCol(this.$route.name)['tablePate'].tablecols
  136. }
  137. }
  138. </script>
  139. <style>
  140. .clearfix{
  141. clear: both;
  142. zoom: 0;
  143. overflow: hidden;
  144. }
  145. </style>