zouyu
2023-09-09 f2245cb7f6dfc7cd83ae257b235fc41e3c5cabab
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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
<template>
  <div class="content-main">
    <div class="top-bar">
      <el-form ref="form" :inline="true" style="margin-top: 10px;">
        <el-form-item>
          <el-date-picker
            size="small"
            v-model="input"
            class="input-form"
            type="month"
            placeholder="请选择查询日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button size="small" type="primary" @click="getData()">查询</el-button>
          <el-button size="small" type="primary" plain @click="resetData()">重置</el-button>
        </el-form-item>
      </el-form>
      <el-form class="rightBtn" style="margin-top: 10px;">
        <!-- 上传附件 -->
        <el-form-item class="createBtn">
          <el-button
            size="small"
            type="primary"
            icon="el-icon-upload2"
            @click="
              dialogFormVisible1 = true;
              uploading = {};
              resetForm('uploading');
            "
            >上传附件</el-button
          >
          <el-dialog
            title="上传附件"
            :visible.sync="dialogFormVisible1"
            width="30%"
          >
            <el-form :model="uploading" :rules="rules1" ref="uploading">
              <el-form-item
                label="审核日期:"
                :label-width="formLabelWidth1"
                prop="auditTime"
                style="margin-bottom: 20px"
              >
                <el-date-picker
                  class="uploading-form"
                  v-model="uploading.auditTime"
                  type="date"
                  placeholder="请选择日期"
                  autocomplete="off"
                >
                </el-date-picker>
              </el-form-item>
              <el-form-item
                prop="accessoryFile"
                label="上传附件:"
                :label-width="formLabelWidth1"
              >
                <el-input
                  class="uploading-form"
                  v-model="uploading.accessoryFile"
                  autocomplete="off"
                  placeholder="请选择文件"
                ></el-input>
              </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
              <el-button @click="dialogFormVisible1 = false">取 消</el-button>
              <el-button type="primary" @click="submitUp('uploading')"
                >确 定</el-button
              >
            </div>
          </el-dialog>
        </el-form-item>
        <!-- 新增计划 -->
        <el-form-item class="createBtn">
          <el-button
            size="small"
            type="primary"
            icon="el-icon-plus"
            @click="
              dialogFormVisible2 = true;
              newly = {};
              resetForm('newly');
            "
            >新增计划</el-button
          >
 
          <el-dialog
            title="新增计划"
            :visible.sync="dialogFormVisible2"
            width="55%"
          >
            <el-form :model="newly" :rules="rules2" ref="newly">
              <!-- 第一行 -->
              <el-row class="newly-margin-bottom">
                <el-col :span="12">
                  <el-form-item
                    label="计划时间:"
                    :label-width="formLabelWidth2"
                    prop="planTime"
                  >
                    <el-date-picker
                      class="newly-form"
                      v-model="newly.planTime"
                      type="date"
                      placeholder="请选择计划日期"
                      autocomplete="off"
                    >
                    </el-date-picker>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item
                    label="部门:"
                    :label-width="formLabelWidth2"
                    prop="department"
                  >
                    <el-input
                      class="newly-form"
                      v-model="newly.department"
                      placeholder="请选择部门"
                      autocomplete="off"
                    ></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <!-- 第二行 -->
              <el-row class="newly-margin-bottom">
                <el-col :span="12">
                  <el-form-item
                    label="性质:"
                    :label-width="formLabelWidth2"
                    prop="auditType"
                  >
                    <el-select
                      class="newly-form"
                      v-model="newly.auditType"
                      placeholder="请选择性质"
                      autocomplete="off"
                    >
                      <el-option label="内审" value="0"></el-option>
                      <el-option label="管理评审" value="1"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item
                    label="审核目的:"
                    :label-width="formLabelWidth2"
                    prop="auditPurpose"
                  >
                    <el-input
                      class="newly-form"
                      v-model="newly.auditPurpose"
                      placeholder="请输入审核目的"
                      autocomplete="off"
                    ></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <!-- 第三行 -->
              <el-row class="newly-margin-bottom">
                <el-col :span="12">
                  <el-form-item
                    label="审核组长:"
                    :label-width="formLabelWidth2"
                    prop="auditLeader"
                  >
                    <el-input
                      class="newly-form"
                      v-model="newly.auditLeader"
                      placeholder="请输入审核组长"
                      autocomplete="off"
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item
                    label="审核范围:"
                    :label-width="formLabelWidth2"
                    prop="auditScope"
                  >
                    <el-input
                      class="newly-form"
                      v-model="newly.auditScope"
                      placeholder="请输入审核范围"
                      autocomplete="off"
                    ></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <!-- 第四行 -->
              <el-row class="newly-margin-bottom">
                <el-col :span="12">
                  <el-form-item
                    label="组员:"
                    :label-width="formLabelWidth2"
                    prop="auditEmp"
                  >
                    <el-input
                      class="newly-form"
                      v-model="newly.auditEmp"
                      placeholder="请输入组员"
                      autocomplete="off"
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item
                    label="审核依据:"
                    :label-width="formLabelWidth2"
                    prop="auditPursuant"
                  >
                    <el-input
                      class="newly-form"
                      v-model="newly.auditPursuant"
                      placeholder="请输入审核依据"
                      autocomplete="off"
                    ></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <!-- 第五行 -->
              <el-row class="newly-margin-bottom">
                <el-col :span="12">
                  <el-form-item
                    label="编制人:"
                    :label-width="formLabelWidth2"
                    prop="writeUser"
                  >
                    <el-input
                      class="newly-form"
                      v-model="newly.writeUser"
                      placeholder="请输入编制人"
                      autocomplete="off"
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item
                    label="审核日期:"
                    :label-width="formLabelWidth2"
                  >
                    <el-date-picker
                      class="newly-form"
                      v-model="newly.auditTime"
                      type="date"
                      placeholder="请选择审核日期"
                      autocomplete="off"
                    >
                    </el-date-picker>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
            <div slot="footer" class="dialog-footer">
              <el-button @click="dialogFormVisible2 = false">取 消</el-button>
              <el-button type="primary" @click="submitAddData('newly')"
                >确 定</el-button
              >
            </div>
          </el-dialog>
        </el-form-item>
        <!-- 导出年度计划 -->
        <el-form-item class="createBtn">
          <el-button size="small" type="primary" icon="el-icon-document-checked"
            >导出年度计划</el-button
          >
        </el-form-item>
        <el-form-item class="createBtn">
          <el-button size="small" type="primary" icon="el-icon-document-checked"
            >导出内部实施计划</el-button
          >
        </el-form-item>
      </el-form>
    </div>
    <div class="library-table">
      <div class="table-box">
        <el-table
          ref="auditTable"
          border
          :max-height="660"
          :cell-style="{ textAlign: 'left' }"
          :header-cell-style="{
            border: '0px',
            background: '#f5f7fa',
            color: '#606266',
            boxShadow: 'inset 0 1px 0 #ebeef5',
            textAlign: 'left',
          }"
          :data="auditTable"
          style="width: 100%"
        >
          <el-table-column type="index" label="序号" min-width="30px">
            <template>
              <el-checkbox type="checkbox" />
            </template>
          </el-table-column>
          <el-table-column prop="year" label="年度" min-width="60px" />
          <el-table-column prop="month" label="月度" min-width="60px" />
          <el-table-column prop="planTime" label="计划时间" min-width="100px" />
          <el-table-column prop="auditType" label="性质" min-width="80px">
            <template slot-scope="scope">
              <span>
                {{ scope.row.auditType == 0 ? "内审" : "管理评审" }}
              </span>
            </template>
          </el-table-column>
          <el-table-column prop="department" label="部门" min-width="80px" />
          <el-table-column
            prop="auditLeader"
            label="审核组长"
            min-width="80px"
          />
          <el-table-column prop="auditEmp" label="组员" min-width="80px" />
          <el-table-column
            prop="auditPurpose"
            label="审核目的"
            min-width="100px"
          />
          <el-table-column
            prop="auditScope"
            label="审核范围"
            min-width="100px"
          />
          <el-table-column
            prop="auditPursuant"
            label="审核依据"
            min-width="100px"
          />
          <el-table-column prop="writeUser" label="编制人" min-width="80px" />
          <el-table-column prop="createTime" label="编制日期" min-width="100px">
          </el-table-column>
          <el-table-column prop="keyboarder" label="录入人" min-width="80px" />
          <el-table-column prop="checker" label="检验人" min-width="80px" />
          <el-table-column
            prop="auditTime"
            label="审核日期"
            min-width="100px"
          />
          <el-table-column prop="count" label="不符合项目数" min-width="60px" />
          <el-table-column prop="auditState" label="状态" min-width="100px">
            <template slot-scope="scope">
              <div v-if="scope.row.auditState === 0">
                <el-tag class="tag-item" type="warning">即将开始</el-tag>
              </div>
              <div v-else-if="scope.row.auditState === 1">
                <el-tag class="tag-item" type="success">完成</el-tag>
              </div>
              <div v-else>
                <el-tag class="tag-item" type="danger">逾期</el-tag>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="操作" min-width="100" fixed="right">
            <template slot-scope="scope">
              <el-button type="text" size="small">查看</el-button>
              <el-button
                type="text"
                size="small"
                @click="deleteClick(scope.row.id)"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>
        <!-- 分页器 -->
        <div>
          <el-pagination
            :current-page="page"
            :page-sizes="[10, 20, 30, 40]"
            :page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
          />
        </div>
      </div>
    </div>
  </div>
