优化代码

This commit is contained in:
java110 2022-10-19 15:54:58 +08:00
parent bd965ac364
commit 7627d8f200
4 changed files with 43 additions and 57 deletions

View File

@ -10,41 +10,31 @@
<div class="ibox-content">
<div class="form-group row" v-show="addPurchaseApplyViewInfo2.resOrderType == 20000">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="出库对象" namespace="addPurchaseApplyView2"></vc:i18n></span></label>
<div class="col-sm-3">
<vc:create path="frame/orgSelect2" parentModal="addPurchaseApplyViewInfoModel"
callBackListener="addPurchaseApplyViewInfo2" callBackFunction="notify" namespace="addPurchaseApplyViewInfo">
<div class="col-sm-6">
<vc:create path="frame/chooseOrgTree2" callBackListener="addPurchaseApplyViewInfo2">
</vc:create>
</div>
<div class="col-sm-3">
<vc:create path="frame/departmentSelect2" parentModal="addPurchaseApplyViewInfoModel"
callBackListener="addPurchaseApplyViewInfo2" callBackFunction="notify" namespace="addPurchaseApplyViewInfo">
</vc:create>
</div>
<div class="col-sm-3">
<vc:create path="frame/staffSelect2" parentModal="addPurchaseApplyViewInfoModel"
callBackListener="addPurchaseApplyViewInfo2" callBackFunction="notify" namespace="addPurchaseApplyViewInfo">
<vc:create path="frame/staffSelect2" parentModal="addPurchaseApplyView2Model" callBackListener="addPurchaseApplyViewInfo2" callBackFunction="notify" namespace="addPurchaseApplyView2">
</vc:create>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="使用人" namespace="addPurchaseApplyView2"></vc:i18n></span></label>
<div class="col-sm-10">
<input :placeholder="vc.i18n('必填,请填写使用人','addPurchaseApplyView2')" class="form-control"
v-model="addPurchaseApplyViewInfo2.endUserName"/></div>
<input :placeholder="vc.i18n('必填,请填写使用人','addPurchaseApplyView2')" class="form-control" v-model="addPurchaseApplyViewInfo2.endUserName" /></div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="联系电话" namespace="addPurchaseApplyView2"></vc:i18n></span></label>
<div class="col-sm-10">
<input :placeholder="vc.i18n('必填,请填写联系电话','addPurchaseApplyView2')" class="form-control"
v-model="addPurchaseApplyViewInfo2.endUserTel"/></div>
<input :placeholder="vc.i18n('必填,请填写联系电话','addPurchaseApplyView2')" class="form-control" v-model="addPurchaseApplyViewInfo2.endUserTel" /></div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="申请说明" namespace="addPurchaseApplyView2"></vc:i18n></span></label>
<div class="col-sm-10">
<textarea :placeholder="vc.i18n('必填,请填写申请说明','addPurchaseApplyView2')" class="form-control"
v-model="addPurchaseApplyViewInfo2.description"></textarea></div>
<textarea :placeholder="vc.i18n('必填,请填写申请说明','addPurchaseApplyView2')" class="form-control" v-model="addPurchaseApplyViewInfo2.description"></textarea></div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,4 +1,4 @@
(function (vc) {
(function(vc) {
vc.extends({
propTypes: {
@ -8,9 +8,9 @@
data: {
addPurchaseApplyViewInfo2: {
flowComponent: 'addPurchaseApplyView2',
description:'',
endUserName:'',
endUserTel:'',
description: '',
endUserName: '',
endUserTel: '',
staffId: '',
staffName: '',
resOrderType: ''
@ -19,47 +19,50 @@
watch: {
addPurchaseApplyViewInfo2: {
deep: true,
handler: function () {
handler: function() {
vc.component.saveAddComplainInfo();
}
}
},
_initMethod: function () {
},
_initEvent: function () {
_initMethod: function() {
vc.on('addPurchaseApplyViewInfo2', 'setResourcesOut', function (_resOrderType) {
},
_initEvent: function() {
vc.on('addPurchaseApplyViewInfo2', 'setResourcesOut', function(_resOrderType) {
vc.component.addPurchaseApplyViewInfo2.resOrderType = _resOrderType;
});
vc.on("addPurchaseApplyViewInfo2", "notify", function (_param) {
vc.on("addPurchaseApplyViewInfo2", "notify", function(_param) {
if (_param.hasOwnProperty("staffId")) {
vc.component.addPurchaseApplyViewInfo2.staffId = _param.staffId;
vc.component.addPurchaseApplyViewInfo2.staffName = _param.staffName;
}
});
vc.on('addPurchaseApplyViewInfo2', 'switchOrg', function(_org) {
vc.emit('addPurchaseApplyViewInfo2', 'staffSelect2', 'setStaff', _org)
});
// vc.on('addPurchaseApplyViewInfo2', 'setPurchaseApplyInfo', function () {
// vc.emit($props.callBackListener, $props.callBackFunction, vc.component.addPurchaseApplyViewInfo2);
// });
vc.on('addPurchaseApplyViewInfo2', 'onIndex', function (_index) {
vc.on('addPurchaseApplyViewInfo2', 'onIndex', function(_index) {
vc.component.addPurchaseApplyViewInfo2.index = _index;
});
vc.on("addPurchaseApplyViewInfo2", "clear", function (_param) {
vc.on("addPurchaseApplyViewInfo2", "clear", function(_param) {
vc.component.addPurchaseApplyViewInfo2.description = '';
vc.component.addPurchaseApplyViewInfo2.endUserName = '';
vc.component.addPurchaseApplyViewInfo2.endUserTel = '';
});
},
methods: {
addComplainValidate: function () {
addComplainValidate: function() {
return vc.validate.validate({
addPurchaseApplyViewInfo2: vc.component.addPurchaseApplyViewInfo2
}, {
'addPurchaseApplyViewInfo2.description': [
{
'addPurchaseApplyViewInfo2.description': [{
limit: "required",
param: "",
errInfo: "申请说明不能为空"
@ -70,8 +73,7 @@
errInfo: "申请说明不能超过200位"
},
],
'addPurchaseApplyViewInfo2.endUserName': [
{
'addPurchaseApplyViewInfo2.endUserName': [{
limit: "required",
param: "",
errInfo: "联系人不能为空"
@ -82,8 +84,7 @@
errInfo: "联系人不能超过50位"
},
],
'addPurchaseApplyViewInfo2.endUserTel': [
{
'addPurchaseApplyViewInfo2.endUserTel': [{
limit: "required",
param: "",
errInfo: "联系电话不能为空"
@ -97,12 +98,11 @@
});
},
addComplainValidate2: function () {
addComplainValidate2: function() {
return vc.validate.validate({
addPurchaseApplyViewInfo2: vc.component.addPurchaseApplyViewInfo2
}, {
'addPurchaseApplyViewInfo2.description': [
{
'addPurchaseApplyViewInfo2.description': [{
limit: "required",
param: "",
errInfo: "申请说明不能为空"
@ -113,8 +113,7 @@
errInfo: "申请说明不能超过200位"
},
],
'addPurchaseApplyViewInfo2.endUserName': [
{
'addPurchaseApplyViewInfo2.endUserName': [{
limit: "required",
param: "",
errInfo: "联系人不能为空"
@ -125,15 +124,12 @@
errInfo: "联系人不能超过50位"
},
],
'addPurchaseApplyViewInfo2.staffId': [
{
limit: "required",
param: "",
errInfo: "出库对象不能为空"
}
],
'addPurchaseApplyViewInfo2.endUserTel': [
{
'addPurchaseApplyViewInfo2.staffId': [{
limit: "required",
param: "",
errInfo: "出库对象不能为空"
}],
'addPurchaseApplyViewInfo2.endUserTel': [{
limit: "required",
param: "",
errInfo: "联系电话不能为空"
@ -147,19 +143,19 @@
});
},
saveAddComplainInfo: function () {
saveAddComplainInfo: function() {
if (vc.component.addPurchaseApplyViewInfo2.resOrderType == 10000 && vc.component.addComplainValidate()) {
//侦听回传
vc.emit($props.callBackListener, $props.callBackFunction, vc.component.addPurchaseApplyViewInfo2);
return;
} else if (vc.component.addPurchaseApplyViewInfo2.resOrderType == 20000 && vc.component.addComplainValidate2()){
} else if (vc.component.addPurchaseApplyViewInfo2.resOrderType == 20000 && vc.component.addComplainValidate2()) {
//侦听回传
vc.emit($props.callBackListener, $props.callBackFunction, vc.component.addPurchaseApplyViewInfo2);
}else{
} else {
vc.emit($props.callBackListener, $props.callBackFunction, null);
}
}
}
});
})(window.vc);
})(window.vc);

View File

@ -126,7 +126,7 @@
vc.toast("请选择需要采购的物品");
return;
}
var _resourceStores = [];
let _resourceStores = [];
for (var i = 0; i < selectResourceStores.length; i++) {
for (j = 0; j < resourceStores.length; j++) {
if (selectResourceStores[i] == resourceStores[j].resId) {

View File

@ -77,5 +77,5 @@
</div>
<vc:create path="dev/addReportCustomComponentFooter" callBackListener="" callBackFunction=""></vc:create>
<vc:create path="dev/editReportCustomComponentFooter"></vc:create>
<!-- <vc:create path="dev/deleteReportCustomComponentFooter"></vc:create> -->
<vc:create path="dev/deleteReportCustomComponentFooter"></vc:create>
</div>