index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
  4. <el-form-item label="主办方名称">
  5. <el-input
  6. v-model="queryParams.name"
  7. placeholder="请输入主办方名称"
  8. clearable
  9. style="width: 240px;"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item>
  14. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  15. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  16. </el-form-item>
  17. </el-form>
  18. <el-row :gutter="10" class="mb8">
  19. <el-col :span="1.5">
  20. <el-button
  21. type="primary"
  22. plain
  23. icon="el-icon-plus"
  24. size="mini"
  25. @click="handleAdd"
  26. v-hasPermi="['performMr:performMr:add']"
  27. >新增</el-button>
  28. </el-col>
  29. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  30. </el-row>
  31. <el-table ref="tables" v-loading="loading" :data="dataList" border>
  32. <el-table-column label="序号" align="center" type="index" width="50"></el-table-column>
  33. <el-table-column label="主办方名你" align="center" prop="name" />
  34. <el-table-column label="法人" align="center" prop="corporationName" />
  35. <el-table-column label="主办方负责人" align="center" prop="contactName" />
  36. <el-table-column label="负责人联系电话" align="center" prop="contactMobile" />
  37. <el-table-column label="创建时间" align="center" prop="createTime" width="160">
  38. <template slot-scope="scope">
  39. <span>{{ parseTime(scope.row.createTime) }}</span>
  40. </template>
  41. </el-table-column>
  42. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  43. <template slot-scope="scope">
  44. <span v-hasPermi="['performMr:performMr:edit']" style="display: inline-block;">
  45. <el-button
  46. size="mini"
  47. type="text"
  48. style="margin-left: 10px;"
  49. v-if="scope.row.status != '1'"
  50. @click="handleUpdate(scope.row)"
  51. >修改</el-button>
  52. </span>
  53. <span v-hasPermi="['performMr:performMr:delete']" style="display: inline-block;">
  54. <el-button
  55. size="mini"
  56. type="text"
  57. style="margin-left: 10px;"
  58. v-if="scope.row.status != '1'"
  59. @click="handleDelete(scope.row,scope.index)"
  60. >删除</el-button>
  61. </span>
  62. </template>
  63. </el-table-column>
  64. </el-table>
  65. <pagination
  66. v-show="total>0"
  67. :total="total"
  68. :page.sync="queryParams.pageNum"
  69. :limit.sync="queryParams.pageSize"
  70. @pagination="getList"
  71. />
  72. <!-- 新增/编辑弹框 -->
  73. <add-and-edit
  74. ref="addAndEdit"
  75. :dict="dict"
  76. @getList="getList"
  77. />
  78. <el-dialog
  79. title="查看"
  80. :visible.sync="visibleStatus"
  81. width="600px"
  82. :destroy-on-close="true"
  83. :close-on-click-modal="false"
  84. >
  85. <div v-if="visibleType == 'img'">
  86. <el-image
  87. style="width: 400px; height: 100%"
  88. :src="newObj.mainImg"
  89. fit="cover"
  90. />
  91. </div>
  92. <div v-if="visibleType == 'html'">
  93. <div v-html="newObj.centent"></div>
  94. </div>
  95. <div slot="footer" class="dialog-footer">
  96. <el-button type="primary" @click="visibleStatus = false">确 定</el-button>
  97. </div>
  98. </el-dialog>
  99. </div>
  100. </template>
  101. <script>
  102. import { pageList, deleteById } from '@/api/performMr/performMr'
  103. import addAndEdit from "./dialog/addAndEdit.vue";
  104. export default {
  105. name: "agreement",
  106. dicts: ['agreement_type'],
  107. components: { addAndEdit },
  108. data() {
  109. return {
  110. // 遮罩层
  111. loading: true,
  112. // 选中数组
  113. ids: [],
  114. // 非单个禁用
  115. single: true,
  116. // 非多个禁用
  117. multiple: true,
  118. // 显示搜索条件
  119. showSearch: true,
  120. // 总条数
  121. total: 0,
  122. // 用户表格数据
  123. dataList: null,
  124. // 弹出层标题
  125. title: "",
  126. // 是否显示弹出层
  127. open: false,
  128. // 日期范围
  129. dateRange: [],
  130. // 查询参数
  131. queryParams: {
  132. pageNum: 1,
  133. pageSize: 10,
  134. type: undefined
  135. },
  136. statusList: [
  137. {id: 1, name: '未发布', value: 0},
  138. {id: 2, name: '发布', value: 1},
  139. {id: 3, name: '下架', value: 2},
  140. ],
  141. visibleStatus: false,
  142. newObj: {},
  143. visibleType: ''
  144. };
  145. },
  146. created() {
  147. this.getList();
  148. },
  149. methods: {
  150. /** 查询列表 */
  151. getList() {
  152. this.loading = true;
  153. pageList(this.addDateRange(this.queryParams, this.dateRange))
  154. .then(response => {
  155. this.dataList = response.data.rows;
  156. this.total = response.data.total;
  157. this.loading = false;
  158. }
  159. );
  160. },
  161. // 取消按钮
  162. cancel() {
  163. this.open = false;
  164. },
  165. /** 搜索按钮操作 */
  166. handleQuery() {
  167. this.queryParams.pageNum = 1;
  168. this.getList();
  169. },
  170. /** 重置按钮操作 */
  171. resetQuery() {
  172. this.dateRange = [];
  173. this.$set(this.queryParams, 'name', '');
  174. this.queryParams.pageNum = 1;
  175. this.handleQuery();
  176. },
  177. // 多选框选中数据
  178. handleSelectionChange(selection) {
  179. this.ids = selection.map(item => item.userId);
  180. this.single = selection.length != 1;
  181. this.multiple = !selection.length;
  182. },
  183. /** 新增按钮操作 */
  184. handleAdd() {
  185. this.$refs["addAndEdit"].openDialog("新增数据", null);
  186. },
  187. /** 修改按钮操作 */
  188. handleUpdate(row) {
  189. this.$refs["addAndEdit"].openDialog("修改数据", row);
  190. },
  191. /** 删除按钮操作 */
  192. handleDelete(row) {
  193. this.$modal.confirm('是否确认删除数据主办方名你为"' + row.name + '"的数据项?').then(function() {
  194. return deleteById(row.id);
  195. }).then(() => {
  196. this.getList();
  197. this.$modal.msgSuccess("删除成功");
  198. }).catch(() => {});
  199. },
  200. /** 查看按钮操作 */
  201. seeCenter(obj, type) {
  202. this.visibleStatus = true
  203. this.visibleType = type;
  204. this.newObj = obj;
  205. }
  206. }
  207. };
  208. </script>