parknotice.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <template>
  2. <basic-container>
  3. <avue-crud :option="option"
  4. :table-loading="loading"
  5. :data="data"
  6. :page.sync="page"
  7. :permission="permissionList"
  8. :before-open="beforeOpen"
  9. v-model="form"
  10. ref="crud"
  11. @row-update="rowUpdate"
  12. @row-save="rowSave"
  13. @row-del="rowDel"
  14. @search-change="searchChange"
  15. @search-reset="searchReset"
  16. @selection-change="selectionChange"
  17. @current-change="currentChange"
  18. @size-change="sizeChange"
  19. @refresh-change="refreshChange"
  20. @on-load="onLoad">
  21. <template slot="menuLeft">
  22. <el-button type="danger"
  23. size="small"
  24. icon="el-icon-delete"
  25. plain
  26. v-if="permission.notice_delete"
  27. @click="handleDelete">删 除
  28. </el-button>
  29. </template>
  30. <template slot="menu" slot-scope="{row}">
  31. <el-button type="text"
  32. size="mini"
  33. icon="el-icon-delete"
  34. plain
  35. @click="showPushRecord(row)">发布
  36. </el-button>
  37. </template>
  38. </avue-crud>
  39. <el-dialog title = "住户信息审核" :visible.sync="pushRecordVisible" :modal-append-to-body="false" >
  40. <HouseuserCheck v-if="pushRecordVisible" ></HouseuserCheck>
  41. </el-dialog>
  42. <el-drawer :visible.sync="pushRecordVisible" size="85%" direction="rtl" :modal-append-to-body="false" destroy-on-close append-to-body center >
  43. <noticepushrecord ref="noticepushrecord" :notice-id="noticeId" ></noticepushrecord>
  44. </el-drawer>
  45. </basic-container>
  46. </template>
  47. <script>
  48. import {getList, getDetail, add, update, remove} from "@/api/estate/notice";
  49. import {mapGetters} from "vuex";
  50. import noticepushrecord from "@/views/estate/noticepushrecord";
  51. export default {
  52. components: {
  53. noticepushrecord
  54. },
  55. data() {
  56. return {
  57. form: {},
  58. query: {},
  59. loading: true,
  60. page: {
  61. pageSize: 10,
  62. currentPage: 1,
  63. total: 0
  64. },
  65. pushRecordVisible: false,
  66. noticeId: null,
  67. selectionList: [],
  68. option: {
  69. menuWidth: 300,
  70. height:'auto',
  71. calcHeight: 30,
  72. tip: false,
  73. searchShow: true,
  74. searchMenuSpan: 6,
  75. border: true,
  76. index: true,
  77. viewBtn: true,
  78. selection: true,
  79. dialogClickModal: false,
  80. column: [
  81. {
  82. label: "公告标题",
  83. prop: "title",
  84. rules: [{
  85. required: true,
  86. message: "请输入文章标题",
  87. trigger: "blur"
  88. }]
  89. },
  90. {
  91. label: "公告内容",
  92. prop: "notice",
  93. component: 'AvueUeditor',
  94. options: {
  95. action: '/api/blade-resource/oss/endpoint/put-file',
  96. props: {
  97. res: "data",
  98. url: "link",
  99. }
  100. },
  101. hide: true,
  102. minRows: 6,
  103. span: 24,
  104. },
  105. {
  106. label: "园区id",
  107. prop: "agencyId",
  108. display:false,
  109. hide: true,
  110. rules: [{
  111. required: true,
  112. message: "请输入园区id",
  113. trigger: "blur"
  114. }]
  115. },
  116. ]
  117. },
  118. data: []
  119. };
  120. },
  121. computed: {
  122. ...mapGetters(["permission"]),
  123. permissionList() {
  124. return {
  125. addBtn: this.vaildData(this.permission.notice_add, false),
  126. viewBtn: this.vaildData(this.permission.notice_view, false),
  127. delBtn: this.vaildData(this.permission.notice_delete, false),
  128. editBtn: this.vaildData(this.permission.notice_edit, false)
  129. };
  130. },
  131. ids() {
  132. let ids = [];
  133. this.selectionList.forEach(ele => {
  134. ids.push(ele.id);
  135. });
  136. return ids.join(",");
  137. }
  138. },
  139. methods: {
  140. showPushRecord(row){
  141. this.pushRecordVisible = true;
  142. this.noticeId = row.id;
  143. },
  144. rowSave(row, done, loading) {
  145. add(row).then(() => {
  146. this.onLoad(this.page);
  147. this.$message({
  148. type: "success",
  149. message: "操作成功!"
  150. });
  151. done();
  152. }, error => {
  153. loading();
  154. window.console.log(error);
  155. });
  156. },
  157. rowUpdate(row, index, done, loading) {
  158. update(row).then(() => {
  159. this.onLoad(this.page);
  160. this.$message({
  161. type: "success",
  162. message: "操作成功!"
  163. });
  164. done();
  165. }, error => {
  166. loading();
  167. console.log(error);
  168. });
  169. },
  170. rowDel(row) {
  171. this.$confirm("确定将选择数据删除?", {
  172. confirmButtonText: "确定",
  173. cancelButtonText: "取消",
  174. type: "warning"
  175. })
  176. .then(() => {
  177. return remove(row.id);
  178. })
  179. .then(() => {
  180. this.onLoad(this.page);
  181. this.$message({
  182. type: "success",
  183. message: "操作成功!"
  184. });
  185. });
  186. },
  187. handleDelete() {
  188. if (this.selectionList.length === 0) {
  189. this.$message.warning("请选择至少一条数据");
  190. return;
  191. }
  192. this.$confirm("确定将选择数据删除?", {
  193. confirmButtonText: "确定",
  194. cancelButtonText: "取消",
  195. type: "warning"
  196. })
  197. .then(() => {
  198. return remove(this.ids);
  199. })
  200. .then(() => {
  201. this.onLoad(this.page);
  202. this.$message({
  203. type: "success",
  204. message: "操作成功!"
  205. });
  206. this.$refs.crud.toggleSelection();
  207. });
  208. },
  209. beforeOpen(done, type) {
  210. if (["edit", "view"].includes(type)) {
  211. getDetail(this.form.id).then(res => {
  212. this.form = res.data.data;
  213. });
  214. }
  215. done();
  216. },
  217. searchReset() {
  218. this.query = {};
  219. this.onLoad(this.page);
  220. },
  221. searchChange(params, done) {
  222. this.query = params;
  223. this.page.currentPage = 1;
  224. this.onLoad(this.page, params);
  225. done();
  226. },
  227. selectionChange(list) {
  228. this.selectionList = list;
  229. },
  230. selectionClear() {
  231. this.selectionList = [];
  232. this.$refs.crud.toggleSelection();
  233. },
  234. currentChange(currentPage){
  235. this.page.currentPage = currentPage;
  236. },
  237. sizeChange(pageSize){
  238. this.page.pageSize = pageSize;
  239. },
  240. refreshChange() {
  241. this.onLoad(this.page, this.query);
  242. },
  243. onLoad(page, params = {}) {
  244. this.loading = true;
  245. getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
  246. const data = res.data.data;
  247. this.page.total = data.total;
  248. this.data = data.records;
  249. this.loading = false;
  250. this.selectionClear();
  251. });
  252. }
  253. }
  254. };
  255. </script>
  256. <style>
  257. </style>