index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  4. <!-- <el-form-item label="系统模块" prop="title">
  5. <el-input
  6. v-model="queryParams.title"
  7. placeholder="请输入系统模块"
  8. clearable
  9. style="width: 240px;"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item> -->
  13. <el-form-item label="协议类型" prop="type">
  14. <el-select
  15. v-model="queryParams.type"
  16. placeholder="协议类型"
  17. clearable
  18. style="width: 240px"
  19. >
  20. <el-option
  21. v-for="dict in dict.type.agreement_type"
  22. :key="dict.value"
  23. :label="dict.label"
  24. :value="dict.value"
  25. />
  26. </el-select>
  27. </el-form-item>
  28. <el-form-item label="添加时间">
  29. <el-date-picker
  30. v-model="dateRange"
  31. style="width: 240px"
  32. value-format="yyyy-MM-dd HH:mm:ss"
  33. type="daterange"
  34. range-separator="-"
  35. start-placeholder="开始日期"
  36. end-placeholder="结束日期"
  37. :default-time="['00:00:00', '23:59:59']"
  38. ></el-date-picker>
  39. </el-form-item>
  40. <el-form-item>
  41. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  42. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  43. </el-form-item>
  44. </el-form>
  45. <el-row :gutter="10" class="mb8">
  46. <!-- <el-col :span="1.5">-->
  47. <!-- <el-button-->
  48. <!-- type="primary"-->
  49. <!-- plain-->
  50. <!-- icon="el-icon-plus"-->
  51. <!-- size="mini"-->
  52. <!-- @click="handleAdd"-->
  53. <!-- v-hasPermi="['system:user:add']"-->
  54. <!-- >新增</el-button>-->
  55. <!-- </el-col>-->
  56. <!-- <el-col :span="1.5">
  57. <el-button
  58. type="danger"
  59. plain
  60. icon="el-icon-delete"
  61. size="mini"
  62. @click="handleClean"
  63. v-hasPermi="['monitor:operlog:remove']"
  64. >清空</el-button>
  65. </el-col> -->
  66. <!-- <el-col :span="1.5">
  67. <el-button
  68. type="warning"
  69. plain
  70. icon="el-icon-download"
  71. size="mini"
  72. @click="handleExport"
  73. v-hasPermi="['monitor:operlog:export']"
  74. >导出</el-button>
  75. </el-col> -->
  76. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  77. </el-row>
  78. <el-table ref="tables" v-loading="loading" :data="dataList" border>
  79. <el-table-column label="协议类型" align="center" prop="type">
  80. <template slot-scope="scope">
  81. <dict-tag :options="dict.type.agreement_type" :value="scope.row.type"/>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="协议内容" align="center" prop="content" width="160">
  85. <template slot-scope="scope">
  86. <el-button type="text" @click="seeCenter(scope.row, 'html')">查看</el-button>
  87. </template>
  88. </el-table-column>
  89. <el-table-column label="添加时间" align="center" prop="createTime" width="160" >
  90. <template slot-scope="scope">
  91. <span>{{ parseTime(scope.row.createTime) }}</span>
  92. </template>
  93. </el-table-column>
  94. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  95. <template slot-scope="scope">
  96. <el-button
  97. size="mini"
  98. type="text"
  99. icon="el-icon-edit"
  100. @click="handleUpdate(scope.row)"
  101. v-hasPermi="['system:user:edit']"
  102. >修改</el-button>
  103. <!-- <el-button
  104. size="mini"
  105. type="text"
  106. icon="el-icon-view"
  107. @click="handleView(scope.row,scope.index)"
  108. v-hasPermi="['monitor:operlog:query']"
  109. >详细</el-button> -->
  110. </template>
  111. </el-table-column>
  112. </el-table>
  113. <pagination
  114. v-show="total>0"
  115. :total="total"
  116. :page.sync="queryParams.pageNum"
  117. :limit.sync="queryParams.pageSize"
  118. @pagination="getList"
  119. />
  120. <!-- 新增/编辑弹框 -->
  121. <add-and-edit
  122. ref="addAndEdit"
  123. :dict="dict"
  124. @getList="getList"
  125. />
  126. <el-dialog
  127. title="查看"
  128. :visible.sync="visibleStatus"
  129. width="600px"
  130. :destroy-on-close="true"
  131. :close-on-click-modal="false"
  132. >
  133. <div v-if="visibleType == 'img'">
  134. <el-image
  135. style="width: 400px; height: 100%"
  136. :src="newObj.sliderImg"
  137. fit="cover"
  138. />
  139. </div>
  140. <div v-if="visibleType == 'html'">
  141. <div v-html="newObj.content"></div>
  142. </div>
  143. <div slot="footer" class="dialog-footer">
  144. <el-button type="primary" @click="visibleStatus = false">确 定</el-button>
  145. </div>
  146. </el-dialog>
  147. </div>
  148. </template>
  149. <script>
  150. import { pageList, saveAndEdit, selectById,deleteById } from "@/api/agreement/agreement";
  151. import addAndEdit from "./dialog/addAndEdit.vue";
  152. export default {
  153. name: "agreement",
  154. dicts: ['agreement_type'],
  155. components: { addAndEdit },
  156. data() {
  157. return {
  158. // 遮罩层
  159. loading: true,
  160. // 选中数组
  161. ids: [],
  162. // 非单个禁用
  163. single: true,
  164. // 非多个禁用
  165. multiple: true,
  166. // 显示搜索条件
  167. showSearch: true,
  168. // 总条数
  169. total: 0,
  170. // 用户表格数据
  171. dataList: null,
  172. // 弹出层标题
  173. title: "",
  174. // 是否显示弹出层
  175. open: false,
  176. // 日期范围
  177. dateRange: [],
  178. // 查询参数
  179. queryParams: {
  180. pageNum: 1,
  181. pageSize: 10,
  182. type: undefined
  183. },
  184. visibleStatus: false,
  185. newObj: {},
  186. visibleType: ''
  187. };
  188. },
  189. created() {
  190. this.getList();
  191. },
  192. methods: {
  193. /** 查询用户列表 */
  194. getList() {
  195. this.loading = true;
  196. pageList(this.addDateRange(this.queryParams, this.dateRange))
  197. .then(response => {
  198. this.dataList = response.data.rows;
  199. this.total = response.data.total;
  200. this.loading = false;
  201. }
  202. );
  203. },
  204. // 取消按钮
  205. cancel() {
  206. this.open = false;
  207. },
  208. /** 搜索按钮操作 */
  209. handleQuery() {
  210. this.queryParams.pageNum = 1;
  211. this.getList();
  212. },
  213. /** 重置按钮操作 */
  214. resetQuery() {
  215. this.dateRange = [];
  216. this.resetForm("queryForm");
  217. this.handleQuery();
  218. },
  219. // 多选框选中数据
  220. handleSelectionChange(selection) {
  221. this.ids = selection.map(item => item.userId);
  222. this.single = selection.length != 1;
  223. this.multiple = !selection.length;
  224. },
  225. /** 新增按钮操作 */
  226. handleAdd() {
  227. this.$refs["addAndEdit"].openDialog("新增数据", null);
  228. },
  229. /** 修改按钮操作 */
  230. handleUpdate(row) {
  231. this.$refs["addAndEdit"].openDialog("修改数据", row);
  232. },
  233. /** 查看按钮操作 */
  234. seeCenter(obj, type) {
  235. this.visibleStatus = true
  236. this.visibleType = type;
  237. this.newObj = obj;
  238. },
  239. /** 删除按钮操作 */
  240. handleDelete(row) {
  241. const dataIds = row.id || this.ids;
  242. this.$modal.confirm('是否确认删除数据编号为"' + dataIds + '"的数据项?').then(function() {
  243. return deleteById(userIds);
  244. }).then(() => {
  245. this.getList();
  246. this.$modal.msgSuccess("删除成功");
  247. }).catch(() => {});
  248. }
  249. }
  250. };
  251. </script>