| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- const _Http = getApp().globalData.http;
- Component({
- properties: {
- disabled: Boolean
- },
- data: {
- list: [],
- sa_projectid: "",
- "content": {
- "nocache": true,
- "pageNumber": 1,
- "pageTotal": 1,
- "total": null,
- "type": 1,
- "where": {
- "condition": ""
- }
- }
- },
- methods: {
- getList(id, init) {
- let content = this.data.content;
- content.sa_projectid = id;
- if (init) content.pageNumber = 1
- _Http.basic({
- "id": 20221027165402,
- content
- }).then(res => {
- console.log("项目竞争对手", res)
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- })
- 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
- });
- })
- },
- add() {
- wx.navigateTo({
- url: '/packageA/select/setclient/select?params=' + JSON.stringify({
- "content": {
- nocache: true,
- "isExport": false,
- "where": {
- "condition": "",
- "tablefilter": {},
- "sa_projectid": this.data.sa_projectid
- }
- },
- "id": 20221018164302,
- }) + '&radio=true&idname=sa_competitorid',
- });
- getApp().globalData.handleSelect = this.handleSelect.bind(this);
- },
- handleSelect({
- item
- }) {
- let that = this;
- wx.showModal({
- title: '提示',
- content: `是否添加"${item.enterprisename}"为竞争对手`,
- complete: ({
- confirm
- }) => {
- if (confirm) _Http.basic({
- "id": 20221019165802,
- "content": {
- sa_project_competeid: 0,
- "sa_projectid": that.data.sa_projectid, //工程项目表ID
- "sa_competitorid": item.sa_competitorid, //竞争对手ID
- "important": 0, //主要威胁 0/1
- }
- }).then(res => {
- console.log("添加竞争对手", res)
- wx.showToast({
- title: res.msg == '成功' ? '添加成功' : res.msg,
- icon: "none"
- })
- if (res.msg == '成功') setTimeout(() => {
- wx.navigateBack();
- that.getList(that.data.sa_projectid, true)
- }, 300)
- })
- }
- })
- },
- /* 修改总数 */
- changeTotal() {
- this.setData({
- "content.total": this.data.content.total - 1
- })
- }
- }
- })
|