马宇豪
2023-06-08 d081cdaabcb942298f1df374f6a1cd626741098f
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
<template>
    <div class="inner">
        <h2>预警信息发布</h2>
    <a-form-model :model="form" :wrapper-col="wrapperCol">
        <div class="left">
      <a-form-model-item prop="title">
              <a-input v-model="form.title" placeholder="请输入标题" style="height: 50px; font-size: 20px;" />
      </a-form-model-item>
<!--      <a-row>-->
<!--        <a-col :span="12" style="display: flex;align-items: center">-->
<!--          <span style="display: block;margin-bottom: 24px">相关灾种</span>-->
 
<!--        </a-col>-->
<!--        <a-col :span="12" style="display: flex;align-items: center;justify-content: right">-->
<!--          <span style="display: block;margin-bottom: 24px">预警级别:</span>-->
 
<!--        </a-col>-->
<!--      </a-row>-->
 
      <a-row>
        <a-col :span="12">
          <a-form-model-item prop="type">
            <a-radio-group v-model="form.type" default-value="a" button-style="solid">
              <a-radio-button value="a">
                常规
              </a-radio-button>
              <a-radio-button value="b">
                紧临
              </a-radio-button>
            </a-radio-group>
          </a-form-model-item>
        </a-col>
        <a-col :span="12" style="display: flex;align-items: center;justify-content: right">
          <a-form-model-item prop="riskType" style="margin-right: 20px">
            <a-select placeholder="请选择相关灾种" v-model="form.riskType" style="width: 240px" allowClear @change="handleRisk">
              <a-select-option v-for="item in riskOptions" :key="item.value" :value="item.value">
                {{ item.name }}
              </a-select-option>
            </a-select>
          </a-form-model-item>
          <a-form-model-item prop="level">
            <a-select placeholder="请选择预警级别" v-model="form.level" style="width: 240px" allowClear @change="handleLevel">
              <a-select-option v-for="item in levelOptions" :key="item.value" :value="item.value">
                {{ item.name }}
              </a-select-option>
            </a-select>
          </a-form-model-item>
        </a-col>
      </a-row>
      <a-form-model-item prop="message">
              <a-textarea v-model="form.message" placeholder="请输入短信通知内容部分" :auto-size="{ minRows: 3, maxRows: 5 }" />
      </a-form-model-item>
      <a-row>
        <a-col :span="12">
          <a-button>上传附件</a-button>
        </a-col>
        <a-col :span="12" style="display: flex;align-items: center;justify-content: right">
          <b style="margin-bottom: 24px">超时设置:</b>
          <a-form-model-item prop="overTime">
            <a-input v-model="form.overTime" style="width:200px;" placeholder="输入时间" suffix="分钟"/>
          </a-form-model-item>
        </a-col>
      </a-row>
            <span><b>发布单位:</b>{{department}}</span>
            <br/><br/>
            <!-- 子单位-->
      <a-row :gutter="24">
        <a-col :span="12">
                <b style="margin-bottom: 6px">选择接收单位:</b>
          <a-form-model-item prop="svalue">
            <a-tree-select
                show-search
                tree-checkable
                treeCheckStrictly
                style="width: 100%"
                v-model="form.svalue"
                :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
                placeholder="选择工作通知接收单位"
                allow-clear
                multiple
                tree-default-expand-all
                @change="onChanges"
                @search="onSearch"
                @select="onSelect"
              >
              <a-tree-select-node key="0" value="all" title="全选">
              </a-tree-select-node>
                <a-tree-select-node key="0-1" value="乌鲁木齐" title="乌鲁木齐(张XX 13268813610)">
                  <a-tree-select-node key="0-1-1" value="米东区" title="米东区(张XX 13268813610)">
                    <a-tree-select-node key="0-1-1-1" value="XX村1" title="XX村(李有田 13268813610)" />
                  </a-tree-select-node>
                  <a-tree-select-node key="0-1-2" value="天山区" title="天山区">
                    <a-tree-select-node key="0-1-2-1" value="XX村2">
                      <b slot="title" style="color: #08c">XX村</b>
                    </a-tree-select-node>
                  </a-tree-select-node>
                </a-tree-select-node>
            </a-tree-select>
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <b style="margin-bottom: 6px">平级接收人选择:</b>
          <a-form-model-item prop="sameDep">
            <a-select mode="multiple" placeholder="选择平级接收单位" v-model="form.sameDep" @change="handle">
              <a-select-option v-for="item in filteredOptions" :key="item" :value="item">
                {{ item }}
              </a-select-option>
            </a-select>
          </a-form-model-item>
        </a-col>
      </a-row>
