优化代码

This commit is contained in:
java110 2020-07-15 17:59:05 +08:00
parent f48fe11ba8
commit fe6283de0b
6 changed files with 269 additions and 201 deletions

View File

@ -10,50 +10,60 @@
</div>
<div class="ibox-content">
<table class="footable table table-stripped toggle-arrow-tiny"
data-page-size="15"
>
<table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15">
<thead>
<tr>
<th class="text-center">订单号</th>
<th class="text-center">订单类型</th>
<th class="text-center">订单状态</th>
<th class="text-center">创建时间</th>
<th class="text-right">操作</th>
</tr>
<tr>
<th class="text-center">订单号</th>
<th class="text-center">订单类型</th>
<th class="text-center">订单状态</th>
<th class="text-center">创建时间</th>
<th class="text-right">操作</th>
</tr>
</thead>
<tbody>
<tr v-for="auditOrder in auditOrdersInfo.auditOrders">
<td class="text-center">{{auditOrder.applyOrderId}}</td>
<td class="text-center">{{auditOrder.resOrderTypeName}}</td>
<td class="text-center">{{auditOrder.stateName}}</td>
<td class="text-center">{{auditOrder.createTime}}</td>
<td class="text-right">
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openDetailPurchaseApplyModel(auditOrder)">查看
</button>
</div>
<div class="btn-group" v-if="auditOrdersInfo.currentUserId != auditOrder.userId">
<button class="btn-white btn btn-xs"
v-on:click="_openAuditOrderModel(auditOrder)">审批
</button>
</div>
<div class="btn-group" else>
<button class="btn-white btn btn-xs"
v-on:click="_finishAuditOrder(auditOrder)">结束
</button>
</div>
</td>
<tr v-for="auditOrder in auditOrdersInfo.auditOrders">
<td class="text-center">{{auditOrder.applyOrderId}}</td>
<td class="text-center">{{auditOrder.resOrderTypeName}}</td>
<td class="text-center">{{auditOrder.stateName}}</td>
<td class="text-center">{{auditOrder.createTime}}</td>
<td class="text-right">
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openDetailPurchaseApplyModel(auditOrder)">查看
</button>
</div>
<div v-if="auditOrdersInfo.procure == false">
<div class="btn-group"
v-if="auditOrdersInfo.currentUserId != auditOrder.userId">
<button class="btn-white btn btn-xs"
v-on:click="_openAuditOrderModel(auditOrder)">审批
</button>
</div>
<div class="btn-group" v-else>
<button class="btn-white btn btn-xs"
v-on:click="_finishAuditOrder(auditOrder)">结束
</button>
</div>
</div>
</tr>
<div class="btn-group" v-else>
<button class="btn-white btn btn-xs"
v-on:click="_procureEnterOrder(auditOrder)">采购入库
</button>
</div>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="7">
<ul class="pagination float-right"></ul>
</td>
</tr>
<tr>
<td colspan="7">
<ul class="pagination float-right"></ul>
</td>
</tr>
</tfoot>
</table>
<!-- 分页 -->
@ -62,8 +72,5 @@
</div>
</div>
</div>
<vc:create path="common/audit"
callBackListener="myAuditOrders"
callBackFunction="notifyAudit"
></vc:create>
</div>
<vc:create path="common/audit" callBackListener="myAuditOrders" callBackFunction="notifyAudit"></vc:create>
</div>

View File

