You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

165 lines
5.2 KiB

<?php
#此段以下由系統自斷產生 include 'day_off-schema.php';
ini_set('display_errors', 'On');
error_reporting(E_ALL);
include "day_off-schema.php";
require_once "../header.php";
// $id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.');
$form_key = isset($_GET['form_key']) ? $_GET['form_key'] : die('ERROR: Record ID not found.');
$data = array();
// sql語法存在變數中
$db_query = "SELECT * FROM $system_name WHERE form_key=$form_key";
// 用mysqli_query方法執行(sql語法)將結果存在變數中
$data = mysqli_query($link, $db_query);
/*
include "inc/record_update.php";
try {
// 設置一個空陣列來放資料
$data = array();
// sql語法存在變數中
$db_query = "SELECT * FROM expert WHERE id=$id";
// 用mysqli_query方法執行(sql語法)將結果存在變數中
$data = mysqli_query($link,$db_query);
}catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
*/
#由day_off-edit.php 拷贝复制而来 ,由id搜索变成form_key搜索
require_once './wf_common.php';
$form_key = $_GET['form_key'];
$flow = new Flow($form_key);
$wf = new WorkFlow($flow->system_id, $flow->flow_id, 'form_id', $form_key);
#获取签核意见
$assign_opinions = Assign::get_records($form_key);
#会签部门意见
$subflow_assign_opinions = SubflowManager::getCounterSignComments($form_key);
$flowName = $wf->getFlowName();
$assigner = $wf->getAssignerList();
$assign_status = $wf->getAssignStatus($assigner);
$isSplitable = $wf->isSplitable();
foreach ($data as $data) :
?>
<script type="text/javascript" src='../assets/js/lib/jquery-3.4.1.min.js'></script>
<link rel="stylesheet" href="../assets/css/selectpage.css" />
<script type="text/javascript" src='../assets/js/selectpage.min.js'></script>
<script type="text/javascript">
$(document).ready(function() {
var assigner = eval('<?= json_encode($assigner) ?>');
$.ajax({
url: 'https://www.masada.com.tw/fds/index.php/DesignFlow/get_assigner',
type: 'post',
dataType: 'json',
success: function(data) {
window.tag_data = data;
$('#selectPage').selectPage({
showField: 'show_name',
keyField: 'val',
data: data,
multiple: true,
multipleControlbar: true,
pagination: false,
focusDropList: false
});
}
});
$('#assign_status').change(function() {
$("#next_users").empty();
var _selected_status = $(this).children('option:selected').val(); //获取被选择的状态
var _option_tmp = ""; //获取下拉列表
for (a in assigner) { //遍历assigner
if (assigner[a][0] == _selected_status) {
_tmp = assigner[a][1].split(',');
for (var b in _tmp) {
if (_tmp[b] == '') {
continue;
}
_uname = _tmp[b].split('-')[1];
_uid = _tmp[b].split('-')[0];
/* console.log(_tmp[b]);*/
_option_tmp += '<option value=' + _uid + '>' + _tmp[b] + '</option>';
}
}
}
$("#next_users").append(_option_tmp);
});
});
</script>
<div class="container">
<form class="form-inline" method="post" action="<?php echo $system_name; ?>-record-update.php" enctype="multipart/form-data">
<input type="hidden" name="form_key" value="<?php echo $form_key; ?>">
<input type="hidden" name="id" value="<?php echo $data['id']; ?>">
<?php for ($i = 1; $i < count($html_schema); ++$i) { ?>
<div>
<?php
$label = $html_schema[$i]["label"];
$element_type = $html_schema[$i]["type"];
$name_id = $html_schema[$i]["id"];
$placeholder = $html_schema[$i]["placeHolder"];
$others = $html_schema[$i]["others"];
# 產生Label
if (stripos($others, "required")) {
echo "<label for='$name_id'>" . $label . "(必填)</label>";
} else {
echo "<label for='$name_id'>" . $label . "</label>";
};
# 產生輸入內容
switch ($element_type) {
case "text":
#echo "<input type='" . $html_schema[$i]["type"] . "' name='" . $html_schema[$i]["id"] . "' id='" $html_schema[$i]["id"] . "' placeholder='" . $html_schema[$i]["placeHolder"] . " " . $html_schema[$i]["others"] . ">";
echo "<input type='text' name='$name_id' id='$name_id' " . "value='" . $data[$name_id] . "'" . " $others>";
break;
default:
echo "<input type='text' name='$name_id' id='$name_id' " . "value='" . $data[$name_id] . "'" . " $others>";
break;
};
?>
</div>
<?php }; ?>
<?php
if ($isSplitable) {
echo '
<label for="selectPage"> 会签人员:</label>
<input type="text" id="selectPage" name="split_members" style="width:100%"/>
';
}
?>
<label for="assign_opinion">签核意见</label>
<input type='text' value='' name='assign_opinion' id='assign_opinion '>
<label for="assign_opinion">签核动作</label>
<select name="assign_status" id="assign_status">
<?php echo $assign_status; ?>
</select>
<label for="next_users">下位签核者</label>
<select name="next_users" id="next_users">
</select>
<div>
<br>
<button type="submit" name="update">確定</button>
</div>
<input type="hidden" name="token" value="<?php echo $token; ?>">
</form>
</div>
<?php
endforeach;
//include "footer.php";
?>