|
@@ -29,12 +29,14 @@
|
|
|
<div class="row">
|
|
<div class="row">
|
|
|
<label class="col-12">日志</label>
|
|
<label class="col-12">日志</label>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="row text-secondary">
|
|
|
|
|
- <label class="col-2">状态</label>
|
|
|
|
|
- <label class="col-2">操作者</label>
|
|
|
|
|
- <label class="col-4">说明</label>
|
|
|
|
|
- <label class="col-3">操作时间</label>
|
|
|
|
|
- <label class="col-1"></label>
|
|
|
|
|
|
|
+ <div class="row">
|
|
|
|
|
+ <div class="row text-secondary offset-1 col-11">
|
|
|
|
|
+ <label class="col-4">说明</label>
|
|
|
|
|
+ <label class="col-2">状态</label>
|
|
|
|
|
+ <label class="col-2">操作者</label>
|
|
|
|
|
+ <label class="col-3">操作时间</label>
|
|
|
|
|
+ <label class="col-1"></label>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</th>
|
|
</th>
|
|
|
<th>合同</th>
|
|
<th>合同</th>
|
|
@@ -52,33 +54,50 @@
|
|
|
<td>@{{ customer.phone }}</td>
|
|
<td>@{{ customer.phone }}</td>
|
|
|
<td>@{{ customer.remark }}</td>
|
|
<td>@{{ customer.remark }}</td>
|
|
|
<td>
|
|
<td>
|
|
|
- <div class="row text-center mb-0" v-if="customer.customer_logs.length > 0">
|
|
|
|
|
- <div class="col-2">@{{ customer.customer_logs[0].status ? customer.customer_logs[0].status.name : '' }}</div>
|
|
|
|
|
- <div class="col-2">@{{ customer.customer_logs[0].user ? customer.customer_logs[0].user.name : '' }}</div>
|
|
|
|
|
- <label v-if="editCustomer == customer.id">
|
|
|
|
|
- <textarea @blur="editLog(i,$event)" class="form-control form-control-sm">@{{ customer.customer_logs[0].description }}</textarea>
|
|
|
|
|
- </label>
|
|
|
|
|
- <div v-if="editCustomer != customer.id" @click="edit(i,customer.customer_logs[0].user)" @mouseenter="textClass($event,true)" @mouseleave="textClass($event,false)" class="col-4">
|
|
|
|
|
- <div class="text-overflow-replace cursor-pointer">@{{ customer.customer_logs[0].description }}</div>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="col-3">@{{ customer.customer_logs[0].created_at }}</div>
|
|
|
|
|
- @can("客户-编辑")<div class="col-1 font-weight-bold text-danger h4 cursor-pointer" @click="delLog(i,0)">×</div>@endcan
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="w-100 up" :id="'log-'+customer.id">
|
|
|
|
|
- <div class="text-center mb-0 row" v-for="(log,j) in customer.customer_logs" v-if="j!==0">
|
|
|
|
|
- <div class="col-2">@{{ log.status ? log.status.name : '' }}</div>
|
|
|
|
|
- <div class="col-2">@{{ log.user ? log.user.name : '' }}</div>
|
|
|
|
|
- <div @mouseenter="textClass($event,true)" @mouseleave="textClass($event,false)" class="col-4"><div class="text-overflow-replace cursor-pointer">@{{ log.description }}</div></div>
|
|
|
|
|
- <div class="col-3">@{{ log.created_at }}</div>
|
|
|
|
|
- @can("客户-编辑")<div class="col-1 font-weight-bold text-danger h4 cursor-pointer" @click="delLog(i,j)">×</div>@endcan
|
|
|
|
|
|
|
+ <div class="bg-white row">
|
|
|
|
|
+ <div class="col-1"><button class="btn btn-sm btn-outline-info" @click="addCustomerLog(i)">添加</button></div>
|
|
|
|
|
+ <div class="col-11">
|
|
|
|
|
+ <div class="w-100">
|
|
|
|
|
+ <div class="text-center mb-0 row" v-for="(log,j) in customer.customer_logs" v-if="j<2">
|
|
|
|
|
+ <div @mouseenter="textClass($event,true)" @mouseleave="textClass($event,false)" class="col-4">
|
|
|
|
|
+ <div class="text-overflow-replace cursor-pointer text-secondary" v-if="log.id && (editCustomer!=customer.id || j!=0)" @click="edit(i,log.user)">
|
|
|
|
|
+ @{{ log.description }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <label v-if="!log.id">
|
|
|
|
|
+ <textarea class="form-control form-control-sm" @blur="addLog(i,log)" v-model="log.description"></textarea>
|
|
|
|
|
+ </label>
|
|
|
|
|
+ <label v-if="editCustomer == customer.id && j==0">
|
|
|
|
|
+ <textarea @blur="editLog(i,$event)" class="form-control form-control-sm">@{{ log.description }}</textarea>
|
|
|
|
|
+ </label>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="col-2">
|
|
|
|
|
+ <span v-if="log.id">@{{ log.status ? log.status.name : '' }}</span>
|
|
|
|
|
+ <label v-else><select class="form-control form-control-sm" @blur="addLog(i,log)" v-model="log.status">
|
|
|
|
|
+ <option v-for="status in logStatuses" :value="status.id">@{{ status.name }}</option>
|
|
|
|
|
+ </select></label>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="col-2">@{{ log.user ? log.user.name : '' }}</div>
|
|
|
|
|
+ <div class="col-3">@{{ log.created_at }}</div>
|
|
|
|
|
+ @can("客户-编辑")<div class="col-1 font-weight-bold text-danger h4 cursor-pointer" @click="delLog(i,j)">×</div>@endcan
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="w-100 up" :id="'log-'+customer.id">
|
|
|
|
|
+ <div class="text-center mb-0 row" v-for="(log,j) in customer.customer_logs" v-if="j>1">
|
|
|
|
|
+ <div @mouseenter="textClass($event,true)" @mouseleave="textClass($event,false)" class="col-4"><div class="text-overflow-replace cursor-pointer text-secondary">@{{ log.description }}</div></div>
|
|
|
|
|
+ <div class="col-2">@{{ log.status ? log.status.name : '' }}</div>
|
|
|
|
|
+ <div class="col-2">@{{ log.user ? log.user.name : '' }}</div>
|
|
|
|
|
+ <div class="col-3">@{{ log.created_at }}</div>
|
|
|
|
|
+ @can("客户-编辑")<div class="col-1 font-weight-bold text-danger h4 cursor-pointer" @click="delLog(i,j)">×</div>@endcan
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="row" @click="showLog(i)" v-if="customer.customer_logs.length > 2">
|
|
|
|
|
+ <label class="text-center mt-0 p-0 cursor-pointer offset-5">
|
|
|
|
|
+ <span class="fa" :class="customer.isShowLog ? 'fa-angle-double-down' : 'fa-angle-double-right'"></span>
|
|
|
|
|
+ <span v-if="customer.isShowLog">收起</span><span v-if="!customer.isShowLog">展开</span> @{{ customer.customer_logs.length }} 条日志
|
|
|
|
|
+ </label>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="row" @click="showLog(i)">
|
|
|
|
|
- <label class="text-center mt-0 p-0 cursor-pointer offset-5">
|
|
|
|
|
- <span class="fa" :class="customer.isShowLog ? 'fa-angle-double-down' : 'fa-angle-double-right'"></span>
|
|
|
|
|
- <span v-if="customer.isShowLog">收起</span><span v-if="!customer.isShowLog">展开</span> @{{ customer.customer_logs.length }} 条日志
|
|
|
|
|
- </label>
|
|
|
|
|
- </div>
|
|
|
|
|
</td>
|
|
</td>
|
|
|
<td v-if="customer.contractQuantity>0" class="cursor-pointer" @click="showContract(customer.id)"><span class="fa" :class="contractIds['_'+customer.id] === true ? 'fa-angle-double-down' : 'fa-angle-double-right'"></span>@{{ customer.contractQuantity }}份合同</td>
|
|
<td v-if="customer.contractQuantity>0" class="cursor-pointer" @click="showContract(customer.id)"><span class="fa" :class="contractIds['_'+customer.id] === true ? 'fa-angle-double-down' : 'fa-angle-double-right'"></span>@{{ customer.contractQuantity }}份合同</td>
|
|
|
<td v-else>#</td>
|
|
<td v-else>#</td>
|
|
@@ -99,7 +118,6 @@
|
|
|
</td>
|
|
</td>
|
|
|
<td>
|
|
<td>
|
|
|
@can("客户-编辑")
|
|
@can("客户-编辑")
|
|
|
- <button class="btn btn-sm btn-outline-info" @click="showCustomerLog(i)">新建日志</button>
|
|
|
|
|
<button class="btn btn-sm btn-outline-success" @click="addContract(i)">新建合同</button>
|
|
<button class="btn btn-sm btn-outline-success" @click="addContract(i)">新建合同</button>
|
|
|
<button v-if="!tagIndexes[i]" class="btn btn-sm btn-info text-white" @click="setTag(i)">设定标签</button>
|
|
<button v-if="!tagIndexes[i]" class="btn btn-sm btn-info text-white" @click="setTag(i)">设定标签</button>
|
|
|
<button class="btn btn-sm btn-outline-primary" @click="relatedOwner(i)">关联项目</button>
|
|
<button class="btn btn-sm btn-outline-primary" @click="relatedOwner(i)">关联项目</button>
|
|
@@ -120,7 +138,6 @@
|
|
|
el:"#container",
|
|
el:"#container",
|
|
|
data:{
|
|
data:{
|
|
|
customers : {!! $customers->toJson() !!}['data'],
|
|
customers : {!! $customers->toJson() !!}['data'],
|
|
|
- customerLogs : [],
|
|
|
|
|
index:'',
|
|
index:'',
|
|
|
logStatuses:null,
|
|
logStatuses:null,
|
|
|
contractIds:[],
|
|
contractIds:[],
|
|
@@ -146,7 +163,6 @@
|
|
|
this._formatOwner();
|
|
this._formatOwner();
|
|
|
$(".up").slideUp();
|
|
$(".up").slideUp();
|
|
|
$('#container').removeClass('d-none');
|
|
$('#container').removeClass('d-none');
|
|
|
- console.log(this.customers[0].customer_logs);
|
|
|
|
|
this.rendering();
|
|
this.rendering();
|
|
|
let data=[
|
|
let data=[
|
|
|
[
|
|
[
|
|
@@ -166,7 +182,7 @@
|
|
|
textClass(event,isOver){
|
|
textClass(event,isOver){
|
|
|
event = event.target.children[0];
|
|
event = event.target.children[0];
|
|
|
if (isOver) event.className = "text-overflow-warp";
|
|
if (isOver) event.className = "text-overflow-warp";
|
|
|
- else event.className = "cursor-pointer text-overflow-replace";
|
|
|
|
|
|
|
+ else event.className = "cursor-pointer text-overflow-replace text-secondary";
|
|
|
},
|
|
},
|
|
|
editLog(customer_index,event){
|
|
editLog(customer_index,event){
|
|
|
let description = event.target.value;
|
|
let description = event.target.value;
|
|
@@ -196,6 +212,10 @@
|
|
|
},
|
|
},
|
|
|
delLog(customer_index,log_index){
|
|
delLog(customer_index,log_index){
|
|
|
let id = this.customers[customer_index].customer_logs[log_index].id;
|
|
let id = this.customers[customer_index].customer_logs[log_index].id;
|
|
|
|
|
+ if (!id){
|
|
|
|
|
+ this.$delete(this.customers[customer_index].customer_logs,log_index);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
window.tempTip.confirm("确定要删除该条日志吗?",()=>{
|
|
window.tempTip.confirm("确定要删除该条日志吗?",()=>{
|
|
|
window.tempTip.postBasicRequest("{{url('customer/customer/destroyLog')}}",{id:id},res=>{
|
|
window.tempTip.postBasicRequest("{{url('customer/customer/destroyLog')}}",{id:id},res=>{
|
|
|
this.$delete(this.customers[customer_index].customer_logs,log_index);
|
|
this.$delete(this.customers[customer_index].customer_logs,log_index);
|
|
@@ -303,12 +323,16 @@
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- showCustomerLog(index){
|
|
|
|
|
|
|
+ addCustomerLog(index){
|
|
|
|
|
+ if (this.customers[index].customer_logs[0] && !this.customers[index].customer_logs[0].id)return;
|
|
|
if (!this.logStatuses)window.tempTip.postBasicRequest("{{url('customer/customer/getLogStatus')}}",{},(res)=>{
|
|
if (!this.logStatuses)window.tempTip.postBasicRequest("{{url('customer/customer/getLogStatus')}}",{},(res)=>{
|
|
|
this.logStatuses = res;
|
|
this.logStatuses = res;
|
|
|
},true);
|
|
},true);
|
|
|
- this.addCustomerLogIndex = index;
|
|
|
|
|
- $("#modal").modal('show');
|
|
|
|
|
|
|
+ this.customers[index].customer_logs.unshift({
|
|
|
|
|
+ id:"",
|
|
|
|
|
+ status:"",
|
|
|
|
|
+ description:"",
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
edit(index,user){
|
|
edit(index,user){
|
|
|
if (!user)return;
|
|
if (!user)return;
|
|
@@ -316,14 +340,12 @@
|
|
|
if (id != user.id) return;
|
|
if (id != user.id) return;
|
|
|
this.editCustomer = this.customers[index].id;
|
|
this.editCustomer = this.customers[index].id;
|
|
|
},
|
|
},
|
|
|
- addLog(){
|
|
|
|
|
- let description = $("#description")[0].value;
|
|
|
|
|
- let logStatus = $("#status")[0].value;
|
|
|
|
|
|
|
+ addLog(index,log){
|
|
|
|
|
+ if (!log.description || !log.status)return;
|
|
|
let url="{{url('customer/customer/storeLog')}}";
|
|
let url="{{url('customer/customer/storeLog')}}";
|
|
|
- let params = {customer_id:this.customers[this.addCustomerLogIndex].id,description:description,customer_log_status_id:logStatus};
|
|
|
|
|
|
|
+ let params = {customer_id:this.customers[index].id,description:log.description,customer_log_status_id:log.status};
|
|
|
window.tempTip.postBasicRequest(url,params,(res)=>{
|
|
window.tempTip.postBasicRequest(url,params,(res)=>{
|
|
|
- this.customers[this.addCustomerLogIndex].customer_logs.unshift(res);
|
|
|
|
|
- console.log(this.customers[this.addCustomerLogIndex].customer_logs);
|
|
|
|
|
|
|
+ this.customers[index].customer_logs[0] = res;
|
|
|
this.$forceUpdate();
|
|
this.$forceUpdate();
|
|
|
$("#modal").modal('hide');
|
|
$("#modal").modal('hide');
|
|
|
return "成功创建客户日志";
|
|
return "成功创建客户日志";
|