cloudroam
2025-03-28 cef2bb0eeeb91a22860cf5d23c7348af1ba921dc
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
<template>
  <el-bus-crud v-bind="tableConfig" />
</template>
 
<script>
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
export default {
  data() {
    const defaultDate = `${dayjs().format('YYYY-MM-DD')} 00:00:00`
    return {
      tableConfig: {
        url: 'flower/v2/sms-template/list',
        newUrl: 'flower/v2/sms-template/new',
        deleteUrl: 'flower/v2/sms-template/delete',
        editUrl: 'flower/v2/sms-template/edit',
        columns: [
          { label: 'ID', prop: 'id' },
          { label: 'CODE', prop: 'code' },
          { label: '模板名称', prop: 'name' },
          { label: '模板描述', prop: 'description' },
          { label: '创建时间', prop: 'createTime' },
        ],
        searchForm: [
          {
            type: 'row',
            items: [
              { label: 'ID', id: 'id', type: 'input' },
              { label: 'CODE', id: 'code', type: 'input' },
              { label: '模板名称', id: 'name', type: 'input' },
              {
                label: '创建时间',
                id: 'startDate',
                component: 'el-bus-date-range',
                el: {
                  clearable: true,
                },
                // commonFormat: true,
                commonFormatProps: ['startDate', 'endDate'],
                inputFormat: (row) => {
                  if ('startDate' in row || 'endDate' in row) {
                    return [
                      this.$elBusUtil.toDate(row.startDate),
                      this.$elBusUtil.toDate(row.endDate),
                    ]
                  }
                },
                outputFormat: (val) => {
                  return {
                    startDate:val[0] ? `${this.$elBusUtil.toDate(val[0])} 00:00:00`: undefined,
                    endDate: val[1] ?`${this.$elBusUtil.toDate(val[1])} 23:59:59`: undefined,
                  }
                },
                customClass: 'in-bus-form',
                // commonRules: true,
                // default: [defaultDate, defaultDate],
              },
            ],
          },
        ],
        form: [
          {
            label: 'CODE:',
            id: 'code',
            type: 'bus-select',
            el: {
              interfaceUri: 'flower/v2/sms-template/aliyun/list',
              extraQuery: {
                current: 1,
                size: 2000,
              },
              props: {
                label: 'templateName',
                value: 'templateCode',
                // dataPath: 'records',
              },
              filterable: true,
              multiple: false,
              style: 'width:100%',
            },
            rules: {
              required: true,
              message: '请选择CODE',
              trigger: 'blur',
            },
          },
 
          {
            label: '模板名称:',
            id: 'name',
            type: 'input',
            rules: {
              required: true,
              message: '请输入模板名称',
              trigger: 'blur',
            },
          },
          {
            label: '模板描述:',
            id: 'description',
            type: 'input',
            el: {
              type: 'textarea',
              rows: 6,
            },
            rules: {
              required: true,
              message: '请输入模板描述',
              trigger: 'blur',
            },
          },
          
        ],
      },
    }
  },
  head() {
    return {
      title: '短信模板维护',
    }
  },
}
</script>