rsvrDataCache.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <!--
  2. * @Title:
  3. * @Description:
  4. * @Author: 893699165@qq.com
  5. * @Date: 2022-08-24 10:49:21
  6. * @LastEditors:
  7. * @LastEditTime: 2022-08-24 10:49:21
  8. -->
  9. <template>
  10. <div>
  11. <el-row>
  12. <el-col :span="5">
  13. <div class="box">
  14. <el-scrollbar>
  15. <basic-container>
  16. <avue-tree :option="treeOption" :data="projectTreeData" @node-click="nodeClick">
  17. <span class="el-tree-node__label" slot-scope="{ node, data }">
  18. <span>
  19. <i class="el-icon-user-solid"></i>
  20. {{ (node || {}).label }}
  21. </span>
  22. </span>
  23. <template slot-scope="scope" slot="menu">
  24. <div class="avue-tree__item" @click.native="tip(scope.node,scope.data)">自定义按钮</div>
  25. </template>
  26. </avue-tree>
  27. </basic-container>
  28. </el-scrollbar>
  29. </div>
  30. </el-col>
  31. <el-col :span="19">
  32. <basic-container>
  33. <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page"
  34. :before-open="beforeOpen" ref="crud" v-model="form" :permission="permissionList"
  35. @row-del="rowDel" @row-update="rowUpdate" @row-save="rowSave" @search-change="searchChange"
  36. @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
  37. @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"
  38. @select-change="selectChange">
  39. </avue-crud>
  40. </basic-container>
  41. </el-col>
  42. </el-row>
  43. </div>
  44. </template>
  45. <script>
  46. import { getPage, } from "@/api/data/dataRsvr.js";
  47. import { getTree } from "@/api/business/manage/manage.js";
  48. export default {
  49. components: {
  50. },
  51. data() {
  52. return {
  53. id: "",
  54. editForm: {},
  55. editDialog: false,
  56. form: {},
  57. selectionList: [],
  58. query: {},
  59. loading: true,
  60. page: {
  61. pageSize: 10,
  62. currentPage: 1,
  63. total: 0,
  64. },
  65. treeCache: {
  66. orgId: '',
  67. projectId: '',
  68. },
  69. projectTreeData: [
  70. ],
  71. treeOption: {
  72. nodeKey: "id",
  73. lazy: false,
  74. defaultExpandAll: true,
  75. addBtn: false,
  76. menu: false,
  77. size: "small",
  78. props: {
  79. labelText: "标题",
  80. label: "title",
  81. value: "value",
  82. children: "children",
  83. },
  84. },
  85. option: {
  86. labelWidth: 120,
  87. viewLabelWidth: 100,
  88. searchlabelWidth: 100,
  89. height: "auto",
  90. //height: 600,
  91. calcHeight: 30,
  92. align: "center",
  93. headerAlign: "center",
  94. lazy: false,
  95. tip: false,
  96. simplePage: true,
  97. searchShow: true,
  98. searchMenuSpan: 6,
  99. tree: true,
  100. border: true,
  101. index: true,
  102. selection: true,
  103. viewBtn: false,
  104. viewTitle: "测站信息",
  105. editBtn: false,
  106. delBtn: false,
  107. addBtn: false,
  108. menu: false,
  109. dialogType: "drawer",
  110. dialogClickModal: false,
  111. column: [
  112. {
  113. label: "站点名称",
  114. prop: "rtuName",
  115. search: true,
  116. span: 12,
  117. },
  118. {
  119. label: "站点编码",
  120. prop: "rtuCode",
  121. span: 12,
  122. },
  123. {
  124. label: "库上水位",
  125. prop: "rz",
  126. span: 8,
  127. },
  128. {
  129. label: "上报时间",
  130. prop: "tm",
  131. span: 8,
  132. },
  133. ],
  134. },
  135. data: [],
  136. };
  137. },
  138. computed: {
  139. // ...mapGetters(["userInfo", "permission"]),
  140. permissionList() {
  141. return {
  142. // addBtn: this.vaildData(this.permission.docCategory_add, false),
  143. // viewBtn: this.vaildData(this.permission.docCategory_view, false),
  144. // delBtn: this.vaildData(this.permission.docCategory_delete, false),
  145. // editBtn: this.vaildData(this.permission.docCategory_edit, false),
  146. };
  147. },
  148. ids() {
  149. let ids = [];
  150. this.selectionList.forEach((ele) => {
  151. ids.push(ele.id);
  152. });
  153. return ids.join(",");
  154. },
  155. },
  156. mounted() { },
  157. created() {
  158. this.initTree();
  159. },
  160. methods: {
  161. initTree() {
  162. getTree(
  163. ).then((res) => {
  164. const data = res.data.data;
  165. this.projectTreeData = data;
  166. });
  167. },
  168. nodeClick(data) {
  169. this.treeCache.orgId = data.orgId;
  170. this.treeCache.projectId = data.projectId;
  171. //this.$message.success(JSON.stringify(data))
  172. this.query = {};
  173. this.page.currentPage = 1;
  174. this.onLoad(this.page);
  175. },
  176. searchReset() {
  177. this.query = {};
  178. this.onLoad(this.page);
  179. },
  180. searchChange(params, done) {
  181. this.query = params;
  182. this.page.currentPage = 1;
  183. this.onLoad(this.page, params);
  184. done();
  185. },
  186. selectionChange(list) {
  187. this.$message.success("ssssssssssssssssssssssssss")
  188. this.selectionList = list;
  189. },
  190. selectChange(item) {
  191. this.$message.success("sssssssssssssssss" + item)
  192. },
  193. selectionClear() {
  194. this.selectionList = [];
  195. this.$refs.crud.toggleSelection();
  196. },
  197. currentChange(currentPage) {
  198. this.page.currentPage = currentPage;
  199. },
  200. sizeChange(pageSize) {
  201. this.page.pageSize = pageSize;
  202. },
  203. refreshChange() {
  204. this.onLoad(this.page, this.query);
  205. },
  206. onLoad(page, params = {}) {
  207. this.loading = true;
  208. params['orgId'] = this.treeCache.orgId;
  209. params['projectId'] = this.treeCache.projectId;
  210. getPage(
  211. page.currentPage,
  212. page.pageSize,
  213. Object.assign(params, this.query)
  214. ).then((res) => {
  215. const data = res.data.data;
  216. this.page.total = data.total;
  217. this.data = data.records;
  218. this.loading = false;
  219. this.selectionClear();
  220. });
  221. },
  222. },
  223. };
  224. </script>