Browse Source

提交物资流程页面

dev
long 2 years ago
parent
commit
525c3e4ad1
  1. 317
      src/views/activiti/form/ProcessUdgetPlanForm.vue
  2. 22
      src/views/activiti/mixins/activitiMixin.js

317
src/views/activiti/form/ProcessUdgetPlanForm.vue

@ -1,58 +1,62 @@
<template>
<a-spin :spinning="confirmLoading">
<j-form-container :disabled="formDisabled">
<!-- 主表单区域 -->
<a-form :form="form" slot="detail">
<a-row>
<a-col :span="12" >
<a-col :span="12">
<a-form-item label="流程发起公司" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-select-depart v-decorator="['company']" multi />
<j-select-depart v-decorator="['company']" multi/>
</a-form-item>
</a-col>
<a-col :span="12" >
<a-col :span="12">
<a-form-item label="流程发起时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-date placeholder="请选择流程发起时间" v-decorator="['createTime']" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
<j-date placeholder="请选择流程发起时间" v-decorator="['createTime']" :trigger-change="true" :show-time="true"
date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/>
</a-form-item>
</a-col>
<a-col :span="12" >
<a-col :span="12">
<a-form-item label="流程发起部门" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-select-depart v-decorator="['sysOrgCode']" multi />
<j-select-depart v-decorator="['sysOrgCode']" multi/>
</a-form-item>
</a-col>
<a-col :span="12" >
<a-col :span="12">
<a-form-item label="流程发起人" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-select-user-by-dep v-decorator="['createBy']" />
<j-select-user-by-dep v-decorator="['createBy']"/>
</a-form-item>
</a-col>
<a-col :span="12" >
<a-col :span="12">
<a-form-item label="物资类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag type="list" v-decorator="['materialType']" :trigger-change="true" dictCode="" placeholder="请选择物资类型" />
<j-dict-select-tag type="list" v-decorator="['materialType']" :trigger-change="true" dictCode=""
placeholder="请选择物资类型"/>
</a-form-item>
</a-col>
<a-col :span="12" >
<a-col :span="12">
<a-form-item label="流程计划" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag type="list" v-decorator="['processPlan']" :trigger-change="true" dictCode="" placeholder="请选择流程计划" />
<j-dict-select-tag type="list" v-decorator="['processPlan']" :trigger-change="true" dictCode=""
placeholder="请选择流程计划"/>
</a-form-item>
</a-col>
<a-col :span="12" >
<a-col :span="12">
<a-form-item label="需求时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-date placeholder="请选择需求时间" v-decorator="['needTime']" :trigger-change="true" style="width: 100%" />
<j-date placeholder="请选择需求时间" v-decorator="['needTime']" :trigger-change="true" style="width: 100%"/>
</a-form-item>
</a-col>
<a-col :span="12" >
<a-col :span="12">
<a-form-item label="顺序号" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input-number v-decorator="['orderNumber']" placeholder="请输入顺序号" style="width: 100%" />
<a-input-number v-decorator="['orderNumber']" placeholder="请输入顺序号" style="width: 100%"/>
</a-form-item>
</a-col>
<a-col :span="12" >
<a-col :span="12">
<a-form-item label="文件id" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-upload v-decorator="['fileId']" :trigger-change="true" ></j-upload>
<j-upload v-decorator="['fileId']" :trigger-change="true"></j-upload>
</a-form-item>
</a-col>
</a-row>
</a-form>
</j-form-container>
<!-- 子表单区域 -->
<!-- 子表单区域 -->
<a-tabs v-model="activeKey" @change="handleChangeTabs">
<a-tab-pane tab="预算计划采购流程物料清单表" :key="refKeys[0]" :forceRender="true">
<j-editable-table
@ -67,6 +71,16 @@
:actionButton="true"/>
</a-tab-pane>
</a-tabs>
<div class="div_process">
<a-form-item v-if="!disabled" :wrapperCol="{ span: 24 }" style="text-align: center">
<a-button type="primary" :disabled="disabled||btndisabled" @click="handleSubmit">保存</a-button>
<a-button style="margin-left: 8px" :disabled="disabled" @click="close">取消</a-button>
</a-form-item>
<a-form-item v-if="task" :wrapperCol="{ span: 24 }" style="text-align: center">
<a-button type="primary" @click="passTask">通过</a-button>
<a-button style="margin-left: 8px" @click="backTask">驳回</a-button>
</a-form-item>
</div>
</a-spin>
</template>
@ -74,16 +88,15 @@
import pick from 'lodash.pick'
import { getAction } from '@/api/manage'
import { FormTypes,getRefPromise } from '@/utils/JEditableTableUtil'
import { FormTypes, getRefPromise } from '@/utils/JEditableTableUtil'
import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
import { validateDuplicateValue } from '@/utils/util'
import JFormContainer from '@/components/jeecg/JFormContainer'
import JDate from '@/components/jeecg/JDate'
import JDate from '@/components/jeecg/JDate'
import JUpload from '@/components/jeecg/JUpload'
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
import JDictSelectTag from "@/components/dict/JDictSelectTag"
import JDictSelectTag from '@/components/dict/JDictSelectTag'
export default {
name: 'ProcessUdgetPlanForm',
mixins: [JEditableTableMixin],
@ -95,30 +108,47 @@
JSelectUserByDep,
JDictSelectTag,
},
props:{
/*全局禁用,可表示查看*/
disabled:{
type:Boolean,
default:false,
required:false
},
/*流程数据*/
processData:{
type:Object,
default:()=>{return {}},
required:false
},
/*是否新增*/
isNew: {type: Boolean, default: false, required: false},
/*是否处理流程*/
task: {type: Boolean, default: false, required: false}
},
data() {
return {
labelCol: {
xs: { span: 24 },
sm: { span: 6 },
sm: { span: 6 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
sm: { span: 16 }
},
labelCol2: {
xs: { span: 24 },
sm: { span: 3 },
sm: { span: 3 }
},
wrapperCol2: {
xs: { span: 24 },
sm: { span: 20 },
sm: { span: 20 }
},
//
addDefaultRowNum: 1,
validatorRules: {
},
refKeys: ['processUdgetPlanMaterial', ],
tableKeys:['processUdgetPlanMaterial', ],
validatorRules: {},
refKeys: ['processUdgetPlanMaterial'],
tableKeys: ['processUdgetPlanMaterial'],
activeKey: 'processUdgetPlanMaterial',
//
processUdgetPlanMaterialTable: {
@ -129,179 +159,182 @@
title: '物料组',
key: 'materialGroup',
type: FormTypes.sel_search,
dictCode:"",
width:"200px",
dictCode: '',
width: '200px',
placeholder: '请输入${title}',
defaultValue:'',
defaultValue: ''
},
{
title: '物料号',
key: 'materialNumber',
type: FormTypes.sel_search,
dictCode:"",
width:"200px",
dictCode: '',
width: '200px',
placeholder: '请输入${title}',
defaultValue:'',
defaultValue: ''
},
{
title: '物料描述',
key: 'materialDescription',
type: FormTypes.input,
width:"200px",
width: '200px',
placeholder: '请输入${title}',
defaultValue:'',
defaultValue: ''
},
{
title: '仓储地点_id',
key: 'unitWasteWarehouseCodeId',
type: FormTypes.input,
width:"200px",
width: '200px',
placeholder: '请输入${title}',
defaultValue:'',
defaultValue: ''
},
{
title: '生产时间',
key: 'productionTime',
type: FormTypes.date,
width:"200px",
width: '200px',
placeholder: '请输入${title}',
defaultValue:'',
defaultValue: ''
},
{
title: '保质期',
key: 'expirationDate',
type: FormTypes.date,
width:"200px",
width: '200px',
placeholder: '请输入${title}',
defaultValue:'',
defaultValue: ''
},
{
title: '是否到货',
key: 'arrivalNotice',
type: FormTypes.inputNumber,
width:"200px",
width: '200px',
placeholder: '请输入${title}',
defaultValue:'',
defaultValue: ''
},
{
title: '入库时间',
key: 'storageTime',
type: FormTypes.date,
width:"200px",
width: '200px',
placeholder: '请输入${title}',
defaultValue:'',
defaultValue: ''
},
{
title: '入库人',
key: 'librarySign',
type: FormTypes.input,
width:"200px",
width: '200px',
placeholder: '请输入${title}',
defaultValue:'',
defaultValue: ''
},
{
title: '核算属性',
key: 'materialType',
type: FormTypes.input,
width:"200px",
width: '200px',
placeholder: '请输入${title}',
defaultValue:'',
defaultValue: ''
},
{
title: '物料名称及规格型号',
key: 'materialName',
type: FormTypes.sel_search,
dictCode:"",
width:"200px",
dictCode: '',
width: '200px',
placeholder: '请输入${title}',
defaultValue:'',
defaultValue: ''
},
{
title: '系列',
key: 'materialSeries',
type: FormTypes.sel_search,
dictCode:"",
width:"200px",
dictCode: '',
width: '200px',
placeholder: '请输入${title}',
defaultValue:'',
defaultValue: ''
},
{
title: '单位',
key: 'materialUnit',
type: FormTypes.select,
dictCode:"",
width:"200px",
dictCode: '',
width: '200px',
placeholder: '请输入${title}',
defaultValue:'',
defaultValue: ''
},
{
title: '单价',
key: 'materialPrice',
type: FormTypes.inputNumber,
width:"200px",
width: '200px',
placeholder: '请输入${title}',
defaultValue:'',
defaultValue: ''
},
{
title: '对比单价',
key: 'contrastPrice',
type: FormTypes.popup,
popupCode:"",
destFields:"",
orgFields:"",
width:"200px",
popupCode: '',
destFields: '',
orgFields: '',
width: '200px',
placeholder: '请输入${title}',
defaultValue:'',
defaultValue: ''
},
{
title: '数量',
key: 'materialQuantity',
type: FormTypes.inputNumber,
width:"200px",
width: '200px',
placeholder: '请输入${title}',
defaultValue:'',
defaultValue: ''
},
{
title: '金额',
key: 'materialAmount',
type: FormTypes.inputNumber,
width:"200px",
width: '200px',
placeholder: '请输入${title}',
defaultValue:'',
defaultValue: ''
},
{
title: '执行标准',
key: 'materialStandard',
type: FormTypes.input,
width:"200px",
width: '200px',
placeholder: '请输入${title}',
defaultValue:'',
defaultValue: ''
},
{
title: '备注',
key: 'remarks',
type: FormTypes.input,
width:"200px",
width: '200px',
placeholder: '请输入${title}',
defaultValue:'',
},
defaultValue: ''
}
]
},
url: {
add: "/hy/processUdgetPlan/add",
edit: "/hy/processUdgetPlan/edit",
queryById: "/hy/processUdgetPlan/queryById",
getForm:'/actBusiness/getForm',
add: '/hy/processUdgetPlan/add',
edit: '/hy/processUdgetPlan/edit',
queryById: '/hy/processUdgetPlan/queryById',
processUdgetPlanMaterial: {
list: '/hy/processUdgetPlan/queryProcessUdgetPlanMaterialByMainId'
},
}
}
},
btndisabled: false
}
},
props: {
//data
formData: {
type: Object,
default: ()=>{},
default: () => {
},
required: false
},
//false true
@ -318,32 +351,70 @@
}
},
computed: {
formDisabled(){
if(this.formBpm===true){
if(this.formData.disabled===false){
formDisabled() {
if (this.formBpm === true) {
if (this.formData.disabled === false) {
return false
}
return true
}
return this.disabled
},
showFlowSubmitButton(){
if(this.formBpm===true){
if(this.formData.disabled===false){
showFlowSubmitButton() {
if (this.formBpm === true) {
if (this.formData.disabled === false) {
return true
}
}
return false
}
},
created () {
created() {
//data
this.showFlowData();
console.log("流程数据",this.processData)
this.showFlowData()
if (!this.isNew){
this.init();
}
},
methods: {
addBefore(){
/*回显数据*/
init(){
this.btndisabled = true;
var r = this.processData;
this.getAction(this.url.getForm,{
tableId:r.tableId,
tableName:r.tableName,
}).then((res)=>{
if (res.success){
let formData = res.result;
formData.tableName = r.tableName;
this.data = formData;
console.log("表单回显数据",this.data)
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.data,'name'))
});
this.btndisabled = false;
}else {
this.$message.error(res.message)
}
})
},
close() {
//todo
this.$emit('close')
},
/*通过审批*/
passTask() {
this.$emit('passTask')
},
/*驳回审批*/
backTask() {
this.$emit('backTask')
},
addBefore() {
this.form.resetFields()
this.processUdgetPlanMaterialTable.dataSource=[]
this.processUdgetPlanMaterialTable.dataSource = []
},
getAllTable() {
let values = this.tableKeys.map(key => getRefPromise(this, key))
@ -351,7 +422,7 @@
},
/** 调用完edit()方法之后会自动调用此方法 */
editAfter() {
let fieldval = pick(this.model,'company','createTime','sysOrgCode','createBy','materialType','processPlan','needTime','orderNumber','fileId')
let fieldval = pick(this.model, 'company', 'createTime', 'sysOrgCode', 'createBy', 'materialType', 'processPlan', 'needTime', 'orderNumber', 'fileId')
this.$nextTick(() => {
this.form.setFieldsValue(fieldval)
})
@ -366,30 +437,64 @@
let main = Object.assign(this.model, allValues.formValue)
return {
...main, //
processUdgetPlanMaterialList: allValues.tablesValue[0].values,
processUdgetPlanMaterialList: allValues.tablesValue[0].values
}
},
//
showFlowData(){
if(this.formBpm === true){
let params = {id:this.formData.dataId};
getAction(this.url.queryById,params).then((res)=>{
if(res.success){
this.edit (res.result);
showFlowData() {
if (this.formBpm === true) {
let params = { id: this.formData.dataId }
getAction(this.url.queryById, params).then((res) => {
if (res.success) {
this.edit(res.result)
}
})
}
},
validateError(msg){
validateError(msg) {
this.$message.error(msg)
},
popupCallback(row){
this.form.setFieldsValue(pick(row,'company','createTime','sysOrgCode','createBy','materialType','processPlan','needTime','orderNumber','fileId'))
},
popupCallback(row) {
this.form.setFieldsValue(pick(row, 'company', 'createTime', 'sysOrgCode', 'createBy', 'materialType', 'processPlan', 'needTime', 'orderNumber', 'fileId'))
},
// handler
handleSubmit (e) {
e.preventDefault()
this.form.validateFields((err, values) => {
if (!err) {
let formData = Object.assign(this.data||{}, values)
formData.procDefId = this.processData.id;
formData.procDeTitle = this.processData.name;
if (!formData.tableName)formData.tableName = this.processData.businessTable;
formData.filedNames = _.keys(values).join(",");
console.log('formData', values)
var url = this.url.addApply;
if (!this.isNew){
url = this.url.editForm;
}
this.btndisabled = true;
this.postFormAction(url,formData).then((res)=>{
if (res.success){
this.$message.success("保存成功!")
//todo
this.$emit('afterSubmit',formData)
}else {
this.$message.error(res.message)
}
}).finally(()=>{
this.btndisabled = false;
})
}
})
},
}
}
</script>
<style scoped>
.div_process{
margin-top: 30px;
}
</style>

22
src/views/activiti/mixins/activitiMixin.js

@ -18,53 +18,59 @@ export const activitiMixin = {
/*todo 所有的流程表单,组件化注册,在此维护*/
allFormComponent:function(){
return [
{
text:'测试流程表单',
routeName:'@/views/activiti/form/demoForm',
component:() => import(`@/views/activiti/form/demoForm`),
businessTable:'test_demo'
},
{
text:'预算计划采购流程',
routeName:'@/views/activiti/form/ProcessUdgetPlanForm',
component:() => import(`@/views/activiti/form/ProcessUdgetPlanForm`),
businessTable:'ProcessUdgetPlanForm'
businessTable:'process_udget_plan'
},
{
text:'物资入库流程',
routeName:'@/views/activiti/form/ProcessMaterialWarehousingForm',
component:() => import(`@/views/activiti/form/ProcessMaterialWarehousingForm`),
businessTable:'ProcessMaterialWarehousingForm'
businessTable:'process_material_warehousing'
},
{
text:'物资出库流程',
routeName:'@/views/activiti/form/ProcessMaterialsDeliveryForm',
component:() => import(`@/views/activiti/form/ProcessMaterialsDeliveryForm`),
businessTable:'ProcessMaterialsDeliveryForm'
businessTable:'process_materials_delivery'
},
{
text:'物资调拨流程',
routeName:'@/views/activiti/form/ProcessMaterialsAllotForm',
component:() => import(`@/views/activiti/form/ProcessMaterialsAllotForm`),
businessTable:'ProcessMaterialsAllotForm'
businessTable:'process_materials_allot'
},
{
text:'物资借用流程',
routeName:'@/views/activiti/form/ProcessMaterialBorrowingForm',
component:() => import(`@/views/activiti/form/ProcessMaterialBorrowingForm`),
businessTable:'ProcessMaterialBorrowingForm'
businessTable:'process_material_borrowing'
},
{
text:'物资归还流程',
routeName:'@/views/activiti/form/ProcessMaterialsReturnForm',
component:() => import(`@/views/activiti/form/ProcessMaterialsReturnForm`),
businessTable:'ProcessMaterialsReturnForm'
businessTable:'process_materials_return'
},
{
text:'物资报废流程',
routeName:'@/views/activiti/form/ProcessSmaterialsScrapForm',
component:() => import(`@/views/activiti/form/ProcessSmaterialsScrapForm`),
businessTable:'ProcessSmaterialsScrapForm'
businessTable:'process_smaterials_scrap'
},
{
text:'特殊物资审批流程',
routeName:'@/views/activiti/form/ProcessSpecialMaterialsForm',
component:() => import(`@/views/activiti/form/ProcessSpecialMaterialsForm`),
businessTable:'ProcessSpecialMaterialsForm'
businessTable:'process_special_materials'
},
]
},

Loading…
Cancel
Save