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.
 
 
 
 
 
 

169 lines
5.4 KiB

<?php
#由系統自斷產生include 'XXXXX-schema.php';;
include 'day_off-schema.php';
include "../header.php";
require_once "wf_common.php";
/***此段以下由系統自斷產生
#系统ID
$system_id = 'con';
#流程ID
$flow_id = 'con02'
***/
$system_id = 'day_off';
#表单号 $form_id;
$form_id = "";
$wf = new WorkFlow($system_id, $flow_id, $form_id);
$wf->initWorkFlow(ID);
$form_key = $wf->flowContext->getFormKey();
$flowName = $wf->getFlowName();
$assigner = $wf->getAssignerList();
$assign_status = $wf->getAssignStatus($assigner);
?>
<!--workflow JS新增 start -->
<script type="text/javascript" src='../assets/js/lib/jquery-3.4.1.min.js'></script>
<script type="text/javascript">
$(document).ready(function() {
var assigner = eval('<?= json_encode($assigner) ?>');
$('#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>
<!--workflow JS新增 end -->
<div class="container">
<?php
include "$system_name-record-submit.php";
/*
if($_SERVER["REQUEST_METHOD"] == "POST"){
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){
echo "<p class='error'>Please fill up the required field!</p>";
} else {
echo "<p class='success'>Record has added successfully</p>";
}
}
*/
?>
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data">
<input type='hidden' value='<?= $form_key ?>' name='form_key' id='form_key'>
<?php for ($i = 0; $i < count($html_schema); ++$i) { ?>
<div>
<?php
# 自動編單據編碼: 系統編號+登入帳號+年月日時分秒+"-"+秒數小數點後一位數字
$mtimestamp = sprintf("%.1f", microtime(true)); // 带小數1位毫秒的时间戳
$timestamp = floor($mtimestamp); // 时间戳
$milliseconds = round(($mtimestamp - $timestamp) * 10); // 秒小數點後1位
$datetime = date("YmdHis", $timestamp) . '-' . $milliseconds;
#echo sprintf("%s => %s", $mtimestamp, $datetime);//1523856374.820 => 2018-04-16 13:26:14.820
$application_id = $system_name . "-" . $user_id . "-" . $datetime;
$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
switch ($element_type) {
case "hidden":
echo "<label hidden for='$name_id'>" . $label . "(必填)</label>";
break;
default:
if (stripos($others, "required")){
echo "<label for='$name_id'>" . $label . "(必填)</label>";
}else{
echo "<label for='$name_id'>" . $label . "</label>";
};
break;
};
echo "<br>";
# 產生輸入內容
switch ($element_type) {
case "hidden":
echo "<input type='hidden' name='$name_id' id='$name_id' $others>";
break;
case "text":
switch ($name_id){
case "application_no":
echo "<input type='text' name='$name_id' id='$name_id' value='$application_id' size='30' $others>";
break;
case "creater":
echo "<input type='text' name='$name_id' id='$name_id' value='$user_id' $others size='30'>";
break;
case "create_at":
echo "<input type='text' name='$name_id' id='$name_id' value='" . date('Y/m/d H:i:s') . "' size='30' $others>";
break;
default:
echo "<input type='text' name='$name_id' id='$name_id' $others>";
break;
};
break;
case "single_select":
echo "<select name='$name_id'" . "size ='" . $html_schema[$i]["size"] . "'>" . $html_schema[$i]["options_string"] . "</select>";
break;
case "datetime-local":
echo "<input type='datetime-local' name='$name_id' id='$name_id' size='30' $others>";
break;
default:
echo "<input type='text' name='$name_id' id='$name_id' $others>";
break;
};
?>
</div>
<?php }; ?>
<label for="assign_opinion">簽核意見</label>
<input type='text' value='' name='assign_opinion' id='assign_opinion '>
<label for="assign_status">簽核狀態</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>
<p class="error"><?php echo $create_at_error; ?></p>
</div>
<div>
<button type="submit" name="submit">確定</button>
</div>
<input type="hidden" name="token" value="<?php echo $token; ?>">
</form>
</div>
<?php include "../footer.php"; ?>