Elements-SY

Merge branch 'et86-black' into et86

...@@ -183,7 +183,6 @@ export default { ...@@ -183,7 +183,6 @@ export default {
183 183
184 methods: { 184 methods: {
185 getTrCurrentHeight: debounce(function () { 185 getTrCurrentHeight: debounce(function () {
186 -
187 this.$nextTick(() => { 186 this.$nextTick(() => {
188 // const trEl = 187 // const trEl =
189 // this.$refs.tableRef.$refs.bodyWrapper.children[0].children[1] 188 // this.$refs.tableRef.$refs.bodyWrapper.children[0].children[1]
...@@ -194,7 +193,6 @@ export default { ...@@ -194,7 +193,6 @@ export default {
194 // } 193 // }
195 }); 194 });
196 }, 800), 195 }, 800),
197 -
198 // 给表头列添加className 196 // 给表头列添加className
199 headerCellClassName({ row, column, rowIndex, columnIndex }) { 197 headerCellClassName({ row, column, rowIndex, columnIndex }) {
200 if (columnIndex !== 0) { 198 if (columnIndex !== 0) {
...@@ -255,6 +253,10 @@ export default { ...@@ -255,6 +253,10 @@ export default {
255 sort: this.attrs.isDragSort, 253 sort: this.attrs.isDragSort,
256 animation: 100, 254 animation: 100,
257 delay: 0, 255 delay: 0,
256 + onStart(evt) {
257 + // console.log("onStart:", evt);
258 + evt.oldIndex;
259 + },
258 onEnd({ newIndex, oldIndex }) { 260 onEnd({ newIndex, oldIndex }) {
259 // console.log("onEnd:", newIndex, oldIndex); 261 // console.log("onEnd:", newIndex, oldIndex);
260 const currRow = _this.tableData.splice(oldIndex, 1)[0]; 262 const currRow = _this.tableData.splice(oldIndex, 1)[0];
......
...@@ -531,6 +531,7 @@ export function filterRepeat(arr, key) { ...@@ -531,6 +531,7 @@ export function filterRepeat(arr, key) {
531 } 531 }
532 /** 532 /**
533 * Array Json 533 * Array Json
534 + * @author SunYu
534 * @param {Array} arr 535 * @param {Array} arr
535 * @param {string} key 536 * @param {string} key
536 * @param {string} time 537 * @param {string} time
......
This diff is collapsed. Click to expand it.
...@@ -11,10 +11,10 @@ ...@@ -11,10 +11,10 @@
11 formWidth="auto" 11 formWidth="auto"
12 @blur="blurEvent" 12 @blur="blurEvent"
13 > 13 >
14 - <yl-draggable 14 + <route-draggable
15 :routeList="routeList" 15 :routeList="routeList"
16 :dragOptions="dragOptions" 16 :dragOptions="dragOptions"
17 - ></yl-draggable> 17 + ></route-draggable>
18 </yl-form> 18 </yl-form>
19 </el-col> 19 </el-col>
20 </el-row> 20 </el-row>
...@@ -49,8 +49,8 @@ ...@@ -49,8 +49,8 @@
49 </template> 49 </template>
50 <script> 50 <script>
51 import YlForm from "@/components/YlForm"; 51 import YlForm from "@/components/YlForm";
52 -import RouteInfo from "../components/routeInfo"; 52 +import RouteInfo from "../components/RouteInfo";
53 -import YlDraggable from "@/components/YlDraggable"; 53 +import RouteDraggable from "../components/RouteDraggable";
54 import { formConfig, routeRuleForm, validateForm } from "./formConfig"; 54 import { formConfig, routeRuleForm, validateForm } from "./formConfig";
55 import { 55 import {
56 updateOrAddFlight, // 新增/修改航线规则设置 56 updateOrAddFlight, // 新增/修改航线规则设置
...@@ -64,7 +64,7 @@ export default { ...@@ -64,7 +64,7 @@ export default {
64 components: { 64 components: {
65 YlForm, 65 YlForm,
66 RouteInfo, 66 RouteInfo,
67 - YlDraggable, 67 + RouteDraggable,
68 }, 68 },
69 mixins: [indexMixins], 69 mixins: [indexMixins],
70 data() { 70 data() {
...@@ -105,7 +105,7 @@ export default { ...@@ -105,7 +105,7 @@ export default {
105 dataStatus: this.$route.query.dataStatus || "", // add 、edit、view 105 dataStatus: this.$route.query.dataStatus || "", // add 、edit、view
106 flightKindName: this.$route.query.flightKindName || "", // 航班种类White Tail 、Purple Tail 106 flightKindName: this.$route.query.flightKindName || "", // 航班种类White Tail 、Purple Tail
107 pageName: this.$route.query.pageName || "", // 107 pageName: this.$route.query.pageName || "", //
108 - id: this.$route.query.id, 108 + id: this.$route.query.id || "",
109 }; 109 };
110 // 指定隐藏或显示From表单域 110 // 指定隐藏或显示From表单域
111 this.hiddenFormItem(parmas); 111 this.hiddenFormItem(parmas);
......
...@@ -405,8 +405,8 @@ export default { ...@@ -405,8 +405,8 @@ export default {
405 if (this.$route.query.flightKindName == "Purple Tail") { 405 if (this.$route.query.flightKindName == "Purple Tail") {
406 this.showFlightKind(dateDataLists); 406 this.showFlightKind(dateDataLists);
407 } 407 }
408 - } 408 + } else {
409 - if (dateConfigFlag == false) { 409 + // 当前航线有缺省的航线配置
410 // 航班航线有规则配置的 410 // 航班航线有规则配置的
411 const dateListHas = mergeDateRouteInfo.filter( 411 const dateListHas = mergeDateRouteInfo.filter(
412 (item) => item.config == true 412 (item) => item.config == true
......
1 +import YlElInputNumber from "./src/input-number";
2 +
3 +YlElInputNumber.install = function (Vue) {
4 + Vue.component(YlElInputNumber.name, YlElInputNumber);
5 +};
6 +// 该组件是基于Element UI InputNumber 计数器
7 +export default YlElInputNumber;
1 +<template>
2 + <div
3 + @dragstart.prevent
4 + :class="[
5 + 'el-input-number',
6 + inputNumberSize ? 'el-input-number--' + inputNumberSize : '',
7 + { 'is-disabled': inputNumberDisabled },
8 + { 'is-without-controls': !controls },
9 + { 'is-controls-right': controlsAtRight }
10 + ]">
11 + <span
12 + class="el-input-number__decrease"
13 + role="button"
14 + v-if="controls"
15 + @click="decrease"
16 + :class="{'is-disabled': minDisabled}"
17 + @keydown.enter="decrease">
18 + <i :class="`el-icon-${controlsAtRight ? 'arrow-down' : 'minus'}`"></i>
19 + </span>
20 + <span
21 + class="el-input-number__increase"
22 + role="button"
23 + v-if="controls"
24 + @click="increase"
25 + :class="{'is-disabled': maxDisabled}"
26 + @keydown.enter="increase">
27 + <i :class="`el-icon-${controlsAtRight ? 'arrow-up' : 'plus'}`"></i>
28 + </span>
29 + <el-input
30 + ref="input"
31 + :value="displayValue"
32 + :placeholder="placeholder"
33 + :disabled="inputNumberDisabled"
34 + :size="inputNumberSize"
35 + :max="max"
36 + :min="min"
37 + :name="name"
38 + :label="label"
39 + @keydown.up.native.prevent="increase"
40 + @keydown.down.native.prevent="decrease"
41 + @blur="handleBlur"
42 + @focus="handleFocus"
43 + @input="handleInput"
44 + @change="handleInputChange">
45 + </el-input>
46 + </div>
47 +</template>
48 +<script>
49 + export default {
50 + name: 'YlElInputNumber',
51 + inject: {
52 + elForm: {
53 + default: ''
54 + },
55 + elFormItem: {
56 + default: ''
57 + }
58 + },
59 + props: {
60 + step: {
61 + type: Number,
62 + default: 1
63 + },
64 + stepStrictly: {
65 + type: Boolean,
66 + default: false
67 + },
68 + max: {
69 + type: Number,
70 + default: Infinity
71 + },
72 + min: {
73 + type: Number,
74 + default: -Infinity
75 + },
76 + value: {},
77 + disabled: Boolean,
78 + size: String,
79 + controls: {
80 + type: Boolean,
81 + default: true
82 + },
83 + controlsPosition: {
84 + type: String,
85 + default: ''
86 + },
87 + name: String,
88 + label: String,
89 + placeholder: String,
90 + precision: {
91 + type: Number,
92 + validator(val) {
93 + return val >= 0 && val === parseInt(val, 10);
94 + }
95 + }
96 + },
97 + data() {
98 + return {
99 + currentValue: 0,
100 + userInput: null
101 + };
102 + },
103 + watch: {
104 + value: {
105 + immediate: true,
106 + handler(value) {
107 + let newVal = value === undefined ? value : Number(value);
108 + if (newVal !== undefined) {
109 + if (isNaN(newVal)) {
110 + return;
111 + }
112 + if (this.stepStrictly) {
113 + const stepPrecision = this.getPrecision(this.step);
114 + const precisionFactor = Math.pow(10, stepPrecision);
115 + newVal = Math.round(newVal / this.step) * precisionFactor * this.step / precisionFactor;
116 + }
117 + if (this.precision !== undefined) {
118 + newVal = this.toPrecision(newVal, this.precision);
119 + }
120 + }
121 + if (newVal >= this.max) newVal = this.max;
122 + if (newVal <= this.min) newVal = this.min;
123 + this.currentValue = newVal;
124 + this.userInput = null;
125 + this.$emit('input', newVal);
126 + }
127 + }
128 + },
129 + computed: {
130 + minDisabled() {
131 + return this._decrease(this.value, this.step) < this.min;
132 + },
133 + maxDisabled() {
134 + return this._increase(this.value, this.step) > this.max;
135 + },
136 + numPrecision() {
137 + const { value, step, getPrecision, precision } = this;
138 + const stepPrecision = getPrecision(step);
139 + if (precision !== undefined) {
140 + if (stepPrecision > precision) {
141 + console.warn('[Element Warn][InputNumber]precision should not be less than the decimal places of step');
142 + }
143 + return precision;
144 + } else {
145 + return Math.max(getPrecision(value), stepPrecision);
146 + }
147 + },
148 + controlsAtRight() {
149 + return this.controls && this.controlsPosition === 'right';
150 + },
151 + _elFormItemSize() {
152 + return (this.elFormItem || {}).elFormItemSize;
153 + },
154 + inputNumberSize() {
155 + return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
156 + },
157 + inputNumberDisabled() {
158 + return this.disabled || !!(this.elForm || {}).disabled;
159 + },
160 + displayValue() {
161 + if (this.userInput !== null) {
162 + return this.userInput;
163 + }
164 + let currentValue = this.currentValue;
165 + if (typeof currentValue === 'number') {
166 + if (this.stepStrictly) {
167 + const stepPrecision = this.getPrecision(this.step);
168 + const precisionFactor = Math.pow(10, stepPrecision);
169 + currentValue = Math.round(currentValue / this.step) * precisionFactor * this.step / precisionFactor;
170 + }
171 +
172 + if (this.precision !== undefined) {
173 + currentValue = currentValue.toFixed(this.precision);
174 + }
175 + }
176 + return currentValue;
177 + }
178 + },
179 + methods: {
180 + toPrecision(num, precision) {
181 + if (precision === undefined) precision = this.numPrecision;
182 + return parseFloat(Math.round(num * Math.pow(10, precision)) / Math.pow(10, precision));
183 + },
184 + getPrecision(value) {
185 + if (value === undefined) return 0;
186 + const valueString = value.toString();
187 + const dotPosition = valueString.indexOf('.');
188 + let precision = 0;
189 + if (dotPosition !== -1) {
190 + precision = valueString.length - dotPosition - 1;
191 + }
192 + return precision;
193 + },
194 + _increase(val, step) {
195 + if (typeof val !== 'number' && val !== undefined) return this.currentValue;
196 + const precisionFactor = Math.pow(10, this.numPrecision);
197 + return this.toPrecision((precisionFactor * val + precisionFactor * step) / precisionFactor);
198 + },
199 + _decrease(val, step) {
200 + if (typeof val !== 'number' && val !== undefined) return this.currentValue;
201 + const precisionFactor = Math.pow(10, this.numPrecision);
202 + return this.toPrecision((precisionFactor * val - precisionFactor * step) / precisionFactor);
203 + },
204 + increase() {
205 + if (this.inputNumberDisabled || this.maxDisabled) return;
206 + const value = this.value || 0;
207 + const newVal = this._increase(value, this.step);
208 + this.setCurrentValue(newVal);
209 + },
210 + decrease() {
211 + if (this.inputNumberDisabled || this.minDisabled) return;
212 + const value = this.value || 0;
213 + const newVal = this._decrease(value, this.step);
214 + this.setCurrentValue(newVal);
215 + },
216 + handleBlur(event) {
217 + this.$emit('blur', event);
218 + },
219 + handleFocus(event) {
220 + this.$emit('focus', event);
221 + },
222 + setCurrentValue(newVal) {
223 + const oldVal = this.currentValue;
224 + if (typeof newVal === 'number' && this.precision !== undefined) {
225 + newVal = this.toPrecision(newVal, this.precision);
226 + }
227 + if (newVal >= this.max) newVal = this.max;
228 + if (newVal <= this.min) newVal = this.min;
229 + if (oldVal === newVal) return;
230 + this.userInput = null;
231 + this.$emit('input', newVal);
232 + this.$emit('change', newVal, oldVal);
233 + this.currentValue = newVal;
234 + },
235 + handleInput(value) {
236 + this.userInput = value;
237 + },
238 + handleInputChange(value) {
239 + const newVal = value === '' ? undefined : Number(value);
240 + if (!isNaN(newVal) || value === '') {
241 + this.setCurrentValue(newVal);
242 + }
243 + this.userInput = null;
244 + },
245 + select() {
246 + this.$refs.input.select();
247 + }
248 + },
249 + mounted() {
250 + let innerInput = this.$refs.input.$refs.input;
251 + innerInput.setAttribute('role', 'spinbutton');
252 + innerInput.setAttribute('aria-valuemax', this.max);
253 + innerInput.setAttribute('aria-valuemin', this.min);
254 + innerInput.setAttribute('aria-valuenow', this.currentValue);
255 + innerInput.setAttribute('aria-disabled', this.inputNumberDisabled);
256 + },
257 + updated() {
258 + if (!this.$refs || !this.$refs.input) return;
259 + const innerInput = this.$refs.input.$refs.input;
260 + innerInput.setAttribute('aria-valuenow', this.currentValue);
261 + }
262 + };
263 +</script>
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
23 </el-col> 23 </el-col>
24 </el-row> 24 </el-row>
25 <yl-table 25 <yl-table
26 + ref="ylTable"
26 emptyText="请添加配舱航班" 27 emptyText="请添加配舱航班"
27 :attrs="tableAttr" 28 :attrs="tableAttr"
28 :loadingTable="tableAttr.loadingTable" 29 :loadingTable="tableAttr.loadingTable"
...@@ -63,27 +64,17 @@ ...@@ -63,27 +64,17 @@
63 align="center" 64 align="center"
64 > 65 >
65 <template slot-scope="scope"> 66 <template slot-scope="scope">
66 - <el-input-number 67 + <yl-el-input-number
67 v-model="scope.row.calculateDay" 68 v-model="scope.row.calculateDay"
68 :disabled="scope.row.edit" 69 :disabled="scope.row.edit"
69 :precision="0" 70 :precision="0"
71 + :controls="true"
70 v-input-filter 72 v-input-filter
71 clearable 73 clearable
72 placeholder="" 74 placeholder=""
73 size="small" 75 size="small"
74 style="width: 100%" 76 style="width: 100%"
75 /> 77 />
76 - <!-- <el-input
77 - type="text"
78 - v-model="scope.row.calculateDay"
79 - :disabled="scope.row.edit"
80 - min="-7"
81 - max="7"
82 - v-input-filter
83 - clearable
84 - placeholder=""
85 - size="small"
86 - /> -->
87 </template> 78 </template>
88 </el-table-column> 79 </el-table-column>
89 <el-table-column 80 <el-table-column
...@@ -431,6 +422,7 @@ ...@@ -431,6 +422,7 @@
431 <script> 422 <script>
432 import YlForm from "@/components/YlForm"; 423 import YlForm from "@/components/YlForm";
433 import YlTable from "@/components/YlTable"; 424 import YlTable from "@/components/YlTable";
425 +import YlElInputNumber from "../components/input-number"
434 import { inputBlurValidate } from "@/utils/mixins"; 426 import { inputBlurValidate } from "@/utils/mixins";
435 import { tableAttr } from "./tableConfig"; 427 import { tableAttr } from "./tableConfig";
436 import { 428 import {
...@@ -448,6 +440,7 @@ export default { ...@@ -448,6 +440,7 @@ export default {
448 components: { 440 components: {
449 YlForm, 441 YlForm,
450 YlTable, 442 YlTable,
443 + YlElInputNumber
451 }, 444 },
452 mixins: [indexMixins, inputBlurValidate], 445 mixins: [indexMixins, inputBlurValidate],
453 data() { 446 data() {
...@@ -752,7 +745,7 @@ export default { ...@@ -752,7 +745,7 @@ export default {
752 // 表单提交 745 // 表单提交
753 submitForm(formName) { 746 submitForm(formName) {
754 this.$refs[formName].validate((valid) => { 747 this.$refs[formName].validate((valid) => {
755 - if (valid) { 748 + if (valid && this.validateForm) {
756 this.tableData.map((item, i) => { 749 this.tableData.map((item, i) => {
757 item.priority = ++i; 750 item.priority = ++i;
758 }); 751 });
...@@ -793,6 +786,7 @@ export default { ...@@ -793,6 +786,7 @@ export default {
793 flightRankDtoList: tableData, // ET86配舱航班顺位 786 flightRankDtoList: tableData, // ET86配舱航班顺位
794 fltRuleDto: this.queryForm, 787 fltRuleDto: this.queryForm,
795 }; 788 };
789 + let queryParmas = JSON.parse(JSON.stringify(parmas));
796 // 筛选重复的航班 790 // 筛选重复的航班
797 let repeat = tableData.filter( 791 let repeat = tableData.filter(
798 (item) => 792 (item) =>
...@@ -808,17 +802,17 @@ export default { ...@@ -808,17 +802,17 @@ export default {
808 this.msgError("ET86配舱航班顺位中存在重复设置"); 802 this.msgError("ET86配舱航班顺位中存在重复设置");
809 return; 803 return;
810 } 804 }
811 - parmas.fltRuleDto.multiHs = this.queryForm.multiHs ? "N" : "Y"; // N为单品名,Y为多品名 805 + queryParmas.fltRuleDto.multiHs = this.queryForm.multiHs ? "N" : "Y"; // N为单品名,Y为多品名
812 if (this.validateForm && this.$route.query.name == "add") { 806 if (this.validateForm && this.$route.query.name == "add") {
813 - this.postAdd(parmas); // 新增 807 + this.postAdd(queryParmas); // 新增
814 } else { 808 } else {
815 if (this.validateForm) { 809 if (this.validateForm) {
816 - parmas.flightRankDtoList.map((item) => { 810 + queryParmas.flightRankDtoList.map((item) => {
817 if (item.hasOwnProperty("routeList")) { 811 if (item.hasOwnProperty("routeList")) {
818 delete item.routeList; 812 delete item.routeList;
819 } 813 }
820 }); 814 });
821 - this.postUpdate(parmas); // 修改 815 + this.postUpdate(queryParmas); // 修改
822 } 816 }
823 } 817 }
824 } else { 818 } else {
......
...@@ -129,20 +129,20 @@ export default { ...@@ -129,20 +129,20 @@ export default {
129 }; 129 };
130 // ursa包含 130 // ursa包含
131 if (ursaMark && ursaInfo.repeat) { 131 if (ursaMark && ursaInfo.repeat) {
132 - this.ursaError = "填写的Ursa已重复"; 132 + this.ursaError = "填写的URSA已重复";
133 } 133 }
134 if (ursaMark && !ursaInfo.inUrsa) { 134 if (ursaMark && !ursaInfo.inUrsa) {
135 - this.ursaError = "Ursa包含之间用分号分隔,例:P2_;P3_;P_"; 135 + this.ursaError = "URSA包含之间用分号分隔,例:P2_;P3_;P_";
136 } 136 }
137 if (ursaMark && !ursaInfo.repeat && ursaInfo.inUrsa) { 137 if (ursaMark && !ursaInfo.repeat && ursaInfo.inUrsa) {
138 this.ursaError = ""; 138 this.ursaError = "";
139 } 139 }
140 // ursa不包含; 140 // ursa不包含;
141 if (!ursaMark && ursaInfo.repeat) { 141 if (!ursaMark && ursaInfo.repeat) {
142 - this.notUrsaError = "填写的Ursa已重复"; 142 + this.notUrsaError = "填写的URSA已重复";
143 } 143 }
144 if (!ursaMark && !ursaInfo.inUrsa) { 144 if (!ursaMark && !ursaInfo.inUrsa) {
145 - this.notUrsaError = "Ursa不包含之间用分号分隔,例:P2;P3;P"; 145 + this.notUrsaError = "URSA不包含之间用分号分隔,例:P2;P3;P";
146 } 146 }
147 if (!ursaMark && !ursaInfo.repeat && ursaInfo.inUrsa) { 147 if (!ursaMark && !ursaInfo.repeat && ursaInfo.inUrsa) {
148 this.notUrsaError = ""; 148 this.notUrsaError = "";
......