index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <div class='m-container'>
  3. <h2>
  4. <div class="squrt"></div>问卷管理
  5. </h2>
  6. <div class="m-core">
  7. <el-button type="primary" @click="onQuestionOperation('create')"
  8. v-permission="'organization/add'"
  9. class='newBand'>添加问卷</el-button>
  10. <save-form :inline="true"
  11. @submit="search"
  12. @reset="onReSet"
  13. ref="searchForm"
  14. :model="searchForm">
  15. <el-form-item prop="search">
  16. <el-input
  17. type="text"
  18. clearable
  19. v-model="searchForm.search"
  20. placeholder="问卷编号或编号"
  21. ></el-input>
  22. </el-form-item>
  23. <el-form-item prop="status">
  24. <el-select v-model="searchForm.status"
  25. filterable
  26. placeholder="请选择收费类型"
  27. clearable>
  28. <el-option label="启用" :value="1"></el-option>
  29. <el-option label="停用" :value="0"></el-option>
  30. </el-select>
  31. </el-form-item>
  32. <el-form-item>
  33. <el-button type="danger" native-type="submit">搜索</el-button>
  34. <el-button native-type="reset" type="primary">重置</el-button>
  35. </el-form-item>
  36. </save-form>
  37. <!-- 列表 -->
  38. <div class="tableWrap">
  39. <el-table :data='tableList'
  40. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  41. <el-table-column align='center'
  42. prop="id"
  43. label="问卷编号">
  44. <template slot-scope="scope">
  45. <copy-text>{{ scope.row.id }}</copy-text>
  46. </template>
  47. </el-table-column>
  48. <el-table-column align='center'
  49. prop="title"
  50. label="问卷名称">
  51. <template slot-scope="scope">
  52. <!-- <copy-text>{{ scope.row.title }}</copy-text> -->
  53. <overflow-text :text="scope.row.title" ></overflow-text>
  54. </template>
  55. </el-table-column>
  56. <el-table-column align='center'
  57. prop="status"
  58. label="状态">
  59. <template slot-scope="scope">
  60. {{ scope.row.status ? '开启' : '关闭' }}
  61. </template>
  62. </el-table-column>
  63. <el-table-column align='center'
  64. label="操作">
  65. <template slot-scope="scope">
  66. <el-button @click="onOperation(scope.row)"
  67. type="text">{{ scope.row.status ? '停用' : '启用' }}</el-button>
  68. <el-button @click="onQuestionOperation('update', scope.row)"
  69. v-permission="'organization/update'"
  70. type="text">修改</el-button>
  71. <el-button @click="onOperation(scope.row, 'del')"
  72. type="text">删除</el-button>
  73. </template>
  74. </el-table-column>
  75. </el-table>
  76. <pagination sync :total.sync="pageInfo.total"
  77. :page.sync="pageInfo.page"
  78. :limit.sync="pageInfo.limit"
  79. :page-sizes="pageInfo.page_size"
  80. @pagination="getList" />
  81. </div>
  82. </div>
  83. </div>
  84. </template>
  85. <script>
  86. import pagination from '@/components/Pagination/index'
  87. import { questionnaireTopicQueryPage, questionnaireTopicUpdate } from './api'
  88. export default {
  89. name: 'branchSetting',
  90. components: { pagination },
  91. data () {
  92. return {
  93. searchForm: {
  94. search: null,
  95. status: null
  96. },
  97. tableList: [],
  98. pageInfo: {
  99. // 分页规则
  100. limit: 10, // 限制显示条数
  101. page: 1, // 当前页
  102. total: 0, // 总条数
  103. page_size: [10, 20, 40, 50] // 选择限制显示条数
  104. },
  105. organId: null,
  106. }
  107. },
  108. mounted () {
  109. this.getList()
  110. },
  111. methods: {
  112. getList () {
  113. questionnaireTopicQueryPage({
  114. rows: this.pageInfo.limit,
  115. page: this.pageInfo.page,
  116. ...this.searchForm
  117. }).then(res => {
  118. if (res.code == 200 && res.data) {
  119. this.tableList = res.data.rows
  120. this.pageInfo.total = res.data.total
  121. }
  122. })
  123. },
  124. onQuestionOperation(type, row) {
  125. let str = '问卷'
  126. str = (type == 'create' ? '添加' : '修改') + str
  127. let params = {
  128. type
  129. }
  130. if(type == 'update') {
  131. params.id = row.id
  132. }
  133. this.$router.push({
  134. path: '/operateManager/questionOperation',
  135. query: params
  136. }, (router) => {
  137. router.meta.title = str;
  138. })
  139. },
  140. async onOperation(row, type) {
  141. let str = row.status ? '停用' : '启用'
  142. if(type == 'del') {
  143. str = '删除'
  144. }
  145. this.$confirm(`是否${str}该问卷?`, '提示', {
  146. confirmButtonText: '确定',
  147. cancelButtonText: '取消',
  148. type: 'warning'
  149. }).then(async () => {
  150. try {
  151. if(type == 'del') {
  152. await questionnaireTopicUpdate({ id: row.id, delFlag: 1 })
  153. } else {
  154. let status = row.status
  155. await questionnaireTopicUpdate({ id: row.id, status: !status })
  156. }
  157. this.$message.success(str + '成功')
  158. this.getList()
  159. } catch {
  160. //
  161. }
  162. })
  163. },
  164. search() {
  165. this.pageInfo.page = 1;
  166. this.getList();
  167. },
  168. onReSet() {
  169. this.$refs['searchForm'].resetFields();
  170. this.search();
  171. },
  172. }
  173. }
  174. </script>
  175. <style lang="scss" scoped>
  176. /deep/.el-button--primary {
  177. background: #14928a;
  178. border-color: #14928a;
  179. color: #fff;
  180. &:hover,
  181. &:active,
  182. &:focus {
  183. background: #14928a;
  184. border-color: #14928a;
  185. color: #fff;
  186. }
  187. }
  188. /deep/.el-date-editor.el-input {
  189. width: 100% !important;
  190. }
  191. /deep/.el-select {
  192. width: 98% !important;
  193. }
  194. </style>