Blame view

admin-web-master/src/components/add/addmb.vue 18.4 KB
f692f3a5   wesley88   1
1
2
  <template>
    <div>
6abe0316   wesley88   1
3
4
      <TitleWithCircle title="模版" style="margin-bottom: 20px;" />
      <el-form :model="forminfo" :rules="rulesmb" ref="ruleForm1" label-width="130px" class="demo-ruleForm">
f692f3a5   wesley88   1
5
        <el-row :gutter="20">
6abe0316   wesley88   1
6
7
8
          <el-col :span="12" >
            <el-form-item label="模版名称" prop="templateName">
              <el-input v-model="forminfo.templateName" placeholder="请输入" maxlength="20"></el-input>
f692f3a5   wesley88   1
9
10
            </el-form-item>
          </el-col>
6abe0316   wesley88   1
11
12
13
14
15
          <el-col :span="12" style="display: flex;align-items: center;">
            <el-form-item label="word模板" prop="templateAttachment" :style="forminfo.templateAttachment?'width: 100%;':''">
              <upfile :accept="'.docx,.doc'" filePath="mb" inputtype="templateAttachment" :value="forminfo.templateAttachment"
                @changimg="e=>changimg(e,'templateAttachment')"></upfile>
               
f692f3a5   wesley88   1
16
            </el-form-item>
6abe0316   wesley88   1
17
            <div v-if="!forminfo.templateAttachment" class="greens tableBtn iterem" @click.stop="openfile($baseURL+'/zsfwzxt/mb/fa0cc984-e1ac-474e-a579-89ea79cc9b8e-ces合同.docx')">模版文件</div>
f692f3a5   wesley88   1
18
19
20
          </el-col>
        </el-row>
      </el-form>
6abe0316   wesley88   1
21
22
23
24
25
      <TitleWithCircle title="合同信息" style="margin-bottom: 20px;" />
      <mbadd :list1="list2" :iscopy="true"/>
      <TitleWithCircle title="其他信息管理" />
      <div style="margin-left: 65px;margin-top: 20px;margin-bottom: 20px;">
        <el-button  @click="mingShow()" style="background-color: #3F9B6A;color: #fff;">添加</el-button>
f692f3a5   wesley88   1
26
      </div>
6abe0316   wesley88   1
27
      <mbadd :list1="list1" :iscopy="true"/>
f692f3a5   wesley88   1
28
29
      <div style="margin-top: 20px;margin-left: 65px;">
        <div style="padding: 0px 20px 0px 0px">
6abe0316   wesley88   1
30
          <el-table :data="list1"
f692f3a5   wesley88   1
31
32
33
34
35
36
37
38
            :header-cell-style="{fontSize: '14px',color:'#0009',fontWeight: 'normal',backgroundColor:'#F2F3F5'}">
            <el-table-column label="字段排序">
              <template slot-scope="scope">
                {{scope.$index + 1}}
              </template>
            </el-table-column>
            <el-table-column prop="notes" label="字段名称">
              <template slot-scope="scope">
6abe0316   wesley88   1
39
                {{scope.row.name?scope.row.name : '-'}}
f692f3a5   wesley88   1
40
41
42
43
              </template>
            </el-table-column>
            <el-table-column prop="notes" label="字段key">
              <template slot-scope="scope">
6abe0316   wesley88   1
44
                {{scope.row.key?scope.row.key : '-'}}
f692f3a5   wesley88   1
45
46
47
48
              </template>
            </el-table-column>
            <el-table-column prop="notes" label="字段类型">
              <template slot-scope="scope">
6abe0316   wesley88   1
49
                {{scope.row.type?scope.row.type : '-'}}
f692f3a5   wesley88   1
50
51
52
53
              </template>
            </el-table-column>
            <el-table-column prop="notes" label="是否必填">
              <template slot-scope="scope">
6abe0316   wesley88   1
54
                {{scope.row.isrequired?scope.row.isrequired : '-'}}
f692f3a5   wesley88   1
55
56
57
58
              </template>
            </el-table-column>
            <el-table-column prop="notes" label="字段宽度">
              <template slot-scope="scope">
6abe0316   wesley88   1
59
                {{scope.row.width?scope.row.width : '-'}}
f692f3a5   wesley88   1
60
61
62
63
              </template>
            </el-table-column>
            <el-table-column prop="notes" label="限制规则">
              <template slot-scope="scope">
