| | |
| | | <!-- |
| | | * @Date: 2024-05-04 16:37:48 |
| | | * @LastEditors: Sneed |
| | | * @LastEditTime: 2024-05-05 21:02:54 |
| | | * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/console/base/Add.vue |
| | | * @LastEditors: gaoshp |
| | | * @LastEditTime: 2024-10-01 20:03:40 |
| | | * @FilePath: /cps-web/src/views/console/base/Add.vue |
| | | --> |
| | | <template> |
| | | <el-container> |
| | |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="应用年份" prop="year"> |
| | | <el-select v-model="form.year" placeholder="" size="" @change="change"> |
| | | <el-select v-model="form.year" placeholder="" size="" @change="changeYear"> |
| | | <el-option v-for="item in options" :key="item.value" :label="item.label" |
| | | :value="item.value" /> |
| | | </el-select> |
| | |
| | | } |
| | | }, |
| | | watch: { |
| | | |
| | | holiday() { |
| | | this.setDay() |
| | | }, |
| | | checkboxGroup1() { |
| | | this.setDay() |
| | | }, |
| | | dateDTOList(val) { |
| | | this.months.forEach(month => { |
| | | if (val.length > 0) { |
| | | month.attributes[1].highlight = 'yellow' |
| | | } else { |
| | | month.attributes[1].highlight = true |
| | | } |
| | | |
| | | }) |
| | | }, |
| | | 'form.year'(val) { |
| | | this.months = [] |
| | | let currentYear = moment(val, 'YYYY').format('YYYY') - 0 |
| | | |
| | | this.form.date = [`${currentYear}-01-01`, `${currentYear}-12-31`] |
| | | if (currentYear == moment().format('YYYY')) { |
| | | this.form.date[0] = moment().format('YYYY-MM-DD') |
| | | } |
| | | // console.log(this.months) |
| | | this.$HTTP.post('/api/blade-cps/shift-off-day/list', { |
| | | year: currentYear, |
| | |
| | | year: currentYear, |
| | | month: i, |
| | | id: `${currentYear}${i}`, |
| | | min: new Date('2024-01-01'), |
| | | min: new Date(`${currentYear}-01-01`), |
| | | attributes: [ |
| | | { |
| | | dot: 'yellow', |
| | |
| | | let currentYear = moment(this.form.year, 'YYYY').format('YYYY') - 0 |
| | | this.months.forEach((item, i) => { |
| | | let start = moment(`${currentYear}-${i + 1}-01`) |
| | | let end = moment(`${currentYear}-${i + 2}-01`) |
| | | let end = i == 11 ? moment(`${currentYear + 1}-${i + 1}-01`) : moment(`${currentYear}-${i + 2}-01`) |
| | | let dates = [] |
| | | console.log(start.format('YYYY-MM-DD'), start.unix() >= moment(this.form.date[0]).unix() && start.unix() <= moment(this.form.date[1]).unix()) |
| | | while (start.unix() < end.unix()) { |
| | |
| | | start.add(1, 'd') |
| | | } |
| | | this.months[i].attributes[1].dates = dates |
| | | console.log(this.months, 'jieguo') |
| | | }) |
| | | }, |
| | | pushDate(start) { |
| | |
| | | console.log(index, item.attributes[1].dates) |
| | | }, |
| | | plan() { |
| | | if (!this.modelId) { |
| | | return this.$message.warning('请选择班次方案'); |
| | | } |
| | | let dateDTOList = this.months.map(item => item.attributes[1].dates) |
| | | console.log(this.months, '>>>>>>>>>>', dateDTOList.flat(2)) |
| | | let list = dateDTOList.flat(2).map(v => { |
| | | return { |
| | | modelId: this.modelId, |
| | |
| | | } |
| | | }, |
| | | planCancel() { |
| | | |
| | | this.dateDTOList = [] |
| | | }, |
| | | save() { |
| | | this.$refs.dialogForm.validate(async (valid) => { |