123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477 |
- <template>
- <div style="width: 100%">
- <div slot="header" class="clearfix">
- <el-breadcrumb separator-class="el-icon-arrow-right">
- <el-breadcrumb-item :to="{ path: '/jc/workbench' }">首页</el-breadcrumb-item>
- <el-breadcrumb-item>承担单位</el-breadcrumb-item>
- <el-breadcrumb-item>例行监测</el-breadcrumb-item>
- </el-breadcrumb>
- </div>
- <!-- 头部搜索栏 -->
- <el-row :gutter="50" style="margin-right: 0px;">
- <el-form style="display: flex; flex-direction: row;" size="mini">
- <el-form-item label="年度" class="select">
- <el-date-picker v-model="queryInfo.year" style="width: 110px;" value-format="yyyy"
- type="year" clearable />
- </el-form-item>
- <el-form-item label="任务状态" class="select">
- <el-select v-model="queryInfo.ispublic" style="width: 110px;">
- <el-option v-for="item in taskstatus" :key="item.value" :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="任务时间" class="select">
- <el-date-picker v-model="queryInfo.starttime" style="width: 180px;" align="right" type="date"
- :picker-options="pickerOptions" clearable />
- </el-form-item>
- <el-form-item label="--" class="select" style="margin-left: 10px; padding-left: 0px;">
- <el-date-picker v-model="queryInfo.endtime" style="width: 180px;" align="right" type="date"
- :picker-options="pickerOptions" clearable />
- </el-form-item>
- <el-form-item label="任务名称" class="select">
- <el-input v-model="queryInfo.task_name"></el-input>
- </el-form-item>
- <!-- 查询 -->
- <el-button style="height: 28px;margin-left: 10px;" size="mini" type="primary" @click="searchData()">查询</el-button>
- <!-- 重置 -->
- <el-button style="height: 28px;margin-left: 5px;" size="mini" type="primary" @click="reset()">重置</el-button>
- </el-form>
- </el-row>
- <!-- 头部钮区域-->
- <el-row :gutter="90" style="margin-right: 0px;">
- <div style="display: flex;flex-direction: row;float: right;">
- <!-- <el-button type="primary" size="small" plain icon="el-icon-plus" @click="add">新增</el-button>
- <el-button type="primary" size="small" plain icon="el-icon-edit-outline" >发布</el-button>
- <el-button type="primary" size="small" plain icon="el-icon-scissors" >废止</el-button>
- <el-button type="primary" size="small" plain icon="el-icon-delete" >删除</el-button> -->
- <el-button type="primary" size="small" plain icon="el-icon-download" @click="exportData">导出Excel</el-button>
- </div>
- </el-row>
- <!-- 表格数据区域-->
- <el-table ref="multipleTable" :data="tableData" border stripe highlight-current-row style="width: 100%"
- :row-style="rowStyle" :cell-style="cellStyle">
- <el-table-column type="selection" width="50" align="center"></el-table-column>
- <el-table-column label="序号" width="50px" align="center">
- <template slot-scope="scope">
- {{ scope.$index+1 }}
- </template>
- </el-table-column>
- <el-table-column :key="table.label" v-for="table in tableHeader" :label="table.label" :prop="table.prop"
- align="center" :width="table.width" :fixed="table.fixed" />
- <el-table-column prop="ispublic" label="任务状态" align="center">
- <template slot-scope="scope">
- <el-tag type="" v-if="scope.row.ispublic==1">已发布</el-tag>
- <el-tag type="danger" v-if="scope.row.ispublic==14">抽样中</el-tag>
- <el-tag type="info" v-if="scope.row.ispublic==13">检测中</el-tag>
- <el-tag type="success" v-if="scope.row.ispublic==17">检测中</el-tag>
- <el-tag type="" v-if="scope.row.ispublic==21">已完成</el-tag>
- <el-tag type="warning" v-if="scope.row.ispublic==25">未完成</el-tag>
- </template>
- </el-table-column>
- <el-table-column prop="level" label="任务优先级" width="100" align="center">
- <template slot-scope="scope">
- <el-tag type="success" v-if="scope.row.level==0">一般</el-tag>
- <el-tag type="warning" v-if="scope.row.level==1">紧急</el-tag>
- <el-tag type="danger" v-if="scope.row.level==2">特急</el-tag>
- </template>
- </el-table-column>
- <el-table-column prop="file_url" label="附件" width="80" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.file_url == null">--</span>
- <el-link v-else type="primary" :href="scope.row.file_url">下载</el-link>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" fixed="right">
- <!-- 操作按钮区域的作用域插槽 -->
- <template slot-scope="scope">
- <el-col>
- <el-button type="primary" style="margin-top:5px;" size="mini" @click="runtask(scope.row.id)">执行任务</el-button>
- </el-col>
- <el-col>
- <el-button type="success" style="margin:5px 0px;" size="mini" @click="up(scope.row.id)">上报任务</el-button>
- </el-col>
- </template>
- </el-table-column>
- </el-table>
- <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
- :current-page="queryInfo.currentPage" :page-sizes="[1,10, 20, 30, 40]" :page-size="queryInfo.pageSize"
- layout="total, sizes, prev, pager, next, jumper" :total="total">
- </el-pagination>
-
- </div>
- </template>
- <script>
- const qee = require('qf-export-excel')
- const HeadersList = [{
- title: '任务名称',
- key: 'task_name',
- },
- {
- title: '年度',
- key: 'year',
- }, {
- title: '文件号',
- key: 'filenum',
- },
- {
- title: '开始时间',
- key: 'starttime',
- },
- {
- title: '结束时间',
- key: 'endtime',
- },
- {
- title: '发布单位',
- key: 'releaser',
- },
- {
- title: '创建时间',
- key: 'createtime',
- },{
- title: '任务状态',
- key: 'ispublic'
- },{
- title: '任务优先级',
- key: 'level'
- }
- ]
- export default {
- name: '',
- data() {
- return {
- total: 0,
- cellStyle: {
- padding: 2 + 'px'
- },
- rowStyle: {
- height: 35 + 'px'
- },
- tableHeader: [{
- label: '任务名称',
- prop: 'task_name',
- // fixed: 'left'
- },
- {
- label: '年度',
- prop: 'year',
- // fixed: 'left'
- }, {
- label: '文件号',
- prop: 'filenum',
- // fixed: 'left'
- },
- {
- label: '开始时间',
- prop: 'starttime',
- },
- {
- label: '结束时间',
- prop: 'endtime',
- },
- {
- label: '发布单位',
- prop: 'releaser.rymc',
- },
- // {
- // label: '创建时间',
- // prop: 'create_time',
- // // width: 180
- // },
- ],
-
- // 数据表格数据
- tableData: [],
- // 批量删除选中数据
- multipleSelection: [],
- queryInfo:{
- pageSize:10,
- pageNum:1,
- currentPage:1,
- year:'',
- ispublic:'',
- starttime:'',
- endtime:'',
- task_name:'',
- task_class:'例行监测'
- },
- // 任务状态选项
- taskstatus: [{
- value: '',
- label: '全部'
- },{
- value: '1',
- label: '已发布'
- }, {
- value: '9',
- label: '执行中'
- }, {
- value: '13',
- label: '抽样中'
- }, {
- value: '17',
- label: '检测中'
- }, {
- value: '21',
- label: '已完成'
- }, {
- value: '25',
- label: '未完成'
- }],
- // 日期选择器快捷选项
- pickerOptions: {
- disabledDate(time) {
- return time.getTime() > Date.now();
- },
- shortcuts: [{
- text: '今天',
- onClick(picker) {
- picker.$emit('pick', new Date());
- }
- }, {
- text: '昨天',
- onClick(picker) {
- const date = new Date();
- date.setTime(date.getTime() - 3600 * 1000 * 24);
- picker.$emit('pick', date);
- }
- }, {
- text: '一周前',
- onClick(picker) {
- const date = new Date();
- date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
- picker.$emit('pick', date);
- }
- }]
- },
- }
- },
- mounted() {
- this.gettaskList()
- },
- // created() {
- // this.gettaskList()
- // },
- methods: {
- handleSizeChange(val) {
- this.queryInfo.pageSize = val;
- console.log(`每页 ${val} 条`);
- this.gettaskList()
- },
- handleCurrentChange(val) {
- this.queryInfo.pageNum = val;
- console.log(`当前页: ${val}`);
- this.gettaskList()
- },
- add() {
- // this.$router.push('')
- },
- async gettaskList() {
- for (var key in this.queryInfo) {
- if (this.queryInfo[key] == '') {
- delete this.queryInfo[key]
- }
- }
- const {
- data: res
- } = await this.$http.post(
- "getCdTasks", this.queryInfo
- );
- console.log(res)
- this.tableData = res.data.rows
- this.total = res.data.total
- },
- // 搜索
- async searchData() {
- console.log(this.queryInfo)
- this.queryInfo.pageNum = 1
- this.gettaskList()
- },
- // 重置
- reset(){
- this.queryInfo={
- year:'',
- task_name:'',
- starttime:'',
- endtime:'',
- ispublic:'',
- pageSize:'',
- pageNum:1,
- task_class:'例行监测'
- }
- this.gettaskList()
- },
- async runtask(id) {
- console.log(id)
- this.$router.push({
- name: 'setTaskcd',
- params: {
- id: id
- }
- })
- },
- async up(id){
- this.$confirm('上报任务后不可撤回, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.$message({
- type: 'success',
- message: '任务上报成功!'
- });
- this.task_id = id
- this.uptask(task_id)
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消上报'
- });
- });
- },
- // 导出Excel
- async exportData() {
-
- // for (var key in this.exportInfo) {
- // if (this.exportInfo[key] == '') {
- // delete this.exportInfo[key]
- // }
- // }
- console.log(this.tableData)
- let exportList = []
- exportList = this.tableData
-
- for (let i = 0; i < exportList.length; i++) {
- if (exportList[i].level == '0') {
- exportList[i].level = '一般'
- } else if (exportList[i].level == '1') {
- exportList[i].level = '紧急'
- }else{
- exportList[i].level = '特急'
- }
- if (exportList[i].ispublic == '1') {
- exportList[i].ispublic = '已发布'
- } else if(exportList[i].ispublic == '2') {
- exportList[i].ispublic = '废止'
- }else if(exportList[i].ispublic == '3') {
- exportList[i].ispublic = '已结束,未完成'
- }else if(exportList[i].ispublic == '4') {
- exportList[i].ispublic = '已结束,已完成'
- }else if(exportList[i].ispublic == '5') {
- exportList[i].ispublic = '执行中'
- }
- }
- // 导出表格的表头设置
- // let allColumns = exportList
- var columnNames = []
- var columnValues = []
- // var columns = []
- require.ensure([], () => {
- const {
- export_json_to_excel
- } = require('@/vendor/Export2Excel.js')
-
- for (var i = 0; i < HeadersList.length; i++) {
- columnNames[i] = HeadersList[i].title
- columnValues[i] = HeadersList[i].key
- }
- const tHeader = columnNames
- const filterVal = columnValues
- // console.log(columns)
- const list = exportList
- const data = this.formatJson(filterVal, list)
- export_json_to_excel(tHeader, data, '例行监测任务')
-
- })
- },
- formatJson(filterVal, jsonData) {
- return jsonData.map(v => filterVal.map(j => v[j]))
- },
- },
- }
- </script>
- <style lang="less" scoped>
- .el-breadcrumb {
- margin-bottom: 20px;
- }
- .el-table {
- align-items: center;
- margin-top: 25px;
- }
- /deep/ .el-col {
- padding-right: 0 !important;
- }
- /deep/ .el-radio-group label {
- width: 180px;
- margin-right: 10px;
- }
- .el-pagination {
- margin-top: 25px;
- }
- // .el-cascader {
- // width: 290px;
- // }
- .el-select {
- width: 210px;
- height: 100%;
- }
- .select {
- display: flex;
- flex-direction: row;
- margin-left: 10px;
- }
- .dialogItem /deep/ .el-dialog__body {
- padding: 15px 12px 0;
- color: #606266;
- font-size: 14px;
- word-break: break-all;
- }
- .el-form-item {
- margin-bottom: 8px;
- padding-left: 18px;
- }
- .labelItem /deep/ .el-form-item__label {
- // width: 80px;
- text-align: center;
- vertical-align: middle;
- float: left;
- font-size: 13px;
- color: #606266;
- // line-height: 40px;
- padding: 0 2px 0 0;
- -webkit-box-sizing: border-box;
- box-sizing: border-box;
- }
- // .el-form-item__content{
- // margin-left: 0;
- // }
- </style>
|