6abe0316   wesley88   1
64
                {{scope.row.length?scope.row.length : '-'}}
f692f3a5   wesley88   1
65
66
67
68
69
70
71
72
73
74
              </template>
            </el-table-column>
            <el-table-column label="操作">
              <template slot-scope="scope">
                <div @click="MingDelete(scope.$index)" class="tableBtn greens">删除</div>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>
6abe0316   wesley88   1
75
76
77
78
79
      <div v-if="info.id" style="margin-top: 20px;margin-left: 65px;">
        <el-button @click="close()" class="buttonHover"
          style="color: #606266;border: 1px solid #DBDBDB;background-color: #fff;">返回</el-button>
      </div>
      <div v-else style="margin-top: 20px;margin-left: 65px;">
f692f3a5   wesley88   1
80
81
82
83
        <el-button @click="add()" style="background-color: #3F9B6A;color: #fff;">确定</el-button>
        <el-button @click="close()" class="buttonHover"
          style="color: #606266;border: 1px solid #DBDBDB;background-color: #fff;">取消</el-button>
      </div>
6abe0316   wesley88   1
84
      <el-dialog :visible.sync="addMing" title="添加" style="padding: 0;z-index: 9999999;" width="50%" append-to-body center
f692f3a5   wesley88   1
85
86
87
        :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false">
        <div v-if="addMing">
          <el-form :model="addmbitem" :rules="ruleaddmbitem" ref="addmbitem" label-width="130px" class="demo-ruleForm">
6abe0316   wesley88   1
88
89
            <el-form-item label="字段名称" prop="name">
              <el-input v-model="addmbitem.name" placeholder="请输入" maxlength="20"></el-input>
f692f3a5   wesley88   1
90
            </el-form-item>
6abe0316   wesley88   1
91
92
            <el-form-item label="字段key" prop="key">
              <el-input v-model="addmbitem.key" placeholder="请输入" maxlength="20"></el-input>
f692f3a5   wesley88   1
93
            </el-form-item>
6abe0316   wesley88   1
94
95
96
            <el-form-item label="字段类型" prop="type">
              <el-select v-model="addmbitem.type" placeholder="请选择" style="width: 100%;">
                <el-option v-for="(item,index) in mobantype" :key="index" :label="item.label" :value="item.value"></el-option>
f692f3a5   wesley88   1
97
98
              </el-select>
            </el-form-item>
6abe0316   wesley88   1
99
100
101
102
103
104
105
            <el-form-item label="选择内容" v-if="addmbitem.type == '下拉选择'">
              <el-button @click="additemlist" style="background-color: #3F9B6A;color: #fff;">添加</el-button>
              <el-input v-for="(item,index) in addmbitem.list" :key="index" v-model="item.label" placeholder="请输入" maxlength="20" @input="e=>inputvalue(e,index)"></el-input>
  
            </el-form-item>
            <el-form-item label="是否必填" prop="isrequired">
              <el-select v-model="addmbitem.isrequired" placeholder="请选择" style="width: 100%;">
f692f3a5   wesley88   1
106
107
108
109
                <el-option label="是" value="是"></el-option>
                <el-option label="否" value="否"></el-option>
              </el-select>
            </el-form-item>
6abe0316   wesley88   1
110
111
            <el-form-item label="字段宽度" prop="width">
              <el-select v-model="addmbitem.width" placeholder="请选择" style="width: 100%;">
f692f3a5   wesley88   1
112
113
114
115
                <el-option label="50%(半行)" value="50%(半行)"></el-option>
                <el-option label="100%(一行)" value="100%(一行)"></el-option>
              </el-select>
            </el-form-item>
6abe0316   wesley88   1
116
117
            <el-form-item label="限制规则" prop="length">
              <el-input v-model.number="addmbitem.length" placeholder="请输入" maxlength="20"></el-input>
f692f3a5   wesley88   1
118
119
120
121
122
123
124
125
126
127
128
129
130
            </el-form-item>
          </el-form>
        </div>
        <template #footer>
          <div style="display: flex; justify-content: flex-end; align-items: center;">
            <el-button @click="minSev" style="background-color: #3F9B6A;color: #fff;">确定</el-button>
            <el-button @click="mingClose" class="buttonHover"
              style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;">取消</el-button>
          </div>
        </template>
      </el-dialog>
    </div>
  </template>