</template>
 
<script>
import {
  selectAllList,
  addCnasAnnualPlan,
  addAccessory,
  deleteCnasAnnualPlan,
} from "@/api/CNAS/reviewAnnualPlan";
import { P } from "af-table-column";
export default {
  data() {
    return {
      input: "",
      auditTable: [],
      page: 1,
      total: 0,
      pageSize: 10,
      dialogFormVisible1: false,
      dialogFormVisible2: false,
      formLabelWidth1: "80px",
      formLabelWidth2: "80px",
      //上传附件参数
      uploading: {
        auditTime: "",
        //====================文件上传还没做,此处是应是文件参数,暂时还是文本
        accessoryFile: "",
      },
      rules1: {
        auditTime: [
          {
            type: "date",
            required: true,
            message: "请选择日期",
            trigger: "blur",
          },
        ],
        accessoryFile: [
          { required: true, message: "请输入活动名称", trigger: "blur" },
          { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" },
        ],
      },
      //新增计划对象
      newly: {
        planTime: "",
        auditType: "",
        department: "",
        auditPurpose: "",
        auditLeader: "",
        auditEmp: "",
        auditPursuant: "",
        auditScope: "",
        writeUser: "",
        auditTime: "",
      },
      rules2: {
        planTime: [
          {
            type: "date",
            required: true,
            message: "请选择日期",
            trigger: "blur",
          },
        ],
        auditType: [
          { required: true, message: "请选择性质", trigger: "change" },
        ],
        department: [
          { required: true, message: "请输入部门", trigger: "blur" },
          { min: 1, max: 25, message: "字数过长", trigger: "blur" },
        ],
        auditPurpose: [
          { required: true, message: "请输入审核目的", trigger: "blur" },
          { min: 1, max: 25, message: "字数过长", trigger: "blur" },
        ],
        auditLeader: [
          { required: true, message: "请输入审核组长", trigger: "blur" },
          { min: 1, max: 25, message: "字数过长", trigger: "blur" },
        ],
        auditEmp: [
          { required: true, message: "请输入组员", trigger: "blur" },
          { min: 1, max: 25, message: "字数过长", trigger: "blur" },
        ],
        auditPursuant: [
          { required: true, message: "请输入审核依据", trigger: "blur" },
          { min: 1, max: 25, message: "字数过长", trigger: "blur" },
        ],
        auditScope: [
          { required: true, message: "请输入审核范围", trigger: "blur" },
          { min: 1, max: 5, message: "字数过长", trigger: "blur" },
        ],
        writeUser: [
          { required: true, message: "请输入编制人", trigger: "blur" },
          { min: 1, max: 25, message: "字数过长", trigger: "blur" },
        ],
      },
    };
  },
  created() {
    this.getData();
  },
  methods: {
    //====================================================上传附件
    //上传附件字段确认
    submitUp(uploading) {
      this.$refs[uploading].validate((valid) => {
        if (!valid) {
          return false;
        } else {
          //   this.upData();
        }
      });
    },
    // //上传附件
    // async upData() {
    //   try {
    //     const res = await addAccessory(this.uploading);
    //     console.log(res);
    //   } catch (error) {
    //     this.$message.error("添加失败");
    //   }
    //   this.resetData();
    //   this.dialogFormVisible1 = false;
    // },
 
    //新增计划字段确认
    submitAddData(newly) {
      this.$refs[newly].validate((valid) => {
        if (!valid) {
          return false;
        } else {
          this.addData();
        }
      });
    },
    //新增计划
    async addData() {
      try {
        const res = await deleteCnasAnnualPlan(this.newly);
      } catch (error) {
        this.$message.error("添加失败");
      }
      this.getData();
      this.dialogFormVisible2 = false;
    },
    // 每页条数改变时触发 选择一页显示多少行
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.pageSize = val;
      this.getData();
    },
    // 当前页改变时触发 跳转其他页
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.page = val;
      this.getData();
    },
    // 重置按钮
    resetData() {
      this.input = undefined;
      this.page = 1;
      this.pageSize = 10;
      this.getData();
    },
    // 查询列表
    async getData() {
      const params = {
        page: this.page,
        pageSize: this.pageSize,
        planTime: this.input ? this.input : undefined,
      };
      const { data } = await selectAllList(params);
      this.auditTable = data.row;
      this.total = data.total;
    },
    async deleteOneData(planId) {
      await deleteCnasAnnualPlan({ planId: planId });
      this.getData();
      console.log(planId);
    },
 
    deleteClick(planId) {
      this.$confirm("确认删除?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
      }).then(() => {
        this.deleteOneData(planId);
      });
    },
    //重置表单
    resetForm(formName) {
      this.$refs[formName].resetFields();
    },
  },
};
</script>
 
<style lang="scss" scoped>
.top-bar {
  margin: -25px -15px;
  background: #fff;
  display: flex;
  justify-content: space-between;
  padding: 5px 24px 0px 24px;
  .input-form {
    width: 400px;
  }
  .uploading-form {
    // margin-bottom: 20px;
    width: 400px;
  }
  .newly-form {
    // margin-bottom: 20px;
    width: 400px;
  }
  .newly-margin-bottom {
    margin-bottom: 23px;
  }
}
 
.library-table {
  height: 80vh;
  background-color: #fff;
  flex: 1;
  margin: 0px -15px;
  margin-top: 40px;
  display: flex;
  flex-direction: column;
 
  .table-box {
    padding: 0px 20px;
    margin-top: 20px;
    flex: 1;
    background: #fff;
    display: flex;
    flex-direction: column;
    > div:nth-child(2) {
      display: flex;
      justify-content: end;
      margin: 10px 0;
    }
    .tag-item {
      width: 80px;
    }
  }
}
.rightBtn {
  display: flex;
  justify-content: flex-end;
}
.createBtn {
  margin-left: 10px;
}
</style>