duhuizhe
2023-10-16 3aa55dd3f62cee2c1c4c0aa74e1570acf83f8927
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<template>
  <div class="app-container">
    <el-card class="box-card" style="width: 100%;margin-top: 15px" shadow="never">
      <!--搜索条件-->
      <div class="filter-container">
        <my-search ref="searchBar" :items="items" @search="fifterForm"></my-search>
      </div>
      <el-row style="margin-top: 8px">
        <el-col>
          <!--列表-->
          <my-table ref="myTable" :filter="filterFrom" :table="table"/>
        </el-col>
      </el-row>
    </el-card>
    <!-- 详情 -->
    <detail v-if="detailShow" :setting="setting" @close="detailShow=false"></detail>
  </div>
</template>
 
<script>
import MyTable from "@/components/myTable/myTable";
import SettingIplatform from '@/utils/settingIplatform';
import items from './items'
import detail from  '@/views/projectManage/information/detail'
import * as cancel from '@/api/projectManage/cancel'
import * as DateFormatter from "@/utils/DateFormatter";
export default {
  name: "index",
  components: { MyTable,detail },
  data() {
    return {
      // 搜索框
      items: items,
      // 搜索条件
      filterFrom: {
        projectName: null,  // 项目总数
        projectCode: null, // 项目编号
        projectCategoryId: null, // 分类
        buildOrgId: null, // 建设单位
        archiveStatus: null, // 类型  0 未归档 1 审核中 2 已归档
        approvalDate: null, // 批复时间
        createTime: null // 创建时间
      },
      setting:{
        id:null,
        title:'详情'
      },
      detailShow:false,// 详情
      // 表格数据
      table: {
        showIndex: true, // 是否显示序号
        expand: false, // 是否显示详情数据
        url: SettingIplatform.apiBaseURL + '/pc/p/project/info/cancel/list', // 请求地址
        // 工具条
        tools: {
          columnsCtrl: {// 列控制按钮
            show: false
          },
          generalExport: {// 通用导出按钮
            show: false
          },
          // 自定义工具条按钮
          custom: []
        },
        // 列信息
        columns: [
          {title: '项目名称', field: 'projectName', align: 'left',width: '240px'},
          {title: '编号', field: 'projectCode', align: 'center', width: '180px'},
          {title: '分类', field: 'projectCategoryName', align: 'center', width: '150px'},
          {title: '建设单位', field: 'buildOrgName', align: 'center', width: '200px'},
          {title: '批复时间', field: 'approvalDate', align: 'center', width: '180px',
            formatter: row => {
              return { value: DateFormatter.LongToDate(row.approvalDate) }
            }
          },
          {title: '创建时间', field: 'createTime', align: 'center', width: '180px',
            formatter: row => {
              return { value: DateFormatter.LongToDateTime(row.createTime) }
            }
          },
          {
            title: '状态', field: 'cancelStatus', align: 'center', width: '120px',
            formatter: row => {
              return {value: row.cancelStatus === 0 ? '未取消' :'已取消'}
            }
          },
        ],
        // 操作信息
        operation: {
          width: 180,
          align:'center',
          show: true, // 显示操作列
          attr: [
            {
              title: '取消',
              events: row => {
                this.$confirm('确认要取消吗?', {
                  type: 'warning'
                }).then(() => {
                  this.$message.success('取消成功')
                  this.qx(row.id)
                  this.search()
                })
              },
              hidden:(row) => {
                return row.cancelStatus !== 0
              }
            },
            {
              title: '详情',
              events: row => {
                this.showDetail(row.id)
              }
            }
          ]
        },
        paging: {
          show: true, // 显示分页
          // 分页信息
          page: {
            small: false,
            pageNum: 1,
            pageSize: 10,
            total: 0
          }
        }
      },
    }
  },
  methods:{
    showDetail(id){
      this.setting = {
        id,
        title:'项目详情'
      }
      this.detailShow = true
    },
    // 查询table列表
    search(pageNum) {
      if (pageNum != undefined) {
        this.$refs.myTable.search(pageNum)
      } else {
        this.$refs.myTable.search()
      }
    },
    fifterForm(params) {
      this.filterFrom = Object.assign(this.filterFrom, params)
      this.search(1)
    },
    // 取消
    qx(id){
      let data = {id:id}
      cancel.cancelSave(data).then(res=>{
        this.$message.success('已取消')
        this.search(1)
      })
    },
  }
}
</script>
 
<style scoped>
 
</style>