syntec3-0-ui-components-test 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/S3_0UC_main.csv +4 -0
- package/dist/S3_0UC_sub.csv +2 -0
- package/dist/globalVariableS3_0UC.json +1 -0
- package/dist/style.css +1 -0
- package/dist/syntec3-0-ui-components.es.js +19518 -0
- package/dist/syntec3-0-ui-components.es.js.map +1 -0
- package/dist/syntec3-0-ui-components.umd.js +23 -0
- package/dist/syntec3-0-ui-components.umd.js.map +1 -0
- package/dist/vite.svg +1 -0
- package/dist/web.config +17 -0
- package/package.json +137 -0
- package/src/App.vue +31 -0
- package/src/assets/fonts/genYoGothicTW-normal.js +7 -0
- package/src/assets/image/defaultImage.png +0 -0
- package/src/assets/vue.svg +1 -0
- package/src/components/Layout/modules/fullPageGlobal.vue +113 -0
- package/src/components/Layout/modules/viewFile/config.js +65 -0
- package/src/components/Layout/modules/viewFile/createView.vue +1000 -0
- package/src/components/Layout/modules/viewFile/filterCriteria.vue +816 -0
- package/src/components/Layout/modules/viewFile/viewList.vue +291 -0
- package/src/components/Layout/modules/viewFile/viewManageTool.js +271 -0
- package/src/components/Layout/modules/viewFile/viewRecord.vue +472 -0
- package/src/components/Layout/modules/viewFile/viewTabs.vue +542 -0
- package/src/components/Layout/tools/GlobalDialog.vue +115 -0
- package/src/components/Pagination.vue +139 -0
- package/src/components/columnConfigNext.vue +273 -0
- package/src/components/customFilter/customFilter.vue +492 -0
- package/src/components/customFilter/filterCriteria.vue +769 -0
- package/src/components/customTable/components/headerOperation/index.vue +136 -0
- package/src/components/customTable/components/headerTabs/index.vue +171 -0
- package/src/components/customTable/components/tableContent/index.vue +440 -0
- package/src/components/customTable/index.vue +305 -0
- package/src/components/dialog.vue +85 -0
- package/src/components/pageContent.vue +48 -0
- package/src/components/popover.vue +402 -0
- package/src/configFiles/apiFile/baseApiList.json +11 -0
- package/src/configFiles/apiFile/coreApiList.json +24 -0
- package/src/configFiles/apiFile/mesApiList.json +4 -0
- package/src/configFiles/apiFile/mmsApiList.json +3 -0
- package/src/configFiles/errorCode.json +291 -0
- package/src/configFiles/version.js +2 -0
- package/src/i18n/lang/en-us.json +2060 -0
- package/src/i18n/lang/errorCodeTranslate.mjs +847 -0
- package/src/i18n/lang/zh-cn.json +2062 -0
- package/src/i18n/lang/zh-tw.json +2059 -0
- package/src/index.js +115 -0
- package/src/main.js +51 -0
- package/src/plugins/excel.js +88 -0
- package/src/router/index.js +41 -0
- package/src/scriptFiles/apiConfig/baseApis.js +10 -0
- package/src/scriptFiles/apiConfig/mesApis.js +10 -0
- package/src/scriptFiles/apiConfig/mmsApis.js +10 -0
- package/src/scriptFiles/apiConfig/privateCloudCoreApis.js +13 -0
- package/src/scriptFiles/apiConfig/serviceRoute.js +23 -0
- package/src/scriptFiles/apis/baseApiFunction.js +63 -0
- package/src/scriptFiles/apis/mesApiFunction.js +15 -0
- package/src/scriptFiles/apis/mmsApiFunction.js +9 -0
- package/src/scriptFiles/apis/privateCloudCoreApiFunction.js +101 -0
- package/src/scriptFiles/backendApiFunction.js +11 -0
- package/src/scriptFiles/checkApiErrorMechanism.js +137 -0
- package/src/scriptFiles/common/objectDataProcessing.js +65 -0
- package/src/scss/base/commom.scss +1068 -0
- package/src/scss/base/dialog.scss +45 -0
- package/src/scss/base/index.scss +3 -0
- package/src/scss/base/table.scss +28 -0
- package/src/store/index.js +25 -0
- package/src/store/module/langStore.js +116 -0
- package/src/style.css +52 -0
- package/src/utils/excel.js +86 -0
- package/src/utils/formula.js +69 -0
- package/src/utils/https.js +13 -0
- package/src/utils/i18n.js +42 -0
- package/src/utils/shiftSelect.js +164 -0
- package/src/utils/summation.js +77 -0
- package/src/utils/tableWidth.js +29 -0
- package/src/utils/toolFun.js +93 -0
- package/src/views/productionWorkOrder/components/columnConfig.vue +242 -0
- package/src/views/productionWorkOrder/components/docCustomFieldForm.vue +739 -0
- package/src/views/productionWorkOrder/components/filePreview.vue +148 -0
- package/src/views/productionWorkOrder/components/querySearch.vue +363 -0
- package/src/views/productionWorkOrder/configFiles/excelImportErrorCode.json +94 -0
- package/src/views/productionWorkOrder/configFiles/pdfDefaultConfig.js +933 -0
- package/src/views/productionWorkOrder/configFiles/planMakingScript.js +600 -0
- package/src/views/productionWorkOrder/configFiles/productionRelatedScript.js +368 -0
- package/src/views/productionWorkOrder/configFiles/rulse.js +23 -0
- package/src/views/productionWorkOrder/configFiles/status.js +50 -0
- package/src/views/productionWorkOrder/index.vue +2174 -0
- package/src/views/productionWorkOrder/productionFlowLabel/component/addCirculationLabel.vue +394 -0
- package/src/views/productionWorkOrder/productionFlowLabel/component/circulationLabelTable.vue +124 -0
- package/src/views/productionWorkOrder/productionFlowLabel/component/materialPartFilePreview.vue +167 -0
- package/src/views/productionWorkOrder/productionFlowLabel/component/workOrderInformation.vue +28 -0
- package/src/views/productionWorkOrder/productionFlowLabel/index.vue +604 -0
- package/src/views/production_work_order/components/priorityTooltip.vue +53 -0
- package/src/views/production_work_order/index.vue +1307 -0
- package/src/views/review_record/components/materialInfo.vue +50 -0
- package/src/views/review_record/components/rootCause.vue +42 -0
- package/src/views/review_record/components/workDetail.vue +115 -0
- package/src/views/review_record/index.vue +884 -0
|
@@ -0,0 +1,1000 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-drawer
|
|
3
|
+
v-model="visible"
|
|
4
|
+
:show-close="false"
|
|
5
|
+
size="calc(60% - 100px)"
|
|
6
|
+
:append-to-body="false"
|
|
7
|
+
:close-on-press-escape="false"
|
|
8
|
+
:modal="false"
|
|
9
|
+
:z-index="2000"
|
|
10
|
+
:with-header="false"
|
|
11
|
+
body-class="drawer-box"
|
|
12
|
+
data-test-id="EL-DRAWER-bQvmdU"
|
|
13
|
+
class="create-view-drawer"
|
|
14
|
+
>
|
|
15
|
+
<template #default>
|
|
16
|
+
<div class="view-box" data-test-id="DIV-1N5GVN">
|
|
17
|
+
<div class="view-title" data-test-id="DIV-RHdrZN">
|
|
18
|
+
<h3 data-test-id="H4-2vhWDY">
|
|
19
|
+
<span data-test-id="SPAN-vzUpbG">
|
|
20
|
+
<v-icon class="mdi mdi-book-open-variant" data-test-id="V-ICON-52NN4f" /> {{ viewTypeTitle }}
|
|
21
|
+
</span>
|
|
22
|
+
</h3>
|
|
23
|
+
<el-icon class="mdi mdi-close cursor" :size="25" data-test-id="EL-ICON-Y6FnRm" @click="close"> </el-icon>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="view-content" data-test-id="DIV-lpvhN1">
|
|
26
|
+
<el-menu
|
|
27
|
+
v-model="activeMenu"
|
|
28
|
+
class="el-menu-vertical-demo"
|
|
29
|
+
background-color="#f5f7fa"
|
|
30
|
+
text-color="#333"
|
|
31
|
+
active-text-color="#125088"
|
|
32
|
+
:default-active="activeMenu"
|
|
33
|
+
unique-opened
|
|
34
|
+
data-test-id="EL-MENU-zUc2Ka"
|
|
35
|
+
>
|
|
36
|
+
<el-menu-item index="basicInfo" data-test-id="EL-MENU-ITEM-e3jZsV" @click="activeMenu = 'basicInfo'">
|
|
37
|
+
<span class="mdi mdi-note-text" data-test-id="SPAN-FXgldN" /> {{ t('basicInfo') }}
|
|
38
|
+
</el-menu-item>
|
|
39
|
+
<el-menu-item index="dataFilter" data-test-id="EL-MENU-ITEM-FP0Pdh" @click="activeMenu = 'dataFilter'">
|
|
40
|
+
<span class="mdi mdi-filter-cog" data-test-id="SPAN-DvUe8j" /> {{ t('dataFilter') }}
|
|
41
|
+
</el-menu-item>
|
|
42
|
+
</el-menu>
|
|
43
|
+
<div class="drawer-content" data-test-id="DIV-9dBeYG">
|
|
44
|
+
<div v-show="activeMenu === 'basicInfo'" data-test-id="DIV-qkoKbM">
|
|
45
|
+
<h3 data-test-id="H3-95pW9X">{{ t('basicInfo') }}</h3>
|
|
46
|
+
<el-form
|
|
47
|
+
ref="basicFormRef"
|
|
48
|
+
:model="formData"
|
|
49
|
+
:rules="rules"
|
|
50
|
+
label-width="auto"
|
|
51
|
+
data-test-id="EL-FORM-RLlvjp"
|
|
52
|
+
>
|
|
53
|
+
<el-form-item :label="t('viewName')" prop="viewName" data-test-id="EL-FORM-ITEM-wwCvB7">
|
|
54
|
+
<el-input
|
|
55
|
+
v-model="formData.viewName"
|
|
56
|
+
:placeholder="t('enter') + t('viewName')"
|
|
57
|
+
maxlength="20"
|
|
58
|
+
:disabled="viewId < 0"
|
|
59
|
+
show-word-limit
|
|
60
|
+
clearable
|
|
61
|
+
data-test-id="EL-INPUT-eTI2mw"
|
|
62
|
+
/>
|
|
63
|
+
</el-form-item>
|
|
64
|
+
<el-form-item :label="t('viewIcon')" data-test-id="EL-FORM-ITEM-UtKiIs">
|
|
65
|
+
<div class="icon-options" data-test-id="DIV-OuotQS">
|
|
66
|
+
<el-button
|
|
67
|
+
v-for="(option, index) in 7"
|
|
68
|
+
:key="index"
|
|
69
|
+
:class="{ active: formData.selectedIconIndex === index }"
|
|
70
|
+
:style="{
|
|
71
|
+
color: iconColors[index],
|
|
72
|
+
borderColor: formData.selectedIconIndex === index ? '#4665ad' : '#dcdcdc',
|
|
73
|
+
}"
|
|
74
|
+
type="text"
|
|
75
|
+
data-test-id="EL-BUTTON-4Hyaga"
|
|
76
|
+
@click="formData.selectedIconIndex = index"
|
|
77
|
+
>
|
|
78
|
+
<i class="mdi mdi-book-open-blank-variant radio-icon" data-test-id="V-ICON-oBZKUA" />
|
|
79
|
+
</el-button>
|
|
80
|
+
</div>
|
|
81
|
+
</el-form-item>
|
|
82
|
+
<el-form-item
|
|
83
|
+
:label="t('viewPermission')"
|
|
84
|
+
prop="permission"
|
|
85
|
+
required
|
|
86
|
+
data-test-id="EL-FORM-ITEM-Jb9jGY"
|
|
87
|
+
>
|
|
88
|
+
<el-cascader
|
|
89
|
+
v-model="formData.permission"
|
|
90
|
+
:options="options"
|
|
91
|
+
:props="cascadeProperty"
|
|
92
|
+
:show-all-levels="false"
|
|
93
|
+
show-checked-strategy="parent"
|
|
94
|
+
clearable
|
|
95
|
+
data-test-id="EL-CASCADER-X0KLWz"
|
|
96
|
+
@change="handleChange"
|
|
97
|
+
/>
|
|
98
|
+
</el-form-item>
|
|
99
|
+
</el-form>
|
|
100
|
+
</div>
|
|
101
|
+
<div v-show="activeMenu === 'dataFilter'" data-test-id="DIV-ckP1yh">
|
|
102
|
+
<h3 data-test-id="H3-c1nKHQ">
|
|
103
|
+
{{ t('dataFilter') }}
|
|
104
|
+
</h3>
|
|
105
|
+
<filterCriteria
|
|
106
|
+
ref="filterCriteriaRef"
|
|
107
|
+
:field-setting="fieldSetting"
|
|
108
|
+
:filter-conditions="dataFilterList"
|
|
109
|
+
:select-options="selectOptions"
|
|
110
|
+
:default-create-time-string="defaultCreateTimeString"
|
|
111
|
+
data-test-id="FILTERCRITERIA-ShqDeQ"
|
|
112
|
+
/>
|
|
113
|
+
<el-button link type="primary" data-test-id="EL-BUTTON-W21EYJ" @click="addFilterCondition">
|
|
114
|
+
<v-icon class="mdi mdi-plus" style="margin-right: 0.5rem" data-test-id="V-ICON-u6sfaW" />
|
|
115
|
+
{{ t('addFilterConditions') }}
|
|
116
|
+
</el-button>
|
|
117
|
+
</div>
|
|
118
|
+
<div class="drawer-footer" data-test-id="DIV-eCU0O7">
|
|
119
|
+
<el-button type="primary" data-test-id="EL-BUTTON-xHRONm" @click="saveView">
|
|
120
|
+
{{ t('save') }}
|
|
121
|
+
</el-button>
|
|
122
|
+
<el-button type="primary" data-test-id="EL-BUTTON-CQwuMO" @click="close">
|
|
123
|
+
{{ t('cancellation') }}
|
|
124
|
+
</el-button>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
</template>
|
|
130
|
+
</el-drawer>
|
|
131
|
+
</template>
|
|
132
|
+
|
|
133
|
+
<script setup>
|
|
134
|
+
import { ref, computed, reactive } from 'vue';
|
|
135
|
+
import { useI18n } from 'vue-i18n';
|
|
136
|
+
import apiFunction from '@/scriptFiles/checkApiErrorMechanism.js';
|
|
137
|
+
import { ElMessage, ElLoading } from 'element-plus';
|
|
138
|
+
import dayjs from 'dayjs';
|
|
139
|
+
import filterCriteria from './filterCriteria.vue';
|
|
140
|
+
import optionFile from './config.js';
|
|
141
|
+
import CryptoJS from 'crypto-js';
|
|
142
|
+
const loadin = ref(null);
|
|
143
|
+
const loadingFun = (val) => {
|
|
144
|
+
if (val && !loadin.value) {
|
|
145
|
+
loadin.value = ElLoading.service({
|
|
146
|
+
target: '.create-view-drawer',
|
|
147
|
+
lock: true,
|
|
148
|
+
});
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
loadin.value?.close();
|
|
152
|
+
loadin.value = null;
|
|
153
|
+
};
|
|
154
|
+
const props = defineProps({
|
|
155
|
+
permissionData: Object,
|
|
156
|
+
selectOptions: {
|
|
157
|
+
type: Object,
|
|
158
|
+
default: () => ({}),
|
|
159
|
+
},
|
|
160
|
+
defaultCreateTimeString: {
|
|
161
|
+
type: String,
|
|
162
|
+
default: 'createTime',
|
|
163
|
+
}, // 默认创建时间字符串
|
|
164
|
+
});
|
|
165
|
+
const fieldSetting = ref([]);
|
|
166
|
+
const emit = defineEmits(['updataView']);
|
|
167
|
+
const dataFilterList = ref([]);
|
|
168
|
+
const dataInfo = reactive({
|
|
169
|
+
Operator: 12, // 操作内容
|
|
170
|
+
IsCustomSetting: false, // 是否自定义
|
|
171
|
+
DocCustomId: null, // 自定义id
|
|
172
|
+
ColumnType: 3, // 字段类型
|
|
173
|
+
TextValue: null, // 文本内容
|
|
174
|
+
NumberValue: null, // 数字内容
|
|
175
|
+
NumberRangeValue: [], // 最大值最小值
|
|
176
|
+
CloumnName: props.defaultCreateTimeString, // 字段名
|
|
177
|
+
SelectRangeValue: [], // 下拉选择内容
|
|
178
|
+
// 单选日期
|
|
179
|
+
DateTimeOperatorValue: {
|
|
180
|
+
TimeType: null,
|
|
181
|
+
TimeValue: null,
|
|
182
|
+
},
|
|
183
|
+
// 多选日期范围对应的值
|
|
184
|
+
DateTimeRangeValue: {
|
|
185
|
+
TimeType: null,
|
|
186
|
+
TimeValue: [],
|
|
187
|
+
},
|
|
188
|
+
// 自定义区间1:双区间,0:单区间
|
|
189
|
+
DateTimeDynamicFilteringValue: {
|
|
190
|
+
DateType: 1,
|
|
191
|
+
},
|
|
192
|
+
// 自定义范围区间对应的值
|
|
193
|
+
DateTimeDynamicFilteringCustomize: [
|
|
194
|
+
{
|
|
195
|
+
PastOrFuture: 0,
|
|
196
|
+
NumberValue: 365,
|
|
197
|
+
DayType: 1,
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
PastOrFuture: 2,
|
|
201
|
+
NumberValue: 1,
|
|
202
|
+
DayType: 1,
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
StartOrEnd: null,
|
|
206
|
+
});
|
|
207
|
+
const { t, locale } = useI18n();
|
|
208
|
+
const activeMenu = ref('basicInfo');
|
|
209
|
+
const viewId = ref(null); // 视图ID
|
|
210
|
+
const viewTypeTitle = ref(t('newView'));
|
|
211
|
+
const visible = ref(false); // 视图窗口
|
|
212
|
+
const isType = ref(1); // 1:新增 0:编辑
|
|
213
|
+
const formData = reactive({
|
|
214
|
+
viewName: '', // 视图名称
|
|
215
|
+
permission: ['-1'], // 查阅人员
|
|
216
|
+
selectedIconIndex: 0, // 图标
|
|
217
|
+
});
|
|
218
|
+
const filterCriteriaRef = ref(null);
|
|
219
|
+
const basicFormRef = ref(null);
|
|
220
|
+
// 校验
|
|
221
|
+
const rules = computed(() => ({
|
|
222
|
+
viewName: [
|
|
223
|
+
{ required: true, message: t('required'), trigger: ['change'] },
|
|
224
|
+
{
|
|
225
|
+
validator: async (rule, value, callback) => {
|
|
226
|
+
const {
|
|
227
|
+
data: { code },
|
|
228
|
+
} = await apiFunction.checkViewName({
|
|
229
|
+
viewName: value,
|
|
230
|
+
permissionCode: props.permissionData.permissionCode,
|
|
231
|
+
id: viewId.value,
|
|
232
|
+
});
|
|
233
|
+
if (code !== 0 && viewId.value >= 0) {
|
|
234
|
+
return callback(new Error(t('duplicateViewNames')));
|
|
235
|
+
}
|
|
236
|
+
if (value !== value.trim()) {
|
|
237
|
+
return callback(new Error(t('haveSpace')));
|
|
238
|
+
}
|
|
239
|
+
if (value.trim().length > 20) {
|
|
240
|
+
return callback(new Error(t('no20Characters')));
|
|
241
|
+
}
|
|
242
|
+
callback();
|
|
243
|
+
},
|
|
244
|
+
trigger: ['change'],
|
|
245
|
+
},
|
|
246
|
+
],
|
|
247
|
+
permission: [{ required: true, message: t('required'), trigger: ['blur', 'change'] }],
|
|
248
|
+
}));
|
|
249
|
+
// 查询人员
|
|
250
|
+
// 数据源 - 将"所有人"的value改为'1'保持一致性
|
|
251
|
+
const options = ref([]);
|
|
252
|
+
const queryDepartmentStaff = async () => {
|
|
253
|
+
await apiFunction
|
|
254
|
+
.getViewReadEmployeeList()
|
|
255
|
+
.then((res) => {
|
|
256
|
+
if (res.data.code === 0) {
|
|
257
|
+
options.value = res.data.content;
|
|
258
|
+
} else {
|
|
259
|
+
ElMessage.error(t('message'));
|
|
260
|
+
}
|
|
261
|
+
})
|
|
262
|
+
.catch(() => {
|
|
263
|
+
ElMessage.error(t('apiError'));
|
|
264
|
+
});
|
|
265
|
+
};
|
|
266
|
+
// 图标选择配置
|
|
267
|
+
const iconColors = ref(['#125088', '#FF0000', '#F0D155', '#99C0E4', '#FF7A21', '#323338', '#34AA1A']);
|
|
268
|
+
// 级联选择器配置
|
|
269
|
+
const cascadeProperty = {
|
|
270
|
+
showPrefix: true,
|
|
271
|
+
multiple: true,
|
|
272
|
+
checkOnClickNode: true,
|
|
273
|
+
renderTag: (obj) => obj.label,
|
|
274
|
+
};
|
|
275
|
+
const handleChange = (newValues) => {
|
|
276
|
+
if (newValues.length && newValues.length > 1) {
|
|
277
|
+
if (newValues[0].includes('-1')) {
|
|
278
|
+
formData.permission = formData.permission.filter((ite, i) => i > 0);
|
|
279
|
+
} else {
|
|
280
|
+
newValues.forEach((item) => {
|
|
281
|
+
const isAll = item.some((el) => el === '-1');
|
|
282
|
+
if (isAll) {
|
|
283
|
+
formData.permission = ['-1'];
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
/* 筛选条件 */
|
|
290
|
+
const addFilterCondition = () => {
|
|
291
|
+
dataFilterList.value.push({
|
|
292
|
+
Operator: null,
|
|
293
|
+
IsCustomSetting: null,
|
|
294
|
+
DocCustomId: null,
|
|
295
|
+
ColumnType: null,
|
|
296
|
+
TextValue: null,
|
|
297
|
+
NumberValue: null,
|
|
298
|
+
NumberRangeValue: [],
|
|
299
|
+
CloumnName: null,
|
|
300
|
+
SelectRangeValue: [],
|
|
301
|
+
DateTimeOperatorValue: { TimeType: null, TimeValue: null },
|
|
302
|
+
DateTimeRangeValue: { TimeType: null, TimeValue: [] },
|
|
303
|
+
DateTimeDynamicFilteringValue: {
|
|
304
|
+
DateType: null,
|
|
305
|
+
},
|
|
306
|
+
DateTimeDynamicFilteringCustomize: [
|
|
307
|
+
{
|
|
308
|
+
PastOrFuture: null,
|
|
309
|
+
NumberValue: null,
|
|
310
|
+
DayType: null,
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
PastOrFuture: null,
|
|
314
|
+
NumberValue: null,
|
|
315
|
+
DayType: null,
|
|
316
|
+
},
|
|
317
|
+
],
|
|
318
|
+
});
|
|
319
|
+
};
|
|
320
|
+
const setPerson = (List) => {
|
|
321
|
+
if (!List.length) {
|
|
322
|
+
return ['-1'];
|
|
323
|
+
}
|
|
324
|
+
let result = [];
|
|
325
|
+
const allList = [];
|
|
326
|
+
options.value.forEach((item) => {
|
|
327
|
+
if (item.children.length) {
|
|
328
|
+
item.children.forEach((el) => {
|
|
329
|
+
allList.push(el.value);
|
|
330
|
+
if (List.includes(Number(el.value))) {
|
|
331
|
+
result.push([item.value, el.value]);
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
if (allList.length === List.length) {
|
|
337
|
+
result = [['-1']];
|
|
338
|
+
}
|
|
339
|
+
return result;
|
|
340
|
+
};
|
|
341
|
+
/* 查询自定义筛选字段内容 */
|
|
342
|
+
const getViewFilterList = async () => {
|
|
343
|
+
try {
|
|
344
|
+
// 优先使用外部传入的selectOptions数据
|
|
345
|
+
if (props.selectOptions && props.selectOptions.fieldList && props.selectOptions.fieldList.length > 0) {
|
|
346
|
+
// 转换外部传入的fieldList数据为fieldSetting格式
|
|
347
|
+
fieldSetting.value = props.selectOptions.fieldList.map((item) => ({
|
|
348
|
+
fieldName: item.fieldName,
|
|
349
|
+
fieldTypeId: item.fieldTypeId,
|
|
350
|
+
fieldSelectOptions: item.fieldSelectOptions,
|
|
351
|
+
key: item.key || item.fieldName,
|
|
352
|
+
isDoc: item.isDoc || false,
|
|
353
|
+
}));
|
|
354
|
+
} else {
|
|
355
|
+
// 如果没有外部数据,则回退到API调用
|
|
356
|
+
const {
|
|
357
|
+
data: { code, content, message },
|
|
358
|
+
} = await apiFunction.getViewFilterList({ permissionCode: props.permissionData.permissionCode });
|
|
359
|
+
const params = {
|
|
360
|
+
docCode: props.permissionData.docCode,
|
|
361
|
+
status: 1,
|
|
362
|
+
fieldName: '',
|
|
363
|
+
consDate: [],
|
|
364
|
+
startIndex: 0,
|
|
365
|
+
count: 100,
|
|
366
|
+
};
|
|
367
|
+
const custom = await apiFunction.querySetting(params);
|
|
368
|
+
if (code !== 0) {
|
|
369
|
+
ElMessage.error(t(message));
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
const fieldSettings = content.map((item) => ({
|
|
373
|
+
fieldName: item.fieldKey,
|
|
374
|
+
fieldTypeId: item.fieldTypeId,
|
|
375
|
+
fieldSelectOptions: item.fieldSelectOptions,
|
|
376
|
+
key: item.fieldKey,
|
|
377
|
+
isDoc: false,
|
|
378
|
+
}));
|
|
379
|
+
let docCustomSettings = [];
|
|
380
|
+
if (custom.data.code === 0) {
|
|
381
|
+
docCustomSettings = custom.data.content.data
|
|
382
|
+
.filter((it) => it.fieldTypeId !== 9)
|
|
383
|
+
.map((item) => ({
|
|
384
|
+
fieldName: item.fieldName,
|
|
385
|
+
fieldTypeId: item.fieldTypeId,
|
|
386
|
+
fieldSelectOptions: item.fieldSelectOptions,
|
|
387
|
+
key: item.docCustomId,
|
|
388
|
+
isDoc: true,
|
|
389
|
+
}));
|
|
390
|
+
}
|
|
391
|
+
fieldSetting.value = [...fieldSettings, ...docCustomSettings];
|
|
392
|
+
}
|
|
393
|
+
const createTimeSetting = fieldSetting.value.find((item) => item.key === props.defaultCreateTimeString);
|
|
394
|
+
if (!createTimeSetting) {
|
|
395
|
+
fieldSetting.value.unshift({
|
|
396
|
+
fieldName: props.defaultCreateTimeString,
|
|
397
|
+
fieldKey: props.defaultCreateTimeString,
|
|
398
|
+
fieldTypeId: 3,
|
|
399
|
+
fieldSelectOptions: [],
|
|
400
|
+
key: props.defaultCreateTimeString,
|
|
401
|
+
isDoc: false,
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
} catch (error) {
|
|
405
|
+
ElMessage.error(t('apiError'));
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
const open = async (id, type) => {
|
|
409
|
+
try {
|
|
410
|
+
loadingFun(true);
|
|
411
|
+
activeMenu.value = 'basicInfo';
|
|
412
|
+
visible.value = true;
|
|
413
|
+
await queryDepartmentStaff();
|
|
414
|
+
await getViewFilterList();
|
|
415
|
+
isType.value = type;
|
|
416
|
+
if (id) {
|
|
417
|
+
viewTypeTitle.value = type ? t('copyView') : t('editView');
|
|
418
|
+
if (!isType.value) {
|
|
419
|
+
viewId.value = id;
|
|
420
|
+
}
|
|
421
|
+
// 编辑逻辑待补充
|
|
422
|
+
const { data } = await apiFunction.getViewDetail(id, !!type);
|
|
423
|
+
if (data.code === 0) {
|
|
424
|
+
dataFilterList.value = data.content.fieldString ? [...JSON.parse(data.content.fieldString)] : [{ ...dataInfo }];
|
|
425
|
+
formData.viewName = type
|
|
426
|
+
? `${t('copy')}${['zh-cn', 'zh-tw'].includes(locale.value) ? '' : ' '}${data.content.id < 0 && (data.content.viewName === '全部' || data.content.viewName === 'all') ? t('all') : data.content.viewName}`
|
|
427
|
+
: data.content.id < 0 && (data.content.viewName === '全部' || data.content.viewName === 'all')
|
|
428
|
+
? t('all')
|
|
429
|
+
: data.content.viewName;
|
|
430
|
+
formData.permission = setPerson(data.content.viewPermissionEmpId);
|
|
431
|
+
formData.selectedIconIndex = Number(data.content.meta);
|
|
432
|
+
}
|
|
433
|
+
} else {
|
|
434
|
+
dataFilterList.value = [{ ...dataInfo }];
|
|
435
|
+
}
|
|
436
|
+
} catch (error) {
|
|
437
|
+
ElMessage.error(t('apiError'));
|
|
438
|
+
} finally {
|
|
439
|
+
loadingFun(false);
|
|
440
|
+
basicFormRef.value.clearValidate();
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
const close = () => {
|
|
444
|
+
viewTypeTitle.value = t('newView');
|
|
445
|
+
viewId.value = null;
|
|
446
|
+
visible.value = false;
|
|
447
|
+
dataFilterList.value = [{ ...dataInfo }];
|
|
448
|
+
formData.viewName = '';
|
|
449
|
+
formData.permission = ['-1'];
|
|
450
|
+
formData.selectedIconIndex = 0;
|
|
451
|
+
basicFormRef.value.clearValidate();
|
|
452
|
+
};
|
|
453
|
+
// 部门人员
|
|
454
|
+
const getDepartmentStaff = (list) => {
|
|
455
|
+
let result = [];
|
|
456
|
+
if (list.length === 1 && list[0].includes('-1')) {
|
|
457
|
+
options.value.forEach((item) => {
|
|
458
|
+
if (item.children.length) {
|
|
459
|
+
item.children.forEach((el) => result.push(el.value));
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
return result;
|
|
463
|
+
}
|
|
464
|
+
list.forEach((item) => {
|
|
465
|
+
if (item.length > 1) {
|
|
466
|
+
result.push(item[1]);
|
|
467
|
+
} else if (item.length === 1) {
|
|
468
|
+
result.push(item[0]);
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
return result;
|
|
472
|
+
};
|
|
473
|
+
// 解析数据筛选
|
|
474
|
+
const validateField = (val) => {
|
|
475
|
+
if (val === null || (Array.isArray(val) && !val.length)) {
|
|
476
|
+
return false;
|
|
477
|
+
}
|
|
478
|
+
return true;
|
|
479
|
+
};
|
|
480
|
+
// 时间经度处理
|
|
481
|
+
const getTimeLongitude = (val) => {
|
|
482
|
+
const obj = optionFile.timePrecisionOptions.find((el) => el.value === val);
|
|
483
|
+
return obj.label === 'daily' ? 'day' : obj.label;
|
|
484
|
+
};
|
|
485
|
+
const getTimeFormat = (val) => optionFile.timePrecisionOptions.find((el) => el.value === val)?.timeFormat;
|
|
486
|
+
// 动态筛选内容处理
|
|
487
|
+
const getDynamicFilter = (val, sql) => {
|
|
488
|
+
const obj = optionFile.dynamicFilteringOptions.find((el) => el.value === val);
|
|
489
|
+
return sql ? obj.sql : obj.label;
|
|
490
|
+
};
|
|
491
|
+
// 动态筛选过去、未来处理
|
|
492
|
+
const getFutureOptions = (val) => {
|
|
493
|
+
const obj = optionFile.pastOrFutureOptions.find((el) => el.value === val);
|
|
494
|
+
return obj.label;
|
|
495
|
+
};
|
|
496
|
+
// 动态筛选时间类型处理
|
|
497
|
+
const getDateType = (val) => {
|
|
498
|
+
const obj = optionFile.dayTypeOptions.find((el) => el.value === val);
|
|
499
|
+
return obj.label === 'daily' ? 'day' : obj.label;
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
function calculateTimestamp(timestamp, dimension) {
|
|
503
|
+
// 定义各维度对应的毫秒数
|
|
504
|
+
const millisecondsPerUnit = {
|
|
505
|
+
0: 24 * 60 * 60 * 1000,
|
|
506
|
+
1: 60 * 60 * 1000,
|
|
507
|
+
2: 60 * 1000,
|
|
508
|
+
3: 1000,
|
|
509
|
+
};
|
|
510
|
+
const unitMs = millisecondsPerUnit[dimension];
|
|
511
|
+
return +timestamp + unitMs;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
// 处理SQL语句
|
|
515
|
+
const getSqlInfo = (item) => {
|
|
516
|
+
let title = fieldSetting.value.find((el) => el.key === item.CloumnName).fieldName;
|
|
517
|
+
let sqlTitle = item.IsCustomSetting ? `"${title}"` : title;
|
|
518
|
+
// 生产工单入库未完字段单独处理
|
|
519
|
+
if (sqlTitle === 'inboundRemain') {
|
|
520
|
+
sqlTitle = '(required_throughput-COALESCE(inboundQuantity,0)+COALESCE(returnQuantity,0))';
|
|
521
|
+
}
|
|
522
|
+
let sql = `${sqlTitle} ${optionFile.operatorOptions.find((el) => el.value === item.Operator)?.sql}`;
|
|
523
|
+
let str = '';
|
|
524
|
+
// 处理文本sql
|
|
525
|
+
if ([1, 5, 6].includes(item.ColumnType)) {
|
|
526
|
+
if (item.TextValue) {
|
|
527
|
+
if (item.Operator === 5) {
|
|
528
|
+
str = `${sql} '${item.TextValue}'`;
|
|
529
|
+
} else if (item.Operator === 6) {
|
|
530
|
+
str = `(${sql} '${item.TextValue}' or ${sqlTitle} is null)`;
|
|
531
|
+
} else if (item.Operator === 8) {
|
|
532
|
+
str = `(${sql} '%${item.TextValue}%' or ${sqlTitle} is null)`;
|
|
533
|
+
} else {
|
|
534
|
+
str = `${sql} '%${item.TextValue}%'`;
|
|
535
|
+
}
|
|
536
|
+
} else {
|
|
537
|
+
if (item.Operator === 10) {
|
|
538
|
+
str = `(${sql} null and ${sqlTitle} != '')`;
|
|
539
|
+
} else if (item.Operator === 9) {
|
|
540
|
+
str = `(${sql} null or ${sqlTitle} = '')`;
|
|
541
|
+
} else {
|
|
542
|
+
str = `${sql} null`;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
// 处理下拉sql
|
|
547
|
+
if ([7, 8].includes(item.ColumnType)) {
|
|
548
|
+
if (item.SelectRangeValue.length) {
|
|
549
|
+
if (item.IsCustomSetting && item.ColumnType === 8) {
|
|
550
|
+
str = `STRING_TO_ARRAY(replace(replace(replace(${sqlTitle}, '"', ''), '[', ''), ']', ''), ',')::text[] && STRING_TO_ARRAY('${item.SelectRangeValue.toString()}', ',')::text[] =${item.Operator === 15 ? true : false}`;
|
|
551
|
+
} else {
|
|
552
|
+
if (item.ColumnType === 7) {
|
|
553
|
+
str = `${sql} '${item.SelectRangeValue}'`;
|
|
554
|
+
} else {
|
|
555
|
+
str = `${sql} (${item.SelectRangeValue.toString()})`;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
} else {
|
|
559
|
+
if (item.Operator === 10 && item.IsCustomSetting) {
|
|
560
|
+
str = `(${sql} null and ${sqlTitle} != '')`;
|
|
561
|
+
} else if (item.Operator === 9 && item.IsCustomSetting) {
|
|
562
|
+
str = `(${sql} null or ${sqlTitle} = '')`;
|
|
563
|
+
} else {
|
|
564
|
+
str = `${sql} null`;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
// 处理数字sql
|
|
569
|
+
if (item.ColumnType === 2 || item.ColumnType === 9) {
|
|
570
|
+
if (item.NumberRangeValue.length) {
|
|
571
|
+
if (item.Operator === 14) {
|
|
572
|
+
str = `(${sql} ${item.NumberRangeValue[0]} AND ${item.NumberRangeValue[1]} or ${sqlTitle} is null)`;
|
|
573
|
+
} else {
|
|
574
|
+
str = `${sql} ${item.NumberRangeValue[0]} AND ${item.NumberRangeValue[1]}`;
|
|
575
|
+
}
|
|
576
|
+
} else {
|
|
577
|
+
str = `${sql} null`;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
// 处理日期sql
|
|
581
|
+
if ([3, 4].includes(item.ColumnType)) {
|
|
582
|
+
// 处理日期区间
|
|
583
|
+
let dateTitle = item.IsCustomSetting
|
|
584
|
+
? `"${title}_${item.StartOrEnd ? 'end' : 'start'}"`
|
|
585
|
+
: `${title}_${item.StartOrEnd ? 'end' : 'start'}`;
|
|
586
|
+
if (item.ColumnType === 4) {
|
|
587
|
+
sql = `${dateTitle} ${optionFile.operatorOptions.find((el) => el.value === item.Operator)?.sql}`;
|
|
588
|
+
}
|
|
589
|
+
if ([1, 2, 3, 4].includes(item.Operator)) {
|
|
590
|
+
str = `${sql} ${item.DateTimeOperatorValue.TimeValue}`;
|
|
591
|
+
}
|
|
592
|
+
if ([5].includes(item.Operator)) {
|
|
593
|
+
const endTime = calculateTimestamp(item.DateTimeOperatorValue.TimeValue, item.DateTimeOperatorValue.TimeType);
|
|
594
|
+
str =
|
|
595
|
+
item.StartOrEnd === null
|
|
596
|
+
? `${sqlTitle} >= ${item.DateTimeOperatorValue.TimeValue} AND ${sqlTitle} < ${endTime}`
|
|
597
|
+
: `${dateTitle} >= ${item.DateTimeOperatorValue.TimeValue} AND ${dateTitle} < ${endTime}`;
|
|
598
|
+
}
|
|
599
|
+
if ([9, 10].includes(item.Operator)) {
|
|
600
|
+
str = `${sql} null`;
|
|
601
|
+
}
|
|
602
|
+
if (item.Operator === 11) {
|
|
603
|
+
str = `${sql} ${dayjs(item.DateTimeRangeValue.TimeValue[0]).format('x')} AND ${calculateTimestamp(dayjs(item.DateTimeRangeValue.TimeValue[1]).format('x'), item.DateTimeRangeValue.TimeType)}`;
|
|
604
|
+
}
|
|
605
|
+
if (item.Operator === 12) {
|
|
606
|
+
// 动态筛选不需要处理类型
|
|
607
|
+
if ([4, 5, 6, 7, 8].includes(item.DateTimeDynamicFilteringValue.DateType)) {
|
|
608
|
+
str = `${sql} ${getDynamicFilter(item.DateTimeDynamicFilteringValue.DateType, true)}`;
|
|
609
|
+
}
|
|
610
|
+
// 天
|
|
611
|
+
if (item.DateTimeDynamicFilteringValue.DateType === 2) {
|
|
612
|
+
str = `${sql} currentday`;
|
|
613
|
+
}
|
|
614
|
+
// 昨天
|
|
615
|
+
if (item.DateTimeDynamicFilteringValue.DateType === 3) {
|
|
616
|
+
str = `${sql} past_day_1`;
|
|
617
|
+
}
|
|
618
|
+
if (item.DateTimeDynamicFilteringValue.DateType === 0) {
|
|
619
|
+
let rangeSql = `${getFutureOptions(item.DateTimeDynamicFilteringCustomize[0].PastOrFuture)}_${getDateType(item.DateTimeDynamicFilteringCustomize[0].DayType)}_${item.DateTimeDynamicFilteringCustomize[0].NumberValue}`;
|
|
620
|
+
if (item.DateTimeDynamicFilteringCustomize[0].PastOrFuture) {
|
|
621
|
+
str = `${sql} currentend AND ${rangeSql}`;
|
|
622
|
+
} else {
|
|
623
|
+
str = `${sql} ${rangeSql} AND currentstart`;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
// 自定义范围
|
|
627
|
+
if (item.DateTimeDynamicFilteringValue.DateType === 1) {
|
|
628
|
+
let startSql = `${getFutureOptions(item.DateTimeDynamicFilteringCustomize[0].PastOrFuture)}_${getDateType(item.DateTimeDynamicFilteringCustomize[0].DayType)}_${item.DateTimeDynamicFilteringCustomize[0].NumberValue}`;
|
|
629
|
+
let endSql = `${getFutureOptions(item.DateTimeDynamicFilteringCustomize[1].PastOrFuture)}_${getDateType(item.DateTimeDynamicFilteringCustomize[1].DayType)}_${item.DateTimeDynamicFilteringCustomize[1].NumberValue}`;
|
|
630
|
+
if (item.DateTimeDynamicFilteringCustomize[0].PastOrFuture === 2) {
|
|
631
|
+
startSql = `${getFutureOptions(item.DateTimeDynamicFilteringCustomize[0].PastOrFuture)}${getDateType(item.DateTimeDynamicFilteringCustomize[0].DayType)}`;
|
|
632
|
+
}
|
|
633
|
+
if (item.DateTimeDynamicFilteringCustomize[1].PastOrFuture === 2) {
|
|
634
|
+
endSql = `${getFutureOptions(item.DateTimeDynamicFilteringCustomize[1].PastOrFuture)}${getDateType(item.DateTimeDynamicFilteringCustomize[1].DayType)}`;
|
|
635
|
+
}
|
|
636
|
+
str = `${sql} ${startSql} AND ${endSql}`;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
return str;
|
|
641
|
+
};
|
|
642
|
+
// 获取日期区间信息
|
|
643
|
+
const getIntervalInfo = (item) => {
|
|
644
|
+
let obj = {};
|
|
645
|
+
if ([1, 2, 3, 4, 5].includes(item.Operator)) {
|
|
646
|
+
obj = {
|
|
647
|
+
precision: getTimeLongitude(item.DateTimeOperatorValue.TimeType),
|
|
648
|
+
value: item.DateTimeOperatorValue.TimeValue,
|
|
649
|
+
judgeLogic: item.Operator,
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
if ([9, 10].includes(item.Operator)) {
|
|
653
|
+
obj = {
|
|
654
|
+
value: '',
|
|
655
|
+
judgeLogic: item.Operator,
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
if (item.Operator === 11) {
|
|
659
|
+
obj = {
|
|
660
|
+
precision: getTimeLongitude(item.DateTimeRangeValue.TimeType),
|
|
661
|
+
value: item.DateTimeRangeValue.TimeValue,
|
|
662
|
+
judgeLogic: item.Operator,
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
if (item.Operator === 12) {
|
|
666
|
+
if (item.DateTimeDynamicFilteringValue.DateType === 0) {
|
|
667
|
+
obj = {
|
|
668
|
+
value: getDynamicFilter(item.DateTimeDynamicFilteringValue.DateType),
|
|
669
|
+
customType: getFutureOptions(item.DateTimeDynamicFilteringCustomize[0].PastOrFuture),
|
|
670
|
+
customUnit: getDateType(item.DateTimeDynamicFilteringCustomize[0].DayType),
|
|
671
|
+
customUum: item.DateTimeDynamicFilteringCustomize[0].NumberValue,
|
|
672
|
+
judgeLogic: item.Operator,
|
|
673
|
+
};
|
|
674
|
+
} else if (item.DateTimeDynamicFilteringValue.DateType === 1) {
|
|
675
|
+
obj = {
|
|
676
|
+
value: getDynamicFilter(item.DateTimeDynamicFilteringValue.DateType),
|
|
677
|
+
customTypeStart: getFutureOptions(item.DateTimeDynamicFilteringCustomize[0].PastOrFuture),
|
|
678
|
+
customUnitStart: getDateType(item.DateTimeDynamicFilteringCustomize[0].DayType),
|
|
679
|
+
customNumStart: item.DateTimeDynamicFilteringCustomize[0].NumberValue,
|
|
680
|
+
customTypeEnd: getFutureOptions(item.DateTimeDynamicFilteringCustomize[1].PastOrFuture),
|
|
681
|
+
customUnitEnd: getDateType(item.DateTimeDynamicFilteringCustomize[1].DayType),
|
|
682
|
+
customNumEnd: item.DateTimeDynamicFilteringCustomize[1].NumberValue,
|
|
683
|
+
judgeLogic: item.Operator,
|
|
684
|
+
};
|
|
685
|
+
} else {
|
|
686
|
+
obj = {
|
|
687
|
+
value: getDynamicFilter(item.DateTimeDynamicFilteringValue.DateType),
|
|
688
|
+
judgeLogic: item.Operator,
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
return obj;
|
|
693
|
+
};
|
|
694
|
+
// 获取其余字段信息
|
|
695
|
+
const getInfo = (item) => {
|
|
696
|
+
let obj = {};
|
|
697
|
+
if ([1, 5, 6].includes(item.ColumnType) && item.TextValue) {
|
|
698
|
+
obj = {
|
|
699
|
+
first: item.TextValue,
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
if ([7, 8].includes(item.ColumnType) && item.SelectRangeValue.length) {
|
|
703
|
+
obj = {
|
|
704
|
+
first: item.SelectRangeValue.toString(),
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
if ((item.ColumnType === 2 || item.ColumnType === 9) && item.NumberRangeValue.length) {
|
|
708
|
+
obj = {
|
|
709
|
+
first: item.NumberRangeValue[0],
|
|
710
|
+
second: item.NumberRangeValue[1],
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
if ([3].includes(item.ColumnType)) {
|
|
714
|
+
if ([1, 2, 3, 4, 5].includes(item.Operator)) {
|
|
715
|
+
obj = {
|
|
716
|
+
first: getTimeLongitude(item.DateTimeOperatorValue.TimeType),
|
|
717
|
+
second: item.DateTimeOperatorValue.TimeValue,
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
if (item.Operator === 11) {
|
|
721
|
+
obj = {
|
|
722
|
+
first: getTimeLongitude(item.DateTimeRangeValue.TimeType),
|
|
723
|
+
second: item.DateTimeRangeValue.TimeValue[0],
|
|
724
|
+
third: item.DateTimeRangeValue.TimeValue[1],
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
if (item.Operator === 12) {
|
|
728
|
+
if (item.DateTimeDynamicFilteringValue.DateType === 0) {
|
|
729
|
+
obj = {
|
|
730
|
+
first: getDynamicFilter(item.DateTimeDynamicFilteringValue.DateType),
|
|
731
|
+
second: getFutureOptions(item.DateTimeDynamicFilteringCustomize[0].PastOrFuture),
|
|
732
|
+
four: getDateType(item.DateTimeDynamicFilteringCustomize[0].DayType),
|
|
733
|
+
third: item.DateTimeDynamicFilteringCustomize[0].NumberValue,
|
|
734
|
+
judgeLogic: item.Operator,
|
|
735
|
+
};
|
|
736
|
+
} else if (item.DateTimeDynamicFilteringValue.DateType === 1) {
|
|
737
|
+
obj = {
|
|
738
|
+
first: getDynamicFilter(item.DateTimeDynamicFilteringValue.DateType),
|
|
739
|
+
second: getFutureOptions(item.DateTimeDynamicFilteringCustomize[0].PastOrFuture),
|
|
740
|
+
third: item.DateTimeDynamicFilteringCustomize[0].NumberValue,
|
|
741
|
+
four: getDateType(item.DateTimeDynamicFilteringCustomize[0].DayType),
|
|
742
|
+
five: getFutureOptions(item.DateTimeDynamicFilteringCustomize[1].PastOrFuture),
|
|
743
|
+
six: item.DateTimeDynamicFilteringCustomize[1].NumberValue,
|
|
744
|
+
seven: getDateType(item.DateTimeDynamicFilteringCustomize[1].DayType),
|
|
745
|
+
judgeLogic: item.Operator,
|
|
746
|
+
};
|
|
747
|
+
} else {
|
|
748
|
+
obj = {
|
|
749
|
+
first: getDynamicFilter(item.DateTimeDynamicFilteringValue.DateType),
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
return { ...obj };
|
|
755
|
+
};
|
|
756
|
+
const getFeild = (item) => {
|
|
757
|
+
let str = {};
|
|
758
|
+
if (item.ColumnType === 4) {
|
|
759
|
+
const type = item.StartOrEnd ? 'end' : 'start';
|
|
760
|
+
str[type] = { ...getIntervalInfo(item) };
|
|
761
|
+
} else {
|
|
762
|
+
str = { ...getInfo(item) };
|
|
763
|
+
}
|
|
764
|
+
return { ...str };
|
|
765
|
+
};
|
|
766
|
+
// 获取筛选字符串内容
|
|
767
|
+
const getStringInfo = (item) => {
|
|
768
|
+
let str = [];
|
|
769
|
+
let field = {};
|
|
770
|
+
field = fieldSetting.value.find((el) => el.key === item.CloumnName);
|
|
771
|
+
str.push(field.key === 'salesOrderNumber' ? field.key : field.fieldName);
|
|
772
|
+
if (validateField(item.StartOrEnd)) {
|
|
773
|
+
str.push(item.StartOrEnd ? 'intervalEnd' : 'intervalStart');
|
|
774
|
+
}
|
|
775
|
+
if (validateField(item.Operator)) {
|
|
776
|
+
str.push(optionFile.operatorOptions.find((el) => el.value === item.Operator)?.label);
|
|
777
|
+
}
|
|
778
|
+
if (validateField(item.TextValue)) {
|
|
779
|
+
str.push(item.TextValue);
|
|
780
|
+
}
|
|
781
|
+
if (validateField(item.SelectRangeValue)) {
|
|
782
|
+
if (field.fieldSelectOptions) {
|
|
783
|
+
if (item.IsCustomSetting) {
|
|
784
|
+
str.push(item.SelectRangeValue.toString());
|
|
785
|
+
} else {
|
|
786
|
+
try {
|
|
787
|
+
// 验证 fieldSelectOptions 是有效的 JSON 字符串
|
|
788
|
+
if (
|
|
789
|
+
typeof field.fieldSelectOptions === 'string' &&
|
|
790
|
+
field.fieldSelectOptions.trim() &&
|
|
791
|
+
((field.fieldSelectOptions.trim().startsWith('[') && field.fieldSelectOptions.trim().endsWith(']')) ||
|
|
792
|
+
(field.fieldSelectOptions.trim().startsWith('{') && field.fieldSelectOptions.trim().endsWith('}')))
|
|
793
|
+
) {
|
|
794
|
+
const labelList = JSON.parse(field.fieldSelectOptions)
|
|
795
|
+
.filter((el) => item.SelectRangeValue.includes(el.value))
|
|
796
|
+
.map((el) => el.key);
|
|
797
|
+
str.push(labelList.toString());
|
|
798
|
+
} else {
|
|
799
|
+
// 如果不是有效的 JSON 字符串,直接使用 SelectRangeValue
|
|
800
|
+
str.push(item.SelectRangeValue.toString());
|
|
801
|
+
}
|
|
802
|
+
} catch (error) {
|
|
803
|
+
// 解析失败时直接使用 SelectRangeValue
|
|
804
|
+
str.push(item.SelectRangeValue.toString());
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
} else {
|
|
808
|
+
const list = [];
|
|
809
|
+
// 从统一的selectOptions中获取字段选项
|
|
810
|
+
const fieldOptions = props.selectOptions[item.CloumnName] || [];
|
|
811
|
+
if (Array.isArray(fieldOptions)) {
|
|
812
|
+
fieldOptions.forEach((el) => {
|
|
813
|
+
if (item.SelectRangeValue.includes(el.value)) {
|
|
814
|
+
list.push(el.label);
|
|
815
|
+
}
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
// 如果没有找到对应的选项,直接使用值
|
|
819
|
+
str.push(list.length ? list.toString() : item.SelectRangeValue.toString());
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
if (validateField(item.NumberRangeValue)) {
|
|
823
|
+
str.push(item.NumberRangeValue.toString());
|
|
824
|
+
}
|
|
825
|
+
if (validateField(item.DateTimeOperatorValue.TimeType)) {
|
|
826
|
+
str.push(
|
|
827
|
+
getTimeLongitude(item.DateTimeOperatorValue.TimeType),
|
|
828
|
+
dayjs(item.DateTimeOperatorValue.TimeValue).format(getTimeFormat(item.DateTimeOperatorValue.TimeType)),
|
|
829
|
+
);
|
|
830
|
+
}
|
|
831
|
+
if (validateField(item.DateTimeRangeValue.TimeType)) {
|
|
832
|
+
str.push(getTimeLongitude(item.DateTimeRangeValue.TimeType));
|
|
833
|
+
}
|
|
834
|
+
if (validateField(item.DateTimeRangeValue.TimeType)) {
|
|
835
|
+
str.push(
|
|
836
|
+
dayjs(item.DateTimeRangeValue.TimeValue[0]).format(getTimeFormat(item.DateTimeRangeValue.TimeType)),
|
|
837
|
+
dayjs(item.DateTimeRangeValue.TimeValue[1]).format(getTimeFormat(item.DateTimeRangeValue.TimeType)),
|
|
838
|
+
);
|
|
839
|
+
}
|
|
840
|
+
if (validateField(item.DateTimeDynamicFilteringValue.DateType)) {
|
|
841
|
+
str.push(getDynamicFilter(item.DateTimeDynamicFilteringValue.DateType));
|
|
842
|
+
}
|
|
843
|
+
if (validateField(item.DateTimeDynamicFilteringCustomize[0].DayType)) {
|
|
844
|
+
str.push(
|
|
845
|
+
getFutureOptions(item.DateTimeDynamicFilteringCustomize[0].PastOrFuture),
|
|
846
|
+
item.DateTimeDynamicFilteringCustomize[0].NumberValue,
|
|
847
|
+
getDateType(item.DateTimeDynamicFilteringCustomize[0].DayType),
|
|
848
|
+
);
|
|
849
|
+
}
|
|
850
|
+
if (validateField(item.DateTimeDynamicFilteringCustomize[1].DayType)) {
|
|
851
|
+
str.push(
|
|
852
|
+
getFutureOptions(item.DateTimeDynamicFilteringCustomize[1].PastOrFuture),
|
|
853
|
+
item.DateTimeDynamicFilteringCustomize[1].NumberValue,
|
|
854
|
+
getDateType(item.DateTimeDynamicFilteringCustomize[1].DayType),
|
|
855
|
+
);
|
|
856
|
+
}
|
|
857
|
+
return str.toString();
|
|
858
|
+
};
|
|
859
|
+
const parseDataFilter = () => {
|
|
860
|
+
const filterObj = {
|
|
861
|
+
viewField: [],
|
|
862
|
+
filterString: [],
|
|
863
|
+
whereSql: '',
|
|
864
|
+
};
|
|
865
|
+
const sqlList = [];
|
|
866
|
+
dataFilterList.value.forEach((item) => {
|
|
867
|
+
let fieldObj = fieldSetting.value.find((el) => el.key === item.CloumnName);
|
|
868
|
+
sqlList.push(getSqlInfo(item));
|
|
869
|
+
filterObj.filterString.push(getStringInfo(item));
|
|
870
|
+
filterObj.viewField.push({
|
|
871
|
+
fieldCode: fieldObj.fieldName,
|
|
872
|
+
fieldKey: item.IsCustomSetting ? fieldObj.fieldName : fieldObj.key,
|
|
873
|
+
docCustomId: item.DocCustomId || '',
|
|
874
|
+
fieldTypeId: item.ColumnType,
|
|
875
|
+
judgeLogic: item.ColumnType === 4 ? null : item.Operator,
|
|
876
|
+
fieldValue: JSON.stringify(getFeild(item)),
|
|
877
|
+
isCustom: item.IsCustomSetting ? 1 : 0,
|
|
878
|
+
});
|
|
879
|
+
});
|
|
880
|
+
sqlList.forEach((ite, ind) => {
|
|
881
|
+
filterObj.whereSql += ind ? ` AND ${ite}` : ite;
|
|
882
|
+
});
|
|
883
|
+
return { ...filterObj };
|
|
884
|
+
};
|
|
885
|
+
const encryptionSql = (sql) => {
|
|
886
|
+
const key = CryptoJS.enc.Utf8.parse('3847201956372841'); // 密钥,16字节
|
|
887
|
+
const iv = CryptoJS.enc.Utf8.parse('3847201956372841'); // 偏移量,16字节
|
|
888
|
+
const encrypted = CryptoJS.AES.encrypt(sql, key, {
|
|
889
|
+
iv: iv,
|
|
890
|
+
mode: CryptoJS.mode.CBC,
|
|
891
|
+
padding: CryptoJS.pad.Pkcs7,
|
|
892
|
+
});
|
|
893
|
+
return encrypted.toString();
|
|
894
|
+
};
|
|
895
|
+
const saveView = async () => {
|
|
896
|
+
try {
|
|
897
|
+
const filterValid = await filterCriteriaRef.value.validateAllForms();
|
|
898
|
+
const valid = await basicFormRef.value.validate();
|
|
899
|
+
if (valid && filterValid) {
|
|
900
|
+
loadingFun(true);
|
|
901
|
+
const { viewField, filterString, whereSql } = parseDataFilter();
|
|
902
|
+
const params = {
|
|
903
|
+
meta: String(formData.selectedIconIndex),
|
|
904
|
+
viewName: formData.viewName,
|
|
905
|
+
permissionCode: props.permissionData.permissionCode,
|
|
906
|
+
viewPermissionEmpId: getDepartmentStaff(formData.permission),
|
|
907
|
+
viewField: JSON.stringify(viewField),
|
|
908
|
+
filterString: JSON.stringify(filterString),
|
|
909
|
+
whereSql: encryptionSql(whereSql),
|
|
910
|
+
fieldString: JSON.stringify(dataFilterList.value),
|
|
911
|
+
};
|
|
912
|
+
if (isType.value) {
|
|
913
|
+
const {
|
|
914
|
+
data: { code },
|
|
915
|
+
} = await apiFunction.addView(params);
|
|
916
|
+
if (code === 0) {
|
|
917
|
+
ElMessage.success(t('addSuccess'));
|
|
918
|
+
emit('updataView');
|
|
919
|
+
close();
|
|
920
|
+
}
|
|
921
|
+
} else {
|
|
922
|
+
params.id = viewId.value;
|
|
923
|
+
const {
|
|
924
|
+
data: { code },
|
|
925
|
+
} = await apiFunction.editView(params);
|
|
926
|
+
if (code === 0) {
|
|
927
|
+
ElMessage.success(t('editSuccess'));
|
|
928
|
+
emit('updataView');
|
|
929
|
+
close();
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
} catch (err) {
|
|
934
|
+
ElMessage.error(t('someColumnRequired'));
|
|
935
|
+
} finally {
|
|
936
|
+
loadingFun(false);
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
defineExpose({
|
|
940
|
+
open,
|
|
941
|
+
});
|
|
942
|
+
</script>
|
|
943
|
+
|
|
944
|
+
<style scoped lang="scss">
|
|
945
|
+
.drawer-box {
|
|
946
|
+
width: 100%;
|
|
947
|
+
}
|
|
948
|
+
.view-box {
|
|
949
|
+
margin-top: -2rem;
|
|
950
|
+
margin-left: -1rem;
|
|
951
|
+
width: 100%;
|
|
952
|
+
height: 100%;
|
|
953
|
+
}
|
|
954
|
+
.view-title {
|
|
955
|
+
display: flex;
|
|
956
|
+
justify-content: space-between;
|
|
957
|
+
align-items: center;
|
|
958
|
+
}
|
|
959
|
+
.view-content {
|
|
960
|
+
display: flex;
|
|
961
|
+
width: 100%;
|
|
962
|
+
height: calc(100% - 1.5rem);
|
|
963
|
+
}
|
|
964
|
+
.el-menu-vertical-demo {
|
|
965
|
+
width: 150px;
|
|
966
|
+
border-right: 1px solid #eee;
|
|
967
|
+
}
|
|
968
|
+
.drawer-content {
|
|
969
|
+
width: 90%;
|
|
970
|
+
height: 95%;
|
|
971
|
+
overflow: auto;
|
|
972
|
+
margin-left: 10px;
|
|
973
|
+
}
|
|
974
|
+
.icon-options {
|
|
975
|
+
display: flex;
|
|
976
|
+
gap: 12px;
|
|
977
|
+
}
|
|
978
|
+
.icon-options .el-button {
|
|
979
|
+
width: 36px;
|
|
980
|
+
height: 36px;
|
|
981
|
+
border-radius: 4px;
|
|
982
|
+
display: flex;
|
|
983
|
+
align-items: center;
|
|
984
|
+
justify-content: center;
|
|
985
|
+
}
|
|
986
|
+
.icon-options .el-button.active {
|
|
987
|
+
border-width: 2px;
|
|
988
|
+
}
|
|
989
|
+
.radio-icon {
|
|
990
|
+
font-size: 18px;
|
|
991
|
+
}
|
|
992
|
+
.drawer-footer {
|
|
993
|
+
position: absolute;
|
|
994
|
+
bottom: 1rem;
|
|
995
|
+
right: 2rem;
|
|
996
|
+
}
|
|
997
|
+
.cursor {
|
|
998
|
+
cursor: pointer;
|
|
999
|
+
}
|
|
1000
|
+
</style>
|