|
|
@@ -0,0 +1,230 @@
|
|
|
+const _Http = getApp().globalData.http,
|
|
|
+ getHeight = require("../../utils/getRheRemainingHeight");
|
|
|
+Page({
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 页面的初始数据
|
|
|
+ */
|
|
|
+ data: {
|
|
|
+ navList: [{
|
|
|
+ label: "全部",
|
|
|
+ icon: "icon-webxialaxuanxiangjiantou",
|
|
|
+ color: "",
|
|
|
+ width: "",
|
|
|
+ id: "1"
|
|
|
+ }, {
|
|
|
+ label: "排序",
|
|
|
+ icon: "icon-shengxu",
|
|
|
+ color: "",
|
|
|
+ width: "",
|
|
|
+ id: "sort"
|
|
|
+ }, {
|
|
|
+ label: "筛选",
|
|
|
+ icon: "icon-shaixuan",
|
|
|
+ color: "",
|
|
|
+ width: "",
|
|
|
+ id: "2"
|
|
|
+ }],
|
|
|
+ classShow: false,
|
|
|
+ classActions: [{
|
|
|
+ name: '全部',
|
|
|
+ index: 0
|
|
|
+ }, {
|
|
|
+ name: '我负责的',
|
|
|
+ index: 1
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '我参与的',
|
|
|
+ index: 2
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "我下属负责的",
|
|
|
+ index: 3
|
|
|
+ }, {
|
|
|
+ name: "我下属参与的",
|
|
|
+ index: 4
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ content: {
|
|
|
+ "nocache": true,
|
|
|
+ "type": 0,
|
|
|
+ "version": 1,
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 20,
|
|
|
+ "where": {
|
|
|
+ "condition": "",
|
|
|
+ "startdate": "",
|
|
|
+ "enddate": "",
|
|
|
+ "status": "",
|
|
|
+ },
|
|
|
+ "sort": []
|
|
|
+ },
|
|
|
+ filter: {
|
|
|
+ show: false,
|
|
|
+ type: ['普通报价', '项目报价'], //状态项
|
|
|
+ typeActive: "",
|
|
|
+ status: ['新建', '提交', '审核'], //状态项
|
|
|
+ statusActive: "",
|
|
|
+ startdate: "",
|
|
|
+ enddate: ""
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad(options) {
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ /* 获取列表 */
|
|
|
+ getList(init = false, data) {
|
|
|
+ if (init.detail != undefined) init = init.detail;
|
|
|
+ let content = this.data.content;
|
|
|
+ if (init) content.pageNumber = 1;
|
|
|
+ if (content.pageNumber > content.pageTotal) return;
|
|
|
+ if (data) {
|
|
|
+ content.where.status = data.statusActive;
|
|
|
+ content.where.begindate = data.startdate;
|
|
|
+ content.where.enddate = data.enddate;
|
|
|
+ }
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20221121201502,
|
|
|
+ content
|
|
|
+ }).then(res => {
|
|
|
+ console.log("合同列表", res)
|
|
|
+ this.selectComponent('#ListBox').RefreshToComplete();
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ 'content.pageNumber': res.pageNumber + 1,
|
|
|
+ 'content.pageTotal': res.pageTotal,
|
|
|
+ 'content.total': res.total,
|
|
|
+ 'content.sort': res.sort,
|
|
|
+ list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
|
|
|
+ });
|
|
|
+ this.setListHeight();
|
|
|
+ this.getTags();
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* 处理搜索 */
|
|
|
+ onSearch({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.setData({
|
|
|
+ "content.where.condition": detail
|
|
|
+ });
|
|
|
+ this.getList(true);
|
|
|
+ },
|
|
|
+ /* 获取列表标签 */
|
|
|
+ getTags() {
|
|
|
+ let list = this.data.list,
|
|
|
+ ownerids = list.map(v => v.sa_contractid);
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20221018102001,
|
|
|
+ "content": {
|
|
|
+ nocache: true,
|
|
|
+ "ownertable": "sa_contract",
|
|
|
+ ownerids
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log("标签", res)
|
|
|
+ for (let key in res.data) {
|
|
|
+ let index = list.findIndex(v => v.sa_contractid == key);
|
|
|
+ list[index].tags = res.data[key]
|
|
|
+ };
|
|
|
+ this.setData({
|
|
|
+ list
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onReady() {
|
|
|
+ this.setListHeight();
|
|
|
+ },
|
|
|
+ setListHeight() {
|
|
|
+ getHeight.getHeight('.total', this).then(res => {
|
|
|
+ if (this.data.listHeight != res)
|
|
|
+ this.setData({
|
|
|
+ listHeight: res
|
|
|
+ })
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /* 顶部条件导航回调 */
|
|
|
+ navClick({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ switch (detail.id) {
|
|
|
+ case '1':
|
|
|
+ this.setData({
|
|
|
+ classShow: true
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case '2':
|
|
|
+ this.setData({
|
|
|
+ 'filter.show': true
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 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
|
|
|
+ })
|
|
|
+ this.classClose();
|
|
|
+ this.getList(true)
|
|
|
+ },
|
|
|
+ /* 筛选状态选择 */
|
|
|
+ selectStatus(e) {
|
|
|
+ const {
|
|
|
+ item
|
|
|
+ } = e.currentTarget.dataset;
|
|
|
+ this.setData({
|
|
|
+ "filter.statusActive": this.data.filter.statusActive == item ? "" : item
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* 筛选状态选择 */
|
|
|
+ typeStatus(e) {
|
|
|
+ const {
|
|
|
+ item
|
|
|
+ } = e.currentTarget.dataset;
|
|
|
+ this.setData({
|
|
|
+ "filter.typeActive": this.data.filter.typeActive == item ? "" : item
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* 处理筛选 */
|
|
|
+ handleFilter({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ const data = this.data.filter;
|
|
|
+ switch (detail) {
|
|
|
+ case 'confirm':
|
|
|
+ this.setData({
|
|
|
+ 'filter.show': false
|
|
|
+ });
|
|
|
+ this.getList(true, data);
|
|
|
+ break;
|
|
|
+ case 'reset':
|
|
|
+ this.setData({
|
|
|
+ 'filter.statusActive': "",
|
|
|
+ 'filter.startdate': "",
|
|
|
+ 'filter.enddate': "",
|
|
|
+ });
|
|
|
+ this.getList(true, this.data.filter)
|
|
|
+ break;
|
|
|
+ case 'close':
|
|
|
+ this.setData({
|
|
|
+ 'filter.show': false
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onShareAppMessage() {
|
|
|
+
|
|
|
+ }
|
|
|
+})
|