Elements-SY

Merge branch 'et86-black' into uat

...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
50 :empty-text="emptyText" 50 :empty-text="emptyText"
51 v-bind="attrs" 51 v-bind="attrs"
52 v-loading="tableLoading" 52 v-loading="tableLoading"
53 - :data="tableData" 53 + :data="tableData ? tableData : []"
54 @selection-change="selectionChange" 54 @selection-change="selectionChange"
55 ref="tableRef" 55 ref="tableRef"
56 row-key="id" 56 row-key="id"
...@@ -176,7 +176,7 @@ export default { ...@@ -176,7 +176,7 @@ export default {
176 window.addEventListener("resize", this.getTrCurrentHeight); 176 window.addEventListener("resize", this.getTrCurrentHeight);
177 }, 177 },
178 destroyed() { 178 destroyed() {
179 - if (this.tableData.length) { 179 + if (this.tableData && this.tableData.length) {
180 window.removeEventListener("resize", this.getTrCurrentHeight); 180 window.removeEventListener("resize", this.getTrCurrentHeight);
181 } 181 }
182 }, 182 },
...@@ -283,7 +283,7 @@ export default { ...@@ -283,7 +283,7 @@ export default {
283 }); 283 });
284 }, 284 },
285 tableData() { 285 tableData() {
286 - if (this.tableData.length && this.attrs.isDragSort) { 286 + if (this.tableData && this.tableData.length && this.attrs.isDragSort) {
287 // 拖拽行更新排序 287 // 拖拽行更新排序
288 // this.rowDrop(); 288 // this.rowDrop();
289 // 拖拽列更新排序 289 // 拖拽列更新排序
......
...@@ -133,20 +133,6 @@ export const inputBlurValidate = { ...@@ -133,20 +133,6 @@ export const inputBlurValidate = {
133 } 133 }
134 } 134 }
135 }, 135 },
136 - validateNumber(number) {
137 - // 首先检查是否为合法数字
138 - if (isNaN(number)) {
139 - return "请输入有效数字";
140 - }
141 -
142 - // 然后检查是否大于0
143 - if (number <= 0) {
144 - return "请输入大于0的数字";
145 - }
146 -
147 - // 如果通过了以上两个条件,则表示数字合法
148 - return "数字合法";
149 - },
150 // 人民币最小申报价值 136 // 人民币最小申报价值
151 inputCNYBlurMin({ target }, customVal) { 137 inputCNYBlurMin({ target }, customVal) {
152 // 申报价值最小值和最大值都为空的情况下 138 // 申报价值最小值和最大值都为空的情况下
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
64 <el-col :span="2"> 64 <el-col :span="2">
65 <el-radio-group 65 <el-radio-group
66 v-model="item.isLocation" 66 v-model="item.isLocation"
67 - @change="changeLocation" 67 + @change="changeLocation({ index, item, $event })"
68 :disabled="pageName || status" 68 :disabled="pageName || status"
69 > 69 >
70 <el-radio label="1">包含始发站</el-radio> 70 <el-radio label="1">包含始发站</el-radio>
...@@ -72,28 +72,34 @@ ...@@ -72,28 +72,34 @@
72 </el-radio-group> 72 </el-radio-group>
73 </el-col> 73 </el-col>
74 <el-col :span="10"> 74 <el-col :span="10">
75 + <span style="width: 500px; display: block">
75 <el-input 76 <el-input
76 - v-if="item.isLocation == '1'" 77 + v-show="item.isLocation == '1'"
77 :disabled="pageName || status" 78 :disabled="pageName || status"
78 type="textarea" 79 type="textarea"
79 v-model="item.location" 80 v-model="item.location"
80 :rows="4" 81 :rows="4"
81 placeholder="始发站之间用回车符分隔" 82 placeholder="始发站之间用回车符分隔"
82 - style="width: 500px"
83 @blur="location({ index, item, $event })" 83 @blur="location({ index, item, $event })"
84 > 84 >
85 </el-input> 85 </el-input>
86 <el-input 86 <el-input
87 - v-else 87 + v-show="item.isLocation == '2'"
88 :disabled="pageName || status" 88 :disabled="pageName || status"
89 type="textarea" 89 type="textarea"
90 v-model="item.notLocation" 90 v-model="item.notLocation"
91 :rows="4" 91 :rows="4"
92 placeholder="始发站之间用回车符分隔" 92 placeholder="始发站之间用回车符分隔"
93 - style="width: 500px"
94 @blur="notLocation({ index, item, $event })" 93 @blur="notLocation({ index, item, $event })"
95 > 94 >
96 </el-input> 95 </el-input>
96 + </span>
97 + <div class="form-item-error-block">
98 + <span
99 + class="el-form-item__error"
100 + v-text="item.locationError"
101 + ></span>
102 + </div>
97 </el-col> 103 </el-col>
98 </el-form-item> 104 </el-form-item>
99 </el-col> 105 </el-col>
...@@ -103,37 +109,45 @@ ...@@ -103,37 +109,45 @@
103 <el-radio-group 109 <el-radio-group
104 :disabled="pageName || status" 110 :disabled="pageName || status"
105 v-model="item.isDestinationSite" 111 v-model="item.isDestinationSite"
106 - @change="changeDestinationSite" 112 + @change="
113 + changeDestinationSite({ index, item, $event })
114 + "
107 > 115 >
108 <el-radio label="1">包含目的站</el-radio> 116 <el-radio label="1">包含目的站</el-radio>
109 <el-radio label="2">不包含目的站</el-radio> 117 <el-radio label="2">不包含目的站</el-radio>
110 </el-radio-group> 118 </el-radio-group>
111 </el-col> 119 </el-col>
112 <el-col :span="10"> 120 <el-col :span="10">
121 + <span style="width: 500px; display: block">
113 <el-input 122 <el-input
114 - v-if="item.isDestinationSite == '1'" 123 + v-show="item.isDestinationSite == '1'"
115 :disabled="pageName || status" 124 :disabled="pageName || status"
116 type="textarea" 125 type="textarea"
117 v-model="item.destinationSite" 126 v-model="item.destinationSite"
118 :rows="4" 127 :rows="4"
119 placeholder="目的站之间用回车符分隔" 128 placeholder="目的站之间用回车符分隔"
120 - style="width: 500px"
121 @blur="destinationSite({ index, item, $event })" 129 @blur="destinationSite({ index, item, $event })"
122 > 130 >
123 </el-input> 131 </el-input>
124 <el-input 132 <el-input
125 - v-else 133 + v-show="item.isDestinationSite == '2'"
126 :disabled="pageName || status" 134 :disabled="pageName || status"
127 type="textarea" 135 type="textarea"
128 v-model="item.notDestinationSite" 136 v-model="item.notDestinationSite"
129 :rows="4" 137 :rows="4"
130 placeholder="目的站之间用回车符分隔" 138 placeholder="目的站之间用回车符分隔"
131 - style="width: 500px"
132 @blur=" 139 @blur="
133 notDestinationSite({ index, item, $event }) 140 notDestinationSite({ index, item, $event })
134 " 141 "
135 > 142 >
136 </el-input> 143 </el-input>
144 + </span>
145 + <div class="form-item-error-block">
146 + <span
147 + class="el-form-item__error"
148 + v-text="item.destinationSiteError"
149 + ></span>
150 + </div>
137 </el-col> 151 </el-col>
138 </el-form-item> 152 </el-form-item>
139 </el-col> 153 </el-col>
...@@ -149,6 +163,10 @@ ...@@ -149,6 +163,10 @@
149 @blur="includeUrsa({ index, item, $event })" 163 @blur="includeUrsa({ index, item, $event })"
150 > 164 >
151 </el-input> 165 </el-input>
166 + <span
167 + class="el-form-item__error"
168 + v-text="item.ursaError"
169 + ></span>
152 </el-form-item> 170 </el-form-item>
153 </el-col> 171 </el-col>
154 <el-col :span="10"> 172 <el-col :span="10">
...@@ -162,6 +180,12 @@ ...@@ -162,6 +180,12 @@
162 @blur="notIncludeUrsa({ index, item, $event })" 180 @blur="notIncludeUrsa({ index, item, $event })"
163 > 181 >
164 </el-input> 182 </el-input>
183 + <div class="form-item-error-block">
184 + <span
185 + class="el-form-item__error"
186 + v-text="item.notUrsaError"
187 + ></span>
188 + </div>
165 </el-form-item> 189 </el-form-item>
166 </el-col> 190 </el-col>
167 </el-col> 191 </el-col>
...@@ -178,7 +202,6 @@ ...@@ -178,7 +202,6 @@
178 > 202 >
179 </el-input> 203 </el-input>
180 <span 204 <span
181 - ref="minNumOfPieces"
182 class="el-form-item__error" 205 class="el-form-item__error"
183 ></span> 206 ></span>
184 </el-col> 207 </el-col>
...@@ -209,7 +232,6 @@ ...@@ -209,7 +232,6 @@
209 > 232 >
210 </el-input> 233 </el-input>
211 <span 234 <span
212 - ref="minWeight"
213 class="el-form-item__error" 235 class="el-form-item__error"
214 ></span> 236 ></span>
215 </el-col> 237 </el-col>
...@@ -571,12 +593,12 @@ export default { ...@@ -571,12 +593,12 @@ export default {
571 this.$emit("collapse", name); 593 this.$emit("collapse", name);
572 }, 594 },
573 // 始发站 595 // 始发站
574 - changeLocation(val) { 596 + changeLocation(item) {
575 - this.$emit("location", val); 597 + this.$emit("locRadio", item);
576 }, 598 },
577 // 目的站 599 // 目的站
578 - changeDestinationSite(val) { 600 + changeDestinationSite(item) {
579 - this.$emit("destinationSite", val); 601 + this.$emit("dessiteRadio", item);
580 }, 602 },
581 // 申报类别 603 // 申报类别
582 changeCargoType(arr) { 604 changeCargoType(arr) {
......
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
40 @save="saveSubmit" 40 @save="saveSubmit"
41 @onOff="onOffSubmit" 41 @onOff="onOffSubmit"
42 @delete="deleteSubmit" 42 @delete="deleteSubmit"
43 + @locRadio="locRadio"
44 + @dessiteRadio="dessiteRadio"
43 @locationBur="locationBur" 45 @locationBur="locationBur"
44 @notLocationBur="notLocationBur" 46 @notLocationBur="notLocationBur"
45 @destinationSiteBur="destinationSiteBur" 47 @destinationSiteBur="destinationSiteBur"
......
...@@ -766,63 +766,229 @@ export default { ...@@ -766,63 +766,229 @@ export default {
766 blurEvent({ originOfFlightNo }) { 766 blurEvent({ originOfFlightNo }) {
767 this.queryForm.originOfFlightNo = this.upCase(originOfFlightNo); 767 this.queryForm.originOfFlightNo = this.upCase(originOfFlightNo);
768 }, 768 },
769 - 769 + // 始发地
770 - validateLocation({ isLocation, location, notLocation }) { 770 + locRadio({ index, item }) {
771 - let locationVal, 771 + const validateData = {
772 - notLocationVal, 772 + reg: /^[a-zA-Z0-9]*$/,
773 - repeat, 773 + index: index,
774 - validateLocation, 774 + radio: item.isLocation,
775 - validateNotlocation; 775 + include: item.location,
776 - if (isLocation == "1") { 776 + notInclude: item.notLocation,
777 + errorMsgAttr: "locationError",
778 + validateForm: false, // form表单节流阀
779 + errorMsg: {
780 + repeat: "填写的始发站已重复",
781 + empty: "不能为空",
782 + error: "始发站之间用分号分隔,例:P1;P2;P3",
783 + },
784 + };
785 + // this.validateParmas(validateData);
786 + },
787 + // 目的站
788 + dessiteRadio({ index, item }) {
789 + const validateData = {
790 + reg: /^[a-zA-Z0-9]*$/,
791 + index: index,
792 + radio: item.isLocation,
793 + include: item.location,
794 + notInclude: item.notLocation,
795 + errorMsgAttr: "destinationSiteError",
796 + validateForm: false, // form表单节流阀
797 + errorMsg: {
798 + repeat: "填写的目的站已重复",
799 + empty: "不能为空",
800 + error: "目的站之间用分号分隔,例:P1;P2;P3",
801 + },
802 + };
803 + // this.validateParmas(validateData);
804 + },
805 + // 校验目的地
806 + validateParmas({
807 + reg,
808 + index,
809 + radio,
810 + include,
811 + notInclude,
812 + errorMsgAttr,
813 + errorMsg,
814 + ursaMark,
815 + }) {
816 + let includeVal,
817 + notIncludeVal,
818 + repeat = false,
819 + validate = true;
820 + if (radio == "1") {
821 + if (include) {
777 // 分隔字符串并且转数组&去除数组空字符串 822 // 分隔字符串并且转数组&去除数组空字符串
778 - locationVal = location.split(";").filter((str) => str !== ""); 823 + includeVal = include.split(";").filter((str) => str !== "");
779 // 是否有重复的 824 // 是否有重复的
780 - repeat = new Set(locationVal).size !== locationVal.length; 825 + repeat = new Set(includeVal).size !== includeVal.length;
781 // 校验校验开头以字母或者数字开头的/^[a-zA-Z0-9]*$/ 826 // 校验校验开头以字母或者数字开头的/^[a-zA-Z0-9]*$/
782 - validateLocation = locationVal.every((item) => 827 + validate = includeVal.every((item) => reg.test(item));
783 - /^[a-zA-Z0-9]*$/.test(item) 828 + }
784 - );
785 } else { 829 } else {
786 - notLocationVal = notLocation.split(";").filter((str) => str !== ""); 830 + if (notInclude) {
787 - repeat = new Set(notLocationVal).size !== notLocationVal.length; 831 + notIncludeVal = notInclude.split(";").filter((str) => str !== "");
788 - validateNotlocation = locationVal.every((item) => 832 + repeat = new Set(notIncludeVal).size !== notIncludeVal.length;
789 - /^[a-zA-Z0-9]*$/.test(item) 833 + validate = notIncludeVal.every((item) => reg.test(item));
790 - ); 834 + }
835 + }
836 + if (ursaMark) {
837 + if (include) {
838 + includeVal = include.split(";").filter((str) => str !== "");
839 + repeat = new Set(includeVal).size !== includeVal.length;
840 + validate = includeVal.every((item) => reg.test(item));
841 + } else {
842 + this.routesInfo[index].validateForm = true; // form表单节流阀
843 + this.routesInfo[index][errorMsgAttr] = "";
844 + this.$set(this.routesInfo, index, this.routesInfo[index]);
845 + }
846 + }
847 + if (ursaMark == false) {
848 + if (notInclude) {
849 + notIncludeVal = notInclude.split(";").filter((str) => str !== "");
850 + repeat = new Set(notIncludeVal).size !== notIncludeVal.length;
851 + validate = notIncludeVal.every((item) => reg.test(item));
852 + } else {
853 + this.routesInfo[index].validateForm = true; // form表单节流阀
854 + this.routesInfo[index][errorMsgAttr] = "";
855 + this.$set(this.routesInfo, index, this.routesInfo[index]);
856 + }
857 + }
858 + if (repeat) {
859 + this.routesInfo[index].validateForm = false; // form表单节流阀
860 + this.routesInfo[index][errorMsgAttr] = errorMsg.repeat;
861 + this.$set(this.routesInfo, index, this.routesInfo[index]);
862 + }
863 + if (!validate) {
864 + this.routesInfo[index].validateForm = false; // form表单节流阀
865 + this.routesInfo[index][errorMsgAttr] = errorMsg.error;
866 + this.$set(this.routesInfo, index, this.routesInfo[index]);
867 + }
868 + if (!repeat && validate) {
869 + this.routesInfo[index].validateForm = true; // form表单节流阀
870 + this.routesInfo[index][errorMsgAttr] = "";
871 + this.$set(this.routesInfo, index, this.routesInfo[index]);
872 + }
873 + if (radio == "1" && !include) {
874 + this.routesInfo[index].validateForm = true; // form表单节流阀
875 + this.routesInfo[index][errorMsgAttr] = "";
876 + this.$set(this.routesInfo, index, this.routesInfo[index]);
877 + }
878 + if (radio == "2" && !notInclude) {
879 + this.routesInfo[index].validateForm = true; // form表单节流阀
880 + this.routesInfo[index][errorMsgAttr] = "";
881 + this.$set(this.routesInfo, index, this.routesInfo[index]);
791 } 882 }
792 }, 883 },
793 -
794 // 包含始发站失焦事件 884 // 包含始发站失焦事件
795 locationBur({ index, item }) { 885 locationBur({ index, item }) {
796 - /*
797 - 对于单选框这种,不论是勾选哪一个两则都使用一个布尔值;
798 - // 校验:只能字母和数组组合,不能有重复的,包含中不能有包含的
799 - */
800 - // console.log(this.routesInfo);
801 - // console.log("locationBur", index, item);
802 // 不为空的时候做校验 886 // 不为空的时候做校验
803 - // if (item.location || item.notLocation) { 887 + const validateData = {
804 - // this.validateLocation(item); 888 + reg: /^[a-zA-Z0-9]*$/,
805 - // } 889 + index: index,
890 + radio: item.isLocation,
891 + include: item.location,
892 + notInclude: item.notLocation,
893 + errorMsgAttr: "locationError",
894 + validateForm: false, // form表单节流阀
895 + errorMsg: {
896 + repeat: "填写的始发站已重复",
897 + empty: "不能为空",
898 + error: "始发站之间用分号分隔,例:P1;P2;P3",
899 + },
900 + };
901 + // this.validateParmas(validateData);
806 }, 902 },
807 // 不包含始发站失焦事件 903 // 不包含始发站失焦事件
808 notLocationBur({ index, item }) { 904 notLocationBur({ index, item }) {
809 - // console.log("notLocationBur", index, item); 905 + const validateData = {
906 + reg: /^[a-zA-Z0-9]*$/,
907 + index: index,
908 + radio: item.isLocation,
909 + include: item.location,
910 + notInclude: item.notLocation,
911 + errorMsgAttr: "locationError",
912 + validateForm: false, // form表单节流阀
913 + errorMsg: {
914 + repeat: "填写的始发站已重复",
915 + empty: "不能为空",
916 + error: "始发站之间用分号分隔,例:P1;P2;P3",
917 + },
918 + };
919 + // this.validateParmas(validateData);
810 }, 920 },
811 // 包含目的站失焦事件 921 // 包含目的站失焦事件
812 destinationSiteBur({ index, item }) { 922 destinationSiteBur({ index, item }) {
813 - // console.log("destinationSiteBur", index, item); 923 + const validateData = {
924 + reg: /^[a-zA-Z0-9]*$/,
925 + index: index,
926 + radio: item.isLocation,
927 + include: item.location,
928 + notInclude: item.notLocation,
929 + errorMsgAttr: "destinationSiteError",
930 + validateForm: false, // form表单节流阀
931 + errorMsg: {
932 + repeat: "填写的目的站已重复",
933 + empty: "不能为空",
934 + error: "目的站之间用分号分隔,例:P1;P2;P3",
935 + },
936 + };
937 + // this.validateParmas(validateData);
814 }, 938 },
815 // 不包含目的站失焦事件 939 // 不包含目的站失焦事件
816 notDestinationSiteBur({ index, item }) { 940 notDestinationSiteBur({ index, item }) {
817 - // console.log("notDestinationSiteBur", index, item); 941 + const validateData = {
942 + reg: /^[a-zA-Z0-9]*$/,
943 + index: index,
944 + radio: item.isLocation,
945 + include: item.location,
946 + notInclude: item.notLocation,
947 + errorMsgAttr: "destinationSiteError",
948 + validateForm: false, // form表单节流阀
949 + errorMsg: {
950 + repeat: "填写的目的站已重复",
951 + empty: "不能为空",
952 + error: "目的站之间用分号分隔,例:P1;P2;P3",
953 + },
954 + };
955 + // this.validateParmas(validateData);
818 }, 956 },
819 // URSA包含失焦事件 957 // URSA包含失焦事件
820 includeUrsaBur({ index, item }) { 958 includeUrsaBur({ index, item }) {
821 - // console.log("includeUrsaBur", index, item); 959 + const validateData = {
960 + reg: /^[a-zA-Z0-9]*_$/,
961 + index: index,
962 + ursaMark: true,
963 + include: item.includeUrsa,
964 + notInclude: item.notIncludeUrsa,
965 + errorMsgAttr: "ursaError",
966 + validateForm: false, // form表单节流阀
967 + errorMsg: {
968 + repeat: "填写的URSA已重复",
969 + empty: "不能为空",
970 + error: "URSA包含之间用分号分隔,例:P1_;F2_;F3_",
971 + },
972 + };
973 + // this.validateParmas(validateData);
822 }, 974 },
823 // URSA不包含失焦事件 975 // URSA不包含失焦事件
824 notIncludeUrsaBur({ index, item }) { 976 notIncludeUrsaBur({ index, item }) {
825 - // console.log("notIncludeUrsaBur", index, item); 977 + const validateData = {
978 + reg: /^[a-zA-Z0-9]*$/,
979 + index: index,
980 + ursaMark: false,
981 + include: item.includeUrsa,
982 + notInclude: item.notIncludeUrsa,
983 + errorMsgAttr: "notUrsaError",
984 + validateForm: false, // form表单节流阀
985 + errorMsg: {
986 + repeat: "填写的URSA已重复",
987 + empty: "不能为空",
988 + error: "URSA包含之间用分号分隔,例:P1;F2;F3",
989 + },
990 + };
991 + // this.validateParmas(validateData);
826 }, 992 },
827 // 最少件数失焦事件 993 // 最少件数失焦事件
828 minNumOfPiecesBur({ index, item }) { 994 minNumOfPiecesBur({ index, item }) {
......