ny
23 小时以前 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
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
<script lang="ts" setup>
import { nextTick, reactive, toRefs } from 'vue';
 
import { BasicModal, useModalInner } from '@jnpf/ui/modal';
 
const emit = defineEmits(['register', 'confirm']);
 
interface State {
  columnList: any[];
  list: any[];
  activeIndex: number;
  activeKey: String;
  sheetList: any[];
  sheetIndex: number;
}
 
const state = reactive<State>({
  columnList: [],
  list: [],
  activeIndex: 0,
  activeKey: '',
  sheetList: [],
  sheetIndex: 0,
});
const { columnList, activeKey } = toRefs(state);
const [registerModal, { closeModal }] = useModalInner(init);
 
function init(data: any) {
  state.columnList = getColumnList(data);
  state.activeKey = state.columnList[0].sheet;
}
 
function getColumnList(data) {
  const sheetList = data.sheetList.map((item) => ({
    sheet: item.id,
    sheetName: item.fullName,
    columnList: {
      columnState: false,
      columnStyle: 'col',
      columnType: '1',
      maxCol: 0,
      rowCount: 0,
      maxRow: 0,
      colCount: 0,
      columnData: null,
      copyCol: null,
      copyRow: null,
      fillEmptyRows: false,
    },
  }));
 
  if (!data.columnList?.length) return sheetList;
  for (const element of sheetList) {
    for (let i = 0; i < data.columnList.length; i++) {
      const el = data.columnList[i];
      if (element.sheet == el.sheet) element.columnList = el.columnList || [];
    }
  }
  return sheetList;
}
 
function handleSubmit() {
  emit('confirm', state.columnList);
  nextTick(() => closeModal());
}
</script>
<template>
  <BasicModal v-bind="$attrs" width="1000px" class="jnpf-parameter-modal" @register="registerModal" title="分栏配置" @ok="handleSubmit" destroy-on-close>
    <a-tabs v-model:active-key="activeKey">
      <a-tab-pane v-for="item in columnList" :key="item.sheet" :tab="item.sheetName">
        <a-form class="column-form-wrap" :model="item.columnList" :label-col="{ style: { width: '86px' } }" :colon="false">
          <a-form-item label="启用分栏">
            <a-switch v-model:checked="item.columnList.columnState" />
          </a-form-item>
          <template v-if="item.columnList.columnState">
            <a-form-item label="样式">
              <a-radio-group class="column-style-radio-wrap" v-model:value="item.columnList.columnStyle">
                <a-radio value="col">行分栏</a-radio>
                <a-radio value="row">列分栏</a-radio>
              </a-radio-group>
            </a-form-item>
            <div class="column-style-marks">
              <img src="@/assets/images/report/col_column_mark.png" alt="行分栏图示" />
              <img class="row-column-mark-img" src="@/assets/images/report/row_column_mark.png" alt="列分栏图示" />
            </div>
            <a-form-item label="类型" v-if="item.columnList.columnStyle === 'col'">
              <a-radio-group class="column-type-radio-wrap" v-model:value="item.columnList.columnType">
                <a-radio value="1">
                  <span>超过</span>
                  <a-input-number v-model:value="item.columnList.maxCol" min="0" />
                  <span>行分栏</span>
                </a-radio>
                <a-radio value="2">
                  <span>分栏成</span>
                  <a-input-number v-model:value="item.columnList.rowCount" min="0" />
                  <span>列</span>
                </a-radio>
              </a-radio-group>
            </a-form-item>
            <a-form-item label="类型" v-if="item.columnList.columnStyle === 'row'">
              <a-radio-group class="column-type-radio-wrap" v-model:value="item.columnList.columnType">
                <a-radio value="1">
                  <span>超过</span>
                  <a-input-number v-model:value="item.columnList.maxRow" min="0" />
                  <span>列分栏</span>
                </a-radio>
                <a-radio value="2">
                  <span>分栏成</span>
                  <a-input-number v-model:value="item.columnList.colCount" min="0" />
                  <span>行</span>
                </a-radio>
              </a-radio-group>
            </a-form-item>
            <a-form-item label="分栏数据">
              <div class="input-item-tip-wrap">
                <a-input v-model:value="item.columnList.columnData" placeholder="请输入" :maxlength="256" allow-clear />
                <span class="tip-text">格式 A2:D10</span>
              </div>
            </a-form-item>
            <a-form-item label="复制行号" v-if="item.columnList.columnStyle === 'col'">
              <div class="input-item-tip-wrap">
                <a-input v-model:value="item.columnList.copyCol" placeholder="请输入" :maxlength="256" allow-clear />
                <span class="tip-text">格式 1,2-3,6,20</span>
              </div>
            </a-form-item>
            <a-form-item label="复制列号" v-if="item.columnList.columnStyle === 'row'">
              <div class="input-item-tip-wrap">
                <a-input v-model:value="item.columnList.copyRow" placeholder="请输入" :maxlength="256" allow-clear />
                <span class="tip-text">格式 1,2-3,6,20</span>
              </div>
            </a-form-item>
            <a-form-item label="补充空白行">
              <a-switch v-model:checked="item.columnList.fillEmptyRows" />
            </a-form-item>
          </template>
        </a-form>
      </a-tab-pane>
    </a-tabs>
  </BasicModal>
</template>
 
<style lang="scss" scoped>
.ant-tabs {
  height: 50vh;
 
  :deep(.ant-tabs-content) {
    height: 100%;
    overflow: auto;
  }
}
 
.column-form-wrap {
  padding: 15px 15px 10px;
 
  .column-style-radio-wrap {
    .ant-radio-wrapper {
      width: 200px;
    }
  }
 
  .column-style-marks {
    display: flex;
    margin: -20px 0 24px 86px;
 
    img {
      display: block;
      width: 200px;
    }
 
    .row-column-mark-img {
      margin-left: 8px;
    }
  }
 
  .column-type-radio-wrap {
    :deep(.ant-radio-wrapper) {
      & > span:nth-child(2) {
        display: flex;
        align-items: center;
 
        .ant-input-number {
          width: 80px;
          margin: 0 9px;
        }
      }
    }
  }
 
  .input-item-tip-wrap {
    display: flex;
    align-items: center;
 
    .ant-input-affix-wrapper {
      width: 320px;
    }
 
    .tip-text {
      margin-left: 8px;
      color: #aaa;
    }
  }
}
</style>