From 536511ac96b6dc06322c5953eed38ed53f67d409 Mon Sep 17 00:00:00 2001
From: liwentao <1376563863@qq.com>
Date: 星期日, 23 四月 2023 10:49:30 +0800
Subject: [PATCH] 营业-SISearchSetProduct页面修改(李文涛)
---
force-app/main/default/classes/LexSISearchSetProductController.cls | 173 +++++++++++++++++++
force-app/main/default/lwc/lexSISearchSetProduct/lexSISearchSetProduct.js | 181 ++++++++++++++++++++
force-app/main/default/lwc/lexSISearchSetProduct/lexSISearchSetProduct.js-meta.xml | 11 +
force-app/main/default/lwc/lexSISearchSetProduct/lexSISearchSetProduct.css | 10 +
force-app/main/default/lwc/lexSISearchSetProduct/lexSISearchSetProduct.html | 117 +++++++++++++
force-app/main/default/classes/LexSISearchSetProductController.cls-meta.xml | 5
6 files changed, 497 insertions(+), 0 deletions(-)
diff --git a/force-app/main/default/classes/LexSISearchSetProductController.cls b/force-app/main/default/classes/LexSISearchSetProductController.cls
new file mode 100644
index 0000000..36dd0d8
--- /dev/null
+++ b/force-app/main/default/classes/LexSISearchSetProductController.cls
@@ -0,0 +1,173 @@
+public with sharing class LexSISearchSetProductController {
+
+
+ public LexSISearchSetProductController(){
+
+ }
+ @AuraEnabled
+ public static InitData init(){
+ InitData data=new InitData();
+ data.rc = new Product_Set__c();
+ data.sc = new Product_Set__c();
+ data.cl = new List<Product_Set__c>();
+ data.baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
+ data.SearchName='';
+ data.SearchCode='';
+ data.SearchPrice='';
+ data.SearchQuantity='';
+ data.reportid='';
+ data.setProductidFullList=new list<String>();
+ data.activities=new List<SSPLine>();
+ data.setPFString='';
+ data.DataStatus='';
+ data.LabelI='';
+ Report r = new Report();
+ List<Report> rs = new List<Report>();
+ rs=[Select id,DeveloperName,Name,NamespacePrefix from Report Where DeveloperName='Set_Product_Detail'];
+ if (rs.size()>0){
+ data.reportid = rs[0].id;
+ data.reportid = data.reportid.substring(0,15);
+ }
+ data.LabelI=Product_Set__c.Quote_Select_Info__c.getDescribe().getLabel();
+ System.debug('init: '+data);
+ return data;
+ }
+
+ @AuraEnabled
+ public static InitData serContact(String searchName,String searchCode){
+ InitData data=new InitData();
+
+ String searchSql = 'Select id, name, Price__c, Product_Set_CD__c, Quantity__c,Valid_Status__c,Quote_Select_Info__c From Product_Set__c ';
+ String whereStr = 'Where id != null ';
+ String whereSql = '';
+
+ if(searchName != null && searchName != ''){
+ whereSql += 'and name Like ' + '\'%' + searchName + '%\' ';
+ }
+
+ if(searchCode != null && searchCode != ''){
+ whereSql += 'and Product_Set_CD__c like ' + '\'%' + searchCode + '%\' ';
+ }
+/*
+*/
+ searchSql = searchSql + whereStr + whereSql;
+
+ searchSql += ' order by Product_Set_CD__c limit 500';
+
+ data.cl = Database.query(searchSql);
+ data.activities = New List<SSPLine>();
+// SSPLine a = new SSPLine();
+ for(Product_Set__c psl : data.cl){
+ SSPLine a = new SSPLine(psl);
+ data.activities.add(a);
+ }
+ return data;
+ }
+
+ @AuraEnabled
+ public static InitData SelectDone(List<String> activities,List<Boolean> isSelected){
+ try{
+ InitData data=new InitData();
+ data.setPFString = '';
+ data.setProductidFullList = New List<String>();
+ if(activities.size()==1){
+ data.setPFString = activities[0];
+ }else{
+ for(Integer i=0;i<activities.size();i++){
+ if(isSelected[i]==true){
+ if(String.isblank(data.setPFString)||data.setPFString==null){
+ data.setPFString = activities[i];
+ }else{
+ data.setPFString = data.setPFString+','+activities[i];
+ }
+
+ }
+ }
+ }
+ data.DataStatus = 'Fin';
+ return data;
+ }catch(Exception e){
+ System.debug('SelectDone error:'+e);
+ }
+
+ return null;
+ }
+
+ @AuraEnabled
+ public static String getFileName(){
+ Schema.DescribeFieldResult r = Product_Set__c.Quote_Select_Info__c.getDescribe();
+ return r.getLabel();
+ }
+
+ public class InitData{
+ @AuraEnabled
+ public Product_Set__c rc;
+ @AuraEnabled
+ public Product_Set__c sc;
+ @AuraEnabled
+ public List<Product_Set__c> cl;
+ @AuraEnabled
+ public String SearchName;
+ @AuraEnabled
+ public String SearchCode;
+ @AuraEnabled
+ public String SearchPrice;
+ @AuraEnabled
+ public String SearchQuantity;
+ @AuraEnabled
+ public String baseUrl;
+ @AuraEnabled
+ public String reportid;
+ @AuraEnabled
+ public List<String> setProductidFullList;
+ @AuraEnabled
+ public List<SSPLine> activities;
+ @AuraEnabled
+ public String setPFString;
+ @AuraEnabled
+ public String DataStatus;
+ @AuraEnabled
+ public String LabelI;
+ }
+
+ public class SSPLine {
+ @AuraEnabled
+ public Boolean isSelected;
+
+ @AuraEnabled
+ public String setProductid;
+
+ @AuraEnabled
+ public String setProductidFull;
+
+ @AuraEnabled
+ public Decimal Quantity;
+
+ @AuraEnabled
+ public Product_Set__c theObject;
+
+ @AuraEnabled
+ public String Name;
+
+ @AuraEnabled
+ public String Product_Set_CD_c;
+
+ @AuraEnabled
+ public String Quote_Select_Info_c;
+
+ @AuraEnabled
+ public Boolean Valid_c;
+
+ public SSPLine(Product_Set__c psl) {
+ isSelected = false;
+ setProductid = psl.id;
+ setProductid = setProductid.substring(0,15);
+ setProductidFull = psl.id;
+ Name = psl.Name;
+ Product_Set_CD_c= psl.Product_Set_CD__c;
+ Quantity = psl.Quantity__c;
+ Quote_Select_Info_c = psl.Quote_Select_Info__c;
+ Valid_c = psl.Valid_Status__c;
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexSISearchSetProductController.cls-meta.xml b/force-app/main/default/classes/LexSISearchSetProductController.cls-meta.xml
new file mode 100644
index 0000000..70f89f4
--- /dev/null
+++ b/force-app/main/default/classes/LexSISearchSetProductController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>51.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSISearchSetProduct/lexSISearchSetProduct.css b/force-app/main/default/lwc/lexSISearchSetProduct/lexSISearchSetProduct.css
new file mode 100644
index 0000000..742b9b2
--- /dev/null
+++ b/force-app/main/default/lwc/lexSISearchSetProduct/lexSISearchSetProduct.css
@@ -0,0 +1,10 @@
+/*div {
+ color: #fff;
+ height: 300px;
+ overflow-y: auto;
+ overflow-x: hidden;
+}*/
+ .spacer {
+ height: 10px;
+ /* 璁剧疆鍚堥�傜殑楂樺害鏉ラ殧寮�涓婁笅涓や釜妯″潡 */
+ }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSISearchSetProduct/lexSISearchSetProduct.html b/force-app/main/default/lwc/lexSISearchSetProduct/lexSISearchSetProduct.html
new file mode 100644
index 0000000..0d30147
--- /dev/null
+++ b/force-app/main/default/lwc/lexSISearchSetProduct/lexSISearchSetProduct.html
@@ -0,0 +1,117 @@
+<template>
+<!-- <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
+<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
+ -->
+ <template if:true={isLoad}>
+ <form id="mainForm" >
+ <!-- <apex:actionFunction action="{!SelectDone}" name="SelectDone" reRender="setPFString,DataStatus" oncomplete="SetMuiltProduct();"/> -->
+ <lightning-input type="hidden" value={data.setPFString} id="setPFString" ></lightning-input>
+ <lightning-input type="hidden" value={data.DataStatus} id="DataStatus" > </lightning-input>
+
+ <lightning-card title={Label.Set_Search}>
+ <!-- <apex:pageBlock id="idSearchSetProduct" title="{Label.Set_Search}"> -->
+ <div class="spacer" style="background-color:#DCDCDC;">
+ </div>
+
+ <table width="900" border="0" style="background-color:#DCDCDC;" class="my-table" >
+
+ <colgroup>
+ <col width="12" />
+ <col width="20" />
+ <col width="20" />
+ <col width="200" />
+ <col width="200" />
+ <col width="20" />
+ <col width="428" />
+ </colgroup>
+
+ <tr>
+ <td> </td>
+ <th style="width: 50px">{Label.Search_Condition}</th>
+ <td> </td>
+ <th>{Label.Set_Name}</th>
+ <th>{Label.Set_Code}</th>
+ <td> </td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td> </td>
+ <td> </td>
+ <td><lightning-input type="search" value={SearchName} onchange={searchNameInputChange} style="width:200px" ></lightning-input></td>
+
+ <td><lightning-input type="search" value={SearchCode} onchange={searchCodeInputChange} style="width:200px" > </lightning-input></td>
+
+ <td><lightning-button label={Label.Search} onclick={Select} rerender="idRezultVisitor" class="slds-m-left_x-small"> </lightning-button></td>
+
+ <td><lightning-button label="娣诲姞" onclick={DataPrepare} class="slds-m-left_x-small"></lightning-button></td>
+ </tr>
+ <tr>
+ <td style="border-bottom: 1px solid #888;" colspan="15"> </td>
+ </tr>
+ </table>
+ <div class="spacer" style="background-color:#DCDCDC;">
+ </div>
+ <table width="900" border="0" style="background-color:#DCDCDC;" >
+ <tr>
+ <td width="12"> </td>
+ <th valign="top">{Label.Search_Result}</th>
+ <td width="20"> </td>
+ <td>
+ <table border="0">
+ <tr>
+ <td>
+ <div id="iframelike" style="width:770px;
+ height: 300px;
+ overflow-y: auto;
+ overflow-x: hidden;">
+ <lightning-datatable
+ key-field="id"
+ data={data.activities}
+ columns = {columns}>
+ </lightning-datatable>
+
+ <!-- <apex:pageBlockTable id="idRezultVisitor" value="{!activities}" var="c" border="1" columns="7" columnsWidth="30px,300px,120px,90x,200px,50px">
+ <apex:column >
+ <apex:facet name="header">閫夋嫨</apex:facet>
+ <apex:inputCheckbox value="{!c.isSelected}"/>
+ </apex:column>
+ <apex:column >
+ <apex:facet name="header">Report</apex:facet>
+ <apex:outputLink value="{!baseUrl}/{!reportid}?pv1={!c.setProductid}" target="_blank">鈼�</apex:outputLink>
+ </apex:column>
+ <apex:column >
+ <apex:facet name="header">{Label.Set_Name}</apex:facet>
+ <apex:outputLink value="{!c.Name}" onclick="SetProductId('{!c.setProductidFull}')">{!c.Name}</apex:outputLink>
+ </apex:column>
+ <apex:column >
+ <apex:facet name="header">{Label.Set_Code}</apex:facet>
+ <apex:outputText value="{!c.Product_Set_CD_c}" />
+ </apex:column>
+ <apex:column >
+ <apex:facet name="header">{Label.Quantity}</apex:facet>
+ <apex:outputText value="{!c.Quantity}" />
+ </apex:column>
+ <apex:column >
+ <apex:facet name="header">{data.LabelI}</apex:facet>
+ <apex:outputText value="{!c.Quote_Select_Info_c}" />
+ </apex:column>
+ <apex:column >
+ <apex:facet name="header">{!$Label.Valid_Status}</apex:facet>
+ <template layout="inline" rendered={c.Valid_c} >
+ <img width="16" height="16" title="銉併偋銉冦偗" class="checkImg" alt="銉併偋銉冦偗" src="/img/checkbox_checked.gif"/>
+ </template>
+ </apex:column>
+ </apex:pageBlockTable> -->
+ </div>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <!-- </apex:pageBlock> -->
+ </lightning-card>
+ </form>
+ </template>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSISearchSetProduct/lexSISearchSetProduct.js b/force-app/main/default/lwc/lexSISearchSetProduct/lexSISearchSetProduct.js
new file mode 100644
index 0000000..ad0b058
--- /dev/null
+++ b/force-app/main/default/lwc/lexSISearchSetProduct/lexSISearchSetProduct.js
@@ -0,0 +1,181 @@
+import { LightningElement, track, wire } from 'lwc';
+
+import Set_Name from '@salesforce/label/c.Set_Name';
+import Search_Condition from '@salesforce/label/c.Search_Condition';
+import Set_Search from '@salesforce/label/c.Set_Search';
+import Set_Code from '@salesforce/label/c.Set_Code';
+import Search from '@salesforce/label/c.Search';
+import Search_Result from '@salesforce/label/c.Search_Result';
+import Quantity from '@salesforce/label/c.Quantity';
+import Valid_Status from '@salesforce/label/c.Valid_Status';
+
+import serContact from '@salesforce/apex/LexSISearchSetProductController.serContact';
+import SelectDone from '@salesforce/apex/LexSISearchSetProductController.SelectDone';
+import getFileName from '@salesforce/apex/LexSISearchSetProductController.getFileName';
+import init from '@salesforce/apex/LexSISearchSetProductController.init';
+import a from '@salesforce/resourceUrl/jquery183minjs';
+import b from '@salesforce/resourceUrl/PleaseWaitDialog';
+export default class lexSISearchSetProduct extends LightningElement {
+ Label={
+ Set_Name,
+ Search_Condition,
+ Set_Search,
+ Set_Code,
+ Search_Result,
+ Search,
+ Quantity,
+ Valid_Status,
+ };
+ isLoad=false;
+ data;
+ LabelI='';
+ SearchName='';
+ SearchCode='';
+ columns = [
+ { label: '閫夋嫨', fieldName: 'isSelected' },
+ { label: 'Report', fieldName: 'setUrl' },
+ { label: this.Label.Set_Name, fieldName: 'Name' },
+ { label: this.Label.Set_Code, fieldName: 'Product_Set_CD_c' },
+ { label: this.Label.Quantity, fieldName: 'Quantity' },
+ { label: this.Label.Valid_Status, fieldName: 'img' }
+ // { label: 'Website', fieldName: 'Asset_Model_No_forPrint__c', type: 'url' },
+ // { label: 'Phone', fieldName: 'phone', type: 'phone' },
+ // { label: 'Balance', fieldName: 'amount', type: 'currency' },
+ // { label: 'CloseAt', fieldName: 'closeAt', type: 'date' },
+ ];
+
+
+ async connectedCallback(){
+ // getFileName().then(res=>{
+ // console.log("ttt");
+ // console.log(res);
+ // this.Quote_Select_Info__c_Label=res;
+ // })
+ console.log("jinru");
+ await init().then(res=>{
+ console.log("hhh");
+ console.log("res:");
+ console.log(res);
+ console.log(res.LabelI);
+ this.data=res;
+ this.LabelI=res.LabelI;
+ for (var i = this.data.activities.length - 1; i >= 0; i--) {
+ this.data.activities[i].setUrl= res.baseUrl + '/'+ res.reportid +'?pv1='+ this.data.activities[i].setProductid;
+ this.data.activities[i].urlIcon=true;
+ if(this.data.activities[i].Valid_c){
+ this.data.activities[i].img='';
+ }
+ }
+
+ this.columns = [
+ // { label: '閫夋嫨', fieldName: 'isSelected' },
+ {
+ label: 'Report',
+ fieldName: 'setUrl',
+ type: 'url',
+ typeAttributes: {
+ label: '鈼�',
+ target: '_blank'
+ },
+ cellAttributes: {
+ iconName: {
+ fieldName: 'urlIcon',
+ operator: '=',
+ value: true
+ } ? 'standard:link' : '',
+ iconPosition: 'left',
+ }
+ },
+ { label: this.Label.Set_Name, fieldName: 'Name' },
+ { label: this.Label.Set_Code, fieldName: 'Product_Set_CD_c' },
+ { label: this.Label.Quantity, fieldName: 'Quantity' },
+ { label: this.data.LabelI, fieldName: 'Quote_Select_Info_c' },
+ { label: this.Label.Valid_Status, fieldName: 'img' }
+ ];
+ this.isLoad=true;
+ });
+ }
+
+
+ SetProductId(str) {
+ //top.window.opener.setProductEntry(str);
+ top.window.opener.setProductEntryGateway(str);
+ top.window.close();
+ }
+
+ SetMuiltProduct(){
+ var Str = this.data.setPFString;
+ var isPrepared = this.data.DataStatus;
+ if(isPrepared!='Fin'){
+ confirm(isPrepared)
+ }else if(Str==''||Str==null){
+ if(confirm("鎮ㄥ皻鏈�夊彇浠讳綍浜у搧閰嶅锛岀‘璁ゅ畬鎴愪箞锛�")){
+ top.window.close();
+ }else{
+ }
+ }else{
+ top.window.opener.setProductEntryGateway(Str);
+ top.window.close();
+ }
+ }
+ async DataPrepare() {
+ // body...
+ console.log("娣诲姞:");
+ this.data.DataStatus='鏁版嵁灏氭湭鍑嗗濂斤紝璇风◢绛�';
+ console.log(this.data);
+ let activities=[];
+ let isSelected=[];
+ for (var i = this.data.activities.length - 1; i >= 0; i--) {
+ activities.push(this.data.activities[i].setProductidFull);
+ isSelected.push(this.data.activities[i].isSelected);
+ }
+ //j$(escapeVfId("Page:mainForm:DataStatus")).val('鏁版嵁灏氭湭鍑嗗濂斤紝璇风◢绛�');
+ await SelectDone({activities:activities,isSelected:isSelected}).then(res=>{
+ console.log("SelectDone:");
+ console.log(res);
+ if(res!=null){
+ this.data.setPFString=res.setPFString;
+ this.data.setProductidFullList=res.setProductidFullList;
+ this.data.DataStatus=res.DataStatus;
+ console.log(this.data);
+ }
+ }).catch(err=>{
+ console.log("err:");
+ console.log(err);
+ console.log(err.message);
+ });
+ }
+
+ Select(){
+ serContact({searchName:this.data.SearchName,searchCode:this.data.SearchCode}).then(res=>{
+ console.log("鏌ヨ缁撴灉");
+ console.log(res);
+ if(res!=null){
+ this.data.cl=res.cl;
+ this.data.activities=res.activities;
+ for (var i = this.data.activities.length - 1; i >= 0; i--) {
+
+ this.data.activities[i].setUrl= this.data.baseUrl + '/'+ this.data.reportid +'?pv1='+ this.data.activities[i].setProductid;
+ if(this.data.activities[i].Valid_c){
+ this.data.activities[i].img='鈭�';
+ }
+ }
+ console.log("activities!");
+ }
+ let t=this.data;
+ this.data={};
+ this.data=t;
+ console.log(this.data);
+ })
+ }
+ searchNameInputChange(event){
+ this.data.SearchName = event.detail.value;
+ }
+ searchCodeInputChange(event){
+ this.data.SearchCode = event.detail.value;
+ }
+ // function DataReady() {
+ // // body...
+ // j$(escapeVfId("Page:mainForm:DataStatus")).value()='Fin';
+ // }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSISearchSetProduct/lexSISearchSetProduct.js-meta.xml b/force-app/main/default/lwc/lexSISearchSetProduct/lexSISearchSetProduct.js-meta.xml
new file mode 100644
index 0000000..d0dd8b9
--- /dev/null
+++ b/force-app/main/default/lwc/lexSISearchSetProduct/lexSISearchSetProduct.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexSISearchSetProduct">
+ <apiVersion>51.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightning__AppPage</target>
+ <target>lightning__RecordPage</target>
+ <target>lightning__HomePage</target>
+ <target>lightning__RecordAction</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
--
Gitblit v1.9.1