f692f3a5   wesley88   1
131
  <script>
6abe0316   wesley88   1
132
    import upfile from "@/components/fujianUpload/fujianList"
f692f3a5   wesley88   1
133
    import TitleWithCircle from '@/components/top/index';
6abe0316   wesley88   1
134
    import mbadd from '@/components/change/mbadd';
f692f3a5   wesley88   1
135
    import {
6abe0316   wesley88   1
136
      cereContractTemplateadd
f692f3a5   wesley88   1
137
    } from '@/api/newly.js'
6abe0316   wesley88   1
138
  import { Input } from "element-ui";
f692f3a5   wesley88   1
139
140
    export default {
      components: {
6abe0316   wesley88   1
141
142
143
        TitleWithCircle,
        mbadd,
        upfile
f692f3a5   wesley88   1
144
145
146
      },
      data() {
        return {
6abe0316   wesley88   1
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
          list1:[],
          list2: [
            {
              name: '合同类型',
              key: 'contractType',
              type: '下拉选择',
              isrequired: '是',
              width: '50%(半行)',
              length: '20',
              value: '',
              list: [{
                  label: '商铺合同',
                  value: '商铺合同',
                },
                {
                  label: '广告位合同',
                  value: '广告位合同',
                },
                {
                  label: '场地合同',
                  value: '场地合同',
                },
              ]
            },
            {
              name: '合同编号',
              key: 'contractNumber',
              type: '单行文本',
              isrequired: '是',
              width: '50%(半行)',
              length: '20',
              value: '',
            },
            {
              name: '标段号',
              key: 'sectionNumber',
              type: '单行文本',
              isrequired: '是',
              width: '50%(半行)',
              length: '20',
              value: '',
            },
            {
              name: '合同名称',
              key: 'contractName',
              type: '单行文本',
              isrequired: '是',
              width: '50%(半行)',
              length: '50',
              value: '',
            },
            {
              name: '合同签订日期',
              key: 'contractSigningDate',
              type: '日期',
              isrequired: '是',
              width: '50%(半行)',
              length: '',
              value: '',
            },
            {
              name: '押金',
              key: 'earnestMoney',
              type: '单行数字文本',
              isrequired: '是',
              width: '50%(半行)',
              length: '20',
              value: '',
            },
            {
              name: '起租日期',
              key: 'leaseStartDate',
              type: '日期',
              isrequired: '是',
              width: '50%(半行)',
              length: '',
              value: '',
            },
            {
              name: '终止日期',
              key: 'contractTerminationDate',
              type: '日期',
              isrequired: '是',
              width: '50%(半行)',
              length: '',
              value: '',
            },
            {
              name: '付款周期',
              key: 'paymentCycle',
              type: '下拉选择',
              isrequired: '是',
              width: '50%(半行)',
              length: '20',
              value: '',
              list: [{
                  label: '按年',
                  value: '按年',
                },
                {
                  label: '按月',
                  value: '按月',
                },
                {
                  label: '按日',
                  value: '按日',
                },
                {
                  label: '季度',
                  value: '季度',
                },
              ]
            },
            {
              name: '租金',
              key: 'contractAmount',
              type: '单行数字文本',
              isrequired: '是',
              width: '50%(半行)',
              length: '20',
              value: '',
            },
            {
523cfe19   wesley88   1
270
              name: '首次付款日',
6abe0316   wesley88   1
271
272
273
274
275
276
277
278
279
280
              key: 'paymentDay',
              type: '付款日',
              isrequired: '是',
              width: '50%(半行)',
              length: '20',
              value: '',
            },
            {
              name: '承租人银行账号',
              key: 'tenantBankAccount',
a72e57a5   wesley88   1
281
              type: '银行账号',
6abe0316   wesley88   1
282
283
              isrequired: '是',
              width: '50%(半行)',
a72e57a5   wesley88   1
284
              length: '',
6abe0316   wesley88   1
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
              value: '',
            },
            {
              name: '绑定商家',
              key: 'relatedMerchants',
              type: '商家',
              isrequired: '是',
              width: '100%(一行)',
              length: '',
              value: '',
            },
            {
              name: '承租人名称',
              key: 'tenantName',
              type: '单行文本',
              isrequired: '是',
              width: '50%(半行)',
              length: '20',
              value: '',
            },
            {
              name: '联系电话',
              key: 'tenantTelephone',
a72e57a5   wesley88   1
308
              type: '联系电话',
6abe0316   wesley88   1
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
              isrequired: '是',
              width: '50%(半行)',
              length: '20',
              value: '',
            },
            // {
            //   name: '附件信息',
            //   key: 'appendicesContract',
            //   type: '附件',
            //   isrequired: '是',
            //   width: '100%(一行)',
            //   length: '',
            //   value: '',
            // },
            {
              name: '绑定资源',
              key: 'shopNumber',
              type: '资源',
              isrequired: '是',
              width: '100%(一行)',
              length: '',
              value: '',
              list:[]
            },
          ],
          rulesmb:{
            templateName: [{
              required: true,
              message: '请填写模版名称',
              trigger: 'change'
            }],
            templateAttachment: [{
              required: true,
              message: '请上传word模板',
              trigger: 'change'
            }],
          },
f692f3a5   wesley88   1
346
          ruleAddData:{},
6abe0316   wesley88   1
347
348
349
350
351
352
353
354
355
356
          forminfo:{
            templateName: '',       // 模板名称
            templateAttachment: '', // 模板附件路径或名称
            otherInfo: '',          // 其他信息
            templateType: '',       // 模板类型
            creator: '',            // 创建人
            createTime: '',         // 创建时间
            remark1: '',            // 备注1
            remark2: ''             // 备注2
          },
f692f3a5   wesley88   1
357
          ruleaddmbitem:{
6abe0316   wesley88   1
358
            name: [{
f692f3a5   wesley88   1
359
360
361
362
              required: true,
              message: '请填写字段名称',
              trigger: 'change'
            }],
6abe0316   wesley88   1
363
            key: [{
f692f3a5   wesley88   1
364
365
366
367
              required: true,
              message: '请填写字段key',
              trigger: 'change'
            }],
6abe0316   wesley88   1
368
            type: [{
f692f3a5   wesley88   1
369
370
371
372
              required: true,
              message: '请选择字段类型',
              trigger: 'change'
            }],
6abe0316   wesley88   1
373
            isrequired: [{
f692f3a5   wesley88   1
374
375
376
377
              required: true,
              message: '请选择是否必填',
              trigger: 'change'
            }],
6abe0316   wesley88   1
378
            width: [{
f692f3a5   wesley88   1
379
380
381
382
              required: true,
              message: '请选择字段宽度',
              trigger: 'change'
            }],
6abe0316   wesley88   1
383
384
385
386
387
            // length: [{
            //   required: true,
            //   message: '请填写限制规则',
            //   trigger: 'change'
            // }],
f692f3a5   wesley88   1
388
389
          },
          addmbitem: {
6abe0316   wesley88   1
390
391
392
393
394
395
            name: '',
            key: '',
            type: '',
            isrequired: '',
            width: '',
            length: '',
f692f3a5   wesley88   1
396
            value: '',
6abe0316   wesley88   1
397
            list:[]
f692f3a5   wesley88   1
398
          },
6abe0316   wesley88   1
399
400
401
402
403
404
405
406
          addMing:false,
           
        }
      },
      computed: {
        mobantype() {
          return this.$store.state.app.mobantype;
        }
f692f3a5   wesley88   1
407
408
409
410
411
412
413
414
      },
      props: {
        info: {
          type: Object,
          default: {}
        }
      },
      async created() {
f692f3a5   wesley88   1
415
        if (this.info.id) {
6abe0316   wesley88   1
416
417
418
          this.info.otherInfo = JSON.parse(this.info.otherInfo)
          this.list1 =  this.info.otherInfo
          this.forminfo = this.info
f692f3a5   wesley88   1
419
420
421
        }
      },
      methods: {
6abe0316   wesley88   1
422
423
424
425
426
427
428
429
        inputvalue(e,index){
          console.error(e)
          this.addmbitem.list[index].value = e
        },
        additemlist() {
          this.addmbitem.list.push({
            label: '',
            value: ''
f692f3a5   wesley88   1
430
          })
6abe0316   wesley88   1
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
        },
        async mingShow() {
          this.addMing = true
        },
        minSev() {
          // return
          this.$refs.addmbitem.validate((valid) => {
              console.log(valid)
              if (valid) {
                this.list1.push(this.addmbitem)
                this.addmbitem = {
                  name: '',
                  key: '',
                  type: '',
                  isrequired: '',
                  width: '',
                  length: '',
                  value: '',
                  list:[]
                }
                this.addMing = false
              } else {
                this.$message({
                  message: '请填写完整信息',
                  type: 'error'
                })
                return false;
              }
            })
        },
        mingClose() {
          this.addMing = false
        },
        openfile(e) {
          if (e) {
            const fullUrl = e;
            try {
              window.open(fullUrl, '_blank'); // 在新标签页中打开文件
            } catch (error) {
              console.error('打开文件失败:', error);
f692f3a5   wesley88   1
471
            }
6abe0316   wesley88   1
472
473
          } else {
            console.error('无文件可查看');
f692f3a5   wesley88   1
474
          }
6abe0316   wesley88   1
475
476
477
478
479
480
481
482
483
484
485
486
487
488
        },
        changimg(e, type) {
          this.forminfo[type] = e
        },
        changimg(e, type) {
          this.forminfo[type] = e
        },
        openfile(e) {
          if (e) {
            const fullUrl = e;
            try {
              window.open(fullUrl, '_blank'); // 在新标签页中打开文件
            } catch (error) {
              console.error('打开文件失败:', error);
f692f3a5   wesley88   1
489
            }
f692f3a5   wesley88   1
490
          } else {
6abe0316   wesley88   1
491
492
493
494
495
496
497
498
499
500
501
502
            console.error('无文件可查看');
          }
        },
        //获取当前时间
        updateCurrentTime() {
          const now = new Date();
          const year = now.getFullYear();
          const month = (now.getMonth() + 1).toString().padStart(2, '0');
          const day = now.getDate().toString().padStart(2, '0');
          const hours = now.getHours().toString().padStart(2, '0');
          const minutes = now.getMinutes().toString().padStart(2, '0');
          const seconds = now.getSeconds().toString().padStart(2, '0');
f692f3a5   wesley88   1
503
  
6abe0316   wesley88   1
504
505
506
507
508
          return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
        },
        add() {
         console.error(this.list1)
          this.$refs.ruleForm1.validate((valid) => {
f692f3a5   wesley88   1
509
510
              console.log(valid)
              if (valid) {
6abe0316   wesley88   1
511
                let allist = [...this.list2,...this.list1]
523cfe19   wesley88   1
512
513
514
515
516
                let listallcl = allist.map((item) => {
                  item.value = ''
                   return item;
                });
                this.forminfo.otherInfo = JSON.stringify(listallcl)
6abe0316   wesley88   1
517
518
519
520
521
522
523
524
                console.log(
                  {...this.forminfo}
                )
                // return
                cereContractTemplateadd({
                  ...this.forminfo,
                  creator: localStorage.getItem('roleName'),
                  createTime: this.updateCurrentTime(),
f692f3a5   wesley88   1
525
526
527
528
529
530
531
                }).then(res => {
                  console.error(res)
                  if (res.code == 200) {
                    this.$message({
                      message: '添加成功',
                      type: 'success'
                    })
f692f3a5   wesley88   1
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
                    this.$emit('removeonaction', '1')
                  } else {
                    this.$message({
                      message: res.msg,
                      type: 'error'
                    })
                  }
  
                })
              } else {
                this.$message({
                  message: '请填写完整信息',
                  type: 'error'
                })
                return false;
              }
            })
f692f3a5   wesley88   1
549
550
551
552
        },
        close() {
          this.$emit('removeonaction', '1')
        },
6abe0316   wesley88   1
553
554
      }
    }
f692f3a5   wesley88   1
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
  </script>
  <style lang="css">
    .el-upload {
      display: block;
      text-align: left;
    }
  
    .el-dialog__header {
      background-color: #F2F3F5;
      text-align: left;
    }
  
    .el-dialog__title {
      line-height: 30px;
      font-size: 15px;
      color: #303133;
    }
6abe0316   wesley88   1
572
573
574
575
576
577
578
  
    .iterem {
      z-index: 99;
      margin-left: 10px;
      height: 40px;
      line-height: 25px;
    }
f692f3a5   wesley88   1
579
  </style>