Commit 9432eb8f by yubin

修改启动错误

parent c02ff50e
...@@ -121,7 +121,6 @@ ...@@ -121,7 +121,6 @@
<DatePicker v-model="statsStart" type="date" placeholder="开始日期" style="min-width:110px;margin-right:20px" /> <DatePicker v-model="statsStart" type="date" placeholder="开始日期" style="min-width:110px;margin-right:20px" />
<span>结束:</span> <span>结束:</span>
<DatePicker v-model="statsEnd" type="date" placeholder="结束日期" style="min-width:110px;margin-right:20px" /> <DatePicker v-model="statsEnd" type="date" placeholder="结束日期" style="min-width:110px;margin-right:20px" />
</Col> </Col>
<Col span="8" class="text-right"> <Col span="8" class="text-right">
<Button type="primary" class="mr10" @click="loadStats">统计</Button> <Button type="primary" class="mr10" @click="loadStats">统计</Button>
...@@ -315,7 +314,7 @@ export default { ...@@ -315,7 +314,7 @@ export default {
{ title: '申请人', key: 'user_name', align: 'center' }, { title: '申请人', key: 'user_name', align: 'center' },
{ title: '部门', key: 'department_name', align: 'center' }, { title: '部门', key: 'department_name', align: 'center' },
{ title: '请假类型', key: 'leave_type_name', align: 'center' }, { title: '请假类型', key: 'leave_type_name', align: 'center' },
{ title: '起止时间', key: 'start_time',width: 300, align: 'center', render: (h, { row }) => h('span', `${row.start_time || '-'} ~ ${row.end_time || '-'}`) }, { title: '起止时间', key: 'start_time', width: 300, align: 'center', render: (h, { row }) => h('span', `${row.start_time || '-'} ~ ${row.end_time || '-'}`) },
{ title: '时长', key: 'duration', align: 'center' }, { title: '时长', key: 'duration', align: 'center' },
{ title: '状态', key: 'status', align: 'center', render: (h, { row }) => h('span', this.mapStatusText(row.status)) }, { title: '状态', key: 'status', align: 'center', render: (h, { row }) => h('span', this.mapStatusText(row.status)) },
{ title: '操作', slot: 'action', align: 'center', width: 160 } { title: '操作', slot: 'action', align: 'center', width: 160 }
...@@ -733,30 +732,30 @@ export default { ...@@ -733,30 +732,30 @@ export default {
} }
// 验证开始/结束时间:结束时间必须大于开始时间 // 验证开始/结束时间:结束时间必须大于开始时间
const form = this.applyModal.form || {} const form = this.applyModal.form || {}
const parseToDate = (v) => { const parseToDate = (v) => {
if (v === null || v === undefined || v === '') return null if (v === null || v === undefined || v === '') return null
if (typeof v === 'number') return new Date(v) if (typeof v === 'number') return new Date(v)
if (typeof v === 'string') { if (typeof v === 'string') {
if (/^\d+$/.test(v)) return new Date(Number(v)) if (/^\d+$/.test(v)) return new Date(Number(v))
// 把 "YYYY-MM-DD HH:mm:ss" 之类的字符串转换为可解析的 ISO 风格(替换第一个空格为'T') // 把 "YYYY-MM-DD HH:mm:ss" 之类的字符串转换为可解析的 ISO 风格(替换第一个空格为'T')
const s = v.includes('T') ? v : v.replace(' ', 'T') const s = v.includes('T') ? v : v.replace(' ', 'T')
const parsed = new Date(s) const parsed = new Date(s)
return isNaN(parsed.getTime()) ? null : parsed
}
if (v instanceof Date) return isNaN(v.getTime()) ? null : v
const parsed = new Date(v)
return isNaN(parsed.getTime()) ? null : parsed return isNaN(parsed.getTime()) ? null : parsed
} }
if (v instanceof Date) return isNaN(v.getTime()) ? null : v const startDate = parseToDate(form.start_time)
const parsed = new Date(v) const endDate = parseToDate(form.end_time)
return isNaN(parsed.getTime()) ? null : parsed if (startDate && endDate) {
} if (endDate.getTime() <= startDate.getTime()) {
const startDate = parseToDate(form.start_time) this.applyModal.saving = false
const endDate = parseToDate(form.end_time) this.$Message.warning('结束时间必须大于开始时间')
if (startDate && endDate) { return
if (endDate.getTime() <= startDate.getTime()) { }
this.applyModal.saving = false
this.$Message.warning('结束时间必须大于开始时间')
return
} }
}
// 拷贝表单并格式化开始/结束时间为数据库 datetime 字符串 // 拷贝表单并格式化开始/结束时间为数据库 datetime 字符串
const payload = Object.assign({}, this.applyModal.form) const payload = Object.assign({}, this.applyModal.form)
...@@ -769,12 +768,12 @@ export default { ...@@ -769,12 +768,12 @@ export default {
this.applyModal.saving = true this.applyModal.saving = true
saveLeaveApplication(payload).then(ret => { saveLeaveApplication(payload).then(ret => {
if (ret.data && ret.data.errcode === 0) { if (ret.data && ret.data.errcode === 0) {
this.$Message.success('保存成功') this.$Message.success('保存成功')
this.applyModal.visible = false this.applyModal.visible = false
this.fetchList('apply') this.fetchList('apply')
} else this.$Notice.error({ title: '保存失败', desc: ret.data && ret.data.errmsg }) } else this.$Notice.error({ title: '保存失败', desc: ret.data && ret.data.errmsg })
}).finally(() => { this.applyModal.saving = false }) }).finally(() => { this.applyModal.saving = false })
}) })
}, },
canEdit (row) { canEdit (row) {
......
...@@ -90,7 +90,6 @@ ...@@ -90,7 +90,6 @@
<script> <script>
import { getDmUserList, syncDmUsersByOffice, saveDmUser } from '@/api/key-dm-user' import { getDmUserList, syncDmUsersByOffice, saveDmUser } from '@/api/key-dm-user'
import UserSelector from './userSelector.vue' import UserSelector from './userSelector.vue'
import { normalizeVisitTimeValue } from '@/view/key-person/key_dm_conf/dates.js'
export default { export default {
name: 'key-dm-user-index', name: 'key-dm-user-index',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论