This commit is contained in:
fan 2020-12-31 09:32:40 +08:00
commit a5c97fc6b5
11 changed files with 97 additions and 49 deletions

View File

@ -60,9 +60,11 @@ export default {
this.bacground = 'rgba(0,0,0,0)'; this.bacground = 'rgba(0,0,0,0)';
this.scaleRate = window.innerWidth / 2200; this.scaleRate = window.innerWidth / 2200;
if (this.stationId == 'mainHouseOne') { if (this.stationId == 'mainHouseOne') {
this.title = '黄山主变电所接线图'; //
this.title = '主所1主变电所接线图';
} else { } else {
this.title = '茶亭主变电所接线图'; //
this.title = '主所2主变电所接线图';
} }
params.userInterface = 'substation'; params.userInterface = 'substation';
// parkingLotName // parkingLotName

View File

@ -10,12 +10,11 @@
:modal="false" :modal="false"
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<el-row> <el-form ref="form" :rules="rules" :model="formModel" label-width="100px" size="medium" @submit.native.prevent>
<el-col :span="6" :offset="2" style="height: 30px; line-height: 30px;">{{ $t('planMonitor.serviceNumber2')+$t('global.colon') }}</el-col> <el-form-item prop="serviceNumber" :label="$t('planMonitor.serviceNumber2')+$t('global.colon')" :required="true">
<el-col :span="10" :offset="1"> <el-input v-model="formModel.serviceNumber" type="text" size="mini" maxlength="3" minlength="2" />
<el-input v-model="serviceNumber" size="mini" maxlength="3" minlength="2" /> </el-form-item>
</el-col> </el-form>
</el-row>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button size="medium" @click="doClose">{{ $t('global.cancel') }}</el-button> <el-button size="medium" @click="doClose">{{ $t('global.cancel') }}</el-button>
<el-button type="primary" size="medium" @click="handleCommit">{{ $t('global.confirm') }}</el-button> <el-button type="primary" size="medium" @click="handleCommit">{{ $t('global.confirm') }}</el-button>
@ -40,7 +39,15 @@ export default {
return { return {
dialogShow: false, dialogShow: false,
loading: false, loading: false,
serviceNumber: '' formModel:{
serviceNumber: ''
},
rules:{
serviceNumber:[
{required: true, validator: this.validateServiceNumber, trigger: 'blur'},
{required: true, validator: this.validateServiceNumber, trigger: 'change'}
]
}
}; };
}, },
computed: { computed: {
@ -58,9 +65,30 @@ export default {
this.loading = false; this.loading = false;
this.dialogShow = false; this.dialogShow = false;
}, },
validateServiceNumber(rule, value, callback) {
if (typeof value == 'string' && value.trim().length == 0) {
return callback(new Error('请填写服务号'));
} else {
const newValue = parseInt(value);
if (newValue) {
if (newValue.toString() != value) {
this.formModel.serviceNumber = newValue;
}
const serviceNumberList = Object.keys(this.$store.state.runPlan.editData);
if (serviceNumberList.includes(value)) {
return callback(new Error('该服务号已存在,请重新填写'));
} else {
return callback();
}
} else {
this.formModel.serviceNumber = '';
}
}
},
handleCommit() { handleCommit() {
if (this.$route.query.planId || this.loadRunPlanId) { this.$refs.dataform.validateForm(() => {
if (this.serviceNumber.length >= 2 && this.serviceNumber.length <= 3) { if (this.$route.query.planId || this.loadRunPlanId) {
checkServiceNumberExist({ planId: this.$route.query.planId || this.loadRunPlanId, serviceNumber: this.serviceNumber }).then(resp => { checkServiceNumberExist({ planId: this.$route.query.planId || this.loadRunPlanId, serviceNumber: this.serviceNumber }).then(resp => {
if (resp.data) { if (resp.data) {
this.$emit('dispatchDialog', { this.$emit('dispatchDialog', {
@ -79,11 +107,13 @@ export default {
} }
}); });
} else { } else {
this.$messageBox('长度在二到三位'); this.$messageBox(this.$t('tip.chooseToOpenTheRunGraph'));
} }
} else { });
this.$messageBox(this.$t('tip.chooseToOpenTheRunGraph')); // if (this.serviceNumber.length >= 2 && this.serviceNumber.length <= 3) {
} // } else {
// this.$messageBox('');
// }
}, },
handleConfirm(isNew = false) { handleConfirm(isNew = false) {
this.doClose(); this.doClose();

View File

@ -58,7 +58,8 @@ export default {
rules: { rules: {
serviceNumber:[ serviceNumber:[
{required: true, validator: this.validateServiceNumber, trigger: 'blur'} {required: true, validator: this.validateServiceNumber, trigger: 'blur'},
{required: true, validator: this.validateServiceNumber, trigger: 'change'}
], ],
beginTime: [ beginTime: [
{ required: true, message: '请填写开始时间', trigger: 'blur' } { required: true, message: '请填写开始时间', trigger: 'blur' }
@ -134,15 +135,24 @@ export default {
this.dialogShow = true; this.dialogShow = true;
}, },
validateServiceNumber(rule, value, callback) { validateServiceNumber(rule, value, callback) {
if (value.trim().length == 0) { if (typeof value == 'string' && value.trim().length == 0) {
return callback(new Error('请填写服务号')); return callback(new Error('请填写服务号'));
} else { } else {
const serviceNumberList = Object.keys(this.$store.state.runPlan.editData); const newValue = parseInt(value);
if (serviceNumberList.includes(value.trim())) { if (newValue) {
return callback(new Error('该服务号已存在,请重新填写')); if (newValue.toString() != value) {
this.formModel.serviceNumber = newValue;
}
const serviceNumberList = Object.keys(this.$store.state.runPlan.editData);
if (serviceNumberList.includes(value)) {
return callback(new Error('该服务号已存在,请重新填写'));
} else {
return callback();
}
} else { } else {
return callback(); this.formModel.serviceNumber = '';
} }
} }
}, },
validateRunningRouting(rule, value, callback) { validateRunningRouting(rule, value, callback) {

View File

@ -32,7 +32,7 @@
<span>{{ $t('global.startTime')+$t('global.colon') }}</span> <span>{{ $t('global.startTime')+$t('global.colon') }}</span>
</el-col> </el-col>
<el-col :span="5"> <el-col :span="5">
<el-time-picker v-model="addModel.startTime" size="mini" value-format="HH:mm:ss" :clearable="false" /> <el-time-picker v-model="addModel.startTime" size="mini" value-format="HH:mm:ss" :clearable="false" :picker-options="{selectableRange:'02:00:00-23:59:59'}" />
</el-col> </el-col>
</el-row> </el-row>
<el-row style="margin-top: 5px;height: 28px;line-height: 28px;"> <el-row style="margin-top: 5px;height: 28px;line-height: 28px;">

View File

@ -146,6 +146,7 @@
value-format="HH:mm:ss" value-format="HH:mm:ss"
size="mini" size="mini"
:clearable="false" :clearable="false"
:picker-options="{selectableRange:'02:00:00-23:59:59'}"
/> />
</el-col> </el-col>
</el-row> </el-row>

View File

@ -80,8 +80,8 @@ export default {
return { return {
labelWidth: '100px', labelWidth: '100px',
items: [ items: [
{ prop: 'beginTime', label: '开始时间', type: 'timePicker'}, { prop: 'beginTime', label: '开始时间', type: 'timePicker', selectableRange:'02:00:00-23:59:59'},
{ prop: 'overTime', label: '结束时间', type: 'timePicker'}, { prop: 'overTime', label: '结束时间', type: 'timePicker', selectableRange:'02:00:00-23:59:59'},
{ prop: 'departureTimeInterval', label: '发车间隔', type: 'number'}, { prop: 'departureTimeInterval', label: '发车间隔', type: 'number'},
{ prop: 'parkedTime', label: '停站时间', type: 'number'}, { prop: 'parkedTime', label: '停站时间', type: 'number'},
{ prop: 'reentryTime', label: '折返时间', type: 'number'}, { prop: 'reentryTime', label: '折返时间', type: 'number'},

View File

@ -24,6 +24,7 @@
value-format="timestamp" value-format="timestamp"
:disabled="isEdit" :disabled="isEdit"
:picker-options="pickerOptions" :picker-options="pickerOptions"
@change="handle"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -37,8 +38,8 @@
style="width: 100%;" style="width: 100%;"
value-format="timestamp" value-format="timestamp"
:disabled="true" :disabled="true"
:picker-options="pickerOptions"
/> />
<!-- :picker-options="pickerOptions" -->
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-form-item> </el-form-item>
@ -123,6 +124,7 @@ export default {
pickerOptions: { pickerOptions: {
disabledDate(time) { disabledDate(time) {
return time.getTime() < new Date(new Date().toLocaleDateString()).getTime(); return time.getTime() < new Date(new Date().toLocaleDateString()).getTime();
// return time.getTime() < Date.now() - 1 * 24 * 3600 * 1000;
} }
}, },
formDetail: { formDetail: {
@ -217,6 +219,12 @@ export default {
passMark: data.passMark passMark: data.passMark
}; };
}, },
handle() {
var startAt = new Date(this.form.startDate) * 1000 / 1000;
if (startAt < Date.now()) {
this.form.startDate = new Date().getTime();
}
},
getClassList() { getClassList() {
if (this.isClassShow) { if (this.isClassShow) {
this.classList = []; this.classList = [];
@ -255,34 +263,26 @@ export default {
}); });
}, },
submitForm() { submitForm() {
this.submit('definition');
},
submit(type) {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
if (valid) { if (valid) {
if (this.form.startDate) { const form = Object.assign({}, this.form);
this.form.startDate = this.getDate(this.form.startDate); if (form.startDate) {
form.startDate = this.getDate(form.startDate);
} }
if (this.form.endDate) { if (form.endDate) {
this.form.endDate = this.getDate(this.form.endDate); form.endDate = this.getDate(form.endDate);
} }
this.form['trial'] = this.trial; form['trial'] = this.trial;
this.$store.dispatch('exam/setCourseDetail', this.form); this.$store.dispatch('exam/setCourseDetail', form);
this.$emit('definition', this.form); this.$emit(type, form);
} }
}); });
}, },
createQuickly() { createQuickly() {
this.$refs['form'].validate((valid) => { this.submit('createQuickly');
if (valid) {
if (this.form.startDate) {
this.form.startDate = this.getDate(this.form.startDate);
}
if (this.form.endDate) {
this.form.endDate = this.getDate(this.form.endDate);
}
this.form['trial'] = this.trial;
this.$store.dispatch('exam/setCourseDetail', this.form);
this.$emit('createQuickly', this.form);
}
});
}, },
getDate(date) { getDate(date) {
const now = new Date(date); const now = new Date(date);

View File

@ -149,6 +149,7 @@ export default {
this.$store.dispatch('exam/setRuleList', []); // this.$store.dispatch('exam/setRuleList', []); //
const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleManage}`; const path = `${this.$route.path.match(/(\/.*)\/examRule/)[1]}${UrlConfig.examRuleManage}`;
const lessonId = this.$route.params.lessonId; const lessonId = this.$route.params.lessonId;
this.$store.dispatch('exam/setCourseDetail', {});
if (parseInt(lessonId)) { if (parseInt(lessonId)) {
this.$router.replace({ path: `${path}`, query: { mapId: this.$route.query.mapId, lessonId: lessonId, noPreLogout: this.$route.query.noPreLogout } }); this.$router.replace({ path: `${path}`, query: { mapId: this.$route.query.mapId, lessonId: lessonId, noPreLogout: this.$route.query.noPreLogout } });
} else { } else {

View File

@ -141,8 +141,8 @@ export default {
name: this.course.name, // name: this.course.name, //
passingPoint: Number(this.course.passMark), // passingPoint: Number(this.course.passMark), //
remarks: this.course.desc, // remarks: this.course.desc, //
endTime: this.course.endTime, endTime: this.course.endDate,
startTime: this.course.startTime, startTime: this.course.startDate,
type: this.course.type, // type: this.course.type, //
trial: this.course.trial == 2 // trial: this.course.trial == 2 //
}; };

View File

@ -76,7 +76,8 @@ export default {
title: this.$t('publish.examTime'), title: this.$t('publish.examTime'),
prop: 'startTime', prop: 'startTime',
type: 'formatter', type: 'formatter',
format: 'yyyy-MM-dd hh:ss' format: 'yyyy-MM-dd hh:ss',
width:'200px'
}, },
{ {
title: this.$t('publish.fullMark'), title: this.$t('publish.fullMark'),

View File

@ -4,7 +4,7 @@
<el-dialog title="复制iscs数据" :visible.sync="dialogVisible" width="400px" center> <el-dialog title="复制iscs数据" :visible.sync="dialogVisible" width="400px" center>
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" /> <data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button> <el-button :loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="close">{{ $t('global.cancel') }}</el-button> <el-button @click="close">{{ $t('global.cancel') }}</el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -158,11 +158,14 @@ export default {
}, },
doSave() { doSave() {
this.$refs.dataform.validateForm(() => { this.$refs.dataform.validateForm(() => {
this.loading = true;
copyIscsData(this.formModel).then(res=>{ copyIscsData(this.formModel).then(res=>{
this.loading = false;
this.$message.success('复制ISCS数据成功'); this.$message.success('复制ISCS数据成功');
this.close(); this.close();
this.reloadTable(); this.reloadTable();
}).catch(() => { }).catch(() => {
this.loading = false;
this.reloadTable(); this.reloadTable();
this.$messageBox('复制ISCS数据失败'); this.$messageBox('复制ISCS数据失败');
}); });