Blame view

src/views/baseSpecialAction/Form.vue 12.3 KB
4424f41c   monkeyhouyi   网信执法、清单管理静态页面
1
  <template>
93186f57   monkeyhouyi   前端整改页面
2
3
4
5
6
7
    <el-dialog
      :title="!dataForm.id ? '新建' : isDetail ? '详情' : '编辑'"
      :close-on-click-modal="false"
      :visible.sync="visible"
      class="NCC-dialog NCC-dialog_center"
      lock-scroll
5a14192c   monkeyhouyi   1
8
      width="50%"
93186f57   monkeyhouyi   前端整改页面
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    >
      <el-row :gutter="15" style="padding-top: 10px">
        <el-form
          ref="elForm"
          :model="dataForm"
          size="small"
          label-width="100px"
          label-position="right"
          :disabled="!!isDetail"
          :rules="rules"
        >
          <el-col :span="23" v-if="false">
            <el-form-item label="主键" prop="id">
              <el-input
                v-model="dataForm.id"
                placeholder="请输入"
                clearable
                :style="{ width: '100%' }"
              >
              </el-input>
            </el-form-item>
          </el-col>
ce1de261   monkeyhouyi   专项行动
31
          <el-col :span="23" v-if="ncc.hasFormP('title') && !dataForm.id">
93186f57   monkeyhouyi   前端整改页面
32
33
34
35
36
37
38
39
40
41
42
            <el-form-item label="标题" prop="title">
              <el-input
                v-model="dataForm.title"
                placeholder="请输入"
                clearable
                required
                :style="{ width: '100%' }"
              >
              </el-input>
            </el-form-item>
          </el-col>
ce1de261   monkeyhouyi   专项行动
43
44
45
46
47
48
49
50
          <el-col :span="23" v-if="ncc.hasFormP('content') && !dataForm.id">
            <el-form-item label="内容" prop="content">
              <el-input v-model="dataForm.content" placeholder="请输入" show-word-limit :style="{ width: '100%' }"
                type="textarea" :autosize="{ minRows: 4, maxRows: 4 }">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="23" v-if="ncc.hasFormP('annex') && !dataForm.id">
93186f57   monkeyhouyi   前端整改页面
51
52
53
54
55
56
57
58
59
60
61
            <el-form-item label="附件" prop="annex">
              <NCC-UploadFz
                v-model="dataForm.annex"
                :fileSize="5"
                sizeUnit="MB"
                :limit="9"
                buttonText="点击上传"
              >
              </NCC-UploadFz>
            </el-form-item>
          </el-col>
5a14192c   monkeyhouyi   1
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
          <el-col :span="23" v-if="ncc.hasFormP('recordCommunicationArea') && !dataForm.id">
            <el-form-item label="台账区域" prop="recordCommunicationArea">
              <el-checkbox-group v-model="dataForm.recordCommunicationArea" :style="{}">
                <el-checkbox
                  v-for="(item, index) in areaOptions"
                  :key="index"
                  :label="item.id"
                  >{{ item.fullName }}</el-checkbox
                >
              </el-checkbox-group>
              <div style="margin-top: 10px">
                <el-button size="mini" @click="selectAreaAll('area')">全选</el-button>
                <el-button size="mini" @click="closeAreaAll('area')">反选</el-button>
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="23" v-if="ncc.hasFormP('recordCommunicationOut') && !dataForm.id">
            <el-form-item label="台账外协" prop="recordCommunicationOut">
              <el-checkbox-group v-model="dataForm.recordCommunicationOut" :style="{}">
                <el-checkbox
                  v-for="(item, index) in communicationOutOptions"
                  :key="index"
                  :label="item.id"
                  >{{ item.fullName }}</el-checkbox
                >
              </el-checkbox-group>
              <div style="margin-top: 10px">
                <el-button size="mini" @click="selectAreaAll">全选</el-button>
                <el-button size="mini" @click="closeAreaAll">反选</el-button>
              </div>
            </el-form-item>
          </el-col>
ce1de261   monkeyhouyi   专项行动
94
          <el-col :span="23" v-if="ncc.hasFormP('communicationArea') && dataForm.id">
