| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- const _Http = getApp().globalData.http;
- Page({
- data: {
- list: [],
- filtrate: false,
- navList: [{
- label: "我负责的",
- icon: "icon-webxialaxuanxiangjiantou",
- color: "",
- width: "",
- id: "1"
- }, {
- label: "排序",
- icon: "icon-jiangxu1",
- color: "",
- width: "",
- id: "sort"
- }, {
- label: "筛选",
- icon: "icon-shaixuan",
- color: "",
- width: "",
- id: "2"
- }],
- content: {
- nocache: true,
- "pageNumber": 1,
- "pageSize": 20,
- "isExport": 0,
- "type": 1,
- "where": {
- "condition": "",
- "startdate": "",
- "enddate": ""
- },
- "sort": [],
- total: 0,
- },
- classShow: false, //type类型
- filtratelist: [{
- label: "任务状态",
- index: null,
- showName: "name", //显示字段
- valueKey: "status", //返回Key
- selectKey: "name", //传参 代表选着字段 不传参返回整个选择对象
- value: "", //选中值
- list: [{
- name: "待执行"
- }, {
- name: "进行中"
- }, {
- name: "已完成"
- }]
- }]
- },
- onLoad(options) {
- getApp().globalData.Language.getLanguagePackage(this, '任务')
- this.setData({
- classActions: wx.getStorageSync('templetList').map((v, i) => {
- return {
- name: v.templetname,
- index: v.templetid,
- color: i == 0 ? '#3874F6' : '',
- i: i,
- }
- }),
- 'navList[0].label': wx.getStorageSync('templetList')[0].templetname,
- "content.type": wx.getStorageSync('templetList')[0].templetid,
- });
- this.getList()
- },
- /* 导航点击功能 */
- navOnClick({
- detail
- }) {
- if (detail.label == '筛选') {
- this.setData({
- filtrate: true
- })
- } else if (detail.id == 1) {
- this.setData({
- classShow: true
- })
- }
- },
- /* 处理筛选 */
- handleFilter(e) {
- this.data.content.where.status = e.detail.status || "";
- this.getList(true)
- },
- /* 去添加 */
- toAdd() {
- wx.navigateTo({
- url: './add'
- })
- },
- getList(init = false) {
- _Http.init(this.data.content, init).then(content => {
- _Http.basic({
- "id": 20220901162901,
- content
- }).then(res => {
- console.log("任务列表", res)
- this.selectComponent('#ListBox').RefreshToComplete();
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- })
- this.setData({
- content: _Http.paging(content, res),
- list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
- })
- this.getTags();
- })
- })
- },
- /* 获取列表标签 */
- getTags() {
- let list = this.data.list,
- ownerids = list.map(v => v.sys_taskid)
- _Http.basic({
- "id": 20221018102001,
- "content": {
- "ownertable": "sys_task",
- ownerids
- }
- }).then(res => {
- for (let key in res.data) {
- let index = list.findIndex(v => v.sys_taskid == key);
- list[index].tags = res.data[key]
- };
- this.setData({
- list
- })
- })
- },
- /* 顶部条件导航回调 */
- navClick({
- detail
- }) {
- switch (detail.id) {
- case '1':
- this.setData({
- classShow: true
- })
- break;
- case '2':
- break;
- case '3':
- this.setData({
- 'content.sort[0].reversed': this.data.content.sort[0].reversed == 0 ? 1 : 0
- });
- this.getList(true)
- break;
- default:
- break;
- }
- },
- /* 处理搜索 */
- onSearch({
- detail
- }) {
- this.setData({
- "content.where.condition": detail
- });
- this.getList(true);
- },
- classClose() {
- this.setData({
- classShow: false
- })
- },
- classSelect({
- detail
- }) {
- if (this.data.content.type == detail.index) return this.classClose();
- this.setData({
- "content.type": detail.index,
- 'navList[0].label': detail.name,
- classActions: this.data.classActions.map(v => {
- v.color = detail.i == v.i ? '#3874F6' : ''
- return v
- })
- })
- this.classClose();
- this.getList(true)
- },
- onShareAppMessage() {}
- })
|