index.blade.php 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. @extends('layouts.base')
  2. @section('title', trans('供应商模块'))
  3. @section('content')
  4. <link rel="stylesheet" href="{{resource_get('plugins/pc-terminal-two/views/css/index.css')}}">
  5. <div class="all">
  6. <div id="app" v-cloak>
  7. <el-form ref="form" :model="form" label-width="15%">
  8. <div class="vue-main">
  9. <div class="vue-main-title">
  10. <div class="vue-main-title-left"></div>
  11. <div class="vue-main-title-content">供应商模块</div>
  12. <el-button type="primary" class="createModuleSet" @click="createModuleSet">+新增供应商模块</el-button>
  13. </div>
  14. </div>
  15. <div class="vue-main">
  16. <div class="vue-main-content" style="margin-bottom: 20px">
  17. <el-table :data="records.data" align="center" style="width: 100%">
  18. <el-table-column prop="id" label="ID" align="center"></el-table-column>
  19. <el-table-column prop="sort" label="排序" align="center"></el-table-column>
  20. <el-table-column prop="title" label="标题" align="center"></el-table-column>
  21. <el-table-column label="状态" align="center">
  22. <template slot-scope="scope">
  23. <el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0"
  24. @change="updateStatus(scope.row.status, scope.row.id)"></el-switch>
  25. </template>
  26. </el-table-column>
  27. <el-table-column prop="operation" label="操作" align="center">
  28. <template scope="scope">
  29. <el-button type="text" size="medium" title="修改" icon="el-icon-edit-outline"
  30. @click="moduleEdit(scope.row.id)"></el-button>
  31. <el-button type="text" size="medium" title="删除" icon="el-icon-delete"
  32. @click="moduleDel(scope.row.id)"></el-button>
  33. </template>
  34. </el-table-column>
  35. </el-table>
  36. </div>
  37. <el-pagination style="margin-right: 50px"
  38. background align="right"
  39. layout="prev, pager, next"
  40. :total="records.total"
  41. :page-size="records.per_page"
  42. :page-count="records.last_page"
  43. :current-page="records.current_page"
  44. @prev-click="handlePrevPage"
  45. @next-click="handleNextPage"
  46. @current-change="handleCurrentPage">
  47. </el-pagination>
  48. </div>
  49. </el-form>
  50. </div>
  51. </div>
  52. <script>
  53. let app = new Vue({
  54. el: "#app",
  55. delimiters: ['[[', ']]'],
  56. data() {
  57. return {
  58. records: [],
  59. }
  60. },
  61. mounted() {
  62. this.getData()
  63. },
  64. methods: {
  65. getData() {
  66. this.$http.post(`{!! yzWebFullUrl('plugin.pc-terminal-two.backend.supplier-module.records') !!}`).then(function (response) {
  67. if (response.data.result) {
  68. this.records = response.data.data
  69. } else {
  70. this.$message({
  71. message: response.data.msg,
  72. type: 'error'
  73. });
  74. }
  75. }, function (response) {
  76. this.$message({
  77. message: response.data.msg,
  78. type: 'error'
  79. });
  80. });
  81. },
  82. createModuleSet() {
  83. window.location.href = `{!! yzWebFullUrl('plugin.pc-terminal-two.backend.supplier-module.generate-view') !!}`
  84. },
  85. handleCurrentPage(page) {
  86. this.form.page = page
  87. this.getData()
  88. },
  89. handlePrevPage(page) {
  90. // 必要方法,无需执行任何代码
  91. },
  92. handleNextPage(page) {
  93. // 必要方法,无需执行任何代码
  94. },
  95. moduleEdit(id) {
  96. window.location.href = `{!! yzWebFullUrl('plugin.pc-terminal-two.backend.supplier-module.update-view') !!}&id=` + id
  97. },
  98. moduleDel(id) {
  99. this.$confirm('确认删除?', '提示', {
  100. confirmButtonText: '确定',
  101. cancelButtonText: '取消',
  102. type: 'warning'
  103. }).then(() => {
  104. this.$http.post(`{!! yzWebFullUrl('plugin.pc-terminal-two.backend.supplier-module.destroy') !!}`, {id: id}).then(function (response) {
  105. if (response.data.result) {
  106. this.$message({
  107. message: response.data.msg,
  108. type: 'success'
  109. });
  110. this.getData()
  111. } else {
  112. this.$message({
  113. message: response.data.msg,
  114. type: 'error'
  115. });
  116. }
  117. }, function (response) {
  118. this.$message({
  119. message: response.data.msg,
  120. type: 'error'
  121. });
  122. });
  123. }).catch(() => {
  124. this.$message({
  125. type: 'info',
  126. message: '已取消删除'
  127. });
  128. });
  129. },
  130. updateStatus(status, id) {
  131. this.$http.post(`{!! yzWebFullUrl('plugin.pc-terminal-two.backend.supplier-module.updateStatus') !!}`, {
  132. status: status,
  133. id: id
  134. }).then(function (response) {
  135. if (response.data.result) {
  136. this.$message({
  137. message: response.data.msg,
  138. type: 'success'
  139. });
  140. this.getData()
  141. } else {
  142. this.$message({
  143. message: response.data.msg,
  144. type: 'error'
  145. });
  146. }
  147. }, function (response) {
  148. this.$message({
  149. message: response.data.msg,
  150. type: 'error'
  151. });
  152. });
  153. }
  154. }
  155. })
  156. </script>
  157. <style>
  158. .createModuleSet {
  159. background-color: #e5f6f1;
  160. color: #48c1a7;
  161. margin-right: 20px;
  162. }
  163. </style>
  164. @endsection