123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- const _Http = getApp().globalData.http;
- Component({
- properties: {
- },
- data: {
- "sa_projectid": null,
- content: {
- nocache: true,
- pageNumber: 1,
- pageTotal: 1,
- pageSize: 10,
- total: null,
- where: {
- condition: "",
- }
- },
- },
- methods: {
- /* 获取地址列表 */
- getList(id, init) {
- let content = this.data.content;
- content.sa_projectid = id;
- if (init) {
- content.pageNumber = 1
- content.pageTotal = 1
- }
- _Http.basic({
- "id": "20221027143702",
- content
- }).then(res => {
- console.log("关联客户列表", res)
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- })
- this.getTags(res.data.map(v => v.sa_customersid));
- this.setData({
- list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
- "content.pageNumber": res.pageNumber + 1,
- "content.pageSize": res.pageSize,
- "content.pageTotal": res.pageTotal,
- "content.total": res.total,
- sa_projectid: id
- })
- })
- },
- /* 获取列表标签 */
- getTags(ownerids = []) {
- _Http.basic({
- "id": 20221018102001,
- "content": {
- "ownertable": "sa_customers",
- ownerids
- }
- }).then(res => {
- console.log("标签", res)
- let list = this.data.list;
- for (let key in res.data) {
- let index = list.findIndex(v => v.sa_customersid == key);
- if (index != -1) list[index].tags = res.data[key]
- };
- this.setData({
- list
- })
- })
- },
- /* 去搜索 */
- toSearch() {
- wx.navigateTo({
- url: '/packageA/project/modules/treaty/search?data=' + JSON.stringify(this.data.content),
- })
- },
- fastCallBack({
- detail
- }) {
- console.log(detail.name, detail.item)
- const that = this;
- switch (detail.name) {
- case 'delete':
- wx.showModal({
- title: '提示',
- content: `是否确认取消关联"${detail.item.enterprisename}"?`,
- complete: ({
- confirm
- }) => {
- if (confirm) _Http.basic({
- "id": 20221027143802,
- "content": {
- "sa_project_partiesids": [detail.item.sa_project_partiesid]
- },
- }).then(res => {
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- });
- that.setData({
- list: that.data.list.filter(v => v.sa_project_partiesid != detail.item.sa_project_partiesid),
- 'content.total': that.data.content.total - 1
- });
- wx.showToast({
- title: `已取消关联"${detail.item.enterprisename}"`,
- icon: "none"
- })
- })
- }
- })
- break;
- default:
- break;
- }
- }
- }
- })
|