mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-25 14:17:54 +08:00
优化代码
This commit is contained in:
parent
43579a76ec
commit
0b14acf1df
@ -1,40 +1,34 @@
|
||||
<div id="addInspectionRouteModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
|
||||
aria-hidden="true">
|
||||
<div id="addInspectionRouteModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
<h3 class="m-t-none m-b ">添加巡检路线</h3>
|
||||
<h3 class="m-t-none m-b ">添加</h3>
|
||||
<div class="ibox-content">
|
||||
<div>
|
||||
<div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">路线名称</label>
|
||||
<div class="col-sm-10">
|
||||
<input v-model="addInspectionRouteInfo.routeName" type="text"
|
||||
placeholder="必填,请填写路线名称" class="form-control">
|
||||
<input v-model="addInspectionRouteInfo.routeName" type="text" placeholder="必填,请填写路线名称" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="form-group row">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">顺序</label>
|
||||
<div class="col-sm-10">
|
||||
<input v-model="addInspectionRouteInfo.seq" type="text"
|
||||
placeholder="必填,请填写检查项数量" class="form-control">
|
||||
<input v-model="addInspectionRouteInfo.seq" type="text" placeholder="必填,请填写检查项数量" class="form-control">
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">备注</label>
|
||||
<div class="col-sm-10">
|
||||
<input v-model="addInspectionRouteInfo.remark" type="text" placeholder="选填,请填写备注"
|
||||
class="form-control">
|
||||
<input v-model="addInspectionRouteInfo.remark" type="text" placeholder="选填,请填写备注" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<button class="btn btn-primary float-right" type="button"
|
||||
v-on:click="saveInspectionRouteInfo()">
|
||||
<button class="btn btn-primary float-right" type="button" v-on:click="saveInspectionRouteInfo()">
|
||||
<i class="fa fa-check"></i> 保存
|
||||
</button>
|
||||
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
|
||||
data-dismiss="modal">
|
||||
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;" data-dismiss="modal">
|
||||
<i class="fa fa-times"></i> 取消
|
||||
</button>
|
||||
</div>
|
||||
@ -44,4 +38,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,4 +1,4 @@
|
||||
(function (vc) {
|
||||
(function(vc) {
|
||||
vc.extends({
|
||||
propTypes: {
|
||||
callBackListener: vc.propTypes.string,
|
||||
@ -12,50 +12,48 @@
|
||||
remark: '',
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
},
|
||||
_initEvent: function () {
|
||||
_initMethod: function() {},
|
||||
_initEvent: function() {
|
||||
vc.on('addInspectionRoute', 'openAddInspectionRouteModal',
|
||||
function () {
|
||||
function() {
|
||||
$('#addInspectionRouteModel').modal('show');
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
addInspectionRouteValidate() {
|
||||
return vc.validate.validate({
|
||||
addInspectionRouteInfo: vc.component.addInspectionRouteInfo
|
||||
},
|
||||
{
|
||||
'addInspectionRouteInfo.routeName': [{
|
||||
addInspectionRouteInfo: vc.component.addInspectionRouteInfo
|
||||
}, {
|
||||
'addInspectionRouteInfo.routeName': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "路线名称不能为空"
|
||||
},
|
||||
{
|
||||
limit: "maxin",
|
||||
param: "1,100",
|
||||
errInfo: "路线名称字数不能超过100个"
|
||||
},
|
||||
],
|
||||
'addInspectionRouteInfo.seq': [{
|
||||
{
|
||||
limit: "maxin",
|
||||
param: "1,100",
|
||||
errInfo: "路线名称字数不能超过100个"
|
||||
},
|
||||
],
|
||||
'addInspectionRouteInfo.seq': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "顺序不能为空"
|
||||
},
|
||||
{
|
||||
limit: "num",
|
||||
param: "",
|
||||
errInfo: "顺序必须是整数"
|
||||
},
|
||||
],
|
||||
'addInspectionRouteInfo.remark': [{
|
||||
limit: "maxin",
|
||||
param: "0,200",
|
||||
errInfo: "备注不能超过200位"
|
||||
}],
|
||||
});
|
||||
{
|
||||
limit: "num",
|
||||
param: "",
|
||||
errInfo: "顺序必须是整数"
|
||||
},
|
||||
],
|
||||
'addInspectionRouteInfo.remark': [{
|
||||
limit: "maxin",
|
||||
param: "0,200",
|
||||
errInfo: "备注不能超过200位"
|
||||
}],
|
||||
});
|
||||
},
|
||||
saveInspectionRouteInfo: function () {
|
||||
saveInspectionRouteInfo: function() {
|
||||
if (!vc.component.addInspectionRouteValidate()) {
|
||||
vc.toast(vc.validate.errInfo);
|
||||
return;
|
||||
@ -70,7 +68,7 @@
|
||||
vc.http.post('addInspectionRoute', 'save', JSON.stringify(vc.component.addInspectionRouteInfo), {
|
||||
emulateJSON: true
|
||||
},
|
||||
function (json, res) {
|
||||
function(json, res) {
|
||||
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
||||
if (res.status == 200) {
|
||||
//关闭model
|
||||
@ -81,15 +79,15 @@
|
||||
}
|
||||
vc.toast(json);
|
||||
},
|
||||
function (errInfo, error) {
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
vc.toast(errInfo);
|
||||
});
|
||||
},
|
||||
clearAddInspectionRouteInfo: function () {
|
||||
clearAddInspectionRouteInfo: function() {
|
||||
vc.component.addInspectionRouteInfo = {
|
||||
routeName: '',
|
||||
// seq: '',
|
||||
seq: '1',
|
||||
remark: ''
|
||||
};
|
||||
}
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<div id="editInspectionRouteModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
|
||||
aria-hidden="true">
|
||||
<div id="editInspectionRouteModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
@ -10,31 +9,26 @@
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">路线名称</label>
|
||||
<div class="col-sm-10">
|
||||
<input v-model="editInspectionRouteInfo.routeName" type="text"
|
||||
placeholder="必填,请填写路线名称" class="form-control">
|
||||
<input v-model="editInspectionRouteInfo.routeName" type="text" placeholder="必填,请填写路线名称" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="form-group row">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">顺序</label>
|
||||
<div class="col-sm-10">
|
||||
<input v-model="editInspectionRouteInfo.seq" type="text"
|
||||
placeholder="必填,请填写设备数量" class="form-control">
|
||||
<input v-model="editInspectionRouteInfo.seq" type="text" placeholder="必填,请填写设备数量" class="form-control">
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">备注</label>
|
||||
<div class="col-sm-10">
|
||||
<input v-model="editInspectionRouteInfo.remark" type="text" placeholder="选填,请填写备注"
|
||||
class="form-control">
|
||||
<input v-model="editInspectionRouteInfo.remark" type="text" placeholder="选填,请填写备注" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<button class="btn btn-primary float-right" type="button"
|
||||
v-on:click="editInspectionRoute()">
|
||||
<button class="btn btn-primary float-right" type="button" v-on:click="editInspectionRoute()">
|
||||
<i class="fa fa-check"></i> 保存
|
||||
</button>
|
||||
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
|
||||
data-dismiss="modal">
|
||||
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;" data-dismiss="modal">
|
||||
<i class="fa fa-times"></i> 取消
|
||||
</button>
|
||||
</div>
|
||||
@ -44,4 +38,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,4 +1,4 @@
|
||||
(function (vc, vm) {
|
||||
(function(vc, vm) {
|
||||
vc.extends({
|
||||
data: {
|
||||
editInspectionRouteInfo: {
|
||||
@ -8,11 +8,10 @@
|
||||
remark: ''
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
},
|
||||
_initEvent: function () {
|
||||
_initMethod: function() {},
|
||||
_initEvent: function() {
|
||||
vc.on('editInspectionRoute', 'openEditInspectionRouteModal',
|
||||
function (_params) {
|
||||
function(_params) {
|
||||
vc.component.refreshEditInspectionRouteInfo();
|
||||
$('#editInspectionRouteModel').modal('show');
|
||||
vc.copyObject(_params, vc.component.editInspectionRouteInfo);
|
||||
@ -20,48 +19,46 @@
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
editInspectionRouteValidate: function () {
|
||||
editInspectionRouteValidate: function() {
|
||||
return vc.validate.validate({
|
||||
editInspectionRouteInfo: vc.component.editInspectionRouteInfo
|
||||
},
|
||||
{
|
||||
'editInspectionRouteInfo.routeName': [{
|
||||
editInspectionRouteInfo: vc.component.editInspectionRouteInfo
|
||||
}, {
|
||||
'editInspectionRouteInfo.routeName': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "路线名称不能为空"
|
||||
},
|
||||
{
|
||||
limit: "maxin",
|
||||
param: "1,100",
|
||||
errInfo: "路线名称字数不能超过100个"
|
||||
},
|
||||
],
|
||||
'editInspectionRouteInfo.seq': [{
|
||||
{
|
||||
limit: "maxin",
|
||||
param: "1,100",
|
||||
errInfo: "路线名称字数不能超过100个"
|
||||
},
|
||||
],
|
||||
'editInspectionRouteInfo.seq': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "顺序不能为空"
|
||||
},
|
||||
{
|
||||
limit: "num",
|
||||
param: "",
|
||||
errInfo: "顺序必须是数字"
|
||||
},
|
||||
],
|
||||
'editInspectionRouteInfo.remark': [{
|
||||
limit: "maxin",
|
||||
param: "0,200",
|
||||
errInfo: "备注不能超过200位"
|
||||
},
|
||||
],
|
||||
'editInspectionRouteInfo.inspectionRouteId': [{
|
||||
limit: "required",
|
||||
{
|
||||
limit: "num",
|
||||
param: "",
|
||||
errInfo: "路线ID不能为空"
|
||||
}]
|
||||
errInfo: "顺序必须是数字"
|
||||
},
|
||||
],
|
||||
'editInspectionRouteInfo.remark': [{
|
||||
limit: "maxin",
|
||||
param: "0,200",
|
||||
errInfo: "备注不能超过200位"
|
||||
}, ],
|
||||
'editInspectionRouteInfo.inspectionRouteId': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "路线ID不能为空"
|
||||
}]
|
||||
|
||||
});
|
||||
});
|
||||
},
|
||||
editInspectionRoute: function () {
|
||||
editInspectionRoute: function() {
|
||||
if (!vc.component.editInspectionRouteValidate()) {
|
||||
vc.toast(vc.validate.errInfo);
|
||||
return;
|
||||
@ -70,7 +67,7 @@
|
||||
vc.http.post('editInspectionRoute', 'update', JSON.stringify(vc.component.editInspectionRouteInfo), {
|
||||
emulateJSON: true
|
||||
},
|
||||
function (json, res) {
|
||||
function(json, res) {
|
||||
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
||||
if (res.status == 200) {
|
||||
//关闭model
|
||||
@ -80,12 +77,12 @@
|
||||
}
|
||||
vc.toast(json);
|
||||
},
|
||||
function (errInfo, error) {
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
vc.toast(errInfo);
|
||||
});
|
||||
},
|
||||
refreshEditInspectionRouteInfo: function () {
|
||||
refreshEditInspectionRouteInfo: function() {
|
||||
vc.component.editInspectionRouteInfo = {
|
||||
inspectionRouteId: '',
|
||||
routeName: '',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user