修复:处理工单bug
This commit is contained in:
parent
646b58c851
commit
b31012af25
@ -122,17 +122,47 @@ class Index extends BaseController
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$param = get_params();
|
$param = get_params();
|
||||||
$id = isset($param['id']) ? $param['id'] : 0;
|
$id = !empty($param['id']) ? intval($param['id']) : 0;
|
||||||
|
|
||||||
$workorder = WorkOrderList::where('id', $id)
|
$workorder = WorkOrderList::where('id', $id)
|
||||||
->field('id, project_id, problemtype, uid, username, contact, content, remark, status, solve, creater, sub_time, create_time')
|
->field('id, project_id, problemtype, uid, username, contact, email, content, remark, status, solve, creater, sub_time, create_time')
|
||||||
->find();
|
->find();
|
||||||
|
|
||||||
if ($workorder) {
|
if ($workorder) {
|
||||||
|
// 批量获取相关ID
|
||||||
|
$projectId = $workorder['project_id'];
|
||||||
|
$createrId = $workorder['creater'];
|
||||||
|
// $solveId = $workorder['solve'];
|
||||||
|
|
||||||
|
// 查询相关名称和联系方式
|
||||||
|
$projectName = $projectId ? Db::name('Project')->where('id', $projectId)->value('name_short') : '-';
|
||||||
|
$adminName = $createrId ? Db::name('Admin')->where('id', $createrId)->value('name') : '-';
|
||||||
|
// $solveName = $solveId ? Db::name('Admin')->where('id', $solveId)->value('name') : '-';
|
||||||
|
|
||||||
|
// 联系方式优先用工单自带,否则查创建人
|
||||||
|
$contact = !empty($workorder['contact']) ? $workorder['contact'] : (
|
||||||
|
$createrId ? (Db::name('Admin')->where('id', $createrId)->value('mobile') ?: '-') : '-'
|
||||||
|
);
|
||||||
|
$email = !empty($workorder['email']) ? $workorder['email'] : (
|
||||||
|
$createrId ? (Db::name('Admin')->where('id', $createrId)->value('email') ?: '-') : '-'
|
||||||
|
);
|
||||||
|
$uid = !empty($workorder['uid']) ? $workorder['uid'] : (
|
||||||
|
$createrId ? (Db::name('Admin')->where('id', $createrId)->value('id') ?: '-') : '-'
|
||||||
|
);
|
||||||
|
|
||||||
|
// 赋值
|
||||||
|
$workorder['project_id'] = $projectName ?: '-';
|
||||||
|
$workorder['creater'] = $adminName ?: '-';
|
||||||
|
// $workorder['solve'] = $solveName ?: '-';
|
||||||
|
$workorder['contact'] = $contact;
|
||||||
|
$workorder['email'] = $email ?: '-';
|
||||||
|
$workorder['uid'] = $uid ?: '-';
|
||||||
View::assign('detail', $workorder);
|
View::assign('detail', $workorder);
|
||||||
} else {
|
} else {
|
||||||
View::assign('message', '没有详细数据');
|
View::assign('message', '没有详细数据');
|
||||||
}
|
}
|
||||||
return view();
|
return view();
|
||||||
|
// return json($workorder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,6 +183,22 @@ class Index extends BaseController
|
|||||||
} else {
|
} else {
|
||||||
$view->contact = Db::name('Admin')->where('id', $view['creater'])->value('mobile') ?: '-';
|
$view->contact = Db::name('Admin')->where('id', $view['creater'])->value('mobile') ?: '-';
|
||||||
}
|
}
|
||||||
|
if (!empty($view['uid'])) {
|
||||||
|
$view->uid = $view['uid'];
|
||||||
|
} else {
|
||||||
|
$view->uid = Db::name('Admin')->where('id', $view['creater'])->value('id') ?: '-';
|
||||||
|
}
|
||||||
|
if (!empty($view['email'])) {
|
||||||
|
$view->email = $view['email'];
|
||||||
|
} else {
|
||||||
|
$view->email = Db::name('Admin')->where('id', $view['creater'])->value('email') ?: '-';
|
||||||
|
}
|
||||||
|
if (!empty($view['project_order_id'])) {
|
||||||
|
$view->project_order_id = $view['project_order_id'];
|
||||||
|
} else {
|
||||||
|
$projectOrderId = Db::name('WorkOrder')->where('id', $id ?: $view['id'])->value('project_order_id');
|
||||||
|
$view->project_order_id = $projectOrderId ?: $view['id'];
|
||||||
|
}
|
||||||
$adminName = Db::name('Admin')->where('id', $view['creater'])->value('name');
|
$adminName = Db::name('Admin')->where('id', $view['creater'])->value('name');
|
||||||
$view->creater = $adminName ?: '-';
|
$view->creater = $adminName ?: '-';
|
||||||
$solveName = Db::name('Admin')->where('id', $view['solve'])->value('name');
|
$solveName = Db::name('Admin')->where('id', $view['solve'])->value('name');
|
||||||
|
|||||||
@ -7,18 +7,23 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select name="solve" lay-verify="required" lay-reqText="请选择处理人" class="layui-select" lay-search=""
|
<select name="solve" lay-verify="required" lay-reqText="请选择处理人" class="layui-select" lay-search=""
|
||||||
lay-filter="solve"<?php if(isset($detail['status']) && ($detail['status']==2 || $detail['status']==3)) echo 'disabled'; ?>>
|
lay-filter="solve" <?php if(isset($detail['status']) && ($detail['status']==2 || $detail['status']==3))
|
||||||
|
echo 'disabled' ; ?>>
|
||||||
<option value="">请选择处理人</option>
|
<option value="">请选择处理人</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td class="layui-td-gray-2">工单状态<font>*</font>
|
<td class="layui-td-gray-2">工单状态<font>*</font>
|
||||||
</td>
|
</td>
|
||||||
<td colspan="3">
|
<td colspan="3">
|
||||||
<select name="status" lay-verify="required" lay-reqText="请选择工单状态" class="layui-select" id="status-select"
|
<select name="status" lay-verify="required" lay-reqText="请选择工单状态" class="layui-select" id="status-select" <?php
|
||||||
<?php if(isset($detail['status']) && $detail['status']==3) echo 'disabled'; ?>>
|
if(isset($detail['status']) && $detail['status']==3) echo 'disabled' ; ?>>
|
||||||
<option value="">请选择工单状态</option>
|
<option value="">请选择工单状态</option>
|
||||||
<option value="1" <?php if(isset($detail['status']) && $detail['status']==1) echo 'selected' ; ?> <?php if(isset($detail['status']) && $detail['status']==2) echo 'disabled'; ?>>解决中</option>
|
<option value="1" <?php if(isset($detail['status']) && $detail['status']==1) echo 'selected' ; ?>
|
||||||
<option value="2" <?php if(isset($detail['status']) && $detail['status']==2) echo 'selected' ; ?> <?php if(isset($detail['status']) && $detail['status']==2) echo 'disabled'; ?>>已解决</option>
|
<?php if(isset($detail['status']) && $detail['status']==2) echo 'disabled'; ?>>解决中
|
||||||
|
</option>
|
||||||
|
<option value="2" <?php if(isset($detail['status']) && $detail['status']==2) echo 'selected' ; ?>
|
||||||
|
<?php if(isset($detail['status']) && $detail['status']==2) echo 'disabled'; ?>>已解决
|
||||||
|
</option>
|
||||||
<option value="3" <?php if(isset($detail['status']) && $detail['status']==3) echo 'selected' ; ?>>已关闭</option>
|
<option value="3" <?php if(isset($detail['status']) && $detail['status']==3) echo 'selected' ; ?>>已关闭</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
@ -33,8 +38,69 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<h3 class="h3-title">问题简述</h3>
|
<div class="wtjs-box">
|
||||||
|
<h3 class="h3-title">基础信息</h3>
|
||||||
<table class="layui-table layui-table-form">
|
<table class="layui-table layui-table-form">
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray-2">工单ID</td>
|
||||||
|
<td>
|
||||||
|
{$detail['id']}
|
||||||
|
</td>
|
||||||
|
<td class="layui-td-gray-2">项目工单ID</td>
|
||||||
|
<td>
|
||||||
|
{$detail['id']}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray-2">隶属项目</td>
|
||||||
|
<td>
|
||||||
|
{$detail['project_id']}
|
||||||
|
</td>
|
||||||
|
<td class="layui-td-gray-2">问题类型</td>
|
||||||
|
<td>
|
||||||
|
{$detail['problemtype']}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray-2">提交人</td>
|
||||||
|
<td>
|
||||||
|
{$detail['creater']}
|
||||||
|
</td>
|
||||||
|
<td class="layui-td-gray-2">联系电话</td>
|
||||||
|
<td>
|
||||||
|
{$detail['contact']}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray-2">电子邮箱</td>
|
||||||
|
<td>
|
||||||
|
{$detail['email']}
|
||||||
|
</td>
|
||||||
|
<td class="layui-td-gray-2">提交时间</td>
|
||||||
|
<td>
|
||||||
|
{$detail['sub_time']}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="wtjs-box">
|
||||||
|
<h3 class="h3-title">问题沟通</h3>
|
||||||
|
<div style="display: flex;gap: 15px;">
|
||||||
|
<div class="wtjs-content">
|
||||||
|
<h4>问题描述</h4>
|
||||||
|
<div id="workorder-content">
|
||||||
|
<?= $detail['content'] ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="wtbz">
|
||||||
|
<h4>备注</h4>
|
||||||
|
<p>{$detail.remark}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- <table class="layui-table layui-table-form">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="layui-td-gray-2">项目问题</td>
|
<td class="layui-td-gray-2">项目问题</td>
|
||||||
<td>
|
<td>
|
||||||
@ -45,32 +111,57 @@
|
|||||||
<td class="layui-td-gray-2">备注</td>
|
<td class="layui-td-gray-2">备注</td>
|
||||||
<td>{$detail.remark}</td>
|
<td>{$detail.remark}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table> -->
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
//判断工单状态
|
// 工具函数:获取URL参数
|
||||||
// 判断工单状态,禁用表单项
|
function getQueryParam(name) {
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
var params = new URLSearchParams(window.location.search);
|
||||||
var detail = <?php echo json_encode(isset($detail) ? $detail : (object)[]); ?>;
|
return params.get(name) || '';
|
||||||
var status = parseInt(detail.status, 10);
|
}
|
||||||
|
|
||||||
// 获取所有表单元素
|
// 需要填充的字段
|
||||||
var formElem = document.querySelector("form.layui-form");
|
var fields = [
|
||||||
var allInputs = formElem ? formElem.querySelectorAll("input, select, textarea, button[lay-submit]") : [];
|
'id', 'project_id', 'problemtype', 'creater', 'contact', 'email', 'sub_time', 'remark', 'status'
|
||||||
|
];
|
||||||
|
|
||||||
// 如果status为3或4,禁用所有表单项
|
// 页面内容填充
|
||||||
if (status === 3 || status === 4) {
|
function fillFieldsFromUrl() {
|
||||||
|
fields.forEach(function(field) {
|
||||||
|
var value = getQueryParam(field);
|
||||||
|
var el = document.getElementById('workorder-' + field);
|
||||||
|
if (el) el.textContent = value;
|
||||||
|
// 隐藏input赋值
|
||||||
|
var inputEl = document.querySelector('input[name="' + field + '"]');
|
||||||
|
if (inputEl && !inputEl.value) inputEl.value = value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
fillFieldsFromUrl();
|
||||||
|
});
|
||||||
|
|
||||||
|
layui.use(['form', 'layer'], function () {
|
||||||
|
var form = layui.form,
|
||||||
|
layer = layui.layer;
|
||||||
|
|
||||||
|
// 1. 工单状态禁用逻辑
|
||||||
|
function handleStatusDisable() {
|
||||||
|
var status = getQueryParam('status');
|
||||||
|
var statusNum = parseInt(status, 10);
|
||||||
|
var formElem = document.querySelector('form.layui-form');
|
||||||
|
var allInputs = formElem ? formElem.querySelectorAll('input, select, textarea, button[lay-submit]') : [];
|
||||||
|
if (statusNum === 3 || statusNum === 4) {
|
||||||
allInputs.forEach(function (el) {
|
allInputs.forEach(function (el) {
|
||||||
// 只允许工单状态选择4
|
if (el.name === 'status') {
|
||||||
if (el.name === "status") {
|
|
||||||
// 只保留4选项
|
|
||||||
Array.from(el.options).forEach(function (opt) {
|
Array.from(el.options).forEach(function (opt) {
|
||||||
if (opt.value !== "4" && opt.value !== "") {
|
if (opt.value !== '4' && opt.value !== '') {
|
||||||
opt.disabled = true;
|
opt.disabled = true;
|
||||||
opt.style.display = "none";
|
opt.style.display = 'none';
|
||||||
} else if (opt.value === "4") {
|
} else if (opt.value === '4') {
|
||||||
opt.selected = true;
|
opt.selected = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -80,80 +171,77 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (statusNum === 4) {
|
||||||
// 如果status为4,全部禁用(包括工单状态)
|
|
||||||
if (status === 4) {
|
|
||||||
allInputs.forEach(function (el) {
|
allInputs.forEach(function (el) {
|
||||||
el.disabled = true;
|
el.disabled = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// 获取URL参数id
|
|
||||||
function getQueryId() {
|
|
||||||
var match = window.location.pathname.match(/\/edit\/id\/(\d+)/);
|
|
||||||
return match ? match[1] : "";
|
|
||||||
}
|
}
|
||||||
var id = getQueryId();
|
|
||||||
// 赋值给input(如果不是php渲染,也可保留此段,防止页面未渲染id时赋值)
|
// 2. 渲染处理人下拉框
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
function renderSolveSelect() {
|
||||||
var idInput = document.getElementById("id");
|
fetch('/api/index/getallstaff')
|
||||||
if (idInput && !idInput.value) {
|
.then((response) => response.json())
|
||||||
idInput.value = id;
|
.then((data) => {
|
||||||
|
var select = document.querySelector('select[name="solve"]');
|
||||||
|
select.innerHTML = '<option value="">请选择处理人</option>';
|
||||||
|
var solveVal = getQueryParam('solve') || "<?php echo isset($detail['solve']) ? $detail['solve'] : ''; ?>";
|
||||||
|
var found = false;
|
||||||
|
data.data.forEach((solve) => {
|
||||||
|
var option = document.createElement('option');
|
||||||
|
option.value = solve.id;
|
||||||
|
option.innerText = solve.name;
|
||||||
|
if (String(solve.id) === String(solveVal)) {
|
||||||
|
option.selected = true;
|
||||||
|
found = true;
|
||||||
}
|
}
|
||||||
|
select.appendChild(option);
|
||||||
});
|
});
|
||||||
|
// 如果solve的值不在接口返回的列表中,手动添加一个option
|
||||||
|
if (solveVal && !found) {
|
||||||
|
var option = document.createElement('option');
|
||||||
|
option.value = solveVal;
|
||||||
|
// 这里可以显示solveVal本身,或者显示“未知处理人”
|
||||||
|
option.innerText = "<?php echo isset($detail['solve']) && isset($detail['solve_name']) ? $detail['solve_name'] : '未知处理人'; ?>";
|
||||||
|
option.selected = true;
|
||||||
|
select.appendChild(option);
|
||||||
|
}
|
||||||
|
form.render('select');
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Error fetching staff:', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
layui.use(["form", "layer"], function () {
|
// 3. 渲染工单状态
|
||||||
var form = layui.form,
|
function renderStatusSelect() {
|
||||||
layer = layui.layer;
|
var statusVal = getQueryParam('status');
|
||||||
|
if (statusVal) {
|
||||||
|
form.val('webform', {
|
||||||
|
status: String(statusVal)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 图片预览
|
||||||
layer.photos({
|
layer.photos({
|
||||||
photos: '#workorder-content',
|
photos: '#workorder-content',
|
||||||
anim: 5
|
anim: 5
|
||||||
});
|
});
|
||||||
|
|
||||||
// 渲染处理人下拉框并设置默认值
|
// 5. 初始化
|
||||||
// var detail = <?php echo json_encode(isset($detail) ? $detail : (object)[]); ?>;
|
handleStatusDisable();
|
||||||
var detail = <?php echo json_encode(isset($detail) ? $detail : (object)[]); ?>;
|
renderSolveSelect();
|
||||||
fetch("/api/index/getallstaff")
|
renderStatusSelect();
|
||||||
.then((response) => response.json())
|
|
||||||
.then((data) => {
|
|
||||||
var select = document.querySelector('select[name="solve"]');
|
|
||||||
select.innerHTML = '<option value="">请选择处理人</option>';
|
|
||||||
data.data.forEach((solve) => {
|
|
||||||
var option = document.createElement("option");
|
|
||||||
option.value = solve.id;
|
|
||||||
option.innerText = solve.name;
|
|
||||||
// 设置选中
|
|
||||||
if (detail.solve && String(detail.solve) === String(solve.id)) {
|
|
||||||
option.selected = true;
|
|
||||||
}
|
|
||||||
select.appendChild(option);
|
|
||||||
console.log('detail.solve:', detail.solve, 'solve.id:', solve.id, 'equal:', String(detail.solve) === String(solve.id));
|
|
||||||
});
|
|
||||||
form.render("select");
|
|
||||||
|
|
||||||
// 渲染默认值(工单状态)
|
// 6. 表单提交
|
||||||
if (detail && typeof detail.status !== "undefined") {
|
form.on('submit(webform)', function (data) {
|
||||||
form.val("webform", {
|
var id = getQueryParam('id');
|
||||||
status: detail.status,
|
fetch('/workorder/index/edit?id=' + id, {
|
||||||
});
|
method: 'POST',
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error("Error:", error);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// 监听提交事件
|
|
||||||
form.on("submit(webform)", function (data) {
|
|
||||||
// 发送请求并处理响应
|
|
||||||
fetch("/workorder/index/edit/" + id, {
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify(data.field),
|
body: JSON.stringify(data.field),
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
@ -163,18 +251,17 @@
|
|||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
var index = parent.layer.getFrameIndex(window.name);
|
var index = parent.layer.getFrameIndex(window.name);
|
||||||
parent.layer.close(index);
|
parent.layer.close(index);
|
||||||
parent.location.reload(); // 刷新父页面
|
parent.location.reload();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
.page-content img {
|
.page-content img {
|
||||||
padding: 15px;
|
padding: 15px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layui-layer-shade {
|
.layui-layer-shade {
|
||||||
@ -192,4 +279,33 @@
|
|||||||
.layui-table {
|
.layui-table {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.wtjs-box {
|
||||||
|
border: 1px solid #eee;
|
||||||
|
padding: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wtjs-content {
|
||||||
|
border: 1px solid #eee;
|
||||||
|
width: 60%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wtbz {
|
||||||
|
border: 1px solid #eee;
|
||||||
|
width: 40%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wtjs-content,
|
||||||
|
.wtbz {
|
||||||
|
padding: 15px;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wtjs-box h4 {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
border-bottom: 1px solid #949494;
|
||||||
|
padding-bottom: 15px;
|
||||||
|
color: #4b4b4b;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -103,7 +103,7 @@
|
|||||||
var id = data.id;
|
var id = data.id;
|
||||||
var status = data.status; // 获取当前行的status
|
var status = data.status; // 获取当前行的status
|
||||||
// 处理工单时带上status参数
|
// 处理工单时带上status参数
|
||||||
tool.open('/workorder/index/edit/id/' + id + '/status/' + status, '处理工单');
|
tool.open('/workorder/index/edit?id=' + id + '&status=' + status, '处理工单');
|
||||||
} else if (obj.event === 'delete') {
|
} else if (obj.event === 'delete') {
|
||||||
var id = data.id;
|
var id = data.id;
|
||||||
layui.layer.confirm('确定要删除该工单吗?', {icon: 3, title: '提示'}, function(index){
|
layui.layer.confirm('确定要删除该工单吗?', {icon: 3, title: '提示'}, function(index){
|
||||||
|
|||||||
@ -1,30 +1,41 @@
|
|||||||
<form class="layui-form page-content p-4">
|
<form class="layui-form page-content p-4">
|
||||||
<input type="hidden" name="id" id="id" value="<?php echo isset($view['id']) ? $view['id'] : ''; ?>">
|
<input
|
||||||
|
type="hidden"
|
||||||
|
name="id"
|
||||||
|
id="id"
|
||||||
|
value="<?php echo isset($view['id']) ? $view['id'] : ''; ?>"
|
||||||
|
/>
|
||||||
<h3 class="h3-title">工单详情 - ID:{$view['id']}</h3>
|
<h3 class="h3-title">工单详情 - ID:{$view['id']}</h3>
|
||||||
<table class="layui-table layui-table-form">
|
<table class="layui-table layui-table-form">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="layui-td-gray-2">隶属项目</td>
|
|
||||||
<td>{$view['project_id']}</td>
|
|
||||||
<td class="layui-td-gray-2">工单状态</td>
|
<td class="layui-td-gray-2">工单状态</td>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
$statusMap = [
|
$statusMap = [
|
||||||
0 => "未解决",
|
0 =>
|
||||||
1 => "解决中",
|
"未解决", 1 => "解决中", 2 => "已解决", 3 => "已关闭" ]; $statusClass =
|
||||||
2 => "已解决",
|
isset($view['status']) ? 'gdzt gd-' . intval($view['status']) : '';
|
||||||
3 => "已关闭"
|
$statusText = (isset($view['status']) &&
|
||||||
];
|
isset($statusMap[$view['status']])) ? $statusMap[$view['status']] : '-';
|
||||||
$statusClass = isset($view['status']) ? 'gdzt gd-' . intval($view['status']) : '';
|
|
||||||
$statusText = (isset($view['status']) && isset($statusMap[$view['status']])) ? $statusMap[$view['status']] : '-';
|
|
||||||
?>
|
?>
|
||||||
<span class="<?php echo $statusClass; ?>"><?php echo $statusText; ?></span>
|
<span class="<?php echo $statusClass; ?>"
|
||||||
|
><?php echo $statusText; ?></span
|
||||||
|
>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="layui-td-gray-2">隶属项目</td>
|
||||||
|
<td>{$view['project_id']}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="layui-td-gray-2">提交人</td>
|
<td class="layui-td-gray-2">提交人</td>
|
||||||
<td>{$view['creater']}</td>
|
<td>{$view['creater']}</td>
|
||||||
<td class="layui-td-gray-2">联系方式</td>
|
<td class="layui-td-gray-2">提交人项目ID</td>
|
||||||
|
<td>{$view['uid']}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray-2">联系电话</td>
|
||||||
<td>{$view['contact']}</td>
|
<td>{$view['contact']}</td>
|
||||||
|
<td class="layui-td-gray-2">电子邮箱</td>
|
||||||
|
<td>{$view['email']}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="layui-td-gray-2">提交时间</td>
|
<td class="layui-td-gray-2">提交时间</td>
|
||||||
@ -34,6 +45,12 @@
|
|||||||
<?php echo isset($view['solve']) && $view['solve'] !== '' ? $view['solve'] : '暂无'; ?>
|
<?php echo isset($view['solve']) && $view['solve'] !== '' ? $view['solve'] : '暂无'; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray-2">问题类型</td>
|
||||||
|
<td>{$view['problemtype']}</td>
|
||||||
|
<td class="layui-td-gray-2">项目工单ID</td>
|
||||||
|
<td>{$view['project_order_id']}</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="layui-td-gray-2">项目问题</td>
|
<td class="layui-td-gray-2">项目问题</td>
|
||||||
<td colspan="4">
|
<td colspan="4">
|
||||||
@ -44,9 +61,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="layui-td-gray-2">备注</td>
|
<td class="layui-td-gray-2">备注</td>
|
||||||
<td colspan="4">
|
<td colspan="4">{$view.remark}</td>
|
||||||
{$view.remark}
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
@ -55,12 +70,12 @@
|
|||||||
// 获取URL参数id
|
// 获取URL参数id
|
||||||
function getQueryId() {
|
function getQueryId() {
|
||||||
var match = window.location.pathname.match(/\/edit\/id\/(\d+)/);
|
var match = window.location.pathname.match(/\/edit\/id\/(\d+)/);
|
||||||
return match ? match[1] : '';
|
return match ? match[1] : "";
|
||||||
}
|
}
|
||||||
var id = getQueryId();
|
var id = getQueryId();
|
||||||
// 赋值给input(如果不是php渲染,也可保留此段,防止页面未渲染id时赋值)
|
// 赋值给input(如果不是php渲染,也可保留此段,防止页面未渲染id时赋值)
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
var idInput = document.getElementById('id');
|
var idInput = document.getElementById("id");
|
||||||
if (idInput && !idInput.value) {
|
if (idInput && !idInput.value) {
|
||||||
idInput.value = id;
|
idInput.value = id;
|
||||||
}
|
}
|
||||||
@ -72,8 +87,8 @@
|
|||||||
upload = layui.upload;
|
upload = layui.upload;
|
||||||
|
|
||||||
layer.photos({
|
layer.photos({
|
||||||
photos: '#workorder-content',
|
photos: "#workorder-content",
|
||||||
anim: 5
|
anim: 5,
|
||||||
});
|
});
|
||||||
|
|
||||||
var selectedFile = null; // 用于存储选择的文件
|
var selectedFile = null; // 用于存储选择的文件
|
||||||
@ -86,14 +101,17 @@
|
|||||||
fetch("/download/index/edit?id=" + idValue, {
|
fetch("/download/index/edit?id=" + idValue, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
id: document.getElementById('id').value,
|
id: document.getElementById("id").value,
|
||||||
name: document.getElementById('name').value,
|
name: document.getElementById("name").value,
|
||||||
cid: document.querySelector('select[name="cid"]').value,
|
cid: document.querySelector('select[name="cid"]').value,
|
||||||
version: document.querySelector('input[name="version"]').value,
|
version: document.querySelector('input[name="version"]').value,
|
||||||
path: document.querySelector('input[name="path"]').value,
|
path: document.querySelector('input[name="path"]').value,
|
||||||
download_url: document.querySelector('input[name="download_url"]').value,
|
download_url: document.querySelector('input[name="download_url"]')
|
||||||
download_code: document.querySelector('input[name="download_code"]').value,
|
.value,
|
||||||
description: document.querySelector('textarea[name="description"]').value,
|
download_code: document.querySelector('input[name="download_code"]')
|
||||||
|
.value,
|
||||||
|
description: document.querySelector('textarea[name="description"]')
|
||||||
|
.value,
|
||||||
update_time: updateTime,
|
update_time: updateTime,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user