rushfee/resource/html/revisit/operation.html

490 lines
22 KiB
HTML
Raw Normal View History

2022-05-16 15:07:40 +00:00
<html login="false">
<head>
<title>回访界面</title>
<style>
.aos-labelfield-label2>.aos-labelfield-label{
text-align: left;
width:300px;
white-space: normal;
}
.aos-labelfield-label3>.aos-labelfield-label{
text-align: left;
}
</style>
</head>
<body >
<div widget="toolbar" >
<!-- <a widget="button" iconCls="icon-test" onclick="">客户档案</a>
<a widget="button" iconCls="icon-admin" onclick="">服务记录</a>
<a widget="button" iconCls="icon-log" onclick="">回访记录</a>
<a widget="button" iconCls="icon-log" onclick="">缴费信息</a>margin-right: 20px;margin-bottom: 5px-->
<div id="call_div" style="display: inline-block">&nbsp;&nbsp;线路:<input name="phone_type" style="width: 50px;display: inline-block" widget="combox" allowInput="false" url="revisit/getPhoneLine" textField="text" valueField="text" showNullItem="false"/>
<a widget="button" iconCls="icon-setup" id="callbtn" onclick="call">呼叫</a>
<a widget="button" iconCls="icon-disable" onclick="endcall">挂断</a></div>
<!--<a widget="button" iconCls="icon-mail" onclick="message">短信</a>-->
<a widget="button" iconCls="icon-save" id="savebtn" onclick="save" linkToState="editold,editnew">保存</a>
<a widget="button" iconCls="icon-log" onclick="hfLog()">回访记录</a>
</div>
<div id="left_div">
<input widget="edit" name="cust_naem" label="客户名称" readonly="true" style="width:502px;margin-top:5px"/>
<br/>
<input widget="edit" name="cust_tax_code" label="客户税号" readonly="true" style="width:502px;margin-top:5px"/>
<br/>
<input widget="edit" name="org_name" label="销售部门" readonly="true" style="width:502px;margin-top:5px"/>
<br/>
<input widget="edit" name="hf_phone" label="回访电话" readonly="true" style="margin-top:5px"/>
<br/>
<div style="vertical-align: middle;">
<input widget="edit" name="hf_name" label="联系人" readonly="true" style="margin-top:5px;display: inline-block;"/>
<div id="div_dl" style="display: inline-block">&nbsp;&nbsp;代理会计:<input name="dailikuaiji" style="width:180px;display: inline-block;" widget="combox" allowInput="false" showNullItem="false" onitemclick="dailichange();"/></div>
</div>
<div style="display: none;">
<div name="kh_is_success" label="回访结果" widget="radiobuttonlist"
repeatitems="2" repeatlayout="table" textfield="text" valuefield="id"
data="[{id:'1',text:'成功'},{id:'0',text:'不成功'}]" readonly="true" value="1" style="margin-top:5px" ></div>
</div>
<input name="spids" widget="hidden"/>
<input name="noneed_spids" widget="hidden"/>
<div id="typeList" style="width: 480px;height: 380px;margin-left: 10px;margin-top:5px;margin-bottom:10px;overflow: auto">
</div>
</div>
<div id="right_top" style="margin-left:510px;">
<div widget="toolbar" >
<a widget="button" iconcls="icon-add" onclick="addRow()">新增</a>
<a widget="button" iconcls="icon-delete" onclick="removeRow()">删除</a>
<a widget="button" iconCls="icon-save" onclick="saveContact()">保存</a>
</div>
<div widget="datagrid" name="grid" style="width: 465px; height:200px;" url="revisit/getContact" allowcelledit="true" allowcellselect="true" allowalternating="true" editnextonenterkey="true" editnextrowcell="true" >
<div type="checkcolumn" width="35" header="选择" allowNull="true"></div>
<div type="indexcolumn" width="35" header="序号"></div>
<div field="contact" width="50" header="联系人"><input editor="edit"/></div>
<div field="mobile" width="80" header="联系电话"><input editor="edit"/></div>
<div field="source" width="80" header="来源"></div>
<div field="mobile_mark" width="80" header="电话类型">
<input editor="combox" name="mobile_mark" url="rushtaskcenter/getMobileMarkList"
textField="text" valueField="memo" allowInput="false" showNullItem="true" /></div>
</div>
</div>
<label style="margin-left: 510px;margin-top:10px;white-space:nowrap;">意见与建议:</label><br/>
<input widget="textarea" name="suggestion" style="margin-left:510px;margin-top:2px;width: 465px;height:50px;"/>
<br/>
<label style="margin-left: 510px;margin-top:10px;white-space:nowrap;">满意度:</label><br/>
<div name="satisfy1" class="aos-labelfield-label2 satisfy" label="1.热线是否满意" widget="radiobuttonlist"
repeatitems="2" repeatlayout="table" textfield="text" valuefield="id"
data="[{id:'1',text:'是'},{id:'0',text:'否'}]" value="1" style="margin-left: 510px;width: 465px"></div>
<div name="satisfy2" class="aos-labelfield-label2 satisfy" label="2.培训是否满意" widget="radiobuttonlist"
repeatitems="2" repeatlayout="table" textfield="text" valuefield="id"
data="[{id:'1',text:'是'},{id:'0',text:'否'}]" value="1" style="margin-left: 510px;width: 465px"></div>
<div name="satisfy3" class="aos-labelfield-label2 satisfy" label="3.上门服务是否满意" widget="radiobuttonlist"
repeatitems="2" repeatlayout="table" textfield="text" valuefield="id"
data="[{id:'1',text:'是'},{id:'0',text:'否'}]" value="1" style="margin-left: 510px;width: 465px;"></div>
<div style="display: inline-block;margin-left: 510px;">
<span class="aos-button-icon aos-iconfont icon-clear" title="取消选中反馈类型" style="display: inline-block;cursor: pointer;position: relative;vertical-align: top;margin-top:7px;" onclick="calcelFeedback()"></span>
<div name="feedback" class="aos-labelfield-label3" label="反馈筛选类型" widget="radiobuttonlist" style="margin-top:5px;white-space:nowrap;display: inline-block;"
repeatitems="3" repeatlayout="table" textfield="reflect_name" valuefield="reflect_id" url="revisit/reflect/getReflect" onValueChanged="refreshQuestion()">
</div>
</div>
<input name="video_path" widget="hidden"/>
<input name="dlremark" widget="hidden"/>
</body>
<script type="text/javascript">
var grid = aos.get('grid');
var isSaving = false;
var custname = '';
var begindate = '';
var enddate = '';
var showdaili = '';
var dlcustname='';
var dlphone='';
var contactParams;
function init(params){
aos.get("phone_type").select(0);
contactParams=params;
custname = params['cust_name'];
begindate = params['searchbegindate'];
enddate = params['searchenddate'];
showdaili = params['showdaili'];
aos.post({
url:"revisit/question/getCustInfo",
data:params,
success:function (rtnData) {
aos.get("cust_naem").setValue(rtnData[0]["cust_naem"]);
aos.get("cust_tax_code").setValue(rtnData[0]["cust_tax_code"]);
aos.get("org_name").setValue(rtnData[0]["org_name"]);
aos.get("hf_phone").setValue(rtnData[0]["hf_phone"]);
aos.get("hf_name").setValue(rtnData[0]["hf_name"]);
if(rtnData!=null&&rtnData.length>0){
var spidsVar = "";
for(var i=0;i<rtnData.length;i++){
if(i==rtnData.length-1){
spidsVar = spidsVar+rtnData[i]["id"];
}else{
spidsVar = spidsVar+rtnData[i]["id"]+";";
}
$("#typeList").append(" <div id=\"sp"+rtnData[i]["id"]+"\" style=\"padding: 5px 0px 5px 10px;display:inline-block;\"></div>");
if(rtnData[i]["type"]=='1'){
$("#sp"+rtnData[i]["id"]).append("<label style=\"display:inline-block;width: 387px\">"+(i+1)+"、"+rtnData[i]["spfl"]+""+rtnData[i]["spmc"]+""+rtnData[i]["xsrq"]+""+rtnData[i]["dkjg"]+""+rtnData[i]["fkje"]+""+rtnData[i]["ykqx"]+""+rtnData[i]["ywy"]+""+rtnData[i]["lilv"]
+""+rtnData[i]["sdsj"]+""+rtnData[i]["ssqy"]+""+rtnData[i]["sxzt"]+""+rtnData[i]["sxed"]+""+rtnData[i]["sfyx"]+""+"</label>");
}else if(rtnData[i]["type"]=='2'){
if(rtnData[i]["remark"]==null||rtnData[i]["remark"]==""){
$("#sp"+rtnData[i]["id"]).append("<label style=\"display:inline-block;width: 387px\">"+(i+1)+"、"+rtnData[i]["spfl"]+""+rtnData[i]["spmc"]+""+rtnData[i]["remark_date"]+",无"+""+"</label>");
}else{
$("#sp"+rtnData[i]["id"]).append("<label style=\"display:inline-block;width: 387px\">"+(i+1)+"、"+rtnData[i]["spfl"]+""+rtnData[i]["spmc"]+""+rtnData[i]["remark_date"]+""+rtnData[i]["remark"]+""+"</label>");
}
}else{
$("#sp"+rtnData[i]["id"]).append("<label style=\"display:inline-block;width: 387px\">"+(i+1)+"、"+rtnData[i]["spfl"]+""+rtnData[i]["spmc"]+""+rtnData[i]["xsrq"]+""+rtnData[i]["ywy"]+"&yen;"+rtnData[i]["price"]+""+"</label>");
}
$("#sp"+rtnData[i]["id"]).append("<div class=\"noneed\" name=\"noneed_"+rtnData[i]["id"]+"\" widget=\"checkbox\" style=\"display:inline-block;text-align:right;vertical-align: center;\" text=\"不需回访\" checked=\"false\"></div>");
var quesList = rtnData[i]["question_list"];
if(quesList!=null&&quesList.length>0){
var questionIds = "";
for(var j=0;j<quesList.length;j++){
var ques = quesList[j];
if(j==quesList.length-1){
questionIds = questionIds+rtnData[i]["id"]+"_"+ques["question_id"];
}else{
questionIds = questionIds+rtnData[i]["id"]+"_"+ques["question_id"]+";";
}
var html="<div name=\"question"+rtnData[i]["id"]+"_"+ques["question_id"]+"\" class=\"aos-labelfield-label2 question cques"+rtnData[i]["id"]+"\" label=\""+ques["question_name"]+"\" widget=\"radiobuttonlist\"" +
"repeatitems=\"2\" repeatlayout=\"table\" textfield=\"text\" valuefield=\"id\"" +
"data=\"[{id:'1',text:'是'},{id:'0',text:'否'}]\" value=\"1\" style=\"width: 450px\" onValueChanged=\"refreshResult('"+rtnData[i]["id"]+"')\"></div>";
aos.append("sp"+rtnData[i]["id"],html);
}
var html2 = "<input name=\"question"+rtnData[i]["id"]+"\" widget=\"hidden\" value=\""+questionIds+"\"/><div name=\"sp_is_success"+rtnData[i]["id"]+"\" class=\"aos-labelfield-label2 spResult\" label=\"回访结果\" widget=\"radiobuttonlist\"\n" +
" repeatitems=\"2\" repeatlayout=\"table\" textfield=\"text\" valuefield=\"id\"\n" +
" data=\"[{id:'1',text:'成功'},{id:'0',text:'不成功'}]\" value=\"1\" readonly=\"true\" onValueChanged=\"refreshResult2()\" ></div>\n";
aos.append("sp"+rtnData[i]["id"],html2);
}
aos.parse("sp"+rtnData[i]["id"]);
}
aos.get("spids").setValue(spidsVar);
}
grid.load(params);
resetHeight();
if(showdaili=='1'){
$("#div_dl").show();
$("#call_div").show();
dlcustname = params["cust_name"];
dlphone=aos.get("hf_phone").getValue();
if(dlphone!=null&&dlphone!=""&&dlphone!="1"&&dlphone!="'"){
aos.get("dailikuaiji").load("revisit/getDlCust?dlphone="+dlphone+"&cust_name="+params["cust_name"]
+"&searchbegindate="+params["searchbegindate"]+"&searchenddate="+params["searchenddate"]);
}
}else{
$("#div_dl").hide();
$("#call_div").hide();
dlcustname = params['dlcustname'];
dlphone = params['dlphone'];
aos.get("dlremark").setValue('代理会计('+dlphone+';'+dlcustname+')');
}
},
fail:function (e) {
alert("发生错误!"+e);
resetHeight();
}
});
}
function dailichange() {
var daili=aos.get("dailikuaiji").getValue();
var params ={};
params['cust_name'] = daili;
params['searchbegindate'] = begindate;
params['searchenddate'] = enddate;
params['dlphone'] = dlphone;
params['dlcustname']=dlcustname;
aos.showWindow('canvas/revisit/operation', params, '960px', '550px', daili, function(rtnValue){
var dlphone=aos.get("hf_phone").getValue();
aos.get("dailikuaiji").load("revisit/getDlCust?dlphone="+dlphone+"&cust_name="+custname
+"&searchbegindate="+begindate+"&searchenddate="+enddate);
});
}
function resetHeight(){
var height=$("#left_div").height();
// alert(height);
$("#right_top").css("marginTop",-height-3);
}
function refreshResult2(){
var arr=document.getElementsByClassName("spResult");
for(var i=0;i<arr.length;i++){
var va = aos.get(arr[i]).getValue();
if(va=='0'){
aos.get("kh_is_success").setValue("0");
return false;
}
if(i==arr.length-1&&va=='1'){
aos.get("kh_is_success").setValue("1");
}
}
}
function refreshResult(id){
var arr=document.getElementsByClassName("cques"+id);
for(var i=0;i<arr.length;i++){
var va = aos.get(arr[i]).getValue();
if(va=='0'){
aos.get("sp_is_success"+id).setValue("0");
refreshResult2();
return false;
}
if(i==arr.length-1&&va=='1'){
aos.get("sp_is_success"+id).setValue("1");
}
}
refreshResult2();
}
function refreshQuestion(){
var arr=document.getElementsByClassName("question");
for(var i=0;i<arr.length;i++){
aos.get(arr[i]).setValue("0");
}
var arr2=document.getElementsByClassName("spResult");
for(var j=0;j<arr2.length;j++){
aos.get(arr2[j]).setValue("0");
}
aos.get("kh_is_success").setValue("0");
}
function save(){
// alert(aos.get("phone_type").getValue());
aos.confirm("请检查信息,是否确认保存?",null,function(action) {
if(action == 'cancel')
{return;}else if(action=='ok'){
var noneedArr = document.getElementsByClassName("noneed");
var ids="";
for(var i=0;i<noneedArr.length;i++){
if(aos.get(noneedArr[i]).getChecked()){
var name=aos.get(noneedArr[i]).getName();
name = name.replace("noneed_","");
if(ids==""){
ids = ids+name;
}else{
ids = ids+";"+name;
}
}
}
//alert(ids);
aos.get("noneed_spids").setValue(ids);
// alert(ids+"=="+aos.get("spids").value);
if(isSaving){
aos.tip("正在保存中...");
return;
}else{
isSaving=true;
var path = parent.document.getElementById('recordFileName').value;
// if(path!=null&&path!=''&&parent.document.getElementById('isrecdend').value=='0'){
if(path!=null&&path!=''){
path = path+',"callId":"'+parent.document.getElementById("callId").value+'"} ]';
// parent.document.getElementById('isrecdend').value=='1';
}
// alert(path);
aos.get("video_path").setValue(path);
var data = aos.getForm().getData();
var grid = aos.get("grid")
data['grid']=grid.getData();
aos.post({
url:"revisit/saveRevisit",
data:data,
success:function (rtnData) {
isSaving=false;
if(rtnData.isOk == 1){
window.alert(rtnData.msg);
if(showdaili=="1"){
aos.get("video_path").setValue("");
parent.document.getElementById("recordFileName").value="";
}
CloseWindow();
}
else{
window.alert(rtnData.msg);
}
},
error:function () {
isSaving=false;
}
});
}
}
});
}
function call(){
var isInit = parent.document.getElementById("hwIsInit").value;
if(isInit!=1){
aos.alert('华为控件未初始化成功!');
}else{
var data = grid.getSelected();
if (!data) {
aos.alert('请选择一条联系人!');
return;
}else{
if(isPhone(data.mobile,1)){
var phoneType = aos.get("phone_type").getValue();
var phoneNo = parent.document.getElementById("hwPhoneNo").value;
var agentId = parent.document.getElementById('hwAgentId').value;
aos.confirm('拨打号码:'+phoneType+data.mobile+";\n分机号"+phoneNo,null,function(action){
if(action == 'cancel')
{return;}else if(action=='ok') {
var logPath = parent.document.getElementById('recordFileName').value;
var callTime = new Date().getTime() + "";
if (logPath == null || logPath == '') {
parent.document.getElementById('recordFileName').value = '[{"isFirst":"\1"},{"callTime":"' + callTime + '","agentId":"' + agentId + '","callee":"' + phoneNo + '","called":"' + phoneType + data.mobile + '"';
} else {
parent.document.getElementById('recordFileName').value = logPath + ',"callId":"' + parent.document.getElementById("callId").value + '"},{"callTime":"' + callTime + '","agentId":"' + agentId + '","callee":"' + phoneNo + '","called":"' + phoneType + data.mobile + '"';
}
window.parent.AgentAppDemoExcute('CallOut', phoneNo, phoneType + data.mobile);
}
});
}
}
}
}
function isPhone(TEL,flag) {
var strPhone = /^1[2|3|4|5|6|7|8|9][0-9]{9}$/;//验证手机号码
var strtel = /^(\(\d{3,4}\)|\d{3,4}|\s)?\d{7,14}$/;//验证固定电话号码
if (strPhone.test(TEL)||strtel.test(TEL)) {
return true;
}else{
if(flag=='1'){
aos.alert("号码不正确!");
}
return false;
}
}
function endcall() {
// AgentAppDemoExcute('StopRecordEx');
window.parent.AgentAppDemoExcute('ReleasePhone');
//指示挂机
window.parent.AgentOcx._ocx.AgentLinkagePhoneOnhook ();
}
function message() {
var data = grid.getSelected();
if(!data){
aos.alert('请选择一条联系人!');
return;
}else{
var mobile = data.mobile;
if(mobile=='无' || mobile== null || mobile==''){
aos.alert('选中的联系人没有联系电话请更改,谢谢~');
return;
}else {
if (mobile.length != 11 || mobile.substr(0, 1) != '1') {
aos.alert('选中的电话号码不符合要求');
return;
}
}
}
}
function hfLog(){
var param = {};
param['cust_name'] = aos.get('cust_naem').getValue();
aos.showWindow( 'canvas/revisit/revisitRecord', param, '800px','400px','回访记录',
function(params, rtnData){
}
);
}
function addRow(){
var newRow = {
source:'维护'
};
grid.addRow(newRow,0);
}
function removeRow(){
var row=grid.getSelected();
if(!row){
aos.alert('选择一行后进行删除!');
return;
}
aos.confirm('确认删除吗?',null,function(action){
if(action == 'cancel')
return;
grid.removeRow(row, true);
});
}
function getChangeData(status){
var list=grid.getChanges(status);
return list;
}
function saveContact(){
var data = {};
data['cust_name']=aos.get('cust_naem').getValue();
data['added']=getChangeData("added");
data['modified']=getChangeData("modified");
data['removed']=getChangeData("removed");
aos.post({
url:"revisit/saveContact",
data:data,
success:function(rtnData){
if(rtnData.isOk == 1){
aos.tip('保存联系人电话成功!');
grid.reload(contactParams);
}else{
aos.tip(rtnData.msg);
grid.reload(contactParams);
}
}
});
}
function calcelFeedback(){
if(aos.get("feedback").value!=""){
aos.get("feedback").setValue("");
var arr=document.getElementsByClassName("question");
for(var i=0;i<arr.length;i++){
aos.get(arr[i]).setValue("1");
}
var arr2=document.getElementsByClassName("spResult");
for(var j=0;j<arr2.length;j++){
aos.get(arr2[j]).setValue("1");
}
aos.get("kh_is_success").setValue("1");
}
}
</script>
</html>