centaline-data-driven-v3 0.0.66 → 0.0.68
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/dist/centaline-data-driven-v3.umd.js +51 -51
- package/package.json +1 -1
- package/src/assets/commonWeb.css +3 -0
- package/src/components/common/video.vue +2 -2
- package/src/components/web/ComboBox.vue +40 -6
- package/src/components/web/FormList.vue +69 -51
- package/src/components/web/RadioButton.vue +9 -2
- package/src/components/web/SearchList/Tablecurrency.vue +4 -3
- package/src/components/web/SearchScreen.vue +1 -1
- package/src/loader/src/ComboBox.js +2 -2
- package/src/loader/src/Form.js +1 -0
- package/src/loader/src/FormList.js +1 -1
- package/src/loader/src/SearchScreen.js +10 -10
- package/src/main.js +2 -2
- package/src/utils/request.js +28 -1
package/package.json
CHANGED
package/src/assets/commonWeb.css
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
<div class="alert fade in" role="alert"
|
|
3
3
|
style="padding:0px;border-bottom:none;display: table-caption;margin-left: 5px;">
|
|
4
4
|
<video :src="submitData[router.submitFormField]" controls="true" autoplay controlslist="nodownload"
|
|
5
|
-
:height="router.
|
|
6
|
-
:width="router.
|
|
5
|
+
:height="router.pageHeight ? router.pageHeight - 10 : '40'"
|
|
6
|
+
:width="router.pageWidth ? router.pageWidth - 10 : '100%'">您的浏览器不支持 video 标签。
|
|
7
7
|
</video>
|
|
8
8
|
</div>
|
|
9
9
|
</template>
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<ct-field :vmodel="model">
|
|
3
3
|
<template #Control>
|
|
4
|
-
<el-select-v2 ref="refselect" :key="itemKey" v-model="model.value" :options="model.options"
|
|
4
|
+
<el-select-v2 ref="refselect" :key="model.itemKey" v-model="model.value" :options="model.options"
|
|
5
5
|
:props="model.optionAttrs" v-bind="model.attrs" :disabled="model.locked" clearable @change="change"
|
|
6
6
|
:placeholder="model.placeholder" @visible-change="visibleChange" @clear="clear"
|
|
7
7
|
:filterable="model.filterable" :multiple="model.multiple" class="fieldControl" :height="300"
|
|
8
8
|
@click="clickHandler" :class="[model.moreActionRouter ? 'selectmore' : '', open ? 'open' : '']"
|
|
9
|
-
:filter-method="
|
|
9
|
+
:filter-method="debouncedRemoteMethod" @compositionstart="handleCompositionStart"
|
|
10
|
+
@compositionend="handleCompositionEnd">
|
|
10
11
|
<template #default="{ item }">
|
|
11
12
|
<el-tooltip :disabled="!item.toolTip" :content="item.toolTip" placement="right">
|
|
12
13
|
<span v-html="item.displayName || item.name"></span>
|
|
@@ -43,6 +44,7 @@
|
|
|
43
44
|
</ct-field>
|
|
44
45
|
</template>
|
|
45
46
|
<script lang="ts" setup>
|
|
47
|
+
import Axios from 'axios';
|
|
46
48
|
import { ref, nextTick } from 'vue'
|
|
47
49
|
import { Search } from '@element-plus/icons-vue'
|
|
48
50
|
import { initData, changeHandler } from '../../utils/mixins';
|
|
@@ -56,7 +58,9 @@ const props = defineProps({
|
|
|
56
58
|
const model = initData(props, ComboBox)
|
|
57
59
|
const refselect = ref()
|
|
58
60
|
const open = ref(false)
|
|
59
|
-
const
|
|
61
|
+
const isComposing = ref(false);
|
|
62
|
+
model.value.itemKey=Math.random();
|
|
63
|
+
let cancelTokenSource = null; // 用于存储取消令牌
|
|
60
64
|
|
|
61
65
|
//下拉框出现/隐藏时触发
|
|
62
66
|
function visibleChange(visible) {
|
|
@@ -79,8 +83,16 @@ function visibleChange(visible) {
|
|
|
79
83
|
}
|
|
80
84
|
//获取数据列表
|
|
81
85
|
function getOptions(key) {
|
|
82
|
-
if (
|
|
83
|
-
|
|
86
|
+
if (cancelTokenSource) {
|
|
87
|
+
// 取消上一次未完成的请求
|
|
88
|
+
cancelTokenSource.cancel('取消上一次请求');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// 创建新的取消令牌
|
|
92
|
+
cancelTokenSource = Axios.CancelToken.source();
|
|
93
|
+
if (!isComposing.value &&!model.value.moreActionRouter) {
|
|
94
|
+
model.value.getOptions(props.parameterAction, key,cancelTokenSource, function (data) {
|
|
95
|
+
if(data){
|
|
84
96
|
data.forEach((v) => {
|
|
85
97
|
let item = model.value.globalOptions.find((v1) => {
|
|
86
98
|
return v1.code === v.code && v1.locked;
|
|
@@ -113,17 +125,32 @@ function getOptions(key) {
|
|
|
113
125
|
nextTick(function () {
|
|
114
126
|
setminWidth()
|
|
115
127
|
});
|
|
128
|
+
}
|
|
116
129
|
})
|
|
117
130
|
}
|
|
118
131
|
|
|
119
132
|
}
|
|
133
|
+
// 防抖函数
|
|
134
|
+
function debounce(func, delay) {
|
|
135
|
+
let timer = null;
|
|
136
|
+
return function () {
|
|
137
|
+
const context = this;
|
|
138
|
+
const args = arguments;
|
|
139
|
+
clearTimeout(timer);
|
|
140
|
+
timer = setTimeout(() => {
|
|
141
|
+
func.apply(context, args);
|
|
142
|
+
}, delay);
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
// 创建防抖后的远程搜索方法,延迟 300 毫秒
|
|
146
|
+
const debouncedRemoteMethod = debounce(getOptions, 300);
|
|
120
147
|
//选中值发生变化时触发
|
|
121
148
|
function change(val) {
|
|
122
149
|
if (typeof val == 'undefined') {
|
|
123
150
|
if (model.value.defaultCode1) {
|
|
124
151
|
val = model.value.defaultCode1
|
|
125
152
|
model.value.value = val
|
|
126
|
-
|
|
153
|
+
model.value.itemKey = Math.random()
|
|
127
154
|
}
|
|
128
155
|
}
|
|
129
156
|
model.value.setcode(val)
|
|
@@ -131,6 +158,13 @@ function change(val) {
|
|
|
131
158
|
if (model.value.autoSearch) emit('search');
|
|
132
159
|
|
|
133
160
|
}
|
|
161
|
+
function handleCompositionStart() {
|
|
162
|
+
isComposing.value = true;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function handleCompositionEnd() {
|
|
166
|
+
isComposing.value = false;
|
|
167
|
+
}
|
|
134
168
|
//弹出选择列表
|
|
135
169
|
function popupSearchListHandle() {
|
|
136
170
|
emit('popupSearchList', false, model, model.value.moreActionRouter, (optionArr) => {
|
|
@@ -68,6 +68,9 @@
|
|
|
68
68
|
</div>
|
|
69
69
|
</template>
|
|
70
70
|
<template v-else>
|
|
71
|
+
<div v-if="model.controlLabel" class="list-title">
|
|
72
|
+
<h5>{{ model.controlLabel }}</h5>
|
|
73
|
+
</div>
|
|
71
74
|
<div class="list-button">
|
|
72
75
|
<component v-if="model.selectRouter !== null" :is="model.selectRouter.is"
|
|
73
76
|
:vmodel="model.selectRouter" @click="popupSearchListHandle(model.selectRouter)"></component>
|
|
@@ -79,33 +82,37 @@
|
|
|
79
82
|
<el-table :data="model.tableData" border :show-summary="model.showSummary"
|
|
80
83
|
:summary-method="getSummaries" style="width: 100%" highlight-current-row>
|
|
81
84
|
<template v-if="model.rowActionRoutersAlign === 1">
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
{
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<template #default="scope">
|
|
89
|
-
<el-tag :disable-transitions="true" v-if="scope.row.edit || scope.row.isSet" type="success"
|
|
90
|
-
@click="saveRow(scope.row, scope.$index, true)" style="cursor: pointer;">{{
|
|
91
|
-
scope.row.isSet
|
|
92
|
-
?
|
|
93
|
-
'保存' :
|
|
94
|
-
"修改" }}</el-tag>
|
|
95
|
-
<el-tag :disable-transitions="true" v-if="scope.row.delete && !scope.row.isSet"
|
|
96
|
-
style="cursor: pointer;" type="danger"
|
|
97
|
-
@click="deleteRow(scope.$index, scope.row.$sourceIndex)">删除</el-tag>
|
|
98
|
-
<el-tag :disable-transitions="true" v-else-if="scope.row.isSet"
|
|
99
|
-
@click="saveRow(scope.row, scope.$index, false)" style="cursor: pointer;">取消</el-tag>
|
|
100
|
-
<template v-for="(v, i) in model.buttons">
|
|
101
|
-
<el-tag
|
|
102
|
-
v-if="!scope.row.isSet && v.show && (!v.rightField || !scope.row[v.rightField] || scope.row[v.rightField].value == 1)"
|
|
103
|
-
style="cursor: pointer;" @click="buttonClick(scope.row, v)">{{ v.label }} 1</el-tag>
|
|
104
|
-
|
|
85
|
+
<el-table-column label="操作"
|
|
86
|
+
v-if="model.rows[0].edit || model.rows[0].delete || model.buttons.length > 0"
|
|
87
|
+
:width="'100%'">
|
|
88
|
+
<template #header="{ column, $index }">
|
|
89
|
+
{{ setcolumnminWidth(column) }}
|
|
90
|
+
<span style="width:auto; white-space: nowrap;">{{ column.label }}</span>
|
|
105
91
|
</template>
|
|
92
|
+
<template #default="scope">
|
|
93
|
+
<el-tag :disable-transitions="true" v-if="scope.row.edit || scope.row.isSet"
|
|
94
|
+
type="success" @click="saveRow(scope.row, scope.$index, true)"
|
|
95
|
+
style="cursor: pointer;">{{
|
|
96
|
+
scope.row.isSet
|
|
97
|
+
?
|
|
98
|
+
'保存' :
|
|
99
|
+
"修改" }}</el-tag>
|
|
100
|
+
<el-tag :disable-transitions="true" v-if="scope.row.delete && !scope.row.isSet"
|
|
101
|
+
style="cursor: pointer;" type="danger"
|
|
102
|
+
@click="deleteRow(scope.$index, scope.row.$sourceIndex)">删除</el-tag>
|
|
103
|
+
<el-tag :disable-transitions="true" v-else-if="scope.row.isSet"
|
|
104
|
+
@click="saveRow(scope.row, scope.$index, false)"
|
|
105
|
+
style="cursor: pointer;">取消</el-tag>
|
|
106
|
+
<template v-for="(v, i) in model.buttons">
|
|
107
|
+
<el-tag
|
|
108
|
+
v-if="!scope.row.isSet && v.show && (!v.rightField || !scope.row[v.rightField] || scope.row[v.rightField].value == 1)"
|
|
109
|
+
style="cursor: pointer;" @click="buttonClick(scope.row, v)">{{ v.label }}
|
|
110
|
+
1</el-tag>
|
|
106
111
|
|
|
107
|
-
|
|
108
|
-
|
|
112
|
+
</template>
|
|
113
|
+
|
|
114
|
+
</template>
|
|
115
|
+
</el-table-column>
|
|
109
116
|
</template>
|
|
110
117
|
<template v-for="(v, i) in model.rows[0].field" :key="i">
|
|
111
118
|
<el-table-column :prop="v.fieldName1" :label="v.controlLabel" :width="v.width"
|
|
@@ -137,33 +144,37 @@
|
|
|
137
144
|
</el-table-column>
|
|
138
145
|
</template>
|
|
139
146
|
<template v-if="model.rowActionRoutersAlign !== 1">
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
{
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
<template #default="scope">
|
|
147
|
-
<el-tag :disable-transitions="true" v-if="scope.row.edit || scope.row.isSet" type="success"
|
|
148
|
-
@click="saveRow(scope.row, scope.$index, true)" style="cursor: pointer;">{{
|
|
149
|
-
scope.row.isSet
|
|
150
|
-
?
|
|
151
|
-
'保存' :
|
|
152
|
-
"修改" }}</el-tag>
|
|
153
|
-
<el-tag :disable-transitions="true" v-if="scope.row.delete && !scope.row.isSet"
|
|
154
|
-
style="cursor: pointer;" type="danger"
|
|
155
|
-
@click="deleteRow(scope.$index, scope.row.$sourceIndex)">删除</el-tag>
|
|
156
|
-
<el-tag :disable-transitions="true" v-else-if="scope.row.isSet"
|
|
157
|
-
@click="saveRow(scope.row, scope.$index, false)" style="cursor: pointer;">取消</el-tag>
|
|
158
|
-
<template v-for="(v, i) in model.buttons">
|
|
159
|
-
<el-tag
|
|
160
|
-
v-if="!scope.row.isSet && v.show && (!v.rightField || !scope.row[v.rightField] || scope.row[v.rightField].value == 1)"
|
|
161
|
-
style="cursor: pointer;" @click="buttonClick(scope.row, v)">{{ v.label }} 1</el-tag>
|
|
162
|
-
|
|
147
|
+
<el-table-column label="操作"
|
|
148
|
+
v-if="model.rows[0].edit || model.rows[0].delete || model.buttons.length > 0"
|
|
149
|
+
:width="'100%'">
|
|
150
|
+
<template #header="{ column, $index }">
|
|
151
|
+
{{ setcolumnminWidth(column) }}
|
|
152
|
+
<span style="width:auto; white-space: nowrap;">{{ column.label }}</span>
|
|
163
153
|
</template>
|
|
154
|
+
<template #default="scope">
|
|
155
|
+
<el-tag :disable-transitions="true" v-if="scope.row.edit || scope.row.isSet"
|
|
156
|
+
type="success" @click="saveRow(scope.row, scope.$index, true)"
|
|
157
|
+
style="cursor: pointer;">{{
|
|
158
|
+
scope.row.isSet
|
|
159
|
+
?
|
|
160
|
+
'保存' :
|
|
161
|
+
"修改" }}</el-tag>
|
|
162
|
+
<el-tag :disable-transitions="true" v-if="scope.row.delete && !scope.row.isSet"
|
|
163
|
+
style="cursor: pointer;" type="danger"
|
|
164
|
+
@click="deleteRow(scope.$index, scope.row.$sourceIndex)">删除</el-tag>
|
|
165
|
+
<el-tag :disable-transitions="true" v-else-if="scope.row.isSet"
|
|
166
|
+
@click="saveRow(scope.row, scope.$index, false)"
|
|
167
|
+
style="cursor: pointer;">取消</el-tag>
|
|
168
|
+
<template v-for="(v, i) in model.buttons">
|
|
169
|
+
<el-tag
|
|
170
|
+
v-if="!scope.row.isSet && v.show && (!v.rightField || !scope.row[v.rightField] || scope.row[v.rightField].value == 1)"
|
|
171
|
+
style="cursor: pointer;" @click="buttonClick(scope.row, v)">{{ v.label }}
|
|
172
|
+
1</el-tag>
|
|
173
|
+
|
|
174
|
+
</template>
|
|
164
175
|
|
|
165
|
-
|
|
166
|
-
|
|
176
|
+
</template>
|
|
177
|
+
</el-table-column>
|
|
167
178
|
</template>
|
|
168
179
|
<template #empty>
|
|
169
180
|
{{ common.LocalizedString('暂无数据', '暫無數據') }}
|
|
@@ -425,7 +436,7 @@ function fieldsValidExcute() {
|
|
|
425
436
|
if (i === 0) {
|
|
426
437
|
if (f.displayValidMessage) {
|
|
427
438
|
model.value.displayValidMessage = f.displayValidMessage;
|
|
428
|
-
}
|
|
439
|
+
}
|
|
429
440
|
}
|
|
430
441
|
i++;
|
|
431
442
|
rtnBool = false;
|
|
@@ -577,6 +588,12 @@ defineExpose({
|
|
|
577
588
|
})
|
|
578
589
|
</script>
|
|
579
590
|
<style scoped>
|
|
591
|
+
.list-title {
|
|
592
|
+
padding-bottom: 5px;
|
|
593
|
+
text-align: left;
|
|
594
|
+
display: inline-table;
|
|
595
|
+
}
|
|
596
|
+
|
|
580
597
|
.list-button {
|
|
581
598
|
padding-bottom: 5px;
|
|
582
599
|
text-align: right;
|
|
@@ -591,6 +608,7 @@ defineExpose({
|
|
|
591
608
|
width: 100%;
|
|
592
609
|
}
|
|
593
610
|
|
|
611
|
+
|
|
594
612
|
.ct-form-repeat .list-title {
|
|
595
613
|
padding-bottom: 5px;
|
|
596
614
|
text-align: left;
|
|
@@ -25,8 +25,15 @@ const props = defineProps({
|
|
|
25
25
|
const model = initData(props, RadioButton)
|
|
26
26
|
|
|
27
27
|
function change() {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
if(model.value.code1){
|
|
29
|
+
model.value.selectItems1.forEach((v) => {
|
|
30
|
+
if(model.value.code1===v.code){
|
|
31
|
+
model.value.name1=v.name;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
changeHandler(model.value, emit);
|
|
36
|
+
if (model.value.autoSearch) emit('search');
|
|
30
37
|
}
|
|
31
38
|
function clearClickHandle() {
|
|
32
39
|
model.value.reset()
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
</button>
|
|
39
39
|
<video ref="video" :src="rowData[router.submitFormField]" controls="true"
|
|
40
40
|
controlslist="nodownload" @timeupdate="saveVoiceHistoryHandler" @ended="voiceEndedHandler"
|
|
41
|
-
:height="router.
|
|
42
|
-
:width="router.
|
|
41
|
+
:height="router.pageHeight ? router.pageHeight : '40'"
|
|
42
|
+
:width="router.pageWidth ? router.pageWidth : '100%'">您的浏览器不支持 video 标签。
|
|
43
43
|
</video>
|
|
44
44
|
</div>
|
|
45
45
|
<img v-if="router.imgUrl && isShowImg" slot="reference"
|
|
@@ -107,7 +107,7 @@ const option = ref({
|
|
|
107
107
|
const tooltipModel = ref({});
|
|
108
108
|
const labelColor = ref('')
|
|
109
109
|
const video = ref()
|
|
110
|
-
const label = computed(() => {
|
|
110
|
+
const label = computed(() => {
|
|
111
111
|
return (typeof props.colValue === "undefined" || props.colValue === '') ? props.router.controlLabel : props.colValue
|
|
112
112
|
})
|
|
113
113
|
const isShowLabel = computed(() => {
|
|
@@ -127,6 +127,7 @@ const isShowLabel = computed(() => {
|
|
|
127
127
|
}
|
|
128
128
|
return flag;
|
|
129
129
|
})
|
|
130
|
+
|
|
130
131
|
isVisited()
|
|
131
132
|
function isVisited() {
|
|
132
133
|
var key = props.router.action + props.rowData.chanceID;
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
@SaveSearchWhere="SaveSearchWhere" @SearchWhereManage="SearchWhereManage"
|
|
23
23
|
@clickSearchWhere="clickSearchWhere"></component>
|
|
24
24
|
<br v-else-if="col.controlType === Enum.ControlType.LineFeed" />
|
|
25
|
-
<component v-else :from="from" class="list-field"
|
|
25
|
+
<component v-else :from="from" class="list-field" v-bind="col.listBind"
|
|
26
26
|
:is="col.is" :vmodel="col" :parameterAction="model.parameterAction"
|
|
27
27
|
@search="searchHandler(col)" @change="changeHandler(col)">
|
|
28
28
|
</component>
|
|
@@ -160,7 +160,7 @@ const ComboBox = function (source) {
|
|
|
160
160
|
}
|
|
161
161
|
return source.code1 === '' ? [] : [{ value: source.code1, label: source.name1 }]
|
|
162
162
|
},
|
|
163
|
-
getOptions(paramsAction, searchText, CallBack) {
|
|
163
|
+
getOptions(paramsAction, searchText, cancelTokenSource,CallBack) {
|
|
164
164
|
var apiAddrs = paramsAction;
|
|
165
165
|
var params = {
|
|
166
166
|
action: apiAddrs,
|
|
@@ -171,7 +171,7 @@ const ComboBox = function (source) {
|
|
|
171
171
|
key: searchText
|
|
172
172
|
}
|
|
173
173
|
};
|
|
174
|
-
request.
|
|
174
|
+
request.postTokenHandler(common.globalUri(), params,cancelTokenSource).then((response) => {
|
|
175
175
|
if (response.rtnCode === 200) {
|
|
176
176
|
if (CallBack) {
|
|
177
177
|
CallBack(response.content)
|
package/src/loader/src/Form.js
CHANGED
|
@@ -490,7 +490,7 @@ function addRow(model) {
|
|
|
490
490
|
"buttonType": Enum.ButtonType.Submit
|
|
491
491
|
}
|
|
492
492
|
],
|
|
493
|
-
actionRouters: model.actionRouters,
|
|
493
|
+
actionRouters: model.source.actionRouters,
|
|
494
494
|
},
|
|
495
495
|
parentModelForm: model.parentModel,
|
|
496
496
|
relationParentFormFields:model.getRelationParentFormFields(),
|
|
@@ -135,16 +135,16 @@ function loadSearchScreenModel(source, prevParam) {
|
|
|
135
135
|
var advIndex = rtn.sourceFieldsArr.findIndex((v) => {
|
|
136
136
|
return v.controlType === Enum.ControlType.ButtonAdvancedSearch;
|
|
137
137
|
});
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
138
|
+
if (advIndex === -1) {
|
|
139
|
+
advIndex = rtn.sourceFieldsArr.findIndex((v) => {
|
|
140
|
+
return v.controlType === Enum.ControlType.ButtonReset;
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
if (advIndex === -1) {
|
|
144
|
+
advIndex = rtn.sourceFieldsArr.findIndex((v) => {
|
|
145
|
+
return v.controlType === Enum.ControlType.ButtonSearch;
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
148
|
var screens = rtn.sourceFieldsArr.filter((v, i) => {
|
|
149
149
|
return (advIndex !== -1 && i > advIndex) && v.controlType !== Enum.ControlType.From;
|
|
150
150
|
});
|
package/src/main.js
CHANGED
|
@@ -26,7 +26,7 @@ app.use(centaline, {
|
|
|
26
26
|
//baseUrl: "http://10.1.245.50:38735/max-uplink-api/",
|
|
27
27
|
//baseUrl: "http://10.1.245.111:38028/",
|
|
28
28
|
flagRouterSelf: true,
|
|
29
|
-
flagApp:
|
|
29
|
+
flagApp: false,//是否app端
|
|
30
30
|
zindex: 999,
|
|
31
31
|
showRequestSuccessMessage: true,
|
|
32
32
|
showRequestErrorMessage: true,
|
|
@@ -64,7 +64,7 @@ app.use(centaline, {
|
|
|
64
64
|
//authObject: '{token:"aplus eyJhbGciOiJIUzI1NiIsInppcCI6IkRFRiJ9.eNrEjjsOwjAQBe-ydVay1xvvOl3sJA2HiPIxElSIJBIIcXdAQEfPFK-YZt4Nlm2EChqtDafOYWqpRG6kxLoTxZhUTSRxHLUPH_DHfOmt5SDWt1gHScieHapNiol94q5pXYoNFJAvJ6isGHWmNMYVcBjWtyCr_iW2JZ93-fqPc8f18MwGIqFRCIO1GXmWGYd9npCZJ6N5JjYZ7g8AAAD__w.HgtNKtHWooj8c9Hy_vB8CfKq-qOeHMp0irnW0DfXtHo"}',
|
|
65
65
|
//oldToken: 'd92d4a3b-2274-42e8-96f0-100ffb579b6e',
|
|
66
66
|
//authObject: '{token:"1-a7289bb2-9f1e-4a04-9016-1e555bf39188"}',
|
|
67
|
-
authObject: '{EmpID:"
|
|
67
|
+
authObject: '{EmpID:"Token_00f32936-8123-45d4-b1b2-2206150ab06e",MachineCode:"e1f39b75-7069-4c4f-b5d5-c590da2d9aa2",SSO_Token:"SSOToken_00f32936-8123-45d4-b1b2-2206150ab06e",Platform:"WEB"}',
|
|
68
68
|
};
|
|
69
69
|
},
|
|
70
70
|
// 请求完成事件,可判断是否登录过期执行响应操作
|
package/src/utils/request.js
CHANGED
|
@@ -119,7 +119,7 @@ const request = {
|
|
|
119
119
|
return Promise.reject(response);
|
|
120
120
|
}
|
|
121
121
|
//返回给下一个链式调用
|
|
122
|
-
return Promise.resolve(response.data,response.headers);
|
|
122
|
+
return Promise.resolve(response.data, response.headers);
|
|
123
123
|
},
|
|
124
124
|
postHandler(url, params, scripts) {
|
|
125
125
|
if (params.action.indexOf('http://') > -1 || params.action.indexOf('https://') > -1) {
|
|
@@ -168,6 +168,33 @@ const request = {
|
|
|
168
168
|
return Promise.resolve(ex);//错误处理了,直接返回成功,要判断response.rtnCode=200再处理
|
|
169
169
|
});
|
|
170
170
|
},
|
|
171
|
+
//有新请求关闭上一次请求
|
|
172
|
+
postTokenHandler(url, params, cancelTokenSource) {
|
|
173
|
+
if (params.action.indexOf('http://') > -1 || params.action.indexOf('https://') > -1) {
|
|
174
|
+
url = params.action;
|
|
175
|
+
params = params.para;
|
|
176
|
+
}
|
|
177
|
+
else if (common.flagRouterSelf()) {
|
|
178
|
+
url = url + params.action;
|
|
179
|
+
params = params.para;
|
|
180
|
+
}
|
|
181
|
+
return Axios.post(url, params, {
|
|
182
|
+
headers: common.getDataDrivenOpts().handler.getRequestHeaders(),
|
|
183
|
+
cancelToken: cancelTokenSource.token, // 传递取消令牌
|
|
184
|
+
}).then((response) => {
|
|
185
|
+
return this.postThenHandler(response);
|
|
186
|
+
}).catch((ex) => {
|
|
187
|
+
if (!Axios.isCancel(ex)) {
|
|
188
|
+
if (ex.message) {
|
|
189
|
+
common.message(ex.message, 'error')
|
|
190
|
+
}
|
|
191
|
+
else if (typeof ex.data === "string") {
|
|
192
|
+
common.message(ex.data, 'error')
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return Promise.resolve(ex.data ? ex.data : ex);//错误处理了,直接返回成功,要判断response.rtnCode=200再处理
|
|
196
|
+
});
|
|
197
|
+
},
|
|
171
198
|
};
|
|
172
199
|
request.install = function (app) {
|
|
173
200
|
app.config.globalProperties.$request = request;
|