沙世明
2023-03-09 99b667bdfd8d4fd4d56c2952510169d7f7be794c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
import { LightningElement,track } from 'lwc';
import GetNormalProductSearch from '@salesforce/apex/OpportunityService.GetNormalProductSearch';
import saveInquiryData from '@salesforce/apex/OpportunityService.saveInquiryData';
 
import saveInquiryDataTemp from '@salesforce/apex/OpportunityService.saveInquiryDataTemp';
export default class test02 extends LightningElement {
 
 
    //==================获取招投标项目id================
    ParamIdStr = '';
    getQueryVariable(variable)
    {
        var query = window.location.search.substring(1);
        var vars = query.split("&");
        for (var i=0;i<vars.length;i++) {
                var pair = vars[i].split("=");
                if(pair[0] == variable){return pair[1];}
        }
        return(false);
    }
    connectedCallback(){
       var paramId =  this.getQueryVariable('id');
       if (paramId == null || paramId == '') {
           return ;
       }
       this.ParamIdStr = paramId;
       console.warn(this.ParamIdStr);
    }
    //错误提示
    @track ErrorTongzhishow = false;
    // TZErrorshow(init){
    //     this.ErrorTongzhishow = init;
    // }
    // ErrorTongzhiClick(event)
    // {
    //     this.ErrorTongzhishow = false;
    // }
    //=============================================================================
    // isShow= false;
    // isShow1= false;
    // isShow2= false;
    // inputText = '';
    // apply = '';
    // apply1 = '';
    // apply2 = '';
    // onClicks(event){
    //     var valu=event.currentTarget.innerText;
    //     this.apply=valu;
    //     this.isShow = false;
    // }
    // onClicks1(event){
    //     var valu=event.currentTarget.innerText;
    //     this.apply1=valu;
    //     this.isShow1 = false;
    // }
    // onClicks2(event){
    //     var valu=event.currentTarget.innerText;
    //     this.apply2=valu;
    //     this.isShow2 = false;
    // }
    // handleChanges(event)
    // {
    //     this.inputText = event.target.value;
    //     console.warn(   this.inputText);
    //     this.isShow = true;
    // }
    // handleChanges1(event)
    // {
    //     this.inputText = event.target.value;
    //     console.warn(   this.inputText);
    //     this.isShow1 = true;
    // }
    // handleChanges2(event)
    // {
    //     this.inputText = event.target.value;
    //     console.warn(   this.inputText);
    //     this.isShow2 = true;
    // }
 
    // onmousedownFn(event){
    //     debugger;
    //     console.warn( event.target.value);
    //     this.isShow= true;
    // }
    // onmousedownFn1(event){
    //     debugger;
    //     console.warn( event.target.value);
    //     this.isShow1= true;
    // }
    // onmousedownFn2(event){
    //     debugger;
    //     console.warn( event.target.value);
    //     this.isShow2= true;
    // }
    // 点击搜索触发
    searchData(event){
        let searchParams = event.detail.searchParams || {};
        let temp = this.template;
        this.template.querySelector('[data-parent-id="parent-div-id"]').refreshDataTable({searchParams: searchParams});
        // this.template.activeElement.refreshDataTable({searchParams: searchParams});
        // this.cancel();
    }
    //搜索框,搜索询价编码
    @track
    initSearchForm = [
        {
            label: "询价编码",
            type: "text",
            name: "Opportunity_No__cEqual",
            isInput: true
        }
    ]
    @track tableIsLoding = true;
    //列表标签
    @track
    initDataTable = {
        columns: [
            {label: '询价名称', fieldName: 'Name', sortable: true},
            {label: '询价编码', fieldName: 'Opportunity_No__c', sortable: true},
            {label: '医院', fieldName: 'HP_Name__c', sortable: true}
        ],
        sortInterfaces: false,
        searchColumns: this.initSearchForm
    }
 
    //列表数据
    @track jzData = [];
    //后台交互,获取数据列表
    getTableData(event){
        let listQuery = event.detail.listQuery;
        listQuery.pageLimit=20;
        GetNormalProductSearch(listQuery).then(result => {
            debugger
            var jzselectInquiry=[];
            var jzInquiry=[];
            var responseObj = JSON.parse(result);
            // this.jzData =  responseObj.records;
            responseObj.records.forEach(item=>{
                if(item.Bidding_Project_Name_Bid__c!=undefined){
                    jzselectInquiry.push(item);
                }else{
                    jzInquiry.push(item);
                }
            });
            this.jzData=[...jzselectInquiry,...jzInquiry];
            console.warn(this.jzData);
            this.tableIsLoding = false;
        })
    }
    //选中
    @track SelectedFnDate=[]
    SelectedFn(event){
        let arr = event.detail.rows;
        var arrr=[];
        arr.forEach(item=>{
            if(item.Bidding_Project_Name_Bid__c!=undefined){
                this.ErrorTongzhishow = true;
                setTimeout(()=>{
                    this.ErrorTongzhishow = false;
                    },2000)
            }else{
                arrr.push(item);
            }
        });
        this.SelectedFnDate = arrr;
    }
    //保存
    saveInquiry(){
        debugger;
        var newTemp=[];
        this.SelectedFnDate.forEach(item=>{
            let Temp = {};
            Temp.Id=item.Id;
            Temp.BiddingProjectNameBidc=this.ParamIdStr;
            newTemp.push(Temp);
        });
        var jsondata=JSON.stringify(newTemp);
        debugger;
        saveInquiryData({JsonStr:jsondata}).then(result => {
          debugger;
          var resultObject =  JSON.parse(result);
          console.warn(resultObject);
        });
    // saveInquiryDataTemp().then(result=>{
 
    //     var a = result;
    //     debugger;x
    // });
    }
}