|
@@ -32,18 +32,53 @@
|
|
|
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
|
|
<a-button type="primary" @click="getHjlist" icon="search">查询</a-button>
|
|
|
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">提交</a-button>
|
|
|
+ <a-button type="primary" @click="showCalendar" icon="reload" style="margin-left: 8px">测试</a-button>
|
|
|
</span>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
</a-form>
|
|
|
</div>
|
|
|
<gantt ref="gantt" class="left-container" :tasks="tasks" style="height:600px;"></gantt>
|
|
|
+ <!-- 日历弹窗 -->
|
|
|
+ <el-dialog title="设备日历" :visible.sync="showCalendarDialog" width="60%">
|
|
|
+ <el-calendar>
|
|
|
+ <template slot="dateCell" slot-scope="{date, data}">
|
|
|
+ <!-- <div> -->
|
|
|
+ <!-- 如果是当前选择月 -->
|
|
|
+ <template v-if="data.type === 'current-month'">
|
|
|
+ <!-- 这里加了周六周天的判断 -->
|
|
|
+ <div :class="(date.getDay()==6 || date.getDay()==0)?'weeked' :'notweeked'">{{data.day.substring(8,10)}}</div>
|
|
|
+ <!-- <div :class="(date.getDay()==6 || date.getDay()==0)?'weeked' :'notweeked'">{{data.day.split('-').slice(2).join('-')}}</div> -->
|
|
|
+ <!-- 方法二:在方法中判断设置返回 -->
|
|
|
+ <template v-if="dealMyDate(data.day)">
|
|
|
+ <template v-for="(item, index) in dealMyDate(data.day)">
|
|
|
+ <el-tag type="danger" :key="index" style="margin-right: 2px;" @click="chooseDevice(item)">
|
|
|
+ {{ item.deviceName }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ <!-- <el-tag type="danger" v-if="dealMyDate(data.day).length > 0">
|
|
|
+ {{ dealMyDate(data.day)[0].deviceName }}
|
|
|
+ </el-tag> -->
|
|
|
+ </template>
|
|
|
+ <!-- 不是 -->
|
|
|
+ <template v-else>
|
|
|
+ <div style="text-align: right;">{{ data.day.split('-').slice(1).join('-') }}</div>
|
|
|
+ </template>
|
|
|
+ <!-- </div> -->
|
|
|
+ </template>
|
|
|
+ </el-calendar>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="showCalendarDialog = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="showCalendarDialog = false">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import Gantt from '../../../components/Gantt.vue';
|
|
|
-import {getWeituoClientList, getWeituoInfoListByClient } from '@/api/api'
|
|
|
+import {getWeituoClientList, getWeituoInfoListByClient, getDeviceCalendar } from '@/api/api'
|
|
|
import { getAction } from '@api/manage'
|
|
|
import { gantt } from 'dhtmlx-gantt'
|
|
|
|
|
@@ -71,12 +106,16 @@ export default {
|
|
|
weituoClientOptions : [],
|
|
|
// 委托编号列表
|
|
|
weituoNoOptions:[],
|
|
|
+ // 日历弹窗
|
|
|
+ showCalendarDialog: false,
|
|
|
+ scheduleData: [],
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
this.getClientList();
|
|
|
// this.getHjlist();
|
|
|
this.$nextTick(() => { this.getHjlist() })
|
|
|
+ this.getDeviceCalendar()
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
@@ -117,6 +156,30 @@ export default {
|
|
|
},
|
|
|
searchReset(){
|
|
|
this.$refs.gantt.searchReset()
|
|
|
+ },
|
|
|
+ // 获取设备日历
|
|
|
+ getDeviceCalendar(){
|
|
|
+ getDeviceCalendar().then((res) =>{
|
|
|
+ this.scheduleData = res
|
|
|
+ })
|
|
|
+ },
|
|
|
+ showCalendar(){
|
|
|
+ this.showCalendarDialog = true
|
|
|
+ },
|
|
|
+ dealMyDate(v) {
|
|
|
+ let res = ''
|
|
|
+ for (let index = 0; index < this.scheduleData.length; index++) {
|
|
|
+ const element = this.scheduleData[index];
|
|
|
+ if(element.workDate === v){
|
|
|
+ res = this.scheduleData[index].deviceList
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(res)
|
|
|
+ return res
|
|
|
+ },
|
|
|
+ chooseDevice(item){
|
|
|
+ console.log(item)
|
|
|
}
|
|
|
}
|
|
|
}
|