You've already forked guangan
UserShare
This commit is contained in:
@ -80,14 +80,36 @@ class UserShare extends Controller
|
||||
'type_id.require' => '类型不能为空',
|
||||
'user_id.require' => '请选择处理人员',
|
||||
]);
|
||||
$ticket = TicketTicket::mk()->create([
|
||||
'source_type' => 1,
|
||||
'type_id' => $data['type_id'],
|
||||
'user_type' => 'user',
|
||||
'user_id' => $userShare->user_id,
|
||||
'current_admin_id' => $data['user_id'],
|
||||
'title' => $userShare->title,
|
||||
'content' => $userShare->content,
|
||||
'ticket_region' => $userShare->ticket_region,
|
||||
'ticket_address' => $userShare->ticket_address,
|
||||
'contact_name' => $userShare->contact_name,
|
||||
'contact_phone' => $userShare->contact_phone,
|
||||
'lat' => $userShare->lat,
|
||||
'lng' => $userShare->lng,
|
||||
'imgs' => $userShare->imgs,
|
||||
'status' => 0,
|
||||
]);
|
||||
$ticket->source = $userShare;
|
||||
$ticket->save();
|
||||
$ticket_id = $ticket->id;
|
||||
break;
|
||||
case 'exist':
|
||||
$data = $this->_vali([
|
||||
'ticket_id.require' => '请选择处理工单',
|
||||
]);
|
||||
$ticket_id = $data['ticket_id'];
|
||||
$ticket = TicketTicket::mk()->where(['id' => $data['ticket_id']])->findOrEmpty();
|
||||
if ($ticket->isEmpty()) $this->error('工单不存在!');
|
||||
$ticket_id = $data['ticket_id'];
|
||||
$ticket->source = $userShare;
|
||||
$ticket->save();
|
||||
break;
|
||||
default:
|
||||
$this->error('参数错误');
|
||||
@ -98,5 +120,6 @@ class UserShare extends Controller
|
||||
UserPointService::addUserPoint($userShare->user_id, $basic_data['point_aware'], '用户随手拍奖励积分');
|
||||
$userShare->status = 1;
|
||||
$userShare->save();
|
||||
$this->success('处理成功!');
|
||||
}
|
||||
}
|
@ -22,11 +22,6 @@ class TicketTicket extends Model
|
||||
return $this->hasMany(TicketReply::class, 'ticket_id')->order("create_at", 'asc');
|
||||
}
|
||||
|
||||
public function source()
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
public function getImgsArrAttr($value, $data)
|
||||
{
|
||||
return str2arr($data['imgs'] ?: '', '|');
|
||||
@ -37,6 +32,24 @@ class TicketTicket extends Model
|
||||
return $this->reply()->order('create_at', 'desc')->find();
|
||||
}
|
||||
|
||||
public function getSourceTypeNameAttr($value, $data)
|
||||
{
|
||||
if (!empty($this->getSourceTypeList()[$data['source_type']])) {
|
||||
return $this->getSourceTypeList()[$data['source_type']];
|
||||
} else {
|
||||
return '未知';
|
||||
}
|
||||
}
|
||||
|
||||
public function getSourceTypeList()
|
||||
{
|
||||
return [
|
||||
0 => '其他',
|
||||
1 => '用户随手拍',
|
||||
2 => '工单',
|
||||
];
|
||||
}
|
||||
|
||||
public function getTypeNameAttr($value, $data)
|
||||
{
|
||||
$type = $this->type()->find();
|
||||
|
@ -113,11 +113,11 @@
|
||||
<tbody class="layui-table-body">
|
||||
<tr>
|
||||
<td style="width: 120px">工单编号</td>
|
||||
<td>{$vo.ticket.id|default=""}</td>
|
||||
<td>{$vo.linked_ticket.id|default=""}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>工单类型</td>
|
||||
<td>{$vo.ticket.type_name|default=""}</td>
|
||||
<td>{$vo.linked_ticket.type_name|default=""}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -165,7 +165,7 @@
|
||||
<div class="layui-form-item new_ticket">
|
||||
<label class="layui-form-label">工单类型</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="type_id" lay-verify="required">
|
||||
<select name="type_id">
|
||||
<option value="">请选择工单类型</option>
|
||||
{foreach $type_list as $type}
|
||||
<option value="{$type.id}">{$type.name}</option>
|
||||
@ -240,8 +240,9 @@
|
||||
}
|
||||
console.log(data)
|
||||
$.post("{:url('link')}", field, function (res) {
|
||||
if (res.code === 0) {
|
||||
if (res.code === 1) {
|
||||
layer.msg(res.info, {icon: 1, time: 1500}, function () {
|
||||
layer.closeAll();
|
||||
window.location.reload();
|
||||
});
|
||||
} else {
|
||||
@ -249,7 +250,7 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
return true;
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@ -42,7 +42,13 @@
|
||||
// {field:'title', title:'标题', width:160},
|
||||
{field:'type_name', title:'工单类型', width:120},
|
||||
{field:'content', title:'随手拍内容', minWidth:100},
|
||||
{field:'ticket_address', title:'随手拍地址', width:100},
|
||||
{field:'ticket_address', title:'随手拍地址', width:200, templet:function(item){
|
||||
if (item.ticket_address) {
|
||||
return `${item.ticket_region} ${item.ticket_address}`;
|
||||
} else {
|
||||
return '未填写地址';
|
||||
}
|
||||
}},
|
||||
{field: 'imgs', title: '随手拍图片', width: 100, templet:function(item){
|
||||
if (item.imgs) {
|
||||
return item.imgs.split("|").map((img) => {
|
||||
|
Reference in New Issue
Block a user