mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-24 05:46:03 +08:00
优化代码
This commit is contained in:
parent
b47304b36a
commit
982e051ed3
@ -1,4 +1,4 @@
|
||||
(function (vc) {
|
||||
(function(vc) {
|
||||
|
||||
vc.extends({
|
||||
propTypes: {
|
||||
@ -13,20 +13,20 @@
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
categoryDesc: '',
|
||||
seq:''
|
||||
seq: ''
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
vc.initDateTime('addStartTime', function (_value) {
|
||||
_initMethod: function() {
|
||||
vc.initDateTime('addStartTime', function(_value) {
|
||||
$that.addMainCategoryInfo.startTime = _value;
|
||||
});
|
||||
|
||||
vc.initDateTime('addEndTime', function (_value) {
|
||||
vc.initDateTime('addEndTime', function(_value) {
|
||||
$that.addMainCategoryInfo.endTime = _value;
|
||||
});
|
||||
},
|
||||
_initEvent: function () {
|
||||
vc.on('addMainCategory', 'openAddMainCategoryModal', function () {
|
||||
_initEvent: function() {
|
||||
vc.on('addMainCategory', 'openAddMainCategoryModal', function() {
|
||||
$('#addMainCategoryModel').modal('show');
|
||||
});
|
||||
},
|
||||
@ -35,8 +35,7 @@
|
||||
return vc.validate.validate({
|
||||
addMainCategoryInfo: vc.component.addMainCategoryInfo
|
||||
}, {
|
||||
'addMainCategoryInfo.categoryName': [
|
||||
{
|
||||
'addMainCategoryInfo.categoryName': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "目录名称不能为空"
|
||||
@ -47,8 +46,7 @@
|
||||
errInfo: "目录名称太长"
|
||||
},
|
||||
],
|
||||
'addMainCategoryInfo.categoryType': [
|
||||
{
|
||||
'addMainCategoryInfo.categoryType': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "目录类别不能为空"
|
||||
@ -59,8 +57,7 @@
|
||||
errInfo: "目录类别格式错误"
|
||||
},
|
||||
],
|
||||
'addMainCategoryInfo.startTime': [
|
||||
{
|
||||
'addMainCategoryInfo.startTime': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "开始时间不能为空"
|
||||
@ -71,8 +68,7 @@
|
||||
errInfo: "开始时间格式错误"
|
||||
},
|
||||
],
|
||||
'addMainCategoryInfo.endTime': [
|
||||
{
|
||||
'addMainCategoryInfo.endTime': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "结束时间不能为空"
|
||||
@ -83,8 +79,7 @@
|
||||
errInfo: "结束时间格式错误"
|
||||
},
|
||||
],
|
||||
'addMainCategoryInfo.categoryDesc': [
|
||||
{
|
||||
'addMainCategoryInfo.categoryDesc': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "描述不能为空"
|
||||
@ -95,8 +90,7 @@
|
||||
errInfo: "描述太长"
|
||||
},
|
||||
],
|
||||
'addMainCategoryInfo.seq': [
|
||||
{
|
||||
'addMainCategoryInfo.seq': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "排序不能为空"
|
||||
@ -113,14 +107,13 @@
|
||||
|
||||
});
|
||||
},
|
||||
saveMainCategoryInfo: function () {
|
||||
saveMainCategoryInfo: function() {
|
||||
if (!vc.component.addMainCategoryValidate()) {
|
||||
vc.toast(vc.validate.errInfo);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
vc.component.addMainCategoryInfo.communityId = vc.getCurrentCommunity().communityId;
|
||||
//不提交数据将数据 回调给侦听处理
|
||||
if (vc.notNull($props.callBackListener)) {
|
||||
vc.emit($props.callBackListener, $props.callBackFunction, vc.component.addMainCategoryInfo);
|
||||
@ -130,11 +123,10 @@
|
||||
|
||||
vc.http.apiPost(
|
||||
'/productCategory/saveMainCategory',
|
||||
JSON.stringify(vc.component.addMainCategoryInfo),
|
||||
{
|
||||
JSON.stringify(vc.component.addMainCategoryInfo), {
|
||||
emulateJSON: true
|
||||
},
|
||||
function (json, res) {
|
||||
function(json, res) {
|
||||
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
||||
let _json = JSON.parse(json);
|
||||
if (_json.code == 0) {
|
||||
@ -148,24 +140,24 @@
|
||||
vc.message(_json.msg);
|
||||
|
||||
},
|
||||
function (errInfo, error) {
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
|
||||
vc.message(errInfo);
|
||||
|
||||
});
|
||||
},
|
||||
clearAddMainCategoryInfo: function () {
|
||||
clearAddMainCategoryInfo: function() {
|
||||
vc.component.addMainCategoryInfo = {
|
||||
categoryName: '',
|
||||
categoryType: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
categoryDesc: '',
|
||||
seq:''
|
||||
seq: ''
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})(window.vc);
|
||||
})(window.vc);
|
||||
@ -1,4 +1,4 @@
|
||||
(function (vc, vm) {
|
||||
(function(vc, vm) {
|
||||
|
||||
vc.extends({
|
||||
data: {
|
||||
@ -6,11 +6,11 @@
|
||||
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
_initMethod: function() {
|
||||
|
||||
},
|
||||
_initEvent: function () {
|
||||
vc.on('deleteMainCategory', 'openDeleteMainCategoryModal', function (_params) {
|
||||
_initEvent: function() {
|
||||
vc.on('deleteMainCategory', 'openDeleteMainCategoryModal', function(_params) {
|
||||
|
||||
vc.component.deleteMainCategoryInfo = _params;
|
||||
$('#deleteMainCategoryModel').modal('show');
|
||||
@ -18,15 +18,13 @@
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
deleteMainCategory: function () {
|
||||
vc.component.deleteMainCategoryInfo.communityId = vc.getCurrentCommunity().communityId;
|
||||
deleteMainCategory: function() {
|
||||
vc.http.apiPost(
|
||||
'/productCategory/deleteMainCategory',
|
||||
JSON.stringify(vc.component.deleteMainCategoryInfo),
|
||||
{
|
||||
JSON.stringify(vc.component.deleteMainCategoryInfo), {
|
||||
emulateJSON: true
|
||||
},
|
||||
function (json, res) {
|
||||
function(json, res) {
|
||||
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
||||
let _json = JSON.parse(json);
|
||||
if (_json.code == 0) {
|
||||
@ -37,16 +35,16 @@
|
||||
}
|
||||
vc.message(_json.msg);
|
||||
},
|
||||
function (errInfo, error) {
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
vc.message(json);
|
||||
|
||||
});
|
||||
},
|
||||
closeDeleteMainCategoryModel: function () {
|
||||
closeDeleteMainCategoryModel: function() {
|
||||
$('#deleteMainCategoryModel').modal('hide');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})(window.vc, window.vc.component);
|
||||
})(window.vc, window.vc.component);
|
||||
@ -1,4 +1,4 @@
|
||||
(function (vc, vm) {
|
||||
(function(vc, vm) {
|
||||
|
||||
vc.extends({
|
||||
data: {
|
||||
@ -6,11 +6,11 @@
|
||||
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
_initMethod: function() {
|
||||
|
||||
},
|
||||
_initEvent: function () {
|
||||
vc.on('deleteHousekeepingServ', 'openDeleteHousekeepingServModal', function (_params) {
|
||||
_initEvent: function() {
|
||||
vc.on('deleteHousekeepingServ', 'openDeleteHousekeepingServModal', function(_params) {
|
||||
|
||||
vc.component.deleteHousekeepingServInfo = _params;
|
||||
$('#deleteHousekeepingServModel').modal('show');
|
||||
@ -18,15 +18,13 @@
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
deleteHousekeepingServ: function () {
|
||||
vc.component.deleteHousekeepingServInfo.communityId = vc.getCurrentCommunity().communityId;
|
||||
deleteHousekeepingServ: function() {
|
||||
vc.http.apiPost(
|
||||
'/housekeepingServ/deleteHousekeepingServ',
|
||||
JSON.stringify(vc.component.deleteHousekeepingServInfo),
|
||||
{
|
||||
JSON.stringify(vc.component.deleteHousekeepingServInfo), {
|
||||
emulateJSON: true
|
||||
},
|
||||
function (json, res) {
|
||||
function(json, res) {
|
||||
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
||||
let _json = JSON.parse(json);
|
||||
if (_json.code == 0) {
|
||||
@ -37,16 +35,16 @@
|
||||
}
|
||||
vc.message(_json.msg);
|
||||
},
|
||||
function (errInfo, error) {
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
vc.message(json);
|
||||
|
||||
});
|
||||
},
|
||||
closeDeleteHousekeepingServModel: function () {
|
||||
closeDeleteHousekeepingServModel: function() {
|
||||
$('#deleteHousekeepingServModel').modal('hide');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})(window.vc, window.vc.component);
|
||||
})(window.vc, window.vc.component);
|
||||
Loading…
Reference in New Issue
Block a user