dataStandard.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <template>
  2. <div>
  3. <!-- 面包屑导航 -->
  4. <!-- <el-breadcrumb
  5. separator-class="el-icon-arrow-right"
  6. v-if="this.$router.currentRoute.path != '/home'"
  7. >
  8. <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
  9. <el-breadcrumb-item>矿压监测系统</el-breadcrumb-item>
  10. <el-breadcrumb-item>数据标准</el-breadcrumb-item>
  11. </el-breadcrumb> -->
  12. <!-- <over-view-of-system
  13. :table-data="tableData"
  14. :total="total"
  15. v-if="overViewFlag"
  16. ></over-view-of-system> -->
  17. <!-- 页面主体区域 -->
  18. <!--
  19. <span class="demonstration" style="font-size: 10px">搜索:</span>
  20. <el-cascader
  21. :options="options"
  22. separator=" | "
  23. style="width: 400px"
  24. :props="props"
  25. placeholder="请选择系统"
  26. clearable
  27. ref="cascade"
  28. @change="handleChange()"
  29. ></el-cascader> -->
  30. <!-- <el-button @click="searchDataByPid()" style="margin: 20px 10px" type="primary" size="medium">查询</el-button>-->
  31. <el-table
  32. class="tableStyle"
  33. :data="tableData"
  34. style="min-width: 100%"
  35. border
  36. v-loading="dataListLoading"
  37. >
  38. <el-table-column
  39. prop="id"
  40. label="子系统id"
  41. header-align="center"
  42. align="center"
  43. min-width="5%"
  44. >
  45. </el-table-column>
  46. <el-table-column
  47. prop="name"
  48. label="子系统"
  49. header-align="center"
  50. align="center"
  51. min-width="10%"
  52. >
  53. </el-table-column>
  54. <el-table-column
  55. prop="equipmentCount"
  56. label="设备个数"
  57. header-align="center"
  58. align="center"
  59. min-width="10%"
  60. >
  61. </el-table-column>
  62. <!-- <el-table-column prop="measurePointNum" label="测点个数" header-align="center" align="center" width="180">-->
  63. <!-- </el-table-column>-->
  64. <el-table-column
  65. prop="createDate"
  66. label="创建时间"
  67. header-align="center"
  68. align="center"
  69. min-width="10%"
  70. >
  71. </el-table-column>
  72. <el-table-column
  73. label="操作"
  74. header-align="center"
  75. align="center"
  76. width="180"
  77. >
  78. <template slot-scope="scope">
  79. <el-button
  80. type="text"
  81. size="small"
  82. @click="handleCheck(scope.row)"
  83. :disabled="scope.row.equipmentCount == 0 ? true : false"
  84. >查看
  85. </el-button>
  86. <!-- 这里要改,当子系统个数为0时,查看按钮不可用 -->
  87. </template>
  88. </el-table-column>
  89. <el-table-column
  90. prop="remark"
  91. label="备注"
  92. header-align="center"
  93. align="center"
  94. min-width="20%"
  95. >
  96. </el-table-column>
  97. </el-table>
  98. <div style="display: flex; justify-content: flex-end">
  99. <el-pagination
  100. background
  101. @current-change="currentChange"
  102. @size-change="sizeChange"
  103. :current-page="page"
  104. :page-size="size"
  105. layout="sizes, prev, pager, next, jumper, ->, total, slot"
  106. :total="total"
  107. >
  108. </el-pagination>
  109. </div>
  110. <!-- <checkDataquality v-if="checkVisible" ref="checkquality"></checkDataquality> -->
  111. </div>
  112. </template>
  113. <script>
  114. import OverViewOfSystem from "@/common/dataStandard/overViewOfSystem";
  115. export default {
  116. props: ["dataQualitySystemId"],
  117. components: { OverViewOfSystem },
  118. subSystem: "dataQualitySubsystem",
  119. data() {
  120. let that = this;
  121. return {
  122. options: [],
  123. value: [],
  124. tableData: [],
  125. props: {
  126. //级联选择器懒加载
  127. lazy: true,
  128. lazyLoad(node, resolve) {
  129. console.log({ level });
  130. const { level } = node;
  131. if (level == 0) {
  132. that.getAllCoal((list1) => {
  133. console.log(list1);
  134. let arr = list1.map((e) => ({ value: e.id, label: e.coal }));
  135. resolve(arr); // 通过调用resolve将子节点数据返回,通知组件数据加载完成
  136. });
  137. }
  138. if (level == 1) {
  139. // value为煤矿id
  140. let { value } = node;
  141. that.getSystem(value, (list2) => {
  142. if (list2[0] == null) {
  143. let arr = list2.map((e) => ({
  144. value: 0,
  145. label: 0,
  146. leaf: true,
  147. }));
  148. resolve(arr);
  149. } else {
  150. let arr = list2.map((e) => ({
  151. value: e.id,
  152. label: e.name,
  153. leaf: true,
  154. }));
  155. resolve(arr);
  156. }
  157. });
  158. }
  159. },
  160. },
  161. page: 1, //当前第几页
  162. size: 10, //当前每页个数
  163. total: 100, //全部数据行数
  164. checkVisible: false,
  165. currentSystemId: "",
  166. currentSystem: "",
  167. currentCoal: "",
  168. dataListLoading: false,
  169. currOperator: "",
  170. currOperatorName: "",
  171. overViewFlag: false,
  172. };
  173. },
  174. mounted() {
  175. //获取session中的user的id和name
  176. this.currOperator = JSON.parse(
  177. window.sessionStorage.getItem("user")
  178. ).userId;
  179. this.currOperatorName = JSON.parse(
  180. window.sessionStorage.getItem("user")
  181. ).username;
  182. console.log(this.dataQualitySystemId);
  183. this.handleJump();
  184. },
  185. methods: {
  186. // 监听 pagesize 改变的事件
  187. currentChange(currentPage) {
  188. this.page = currentPage;
  189. if (this.dataQualitySystemId) {
  190. if (this.$refs["cascade"].checkedValue === null) {
  191. this.handleJump();
  192. } else {
  193. this.handleChange();
  194. }
  195. } else {
  196. this.handleChange();
  197. }
  198. },
  199. // 当每页展示数改变时
  200. sizeChange(currentSize) {
  201. this.size = currentSize;
  202. if (this.dataQualitySystemId) {
  203. if (this.$refs["cascade"].checkedValue === null) {
  204. this.handleJump();
  205. } else {
  206. this.handleChange();
  207. }
  208. } else {
  209. this.handleChange();
  210. }
  211. },
  212. handleCheck(row) {
  213. // window.sessionStorage.setItem("dataQualitySubsystemId",subsystem.id); //存到sessionStorage中,下一个页面获取
  214. this.$router.push({
  215. path: "/dataQualityDevice",
  216. query: {
  217. dataQualitySubsystemId: row.id,
  218. },
  219. });
  220. },
  221. initData() {
  222. this.dataListLoading = true;
  223. this.getRequest(
  224. "/subSystemManage/getSubSystemInfoByPage/?page=" +
  225. this.page +
  226. "&size=" +
  227. this.size +
  228. "&userId=" +
  229. this.currOperator
  230. ).then((resp) => {
  231. if (resp.data) {
  232. this.tableData = resp.data.data;
  233. this.total = resp.data.total;
  234. this.overViewFlag = true;
  235. }
  236. this.dataListLoading = false;
  237. });
  238. // this.currentSystemId = parseInt(this.currentSystemId);
  239. // this.getRequest(`/dataQualitySubsystem/getSubsystemBySystemId/?systemId=${this.currentSystemId}&page=${this.page}&size=${this.size}`).then( resp =>{
  240. // if (resp.data){
  241. // console.log("resp.data",resp.data)
  242. // this.tableData= resp.data;
  243. // this.total = resp.data.size;
  244. // }
  245. // })
  246. },
  247. //根据系统id去查找
  248. handleJump() {
  249. this.dataListLoading = true;
  250. this.getRequest(
  251. "/subSystemManage/getSubSystemInfoBySystemId?systemId=" +
  252. this.dataQualitySystemId +
  253. "&page=" +
  254. this.page +
  255. "&size=" +
  256. this.size
  257. ).then((resp) => {
  258. if (resp.data) {
  259. this.tableData = resp.data.data;
  260. this.total = resp.data.total;
  261. this.overViewFlag = true;
  262. }
  263. });
  264. this.dataListLoading = false;
  265. },
  266. handleChange() {
  267. // 如果级联选框为空,则根据页数查找
  268. if (
  269. this.$refs["cascade"].checkedValue === null ||
  270. this.$refs["cascade"].checkedValue.length == 0
  271. ) {
  272. this.dataListLoading = true;
  273. this.getRequest(
  274. "/subSystemManage/getSubSystemInfoByPage/?page=" +
  275. this.page +
  276. "&size=" +
  277. this.size +
  278. "&userId=" +
  279. this.currOperator
  280. ).then((resp) => {
  281. if (resp.data) {
  282. this.tableData = resp.data.data;
  283. this.total = resp.data.total;
  284. this.overViewFlag = true;
  285. }
  286. this.dataListLoading = false;
  287. });
  288. } else {
  289. // 否则根据系统id查找
  290. this.dataListLoading = true;
  291. this.getRequest(
  292. "/subSystemManage/getSubSystemInfoBySystemId?systemId=" +
  293. this.$refs["cascade"].getCheckedNodes()[0].value +
  294. "&page=" +
  295. this.page +
  296. "&size=" +
  297. this.size
  298. ).then((resp) => {
  299. if (resp.data) {
  300. this.tableData = resp.data.data;
  301. this.total = resp.data.total;
  302. this.overViewFlag = true;
  303. }
  304. });
  305. this.dataListLoading = false;
  306. }
  307. },
  308. // searchDataByPid() {
  309. // this.currentSystemId = this.$refs["cascade"].getCheckedNodes()[0].value
  310. // this.getRequest('/dataQualitySubsystem/getSubsystemBySystemId/?systemId=' + this.currentSystemId +
  311. // '&page='+ this.page + '&size='+this.size).then( resp =>{
  312. // if (resp.data){
  313. // this.tableData= resp.data;
  314. // this.total = resp.data.size;
  315. // }
  316. // })
  317. // },
  318. async getAllCoal(getAllCoalcallback) {
  319. this.getRequest("/dataList/getAllCoal/").then((resp) => {
  320. if (resp.data) {
  321. callback(resp.data);
  322. }
  323. });
  324. },
  325. async getSystem(coalId, callback) {
  326. this.getRequest(
  327. "/coalManage/getSystemInfoByCoalId?coalId=" + coalId
  328. ).then((resp) => {
  329. if (resp.data) {
  330. callback(resp.data);
  331. }
  332. });
  333. },
  334. },
  335. };
  336. </script>
  337. <style scoped></style>