Commit 14f4915b authored by wangjiangze's avatar wangjiangze

播单管理功能提交

parent f7e92bdc
...@@ -29,17 +29,21 @@ class InjectAction extends CommonAction{ ...@@ -29,17 +29,21 @@ class InjectAction extends CommonAction{
$spModel = D("Sp"); $spModel = D("Sp");
$mediaModel = D("Media"); $mediaModel = D("Media");
$hotelModel = D("Hotel"); $hotelModel = D("Hotel");
$spPlaylistModel = D("SpPlaylist");
if($id){ if($id){
$info =$model->where("id = $id")->find(); $info =$model->where("id = $id")->find();
$this->info = $info; $this->info = $info;
} }
$hotel_lists = $hotelModel->where("`status`=0")->select(); $hotel_lists = $hotelModel->where("`status`=0")->select();
$sp_lists = $spModel->select(); $sp_lists = $spModel->field("id,`name`")->select();
$media_lists = $mediaModel->field("id,title")->select(); $media_lists = $mediaModel->field("id,title")->select();
$play_lists = $spPlaylistModel->join(" A join sh_sp_playlist_media_map B on A.id = B.playlist_id ")->field("A.id,A.`name`,A.sp_id,group_concat(B.media_id) media_ids")->group("A.id")->select();
$this->hotel_lists = $hotel_lists; $this->hotel_lists = $hotel_lists;
$this->sp_lists = $sp_lists; $this->sp_lists = $sp_lists;
$this->media_lists = json_encode($media_lists); $this->media_lists = json_encode($media_lists);
$this->play_lists = $play_lists;
$this->display(); $this->display();
} }
//添加处理 //添加处理
......
...@@ -5,7 +5,7 @@ class PlaylistAction extends CommonAction{ ...@@ -5,7 +5,7 @@ class PlaylistAction extends CommonAction{
public function index(){ public function index(){
$op = I('op'); $op = I('op');
if($op=="getjson"){ if($op=="getjson"){
$model = D("Hotel"); $model = D("SpPlaylist");
$userInfo = $_SESSION["_USER_INFO"]; $userInfo = $_SESSION["_USER_INFO"];
$inputs = I(); $inputs = I();
$list = $model->getList("list",$userInfo,$inputs); $list = $model->getList("list",$userInfo,$inputs);
...@@ -14,7 +14,7 @@ class PlaylistAction extends CommonAction{ ...@@ -14,7 +14,7 @@ class PlaylistAction extends CommonAction{
echo "{\"total\":\"".$total."\",\"rows\":".json_encode($list)."}"; echo "{\"total\":\"".$total."\",\"rows\":".json_encode($list)."}";
}else{ }else{
$spModel = D("Sp"); $spModel = D("Sp");
$sp_lists = $spModel->where("`status`=0")->select(); $sp_lists = $spModel->field("id,`name`")->where("`status`=0")->select();
$this->sp_lists = $sp_lists; $this->sp_lists = $sp_lists;
$this->display(); $this->display();
} }
...@@ -25,38 +25,41 @@ class PlaylistAction extends CommonAction{ ...@@ -25,38 +25,41 @@ class PlaylistAction extends CommonAction{
$userInfo = $_SESSION["_USER_INFO"]; $userInfo = $_SESSION["_USER_INFO"];
$id = I('id','',int)?I('id','',int):0; $id = I('id','',int)?I('id','',int):0;
$model = D("Hotel"); $model = D("SpPlaylist");
$spModel = D("Sp"); $spModel = D("Sp");
$regionModel = D("Region"); $mediaModel = D("Media");
if($id){ if($id){
$info =$model->where("id = $id")->find(); $info =$model->where("id = $id")->find();
$this->info = $info; $this->info = $info;
} }
$sp_lists = $spModel->where("`status`=0")->select(); $sp_lists = $spModel->field("id,`name`")->select();
$region_lists = $regionModel->where("pid = 1 and level = 2 and `status`=0")->select(); $media_lists = $mediaModel->field("id,title")->select();
$region_city_lists = $regionModel->where("pid > 1 and level = 3 and `status`=0")->select(); $play_lists = $model->join(" A join sh_sp_playlist_media_map B on A.id = B.playlist_id ")->field("A.id,A.`name`,A.sp_id,group_concat(B.media_id) media_ids")->group("A.id")->select();
$this->sp_lists = $sp_lists; $this->sp_lists = $sp_lists;
$this->region_lists = $region_lists; $this->media_lists = json_encode($media_lists);
$this->region_city_lists = $region_city_lists; $this->play_lists = $play_lists;
$this->display(); $this->display();
} }
//添加处理 //添加处理
public function addHandle(){ public function addHandle(){
$model = D("Hotel"); $model = D("SpPlaylist");
$mapModel = D("SpPlaylistMediaMap");
$id = I('id','',int); $id = I('id','',int);
$data['sp_id'] = I("sp_id"); $data['sp_id'] = I("sp_id");
$data['region_id'] = I("region_id");
$data['name'] = I("name"); $data['name'] = I("name");
$data['code'] = I("code");
$data['remark'] = I("remark"); $data['remark'] = I("remark");
$data['status'] = I("status"); $data['status'] = I("status");
$media_lists = I("post.media_lists");
if($id){ if($id){
$data['id'] = $id; $data['id'] = $id;
$data["updatetime"]=date('Y-m-d H:i:s'); $data["updatetime"]=date('Y-m-d H:i:s');
$r = $model->save($data); $r = $model->save($data);
if($r){ if($r){
echo 'true'; echo 'true';
}else{ }else{
...@@ -67,6 +70,13 @@ class PlaylistAction extends CommonAction{ ...@@ -67,6 +70,13 @@ class PlaylistAction extends CommonAction{
$id = $model->add($data); $id = $model->add($data);
if($id){ if($id){
$mapData = array();
foreach($media_lists as $key => $value){
$mapData[] = array("media_id"=>$value,"playlist_id"=>$id,"addtime"=>date('Y-m-d H:i:s'));
}
$r = $mapModel->addAll($mapData);
}
if($r){
echo 'true'; echo 'true';
}else{ }else{
echo 'false'; echo 'false';
...@@ -76,7 +86,11 @@ class PlaylistAction extends CommonAction{ ...@@ -76,7 +86,11 @@ class PlaylistAction extends CommonAction{
//删除处理 //删除处理
public function deleteHandle(){ public function deleteHandle(){
if(D("Hotel")->where("id=".I("id","",int))->delete()){ $model = D("SpPlaylist");
$data = $_POST;
$data['status'] = 2;
$data['updatetime'] = date('Y-m-d H:i:s');
if($model->save($data)){
echo 'true'; echo 'true';
}else{ }else{
echo 'false'; echo 'false';
...@@ -85,7 +99,7 @@ class PlaylistAction extends CommonAction{ ...@@ -85,7 +99,7 @@ class PlaylistAction extends CommonAction{
//ajax修改状态 //ajax修改状态
public function updateStatusAjaxHandle(){ public function updateStatusAjaxHandle(){
$model = D("Hotel"); $model = D("SpPlaylist");
$data = $_POST; $data = $_POST;
$data['updatetime'] = date('Y-m-d H:i:s'); $data['updatetime'] = date('Y-m-d H:i:s');
if($model->save($data)){ if($model->save($data)){
......
...@@ -10,12 +10,12 @@ class InjectModel extends RelationModel{ ...@@ -10,12 +10,12 @@ class InjectModel extends RelationModel{
if($inputs["sort"]) if($inputs["sort"])
$sort = "order by ".$inputs["sort"]." ".$inputs["order"]; $sort = "order by ".$inputs["sort"]." ".$inputs["order"];
//============= //=============
$searchField = $inputs["searchField"]?$inputs["searchField"]:'title'; $searchField = $inputs["searchField"]?$inputs["searchField"]:'name';
$searchValue = $inputs["searchValue"]?$inputs["searchValue"]:''; $searchValue = $inputs["searchValue"]?$inputs["searchValue"]:'';
$searchSp = $inputs["searchSp"]?$inputs["searchSp"]:0; $searchSp = $inputs["searchSp"]?$inputs["searchSp"]:0;
if($searchValue){ if($searchValue){
$where = " and (`title` like '%".$searchValue."%' or `code` like '%".$searchValue."%') "; $where = " and (`name` like '%".$searchValue."%') ";
} }
$model = new Model(); $model = new Model();
......
<?php
class SpPlaylistMediaMapModel extends RelationModel{
protected $tableName = 'sh_sp_playlist_media_map'; //重新定义表名
public function getList($queryType,$userInfo,$inputs){
$p=$inputs["page"]?$inputs["page"]:1;
$n=$inputs["rows"]?$inputs["rows"]:10;
$limit = "limit ".($p-1)*$n.",".$n;
$sort="";
if($inputs["sort"])
$sort = "order by ".$inputs["sort"]." ".$inputs["order"];
//=============
$searchField = $inputs["searchField"]?$inputs["searchField"]:'name';
$searchValue = $inputs["searchValue"]?$inputs["searchValue"]:'';
$searchSp = $inputs["searchSp"]?$inputs["searchSp"]:0;
if($searchValue){
$where = " and (A.`name` like '%".$searchValue."%') ";
}
if($searchSp){
$where = " and A.sp_id = $searchSp ";
}
$model = new Model();
//======================
$fields = "count(A.id) count";
//返回列表(limit分页)
if($queryType=="list"){
$where .= $sort." ".$limit;
$fields = " *,B.`name` sp_name,case A.`status` when 0 then '<font color=green>正常</font>' when 1 then '<font color=red>禁用</font>' when 2 then '<font color=red>删除</font>' end as `status` ";
}
$sql = "select ".$fields." from sh_sp_playlist A join sh_sp B on A.sp_id = B.id where 1=1 ".$where.";";
// echo $sql;
return $model->query($sql);
}
}
\ No newline at end of file
<?php
class SpPlaylistModel extends RelationModel{
protected $tableName = 'sh_sp_playlist'; //重新定义表名
public function getList($queryType,$userInfo,$inputs){
$p=$inputs["page"]?$inputs["page"]:1;
$n=$inputs["rows"]?$inputs["rows"]:10;
$limit = "limit ".($p-1)*$n.",".$n;
$sort="";
if($inputs["sort"])
$sort = "order by A.".$inputs["sort"]." ".$inputs["order"];
//=============
$searchField = $inputs["searchField"]?$inputs["searchField"]:'name';
$searchValue = $inputs["searchValue"]?$inputs["searchValue"]:'';
$searchSp = $inputs["searchSp"]?$inputs["searchSp"]:0;
if($searchValue){
$where = " and (A.`name` like '%".$searchValue."%') ";
}
if($searchSp){
$where = " and A.sp_id = $searchSp ";
}
$model = new Model();
//======================
$fields = "count(A.id) count";
//返回列表(limit分页)
if($queryType=="list"){
$where .= $sort." ".$limit;
$fields = " A.`name`,A.addtime,A.updatetime,B.`name` sp_name,case A.`status` when 0 then '<font color=green>正常</font>' when 1 then '<font color=red>禁用</font>' when 2 then '<font color=red>删除</font>' end as `status` ";
}
$sql = "select ".$fields." from sh_sp_playlist A join sh_sp B on A.sp_id = B.id where 1=1 ".$where.";";
// echo $sql;
return $model->query($sql);
}
}
\ No newline at end of file
...@@ -73,7 +73,9 @@ body{padding:20px} ...@@ -73,7 +73,9 @@ body{padding:20px}
<div class="col-sm-3"> <div class="col-sm-3">
<select class="form-control hidden" id="playlist"> <select class="form-control hidden" id="playlist">
<option value="0">请选择播单</option> <option value="0">请选择播单</option>
<option value="1" ids="1,2,3">播单1</option> <volist name="play_lists" id="item">
<option value="{$item.id}" ids="{$item.media_ids}" sp_id="{$item.sp_id}">{$item.name}</option>
</volist>
</select> </select>
</div> </div>
</div> </div>
...@@ -157,6 +159,10 @@ $().ready(function(){ ...@@ -157,6 +159,10 @@ $().ready(function(){
$("select[name='sp']").bind("change",function(){ $("select[name='sp']").bind("change",function(){
var spid = $(this).val(); var spid = $(this).val();
if(spid>0){ if(spid>0){
// $("#playlist option").addClass("hidden");
// $("#playlist option[value='0']").removeClass("hidden");
// $("#playlist option[sp_id='"+spid+"']").removeClass("hidden");
$("#multiselect option").addClass("hidden"); $("#multiselect option").addClass("hidden");
$("#multiselect option[sp_id='"+spid+"']").removeClass("hidden"); $("#multiselect option[sp_id='"+spid+"']").removeClass("hidden");
} }
...@@ -166,6 +172,9 @@ $().ready(function(){ ...@@ -166,6 +172,9 @@ $().ready(function(){
var tmp_val = $(this).val(); var tmp_val = $(this).val();
if(tmp_val=='playlist'){ if(tmp_val=='playlist'){
$("#playlist").removeClass("hidden"); $("#playlist").removeClass("hidden");
// $("#playlist option").addClass("hidden");
// $("#playlist option[value='0']").removeClass("hidden");
// $("#playlist option[sp_id='"+sp_id+"']").removeClass("hidden");
$("#multiselectMedia").empty(); $("#multiselectMedia").empty();
}else if(tmp_val=='cloud'){ }else if(tmp_val=='cloud'){
$("#playlist").addClass("hidden"); $("#playlist").addClass("hidden");
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<form name="searchform" method="post" action="" id ="searchform"> <form name="searchform" method="post" action="" id ="searchform">
<input type="hidden" name="op" value="getjson"> <input type="hidden" name="op" value="getjson">
<div class="inputBox"> <div class="inputBox">
<input class="input" type="text" placeholder="媒资名称/媒资唯一标识" name="searchValue"> <input class="input" type="text" placeholder="任务名称" name="searchValue">
</div> </div>
<input id="submit_search" name="" type="button" value="查询" class="btn_go_s btn_orange" /> <input id="submit_search" name="" type="button" value="查询" class="btn_go_s btn_orange" />
</form> </form>
......
...@@ -42,12 +42,12 @@ ...@@ -42,12 +42,12 @@
</form> </form>
</div><!--hyperchanne end--> </div><!--hyperchanne end-->
<div class=""> <div class="">
<ul class="operationBox"> <!-- <ul class="operationBox">
<li class="add"> <li class="add">
<a href="javascript:;" onclick="add()" class="on"><span></span>新增</a> <a href="javascript:;" onclick="add()" class="on"><span></span>新增</a>
</li> </li>
</ul> </ul>-->
</div><!--mainBox end--> </div><!--mainBox end-->
</div> </div>
</div> </div>
......
...@@ -8,9 +8,10 @@ ...@@ -8,9 +8,10 @@
<script type="text/javascript" src="__PUBLIC__/js/jquery-easyui-1.3.4/jquery.easyui.min.js"></script> <script type="text/javascript" src="__PUBLIC__/js/jquery-easyui-1.3.4/jquery.easyui.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/jquery-easyui-1.3.4/plugins/jquery.validatebox.extend.js"></script> <script type="text/javascript" src="__PUBLIC__/js/jquery-easyui-1.3.4/plugins/jquery.validatebox.extend.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/jquery-easyui-1.3.4/locale/easyui-lang-{$language}.js"></script> <script type="text/javascript" src="__PUBLIC__/js/jquery-easyui-1.3.4/locale/easyui-lang-{$language}.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/multiselect.min.js"></script>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/js/jquery-easyui-1.3.4/themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="__PUBLIC__/js/jquery-easyui-1.3.4/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/js/jquery-easyui-1.3.4/themes/icon.css"> <link rel="stylesheet" type="text/css" href="__PUBLIC__/js/jquery-easyui-1.3.4/themes/icon.css">
<link rel="stylesheet" href="__PUBLIC__/js/bootstrap3.3.7/bootstrap.min.css"> <link rel="stylesheet" href="__PUBLIC__/js/bootstrap3.3.7/css/bootstrap.min.css">
<style> <style>
body{padding:20px} body{padding:20px}
</style> </style>
...@@ -19,8 +20,14 @@ body{padding:20px} ...@@ -19,8 +20,14 @@ body{padding:20px}
<form class="form-horizontal" role="form" id="ff" action="{:U('/Media/Playlist/addHandle')}" method="POST"> <form class="form-horizontal" role="form" id="ff" action="{:U('/Media/Playlist/addHandle')}" method="POST">
<input name="id" type="hidden" value="{$info.id}"/> <input name="id" type="hidden" value="{$info.id}"/>
<div class="form-group"> <div class="form-group">
<label for="name" class="col-sm-2 control-label">选择合作方</label> <label for="inputEmail3" class="col-sm-2 control-label">播单名称</label>
<div class="col-sm-6" name="type"> <div class="col-sm-6">
<input type="text" class="form-control" id="inputEmail3" placeholder="请输入播单名称" value="{$info.name}" name="name">
</div>
</div>
<div class="form-group">
<label for="name" class="col-sm-2 control-label">合作方</label>
<div class="col-sm-3">
<select class="form-control" name="sp_id"> <select class="form-control" name="sp_id">
<option value="0">请选择合作方</option> <option value="0">请选择合作方</option>
<volist name="sp_lists" id="item"> <volist name="sp_lists" id="item">
...@@ -30,34 +37,43 @@ body{padding:20px} ...@@ -30,34 +37,43 @@ body{padding:20px}
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="name" class="col-sm-2 control-label">选择区域</label> <label for="name" class="col-sm-2 control-label">媒资来源</label>
<div class="col-sm-3"> <div class="col-sm-3">
<select class="form-control" id="province_select"> <select class="form-control" id="laiyuan">
<option value="0">请选择省份</option> <option value="0">请选择媒资来源</option>
<volist name="region_lists" id="item"> <option value="cloud">云端片库</option>
<option value="{$item.id}">{$item.name}</option> <option value="playlist">播单</option>
</volist>
</select> </select>
</div> </div>
<div class="col-sm-3"> <div class="col-sm-3">
<select class="form-control" id="city_select" name="region_id"> <select class="form-control hidden" id="playlist">
<option value="0">请选择城市</option> <option value="0">请选择播单</option>
<volist name="region_city_lists" id="item"> <volist name="play_lists" id="item">
<option value="{$item.id}" class="hidden" pid="{$item.pid}">{$item.name}</option> <option value="{$item.id}" ids="{$item.media_ids}" sp_id="{$item.sp_id}">{$item.name}</option>
</volist> </volist>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">酒店名称</label> <label for="name" class="col-sm-2 control-label"></label>
<div class="col-sm-6"> <div class="col-sm-4">
<input type="text" class="form-control" id="inputEmail3" placeholder="请输入酒店名称" value="{$info.name}" name="name"> <label class="control-label col-sm-3" for="multiselectMedia">未选择</label>
<select id="multiselectMedia" class="form-control" size="8" multiple="multiple" style="height:160px">
</select>
</div> </div>
<div class="col-sm-1">
<br/>
<br/>
<button type="button" id="multiselectMedia_rightAll" class="btn btn-block"><i class="glyphicon glyphicon-forward"></i></button>
<button type="button" id="multiselectMedia_rightSelected" class="btn btn-block"><i class="glyphicon glyphicon-chevron-right"></i></button>
<button type="button" id="multiselectMedia_leftSelected" class="btn btn-block"><i class="glyphicon glyphicon-chevron-left"></i></button>
<button type="button" id="multiselectMedia_leftAll" class="btn btn-block"><i class="glyphicon glyphicon-backward"></i></button>
</div> </div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">合作方酒店标识</label> <div class="col-sm-4">
<div class="col-sm-6"> <label class="control-label col-sm-4" for="multiselectMedia">已选择媒资</label>
<input type="text" class="form-control" id="inputEmail3" placeholder="请输入合作方酒店标识" name="code" value="{$info.code}"> <select id="multiselectMedia_to" class="form-control" size="8" multiple="multiple" name="media_lists[]" style="height:160px"></select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
...@@ -66,41 +82,27 @@ body{padding:20px} ...@@ -66,41 +82,27 @@ body{padding:20px}
<textarea class="form-control" rows="3" name="remark">{$info.remark}</textarea> <textarea class="form-control" rows="3" name="remark">{$info.remark}</textarea>
</div> </div>
</div> </div>
<div class="form-group">
<label for="inputPassword3" class="col-sm-2 control-label">状态</label>
<div class="col-sm-9">
<label class="radio-inline">
<input type="radio" name="status" id="optionsRadios4" value="1"> 禁用
</label>
<label class="radio-inline">
<input type="radio" name="status" id="optionsRadios4" value="0" checked="checked"> 启用
</label>
</div>
</div>
<div class="btnMedia col-sm-5 control-label"> <div class="btnMedia col-sm-5 control-label">
<input name="" type="button" class="btn btn-success" value="确定" onclick="submitForm()" {:buttonAuth('Media','Playlist','addhandle')}/>   <input name="" type="button" class="btn btn-success" value="确定" onclick="submitForm()" {:buttonAuth('Media','Playlist','addhandle')}/>  
<input name="" type="reset" class="btn btn-warning" value="取消" onclick="parentDialog.close();"/>   <input name="" type="reset" class="btn btn-warning" value="取消" onclick="parentDialog.close();"/>  
</div> </div>
</form> </form>
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function($) {
$('#multiselectMedia').multiselect({
//keepRenderingSort:true,
});
});
</script>
<script type="text/javascript">
function submitForm(){ function submitForm(){
var sp_id = $("select[name='sp_id'] option:selected").val();
var region_id = $("select[name='region_id'] option:selected").val();
var name_v = $("input[name='name']").val(); var name_v = $("input[name='name']").val();
var code_v = $("input[name='code']").val();
if(sp_id==0){
alert("请选择合作方");return;
}
if(region_id==0){
alert("请选择省份/城市");return;
}
if(!name_v){ if(!name_v){
alert("请输入酒店名称");return; alert("请输入播单名称");return;
}
if(!code_v){
alert("请输入合作方酒店标识");return;
} }
$("select[name='media_lists[]'] option").prop("selected",true);
$('#ff').form('submit', { $('#ff').form('submit', {
url:'/Media/Playlist/addHandle/', url:'/Media/Playlist/addHandle/',
onSubmit: function(){ onSubmit: function(){
...@@ -122,22 +124,58 @@ function submitForm(){ ...@@ -122,22 +124,58 @@ function submitForm(){
}); });
} }
$().ready(function(){ $().ready(function(){
$("select[id='province_select']").bind("change",function(){ var media_json = '{$media_lists}';
var province_id = $(this).val(); $("select[name='sp_id']").bind("change",function(){
$("select[name='region_id'] option").addClass("hidden"); var spid = $(this).val();
$("select[name='region_id'] option[value='0']").removeClass("hidden"); if(spid>0){
$("select[name='region_id'] option:first").prop("selected","selected"); $("#playlist option").addClass("hidden");
$("select[name='region_id'] option[pid='"+province_id+"']").removeClass("hidden"); $("#playlist option[value='0']").removeClass("hidden");
$("#playlist option[sp_id='"+spid+"']").removeClass("hidden");
$("#multiselect option").addClass("hidden");
$("#multiselect option[sp_id='"+spid+"']").removeClass("hidden");
}
}); });
<if condition="$info"> $("#laiyuan").bind("change",function(){
$("select[name='sp_id'] option[value='{$info.sp_id}']").attr("selected",true); var tmp_val = $(this).val();
var province_id = $("select[name='region_id'] option[value='{$info.region_id}']").attr("pid"); var sp_id = $("select[name='sp_id'] option:selected").val();
$("select[name='region_id'] option[pid='"+province_id+"']").removeClass("hidden"); if(tmp_val=='playlist'){
$("select[id='province_select'] option[value='"+province_id+"']").attr("selected",true); $("#playlist").removeClass("hidden");
$("select[name='region_id'] option[value='{$info.region_id}']").attr("selected",true); $("#playlist option").addClass("hidden");
$("input[name='status'][value='{$info.status}']").attr("checked",true); $("#playlist option[value='0']").removeClass("hidden");
</if> $("#playlist option[sp_id='"+sp_id+"']").removeClass("hidden");
$("#multiselectMedia").empty();
}else if(tmp_val=='cloud'){
$("#playlist").addClass("hidden");
$("#multiselectMedia").empty();
$.each(eval(media_json),function(i,item){
if($("select[name='media_lists[]'] option[value='"+item.id+"']").length==0){
$("#multiselectMedia").append("<option value='"+item.id+"'>"+item.title+"</option>");
}
});
}else{
$("#playlist").addClass("hidden");
$("#multiselectMedia").empty();
}
});
$("#playlist").bind("change",function(){
var tmp_val = $(this).val();
var tmp_ids = $(this).find("option:selected").attr("ids");
$("#multiselectMedia").empty();
if(tmp_val>0){
var tmp_ids_arr = tmp_ids.split(",");
$.each(eval(media_json),function(i,item){
//console.log(tmp_ids_arr.indexOf(item.id));
if(tmp_ids_arr.indexOf(item.id)>=0){
if($("select[name='media_lists[]'] option[value='"+item.id+"']").length==0){
$("#multiselectMedia").append("<option value='"+item.id+"'>"+item.title+"</option>");
}
}
});
}
});
}); });
</script> </script>
</body> </body>
......
...@@ -24,16 +24,13 @@ ...@@ -24,16 +24,13 @@
<form name="searchform" method="post" action="" id ="searchform"> <form name="searchform" method="post" action="" id ="searchform">
<input type="hidden" name="op" value="getjson"> <input type="hidden" name="op" value="getjson">
<div class="inputBox"> <div class="inputBox">
<select class="select" name="searchType"> <select class="select" name="searchSp">
<option value="0">合作方</option> <option value="0">合作方</option>
<volist name="sp_lists" id="item"> <volist name="sp_lists" id="item">
<option value="{$item.id}">{$item.name}</option> <option value="{$item.id}">{$item.name}</option>
</volist> </volist>
</select> </select>
<select class="select" name="searchRegion"> <input class="input" type="text" placeholder="播单名称" name="searchValue">
<option value="0">区域</option>
</select>
<input class="input" type="text" placeholder="酒店名称/合作方酒店标识" name="searchValue">
</div> </div>
<input id="submit_search" name="" type="button" value="查询" class="btn_go_s btn_orange" /> <input id="submit_search" name="" type="button" value="查询" class="btn_go_s btn_orange" />
</form> </form>
...@@ -68,11 +65,8 @@ onRowContextMenu : onRowContextMenu ...@@ -68,11 +65,8 @@ onRowContextMenu : onRowContextMenu
"> ">
<thead> <thead>
<tr> <tr>
<th data-options="field:'name',width:30">酒店名称</th> <th data-options="field:'name',width:30">播单名称</th>
<th data-options="field:'sp_name',width:20" sortable="true">合作方</th> <th data-options="field:'sp_name',width:20" sortable="true">合作方</th>
<th data-options="field:'region_name',width:30" sortable="true">区域</th>
<th data-options="field:'code',width:20">合作方酒店标识</th>
<th data-options="field:'remark',width:40">备注</th>
<th data-options="field:'addtime',width:30" sortable="true">创建时间</th> <th data-options="field:'addtime',width:30" sortable="true">创建时间</th>
<th data-options="field:'updatetime',width:30" sortable="true">更新时间</th> <th data-options="field:'updatetime',width:30" sortable="true">更新时间</th>
<th data-options="field:'status'" sortable="true" align="center">状态</th> <th data-options="field:'status'" sortable="true" align="center">状态</th>
...@@ -83,14 +77,14 @@ onRowContextMenu : onRowContextMenu ...@@ -83,14 +77,14 @@ onRowContextMenu : onRowContextMenu
<div id="mm1" class="easyui-menu" style="width:120px;display: none"> <div id="mm1" class="easyui-menu" style="width:120px;display: none">
<div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('Media','Playlist','add')}>编辑</div> <div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('Media','Playlist','add')}>编辑</div>
<div iconCls="icon-cancel" id="menuDel" onclick="del()" {:buttonAuth('Media','Playlist','deletehandle')}>删除</div> <div iconCls="icon-cancel" id="menuDel" onclick="enable(2)" {:buttonAuth('Media','Playlist','deletehandle')}>删除</div>
<div class="menu-sep"></div> <div class="menu-sep"></div>
<div iconCls="icon-stop" id="menuStop" onclick="enable(1)" {:buttonAuth('Media','Playlist','updateStatusAjaxHandle')}>禁用</div> <div iconCls="icon-stop" id="menuStop" onclick="enable(1)" {:buttonAuth('Media','Playlist','updateStatusAjaxHandle')}>禁用</div>
<div iconCls="icon-start" id="menuStart" onclick="enable(0)" {:buttonAuth('Media','Playlist','updateStatusAjaxHandle')}>启用</div> <div iconCls="icon-start" id="menuStart" onclick="enable(0)" {:buttonAuth('Media','Playlist','updateStatusAjaxHandle')}>启用</div>
</div> </div>
<div id="mm2" class="easyui-menu" style="width:120px;display: none"> <div id="mm2" class="easyui-menu" style="width:120px;display: none">
<div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('Media','Playlist','add')}>编辑</div> <div iconCls="icon-edit" id="menuEdit" onclick="edit()" {:buttonAuth('Media','Playlist','add')}>编辑</div>
<div iconCls="icon-cancel" id="menuDel" onclick="del()" {:buttonAuth('Media','Playlist','deletehandle')}>删除</div> <div iconCls="icon-cancel" id="menuDel" onclick="enable(2)" {:buttonAuth('Media','Playlist','deletehandle')}>删除</div>
<div class="menu-sep"></div> <div class="menu-sep"></div>
<div iconCls="icon-stop" id="menuStop" onclick="enable(1)" {:buttonAuth('Media','Playlist','updateStatusAjaxHandle')}>禁用</div> <div iconCls="icon-stop" id="menuStop" onclick="enable(1)" {:buttonAuth('Media','Playlist','updateStatusAjaxHandle')}>禁用</div>
<div iconCls="icon-start" id="menuStart" onclick="enable(0)" {:buttonAuth('Media','Playlist','updateStatusAjaxHandle')}>启用</div> <div iconCls="icon-start" id="menuStart" onclick="enable(0)" {:buttonAuth('Media','Playlist','updateStatusAjaxHandle')}>启用</div>
...@@ -131,6 +125,8 @@ function enable(status){ ...@@ -131,6 +125,8 @@ function enable(status){
var msg='启用'; var msg='启用';
if(status==1) if(status==1)
msg='禁用' msg='禁用'
else if(status==2)
msg='删除'
$.messager.confirm('操作确认', '确认['+msg+']该记录?', function(r){ $.messager.confirm('操作确认', '确认['+msg+']该记录?', function(r){
if (r){ if (r){
$.post("/Media/Playlist/updateStatusAjaxHandle/", {id:row.id,status:status}, $.post("/Media/Playlist/updateStatusAjaxHandle/", {id:row.id,status:status},
...@@ -144,12 +140,12 @@ function enable(status){ ...@@ -144,12 +140,12 @@ function enable(status){
} }
} }
function add(){ function add(){
pop(800,450,true,'dg','datagrid','/Media/Playlist/add/') pop('80%',600,true,'dg','datagrid','/Media/Playlist/add/')
} }
function edit(){ function edit(){
var row = $('#dg').datagrid('getSelected'); var row = $('#dg').datagrid('getSelected');
if (row){ if (row){
pop(800,450,true,'dg','datagrid','/Media/Playlist/add/id/'+row.id); pop('80%',600,true,'dg','datagrid','/Media/Playlist/add/id/'+row.id);
}else{ }else{
$.messager.alert('提示', '请选择要操作的记录!','info'); $.messager.alert('提示', '请选择要操作的记录!','info');
} }
......
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