Commit 7e1f815e by shz

tospur

parent 6c0bb1ca
...@@ -94,12 +94,11 @@ class customerList extends WP_List_Table ...@@ -94,12 +94,11 @@ class customerList extends WP_List_Table
" left join tospur_consultant tc on tcs.consultant_id = tc.id" . " left join tospur_consultant tc on tcs.consultant_id = tc.id" .
" left join tospur_organization torg on tc.subsidiaryId = torg.id" . " left join tospur_organization torg on tc.subsidiaryId = torg.id" .
" where 1 = 1"; " where 1 = 1";
$current_user = wp_get_current_user(); if (current_user_can('author')) {
if($current_user->roles[0] == 'author'){ $sql = $sql . " and tcs.consultant_id = " . get_current_user_id();
$sql = $sql . " and tcs.consultant_id = " . $current_user->ID;
} }
if (isset($_REQUEST['filedName']) && $_REQUEST['filedName'] != null) { if (isset($_REQUEST['organization']) && $_REQUEST['organization'] != -1) {
$sql = $sql . " and tc.filedName like '%" . $_REQUEST['filedName'] . "%'"; $sql = $sql . " and tc.subsidiaryId = " . $_REQUEST['organization'];
} }
if (isset($_REQUEST['status']) && $_REQUEST['status'] != -1) { if (isset($_REQUEST['status']) && $_REQUEST['status'] != -1) {
$sql = $sql . " and tcs.status = " . $_REQUEST['status']; $sql = $sql . " and tcs.status = " . $_REQUEST['status'];
......
...@@ -42,8 +42,11 @@ class customerTrackingList extends WP_List_Table ...@@ -42,8 +42,11 @@ class customerTrackingList extends WP_List_Table
" left join tospur_consultant tc on tct.consultant_id = tc.id" . " left join tospur_consultant tc on tct.consultant_id = tc.id" .
" left join tospur_organization torg on tc.subsidiaryId = torg.id" . " left join tospur_organization torg on tc.subsidiaryId = torg.id" .
" where 1 = 1"; " where 1 = 1";
if (isset($_REQUEST['filedName']) && $_REQUEST['filedName'] != null) { if (current_user_can('author')) {
$sql = $sql . " and tc.filedName like '%" . $_REQUEST['filedName'] . "%'"; $sql = $sql . " and tc.id = " . get_current_user_id();
}
if (isset($_REQUEST['organization']) && $_REQUEST['organization'] != -1) {
$sql = $sql . " and tc.subsidiaryId = " . $_REQUEST['organization'];
} }
if (isset($_REQUEST['status_type']) && $_REQUEST['status_type'] != -1) { if (isset($_REQUEST['status_type']) && $_REQUEST['status_type'] != -1) {
$sql = $sql . " and tct.status_type = " . $_REQUEST['status_type']; $sql = $sql . " and tct.status_type = " . $_REQUEST['status_type'];
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<input type="hidden" name="page" value="customerList"> <input type="hidden" name="page" value="customerList">
<div> <div>
<input type="hidden" name="hasSearch" value="1"/> <input type="hidden" name="hasSearch" value="1"/>
{% include 'selectOrganization.html' %}
<label for="status" class="hidden"></label> <label for="status" class="hidden"></label>
<select name="status" id="status"> <select name="status" id="status">
<option value="-1">状态</option> <option value="-1">状态</option>
...@@ -94,7 +95,6 @@ ...@@ -94,7 +95,6 @@
</select> </select>
</div> </div>
<div style="margin-top: 10px;"> <div style="margin-top: 10px;">
<input type="text" placeholder="请输入门店" name="filedName" value="{{ req.filedName }}">
<input type="text" placeholder="请输入姓名" name="search_name" value="{{ req.search_name }}"> <input type="text" placeholder="请输入姓名" name="search_name" value="{{ req.search_name }}">
<input type="text" placeholder="请输入置业顾问" name="search_consultant_name" value="{{ req.search_consultant_name }}"> <input type="text" placeholder="请输入置业顾问" name="search_consultant_name" value="{{ req.search_consultant_name }}">
<input type="text" placeholder="请输入电话" name="search_phone" value="{{ req.search_phone }}"> <input type="text" placeholder="请输入电话" name="search_phone" value="{{ req.search_phone }}">
...@@ -166,5 +166,16 @@ ...@@ -166,5 +166,16 @@
} }
allot_consultant('customerlist'); allot_consultant('customerlist');
$('form').submit(function () {
var organization = getOrganization();
var select = $('select[data-depth]:not(.hidden)');
if (select.length > 1 && organization == -1) {
alert('请选择门店');
return false;
} else {
$(this).append('<input type="hidden" name="organization" value="' + organization + '">');
}
});
}); });
</script> </script>
\ No newline at end of file
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<input type="hidden" name="page" value="customerTrackingList"> <input type="hidden" name="page" value="customerTrackingList">
<div> <div>
{% include 'selectOrganization.html' %}
<label for="status_type" class="hidden"></label> <label for="status_type" class="hidden"></label>
<select name="status_type" id="status_type"> <select name="status_type" id="status_type">
<option value="-1">跟进类型</option> <option value="-1">跟进类型</option>
...@@ -13,8 +14,6 @@ ...@@ -13,8 +14,6 @@
{{ item.id == (req.status_type) ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> {{ item.id == (req.status_type) ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
<label for="filedName" class="hidden"></label>
<input type="text" placeholder="请输入门店" name="filedName" id="filedName" value="{{ req.filedName }}">
<label for="search_consultant_name" class="hidden"></label> <label for="search_consultant_name" class="hidden"></label>
<input type="text" placeholder="请输入置业顾问" name="search_consultant_name" id="search_consultant_name" <input type="text" placeholder="请输入置业顾问" name="search_consultant_name" id="search_consultant_name"
value="{{ req.search_consultant_name }}"> value="{{ req.search_consultant_name }}">
...@@ -34,5 +33,16 @@ ...@@ -34,5 +33,16 @@
<script> <script>
$(document).ready(function () { $(document).ready(function () {
search_form_set_page(); search_form_set_page();
$('form').submit(function () {
var organization = getOrganization();
var select = $('select[data-depth]:not(.hidden)');
if (select.length > 1 && organization == -1) {
alert('请选择门店');
return false;
} else {
$(this).append('<input type="hidden" name="organization" value="' + organization + '">');
}
});
}); });
</script> </script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment