groundDataCache.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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/dataGround.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: "vtavslm",
  126. span: 8,
  127. },
  128. {
  129. label: "表层含水量",
  130. prop: "srlslm",
  131. span: 8,
  132. },
  133. {
  134. label: "10CM深度含水量",
  135. prop: "slm10",
  136. span: 8,
  137. },
  138. {
  139. label: "20CM深度含水量",
  140. prop: "slm20",
  141. span: 8,
  142. },
  143. {
  144. label: "30CM深度含水量",
  145. prop: "slm30",
  146. span: 8,
  147. },
  148. {
  149. label: "40CM深度含水量",
  150. prop: "slm40",
  151. span: 8,
  152. },
  153. {
  154. label: "60CM深度含水量",
  155. prop: "slm60",
  156. span: 8,
  157. },
  158. {
  159. label: "80CM深度含水量",
  160. prop: "slm80",
  161. span: 8,
  162. },
  163. {
  164. label: "100CM深度含水量",
  165. prop: "slm100",
  166. span: 8,
  167. },
  168. ],
  169. },
  170. data: [],
  171. };
  172. },
  173. computed: {
  174. // ...mapGetters(["userInfo", "permission"]),
  175. permissionList() {
  176. return {
  177. // addBtn: this.vaildData(this.permission.docCategory_add, false),
  178. // viewBtn: this.vaildData(this.permission.docCategory_view, false),
  179. // delBtn: this.vaildData(this.permission.docCategory_delete, false),
  180. // editBtn: this.vaildData(this.permission.docCategory_edit, false),
  181. };
  182. },
  183. ids() {
  184. let ids = [];
  185. this.selectionList.forEach((ele) => {
  186. ids.push(ele.id);
  187. });
  188. return ids.join(",");
  189. },
  190. },
  191. mounted() { },
  192. created() {
  193. this.initTree();
  194. },
  195. methods: {
  196. initTree() {
  197. getTree(
  198. ).then((res) => {
  199. const data = res.data.data;
  200. this.projectTreeData = data;
  201. });
  202. },
  203. nodeClick(data) {
  204. this.treeCache.orgId = data.orgId;
  205. this.treeCache.projectId = data.projectId;
  206. //this.$message.success(JSON.stringify(data))
  207. this.query = {};
  208. this.page.currentPage = 1;
  209. this.onLoad(this.page);
  210. },
  211. searchReset() {
  212. this.query = {};
  213. this.onLoad(this.page);
  214. },
  215. searchChange(params, done) {
  216. this.query = params;
  217. this.page.currentPage = 1;
  218. this.onLoad(this.page, params);
  219. done();
  220. },
  221. selectionChange(list) {
  222. this.$message.success("ssssssssssssssssssssssssss")
  223. this.selectionList = list;
  224. },
  225. selectChange(item) {
  226. this.$message.success("sssssssssssssssss" + item)
  227. },
  228. selectionClear() {
  229. this.selectionList = [];
  230. this.$refs.crud.toggleSelection();
  231. },
  232. currentChange(currentPage) {
  233. this.page.currentPage = currentPage;
  234. },
  235. sizeChange(pageSize) {
  236. this.page.pageSize = pageSize;
  237. },
  238. refreshChange() {
  239. this.onLoad(this.page, this.query);
  240. },
  241. onLoad(page, params = {}) {
  242. this.loading = true;
  243. params['orgId'] = this.treeCache.orgId;
  244. params['projectId'] = this.treeCache.projectId;
  245. getPage(
  246. page.currentPage,
  247. page.pageSize,
  248. Object.assign(params, this.query)
  249. ).then((res) => {
  250. const data = res.data.data;
  251. this.page.total = data.total;
  252. this.data = data.records;
  253. this.loading = false;
  254. this.selectionClear();
  255. });
  256. },
  257. },
  258. };
  259. </script>