Elements-SY

modify

...@@ -133,9 +133,11 @@ ...@@ -133,9 +133,11 @@
133 </el-row> 133 </el-row>
134 <el-row style="margin-bottom:5px"> 134 <el-row style="margin-bottom:5px">
135 <el-col :span="12"> 135 <el-col :span="12">
136 - <el-form-item prop="route"> 136 + <el-form-item>
137 <template slot="label"> 137 <template slot="label">
138 - <div style="display:inline-block">航班路线 138 + <div style="display:inline-block">
139 + <span class="error-route">*</span>
140 + 航班路线
139 <el-tooltip class="item" effect="dark" content="输入航班号后获取航线信息。航班种类为Purple Tail时可以进行多选,切换航班种类后需重新选择航线" 141 <el-tooltip class="item" effect="dark" content="输入航班号后获取航线信息。航班种类为Purple Tail时可以进行多选,切换航班种类后需重新选择航线"
140 placement="top-start"> 142 placement="top-start">
141 <span class="el-icon-warning" style="color:#1890ff;font-size:16px"></span> 143 <span class="el-icon-warning" style="color:#1890ff;font-size:16px"></span>
...@@ -143,17 +145,18 @@ ...@@ -143,17 +145,18 @@
143 </div> 145 </div>
144 </template> 146 </template>
145 <el-select v-if="routeMultiple" ref="routeSelect" class="wid80" v-model="form.route" 147 <el-select v-if="routeMultiple" ref="routeSelect" class="wid80" v-model="form.route"
146 - :disabled="formdisabled.route" placeholder="请选择航线" no-data-text="未查询到航线" @change="routeChange" 148 + :disabled="formdisabled.route" placeholder="请选择航线" no-data-text="未查询到航线" @change="routeChange" @blur="blurRoute"
147 :loading="routeLoading" :multiple='true' :key="routeMultiple"> 149 :loading="routeLoading" :multiple='true' :key="routeMultiple">
148 <el-option v-for="item in routeList" :key="item.id" :label="item.route" :value="item.route"> 150 <el-option v-for="item in routeList" :key="item.id" :label="item.route" :value="item.route">
149 </el-option> 151 </el-option>
150 </el-select> 152 </el-select>
151 <el-select v-if="routeMultiple == false" ref="routeSelect" class="wid80" v-model="form.route" 153 <el-select v-if="routeMultiple == false" ref="routeSelect" class="wid80" v-model="form.route"
152 - :disabled="formdisabled.route" placeholder="请选择航线" no-data-text="未查询到航线" @change="routeChange" 154 + :disabled="formdisabled.route" placeholder="请选择航线" no-data-text="未查询到航线" @change="routeChange" @blur="blurRoute"
153 :loading="routeLoading" :multiple='false' :key="routeMultiple"> 155 :loading="routeLoading" :multiple='false' :key="routeMultiple">
154 <el-option v-for="item in routeList" :key="item.id" :label="item.route" :value="item.route"> 156 <el-option v-for="item in routeList" :key="item.id" :label="item.route" :value="item.route">
155 </el-option> 157 </el-option>
156 </el-select> 158 </el-select>
159 + <span ref="errorRoute" class="el-form-item__error" v-show="routeError">航班路线不能为空</span>
157 </el-form-item> 160 </el-form-item>
158 <div class="formTips" v-if="title == '修改航班信息'">注意!:移除航线,相对应日期级别航线维度会同时删除</div> 161 <div class="formTips" v-if="title == '修改航班信息'">注意!:移除航线,相对应日期级别航线维度会同时删除</div>
159 </el-col> 162 </el-col>
...@@ -322,7 +325,7 @@ export default { ...@@ -322,7 +325,7 @@ export default {
322 }, 325 },
323 //表单参数 326 //表单参数
324 form: { 327 form: {
325 - isNeedRequired: 2 328 + isNeedRequired: 2,
326 }, 329 },
327 routeList: [], 330 routeList: [],
328 //表单校验 331 //表单校验
...@@ -352,20 +355,9 @@ export default { ...@@ -352,20 +355,9 @@ export default {
352 { 355 {
353 required: true, 356 required: true,
354 message: "原始重量(KG)不能为空", 357 message: "原始重量(KG)不能为空",
355 - trigger: "blur",
356 - },
357 - ],
358 - route: [
359 - {
360 - required: true,
361 - message: "航班路线不能为空",
362 trigger: "change", 358 trigger: "change",
363 }, 359 },
364 - // { 360 + ],
365 - // pattern: /^(([\~A-Z]{3,4})(\-[A-Z]{3,4})+)(;{1,1}(([\~A-Z]{3,4})(\-[A-Z]{3,4})+)){0,}$/,
366 - // message: "请输入正确得航班线路"
367 - // }
368 - ]
369 }, 361 },
370 //原航班规则数据 362 //原航班规则数据
371 findAllFltDatList: [], 363 findAllFltDatList: [],
...@@ -479,6 +471,7 @@ export default { ...@@ -479,6 +471,7 @@ export default {
479 openFlightDate: false, 471 openFlightDate: false,
480 //shift键状态 472 //shift键状态
481 shiftKey: false, 473 shiftKey: false,
474 + routeError: false, // 请选择航线错误显示
482 }; 475 };
483 }, 476 },
484 directives: { 477 directives: {
...@@ -643,7 +636,7 @@ export default { ...@@ -643,7 +636,7 @@ export default {
643 this.routeMultiple = true 636 this.routeMultiple = true
644 this.form.route = [] 637 this.form.route = []
645 } 638 }
646 - this.validateFieldForm() 639 + this.routeError = true
647 } 640 }
648 }) 641 })
649 // this.$refs.routeSelect.$forceUpdate() 642 // this.$refs.routeSelect.$forceUpdate()
...@@ -726,6 +719,7 @@ export default { ...@@ -726,6 +719,7 @@ export default {
726 this.formdisabled.typeId = false; 719 this.formdisabled.typeId = false;
727 //原始重量 720 //原始重量
728 this.formdisabled.originalWeight = false; 721 this.formdisabled.originalWeight = false;
722 + this.routeError = false;
729 this.$nextTick(() => { 723 this.$nextTick(() => {
730 this.$refs.form.clearValidate() 724 this.$refs.form.clearValidate()
731 }) 725 })
...@@ -942,8 +936,19 @@ export default { ...@@ -942,8 +936,19 @@ export default {
942 }, 936 },
943 /** 提交按钮 */ 937 /** 提交按钮 */
944 submitForm: function () { 938 submitForm: function () {
945 - this.validateFieldForm()
946 this.$refs["form"].validate((valid) => { 939 this.$refs["form"].validate((valid) => {
940 + if(this.form.route == undefined){
941 + this.routeError = true;
942 + console.log(this.form.route)
943 + }
944 + if(this.form.route.length || this.form.route !== undefined){
945 + this.routeError = false;
946 + }
947 +
948 + if(this.form.route.length == 0 || this.form.route == undefined){
949 + this.routeError = true;
950 + return
951 + }
947 if (valid) { 952 if (valid) {
948 let formdata = JSON.parse(JSON.stringify(this.form)); 953 let formdata = JSON.parse(JSON.stringify(this.form));
949 //高价百分比和低价百分比和不可以大于100 954 //高价百分比和低价百分比和不可以大于100
...@@ -1131,23 +1136,22 @@ export default { ...@@ -1131,23 +1136,22 @@ export default {
1131 console.log(err) 1136 console.log(err)
1132 }) 1137 })
1133 }, 1138 },
1134 - // 对部分表单字段进行校验的方法
1135 - validateFieldForm(){
1136 - this.$refs.form.validateField(['fltNo', 'fltDate', 'kindId', 'route', 'originalWeight'], (flag) => {
1137 - if(this.form.fltNo && this.form.fltDate && this.form.kindId && this.form.route && this.form.route.length && this.form.originalWeight){
1138 - if(this.form.route.length){
1139 - this.$nextTick(()=>{
1140 - this.$refs.form.clearValidate()
1141 - })
1142 - }
1143 - }
1144 - })
1145 - },
1146 //航线修改 1139 //航线修改
1147 routeChange(val) { 1140 routeChange(val) {
1148 - this.validateFieldForm() 1141 + if(this.form.route.length){
1142 + this.routeError = false;
1143 + }else{
1144 + this.routeError = true;
1145 + }
1149 this.$forceUpdate() 1146 this.$forceUpdate()
1150 }, 1147 },
1148 + blurRoute(){
1149 + if(this.form.route.length){
1150 + this.routeError = false;
1151 + }else{
1152 + this.routeError = true;
1153 + }
1154 + },
1151 //多选框选中数据 1155 //多选框选中数据
1152 tableSelect(val) { 1156 tableSelect(val) {
1153 this.ids = val.selection; 1157 this.ids = val.selection;
...@@ -1204,4 +1208,7 @@ export default { ...@@ -1204,4 +1208,7 @@ export default {
1204 color: #ff4949; 1208 color: #ff4949;
1205 text-align: right; 1209 text-align: right;
1206 } 1210 }
1211 +.error-route{
1212 + color: #ff4949;
1213 +}
1207 </style> 1214 </style>
......