routineMonitor.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. <template>
  2. <div style="width: 100%">
  3. <div slot="header" class="clearfix">
  4. <el-breadcrumb separator-class="el-icon-arrow-right">
  5. <el-breadcrumb-item >首页</el-breadcrumb-item>
  6. <el-breadcrumb-item>监测任务</el-breadcrumb-item>
  7. <el-breadcrumb-item>例行监测</el-breadcrumb-item>
  8. <el-breadcrumb-item>任务列表</el-breadcrumb-item>
  9. </el-breadcrumb>
  10. </div>
  11. <!-- 头部查询栏 -->
  12. <div class="headSearch">
  13. <el-row :gutter="50" style="margin-right: 0px;">
  14. <el-form :inline="true">
  15. <!-- <el-form style="display: flex; flex-direction: row;" > -->
  16. <el-form-item label="年度" class="select" size="mini">
  17. <el-date-picker v-model="queryInfo.year" style="width: 110px;" value-format="yyyy" type="year" clearable />
  18. </el-form-item>
  19. <el-form-item label="任务状态" class="select" size="mini">
  20. <el-select v-model="queryInfo.ispublic" style="width: 110px;" clearable>
  21. <el-option
  22. v-for="item in taskispublic"
  23. :key="item.value"
  24. :label="item.label"
  25. :value="item.value" >
  26. </el-option>
  27. </el-select>
  28. </el-form-item>
  29. <el-form-item label="任务时间" class="select" size="mini">
  30. <el-date-picker v-model="queryInfo.starttime" style="width: 180px;" align="right" type="date"
  31. :picker-options="pickerOptions" clearable value-format="yyyy-MM-dd" />
  32. </el-form-item>
  33. <el-form-item label="--" class="select" style="margin-left: 10px;" size="mini">
  34. <el-date-picker v-model="queryInfo.endtime" style="width: 180px;" align="right" type="date"
  35. :picker-options="pickerOptions" clearable />
  36. </el-form-item>
  37. <el-form-item label="任务名称" class="select" size="mini">
  38. <el-input v-model="queryInfo.task_name"></el-input>
  39. </el-form-item>
  40. <!-- 查询 -->
  41. <el-button size="mini" style="height: 40px;margin-left: 10px;" type="success" @click="searchData()">查询</el-button>
  42. <!-- 重置 -->
  43. <el-button size="mini" style="height: 40px;margin-left: 5px;" type="success" @click="reset()">重置</el-button>
  44. </el-form>
  45. </el-row>
  46. </div>
  47. <!--头部右侧按钮区域-->
  48. <div class="rightButton">
  49. <el-row :gutter="90" style="margin-right: 0px;">
  50. <div style="display: flex;flex-direction: row;float: right;">
  51. <el-button type="primary" size="small" plain icon="el-icon-plus" @click="add()">新增</el-button>
  52. <el-button type="primary" size="small" plain icon="el-icon-edit-outline" @click="ispublic()">发布
  53. </el-button>
  54. <el-button type="primary" size="small" plain icon="el-icon-scissors" @click="repeal()">废止</el-button>
  55. <el-button type="primary" size="small" plain icon="el-icon-delete" @click="delArray()">删除</el-button>
  56. <!-- <el-button type="primary" size="small" plain icon="el-icon-download">导出</el-button> -->
  57. </div>
  58. </el-row>
  59. </div>
  60. <!-- 表格数据区域-->
  61. <el-table ref="multipleTable"
  62. :data="tableData"
  63. border stripe highlight-current-row
  64. style="width: 100%"
  65. :row-style="rowStyle"
  66. :cell-style="cellStyle"
  67. @selection-change="handleSelectionChange">
  68. <el-table-column type="selection" width="50"></el-table-column>
  69. <el-table-column label="序号" width="50px">
  70. <template slot-scope="scope">
  71. {{ scope.$index+1 }}
  72. </template>
  73. </el-table-column>
  74. <el-table-column :key="table.label" v-for="table in tableHeader" :label="table.label" :prop="table.prop" align="center"
  75. :width="table.width" :fixed="table.fixed" />
  76. <el-table-column prop="status" label="任务状态" width="130" align="center" >
  77. <template slot-scope="scope">
  78. <el-tag v-if="scope.row.ispublic==0">未发布</el-tag>
  79. <el-tag type="warning" v-if="scope.row.ispublic==1">已发布</el-tag>
  80. <el-tag type="danger" v-if="scope.row.ispublic==2">已废止</el-tag>
  81. <el-tag type="info" v-if="scope.row.ispublic==3">已结束,未完成</el-tag>
  82. <el-tag type="success" v-if="scope.row.ispublic==4">已结束,已完成</el-tag>
  83. <el-tag type="success" effect="plain" v-if="scope.row.ispublic==5">执行中</el-tag>
  84. </template>
  85. </el-table-column>
  86. <el-table-column prop="level" label="任务优先级" width="85">
  87. <template slot-scope="scope">
  88. <el-tag type="success" v-if="scope.row.level==0">一般</el-tag>
  89. <el-tag type="warning" v-if="scope.row.level==1">紧急</el-tag>
  90. <el-tag type="danger" v-if="scope.row.level==2">特急</el-tag>
  91. </template>
  92. </el-table-column>
  93. <el-table-column label="操作" align="center" fixed="right">
  94. <!-- 操作按钮区域的作用域插槽 -->
  95. <template slot-scope="scope">
  96. <el-col style="margin-bottom: 5px;">
  97. <el-button type="success" size="mini" @click="readDialogVisible1(scope.row)">详情</el-button>
  98. <el-button type="success" size="mini" plain @click="takeTheLeadReport()">牵头单位报告</el-button>
  99. </el-col>
  100. <el-col style="margin-bottom: 5px;">
  101. <el-button type="success" size="mini" plain @click="undertakeReport()">承担单位报告</el-button>
  102. <el-button type="success" size="mini" plain @click="taskSample()">抽样单</el-button>
  103. </el-col>
  104. </template>
  105. </el-table-column>
  106. </el-table>
  107. <!-- 分页器区域-->
  108. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  109. :current-page="queryInfo.pageNum" :page-sizes="[10, 15, 20]" :page-size="queryInfo.pageSize"
  110. layout="total, sizes, prev, pager, next, jumper" :total="total" background />
  111. <!-- 任务详情对话框-->
  112. <el-dialog title="查看" :visible.sync="readDialogVisible" width="30%" :close-on-click-modal="false"
  113. class="dialogItem">
  114. <el-form v-if="readDialogVisible" :model="readForm" label-width="100px">
  115. <el-form-item label="任务名称:" prop="task_name" class="labelItem">
  116. <div>{{readForm.task_name}}</div>
  117. </el-form-item>
  118. <el-form-item label="任务优先级:" prop="level" class="labelItem">
  119. <div v-if="readForm.level=='0'">一般</div>
  120. <div v-else-if="readForm.level=='1'">紧急</div>
  121. <div v-else>特急</div>
  122. </el-form-item>
  123. <el-form-item label="监测类型:" prop="task_class" width="70px" class="labelItem">
  124. <div>{{readForm.task_class}}</div>
  125. </el-form-item>
  126. <el-form-item label="年度:" prop="year" class="labelItem">
  127. <div>{{readForm.year}}</div>
  128. </el-form-item>
  129. <el-form-item label="批次:" prop="batch" width="200px" class="labelItem">
  130. <div>{{readForm.batch}}</div>
  131. </el-form-item>
  132. <el-form-item label="任务时间:" prop="starttime" width="200px" class="labelItem">
  133. <div>{{readForm.starttime}} 至 {{readForm.endtime}}</div>
  134. </el-form-item>
  135. <el-form-item label="发布单位:" prop="releaser" class="labelItem">
  136. <div>{{readForm.releaser}}</div>
  137. </el-form-item>
  138. <el-form-item label="牵头单位:" prop="main_unit" class="labelItem">
  139. <div>{{readForm.main_unit}}</div>
  140. </el-form-item>
  141. <el-form-item label="附件:" prop="file_url" class="labelItem">
  142. <!-- <div>{{readForm.file_url}}</div> -->
  143. <el-link :href="readForm.file_url" type="primary">{{readForm.file_name}}</el-link>
  144. </el-form-item>
  145. <el-form-item label="文件号:" prop="filenum" width="200px" class="labelItem">
  146. <div v-if="readForm.filenum==null">无</div>
  147. <div v-else>{{readForm.filenum}}</div>
  148. </el-form-item>
  149. <el-form-item label="备注:" prop="log" class="labelItem">
  150. <div v-if="readForm.log==null">无</div>
  151. <div v-else>{{readForm.log}}</div>
  152. </el-form-item>
  153. <div class="footer">
  154. <el-button type="success" @click="readDialogVisible = false">返回</el-button>
  155. </div>
  156. </el-form>
  157. </el-dialog>
  158. </div>
  159. </template>
  160. <script>
  161. const token = window.sessionStorage.getItem('token')
  162. const rybh = window.sessionStorage.getItem('rybh')
  163. const rymc = window.sessionStorage.getItem('rymc')
  164. export default {
  165. name: '',
  166. data() {
  167. return {
  168. queryInfo:{
  169. year:'',
  170. task_name:'',
  171. starttime:'',
  172. endtime:'',
  173. ispublic:'',
  174. pageSize:10,
  175. pageNum:1,
  176. task_class:'例行监测'
  177. },
  178. total:0,
  179. cellStyle: {
  180. padding: 2 + 'px'
  181. },
  182. rowStyle: {
  183. height: 35 + 'px'
  184. },
  185. tableHeader: [{
  186. label: '任务名称',
  187. prop: 'task_name',
  188. width: 150
  189. // fixed: 'left'
  190. },
  191. {
  192. label: '年度',
  193. prop: 'year',
  194. width: 80
  195. // fixed: 'left'
  196. }, {
  197. label: '文件号',
  198. prop: 'filenum',
  199. width: 150
  200. // fixed: 'left'
  201. },
  202. {
  203. label: '开始时间',
  204. prop: 'starttime',
  205. width: 120
  206. },
  207. {
  208. label: '结束时间',
  209. prop: 'endtime',
  210. width: 120
  211. },
  212. {
  213. label: '创建者',
  214. prop: 'releaser',
  215. width: 120
  216. },
  217. {
  218. label: '创建时间',
  219. prop: 'createtime',
  220. width: 180
  221. }
  222. ],
  223. // 数据表格数据
  224. tableData: [],
  225. // 批量删除选中数据
  226. multipleSelection: [],
  227. // 任务状态选项
  228. taskispublic: [{
  229. value: '',
  230. label: '全部'
  231. }, {
  232. value: '0',
  233. label: '未发布'
  234. }, {
  235. value: '1',
  236. label: '已发布'
  237. }, {
  238. value: '2',
  239. label: '废止'
  240. }, {
  241. value: '5',
  242. label: '执行中'
  243. }, {
  244. value: '3',
  245. label: '已结束,未完成'
  246. }, {
  247. value: '4',
  248. label: '已结束,已完成'
  249. }],
  250. // 日期选择器快捷选项
  251. pickerOptions: {
  252. // disabledDate(time) {
  253. // return time.getTime() > Date.now();
  254. // },
  255. shortcuts: [{
  256. text: '今天',
  257. onClick(picker) {
  258. picker.$emit('pick', new Date());
  259. }
  260. }, {
  261. text: '昨天',
  262. onClick(picker) {
  263. const date = new Date();
  264. date.setTime(date.getTime() - 3600 * 1000 * 24);
  265. picker.$emit('pick', date);
  266. }
  267. }, {
  268. text: '一周前',
  269. onClick(picker) {
  270. const date = new Date();
  271. date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
  272. picker.$emit('pick', date);
  273. }
  274. }]
  275. },
  276. // 查看任务详情
  277. readDialogVisible: false,
  278. readForm: {},
  279. multipleSelection: [],
  280. delarr: [],
  281. pubarr: []
  282. }
  283. },
  284. created() {
  285. this.gettaskList()
  286. },
  287. methods: {
  288. add() {
  289. this.$router.push('addTask')
  290. },
  291. ttaskSample() {
  292. this.$router.push('taskSample')
  293. },
  294. takeTheLeadReport() {
  295. this.$router.push('takeTheLeadReporList')
  296. },
  297. undertakeReport(){
  298. this.$router.push('undertakeReport')
  299. },
  300. taskSample(){
  301. this.$router.push('taskSample')
  302. },
  303. // 搜索
  304. async searchData() {
  305. this.queryInfo.pageNum = 1
  306. this.gettaskList()
  307. },
  308. // 重置
  309. reset(){
  310. this.queryInfo={
  311. year:'',
  312. task_name:'',
  313. starttime:'',
  314. endtime:'',
  315. ispublic:'',
  316. pageSize:10,
  317. pageNum:1,
  318. task_class:'例行监测'
  319. }
  320. this.gettaskList()
  321. },
  322. /** 监听页码的改变 */
  323. handleCurrentChange(newPage) {
  324. this.queryInfo.pageNum = newPage
  325. this.gettaskList()
  326. },
  327. /** 监听每页显示多少数据的改变 */
  328. handleSizeChange(newSize) {
  329. this.queryInfo.pageSize = newSize
  330. this.gettaskList()
  331. },
  332. /** 监听页码的改变 */
  333. handleCurrentChange(newPage) {
  334. this.queryInfo.pageNum = newPage
  335. this.gettaskList()
  336. },
  337. // 获取任务列表
  338. async gettaskList() {
  339. for (var key in this.queryInfo) {
  340. if (this.queryInfo[key] == '') {
  341. delete this.queryInfo[key]
  342. }
  343. }
  344. const {
  345. data: res
  346. } = await this.$http.post(
  347. "getTaskList", this.queryInfo
  348. );
  349. this.tableData = res.data.rows
  350. this.total = res.data.total
  351. },
  352. // 查看任务详情
  353. async readDialogVisible1(row) {
  354. this.readForm.batch = row.batch
  355. this.readForm.task_name = row.task_name
  356. this.readForm.task_class = row.task_class
  357. this.readForm.level = row.level
  358. console.log(this.readForm.level)
  359. this.readForm.year = row.year
  360. this.readForm.starttime = row.starttime
  361. this.readForm.endtime = row.endtime
  362. this.readForm.releaser = row.releaser
  363. this.readForm.main_unit = row.main_unit
  364. this.readForm.file_url = row.file_url
  365. this.readForm.file_name = row.file_name
  366. this.readForm.filenum = row.filenum
  367. this.readForm.log = row.log
  368. this.readDialogVisible = true
  369. },
  370. // 批量删除
  371. handleSelectionChange(val) {
  372. this.multipleSelection = val;
  373. // console.log(this.multipleSelection)
  374. },
  375. // 删除任务
  376. async delArray() {
  377. // 判断任务是否为该创建者创建
  378. // for (let i = 0; i < this.multipleSelection.length; i++) {
  379. // if (rybh != this.multipleSelection[i].releaser) {
  380. // this.$alert('任务仅创建者可以删除!', {
  381. // confirmButtonText: '确定',
  382. // callback: action => {
  383. // }
  384. // });
  385. // }
  386. // }
  387. var that = this;
  388. const length = this.multipleSelection.length;
  389. // var val = this.selectedData;
  390. for (let i = 0; i < length; i++) {
  391. // console.log(this.multipleSelection[i])
  392. this.delarr.push(this.multipleSelection[i].id);
  393. }
  394. const result = await this.$http.post('delTask', {
  395. delarr: that.delarr,
  396. token: token
  397. })
  398. console.log(that.delarr);
  399. if (result.data.code == 0) {
  400. this.$message({
  401. type: 'success',
  402. message: '删除成功!'
  403. });
  404. that.gettaskList()
  405. } else {
  406. this.$message({
  407. type: 'error',
  408. message: '删除失败!'
  409. });
  410. }
  411. this.$refs.multipleTable.clearSelection();
  412. },
  413. // 发布任务
  414. async ispublic() {
  415. // 判断任务是否为该创建者创建
  416. // for (let i = 0; i < this.multipleSelection.length; i++) {
  417. // if (rybh != this.multipleSelection[i].releaser) {
  418. // this.$alert('任务仅创建者可以发布!', {
  419. // confirmButtonText: '确定',
  420. // callback: action => {
  421. // }
  422. // });
  423. // }
  424. // }
  425. var that = this;
  426. let canPub = 0
  427. const length = this.multipleSelection.length;
  428. // var val = this.selectedData;
  429. console.log(this.multipleSelection)
  430. // this.pubarr = this.multipleSelection;
  431. for (let i = 0; i < length; i++) {
  432. if (this.multipleSelection[i].ispublic != '0') {
  433. this.$alert('任务不在可发布状态!', {
  434. confirmButtonText: '确定',
  435. callback: action => {
  436. }
  437. });
  438. } else {
  439. this.multipleSelection[i].ispublic = 1
  440. canPub = 1
  441. }
  442. }
  443. if(canPub==1){
  444. const result = await this.$http.post('isPublicTask', {
  445. pubarr: that.multipleSelection,
  446. token: token,
  447. })
  448. if (result.data.code == 0) {
  449. this.$message({
  450. type: 'success',
  451. message: '发布成功!'
  452. });
  453. that.gettaskList()
  454. }
  455. }
  456. },
  457. // 废止任务
  458. async repeal() {
  459. // 判断任务是否为该创建者创建
  460. for (let i = 0; i < this.multipleSelection.length; i++) {
  461. if (rybh != this.multipleSelection[i].releaser) {
  462. this.$alert('任务仅创建者可以废止!', {
  463. confirmButtonText: '确定',
  464. callback: action => {}
  465. });
  466. }
  467. }
  468. var that = this;
  469. let canPub = 0
  470. const length = this.multipleSelection.length;
  471. // var val = this.selectedData;
  472. this.pubarr = this.multipleSelection;
  473. for (let i = 0; i < length; i++) {
  474. if (this.pubarr[i].ispublic == '已发布') {
  475. this.pubarr[i].ispublic = 2
  476. canPub = 1
  477. } else {
  478. this.$alert('任务不在可废止状态!', {
  479. confirmButtonText: '确定',
  480. callback: action => {
  481. }
  482. });
  483. }
  484. if(canPub==1){
  485. const result = await this.$http.post('isPublicTask', {
  486. pubarr: that.pubarr,
  487. token: token
  488. })
  489. if (result.data.code == 0) {
  490. this.$message({
  491. type: 'success',
  492. message: '任务已废止!'
  493. });
  494. that.gettaskList()
  495. }
  496. }
  497. }
  498. }
  499. },
  500. }
  501. </script>
  502. <style lang="less" scoped>
  503. .el-breadcrumb {
  504. margin-bottom: 20px;
  505. }
  506. .el-table {
  507. align-items: center;
  508. margin-top: 25px;
  509. }
  510. /deep/ .el-col {
  511. padding-right: 0 !important;
  512. }
  513. /deep/ .el-radio-group label {
  514. width: 180px;
  515. margin-right: 10px;
  516. }
  517. .el-pagination {
  518. margin-top: 25px;
  519. }
  520. // .el-cascader {
  521. // width: 290px;
  522. // }
  523. .el-select {
  524. width: 210px;
  525. height: 100%;
  526. }
  527. .select {
  528. // display: flex;
  529. flex-direction: row;
  530. // margin-left: 10px;
  531. }
  532. .dialogItem /deep/ .el-dialog__body {
  533. padding: 15px 12px 0;
  534. color: #606266;
  535. font-size: 14px;
  536. word-break: break-all;
  537. }
  538. .el-form-item {
  539. margin-bottom: 8px;
  540. }
  541. .labelItem /deep/ .el-form-item__label {
  542. // width: 80px;
  543. text-align: center;
  544. vertical-align: middle;
  545. float: left;
  546. font-size: 13px;
  547. color: #606266;
  548. // line-height: 40px;
  549. padding: 0 2px 0 0;
  550. -webkit-box-sizing: border-box;
  551. box-sizing: border-box;
  552. }
  553. .el-dialog__header {
  554. border-bottom: 1px solid #e5e5e5;
  555. }
  556. // .el-form-item__content{
  557. // margin-left: 0;
  558. // }
  559. .footer {
  560. padding: 5px 0;
  561. border-top: 1px solid #e5e5e5;
  562. text-align: center;
  563. }
  564. .rightButton{
  565. margin-top: 20px;
  566. }
  567. .headSearch{
  568. margin-left: 25px;
  569. }
  570. </style>