| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- const _Http = getApp().globalData.http;
- Page({
- data: {
- tabs: [{
- title: "我收到的",
- id: "Receive"
- }, {
- title: "我发出的",
- id: "SendOut"
- }],
- active: "Receive",
- filterShow: false,
- filtratelist: [{
- label: "模板类型",
- index: null,
- showName: "reportname", //显示字段
- valueKey: "sys_workreportmodelid", //返回Key
- selectKey: "sys_workreportmodelid", //传参 代表选着字段 不传参返回整个选择对象
- value: "", //选中值
- list: []
- }, {
- label: "阅读状态",
- index: null,
- showName: "name", //显示字段
- valueKey: "readstatus", //返回Key
- selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
- value: "", //选中值
- list: [{
- name: "全部",
- value: ""
- }, {
- name: "已读",
- value: "1"
- }, {
- name: "未读",
- value: "0"
- }]
- }, {
- label: "时间筛选",
- index: null,
- showName: "name", //显示字段
- valueKey: "date", //返回Key
- selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
- value: "", //选中值
- list: [{
- name: "今日",
- value: "today"
- }, {
- name: "最近三天",
- value: "lastthreedays"
- }, {
- name: "最近一周",
- value: "lastWeek"
- }]
- }],
- isread: {
- label: "阅读状态",
- index: null,
- showName: "name", //显示字段
- valueKey: "readstatus", //返回Key
- selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
- value: "", //选中值
- list: [{
- name: "全部",
- value: ""
- }, {
- name: "已读",
- value: "1"
- }, {
- name: "未读",
- value: "0"
- }]
- },
- where: {
- condition: "",
- }
- },
- onLoad(options) {
- this.getList();
- },
- onChange(e) {
- let list = this.selectComponent("#Yl_Filtrate1").data.list;
- if (e.detail.name == 'SendOut') {
- this.data.isread = list[1];
- this.setData({
- filtratelist: list.filter(v => v.label != '阅读状态')
- })
- } else {
- list.splice(1, 0, this.data.isread)
- this.setData({
- filtratelist: list
- })
- }
- this.setData({
- active: e.detail.name
- });
- this.getList();
- },
- getList(init = false) {
- if (init.detail != undefined) init = init.detail;
- this.selectComponent("#" + this.data.active).getList(init);
- this.getModel();
- },
- updateList() {
- let Receive = this.selectComponent("#Receive");
- if (Receive) {
- let content = JSON.parse(JSON.stringify(Receive.data.content))
- content.pageSize = (content.pageNumber - 1) * content.pageSize;
- content.pageNumber = 1;
- _Http.basic({
- "id": '20230524103102',
- content
- }).then(res => {
- console.log("Receive更新列表", res)
- if (res.msg != '失败') Receive.setData({
- list: res.data
- })
- })
- }
- let SendOut = this.selectComponent("#SendOut");
- if (SendOut) {
- let Scontent = JSON.parse(JSON.stringify(SendOut.data.content))
- Scontent.pageSize = (Scontent.pageNumber - 1) * Scontent.pageSize;
- Scontent.pageNumber = 1;
- _Http.basic({
- "id": "20230524102802",
- content: Scontent
- }).then(res => {
- console.log("SendOut更新列表", res)
- if (res.msg != '失败') SendOut.setData({
- list: res.data
- })
- })
- }
- },
- /* 获取模版列表 */
- getModel() {
- _Http.basic({
- "id": "20230524091902",
- "content": {
- "hrid": wx.getStorageSync('userMsg').hrid
- }
- }).then(res => {
- console.log("可创建模版列表", res)
- if (res.msg != '成功') return wx.showToast({
- title: res.msg,
- icon: 'none',
- mask: true
- })
- this.setData({
- modelList: res.data,
- "filtratelist[0].list": res.data
- })
- })
- },
- onReady() {
- this.selectComponent("#ListBox").setHeight(".head", this);
- },
- /* 新建汇报 */
- newData(e, i = 0) {
- wx.navigateTo({
- url: '/packageA/report/insert?model=' + JSON.stringify(this.data.modelList[i]),
- })
- },
- /* Picker选择器选择新建模版 */
- onPickerSelected(e) {
- this.newData("", e.detail.value)
- },
- /* 搜索 */
- onSearch({
- detail
- }) {
- if (this.data.where.condition == detail) return;
- this.data.where.condition = detail;
- this.selectComponent("#" + this.data.active).getList(true);
- },
- /* 筛选 */
- handleFilter({
- detail
- }) {
- detail.condition = this.data.where.condition;
- detail.today = 0
- detail.lastthreedays = 0
- detail.lastWeek = 0
- if (detail.date) detail[detail.date] = 1;
- detail.begindate = detail.startdate || ''
- this.data.where = detail;
- this.selectComponent("#" + this.data.active).getList(true);
- },
- onClick() {
- this.setData({
- filterShow: true
- })
- }
- })
|