specialMonitorqt.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  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>
  9. </div>
  10. <!-- 头部搜索栏 -->
  11. <el-row :gutter="50" style="margin-right: 0px;">
  12. <el-form style="display: flex; flex-direction: row;" size="mini">
  13. <el-form-item label="年度" class="select">
  14. <el-date-picker v-model="queryInfo.year" style="width: 110px;" value-format="yyyy"
  15. type="year" clearable />
  16. </el-form-item>
  17. <el-form-item label="任务状态" class="select">
  18. <el-select v-model="queryInfo.ispublic" style="width: 110px;">
  19. <el-option v-for="item in taskstatus" :key="item.value" :label="item.label"
  20. :value="item.value">
  21. </el-option>
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item label="任务时间" class="select">
  25. <el-date-picker v-model="queryInfo.starttime" style="width: 180px;" align="right" type="date"
  26. :picker-options="pickerOptions" clearable />
  27. </el-form-item>
  28. <el-form-item label="--" class="select" style="margin-left: 10px; padding-left: 0px;">
  29. <el-date-picker v-model="queryInfo.endtime" style="width: 180px;" align="right" type="date"
  30. :picker-options="pickerOptions" clearable />
  31. </el-form-item>
  32. <el-form-item label="任务名称" class="select">
  33. <el-input v-model="queryInfo.task_name"></el-input>
  34. </el-form-item>
  35. <!-- 查询 -->
  36. <el-button style="height: 28px;margin-left: 10px;" type="success" size="mini" @click="searchData()">查询</el-button>
  37. <!-- 重置 -->
  38. <el-button style="height: 28px;margin-left: 5px;" type="success" size="mini" @click="reset()">重置</el-button>
  39. </el-form>
  40. </el-row>
  41. <!-- 头部钮区域-->
  42. <!-- <el-row :gutter="90" style="margin-right: 0px;">
  43. <div style="display: flex;flex-direction: row;float: right;">
  44. <el-button type="primary" size="small" plain icon="el-icon-plus" @click="add()">新增</el-button>
  45. <el-button type="primary" size="small" plain icon="el-icon-edit-outline" @click="ispublic()">发布</el-button>
  46. <el-button type="primary" size="small" plain icon="el-icon-scissors" @click="repeal()">废止</el-button>
  47. <el-button type="primary" size="small" plain icon="el-icon-delete" @click="delArray()">删除</el-button>
  48. <el-button type="primary" size="small" plain icon="el-icon-download">导出</el-button>
  49. </div>
  50. </el-row> -->
  51. <!-- 表格数据区域-->
  52. <el-table ref="multipleTable" :data="tableData" border stripe highlight-current-row style="width: 100%"
  53. :row-style="rowStyle" :cell-style="cellStyle" @selection-change="handleSelectionChange">
  54. <el-table-column type="selection" width="50" align="center"></el-table-column>
  55. <el-table-column label="序号" width="50px" align="center">
  56. <template slot-scope="scope">
  57. {{ scope.$index+1 }}
  58. </template>
  59. </el-table-column>
  60. <el-table-column :key="table.label" v-for="table in tableHeader" :label="table.label" :prop="table.prop"
  61. align="center" :width="table.width" :fixed="table.fixed" />
  62. <el-table-column prop="level" label="任务优先级" align="center" width="100">
  63. <template slot-scope="scope">
  64. <el-tag type="success" v-if="scope.row.level==0">一般</el-tag>
  65. <el-tag type="warning" v-if="scope.row.level==1">紧急</el-tag>
  66. <el-tag type="danger" v-if="scope.row.level==2">特急</el-tag>
  67. </template>
  68. </el-table-column>
  69. <el-table-column prop="file_url" label="附件" align="center" width="60">
  70. <template slot-scope="scope">
  71. <span v-if="scope.row.file_url==null">--</span>
  72. <el-link v-else type="primary" :href="scope.row.file_url">下载</el-link>
  73. </template>
  74. </el-table-column>
  75. <el-table-column prop="ispublic" label="任务状态" align="center">
  76. <template slot-scope="scope">
  77. <el-tag type="success" v-if="scope.row.ispublic==1">已发布</el-tag>
  78. <el-tag type="danger" v-if="scope.row.ispublic==2">废止</el-tag>
  79. <el-tag type="info" v-if="scope.row.ispublic==3">已结束,未完成</el-tag>
  80. <el-tag type="success" v-if="scope.row.ispublic==4">已结束,已完成</el-tag>
  81. <el-tag type="warning" v-if="scope.row.ispublic==5">执行中</el-tag>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="操作" align="center" fixed="right">
  85. <!-- 操作按钮区域的作用域插槽 -->
  86. <template slot-scope="scope">
  87. <!-- <el-button type="warning" plain size="small" @click="bindDialogShow1(scope.row)">绑定模型</el-button> -->
  88. <!-- <el-button type="success" size="mini" @click="runtask(scope.row.id)" v-if="this.queryInfo.ispublic == 5">导出word</el-button> -->
  89. <el-button type="success" size="mini" @click="runtask(scope.row.id)">执行任务</el-button>
  90. </template>
  91. </el-table-column>
  92. </el-table>
  93. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  94. :current-page="queryInfo.currentPage" :page-sizes="[10, 20, 30, 40]" :page-size="queryInfo.pageSize"
  95. layout="total, sizes, prev, pager, next, jumper" :total="total">
  96. </el-pagination>
  97. </div>
  98. </template>
  99. <script>
  100. export default {
  101. name: '',
  102. data() {
  103. return {
  104. total: 0,
  105. cellStyle: {
  106. padding: 2 + 'px'
  107. },
  108. rowStyle: {
  109. height: 35 + 'px'
  110. },
  111. tableHeader: [{
  112. label: '任务名称',
  113. prop: 'task_name'
  114. // fixed: 'left'
  115. },
  116. {
  117. label: '年度',
  118. prop: 'year'
  119. // fixed: 'left'
  120. }, {
  121. label: '文件号',
  122. prop: 'filenum',
  123. // fixed: 'left'
  124. },
  125. {
  126. label: '开始时间',
  127. prop: 'starttime'
  128. },
  129. {
  130. label: '结束时间',
  131. prop: 'endtime'
  132. },
  133. {
  134. label: '创建者',
  135. prop: 'releaser'
  136. }
  137. ],
  138. // 数据表格数据
  139. tableData: [],
  140. // 批量删除选中数据
  141. multipleSelection: [],
  142. queryInfo:{
  143. pageSize:10,
  144. pageNum:1,
  145. currentPage:1,
  146. year:'',
  147. ispublic:'',
  148. starttime:'',
  149. endtime:'',
  150. task_name:'',
  151. task_class:'专项监测'
  152. },
  153. // 任务状态选项
  154. taskstatus: [{
  155. value: '',
  156. label: '全部'
  157. }, {
  158. value: '1',
  159. label: '已发布'
  160. }, {
  161. value: '2',
  162. label: '已废止'
  163. }, {
  164. value: '3',
  165. label: '已结束,未完成'
  166. }, {
  167. value: '4',
  168. label: '已结束,已完成'
  169. }, {
  170. value: '5',
  171. label: '执行中'
  172. }],
  173. // 日期选择器快捷选项
  174. pickerOptions: {
  175. disabledDate(time) {
  176. return time.getTime() > Date.now();
  177. },
  178. shortcuts: [{
  179. text: '今天',
  180. onClick(picker) {
  181. picker.$emit('pick', new Date());
  182. }
  183. }, {
  184. text: '昨天',
  185. onClick(picker) {
  186. const date = new Date();
  187. date.setTime(date.getTime() - 3600 * 1000 * 24);
  188. picker.$emit('pick', date);
  189. }
  190. }, {
  191. text: '一周前',
  192. onClick(picker) {
  193. const date = new Date();
  194. date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
  195. picker.$emit('pick', date);
  196. }
  197. }]
  198. },
  199. bindDialogShow:false,
  200. options:[],
  201. bindForm:{}
  202. }
  203. },
  204. mounted: function() {
  205. this.gettaskList()
  206. },
  207. methods: {
  208. handleSizeChange(val) {
  209. this.queryInfo.pageSize = val;
  210. console.log(`每页 ${val} 条`);
  211. },
  212. handleCurrentChange(val) {
  213. this.queryInfo.pageNum = val;
  214. console.log(`当前页: ${val}`);
  215. this.gettaskList()
  216. },
  217. // 废止任务
  218. async repeal() {
  219. // 判断任务是否为该创建者创建
  220. for (let i = 0; i < this.multipleSelection.length; i++) {
  221. if (rymc != this.multipleSelection[i].releaser) {
  222. this.$alert('任务仅创建者可以废止!', {
  223. confirmButtonText: '确定',
  224. callback: action => {}
  225. });
  226. }
  227. }
  228. var that = this;
  229. let canPub = 0
  230. const length = this.multipleSelection.length;
  231. // var val = this.selectedData;
  232. this.pubarr = this.multipleSelection;
  233. for (let i = 0; i < length; i++) {
  234. if (this.pubarr[i].ispublic == '1') {
  235. this.pubarr[i].ispublic = 2
  236. canPub = 1
  237. } else {
  238. this.$alert('任务不在可废止状态!', {
  239. confirmButtonText: '确定',
  240. callback: action => {
  241. }
  242. });
  243. }
  244. if(canPub==1){
  245. const result = await this.$http.post('isPublicTask', {
  246. pubarr: that.pubarr,
  247. token: token
  248. })
  249. if (result.data.code == 0) {
  250. this.$message({
  251. type: 'success',
  252. message: '任务已废止!'
  253. });
  254. that.gettaskList()
  255. }
  256. }
  257. }
  258. },
  259. // 批量选中
  260. handleSelectionChange(val) {
  261. this.multipleSelection = val;
  262. console.log(this.multipleSelection)
  263. },
  264. // 批量删除
  265. handleSelectionChange(val) {
  266. this.multipleSelection = val;
  267. // console.log(this.multipleSelection)
  268. },
  269. // 删除任务
  270. async delArray() {
  271. // 判断任务是否为该创建者创建
  272. for (let i = 0; i < this.multipleSelection.length; i++) {
  273. if (rymc != this.multipleSelection[i].releaser) {
  274. this.$alert('任务仅创建者可以删除!', {
  275. confirmButtonText: '确定',
  276. callback: action => {
  277. }
  278. });
  279. }
  280. }
  281. var that = this;
  282. const length = this.multipleSelection.length;
  283. // var val = this.selectedData;
  284. for (let i = 0; i < length; i++) {
  285. // console.log(this.multipleSelection[i])
  286. this.delarr.push(this.multipleSelection[i].id);
  287. }
  288. const result = await this.$http.post('delTask', {
  289. delarr: that.delarr,
  290. token: token
  291. })
  292. if (result.data.code == 0) {
  293. this.$message({
  294. type: 'success',
  295. message: '删除成功!'
  296. });
  297. that.gettaskList()
  298. } else {
  299. this.$message({
  300. type: 'error',
  301. message: '删除失败!'
  302. });
  303. }
  304. this.$refs.multipleTable.clearSelection();
  305. },
  306. // 获取任务列表
  307. async gettaskList() {
  308. console.log(this.queryInfo)
  309. for (var key in this.queryInfo) {
  310. if (this.queryInfo[key] == '') {
  311. delete this.queryInfo[key]
  312. }
  313. }
  314. const {
  315. data: res
  316. } = await this.$http.post(
  317. "getTaskListTest", this.queryInfo
  318. );
  319. this.tableData = res.data.rows
  320. this.total = res.data.total
  321. },
  322. runtask(id) {
  323. console.log(id)
  324. this.$router.push({
  325. name: 'setTask',
  326. params: {
  327. id:id
  328. }
  329. })
  330. },
  331. // 搜索
  332. async searchData() {
  333. this.queryInfo.pageNum = 1
  334. console.log(this.queryInfo)
  335. this.gettaskList()
  336. },
  337. // 重置
  338. reset(){
  339. this.queryInfo={
  340. year:'',
  341. task_name:'',
  342. starttime:'',
  343. endtime:'',
  344. ispublic:'',
  345. pageSize:10,
  346. pageNum:1,
  347. task_class:'专项监测'
  348. }
  349. this.gettaskList()
  350. },
  351. },
  352. }
  353. </script>
  354. <style lang="less" scoped>
  355. .el-breadcrumb {
  356. margin-bottom: 20px;
  357. }
  358. .el-table {
  359. align-items: center;
  360. margin-top: 25px;
  361. }
  362. /deep/ .el-col {
  363. padding-right: 0 !important;
  364. }
  365. /deep/ .el-radio-group label {
  366. width: 180px;
  367. margin-right: 10px;
  368. }
  369. .el-pagination {
  370. margin-top: 25px;
  371. }
  372. // .el-cascader {
  373. // width: 290px;
  374. // }
  375. .el-select {
  376. width: 210px;
  377. height: 100%;
  378. }
  379. .select {
  380. display: flex;
  381. flex-direction: row;
  382. margin-left: 10px;
  383. }
  384. .dialogItem /deep/ .el-dialog__body {
  385. padding: 15px 12px 0;
  386. color: #606266;
  387. font-size: 14px;
  388. word-break: break-all;
  389. }
  390. .el-form-item {
  391. margin-bottom: 8px;
  392. padding-left: 18px;
  393. }
  394. .labelItem /deep/ .el-form-item__label {
  395. // width: 80px;
  396. text-align: center;
  397. vertical-align: middle;
  398. float: left;
  399. font-size: 13px;
  400. color: #606266;
  401. // line-height: 40px;
  402. padding: 0 2px 0 0;
  403. -webkit-box-sizing: border-box;
  404. box-sizing: border-box;
  405. }
  406. .cell {
  407. display: flex;
  408. flex-direction: row;
  409. }
  410. .footer {
  411. padding: 10px;
  412. text-align: center;
  413. }
  414. // .el-form-item__content{
  415. // margin-left: 0;
  416. // }
  417. </style>