| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- const _Http = getApp().globalData.http;
- Page({
- data: {
- "content": {
- "sa_projectid": 1,
- "pageNumber": 1,
- "pageSize": 20,
- "where": {
- "condition": ""
- }
- }
- },
- onLoad(options) {
- this.data.content.sa_projectid = options.sa_projectid;
- this.getList()
- },
- /* 获取列表 */
- getList(init = false) {
- if (init.detail != undefined) init = init.detail;
- let content = this.data.content;
- if (init) content.pageNumber = 1;
- if (content.pageNumber > content.pageTotal) return;
- _Http.basic({
- "id": 20230816124004,
- content
- }).then(res => {
- console.log("授权列表", res)
- this.selectComponent('#ListBox').RefreshToComplete();
- if (res.msg != '成功') return wx.showToast({
- title: res.msg,
- icon: "none"
- })
- content.pageNumber = res.pageNumber + 1;
- content.pageTotal = res.pageTotal;
- content.total = res.total;
- this.setData({
- list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
- content
- })
- })
- },
- preview(e) {
- const {
- item
- } = e.currentTarget.dataset;
- if (this.compareDates(item.begdate_auth, item.enddate_auth)) return;
- _Http.basic({
- "id": 20221213094501,
- "content": {
- "sys_reportid": 104,
- "dataid": item.sa_projectid,
- sys_enterpriseid: item.enterpriseid_auth,
- }
- }).then(res => {
- console.log("查看授权书", res)
- if (res.msg != '成功') return wx.showToast({
- title: res.msg,
- icon: "none"
- })
- let url = `${_Http.baseUrl+res.data}&enterprisename=${item.enterprisename}&begdate=${item.begdate_auth}&enddate=${item.enddate_auth}`
- wx.navigateTo({
- url: `/packageA/project/impower/webview`,
- })
- this.setData({
- url
- })
- })
- },
- dispose(e) {
- const {
- item
- } = e.target.dataset,
- that = this;
- if (e.target.id == 1 && this.compareDates(item.begdate_auth, item.enddate_auth)) return;
- wx.showModal({
- title: '提示',
- content: `该项目授权申请确认${e.target.id==1?'通过':'不通过'}?`,
- complete: ({
- confirm
- }) => {
- if (confirm) _Http.basic({
- "id": "20230810161804",
- "content": {
- "sa_project_authorizationid": item.sa_project_authorizationid,
- "begdate": item.begdate_auth,
- "enddate": item.enddate_auth,
- "isPass": e.target.id
- }
- }).then(res => {
- console.log(e.target.id == 1 ? '通过' : '不通过', res)
- wx.showToast({
- title: res.msg == '成功' ? '操作成功' : res.msg,
- icon: "none"
- });
- if (res.msg == '成功') this.setData({
- list: that.data.list.filter(v => v.sa_project_authorizationid != item.sa_project_authorizationid)
- })
- })
- }
- })
- },
- onChangeDate(e) {
- const {
- index,
- item,
- name
- } = e.currentTarget.dataset;
- item[name] = e.detail.value;
- this.setData({
- [`list[${index}]`]: item
- })
- },
- compareDates(d1, d2) {
- let date1 = new Date(d1).getTime();
- let date2 = new Date(d2).getTime();
- if (date1 > date2) wx.showToast({
- title: '请检查授权书有效期,开始时间不能晚于结束时间',
- icon: "none"
- })
- return date1 > date2
- },
- onReady() {
- this.selectComponent("#ListBox").setHeight(".head", this);
- }
- })
|