优化diamante

This commit is contained in:
wuxw 2022-10-25 01:09:13 +08:00
parent 69560cffb1
commit 8a1dd13c46
5 changed files with 140 additions and 153 deletions

View File

@ -1,123 +1,110 @@
(function(vc){
(function (vc) {
vc.extends({
propTypes: {
callBackListener:vc.propTypes.string, //父组件名称
callBackFunction:vc.propTypes.string //父组件监听方法
callBackListener: vc.propTypes.string, //父组件名称
callBackFunction: vc.propTypes.string //父组件监听方法
},
data:{
addMarketTextInfo:{
textId:'',
name:'',
sendRate:'',
textContent:'',
data: {
addMarketTextInfo: {
textId: '',
name: '',
sendRate: '',
textContent: '',
}
},
_initMethod:function(){
_initMethod: function () {
},
_initEvent:function(){
vc.on('addMarketText','openAddMarketTextModal',function(){
},
_initEvent: function () {
vc.on('addMarketText', 'openAddMarketTextModal', function () {
$('#addMarketTextModel').modal('show');
});
},
methods:{
addMarketTextValidate(){
methods: {
addMarketTextValidate() {
return vc.validate.validate({
addMarketTextInfo:vc.component.addMarketTextInfo
},{
'addMarketTextInfo.name':[
{
limit:"required",
param:"",
errInfo:"名称不能为空"
addMarketTextInfo: vc.component.addMarketTextInfo
}, {
'addMarketTextInfo.name': [
{
limit: "required",
param: "",
errInfo: "名称不能为空"
},
{
limit:"maxLength",
param:"64",
errInfo:"名称不能超过64"
{
limit: "maxLength",
param: "64",
errInfo: "名称不能超过64"
},
],
'addMarketTextInfo.sendRate':[
{
limit:"required",
param:"",
errInfo:"发送频率不能为空"
'addMarketTextInfo.sendRate': [
{
limit: "required",
param: "",
errInfo: "发送频率不能为空"
},
{
limit:"maxLength",
param:"30",
errInfo:"发送频率不能超过30"
{
limit: "maxLength",
param: "30",
errInfo: "发送频率不能超过30"
},
],
'addMarketTextInfo.textContent':[
{
limit:"required",
param:"",
errInfo:"备注'不能为空"
'addMarketTextInfo.textContent': [
{
limit: "required",
param: "",
errInfo: "备注'不能为空"
},
{
limit:"maxLength",
param:"512",
errInfo:"备注'不能超过512"
{
limit: "maxLength",
param: "512",
errInfo: "备注'不能超过512"
},
],
});
},
saveMarketTextInfo:function(){
if(!vc.component.addMarketTextValidate()){
saveMarketTextInfo: function () {
if (!vc.component.addMarketTextValidate()) {
vc.toast(vc.validate.errInfo);
return ;
}
vc.component.addMarketTextInfo.communityId = vc.getCurrentCommunity().communityId;
//不提交数据将数据 回调给侦听处理
if(vc.notNull($props.callBackListener)){
vc.emit($props.callBackListener,$props.callBackFunction,vc.component.addMarketTextInfo);
$('#addMarketTextModel').modal('hide');
return ;
return;
}
vc.http.apiPost(
'marketText.saveMarketText',
'/marketText.saveMarketText',
JSON.stringify(vc.component.addMarketTextInfo),
{
emulateJSON:true
},
function(json,res){
emulateJSON: true
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
let _json = JSON.parse(json);
if (_json.code == 0) {
//关闭model
$('#addMarketTextModel').modal('hide');
vc.component.clearAddMarketTextInfo();
vc.emit('marketTextManage','listMarketText',{});
vc.emit('marketTextManage', 'listMarketText', {});
return ;
return;
}
vc.message(_json.msg);
vc.toast(_json.msg);
},
function(errInfo,error){
},
function (errInfo, error) {
console.log('请求失败处理');
vc.message(errInfo);
vc.toast(errInfo);
});
});
},
clearAddMarketTextInfo:function(){
clearAddMarketTextInfo: function () {
vc.component.addMarketTextInfo = {
name:'',
sendRate:'',
textContent:'',
name: '',
sendRate: '',
textContent: '',
};
};
}
}
});

View File

@ -19,9 +19,8 @@
},
methods:{
deleteMarketText:function(){
vc.component.deleteMarketTextInfo.communityId=vc.getCurrentCommunity().communityId;
vc.http.apiPost(
'marketText.deleteMarketText',
'/marketText.deleteMarketText',
JSON.stringify(vc.component.deleteMarketTextInfo),
{
emulateJSON:true

View File

@ -1,115 +1,113 @@
(function(vc,vm){
(function (vc, vm) {
vc.extends({
data:{
editMarketTextInfo:{
textId:'',
name:'',
sendRate:'',
textContent:'',
data: {
editMarketTextInfo: {
textId: '',
name: '',
sendRate: '',
textContent: '',
}
},
_initMethod:function(){
_initMethod: function () {
},
_initEvent:function(){
vc.on('editMarketText','openEditMarketTextModal',function(_params){
},
_initEvent: function () {
vc.on('editMarketText', 'openEditMarketTextModal', function (_params) {
vc.component.refreshEditMarketTextInfo();
$('#editMarketTextModel').modal('show');
vc.copyObject(_params, vc.component.editMarketTextInfo );
vc.component.editMarketTextInfo.communityId = vc.getCurrentCommunity().communityId;
vc.copyObject(_params, vc.component.editMarketTextInfo);
});
},
methods:{
editMarketTextValidate:function(){
return vc.validate.validate({
editMarketTextInfo:vc.component.editMarketTextInfo
},{
'editMarketTextInfo.name':[
{
limit:"required",
param:"",
errInfo:"名称不能为空"
methods: {
editMarketTextValidate: function () {
return vc.validate.validate({
editMarketTextInfo: vc.component.editMarketTextInfo
}, {
'editMarketTextInfo.name': [
{
limit: "required",
param: "",
errInfo: "名称不能为空"
},
{
limit:"maxLength",
param:"64",
errInfo:"名称不能超过64"
{
limit: "maxLength",
param: "64",
errInfo: "名称不能超过64"
},
],
'editMarketTextInfo.sendRate':[
{
limit:"required",
param:"",
errInfo:"发送频率不能为空"
'editMarketTextInfo.sendRate': [
{
limit: "required",
param: "",
errInfo: "发送频率不能为空"
},
{
limit:"maxLength",
param:"30",
errInfo:"发送频率不能超过30"
{
limit: "maxLength",
param: "30",
errInfo: "发送频率不能超过30"
},
],
'editMarketTextInfo.textContent':[
{
limit:"required",
param:"",
errInfo:"备注'不能为空"
'editMarketTextInfo.textContent': [
{
limit: "required",
param: "",
errInfo: "备注'不能为空"
},
{
limit:"maxLength",
param:"512",
errInfo:"备注'不能超过512"
{
limit: "maxLength",
param: "512",
errInfo: "备注'不能超过512"
},
],
'editMarketTextInfo.textId':[
{
limit:"required",
param:"",
errInfo:"编号不能为空"
'editMarketTextInfo.textId': [
{
limit: "required",
param: "",
errInfo: "编号不能为空"
}]
});
},
editMarketText:function(){
if(!vc.component.editMarketTextValidate()){
});
},
editMarketText: function () {
if (!vc.component.editMarketTextValidate()) {
vc.toast(vc.validate.errInfo);
return ;
return;
}
vc.http.apiPost(
'marketText.updateMarketText',
'/marketText.updateMarketText',
JSON.stringify(vc.component.editMarketTextInfo),
{
emulateJSON:true
},
function(json,res){
emulateJSON: true
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
let _json = JSON.parse(json);
if (_json.code == 0) {
//关闭model
$('#editMarketTextModel').modal('hide');
vc.emit('marketTextManage','listMarketText',{});
return ;
vc.emit('marketTextManage', 'listMarketText', {});
return;
}
vc.message(_json.msg);
},
function(errInfo,error){
},
function (errInfo, error) {
console.log('请求失败处理');
vc.message(errInfo);
});
});
},
refreshEditMarketTextInfo:function(){
vc.component.editMarketTextInfo= {
textId:'',
name:'',
sendRate:'',
textContent:'',
refreshEditMarketTextInfo: function () {
vc.component.editMarketTextInfo = {
textId: '',
name: '',
sendRate: '',
textContent: '',
}
}
}
});
})(window.vc,window.vc.component);
})(window.vc, window.vc.component);

View File

@ -1,12 +1,12 @@
<div class="margin-top">
<div class="row margin-top-lg">
<div class="col-lg-2 padding-right-xs padding-left-xl">
<input v-model="marketWayTextInfo.conditions.name" type="text" :placeholder="vc.i18n('必填,请填写车牌号','addMarketText')" class="form-control">
<input v-model="marketWayTextInfo.conditions.name" type="text" :placeholder="vc.i18n('请填写名称','addMarketText')" class="form-control">
</div>
<div class="col-lg-2 padding-right-xs padding-left-xl">
<select class="custom-select" v-model="marketWayTextInfo.conditions.sendRate">
<option selected disabled value="">{{vc.i18n('必填,请选择发送频率','addMarketText')}}
<option selected disabled value="">{{vc.i18n('请选择发送频率','addMarketText')}}
</option>
<option value="1001">{{vc.i18n('按天','addMarketText')}}</option>
<option value="2002">{{vc.i18n('按月','addMarketText')}}</option>

View File

@ -28,6 +28,9 @@
$that._listMarketTexts(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('marketTextManage', 'listMarketText', function(_data) {
$that._listMarketTexts(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('marketWayText', 'paginationPlus', 'page_event',
function(_currentPage) {
vc.component._listMarketTexts(_currentPage, DEFAULT_ROWS);
@ -43,7 +46,7 @@
};
//发送get请求
vc.http.apiGet('marketText.listMarketTexts',
vc.http.apiGet('/marketText.listMarketText',
param,
function(json,res){
var _marketWayTextInfo=JSON.parse(json);