routineMonitorqt.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  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;">
  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: 40px;margin-left: 10px;" type="success" size="mini" @click="searchData()">查询</el-button>
  37. <!-- 重置 -->
  38. <el-button style="height: 40px;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)">执行任务</el-button>
  89. </template>
  90. </el-table-column>
  91. </el-table>
  92. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  93. :current-page="queryInfo.currentPage" :page-sizes="[10, 20, 30, 40]" :page-size="queryInfo.pageSize"
  94. layout="total, sizes, prev, pager, next, jumper" :total="total">
  95. </el-pagination>
  96. </div>
  97. </template>
  98. <script>
  99. export default {
  100. name: '',
  101. data() {
  102. return {
  103. total: 0,
  104. cellStyle: {
  105. padding: 2 + 'px'
  106. },
  107. rowStyle: {
  108. height: 35 + 'px'
  109. },
  110. tableHeader: [{
  111. label: '任务名称',
  112. prop: 'task_name'
  113. // fixed: 'left'
  114. },
  115. {
  116. label: '年度',
  117. prop: 'year'
  118. // fixed: 'left'
  119. }, {
  120. label: '文件号',
  121. prop: 'filenum',
  122. // fixed: 'left'
  123. },
  124. {
  125. label: '开始时间',
  126. prop: 'starttime'
  127. },
  128. {
  129. label: '结束时间',
  130. prop: 'endtime'
  131. },
  132. {
  133. label: '创建者',
  134. prop: 'releaser'
  135. }
  136. ],
  137. // 数据表格数据
  138. tableData: [],
  139. // 批量删除选中数据
  140. multipleSelection: [],
  141. queryInfo:{
  142. pageSize:10,
  143. pageNum:1,
  144. currentPage:1,
  145. year:'',
  146. ispublic:'',
  147. starttime:'',
  148. endtime:'',
  149. task_name:'',
  150. task_class:'例行监测'
  151. },
  152. // 任务状态选项
  153. taskstatus: [{
  154. value: '',
  155. label: '全部'
  156. }, {
  157. value: '1',
  158. label: '已发布'
  159. }, {
  160. value: '2',
  161. label: '已废止'
  162. }, {
  163. value: '3',
  164. label: '已结束,未完成'
  165. }, {
  166. value: '4',
  167. label: '已结束,已完成'
  168. }, {
  169. value: '5',
  170. label: '执行中'
  171. }],
  172. // 日期选择器快捷选项
  173. pickerOptions: {
  174. disabledDate(time) {
  175. return time.getTime() > Date.now();
  176. },
  177. shortcuts: [{
  178. text: '今天',
  179. onClick(picker) {
  180. picker.$emit('pick', new Date());
  181. }
  182. }, {
  183. text: '昨天',
  184. onClick(picker) {
  185. const date = new Date();
  186. date.setTime(date.getTime() - 3600 * 1000 * 24);
  187. picker.$emit('pick', date);
  188. }
  189. }, {
  190. text: '一周前',
  191. onClick(picker) {
  192. const date = new Date();
  193. date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
  194. picker.$emit('pick', date);
  195. }
  196. }]
  197. },
  198. bindDialogShow:false,
  199. options:[],
  200. bindForm:{}
  201. }
  202. },
  203. mounted: function() {
  204. this.gettaskList()
  205. },
  206. methods: {
  207. handleSizeChange(val) {
  208. this.queryInfo.pageSize = val;
  209. console.log(`每页 ${val} 条`);
  210. },
  211. handleCurrentChange(val) {
  212. this.queryInfo.pageNum = val;
  213. console.log(`当前页: ${val}`);
  214. this.gettaskList()
  215. },
  216. // 批量选中
  217. handleSelectionChange(val) {
  218. this.multipleSelection = val;
  219. console.log(this.multipleSelection)
  220. },
  221. // 搜索
  222. async searchData() {
  223. console.log(this.queryInfo)
  224. this.queryInfo.pageNum = 1
  225. this.gettaskList()
  226. },
  227. // 重置
  228. reset(){
  229. this.queryInfo={
  230. year:'',
  231. task_name:'',
  232. starttime:'',
  233. endtime:'',
  234. ispublic:'',
  235. pageSize:10,
  236. pageNum:1,
  237. task_class:'例行监测'
  238. }
  239. this.gettaskList()
  240. },
  241. add() {
  242. // this.$router.push('')
  243. },
  244. // 获取任务列表
  245. async gettaskList() {
  246. console.log(this.queryInfo)
  247. for (var key in this.queryInfo) {
  248. if (this.queryInfo[key] == '') {
  249. delete this.queryInfo[key]
  250. }
  251. }
  252. const {
  253. data: res
  254. } = await this.$http.post(
  255. "getTaskListTest", this.queryInfo
  256. );
  257. console.log(res)
  258. this.tableData = res.data.rows
  259. this.total = res.data.total
  260. },
  261. // 获取分页数据
  262. async choseModel() {
  263. const result = await this.$http.post('getPesticidesList', this.queryInfo)
  264. // 判断业务逻辑
  265. if (result.data.code == 0) {
  266. this.pesticidesList = result.data.data.rows
  267. this.total = result.data.data.total
  268. }
  269. },
  270. // 执行任务
  271. runtask(id) {
  272. // console.log(id)
  273. this.$router.push({
  274. name: 'setTask',
  275. params: {
  276. id:id
  277. }
  278. })
  279. }
  280. },
  281. }
  282. </script>
  283. <style lang="less" scoped>
  284. .el-breadcrumb {
  285. margin-bottom: 20px;
  286. }
  287. .el-table {
  288. align-items: center;
  289. margin-top: 25px;
  290. }
  291. /deep/ .el-col {
  292. padding-right: 0 !important;
  293. }
  294. /deep/ .el-radio-group label {
  295. width: 180px;
  296. margin-right: 10px;
  297. }
  298. .el-pagination {
  299. margin-top: 25px;
  300. }
  301. // .el-cascader {
  302. // width: 290px;
  303. // }
  304. .el-select {
  305. width: 210px;
  306. height: 100%;
  307. }
  308. .select {
  309. display: flex;
  310. flex-direction: row;
  311. margin-left: 10px;
  312. }
  313. .dialogItem /deep/ .el-dialog__body {
  314. padding: 15px 12px 0;
  315. color: #606266;
  316. font-size: 14px;
  317. word-break: break-all;
  318. }
  319. .el-form-item {
  320. margin-bottom: 30px;
  321. padding-left: 18px;
  322. }
  323. .labelItem /deep/ .el-form-item__label {
  324. // width: 80px;
  325. text-align: center;
  326. vertical-align: middle;
  327. float: left;
  328. font-size: 13px;
  329. color: #606266;
  330. // line-height: 40px;
  331. padding: 0 2px 0 0;
  332. -webkit-box-sizing: border-box;
  333. box-sizing: border-box;
  334. }
  335. .cell {
  336. display: flex;
  337. flex-direction: row;
  338. }
  339. .footer {
  340. padding: 10px;
  341. text-align: center;
  342. }
  343. // .el-form-item__content{
  344. // margin-left: 0;
  345. // }
  346. </style>