93186f57   monkeyhouyi   前端整改页面
95
96
97
98
99
100
101
102
103
104
            <el-form-item label="传达区域" prop="communicationArea">
              <el-checkbox-group v-model="dataForm.communicationArea" :style="{}">
                <el-checkbox
                  v-for="(item, index) in areaOptions"
                  :key="index"
                  :label="item.id"
                  >{{ item.fullName }}</el-checkbox
                >
              </el-checkbox-group>
              <div style="margin-top: 10px">
ce1de261   monkeyhouyi   专项行动
105
106
                <el-button size="mini" @click="selectAreaAll('area')">全选</el-button>
                <el-button size="mini" @click="closeAreaAll('area')">反选</el-button>
93186f57   monkeyhouyi   前端整改页面
107
108
109
              </div>
            </el-form-item>
          </el-col>
ce1de261   monkeyhouyi   专项行动
110
111
112
          <el-col :span="23" v-if="ncc.hasFormP('communicationOut') && dataForm.id">
            <el-form-item label="传达外协" prop="communicationOut">
              <el-checkbox-group v-model="dataForm.communicationOut" :style="{}">
93186f57   monkeyhouyi   前端整改页面
113
                <el-checkbox
ce1de261   monkeyhouyi   专项行动
114
                  v-for="(item, index) in communicationOutOptions"
93186f57   monkeyhouyi   前端整改页面
115
116
117
118
119
                  :key="index"
                  :label="item.id"
                  >{{ item.fullName }}</el-checkbox
                >
              </el-checkbox-group>
ce1de261   monkeyhouyi   专项行动
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
              <div style="margin-top: 10px">
                <el-button size="mini" @click="selectAreaAll">全选</el-button>
                <el-button size="mini" @click="closeAreaAll">反选</el-button>
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="23" v-if="ncc.hasFormP('relationId') && dataForm.id">
            <el-form-item label="填报表单" prop="relationId">
              <el-select v-model="dataForm.relationId" placeholder="请选择专项行动填报表单" style="margin-right: 10px;width: 300px;">
                <el-option v-for="item in BaseList" :key="item.id" :label="item.fullName" :value="item.id">
                </el-option>
              </el-select>
              <el-button size="mini" type="text" @click="dialogVisible = true">没有找到表单?点击设计表单</el-button>
            </el-form-item>
          </el-col>
          <el-col :span="23" v-if="ncc.hasFormP('deadline') && dataForm.id">
            <el-form-item label="截止日期" prop="deadline">
              <el-date-picker
                v-model="dataForm.deadline"
                type="date"
                placeholder="选择截止日期">
              </el-date-picker>
93186f57   monkeyhouyi   前端整改页面
142
143
144
145
146
147
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button @click="visible = false">取 消</el-button>
2201a66b   monkeyhouyi   专项性行动-首页联动
148
        <el-button type="primary" @click="dataFormSubmit()" v-if="!isDetail" :loading="btnLoading">确 定</el-button>
93186f57   monkeyhouyi   前端整改页面
149
      </span>
ce1de261   monkeyhouyi   专项行动
150
151
152
153
154
155
156
157
158
      <el-dialog class="zxDialog" title="专项行动表单设计" :visible.sync="dialogVisible" fullscreen @close="handleClose" :modal="false">
        <iframe 
          :src="nestedPageUrl" 
          width="100%" 
          :height="viewportHeight - 58 + 'px'" 
          frameborder="0" 
          allowfullscreen>
        </iframe>
      </el-dialog>
93186f57   monkeyhouyi   前端整改页面
159
    </el-dialog>
4424f41c   monkeyhouyi   网信执法、清单管理静态页面
160
161
  </template>
  <script>
