diff --git a/plugs/think-plugs-ticket/src/controller/Repair.php b/plugs/think-plugs-ticket/src/controller/Repair.php index 0a6df9f..9e30e02 100644 --- a/plugs/think-plugs-ticket/src/controller/Repair.php +++ b/plugs/think-plugs-ticket/src/controller/Repair.php @@ -3,6 +3,7 @@ namespace plugin\ticket\controller; use plugin\ticket\model\TicketRepair; +use plugin\ticket\model\TicketType; use think\admin\Controller; use think\admin\helper\QueryHelper; @@ -23,6 +24,7 @@ class Repair extends Controller public function index() { $this->title = '维修工单管理'; + $this->type_list = TicketType::getList(); TicketRepair::mQuery()->layTable(function () { }, static function (QueryHelper $query) { $query->equal('status')->like('title'); diff --git a/plugs/think-plugs-ticket/src/controller/Ticket.php b/plugs/think-plugs-ticket/src/controller/Ticket.php index e567189..248971a 100644 --- a/plugs/think-plugs-ticket/src/controller/Ticket.php +++ b/plugs/think-plugs-ticket/src/controller/Ticket.php @@ -41,7 +41,7 @@ class Ticket extends Controller $query->like(['title|content|contact_name|ticket_address|contact_phone#keyword']) ->dateBetween(['create_at']) ->equal(['status', 'type_id']); - $query->append(['imgs_arr', 'source_type_name', 'type_name', 'last_reply'])->with('approval'); + $query->append(['imgs_arr', 'source_type_name', 'type_name', 'last_reply'])->with(['views', 'repairs', 'verifys']); }); } diff --git a/plugs/think-plugs-ticket/src/controller/Verify.php b/plugs/think-plugs-ticket/src/controller/Verify.php index 6f73948..0076ed9 100644 --- a/plugs/think-plugs-ticket/src/controller/Verify.php +++ b/plugs/think-plugs-ticket/src/controller/Verify.php @@ -2,6 +2,7 @@ namespace plugin\ticket\controller; +use plugin\ticket\model\TicketType; use plugin\ticket\model\TicketVerify; use think\admin\Controller; use think\admin\helper\QueryHelper; @@ -23,6 +24,7 @@ class Verify extends Controller public function index() { $this->title = '验收工单管理'; + $this->type_list = TicketType::getList(); TicketVerify::mQuery()->layTable(function () { }, static function (QueryHelper $query) { $query->equal('status')->like('title'); diff --git a/plugs/think-plugs-ticket/src/controller/View.php b/plugs/think-plugs-ticket/src/controller/View.php index dbe73a9..2cb45a1 100644 --- a/plugs/think-plugs-ticket/src/controller/View.php +++ b/plugs/think-plugs-ticket/src/controller/View.php @@ -2,6 +2,7 @@ namespace plugin\ticket\controller; +use plugin\ticket\model\TicketType; use plugin\ticket\model\TicketView; use think\admin\Controller; use think\admin\helper\QueryHelper; @@ -23,8 +24,9 @@ class View extends Controller public function index() { $this->title = '查看工单管理'; + $this->type_list = TicketType::getList(); TicketView::mQuery()->layTable(function () { - }, static function (QueryHelper $query) { + }, function (QueryHelper $query) { $query->equal('status')->like('title'); $query->timeBetween('create_at'); }); diff --git a/plugs/think-plugs-ticket/src/model/TicketTicket.php b/plugs/think-plugs-ticket/src/model/TicketTicket.php index 1f8eb16..7352be5 100644 --- a/plugs/think-plugs-ticket/src/model/TicketTicket.php +++ b/plugs/think-plugs-ticket/src/model/TicketTicket.php @@ -99,12 +99,12 @@ class TicketTicket extends Model return $this->belongsTo(SystemUser::class, 'fz_user_id'); } - public function verify() + public function verifys() { return $this->hasMany(TicketVerify::class, 'ticket_id')->order('create_at', 'desc'); } - public function repair() + public function repairs() { return $this->hasMany(TicketRepair::class, 'ticket_id')->order('create_at', 'desc'); } @@ -113,6 +113,20 @@ class TicketTicket extends Model return $this->hasMany(TicketView::class, 'ticket_id')->order('create_at', 'desc'); } + public function view_process() { + return $this->belongsTo(ApprovalInstance::class, 'view_pid', 'id'); + } + + public function repair_process() + { + return $this->belongsTo(ApprovalInstance::class, 'repair_pid', 'id'); + } + + public function verify_process() + { + return $this->belongsTo(ApprovalInstance::class, 'verify_pid', 'id'); + } + public function repair_accept() { return $this->hasMany(TicketRepairAccept::class, 'ticket_id')->order('create_at', 'desc'); diff --git a/plugs/think-plugs-ticket/src/view/repair/index.html b/plugs/think-plugs-ticket/src/view/repair/index.html new file mode 100644 index 0000000..d2bd49d --- /dev/null +++ b/plugs/think-plugs-ticket/src/view/repair/index.html @@ -0,0 +1,72 @@ +{extend name="table"} + +{block name="button"} +{/block} + +{block name="content"} +
+
+
+ {include file='repair/index_search'} +
+
+
+
+ +{/block} + +{block name='style'} + +{/block} + +{block name='script'} + +{/block} \ No newline at end of file diff --git a/plugs/think-plugs-ticket/src/view/repair/index_search.html b/plugs/think-plugs-ticket/src/view/repair/index_search.html new file mode 100644 index 0000000..35aeeae --- /dev/null +++ b/plugs/think-plugs-ticket/src/view/repair/index_search.html @@ -0,0 +1,42 @@ +
+ 条件搜索 + + +
diff --git a/plugs/think-plugs-ticket/src/view/ticket/index.html b/plugs/think-plugs-ticket/src/view/ticket/index.html index 1dfce00..3498598 100644 --- a/plugs/think-plugs-ticket/src/view/ticket/index.html +++ b/plugs/think-plugs-ticket/src/view/ticket/index.html @@ -26,25 +26,9 @@ 详情 - {{# if (d.status == 0) { }} - - 分配 - - {{# } }} - {{# if (d.status == -1) { }} - - {{# if (d.approval == null) { }} - 审核 - {{# } else if (d.approval.status == 0 && d.approval.current.approver_id == {$user_id}) { }} - 去审核 - {{# } }} - {{# } }} - - {{# if (d.approval == null || d.approval.status != 1) { }} 修改 - {{# } }} {/block} @@ -65,7 +49,7 @@ {field:'create_at', title: '工单创建时间', width: 160, sort: true}, {field:'source_type_name', title:'工单来源', width:120}, {field:'type_name', title:'工单类型', width:160}, - {field:'content', title:'工单内容', minWidth:100}, + {field:'content', title:'工单内容', minWidth:120}, {field:'ticket_address', title:'工单地址', width:200, templet:function(item){ if (item.ticket_address) { return `${item.ticket_region} ${item.ticket_address}`; @@ -82,23 +66,39 @@ return ''; } }}, - {field:'status', title:'状态', width:80, templet:function(item){ - if (item.approval != null) { - if (item.approval.status != 1) { - return item.approval.status == 2 ? '审核不通过' : '审核中'; - } - } - if(item.status < 0){ - return '待审核'; - }else if(item.status == 0){ - return '待分配'; - }else if(item.status == 1){ - return '已处理'; - }else if(item.status == 2){ - return '已关闭'; + {field: 'view', title:'核验情况', width: 100, minWidth:100, templet:function(item){ + if (item.view_pid) { + // 已有核验流程 + } else { + return `提请核验`; + } + }}, + {field: 'repair', title:'维修情况', width: 100, minWidth:100, templet:function(item){ + if (!item.views || item.views.length === 0) { + // 还没有核验流程 + return `请先核验` + } + if (item.repair_pid) { + // 已有维修流程 + } else { + return `提请维修`; + } + }}, + {field: 'verify', title:'验收情况', width: 100, minWidth:100, templet:function(item){ + if (!item.views || item.views.length === 0) { + // 还没有核验流程 + return `请先核验` + } + if (!item.repairs || item.repairs.length === 0) { + // 还没有维修流程 + return `请先维修` + } + if (item.verify_pid) { + // 已有验收流程 + } else { + return `提请验收`; } }}, - {fixed: 'right', title:'操作', toolbar: '#toolbar', width:200} ]], page: true diff --git a/plugs/think-plugs-ticket/src/view/verify/index.html b/plugs/think-plugs-ticket/src/view/verify/index.html new file mode 100644 index 0000000..fc3508f --- /dev/null +++ b/plugs/think-plugs-ticket/src/view/verify/index.html @@ -0,0 +1,72 @@ +{extend name="table"} + +{block name="button"} +{/block} + +{block name="content"} +
+
+
+ {include file='verify/index_search'} +
+
+
+
+ +{/block} + +{block name='style'} + +{/block} + +{block name='script'} + +{/block} \ No newline at end of file diff --git a/plugs/think-plugs-ticket/src/view/verify/index_search.html b/plugs/think-plugs-ticket/src/view/verify/index_search.html new file mode 100644 index 0000000..fbdb4c6 --- /dev/null +++ b/plugs/think-plugs-ticket/src/view/verify/index_search.html @@ -0,0 +1,42 @@ +
+ 条件搜索 + + +
diff --git a/plugs/think-plugs-ticket/src/view/view/index.html b/plugs/think-plugs-ticket/src/view/view/index.html new file mode 100644 index 0000000..69dbe7c --- /dev/null +++ b/plugs/think-plugs-ticket/src/view/view/index.html @@ -0,0 +1,72 @@ +{extend name="table"} + +{block name="button"} +{/block} + +{block name="content"} +
+
+
+ {include file='view/index_search'} +
+
+
+
+ +{/block} + +{block name='style'} + +{/block} + +{block name='script'} + +{/block} \ No newline at end of file diff --git a/plugs/think-plugs-ticket/src/view/view/index_search.html b/plugs/think-plugs-ticket/src/view/view/index_search.html new file mode 100644 index 0000000..62e35b7 --- /dev/null +++ b/plugs/think-plugs-ticket/src/view/view/index_search.html @@ -0,0 +1,42 @@ +
+ 条件搜索 + + +