index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <template>
  2. <div class="app-container">
  3. <div class="filter-container">
  4. <div class="filter-left">
  5. <div class="filter-item">
  6. 实际班组:
  7. <el-input
  8. v-model="query.eTeamName"
  9. placeholder="请输入实际班组"
  10. style="width: 150px"
  11. clearable
  12. ></el-input>
  13. </div>
  14. <div class="filter-item">
  15. 实际巡更人:
  16. <el-input
  17. v-model="query.UserName"
  18. placeholder="请输入实际巡更人"
  19. style="width: 150px"
  20. clearable
  21. ></el-input>
  22. </div>
  23. <div class="filter-item">
  24. 线路名称:
  25. <el-input
  26. v-model="query.eLName"
  27. placeholder="请输入线路名称"
  28. style="width: 150px"
  29. clearable
  30. ></el-input>
  31. </div>
  32. <el-button
  33. type="primary"
  34. icon="el-icon-search"
  35. size="mini"
  36. @click="getData('query')"
  37. >搜索</el-button
  38. >
  39. <el-button type="primary" icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  40. </div>
  41. </div>
  42. <!-- <el-divider></el-divider> -->
  43. <el-table
  44. v-loading="loading"
  45. :data="tableData"
  46. stripe
  47. style="width: 100%; margin-bottom: 5rem;margin-top:10px"
  48. id="out-table"
  49. @selection-change="handleSelectionChange"
  50. :max-height="tableHeight"
  51. >
  52. <el-table-column prop="eBindDevice" label="巡更设备" show-overflow-tooltip></el-table-column>
  53. <el-table-column prop="eBindTeam" label="绑定班组" show-overflow-tooltip></el-table-column>
  54. <el-table-column prop="eBindUser" label="计划巡更人" width="100" show-overflow-tooltip></el-table-column>
  55. <el-table-column prop="eCreateTime" label="实际实施创建时间" width="130" show-overflow-tooltip></el-table-column>
  56. <el-table-column prop="eDeviceName" label="实际巡检设备" width="120" show-overflow-tooltip></el-table-column>
  57. <el-table-column prop="eDFlag" label="是否报警" show-overflow-tooltip></el-table-column>
  58. <el-table-column prop="eEndTime" label="结束时间" show-overflow-tooltip></el-table-column>
  59. <el-table-column prop="eErrorTime" label="误差时间" show-overflow-tooltip></el-table-column>
  60. <el-table-column prop="eLineOrder" label="线路顺序" show-overflow-tooltip></el-table-column>
  61. <el-table-column prop="eLName" label="线路名称" show-overflow-tooltip></el-table-column>
  62. <el-table-column prop="ePatrolTime" label="巡更时间" show-overflow-tooltip></el-table-column>
  63. <el-table-column prop="ePlaceName" label="巡更地点" show-overflow-tooltip></el-table-column>
  64. <el-table-column prop="ePlanMode" label="计划模式" show-overflow-tooltip>
  65. <template slot-scope="scope">
  66. {{scope.row.ePlanMode == "0" ? "常规" : scope.row.ePlanMode == "1" ? "班组" : scope.row.ePlanMode == "2" ? "星期" : scope.row.ePlanMode == "3" ? "周期" : ""}}
  67. </template>
  68. </el-table-column>
  69. <el-table-column prop="ePlanState" label="巡更状态" show-overflow-tooltip></el-table-column>
  70. <el-table-column prop="ePlanType" label="计划类型" show-overflow-tooltip></el-table-column>
  71. <el-table-column prop="eStartTime" label="开始时间" show-overflow-tooltip></el-table-column>
  72. <el-table-column prop="eStayTime" label="停留时间" show-overflow-tooltip></el-table-column>
  73. <el-table-column prop="eTeamName" label="实际班组" show-overflow-tooltip></el-table-column>
  74. <el-table-column prop="eUserName" label="实际巡更人" width="100" show-overflow-tooltip></el-table-column>
  75. </el-table>
  76. <el-pagination
  77. background
  78. @current-change="handleCurrentChange"
  79. :page-sizes="[10, 15, 20, 30]"
  80. @size-change="handleSizeChange"
  81. :current-page="pageNo"
  82. :page-size="pageSize"
  83. layout="sizes,prev, pager, next"
  84. :total="totalCount"
  85. >
  86. </el-pagination>
  87. </div>
  88. </template>
  89. <script>
  90. //引入api文件
  91. import api from "@/api/patrol/elect-partol";
  92. export default {
  93. //组件注册
  94. components: {},
  95. name: "elect-partol",
  96. data() {
  97. return {
  98. loading:true,
  99. //初始化列表
  100. cols: [],
  101. //列表数据
  102. tableData: [],
  103. //列表总数
  104. totalCount: 0,
  105. //列表每页条目数
  106. pageSize: 15,
  107. //开始页
  108. pageNo: 1,
  109. //input实际巡更人
  110. eBindUser_value: "",
  111. //input线路名称
  112. eLName_value: "",
  113. //input计划完成状态
  114. ePlanState_value: "",
  115. query:{
  116. eTeamName:undefined,
  117. UserName: undefined,
  118. eLName: undefined,
  119. pageNo: 1,
  120. pageSize: 15,
  121. },
  122. form:{
  123. //列表每页条目数
  124. pageSize: 15,
  125. //开始页
  126. pageNo: 1,
  127. },
  128. //表格自适应高度
  129. tableHeight:undefined,
  130. };
  131. },
  132. mounted(){
  133. // table高度
  134. if(window.innerWidth <1920){
  135. this.tableHeight = window.innerHeight - 300
  136. }else{
  137. this.tableHeight = window.innerHeight - 295
  138. }
  139. // 监听窗口大小变化
  140. let self = this;
  141. window.onresize = function() {
  142. self.tableHeight = window.innerHeight - 300
  143. }
  144. this.getData();
  145. },
  146. created() {
  147. this.getData();
  148. },
  149. methods: {
  150. /** 重置按钮操作 */
  151. resetQuery() {
  152. this.query = {
  153. eTeamName:undefined,
  154. UserName: undefined,
  155. eLName: undefined,
  156. pageNo: 1,
  157. pageSize: 15,
  158. },
  159. this.handleQuery();
  160. },
  161. /** 搜索按钮操作 */
  162. handleQuery() {
  163. this.getData();
  164. },
  165. //列表查询
  166. getData(data) {
  167. if(data){
  168. api.queryPatrollingPlanStatus(this.query).then((Response) => {
  169. this.tableData = Response.data.pageList;
  170. this.totalCount = Response.data.totalCount;
  171. this.loading = false
  172. if(this.tableData.length<1){
  173. setTimeout(() =>{
  174. document.getElementsByClassName("el-table__empty-text")[0].innerHTML = "您查询的巡更计划不存在"
  175. },10)
  176. }
  177. });
  178. }else{
  179. api.queryPatrollingPlanStatus(this.form).then((Response) => {
  180. this.tableData = Response.data.pageList;
  181. this.totalCount = Response.data.totalCount;
  182. this.loading = false
  183. if(this.tableData.length<1){
  184. setTimeout(() =>{
  185. document.getElementsByClassName("el-table__empty-text")[0].innerHTML = "您查询的巡更计划不存在"
  186. },10)
  187. }
  188. });
  189. }
  190. },
  191. //改变起始页
  192. handleCurrentChange(val) {
  193. this.pageNo = val;
  194. this.query.pageNo = this.pageNo
  195. this.getData('query');
  196. },
  197. //改变每条数
  198. handleSizeChange(val) {
  199. this.pageSize = val;
  200. this.query.pageSize = this.pageSize
  201. this.getData('query');
  202. },
  203. //修改
  204. handleEdit(index, row) {},
  205. //删除
  206. handleDelete(id) {
  207. this.$confirm("确定删除该数据吗?", "删除", {
  208. confirmButtonText: "确定",
  209. cancelButtonText: "取消",
  210. type: "warning",
  211. })
  212. .then(() => {
  213. // 发送删除请求
  214. api.deleteById({ queryJson: id }).then((response) => {
  215. // 处理响应结果提示
  216. this.$message({
  217. type: response.success ? "success" : "error",
  218. message: response.Msg,
  219. });
  220. });
  221. // 刷新列表数据
  222. this.select();
  223. })
  224. .catch(() => {
  225. // 不用理会
  226. });
  227. },
  228. //全部删除
  229. batchDelete() {
  230. let multData = this.multipleSelection;
  231. let tableData = this.list;
  232. let multDataLen = multData.length;
  233. let tableDataLen = tableData.length;
  234. for (let i = 0; i < multDataLen; i++) {
  235. for (let y = 0; y < tableDataLen; y++) {
  236. if (JSON.stringify(tableData[y]) == JSON.stringify(multData[i])) {
  237. //判断是否相等,相等就删除
  238. this.list.splice(y, 1);
  239. }
  240. }
  241. }
  242. },
  243. handleSelectionChange(val) {
  244. this.multipleSelection = val;
  245. },
  246. //导出功能
  247. handleDownload() {
  248. this.downloadLoading = true;
  249. import("@/vendor/Export2Excel").then((excel) => {
  250. const tHeader = [
  251. "巡更计划名称",
  252. "设备名称",
  253. "执行开始日期",
  254. "执行结束日期",
  255. "巡更开始时间",
  256. "巡更结束时间",
  257. "巡更周期",
  258. "添加时间",
  259. ];
  260. const filterVal = [
  261. "deviceName",
  262. "patrolPlanName",
  263. "startDate",
  264. "endDate",
  265. "startTime",
  266. "endTime",
  267. "patrolPlanCycle",
  268. "creationTime",
  269. ];
  270. const data = this.formatJson(filterVal);
  271. excel.export_json_to_excel({
  272. header: tHeader,
  273. data,
  274. filename: "table-list",
  275. });
  276. this.downloadLoading = false;
  277. });
  278. },
  279. formatJson(filterVal) {
  280. return this.list.map((v) =>
  281. filterVal.map((j) => {
  282. if (j === "timestamp") {
  283. return parseTime(v[j]);
  284. } else {
  285. return v[j];
  286. }
  287. })
  288. );
  289. },
  290. },
  291. };
  292. </script>
  293. <style scoped>
  294. .table-tit {
  295. background: rgb(235, 241, 255);
  296. border: 1px solid #d9d9d9;
  297. border-bottom: 0;
  298. font-weight: bold;
  299. padding: 8px 10px;
  300. }
  301. .el-checkbox {
  302. margin-right: 15px;
  303. line-height: 0;
  304. }
  305. .el-dialog {
  306. min-width: 736px !important;
  307. }
  308. </style>
  309. <style >
  310. </style>