93186f57   monkeyhouyi   前端整改页面
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
  import request from "@/utils/request";
  import { getDictionaryDataSelector } from "@/api/systemData/dictionary";
  import { previewDataInterface } from "@/api/systemData/dataInterface";
  export default {
    components: {},
    props: [],
    data() {
      return {
        loading: false,
        visible: false,
        isDetail: false,
        dataForm: {
          id: "",
          id: undefined,
          specialActionType: undefined,
          title: undefined,
          content: undefined,
          releaseTime: undefined,
5a14192c   monkeyhouyi   1
180
181
          recordCommunicationOut: [],
          recordCommunicationArea: [],
93186f57   monkeyhouyi   前端整改页面
182
183
          annex: [],
          communicationArea: [],
ce1de261   monkeyhouyi   专项行动
184
          communicationOut: [],
93186f57   monkeyhouyi   前端整改页面
185
186
187
188
189
          state: undefined,
          creatorUserId: undefined,
          creatorTime: undefined,
          lastModifyUserId: undefined,
          lastModifyTime: undefined,
ce1de261   monkeyhouyi   专项行动
190
          deadline: undefined,
2201a66b   monkeyhouyi   专项性行动-首页联动
191
          relationId: undefined,
93186f57   monkeyhouyi   前端整改页面
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
        },
        rules: {
          specialActionType: [
            {
              required: true,
              message: "请输入类型",
              trigger: "change",
            },
          ],
          title: [
            {
              required: true,
              message: "请输入标题",
              trigger: "blur",
            },
          ],
ce1de261   monkeyhouyi   专项行动
208
209
210
211
212
213
          deadline: [
            {
              required: true,
              message: "请输入截止日期",
              trigger: "change",
            }
2201a66b   monkeyhouyi   专项性行动-首页联动
214
215
216
217
218
219
220
          ],
          relationId: [
            {
              required: true,
              message: "请选择关联表单",
              trigger: "change",
            }
ce1de261   monkeyhouyi   专项行动
221
          ]
93186f57   monkeyhouyi   前端整改页面
222
223
        },
        areaOptions: [],
ce1de261   monkeyhouyi   专项行动
224
225
226
227
228
        communicationOutOptions: [],
        BaseList:[],
        viewportHeight: 0,
        nestedPageUrl:"http://8.130.38.56:8043/old/#/onlineDev/webDesign/indexNew",
        dialogVisible: false,
2201a66b   monkeyhouyi   专项性行动-首页联动
229
        btnLoading: false
93186f57   monkeyhouyi   前端整改页面
230
231
232
233
234
235
      };
    },
    computed: {},
    watch: {},
    created() {
      this.initAreaTypeList();
ce1de261   monkeyhouyi   专项行动
236
237
238
239
240
      this.initCommunicationOutOptions();
      this.updateViewportHeight();
      this.getDataForm();
        // 监听窗口大小变化事件
        window.addEventListener('resize', this.updateViewportHeight);
93186f57   monkeyhouyi   前端整改页面
241
242
    },
    mounted() {},
ce1de261   monkeyhouyi   专项行动
243
244
245
246
    beforeDestroy() {
      // 移除窗口大小变化事件监听器
      window.removeEventListener('resize', this.updateViewportHeight);
    },
93186f57   monkeyhouyi   前端整改页面
247
    methods: {
ce1de261   monkeyhouyi   专项行动
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
      updateViewportHeight() {
        // 获取页面显示高度
        this.viewportHeight = window.innerHeight || document.documentElement.clientHeight;
      },
      handleClose() {
        // 这里是对话框关闭后需要执行的代码
        this.getDataForm();
        // 例如,你可以在这里添加任何其他的逻辑
      },
       //查询表单
       getDataForm() {
        request({
          url: "/visualdev/Base?type=1",
          method: "get",
        }).then((res) => {
          this.BaseList = res.data.list[0].children;
          console.log(this.BaseList)
        });
      },
93186f57   monkeyhouyi   前端整改页面
267
268
269
270
271
      async initAreaTypeList() {
        let list = this.$store.state.meta.area;
        !list && (list = await this.$store.dispatch("getTypeListByCode", "area"));
        this.areaOptions = list;
      },
ce1de261   monkeyhouyi   专项行动
272
273
274
275
      async initCommunicationOutOptions() {
        let list = this.$store.state.meta.externalAssistanceList;
        !list && (list = await this.$store.dispatch("getTypeListByCode", "externalAssistance"));
        this.communicationOutOptions = list;
93186f57   monkeyhouyi   前端整改页面
276
      },
ce1de261   monkeyhouyi   专项行动
277
278
279
280
281
282
283
284
285
286
287
      // 全选
      selectAreaAll(type) {
        if(type == 'area') {
          this.dataForm.communicationArea = this.areaOptions.map(
            (option) => option.id
          );
        } else {
          this.dataForm.communicationOut = this.communicationOutOptions.map(
            (option) => option.id
          );
        }
93186f57   monkeyhouyi   前端整改页面
288
      },
ce1de261   monkeyhouyi   专项行动
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
      // 反选
      closeAreaAll(type) {
        if(type == 'area') {
          this.dataForm.communicationArea = this.areaOptions
            .filter(
              (option) => !this.dataForm.communicationArea.includes(option.id)
            )
            .map((option) => option.id);
        } else {
          this.dataForm.communicationOut = this.communicationOutOptions
            .filter(
              (option) => !this.dataForm.communicationOut.includes(option.id)
            )
            .map((option) => option.id);
        }
      },
     
93186f57   monkeyhouyi   前端整改页面
306
307
308
309
310
311
312
313
314
      goBack() {
        this.$emit("refresh");
      },
      init(id, isDetail) {
        this.dataForm.id = id || 0;
        this.visible = true;
        this.isDetail = isDetail || false;
        this.$nextTick(() => {
          this.$refs["elForm"].resetFields();
93186f57   monkeyhouyi   前端整改页面
315
316
317
318
319
        });
      },
      dataFormSubmit() {
        this.$refs["elForm"].validate((valid) => {
          if (valid) {
2201a66b   monkeyhouyi   专项性行动-首页联动
320
            this.btnLoading = true;
93186f57   monkeyhouyi   前端整改页面
321
            if (!this.dataForm.id) {
ce1de261   monkeyhouyi   专项行动
322
323
              let {title, content} = this.dataForm;
              // 新增
93186f57   monkeyhouyi   前端整改页面
324
325
326
              request({
                url: `/Extend/BaseSpecialAction`,
                method: "post",
ce1de261   monkeyhouyi   专项行动
327
                data: { title, content },
93186f57   monkeyhouyi   前端整改页面
328
329
330
331
332
333
              }).then((res) => {
                this.$message({
                  message: res.msg,
                  type: "success",
                  duration: 1000,
                  onClose: () => {
2201a66b   monkeyhouyi   专项性行动-首页联动
334
                    this.btnLoading = false;
93186f57   monkeyhouyi   前端整改页面
335
336
337
                    (this.visible = false), this.$emit("refresh", true);
                  },
                });
2201a66b   monkeyhouyi   专项性行动-首页联动
338
              }).catch(() => this.btnLoading = false);
93186f57   monkeyhouyi   前端整改页面
339
            } else {
ce1de261   monkeyhouyi   专项行动
340
              // 发布任务
93186f57   monkeyhouyi   前端整改页面
341
              request({
ce1de261   monkeyhouyi   专项行动
342
                url: "/Extend/BaseSpecialAction/Release",
93186f57   monkeyhouyi   前端整改页面
343
344
345
346
347
348
349
350
                method: "PUT",
                data: this.dataForm,
              }).then((res) => {
                this.$message({
                  message: res.msg,
                  type: "success",
                  duration: 1000,
                  onClose: () => {
2201a66b   monkeyhouyi   专项性行动-首页联动
351
                    this.btnLoading = false;
93186f57   monkeyhouyi   前端整改页面
352
353
354
355
                    this.visible = false;
                    this.$emit("refresh", true);
                  },
                });
2201a66b   monkeyhouyi   专项性行动-首页联动
356
              }).catch(() => this.btnLoading = false);
93186f57   monkeyhouyi   前端整改页面
357
358
359
360
361
362
            }
          }
        });
      },
    },
  };
4424f41c   monkeyhouyi   网信执法、清单管理静态页面
363
  </script>
ce1de261   monkeyhouyi   专项行动
364
365
366
367
368
369
370
  <style lang="scss" scoped>
  .el-dialog__wrapper.zxDialog {
    :deep(.el-dialog__body) {
      max-height: unset;
    }
  }
  </style>