鲁班七号
2023-05-22 83d52c58d6717a2233e1b04e22769f58afcbf20b
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
165
166
167
168
169
170
171
172
173
174
175
<template>
  <div class="inner">
      <a-radio-group v-model="category">
          <a-radio-button value="default">
              全部
          </a-radio-button>
          <a-radio-button value="1">
              已审核
          </a-radio-button>
          <a-radio-button value="2">
              未审核
          </a-radio-button>
      </a-radio-group>
      <div style="float:right">
          时间区间筛选:<a-range-picker :placeholder="['开始时间', '结束时间']" @change="onChange" />
      </div>
      <br/><br/>
      <!-- 表格实体部分-->
      <a-table :columns="columns" :data-source="data" bordered>
          <span slot="level" slot-scope="text">
              <a-tag :color="text === '黄色' ? 'yellow' :text === '橙色'? 'orange':text === '红色'?'red':'blue'">
                  {{ text }}
              </a-tag>
          </span>
          <template slot="attachment" slot-scope="text">
              <span v-if="text==='无'">无</span>
              <a v-else><b><a-icon type="paper-clip" /> {{text}}</b></a>
          </template >
          <template slot="operation" slot-scope="text, record, index">
              <div class="editable-row-operations">
                <a-button v-if="record.audit==='已审核'" type="primary" @click="showModal(record.id)" >
                    确认发布</a-button>&nbsp;&nbsp;
                  <router-link :to="{path:'/details',query: {id: record.id}}">信息详情</router-link>
                &nbsp;&nbsp;<a style="color:red">删除</a>
              </div>
          </template>
      </a-table>
      <!-- 对话框 -->
      <a-modal title="信息发布" 
      okText="确认发布"
      cancelText="取消"
      :visible="visible" :confirm-loading="confirmLoading" @ok="handleOk" @cancel="handleCancel">
      <p>确认发布 “[{{show_id}}]2023年5月23日,全疆黄色高温预警信息”?</p>
      </a-modal>
  </div>
</template>
<script>
    const columns = [{
            title: '编号',
            dataIndex: 'id',
            width: '8%',
        },
        {
            title: '提交审核时间',
            dataIndex: 'time',
            width: '13%',
            scopedSlots: {
                customRender: 'time'
            }, //设置定制化表格数据
        },
        {
            title: '发布单位',
            dataIndex: 'department',
            width: '12%',
        },
        {
            title: '类别',
            dataIndex: 'category',
            width: '6%',
        },
        {
            title: '级别',
            dataIndex: 'level',
            scopedSlots: {
                customRender: 'level'
            }, //设置定制化表格数据
            width: '6%',
        },
        {
            title: '信息标题',
            dataIndex: 'title',
            width: '16%',
        },
        {
            title: '附件',
            dataIndex: 'attachment',
            width: '6%',
            scopedSlots: {
                customRender: 'attachment'
            },
        },
        {
            title: '审核情况',
            dataIndex: 'audit',
            width: '10%',
            scopedSlots: {
                customRender: 'audit'
            }, //设置定制化表格数据
        },
        {
            title: '操作',
            dataIndex: 'operation',
            scopedSlots: {
                customRender: 'operation'
            },
        },
    ];
    const data = [{
            key: 1,
            id:1001,
            readed:false,
            time: '2023年5月3日 15:30',
            department: '自治区预警中心',
            category: '气象',
            level: '黄色',
            title: '全疆高温红色预警',
            attachment: '1',
            audit: '已审核'
        },
        {
                key: 2,
                id:1002,
                readed:false,
                time: '2023年5月3日 15:30',
                department: '自治区预警中心',
                category: '气象',
                level: '黄色',
                title: '全疆高温红色预警',
                attachment: '1',
                audit: '未审核'
            },{
                key: 3,
                id:1003,
                readed:false,
                time: '2023年5月3日 15:30',
                department: '自治区预警中心',
                category: '气象',
                level: '黄色',
                title: '全疆高温红色预警',
                attachment: '1',
                audit: '已审核'
            }]
    export default {
        data() {
            return {
                category: 'default',
                data,
                columns,
                visible: false,
                confirmLoading: false,
                show_id:''
            }
        },
        methods: {
            showModal(id) {
                this.visible = true;
                this.show_id=id
            },
            //确认发布
            handleOk(e) {
                this.ModalText = '正在发布,请稍候...';
                this.confirmLoading = true;
                setTimeout(() => {
                    this.visible = false;
                    this.confirmLoading = false;
                }, 2000);
            },
            handleCancel(e) {
                this.visible = false;
            },
 
        }
        }
        
</script>