76 lines
2.9 KiB
PHP
76 lines
2.9 KiB
PHP
<form id="vue-edit" class="am-form am-form-horizontal" action="/auto/fine/edit" data-auto="true" method="post" style="width: 90%;padding:25px 30px 20px 0;margin: 0 auto">
|
|
<div class="am-form-group">
|
|
<label class="am-para-label"><span class="com-must-star">*</span>名称:</label>
|
|
<div class="am-para-input"><input type="text" placeholder="请输入名称" name="title" v-model="info.title"/></div>
|
|
</div>
|
|
<div class="am-form-group">
|
|
<label class="am-para-label">状态:</label>
|
|
<div class="am-para-input wp50">
|
|
<select name="status" v-model="info.status">
|
|
<option v-for="(v,i) in statusAry" :value="i">{{v}}</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="am-form-group" style="margin-bottom: 2rem">
|
|
<div class="am-para-input"><button class="am-btn am-btn-secondary" type="button" @click="saveEdit">提交</button></div>
|
|
</div>
|
|
</form>
|
|
<script>
|
|
var loading = 0;
|
|
var vue_obj;
|
|
$(function(){
|
|
vue_obj = new Vue({
|
|
el: '#vue-edit',
|
|
data: {
|
|
info:{},
|
|
statusAry:[],
|
|
action:''
|
|
},
|
|
mounted:function(){
|
|
var vm = this;
|
|
vm.info = <?=json_encode($info)?>;
|
|
vm.action = '<?=$action?>';
|
|
vm.statusAry = <?=json_encode($statusAry)?>;
|
|
},
|
|
methods:{
|
|
saveEdit:function(){
|
|
var vm = this;
|
|
if(1 == loading){
|
|
return 0;
|
|
}
|
|
loading = 1;
|
|
|
|
$.ajax({
|
|
url: vm.action,
|
|
type: 'post',
|
|
dataType: 'json',
|
|
data: {info:vm.info},
|
|
beforeSend: function () {
|
|
layer.load(1, {
|
|
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
|
});
|
|
},
|
|
success: function (data) {
|
|
loading = 0;
|
|
if (data['code']) {
|
|
layer.msg(data.msg, {
|
|
icon: 1,
|
|
time: 2000
|
|
}, function () {
|
|
window.location.reload();
|
|
});
|
|
} else {
|
|
layer.msg(data.msg, {icon: 2});
|
|
}
|
|
},
|
|
complete: function () {
|
|
loading = 0;
|
|
layer.closeAll('loading');
|
|
}
|
|
});
|
|
}
|
|
},
|
|
watch:{}
|
|
});
|
|
});
|
|
</script>
|