@ -18,11 +18,13 @@
userName: '',
auditLink: '',
},
orderInfo:''
orderInfo:'',
procure:false
}
},
_initMethod: function () {
vc.component._listAuditOrders(DEFAULT_PAGE, DEFAULT_ROWS);
$that._loadStepStaff();
},
_initEvent: function () {
@ -117,6 +119,34 @@
vc.toast("处理失败:" + errInfo);
}
);
},
_loadStepStaff: function () {
var param = {
params: {
page:1,
row:1,
staffId: $that.auditOrdersInfo.currentUserId,
staffRole: '2002'
}
};
//发送get请求
vc.http.apiGet('workflow.listWorkflowStepStaffs',
param,
function (json, res) {
var _json = JSON.parse(json);
if(_json.data.length > 0){
$that.auditOrdersInfo.procure = true;
}
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_procureEnterOrder:function(_purchaseApply){
vc.jumpToPage("/admin.html#/pages/common/resourceEnterManage?applyOrderId="+_purchaseApply.applyOrderId+"&resOrderType="+_purchaseApply.resOrderType+"&taskId="+_purchaseApply.taskId);
}

View File

@ -1,111 +1,66 @@
<div id="component" class="wrapper wrapper-content animated fadeInRight ecommerce">
<div class="row">
<div class="col-lg-12">
<div class="ibox ">
<div class="ibox-title">
<h5>查询条件</h5>
<div class="ibox-tools" style="top:10px;">
</div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-sm-4">
<div class="form-group">
<input type="text" placeholder="订单号"
v-model="purchaseApplyManageInfo.conditions.applyOrderId" class=" form-control">
</div>
</div>
<div class="col-sm-3">
<select class="custom-select" v-model="purchaseApplyManageInfo.conditions.state">
<option selected value="">订单状态</option>
<option value="1000">未审核</option>
<option value="1001">审核中</option>
<option value="1002">已审核</option>
</select>
</div>
<div class="col-sm-4">
<div class="form-group">
<input type="text" placeholder="请填写申请人姓名"
v-model="purchaseApplyManageInfo.conditions.userName" class=" form-control">
</div>
</div>
<div class="col-sm-1">
<button type="button" class="btn btn-primary btn-sm"
v-on:click="_queryInspectionPlanMethod()">
<i class="fa fa-search"></i> 查询
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div class="row">
<div class="col-lg-12">
<div class="ibox">
<div class="ibox-title">
<h5>采购信息</h5>
<h5>单号:{{resourceEnterManageInfo.applyOrderId}}</h5>
</div>
<div class="ibox-content">
<table class="footable table table-stripped toggle-arrow-tiny"
data-page-size="15"
>
<table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15">
<thead>
<tr>
<th class="text-center">单号</th>
<th class="text-center">审批状态</th>
<th class="text-center">流程处理人</th>
<th class="text-center">申请人</th>
<th class="text-center">申请时间</th>
<th class="text-center">物品</th>
<th class="text-center">总计价格</th>
<th class="text-center">操作</th>
</tr>
<tr>
<th class="text-center">物品名称</th>
<th class="text-center">物品编码</th>
<th class="text-center">物品库存</th>
<th class="text-center">申请数量</th>
<th class="text-center">采购数量</th>
<th class="text-center">采购单价</th>
<th class="text-center">备注</th>
</tr>
</thead>
<tbody>
<tr v-for="purchaseApply in purchaseApplyManageInfo.purchaseApplys">
<td class="text-center">{{purchaseApply.applyOrderId}}</td>
<td class="text-center">{{purchaseApply.stateName}}</td>
<td class="text-center">{{purchaseApply.agreeMan}}</td>
<td class="text-center">{{purchaseApply.userName}}</td>
<td class="text-center">{{purchaseApply.createTime}}</td>
<td class="text-center">{{purchaseApply.resourceNames}}</td>
<td class="text-center">{{purchaseApply.totalPrice}}</td>
<td class="text-center">
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openDetailPurchaseApplyModel(purchaseApply)">查看
</button>
</div>
<div class="btn-group" v-if="purchaseApply.state == '1000'">
<button class="btn-white btn btn-xs"
v-on:click="_openResourceEnterDetailManageModel(purchaseApply)">入库
</button>
</div>
</td>
<tr v-for="resourceEnter in resourceEnterManageInfo.purchaseApplyDetailVo">
<td class="text-center">{{resourceEnter.resName}}</td>
<td class="text-center">{{resourceEnter.resCode}}</td>
<td class="text-center">{{resourceEnter.stock}}</td>
<td class="text-center">{{resourceEnter.quantity}}</td>
<td class="text-center">
<input v-model="resourceEnter.purchaseQuantity" type="number"
placeholder="必填,请填写采购数量" class="form-control">
</td>
<td class="text-center">
<input v-model="resourceEnter.price" type="text"
placeholder="必填,请填写采购单价" class="form-control">
</td>
<td class="text-center">
<input v-model="resourceEnter.purchaseRemark" type="text" placeholder="可填,请填写备注" class="form-control">
</td>
</tr>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="7">
<ul class="pagination float-right"></ul>
</td>
</tr>
<tr>
<td colspan="7">
<ul class="pagination float-right"></ul>
</td>
</tr>
</tfoot>
</table>
<!-- 分页 -->
<vc:create path="frame/pagination"></vc:create>
</div>
</div>
</div>
</div>
<vc:create path="common/addResourceQuantity"></vc:create>
<div class="row">
<div class="col-md-10"></div>
<div class="col-md-2 " style="margin-bottom:10px; text-align:right">
<button type="button" class="btn btn-primary"
style="margin-left:10px;" v-on:click="_submit()">提交
</button>
</div>
</div>
</div>
</div>

View File

@ -1,89 +1,139 @@
/**
//入库
**/
(function(vc){
(function (vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
data:{
purchaseApplyManageInfo:{
purchaseApplys:[],
total:0,
records:1,
moreCondition:false,
applyOrderId:'',
states:'',
conditions:{
state:'1002',
userName:'',
resOrderType:'10000'
}
data: {
resourceEnterManageInfo: {
resourceEnters: [],
applyOrderId: '',
taskId:'',
resOrderType: '',
purchaseApplyDetailVo: [],
}
},
_initMethod:function(){
vc.component._listPurchaseApplys(DEFAULT_PAGE, DEFAULT_ROWS);
vc.getDict('purchase_apply',"state",function(_data){
vc.component.purchaseApplyManageInfo.states = _data;
});
_initMethod: function () {
vc.component.resourceEnterManageInfo.applyOrderId = vc.getParam('applyOrderId');
vc.component.resourceEnterManageInfo.resOrderType = vc.getParam('resOrderType');
vc.component.resourceEnterManageInfo.taskId = vc.getParam('taskId');
vc.component._listPurchaseApply(DEFAULT_PAGE, DEFAULT_ROWS);
},
_initEvent:function(){
vc.on('purchaseApplyManage','listPurchaseApply',function(_param){
vc.component._listPurchaseApplys(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('pagination','page_event',function(_currentPage){
vc.component._listPurchaseApplys(_currentPage,DEFAULT_ROWS);
});
},
methods:{
_listPurchaseApplys:function(_page, _rows){
_initEvent: function () {
vc.component.purchaseApplyManageInfo.conditions.page = _page;
vc.component.purchaseApplyManageInfo.conditions.row = _rows;
},
methods: {
_listPurchaseApply: function (_page, _rows) {
var param = {
params:vc.component.purchaseApplyManageInfo.conditions
};
params: {
page: _page,
row: _rows,
applyOrderId: vc.component.resourceEnterManageInfo.applyOrderId,
resOrderType: vc.component.resourceEnterManageInfo.resOrderType,
}
};
//发送get请求
vc.http.get('purchaseApplyManage',
'list',
param,
function(json,res){
var _purchaseApplyManageInfo=JSON.parse(json);
vc.component.purchaseApplyManageInfo.total = _purchaseApplyManageInfo.total;
vc.component.purchaseApplyManageInfo.records = _purchaseApplyManageInfo.records;
vc.component.purchaseApplyManageInfo.purchaseApplys = _purchaseApplyManageInfo.purchaseApplys;
vc.emit('pagination','init',{
total:vc.component.purchaseApplyManageInfo.records,
currentPage:_page
});
},function(errInfo,error){
console.log('请求失败处理');
}
);
//发送get请求
vc.http.get('purchaseApplyManage',
'list',
param,
function (json, res) {
var _purchaseApplyDetailInfo = JSON.parse(json);
var _purchaseApply = _purchaseApplyDetailInfo.purchaseApplys;
vc.copyObject(_purchaseApply[0], vc.component.resourceEnterManageInfo);
$that.resourceEnterManageInfo.purchaseApplyDetailVo.forEach(function (item) {
item.purchaseQuantity = '';
item.price = '';
item.purchaseRemark = '';
});
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_openDetailPurchaseApplyModel:function(_purchaseApply){
vc.jumpToPage("/admin.html#/pages/common/purchaseApplyDetail?applyOrderId="+_purchaseApply.applyOrderId+"&resOrderType=10000");
_openDetailResourceEnterModel: function (_resourceEnter) {
vc.jumpToPage("/admin.html#/pages/common/resourceEnterDetail?applyOrderId=" + _resourceEnter.applyOrderId + "&resOrderType=10000");
},
_openResourceEnterDetailManageModel:function(_purchaseApply){
vc.jumpToPage("/admin.html#/pages/common/resourceEnterDetailManage?applyOrderId="+_purchaseApply.applyOrderId+"&resOrderType=10000");
_openResourceEnterDetailManageModel: function (_resourceEnter) {
vc.jumpToPage("/admin.html#/pages/common/resourceEnterDetailManage?applyOrderId=" + _resourceEnter.applyOrderId + "&resOrderType=10000");
},
_queryPurchaseApplyMethod:function(){
vc.component._listPurchaseApplys(DEFAULT_PAGE, DEFAULT_ROWS);
_queryResourceEnterMethod: function () {
vc.component._listResourceEnters(DEFAULT_PAGE, DEFAULT_ROWS);
},
_moreCondition:function(){
if(vc.component.purchaseApplyManageInfo.moreCondition){
vc.component.purchaseApplyManageInfo.moreCondition = false;
}else{
vc.component.purchaseApplyManageInfo.moreCondition = true;
_moreCondition: function () {
if (vc.component.resourceEnterManageInfo.moreCondition) {
vc.component.resourceEnterManageInfo.moreCondition = false;
} else {
vc.component.resourceEnterManageInfo.moreCondition = true;
}
},
_queryInspectionPlanMethod:function () {
vc.component._listPurchaseApplys(DEFAULT_PAGE, DEFAULT_ROWS);
_queryInspectionPlanMethod: function () {
vc.component._listResourceEnters(DEFAULT_PAGE, DEFAULT_ROWS);
},
_openAddResourceQuantityModel:function () {
_openAddResourceQuantityModel: function () {
}
},
_submit: function () {
//校验 是否填写正确
$that.resourceEnterManageInfo.purchaseApplyDetailVo.forEach(function (item) {
if (!vc.notNull(item.purchaseQuantity)) {
vc.toast('采购数量未填写')
return;
}
if (!vc.notNull(item.price)) {
vc.toast('单价未填写')
return;
}
});
vc.http.apiPost(
'/purchase/resourceEnter',
JSON.stringify($that.resourceEnterManageInfo),
{
emulateJSON: true
},
function (json, res) {
let _json = JSON.parse(json);
if (_json.code == 0) {
//处理审核通过
$that._finishAuditOrder();
return;
}
vc.toast(_json.msg);
},
function (errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo);
});
},
_finishAuditOrder:function(){
let _auditInfo = {
taskId: $that.resourceEnterManageInfo.taskId,
applyOrderId: $that.resourceEnterManageInfo.applyOrderId,
state:'1100',
remark:'采购入库完成'
};
//发送get请求
vc.http.post('myAuditOrders',
'audit',
JSON.stringify(_auditInfo),
{
emulateJSON: true
},
function (json, res) {
vc.toast("处理成功");
vc.goBack();
}, function (errInfo, error) {
console.log('请求失败处理');
vc.toast("处理失败:" + errInfo);
}
);
},
}

View File

@ -54,6 +54,23 @@
</label>
</div>
</div>
<div class="margin-left" @click="chooseStaffRole(item)" v-if="workflowSettingInfo.flowType == '30003'">
<div class="form-check form-check-inline col-form-label">
<input class="form-check-input" type="radio" v-bind:name="index+'-radio1'"
v-bind:id="index+'-radio3'" value="2002" v-model="item.staffRole" checked>
<label class="form-check-label" v-bind:for="index+'-radio4'">
采购人员
</label>
</div>
<div class="form-check form-check-inline col-form-label">
<input class="form-check-input" type="radio" v-bind:name="index+'-radio1'"
v-bind:id="index+'-radio4'" value="1001" v-model="item.staffRole">
<label class="form-check-label" v-bind:for="index+'-radio3'">
普通人员
</label>
</div>
</div>
<div>
<button type="button" class="btn btn-link" @click="deleteStep(item)">删除步骤</button>
</div>

View File

@ -5,6 +5,7 @@
workflowSettingInfo: {
flowId: '',
flowName: '',
flowType: '',
describle: '',
steps: []
}
@ -53,6 +54,7 @@
}
$that.workflowSettingInfo.flowId = flowId;
$that.workflowSettingInfo.flowName = vc.getParam('flowName');
$that.workflowSettingInfo.flowType = vc.getParam('flowType');
//查询步骤
var param = {
@ -92,6 +94,7 @@
staffId: _workflowStep.workflowStepStaffs[0].staffId,
staffName: _workflowStep.workflowStepStaffs[0].staffName,
type: _workflowStep.type,
staffRole: _workflowStep.workflowStepStaffs[0].staffRole,
subStaff: []
};
if (_workflowStep.type == 2) {
@ -110,7 +113,8 @@
let _subStaff = {
id: vc.uuid(),
staffId: _workflowStepStaff.staffId,
staffName: _workflowStepStaff.staffName
staffName: _workflowStepStaff.staffName,
staffRole: _workflowStepStaff.staffRole
}
_subStaffs.push(_subStaff);
@ -152,7 +156,8 @@
_step.subStaff.push({
id: vc.uuid(),
staffId: '',
staffName: ''
staffName: '',
staffRole: '1001'
});
},
deleteStaff: function (_step, _subStaff) {
@ -166,6 +171,10 @@
if (_item.type == '1') {
_item.subStaff = [];
}
},
chooseStaffRole: function () {
}
}
});