|
|
@@ -1,174 +1,92 @@
|
|
|
<template>
|
|
|
- <van-dialog
|
|
|
- ref="dialog"
|
|
|
- v-model="dialogVisible"
|
|
|
- :z-index="99"
|
|
|
- :title="dynamicParams.editFromType"
|
|
|
- :style="{ width: width, top: top }"
|
|
|
- :overlay="true"
|
|
|
- :overlay-class="'van-dialog__overlay'"
|
|
|
- @close="closeDialog"
|
|
|
+<div>
|
|
|
+ <van-dialog
|
|
|
+ ref="dialog"
|
|
|
+ v-model="dialogVisible"
|
|
|
+ :z-index="99"
|
|
|
+ :title="dynamicParams.editFromType"
|
|
|
+ :style="{ width: width, top: top }"
|
|
|
+ :overlay="true"
|
|
|
+ :overlay-class="'van-dialog__overlay'"
|
|
|
+ class="dialog-box"
|
|
|
+ show-cancel-button
|
|
|
+ @confirm="handleActionEvent"
|
|
|
>
|
|
|
- <div class="maintenanceCycle">
|
|
|
- <div class="maintenanceFont">维护周期:</div>
|
|
|
- <van-cell
|
|
|
- title="请选择"
|
|
|
- is-link
|
|
|
- :value="selectedLabel"
|
|
|
- @click="showPicker = true"
|
|
|
- />
|
|
|
- <van-popup v-model="showPicker" position="bottom">
|
|
|
- <van-radio-group
|
|
|
- v-model="selectedValue"
|
|
|
- @change="onSelectChange"
|
|
|
- >
|
|
|
- <van-radio
|
|
|
- v-for="item in cycleOptions"
|
|
|
- :key="item.value"
|
|
|
- :name="item.value"
|
|
|
- :label="item.label"
|
|
|
- />
|
|
|
- </van-radio-group>
|
|
|
- </van-popup>
|
|
|
- </div>
|
|
|
- <div
|
|
|
- v-if="judgeShow > 0"
|
|
|
- class="maintenanceCycle"
|
|
|
- style="align-items: baseline"
|
|
|
- >
|
|
|
- <div class="maintenanceFont">
|
|
|
- {{ cycleOptions[judgeShow].label }}日期:
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <div v-if="judgeShow == 1" class="maintenanceCycle marginNone">
|
|
|
- <van-checkbox-group v-model="dayCheckList">
|
|
|
- <van-checkbox
|
|
|
- v-for="(item, i) in weekList"
|
|
|
- :key="i"
|
|
|
- :name="item"
|
|
|
- class="rightMargin"
|
|
|
- @change="handleChange"
|
|
|
- />
|
|
|
- </van-checkbox-group>
|
|
|
- </div>
|
|
|
- <!-- 月选择 -->
|
|
|
- <van-popup v-model="showMonthPicker" position="bottom">
|
|
|
- <van-picker
|
|
|
- v-model="monthDateValue"
|
|
|
- :columns="monthDateOptions.map((item) => item.label)"
|
|
|
- @confirm="onMonthConfirm"
|
|
|
- @cancel="showMonthPicker = false"
|
|
|
- />
|
|
|
- </van-popup>
|
|
|
- <!-- 周选择 -->
|
|
|
- <van-radio-group v-model="weekDateValue">
|
|
|
- <van-radio
|
|
|
- v-for="(item, i) in weekList"
|
|
|
- :key="i"
|
|
|
- :name="item"
|
|
|
- >{{ item }}</van-radio
|
|
|
- >
|
|
|
- </van-radio-group>
|
|
|
- <!-- 季度选择 -->
|
|
|
- <van-popup v-model="showQuarterPicker" position="bottom">
|
|
|
- <van-picker
|
|
|
- v-model="quarterDateValue"
|
|
|
- :columns="qmonthDateOptions.map((item) => item.label)"
|
|
|
- @confirm="onQuarterConfirm"
|
|
|
- @cancel="showQuarterPicker = false"
|
|
|
- />
|
|
|
- </van-popup>
|
|
|
- <!-- 半年选择 -->
|
|
|
- <van-popup v-model="showMidyearPicker" position="bottom">
|
|
|
- <van-picker
|
|
|
- v-model="midyearDateValue"
|
|
|
- :columns="mymonthDateOptions.map((item) => item.label)"
|
|
|
- @confirm="onMidyearConfirm"
|
|
|
- @cancel="showMidyearPicker = false"
|
|
|
- />
|
|
|
- </van-popup>
|
|
|
- <van-popup v-model="showYearPicker" position="bottom">
|
|
|
- <van-picker
|
|
|
- v-model="yearDateValue"
|
|
|
- :columns="ymonthDateOptions.map((item) => item.label)"
|
|
|
- @confirm="onYearConfirm"
|
|
|
- @cancel="showYearPicker = false"
|
|
|
- />
|
|
|
- </van-popup>
|
|
|
- <div
|
|
|
- v-if="periodDayDate != '' && judgeShow == 1"
|
|
|
- class="describe"
|
|
|
- >
|
|
|
- 下次维护日期为
|
|
|
- <span class="fontColor">{{ periodDayDate }}</span>
|
|
|
- </div>
|
|
|
- <div
|
|
|
- v-if="periodWeekDate != '' && judgeShow == 3"
|
|
|
- class="describe"
|
|
|
- >
|
|
|
- 下次维护日期为
|
|
|
- <span class="fontColor">{{ periodWeekDate }}</span>
|
|
|
- </div>
|
|
|
- <div
|
|
|
- v-if="periodMonthDate != '' && judgeShow == 2"
|
|
|
- class="describe"
|
|
|
- >
|
|
|
- 下次维护日期为
|
|
|
- <span class="fontColor">{{ periodMonthDate }}</span>
|
|
|
- </div>
|
|
|
- <div
|
|
|
- v-if="periodQuarterDate != '' && judgeShow == 4"
|
|
|
- class="describe"
|
|
|
- >
|
|
|
- 下次维护日期为
|
|
|
- <span class="fontColor">{{ periodQuarterDate }}</span>
|
|
|
- </div>
|
|
|
- <div
|
|
|
- v-if="periodMidYearDate != '' && judgeShow == 5"
|
|
|
- class="describe"
|
|
|
- >
|
|
|
- 下次维护日期为
|
|
|
- <span class="fontColor">{{ periodMidYearDate }}</span>
|
|
|
- </div>
|
|
|
- <div
|
|
|
- v-if="periodYearDate != '' && judgeShow == 6"
|
|
|
- class="describe"
|
|
|
- >
|
|
|
- 下次维护日期为
|
|
|
- <span class="fontColor">{{ periodYearDate }}</span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="maintenanceCycle" style="align-items: normal">
|
|
|
- <div class="maintenanceFont">维护项目:</div>
|
|
|
- <van-field
|
|
|
- v-model="maintenanceTextarea"
|
|
|
- label="请输入内容"
|
|
|
- rows="4"
|
|
|
- autosize
|
|
|
- type="textarea"
|
|
|
- :style="{ width: '50%' }"
|
|
|
- placeholder="请输入内容"
|
|
|
- @input="countWords"
|
|
|
- >
|
|
|
- <template #input>
|
|
|
- <van-textarea
|
|
|
- :maxlength="500"
|
|
|
- :show-word-limit="true"
|
|
|
- @overlimit="handleOverLimit"
|
|
|
- />
|
|
|
- </template>
|
|
|
- </van-field>
|
|
|
- </div>
|
|
|
- <div slot="footer" class="el-dialog--center">
|
|
|
- <ibps-toolbar
|
|
|
- :actions="
|
|
|
- editFromType != 'consult' ? toolbars : toolbarsConsult
|
|
|
- "
|
|
|
- @action-event="handleActionEvent"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </van-dialog>
|
|
|
+ <van-cell-group>
|
|
|
+ <van-field
|
|
|
+ readonly
|
|
|
+ clickable
|
|
|
+ name="picker"
|
|
|
+ :value="value"
|
|
|
+ label="维护周期"
|
|
|
+ label-width='90'
|
|
|
+ placeholder="点击选择城市"
|
|
|
+ @click="showPicker = true"
|
|
|
+ />
|
|
|
+ <!-- 日期的选择(周,月,季度,半年,年)标题:value="valueDate" -->
|
|
|
+ <van-field
|
|
|
+ v-if="dateType"
|
|
|
+ v-model="valueDate"
|
|
|
+ readonly
|
|
|
+ clickable
|
|
|
+ :name="dateName"
|
|
|
+ :label="dateLable"
|
|
|
+ :placeholder="placeholder"
|
|
|
+ label-width='90'
|
|
|
+ @click="showDatePicker = true"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 日期的选择(日) -->
|
|
|
+ <van-field
|
|
|
+ v-if="dayweekDate"
|
|
|
+ label-width='90'
|
|
|
+ name="checkboxGroup"
|
|
|
+ label="日保养日期"
|
|
|
+ >
|
|
|
+ <template #input>
|
|
|
+ <van-checkbox-group v-if="dayweekDate" v-model="dayCheckList" direction="horizontal">
|
|
|
+ <van-row >
|
|
|
+ <van-col v-for="(item,index) in weekList" :key="index" :span="8">
|
|
|
+ <van-checkbox :name="item" shape="square">{{item}}</van-checkbox>
|
|
|
+ </van-col>
|
|
|
+ </van-row>
|
|
|
+ </van-checkbox-group>
|
|
|
+ </template>
|
|
|
+ </van-field>
|
|
|
+ <!-- 提示信息 -->
|
|
|
+ <div v-if="valueDate || value==='日保养'" class="describe">下次维护日期为 <span class="fontColor">{{periodMonthDate}}</span></div>
|
|
|
+ <!-- 维护项目 -->
|
|
|
+ <van-field
|
|
|
+ v-model="maintenanceTextarea"
|
|
|
+ label-width='90'
|
|
|
+ label="维护项目"
|
|
|
+ type="textarea"
|
|
|
+ rows="1"
|
|
|
+ autosize
|
|
|
+ placeholder="请输入内容"
|
|
|
+ />
|
|
|
+ </van-cell-group>
|
|
|
+ </van-dialog>
|
|
|
+ <!-- 下半部分 -->
|
|
|
+ <!-- 维护周期的选择 -->
|
|
|
+ <van-popup v-model="showPicker" position="bottom">
|
|
|
+ <van-picker
|
|
|
+ show-toolbar
|
|
|
+ :columns="columns"
|
|
|
+ @confirm="onConfirm"
|
|
|
+ @cancel="showPicker = false"
|
|
|
+ />
|
|
|
+</van-popup>
|
|
|
+ <!-- 日期的选择(月,季度,半年,年) -->
|
|
|
+<van-popup v-model="showDatePicker" position="bottom">
|
|
|
+ <van-picker
|
|
|
+ show-toolbar
|
|
|
+ :columns="columnsDate"
|
|
|
+ @confirm="onConfirmDate"
|
|
|
+ @cancel="showDatePicker = false"
|
|
|
+ />
|
|
|
+</van-popup>
|
|
|
+</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
export default {
|
|
|
@@ -185,11 +103,11 @@ export default {
|
|
|
},
|
|
|
width: {
|
|
|
type: String,
|
|
|
- default: '80%'
|
|
|
+ default: '90%'
|
|
|
},
|
|
|
top: {
|
|
|
type: String,
|
|
|
- default: '10%'
|
|
|
+ default: '40%'
|
|
|
},
|
|
|
editFromType: {
|
|
|
type: String,
|
|
|
@@ -207,9 +125,10 @@ export default {
|
|
|
const lunarGeneration = (sum) => {
|
|
|
const arr = []
|
|
|
for (let i = 1; i < sum; i++) {
|
|
|
- const mid = { value: '', label: '' }
|
|
|
- mid.value = '第' + i + '日'
|
|
|
- mid.label = '第' + i + '日'
|
|
|
+ // const mid = { value: '', label: '' }
|
|
|
+ // mid.value = '第' + i + '日'
|
|
|
+ // mid.label = '第' + i + '日'
|
|
|
+ const mid = '第' + i + '日'
|
|
|
arr.push(mid)
|
|
|
}
|
|
|
return arr
|
|
|
@@ -217,103 +136,47 @@ export default {
|
|
|
const monthLunarGeneration = (sum) => {
|
|
|
const arr = []
|
|
|
for (let i = 1; i < sum; i++) {
|
|
|
- const mid = { value: '', label: '' }
|
|
|
- mid.value = '第' + i + '个月'
|
|
|
- mid.label = '第' + i + '个月'
|
|
|
+ // const mid = { value: '', label: '' }
|
|
|
+ // mid.value = '第' + i + '个月'
|
|
|
+ // mid.label = '第' + i + '个月'
|
|
|
+ const mid = '第' + i + '个月'
|
|
|
arr.push(mid)
|
|
|
}
|
|
|
return arr
|
|
|
}
|
|
|
- const formatCurrentDate = () => {
|
|
|
- const today = new Date()
|
|
|
- const year = today.getFullYear()
|
|
|
- const month = (today.getMonth() + 1).toString().padStart(2, '0')
|
|
|
- const day = today.getDate().toString().padStart(2, '0')
|
|
|
- return `${year}-${month}-${day}`
|
|
|
- }
|
|
|
return {
|
|
|
- qrCode: '',
|
|
|
+ maintenanceTextarea: '',
|
|
|
+ dayweekDate: false,
|
|
|
+ showDatePicker: false,
|
|
|
+ dateName: '',
|
|
|
+ dateLable: '',
|
|
|
+ placeholder: '',
|
|
|
+ checkboxGroup: [],
|
|
|
+ columnsDate: null,
|
|
|
+ dateType: false,
|
|
|
dialogVisible: this.visible,
|
|
|
- cycleOptions: [{
|
|
|
- value: '按需保养',
|
|
|
- label: '按需保养'
|
|
|
- }, {
|
|
|
- value: '日保养',
|
|
|
- label: '日保养'
|
|
|
- }, {
|
|
|
- value: '月保养',
|
|
|
- label: '月保养'
|
|
|
- }, {
|
|
|
- value: '周保养',
|
|
|
- label: '周保养'
|
|
|
- }, {
|
|
|
- value: '季度保养',
|
|
|
- label: '季度保养'
|
|
|
- }, {
|
|
|
- value: '半年保养',
|
|
|
- label: '半年保养'
|
|
|
- }, {
|
|
|
- value: '年保养',
|
|
|
- label: '年保养'
|
|
|
- }],
|
|
|
- cycleValue: '',
|
|
|
- qmonthDateOptions: monthLunarGeneration(4),
|
|
|
- ymonthDateOptions: monthLunarGeneration(13),
|
|
|
- mymonthDateOptions: monthLunarGeneration(7),
|
|
|
- monthDateOptions: lunarGeneration(29),
|
|
|
- monthDateValue: '',
|
|
|
+ value: '',
|
|
|
+ valueDate: '',
|
|
|
+ qmonthDateOptions: monthLunarGeneration(4), // 季度保养
|
|
|
+ ymonthDateOptions: monthLunarGeneration(13), // 年保养
|
|
|
+ mymonthDateOptions: monthLunarGeneration(7), // 半年保养
|
|
|
+ monthDateOptions: lunarGeneration(29), // 月保养
|
|
|
+ columns: ['按需保养', '日保养', '月保养', '周保养', '季度保养', '半年保养', '年保养'],
|
|
|
weekList: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
|
|
quarterList: [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]],
|
|
|
midList: [[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12]],
|
|
|
dayCheckList: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
|
|
- maintenanceTextarea: '',
|
|
|
- toolbars: [
|
|
|
- { key: 'confirm', label: '确定' },
|
|
|
- { key: 'cancel' }
|
|
|
- ],
|
|
|
- toolbarsConsult: [{ key: 'cancel' }],
|
|
|
- weekDateValue: '',
|
|
|
+ showPicker: false,
|
|
|
+ monthDateValue: '',
|
|
|
quarterDateValue: '',
|
|
|
midyearDateValue: '',
|
|
|
yearDateValue: '',
|
|
|
- periodDayDate: '',
|
|
|
- periodWeekDate: '',
|
|
|
periodMonthDate: '',
|
|
|
- periodQuarterDate: '',
|
|
|
- periodMidYearDate: '',
|
|
|
- periodYearDate: '',
|
|
|
- nowData: formatCurrentDate(),
|
|
|
- judgeShow: 0,
|
|
|
+ weekDateValue: '',
|
|
|
daysOfWeek: [7, 1, 2, 3, 4, 5, 6]
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
- visible: {
|
|
|
- handler: function(val, oldVal) {
|
|
|
- this.dialogVisible = this.visible
|
|
|
- },
|
|
|
- immediate: true
|
|
|
- },
|
|
|
- cycleValue: {
|
|
|
- handler: function(val, oldVal) {
|
|
|
- if (val === '日保养') {
|
|
|
- this.judgeShow = 1
|
|
|
- } else if (val === '月保养') {
|
|
|
- this.judgeShow = 2
|
|
|
- } else if (val === '周保养') {
|
|
|
- this.judgeShow = 3
|
|
|
- } else if (val === '季度保养') {
|
|
|
- this.judgeShow = 4
|
|
|
- } else if (val === '半年保养') {
|
|
|
- this.judgeShow = 5
|
|
|
- } else if (val === '年保养') {
|
|
|
- this.judgeShow = 6
|
|
|
- } else {
|
|
|
- this.judgeShow = 0
|
|
|
- }
|
|
|
- },
|
|
|
- immediate: true
|
|
|
- },
|
|
|
dayCheckList: {
|
|
|
handler: function(val, oldVal) {
|
|
|
const today = new Date()
|
|
|
@@ -328,14 +191,15 @@ export default {
|
|
|
})
|
|
|
const num = weekNum.findIndex(e => e > dayOfWeekNumber)
|
|
|
if (val.length > 0 && num !== -1) {
|
|
|
- this.periodDayDate = this.getDayDate(weekNum[num], 0)
|
|
|
+ this.periodMonthDate = this.getDayDate(weekNum[num], 0)
|
|
|
} else if (val.length > 0 && num === -1) {
|
|
|
- this.periodDayDate = this.getDayDate(weekNum[0], 1)
|
|
|
+ this.periodMonthDate = this.getDayDate(weekNum[0], 1)
|
|
|
} else {
|
|
|
- this.periodDayDate = ''
|
|
|
+ this.periodMonthDate = ''
|
|
|
}
|
|
|
},
|
|
|
immediate: true
|
|
|
+
|
|
|
},
|
|
|
weekDateValue: {
|
|
|
handler: function(val, oldVal) {
|
|
|
@@ -346,14 +210,13 @@ export default {
|
|
|
weekNum.push(num1)
|
|
|
const num = weekNum.findIndex(e => e > dayOfWeekNumber)
|
|
|
if (val !== '' && num !== -1) {
|
|
|
- this.periodWeekDate = this.getDayDate(weekNum[0], 0)
|
|
|
+ this.periodMonthDate = this.getDayDate(weekNum[0], 0)
|
|
|
} else if (val !== '' && num === -1) {
|
|
|
- this.periodWeekDate = this.getDayDate(weekNum[0], 1)
|
|
|
+ this.periodMonthDate = this.getDayDate(weekNum[0], 1)
|
|
|
} else {
|
|
|
- this.periodWeekDate = ''
|
|
|
+ this.periodMonthDate = ''
|
|
|
}
|
|
|
- },
|
|
|
- immediate: true
|
|
|
+ }
|
|
|
},
|
|
|
monthDateValue: {
|
|
|
handler: function(val, oldVal) {
|
|
|
@@ -364,7 +227,6 @@ export default {
|
|
|
const currentMonth = this.getNextMonthDate(today, turnVal, 0)
|
|
|
this.periodMonthDate = turnVal > day ? currentMonth : nextMonth
|
|
|
}
|
|
|
- // immediate: true
|
|
|
},
|
|
|
quarterDateValue: {
|
|
|
handler: function(val, oldVal) {
|
|
|
@@ -373,13 +235,13 @@ export default {
|
|
|
const month = today.getMonth() + 1
|
|
|
const qu = this.getQuarter(today)
|
|
|
const nowM = this.quarterList[qu - 1][turnVal - 1]
|
|
|
- const nextM = this.quarterList[qu][turnVal - 1]
|
|
|
+ const nextM = this.quarterList[qu % 4][turnVal - 1]
|
|
|
|
|
|
const endMonth = month >= nowM ? nextM : nowM
|
|
|
const yearPJ = today.getFullYear()
|
|
|
const monthPJ = endMonth > 9 ? endMonth : '0' + endMonth
|
|
|
-
|
|
|
- this.periodQuarterDate = yearPJ + '-' + monthPJ + '-01'
|
|
|
+ // this.periodQuarterDate = yearPJ + '-' + monthPJ + '-01'
|
|
|
+ this.periodMonthDate = yearPJ + '-' + monthPJ + '-01'
|
|
|
}
|
|
|
// immediate: true
|
|
|
},
|
|
|
@@ -390,13 +252,14 @@ export default {
|
|
|
const month = today.getMonth() + 1
|
|
|
const qu = month > 6 ? 2 : 1
|
|
|
const nowM = this.midList[qu - 1][turnVal - 1]
|
|
|
- const nextM = this.midList[qu][turnVal - 1]
|
|
|
+ const nextM = this.midList[qu % 2][turnVal - 1]
|
|
|
|
|
|
const endMonth = month >= nowM ? nextM : nowM
|
|
|
- const yearPJ = today.getFullYear()
|
|
|
+ const yearPJ = month >= nowM ? today.getFullYear() + 1 : today.getFullYear()
|
|
|
const monthPJ = endMonth > 9 ? endMonth : '0' + endMonth
|
|
|
|
|
|
- this.periodMidYearDate = yearPJ + '-' + monthPJ + '-01'
|
|
|
+ // this.periodMidYearDate = yearPJ + '-' + monthPJ + '-01'
|
|
|
+ this.periodMonthDate = yearPJ + '-' + monthPJ + '-01'
|
|
|
}
|
|
|
// immediate: true
|
|
|
},
|
|
|
@@ -408,8 +271,8 @@ export default {
|
|
|
const year = today.getFullYear()
|
|
|
const qu = month >= turnVal ? year + 1 : year
|
|
|
const monthPJ = turnVal > 9 ? turnVal : '0' + turnVal
|
|
|
-
|
|
|
- this.periodYearDate = qu + '-' + monthPJ + '-01'
|
|
|
+ // this.periodYearDate = qu + '-' + monthPJ + '-01'
|
|
|
+ this.periodMonthDate = qu + '-' + monthPJ + '-01'
|
|
|
}
|
|
|
// immediate: true
|
|
|
}
|
|
|
@@ -418,38 +281,114 @@ export default {
|
|
|
this.loadFormData()
|
|
|
},
|
|
|
methods: {
|
|
|
- handleActionEvent({ key }) {
|
|
|
- switch (key) {
|
|
|
- case 'confirm':
|
|
|
- this.handleConfirm(key)
|
|
|
+ handleActionEvent() {
|
|
|
+ if (this.dynamicParams.customComponent) {
|
|
|
+ this.handleConfirmV2()
|
|
|
+ } else {
|
|
|
+ this.handleConfirm()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onConfirm(value, index) {
|
|
|
+ this.valueDate = ''
|
|
|
+ this.checkboxGroup = []
|
|
|
+ switch (index) {
|
|
|
+ case 0:
|
|
|
+ this.dateType = false
|
|
|
+ this.dayweekDate = false
|
|
|
+ break
|
|
|
+ case 1:
|
|
|
+ this.dateType = false
|
|
|
+ this.dayweekDate = true
|
|
|
break
|
|
|
- case 'cancel':
|
|
|
- this.closeDialog()
|
|
|
+ case 2:
|
|
|
+ this.dayweekDate = false
|
|
|
+ this.dateType = true
|
|
|
+ this.dateName = 'picker'
|
|
|
+ this.dateLable = '月保养日期'
|
|
|
+ this.placeholder = '请选择月保养日期'
|
|
|
+ this.columnsDate = this.monthDateOptions
|
|
|
+ break
|
|
|
+ case 3:
|
|
|
+ this.dayweekDate = false
|
|
|
+ this.dateType = true
|
|
|
+ this.dateName = 'checkboxGroup'
|
|
|
+ this.dateLable = '周保养日期'
|
|
|
+ this.placeholder = '请选择周保养日期'
|
|
|
+ this.columnsDate = this.weekList
|
|
|
+ this.dayweekDate = false
|
|
|
+
|
|
|
break
|
|
|
- default:
|
|
|
+ case 4:
|
|
|
+ this.dayweekDate = false
|
|
|
+ this.dateType = true
|
|
|
+ this.dateName = 'picker'
|
|
|
+ this.dateLable = '季度保养日期'
|
|
|
+ this.placeholder = '请选择季度保养日期'
|
|
|
+ this.columnsDate = this.qmonthDateOptions
|
|
|
+ this.dayweekDate = false
|
|
|
break
|
|
|
+ case 5:
|
|
|
+ this.dayweekDate = false
|
|
|
+ this.dateType = true
|
|
|
+ this.dateName = 'picker'
|
|
|
+ this.dateLable = '半年保养日期'
|
|
|
+ this.placeholder = '请选择半年保养日期'
|
|
|
+ this.columnsDate = this.mymonthDateOptions
|
|
|
+ this.dayweekDate = false
|
|
|
+ break
|
|
|
+ case 6:
|
|
|
+ this.dayweekDate = false
|
|
|
+ this.dateType = true
|
|
|
+ this.dateName = 'picker'
|
|
|
+ this.dateLable = '年保养日期'
|
|
|
+ this.placeholder = '请选择年保养日期'
|
|
|
+ this.columnsDate = this.ymonthDateOptions
|
|
|
+ this.dayweekDate = false
|
|
|
+ break
|
|
|
+ }
|
|
|
+ this.value = value
|
|
|
+ this.showPicker = false
|
|
|
+ },
|
|
|
+ onConfirmDate(value, index) {
|
|
|
+ this.valueDate = value
|
|
|
+ this.showDatePicker = false
|
|
|
+ this.corresponding(this.value)
|
|
|
+ },
|
|
|
+ // 自定义组件
|
|
|
+ handleConfirmV2(key) {
|
|
|
+ const val = this.corresponding(this.value)
|
|
|
+ const valNum = this.correspondingNum(this.value)
|
|
|
+ if (this.value !== '按需保养' && this.value !== '' && val !== '' && valNum !== '' && this.maintenanceTextarea !== '') {
|
|
|
+ this.$emit('submit', { weiHuLeiXing: this.value, weiHuRiQi: val, riQiShuZi: valNum, weiHuXiangMuC: this.maintenanceTextarea, index: this.dynamicParams?.index })
|
|
|
+ this.closeDialog()
|
|
|
+ } else if (this.value === '按需保养' && this.value !== '' && this.maintenanceTextarea !== '') {
|
|
|
+ this.$emit('submit', { weiHuLeiXing: this.value, weiHuXiangMuC: this.maintenanceTextarea, index: this.dynamicParams?.index })
|
|
|
+ this.closeDialog()
|
|
|
+ } else {
|
|
|
+ // this.$message.warning('请保证所有信息都已填写')
|
|
|
+ alert('信息填写不完整')
|
|
|
}
|
|
|
},
|
|
|
handleConfirm(key) {
|
|
|
const a = this.dynamicParams.formObj.getData(this.templateKey)
|
|
|
- const val = this.corresponding(this.cycleValue)
|
|
|
- const valNum = this.correspondingNum(this.cycleValue)
|
|
|
- if (this.cycleValue !== '按需保养' && this.cycleValue !== '' && val !== '' && valNum !== '' && this.maintenanceTextarea !== '') {
|
|
|
+ const val = this.corresponding(this.value)
|
|
|
+ const valNum = this.correspondingNum(this.value)
|
|
|
+ if (this.value !== '按需保养' && this.value !== '' && val !== '' && valNum !== '' && this.maintenanceTextarea !== '') {
|
|
|
if (this.dynamicParams.position === 'manage') {
|
|
|
- this.$set(a, this.dynamicParams.params.index, { ...a[this.dynamicParams.params.index], weiHuLeiXing: this.cycleValue, weiHuRiQi: val, riQiShuZi: valNum, weiHuXiangMuC: this.maintenanceTextarea })
|
|
|
+ this.$set(a, this.dynamicParams.params.index, { ...a[this.dynamicParams.params.index], weiHuLeiXing: this.value, weiHuRiQi: val, riQiShuZi: valNum, weiHuXiangMuC: this.maintenanceTextarea })
|
|
|
} else {
|
|
|
- a.push({ weiHuLeiXing: this.cycleValue, weiHuRiQi: val, riQiShuZi: valNum, weiHuXiangMuC: this.maintenanceTextarea })
|
|
|
+ a.push({ weiHuLeiXing: this.value, weiHuRiQi: val, riQiShuZi: valNum, weiHuXiangMuC: this.maintenanceTextarea })
|
|
|
}
|
|
|
// this.$nextTick(function(){
|
|
|
this.dynamicParams.formObj.setData(this.templateKey, a)
|
|
|
// })
|
|
|
|
|
|
this.closeDialog()
|
|
|
- } else if (this.cycleValue === '按需保养' && this.cycleValue !== '' && this.maintenanceTextarea !== '') {
|
|
|
+ } else if (this.value === '按需保养' && this.value !== '' && this.maintenanceTextarea !== '') {
|
|
|
if (this.dynamicParams.position === 'manage') {
|
|
|
- this.$set(a, this.dynamicParams.params.index, { weiHuLeiXing: this.cycleValue, weiHuXiangMuC: this.maintenanceTextarea })
|
|
|
+ this.$set(a, this.dynamicParams.params.index, { weiHuLeiXing: this.value, weiHuXiangMuC: this.maintenanceTextarea })
|
|
|
} else {
|
|
|
- a.push({ weiHuLeiXing: this.cycleValue, weiHuXiangMuC: this.maintenanceTextarea })
|
|
|
+ a.push({ weiHuLeiXing: this.value, weiHuXiangMuC: this.maintenanceTextarea })
|
|
|
}
|
|
|
// this.$nextTick(function(){
|
|
|
this.dynamicParams.formObj.setData(this.templateKey, a)
|
|
|
@@ -457,7 +396,26 @@ export default {
|
|
|
|
|
|
this.closeDialog()
|
|
|
} else {
|
|
|
- this.dynamicParams.formObj.$message.warning('请保证所有信息都已填写')
|
|
|
+ // this.dynamicParams.formObj.$message.warning('请保证所有信息都已填写')
|
|
|
+ alert('信息填写不完整')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 关闭当前窗口
|
|
|
+ closeDialog() {
|
|
|
+ this.$emit('close', false)
|
|
|
+ },
|
|
|
+ loadFormData() {
|
|
|
+ if (this.dynamicParams.position === 'manage') {
|
|
|
+ const a = this.dynamicParams.formObj.getData(this.templateKey)[this.dynamicParams.params.index]
|
|
|
+ this.assignment(a)
|
|
|
+ this.value = a.weiHuLeiXing
|
|
|
+ this.maintenanceTextarea = a.weiHuXiangMuC
|
|
|
+ }
|
|
|
+ if (this.dynamicParams.customComponent && this.dynamicParams.row) {
|
|
|
+ const a = this.dynamicParams.row
|
|
|
+ this.assignment(a)
|
|
|
+ this.value = a.weiHuLeiXing
|
|
|
+ this.maintenanceTextarea = a.weiHuXiangMuC
|
|
|
}
|
|
|
},
|
|
|
corresponding(content) {
|
|
|
@@ -481,15 +439,20 @@ export default {
|
|
|
})
|
|
|
return str === '每周1,2,3,4,5,6,7' ? '每天' : str
|
|
|
} else if (content === '月保养') {
|
|
|
+ that.monthDateValue = that.valueDate
|
|
|
return '每月' + that.monthDateValue
|
|
|
} else if (content === '周保养') {
|
|
|
+ that.weekDateValue = that.valueDate
|
|
|
const ind = that.weekList.findIndex(item => item === that.weekDateValue) !== -1 ? that.weekList.findIndex(item => item === that.weekDateValue) + 1 : ''
|
|
|
return '每周' + ind
|
|
|
} else if (content === '季度保养') {
|
|
|
+ that.quarterDateValue = that.valueDate
|
|
|
return '每季度' + that.quarterDateValue
|
|
|
} else if (content === '半年保养') {
|
|
|
+ that.midyearDateValue = that.valueDate
|
|
|
return '每半年' + that.midyearDateValue
|
|
|
} else if (content === '年保养') {
|
|
|
+ that.yearDateValue = that.valueDate
|
|
|
return '每年' + that.yearDateValue
|
|
|
} else {
|
|
|
return ''
|
|
|
@@ -516,18 +479,23 @@ export default {
|
|
|
})
|
|
|
return str
|
|
|
} else if (content === '月保养') {
|
|
|
+ that.monthDateValue = that.valueDate
|
|
|
const turnVal = that.monthDateValue.replace(/[^0-9]/ig, '')
|
|
|
return turnVal
|
|
|
} else if (content === '周保养') {
|
|
|
+ that.weekDateValue = that.valueDate
|
|
|
const ind = that.weekList.findIndex(item => item === that.weekDateValue) !== -1 ? that.weekList.findIndex(item => item === that.weekDateValue) + 1 : ''
|
|
|
return ind
|
|
|
} else if (content === '季度保养') {
|
|
|
+ that.quarterDateValue = that.valueDate
|
|
|
const turnVal = that.quarterDateValue.replace(/[^0-9]/ig, '')
|
|
|
return turnVal
|
|
|
} else if (content === '半年保养') {
|
|
|
+ that.midyearDateValue = that.valueDate
|
|
|
const turnVal = that.midyearDateValue.replace(/[^0-9]/ig, '')
|
|
|
return turnVal
|
|
|
} else if (content === '年保养') {
|
|
|
+ that.yearDateValue = that.valueDate
|
|
|
const turnVal = that.yearDateValue.replace(/[^0-9]/ig, '')
|
|
|
return turnVal
|
|
|
} else {
|
|
|
@@ -560,22 +528,11 @@ export default {
|
|
|
} else if (content.weiHuLeiXing === '年保养') {
|
|
|
that.yearDateValue = content.weiHuRiQi.slice(2)
|
|
|
} else {
|
|
|
- // 本人加的
|
|
|
- return
|
|
|
- }
|
|
|
- },
|
|
|
- // 关闭当前窗口
|
|
|
- closeDialog() {
|
|
|
- this.$emit('close', false)
|
|
|
- },
|
|
|
- loadFormData() {
|
|
|
- if (this.dynamicParams.position === 'manage') {
|
|
|
- const a = this.dynamicParams.formObj.getData(this.templateKey)[this.dynamicParams.params.index]
|
|
|
- this.assignment(a)
|
|
|
- this.cycleValue = a.weiHuLeiXing
|
|
|
- this.maintenanceTextarea = a.weiHuXiangMuC
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
+ // 获取年月日
|
|
|
getDayDate(type, dates) {
|
|
|
const now = new Date()
|
|
|
const nowTime = now.getTime()
|
|
|
@@ -609,9 +566,20 @@ export default {
|
|
|
getQuarter(date) {
|
|
|
return Math.floor(date.getMonth() / 3) + 1
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
<style scoped lang="scss">
|
|
|
+.dialog-box{
|
|
|
+ .describe{
|
|
|
+ width: 100%;
|
|
|
+ margin: 5px 0 5px 30%;
|
|
|
+ font-size: 12px;
|
|
|
+ .fontColor{
|
|
|
+ color: #1E90FF;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|
|
|
+
|