|
|
@@ -0,0 +1,117 @@
|
|
|
+const _Http = getApp().globalData.http,
|
|
|
+ getHeight = require("../../utils/getRheRemainingHeight");
|
|
|
+Page({
|
|
|
+ data: {
|
|
|
+ content: {
|
|
|
+ nocache: true,
|
|
|
+ "type": 0,
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 20,
|
|
|
+ "isExport": 0,
|
|
|
+ "where": {
|
|
|
+ "condition": "",
|
|
|
+ }
|
|
|
+ },
|
|
|
+ result: [],
|
|
|
+ radio: true,
|
|
|
+ },
|
|
|
+ onLoad(options) {
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ submit() {
|
|
|
+ let pages = getCurrentPages();
|
|
|
+ let list = this.data.result.map(v => this.data.list.find(value => value.sa_projectid == v));
|
|
|
+ console.log(this.data.result)
|
|
|
+ console.log(list)
|
|
|
+ },
|
|
|
+ getList(init = false) {
|
|
|
+ //init 用于初始化分页
|
|
|
+ if (init.detail != undefined) init = init.detail;
|
|
|
+ if (init) this.setData({
|
|
|
+ ['content.pageNumber']: 1
|
|
|
+ })
|
|
|
+ if (this.data.content.pageNumber > this.data.content.pageTotal) return;
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20221020143502,
|
|
|
+ content: this.data.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,
|
|
|
+ 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.sa_projectid);
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20221018102001,
|
|
|
+ "content": {
|
|
|
+ nocache: true,
|
|
|
+ "ownertable": "sa_project",
|
|
|
+ ownerids
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log("标签", res)
|
|
|
+ for (let key in res.data) {
|
|
|
+ let index = list.findIndex(v => v.sa_projectid == key);
|
|
|
+ list[index].tags = res.data[key]
|
|
|
+ };
|
|
|
+ console.log(list)
|
|
|
+ this.setData({
|
|
|
+ list
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* 选中 */
|
|
|
+ changeResult(e) {
|
|
|
+ const {
|
|
|
+ id
|
|
|
+ } = e.currentTarget.dataset;
|
|
|
+ let result = this.data.result;
|
|
|
+ if (this.data.radio) {
|
|
|
+ result = [id];
|
|
|
+ } else {
|
|
|
+ if (result.some(v => v == id)) {
|
|
|
+ result = result.filter(v => v != id);
|
|
|
+ } else {
|
|
|
+ result.push(id)
|
|
|
+ };
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ result
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* 开始搜索 */
|
|
|
+ startSearch({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ if (detail == this.data.content.where.condition) return;
|
|
|
+ this.setData({
|
|
|
+ 'content.where.condition': detail
|
|
|
+ });
|
|
|
+ this.getList(true);
|
|
|
+ },
|
|
|
+ /* 取消搜索 */
|
|
|
+ onClear() {
|
|
|
+ this.setData({
|
|
|
+ 'content.where.condition': ""
|
|
|
+ });
|
|
|
+ this.getList(true);
|
|
|
+ },
|
|
|
+ onReady() {
|
|
|
+ getHeight.getHeight('.total', this).then(res => this.setData({
|
|
|
+ listHeight: res
|
|
|
+ }));
|
|
|
+ }
|
|
|
+})
|