update.php
4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
use yii\helpers\Url;
$this->title = '编辑维修方案';
$this->params['breadcrumbs'][] = '设备管理';
$this->params['breadcrumbs'][] = ['label' => '故障维修方案管理', 'url' => ['/device/repair/index?catId='.$catId."&faultId=".$faultId]];
$this->params['breadcrumbs'][] = $this->title;
?>
<form action="" name="brandForm" id="brandForm" method="post" enctype="multipart/form-data">
<div class="panel panel-default">
<div class="panel-heading bg-success">
当前型号:<?=$deviceCat['name'] ?> > <?=$fault['name'] ?> > <?=$repair['name'] ?>
</div>
<div class="panel-body">
<div class="form-group col-sm-12">
<label for="modelName" class="col-sm-4 control-label text-right">方案名称:</label>
<div class="col-sm-4 text-left">
<input type="text" class="form-control col-sm-3" id="repair_name" name="repair_name" placeholder="请输入方案名称" value="<?=$repair['name'] ?>">
<input type="hidden" value="<?=$repair['id'] ?>" id="repair_id" name="repair_id">
</div>
</div>
<div class="form-group col-sm-12">
<label for="modelName" class="col-sm-4 control-label text-right">故障原因:</label>
<div class="col-sm-4 text-left">
<textarea class="form-control" rows="4" id="reason" name="reason" placeholder="请填写故障原因"><?=$repair['reason'] ?></textarea>
</div>
</div>
<div class="form-group col-sm-12">
<label for="modelName" class="col-sm-4 control-label text-right">标准价格:</label>
<div class="col-sm-4 text-left">
<input type="number" class="form-control col-sm-3" id="repair_price" name="repair_price" placeholder="请输入标准定价" value="<?=floatval($repair['standard_price']) ?>">
</div>
</div>
</div>
<div class="panel-footer text-center">
<button type="button" class="btn btn-primary" id="save">提 交</button>
<a class="btn btn-default" href="<?php echo Url::toRoute(['/device/model/update', 'id' => $repair['id']]); ?>">重 置</a>
</div>
</div>
</form>
<script>
$(document).ready(function(){
$("#save").bind("click",function(){
var repair_id = $("#repair_id").val();
var repair_name = $("#repair_name").val();
var reason = $("#reason").val();
var repair_price = $("#repair_price").val();
if (repair_id == null || repair_id == ""){
alert("暂时无法提交,请刷新页面后重试");
return false;
}
if (repair_name == null || repair_name == ""){
alert("请输入维修方案名称");
$("#repair_name").focus();
return false;
}
if (reason == null || reason == ""){
alert("请输入请输入方案描述信息");
$("#reason").focus();
return false;
}
if (repair_price == null || repair_price == "" || isNaN(repair_price)){
alert("请输入标准定价");
$("#repair_price").focus();
return false;
}
$.ajax({
type: "post",
url: "do-update-plan",
dataType:"json",
data: $.csrf({"repair_id":repair_id,"repair_name":repair_name,"reason":reason,"repair_price":repair_price}),
success:function(msg){
alert(msg['msg']);
if (msg['status'] == 1){
location.href="<?php echo Url::toRoute(['/device/repair/index?catId='.$catId.'&faultId='.$faultId]); ?>";
}else{
//提示确认失败
}
},
error:function(msg){
//提示确认失败
}
});
});
});
</script>