<!--            <div>-->
<!--        <b>选择审批领导:</b> -->
<!--        <a-select show-search placeholder="请选择审批领导"-->
<!--                    option-filter-prop="children" style="width: 300px" :filter-option="filterOption"-->
<!--                    @focus="handleFocus" @blur="handleBlur" @change="handleChange">-->
<!--                    <a-select-option value="jack">-->
<!--                        裴小威-->
<!--                    </a-select-option>-->
<!--                    <a-select-option value="lucy">-->
<!--                        赵东升-->
<!--                    </a-select-option>-->
<!--                    <a-select-option value="tom">-->
<!--                        王卫萍-->
<!--                    </a-select-option>-->
<!--                </a-select>-->
<!--      </div>-->
      <div style="display: flex;justify-content: right">
        <a-button type="primary" style="width: 250px;">
          确认发送
        </a-button>
      </div>
        </div>
 
        <div class="right">
            <h2>短信预览</h2>
            <div class="mobile">
                <div class="mesg">
                    <P>【{{form.title}}】{{form.message}}。发布单位:{{department}}</P>
                </div>
 
            </div>
        </div>
    </a-form-model>
    </div>
</template>
 
<script>
 
    
    const OPTIONS = ['自治区消防(李XX)', '自治区公安厅(王XX)', '自治区自然资源厅(刘XX)'];
    export default {
        name: "release",
        data() {
            return {
                message: '',
                signname: '自然灾害风险预警提示',
                department: '自治区自然灾害综合监测预警中心',
        wrapperCol: { span: 24 },
        form: {
          title: '',
          riskType: 1,
          level: 1,
          type: 'a',
          svalue: undefined,
          sameDep: [],
          message: '',
          overTime: ''
        },
        riskOptions: [
          {name: '地震',value: 1},
          {name: '洪涝',value: 2},
          {name: '气象',value: 3},
          {name: '泥石流',value: 4},
          {name: '水旱',value: 5},
          {name: '森林草原火灾',value: 6}
        ],
        levelOptions: [
          {name: '红色预警',value: 1},
          {name: '橙色预警',value: 2},
          {name: '黄色预警',value: 3},
          {name: '蓝色预警',value: 4},
          {name: '其他短信通知',value: 5}
        ]
            };
        },
        components: {},
        computed: {
            filteredOptions() {
                return OPTIONS.filter(o => !this.form.sameDep.includes(o));
            },
        },
        methods: {
            //选择子部门部分
            onChanges(value) {
            if(value.find(i=>i.value == 'all')){
              console.log('全选了')
            }else{
              this.svalue = value;
            }
            console.log(this.svalue);
                },
      onSearch() {
        console.log(...arguments);
      },
      onSelect() {
        console.log(...arguments);
      },
            //选择平级部门部分
      handleRisk(selectedItems) {
        // this.selectedItems = selectedItems;
      },
      handleLevel(selectedItems) {
        // this.selectedItems = selectedItems;
      },
            handle(selectedItems) {
                // this.selectedItems = selectedItems;
            },
            onChange(){
                console.log(this.value)
            },
            handleChange(value) {
                console.log(`selected ${value}`);
            },
            handleBlur() {
                console.log('blur');
            },
            handleFocus() {
                console.log('focus');
            },
            filterOption(input, option) {
                return (
                    option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
                );
            },
        },
    }
</script>
 
<style lang="less" scoped>
    .left {
        width: 58%;
        float: left;
    }
 
    .right {
        width: 39%;
        float: right;
        border-left: 1px silver solid;
        padding-left: 18px;
 
        .mobile {
            position: relative;
            background: black;
            border: 1px solid black;
            width: 280px;
            min-height: 500px;
            border-radius: 25px;
            margin-left: 20px;
 
            .mesg {
                width: 260px;
                margin: 25px auto;
                min-height: 450px;
                background: white;
                padding-top: 10px;
 
                p {
                    padding: 15px;
                    background-color: #f5f5f5;
                    border-radius: 10px;
                    font-size: 16px;
                    margin: 15px 10px;
                }
            }
        }
 
    }
</style>