From cf9d04b97ef0b8abb63e587e0898e301765ed4b9 Mon Sep 17 00:00:00 2001
From: cuilei <ray_tsu1@163.com>
Date: 星期一, 18 八月 2025 17:07:30 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
src/views/mdc/base/modules/deviceCalendar/DeviceCalendarModel.vue | 448 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 448 insertions(+), 0 deletions(-)
diff --git a/src/views/mdc/base/modules/deviceCalendar/DeviceCalendarModel.vue b/src/views/mdc/base/modules/deviceCalendar/DeviceCalendarModel.vue
new file mode 100644
index 0000000..477b7cb
--- /dev/null
+++ b/src/views/mdc/base/modules/deviceCalendar/DeviceCalendarModel.vue
@@ -0,0 +1,448 @@
+<template>
+ <div ref="device">
+ <a-modal :title="title" :width="900" :visible="visible" :confirmLoading="confirmLoading"
+ :getContainer="() => this.$refs.device"
+ :okButtonProps="{ props: {disabled: disableSubmit} }" @ok="handleOk" @cancel="handleCancel"
+ cancelText="鍏抽棴">
+ <a-spin :spinning="confirmLoading">
+ <a-form :form="form">
+ <a-row :gutter="24">
+ <a-col :span="24">
+ <a-form-item label="璁惧缁�" :labelCol="labelColLong" :wrapperCol="wrapperColLong">
+ <a-input-search :readOnly="true" v-decorator="['equipmentId', validatorRules.equipmentId]"
+ @search="deviceSearch" enter-button placeholder="璇烽�夋嫨璁惧"/>
+ </a-form-item>
+ </a-col>
+ </a-row>
+ <a-row :gutter="24">
+ <a-col :span="24">
+ <a-form-item label="鐝埗" :labelCol="labelColLong" :wrapperCol="wrapperColLong">
+ <a-select v-decorator="['shiftId', validatorRules.shiftId]" placeholder="璇烽�夋嫨鐝埗"
+ :allowClear='allowClear' @change="initShiftSubList">
+ <a-select-option v-for="(em,index) in shiftList" :key="index" :value="em.value">
+ {{ em.label }}
+ </a-select-option>
+ </a-select>
+ </a-form-item>
+ </a-col>
+ </a-row>
+
+ <a-row :gutter="24">
+ <a-col :span="24">
+ <a-form-item label="鐢熸晥鏃堕棿" :labelCol="labelColLong" :wrapperCol="wrapperColLong">
+ <div class="mainBox">
+ <Calendar
+ v-on:choseDay="clickDay"
+ v-on:changeMonth="changeDate"
+ v-on:isToday="clickToday"
+ :markDate='shiData'
+ :agoDayHide='value'
+ ></Calendar>
+ </div>
+
+ </a-form-item>
+ </a-col>
+ </a-row>
+ </a-form>
+ </a-spin>
+ <device-calender-list-model ref="deviceCalenderListModel"
+ @sendSelectionRows="getDeviceRows"></device-calender-list-model>
+ <select-device-drawer ref="selectDeviceDrawer" @selectFinished="selectOK" :title="'閫夋嫨璁惧'"/>
+ </a-modal>
+ </div>
+</template>
+
+<script>
+ import DeviceCalendarListModel from './DeviceCalendarListModel'
+ import moment from 'moment'
+ import pick from 'lodash.pick'
+ import {
+ getAction,
+ postAction,
+ requestPut
+ } from '@/api/manage'
+
+ import Calendar from 'vue-calendar-component'
+ import SelectDeviceDrawer from '../../../../system/modules/SelectDeviceDrawer'
+
+ export default {
+ name: 'ShiftInfoModel',
+ components: { SelectDeviceDrawer, DeviceCalendarListModel, Calendar },
+ props: {},
+ data() {
+ return {
+ value: '',
+ date: '',
+ week: '',
+ selectDate: [],
+ // 褰撳墠鏃ユ湡
+ allowClear: true,
+ title: '',
+ isDaySpan: false,
+ visible: false,
+ show: false,
+ model: {},
+ checked: false,
+ labelColLong: {
+ xs: {
+ span: 24
+ },
+ sm: {
+ span: 3
+ }
+ },
+ wrapperColLong: {
+ xs: {
+ span: 24
+ },
+ sm: {
+ span: 21
+ }
+ },
+ labelCol: {
+ xs: {
+ span: 24
+ },
+ sm: {
+ span: 6
+ }
+ },
+ wrapperCol: {
+ xs: {
+ span: 24
+ },
+ sm: {
+ span: 18
+ }
+ },
+ confirmLoading: false,
+ form: this.$form.createForm(this),
+ validatorRules: {
+ equipmentId: {
+ rules: [
+ {
+ required: true, message: '璇烽�夋嫨璁惧缁�!'
+ }
+ ]
+ },
+ shiftId: {
+ rules: [{
+ required: true, message: '璇烽�夋嫨鐝埗!'
+ }]
+ }
+ },
+ url: {
+ add: '/mdc/mdcDeviceCalendar/add',
+ edit: '/mdc/mdcshiftsub/edit',
+ initShiftList: '/mdc/mdcMdcShift/initShiftList',
+ initShiftSubList: '/mdc/mdcshiftsub/initShiftSubList',
+ getShiftSubById: '/mdc/mdcshiftsub/getShiftSubById',
+ settingCalendar: '/mdc/mdcDeviceCalendar/add'
+ },
+ shiftList: [],
+ shiftSubList: [],
+ disableSubmit: true,
+ calData: undefined,
+ shiData: [],
+ sendDte: []
+ }
+ },
+ created() {
+ this.value = Math.round(new Date().getTime() / 1000).toString()
+ var now = new Date()
+ this.date = now.getDate()//寰楀埌鏃ユ湡
+ var day = now.getDay()//寰楀埌鍛ㄥ嚑
+ var arr_week = new Array('鏄熸湡鏃�', '鏄熸湡涓�', '鏄熸湡浜�', '鏄熸湡涓�', '鏄熸湡鍥�', '鏄熸湡浜�', '鏄熸湡鍏�')
+ this.week = arr_week[day]
+ this.getWorking()
+ },
+
+ methods: {
+ getWorking() {//鑾峰彇褰撳墠鏈堝伐浣滄棩
+ let myDate = new Date()
+ let tY = myDate.getFullYear()//寰楀埌褰撳墠骞�
+ let tM = myDate.getMonth()//寰楀埌褰撳墠鏈�+1
+ let tD = new Date(tY, tM + 1, 0)
+ let tT = tD.getDate()//寰楀埌褰撳墠鏈堢殑澶╂暟
+
+ for (var i = 1; i <= tT; i++) {
+ let week = new Date(tY, tM, i).getDay()
+ if (week >= 1 && week <= 5) {
+ let dd = tY + '/' + (tM + 1) + '/' + i
+ let temp = { className: 'mark1', date: dd }
+ this.selectDate.push(temp)
+ }
+ }
+//console.log(JSON.stringify(this.selectDate))
+ },
+ resetSelect() {//閲嶇疆閫変腑鐨勬棩鏈�
+ this.selectDate = []
+ this.shiData = []
+ this.sendDte = []
+ },
+ fun(obj) {
+ console.log(obj)
+ if (obj) {
+ if (obj = obj.split('/')) {
+ var timShi = obj[1]
+ var timFen = obj[2]
+ if (timShi < 10) {
+ timShi = '0' + timShi
+ }
+ if (timFen < 10) {
+ timFen = '0' + timFen
+ }
+ var dd = (obj[0] + timShi + timFen)
+ return dd
+ }
+ }
+ },
+ clickDay(today) {//閫変腑鏃ユ湡
+ let existDate = this.selectDate
+ let isExist = true
+ for (var i = 0; i < existDate.length; i++) {
+ if (existDate[i].date === today) {
+ this.selectDate.splice(i, 1)
+ this.shiData.splice(i, 1)
+ this.sendDte.splice(i, 1)
+ isExist = false
+ }
+ }
+ if (isExist) {//褰撳墠鏃ユ湡瀛樺湪绉婚櫎
+ let tempDate = { date: today, className: 'mark1' }
+ // let ddd = this.fun(today)
+ let ddd = today
+ let ccc = this.fun(today)
+ this.selectDate.push(tempDate)
+ this.shiData.push(ddd)
+ this.sendDte.push(ccc)
+ }
+ },
+ onSelect(value) {
+ console.log(value)
+ let arr = []
+ arr.push(value)
+ this.value = arr
+ // this.value = value;
+ // this.selectedValue = value;
+ },
+ onPanelChange(value) {
+ this.value = value
+ },
+ deviceSearch() {
+ this.$refs.selectDeviceDrawer.visible = true
+ this.$refs.selectDeviceDrawer.selectedRowKeys = []
+ this.$refs.selectDeviceDrawer.selectedRows = []
+ this.$refs.selectDeviceDrawer.checkedKeys = this.form.getFieldValue('equipmentId') ? this.form.getFieldValue('equipmentId').split(',') : []
+ },
+ getDeviceRows(val) {
+ console.log('========', val)
+ var equipmentIds = ''
+ for (var i = 0; i < val.length; i++) {
+ //equipmentIds = equipmentIds + "," + val[i].equipmentId;
+ if (i == 0) {
+ equipmentIds = val[i].equipmentId
+ } else {
+ equipmentIds = equipmentIds + ',' + val[i].equipmentId
+ }
+ }
+ this.form.setFieldsValue({
+ equipmentId: equipmentIds
+ })
+ },
+ disabledDate(current) {
+ //Can not slect days before today and today
+ return current && current < moment().subtract('days', 1)
+ },
+ disabledDateEnd(currentend) {
+ //Can not slect days before today and today
+ return currentend && currentend < moment().subtract('days', 0)
+ },
+ initShiftList() {
+ getAction(this.url.initShiftList).then((res) => {
+ if (res.success) {
+ this.shiftList = res.result
+ }
+ })
+ },
+ add(record) {
+ this.resetSelect()
+ let _this = this
+ this.visible = true
+ this.form.resetFields()
+ this.model = Object.assign({}, record)
+ this.initShiftList()
+ this.$nextTick(() => {
+ this.form.setFieldsValue(pick(this.model))
+ this.form.setFieldsValue({
+ // takeEffectDate: moment(),
+ // invalidDate: moment().endOf('month')
+ })
+ })
+ },
+ close() {
+ this.$emit('close')
+ this.visible = false
+ this.show = false
+ },
+ handleOk() {
+ const that = this
+ // 瑙﹀彂琛ㄥ崟楠岃瘉
+ this.form.validateFields((err, values) => {
+ if (!err) {
+ that.confirmLoading = true
+ let formData = Object.assign(this.model, values)
+ formData.dateList = this.sendDte
+ if (formData.dateList && formData.dateList.length > 0) {
+ postAction(this.url.settingCalendar, formData).then((res) => {
+ if (res.success) {
+ // that.$message.success(res.message)
+ that.$notification.success({
+ message: '娑堟伅',
+ description: res.message
+ })
+ that.$emit('ok', res.result)
+ } else {
+ // that.$message.warning(res.message)
+ that.$notification.warning({
+ message: '娑堟伅',
+ description: res.message
+ })
+ }
+ }).finally(() => {
+ that.confirmLoading = false
+ that.close()
+ })
+ } else {
+ that.confirmLoading = false
+ that.$notification.warning({
+ message: '娑堟伅',
+ description: '璇烽�夋嫨鐢熸晥鏃堕棿!'
+ })
+ }
+ }
+ })
+ },
+ handleCancel() {
+ this.close()
+ },
+
+ /**
+ * 閫夋嫨宸叉湁璁惧鍚庣偣鍑荤‘瀹氭椂瑙﹀彂
+ * @param data 宸查�夋嫨鐨勮澶�
+ */
+ selectOK(data) {
+ this.form.setFieldsValue({
+ equipmentId: data.join(',')
+ })
+ }
+ }
+ }
+</script>
+
+<style scoped lang="less">
+
+ /deep/ .ant-modal-close {
+ color: #1191b0;
+ font-size: 24px;
+ }
+
+ /deep/ .ant-modal-close-x {
+ font-size: 24px;
+ }
+
+ .ant-btn {
+ padding: 0 10px;
+ margin-left: 3px;
+ }
+
+ .ant-form-item-control {
+ line-height: 0px;
+ }
+
+ /** 涓昏〃鍗曡闂磋窛 */
+ .ant-form .ant-form-item {
+ margin-bottom: 10px;
+ }
+
+ /** Tab椤甸潰琛岄棿璺� */
+ .ant-tabs-content .ant-form-item {
+ margin-bottom: 0px;
+ }
+
+ /deep/ .mark1 {
+ color: white !important;
+ background-color: #1890ff !important;
+ border-radius: 50%;
+ }
+
+ /deep/ .mainBox .wh_content_all {
+ background-color: #ffffff;
+ border: 1px silver solid;
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+ }
+
+ /deep/ .mainBox .wh_content_all .wh_jiantou1 {
+ border-top: 2px solid #000000;
+ border-left: 2px solid #000000;
+ }
+
+ /deep/ .mainBox .wh_content_all .wh_jiantou2 {
+ border-top: 2px solid #000000;
+ border-right: 2px solid #000000;
+ }
+
+ /deep/ .mainBox .wh_content_all .wh_top_changge li {
+ color: black;
+ }
+
+ /deep/ .mainBox .wh_content_all .wh_content_item {
+ margin-top: 5px;
+ }
+
+ /deep/ .mainBox .wh_content_all .wh_content_item .wh_top_tag {
+ color: #000000;
+ }
+
+ /deep/ .mainBox .wh_content_all .wh_content_item .wh_item_date {
+ color: #000000;
+ }
+
+ /deep/ .mainBox .wh_content_all .wh_content_item .wh_item_date:hover {
+ color: #1890ff;
+ border: 1px solid #1890ff;
+ border-radius: 50%;
+ }
+
+ /deep/ .mainBox .wh_content_all .wh_content_item .wh_other_dayhide {
+ color: #bfbfbf !important;
+ }
+
+ /deep/ .mainBox .wh_content_all .wh_content_item .wh_want_dayhide {
+ color: #bfbfbf !important;
+ }
+
+ /deep/ .mainBox .wh_content_all .wh_content_item .wh_chose_day {
+ background: #ffffff;
+ color: #000000;
+ }
+
+ /deep/ .mainBox .wh_content_all .wh_content_item .wh_isMark {
+ color: #ffffff;
+ background-color: blue;
+ }
+
+ /deep/ .mainBox .wh_content_all .wh_content_item .wh_isToday {
+ background-color: #ffffff;
+ color: #000000;
+ }
+
+</style>
+
+
+
+
+
+
--
Gitblit v1.9.3