|
|
@@ -1,42 +1,81 @@
|
|
|
+let _Http = getApp().globalData.http;
|
|
|
Component({
|
|
|
- properties: {
|
|
|
-
|
|
|
- },
|
|
|
data: {
|
|
|
- tasks: [{
|
|
|
- id: 1,
|
|
|
- title: '参加扬州大学附属医院产品推介会',
|
|
|
- date: '2025-12-15'
|
|
|
- },
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- title: '跟台上海天伦医院手术3场',
|
|
|
- date: '2025-12-15'
|
|
|
- }
|
|
|
- ],
|
|
|
- records: [{
|
|
|
- id: 1,
|
|
|
- title: '参加扬州大学附属医院产品推介会',
|
|
|
- date: '2025-12-15'
|
|
|
- },
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- title: '跟台上海天伦医院手术3场',
|
|
|
- date: '2025-12-15'
|
|
|
+ tasks: [],
|
|
|
+ content: {
|
|
|
+ "year": '',
|
|
|
+ "month": '',
|
|
|
+ "day": '',
|
|
|
+ "taskUserid": wx.getStorageSync('userMsg').userid,
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
}
|
|
|
- ],
|
|
|
+ },
|
|
|
+ list: {}
|
|
|
},
|
|
|
methods: {
|
|
|
- handleCalendarLoad(e) {
|
|
|
- console.log("加载", e)
|
|
|
- // 1. 拿到今日日期 把年月记录到data中
|
|
|
- // 2. 获取当月数据给日期打标记
|
|
|
- // 3. 获取当日数据
|
|
|
- },
|
|
|
handleCalendarDateChange(e) {
|
|
|
- console.log("切换日期", e)
|
|
|
- // 1. 获取当日数据
|
|
|
- // 2. 判断选中日的年月是否与data中的相同;不相同获取当月数据打标记
|
|
|
- }
|
|
|
+ const {
|
|
|
+ year,
|
|
|
+ month,
|
|
|
+ day
|
|
|
+ } = e.detail.date,
|
|
|
+ key = `${year}-${month>10?month:'0'+month}-${day>10?day:'0'+day}`;
|
|
|
+ try {
|
|
|
+ const obj = this.data.list[key];
|
|
|
+ this.setData({
|
|
|
+ tasks: obj.task,
|
|
|
+ })
|
|
|
+ } catch (error) {
|
|
|
+ this.getList(year, month, day, key)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getList(year, month, day, key) {
|
|
|
+ let content = this.data.content;
|
|
|
+ if (year == content.year && month == content.month) return;
|
|
|
+ content.year = year;
|
|
|
+ content.month = month;
|
|
|
+ content.day = day;
|
|
|
+ _Http.basic({
|
|
|
+ "id": 2025122210193402,
|
|
|
+ content
|
|
|
+ }).then(res => {
|
|
|
+ console.log("任务列表", res)
|
|
|
+ if (res.code == 1) {
|
|
|
+ this.setData({
|
|
|
+ tasks: res.data[key].task,
|
|
|
+ list: Object.assign(this.data.list, res.data)
|
|
|
+ })
|
|
|
+ this.setMarkers()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ setMarkers() {
|
|
|
+ let list = this.data.list,
|
|
|
+ rw = [],
|
|
|
+ gj = [];
|
|
|
+ for (const key in list) {
|
|
|
+ const item = list[key];
|
|
|
+ const ymd = key.split("-");
|
|
|
+ item.year = ymd[0];
|
|
|
+ item.month = ymd[1];
|
|
|
+ item.day = ymd[2];
|
|
|
+ item.key = key;
|
|
|
+ if (item.task.length) rw.push({
|
|
|
+ ...item,
|
|
|
+ type: "schedule",
|
|
|
+ color: '#2a97ff',
|
|
|
+ bgColor: '#cce6ff'
|
|
|
+ })
|
|
|
+ // if (item.follow.length) gj.push(item)
|
|
|
+ }
|
|
|
+ this.selectComponent("#calendar").setMarkers(rw)
|
|
|
+ },
|
|
|
+ taskSelect(item) {
|
|
|
+ let data = item.currentTarget.dataset.data
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/prsx/calendar/task/detail?id=' + data.sys_taskid
|
|
|
+ })
|
|
|
+ },
|
|
|
}
|
|
|
})
|