You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1173 lines
45 KiB
1173 lines
45 KiB
<template> |
|
<a-spin :spinning="confirmLoading"> |
|
<j-form-container :disabled="formDisabled"> |
|
<!-- 主表单区域 --> |
|
<a-form :form="form" slot="detail"> |
|
<a-row> |
|
<a-col :span="8" v-show="false"> |
|
<a-form-item label="ID" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
<a-input v-decorator="['id']" placeholder="" style="width: 100%"/> |
|
</a-form-item> |
|
</a-col> |
|
<a-col :span="8" v-show="false"> |
|
<a-form-item label="ID" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
<a-input v-decorator="['id']" placeholder="" style="width: 100%" disabled/> |
|
</a-form-item> |
|
</a-col> |
|
<a-col :span="8" > |
|
<a-form-item label="流程发起人" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
<j-select-user-by-dep v-decorator="['createBy']" disabled/> |
|
</a-form-item> |
|
</a-col> |
|
<a-col :span="8" > |
|
<a-form-item label="流程发起公司" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
<j-select-company v-decorator="['company']" multi disabled/> |
|
</a-form-item> |
|
</a-col> |
|
<a-col :span="8" > |
|
<a-form-item label="流程发起部门" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
<j-select-depart v-decorator="['sysOrgCode']" multi disabled/> |
|
</a-form-item> |
|
</a-col> |
|
<a-col :span="8" > |
|
<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%" disabled/> |
|
</a-form-item> |
|
</a-col> |
|
<a-col :span="8"> |
|
<a-form-item label="物资类型" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
<j-dict-select-tag type="list" @change="isMaterialType" |
|
v-decorator="['materialType',validatorRules.materialType]" :trigger-change="true" |
|
dictCode="material_type" placeholder="请选择物资类型"/> |
|
</a-form-item> |
|
</a-col> |
|
<a-col :span="8" > |
|
<a-form-item label="出库时间" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
<j-date placeholder="请选择出库时间" v-decorator="['deliveryTime',validatorRules.deliveryTime]" |
|
: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="8" > |
|
<a-form-item label="文件" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
|
<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 |
|
ref="processMaterialsDeliveryList" |
|
:loading="processMaterialsDeliveryListTable.loading" |
|
:columns="processMaterialsDeliveryListTable.columns" |
|
:dataSource="processMaterialsDeliveryListTable.dataSource" |
|
:maxHeight="300" |
|
:disabled="this.heid" |
|
@valueChange ="onSelect" |
|
:rowNumber="true" |
|
:rowSelection="true" |
|
:actionButton="true" |
|
@added="addid" |
|
> |
|
<!-- <template v-slot:qing="props">--> |
|
<!-- <a-input v-decorator="['pleaseSendNumber']" placeholder="请输入" style="width: 100%" @change="shuru" type="number"/>--> |
|
<!-- </template>--> |
|
|
|
</j-editable-table> |
|
</a-tab-pane> |
|
</a-tabs> |
|
<j-form-container > |
|
<a-form :form="form"> |
|
<a-row> |
|
<a-col :span="24" > |
|
<a-form-item label="流程说明" > |
|
<j-editor v-decorator="[ 'opinion', {} ]" triggerChange></j-editor> |
|
<!--<a-input type="textarea" v-decorator="[ 'opinion' ]" :rows="4" />--> |
|
</a-form-item> |
|
</a-col> |
|
</a-row> |
|
</a-form> |
|
</j-form-container> |
|
<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> |
|
|
|
<script> |
|
|
|
import pick from 'lodash.pick' |
|
import { getAction, getCurrentTime, httpAction, getStringArry, getRecord } from '@/api/manage' |
|
import { FormTypes, getRefPromise, validateFormAndTables } 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 JUpload from '@/components/jeecg/JUpload' |
|
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart' |
|
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep' |
|
import JDictSelectTag from '@/components/dict/JDictSelectTag' |
|
import JSelectCompany from '../../../components/jeecgbiz/JSelectCompany' |
|
|
|
export default { |
|
name: 'ProcessMaterialsDeliveryForm', |
|
mixins: [JEditableTableMixin], |
|
components: { |
|
JFormContainer, |
|
JDate, |
|
JUpload, |
|
JSelectDepart, |
|
JSelectUserByDep, |
|
JDictSelectTag, |
|
JSelectCompany |
|
}, |
|
data() { |
|
return { |
|
libraryAssociationIdInvisible:'ZK', |
|
rolePlay :false , |
|
jiy:[], |
|
heid: true, |
|
addId : '', |
|
bigIdMerchandiseNewsList:[], |
|
labelCol: { |
|
xs: { span: 24 }, |
|
sm: { span: 6 }, |
|
}, |
|
wrapperCol: { |
|
xs: { span: 24 }, |
|
sm: { span: 16 }, |
|
}, |
|
labelCol2: { |
|
xs: { span: 24 }, |
|
sm: { span: 3 }, |
|
}, |
|
wrapperCol2: { |
|
xs: { span: 24 }, |
|
sm: { span: 20 }, |
|
}, |
|
// 新增时子表默认添加几行空数据 |
|
addDefaultRowNum: 1, |
|
refKeys: ['processMaterialsDeliveryList', ], |
|
tableKeys:['processMaterialsDeliveryList', ], |
|
activeKey: 'processMaterialsDeliveryList', |
|
// 物资出库流程出库清单 |
|
processMaterialsDeliveryListTable: { |
|
loading: false, |
|
dataSource: [], |
|
columns: [ |
|
{ |
|
title: '物料组', |
|
key: 'materialGroup', |
|
// type: FormTypes.slot, // <-------------改为 slot 格式 |
|
// slotName: 'actions', // <-------------slot 的名称,对应 v-slot 冒号后面和等号前面的内容 |
|
type: FormTypes.sel_search, |
|
dictCode: '', |
|
width: '200px', |
|
placeholder: '请输入${title}', |
|
options: [], |
|
// props:{title: 'show title'} |
|
// scopedSlots: { customRender: 'edit' },//引入的插槽 |
|
// customRender:function (t,r,index) { |
|
// console.log(t,r); |
|
// |
|
// } |
|
}, |
|
{ |
|
title: '物资编号', |
|
key: 'equipment', |
|
type: FormTypes.sel_search, |
|
dictCode: '', |
|
width: '200px', |
|
placeholder: '请输入${title}', |
|
// defaultValue:'', |
|
options: [] |
|
}, |
|
{ |
|
title: 'WBS', |
|
key: 'wbs', |
|
type: FormTypes.input, |
|
dictCode: '', |
|
width: '200px', |
|
placeholder: '请输入${title}', |
|
defaultValue:'', |
|
}, |
|
{ |
|
title: '物料名称', |
|
key: 'materialName', |
|
type: FormTypes.input, |
|
dictCode:"", |
|
width:"200px", |
|
placeholder: '请输入${title}', |
|
defaultValue:'', |
|
}, |
|
{ |
|
title: '规格', |
|
key: 'specification', |
|
type: FormTypes.input, |
|
dictCode:"", |
|
width:"200px", |
|
placeholder: '请输入${title}', |
|
defaultValue:'', |
|
}, { |
|
title: '型号', |
|
key: 'type', |
|
type: FormTypes.input, |
|
dictCode:"", |
|
width:"200px", |
|
placeholder: '请输入${title}', |
|
defaultValue:'', |
|
}, |
|
{ |
|
title: '单位', |
|
key: 'materialUnit', |
|
type: FormTypes.input, |
|
dictCode:"", |
|
width:"200px", |
|
placeholder: '请输入${title}', |
|
defaultValue:'', |
|
}, |
|
// { |
|
// title: '批次', |
|
// key: 'batch', |
|
// type: FormTypes.input, |
|
// width:"200px", |
|
// placeholder: '请输入${title}', |
|
// defaultValue:'', |
|
// }, |
|
{ |
|
title: '请发数', |
|
key: 'pleaseSendNumber', |
|
type: FormTypes.inputNumber, |
|
width:"200px", |
|
placeholder: '请输入${title}', |
|
defaultValue:'', |
|
// slotName: 'qing' |
|
}, |
|
{ |
|
title: '实发数', |
|
key: 'actualSendNumber', |
|
type: FormTypes.inputNumber, |
|
width:"200px", |
|
placeholder: '请输入${title}', |
|
defaultValue:'', |
|
disabled:true, |
|
}, |
|
{ |
|
title: '供货商', |
|
key: 'supplierId', |
|
type: FormTypes.input, |
|
dictCode:"", |
|
width:"200px", |
|
placeholder: '请输入${title}', |
|
defaultValue:'', |
|
}, |
|
{ |
|
title: '单价(元)', |
|
key: 'materialPrice', |
|
type: FormTypes.inputNumber, |
|
width:"200px", |
|
placeholder: '请输入${title}', |
|
defaultValue:'', |
|
disabled:true, |
|
}, |
|
{ |
|
title: '金额(元)', |
|
key: 'materialAmount', |
|
type: FormTypes.inputNumber, |
|
width:"200px", |
|
placeholder: '请输入${title}', |
|
defaultValue:'', |
|
disabled:true, |
|
}, |
|
{ |
|
title: '用途', |
|
key: 'purpose', |
|
type: FormTypes.input, |
|
width:"200px", |
|
placeholder: '请输入${title}', |
|
defaultValue:'', |
|
}, |
|
// { |
|
// title: '', |
|
// key: 'MaterialsDeliveryId', |
|
// type: FormTypes.input, |
|
// width:"0px", |
|
// defaultValue:'', |
|
// disabled:true, |
|
// |
|
// }, |
|
] |
|
}, |
|
url: { |
|
getForm: '/actBusiness/getForm', |
|
add: '/hy/processMaterialsDelivery/add', |
|
edit: '/hy/processMaterialsDelivery/edit', |
|
queryById: '/hy/processMaterialsDelivery/queryById', |
|
descriptionRake: '/suppliesstronger/processSuppliesStronger/descriptionName', //查询总库物料组 |
|
wasteMaterialsUrl: '/wastematerials/processWasteMaterials/wasteMaterialsName', //查询账外物料组 |
|
merchandiseNewsList: '/suppliesstronger/processSuppliesStronger/merchandiseNews', |
|
wasteMaterialsList: '/wastematerials/processWasteMaterials/merchandiseNewsName', //账外 |
|
puwwlist: "/unitwaste/processUnitWasteWarehouseCode/queryById", |
|
unitWasteWarehouseList: "/unitwaste/processUnitWasteWarehouseCode/queryById", //查询目标库 |
|
processMaterialsDeliveryList: { |
|
list: '/hy/processMaterialsDelivery/queryProcessMaterialsDeliveryListByMainId' |
|
} |
|
}, |
|
btndisabled: false, |
|
describes:'', |
|
validatorRules: { |
|
// 'blur'是鼠标失去焦点的时候会触发验证 |
|
materialType: { rules: [{ required: true, message: '请选择物资类型!' }] }, |
|
deliveryTime: { rules: [{ required: true, message: '请选择出库时间!' }] }, |
|
processPlan: { rules: [{ required: true, message: '请选择流程计划!' }] } |
|
}, |
|
materialGroupId: '', |
|
} |
|
}, |
|
props: { |
|
/*流程数据*/ |
|
processData: { |
|
type: Object, |
|
default: () => { |
|
return {} |
|
}, |
|
required: false |
|
}, |
|
/*是否新增*/ |
|
isNew: { type: Boolean, default: false, required: false }, |
|
/*是否处理流程*/ |
|
task: { type: Boolean, default: false, required: false }, |
|
//流程表单data |
|
formData: { |
|
type: Object, |
|
default: () => { |
|
}, |
|
required: false |
|
}, |
|
//表单模式:false流程表单 true普通表单 |
|
formBpm: { |
|
type: Boolean, |
|
default: false, |
|
required: false |
|
}, |
|
//表单禁用 |
|
disabled: { |
|
type: Boolean, |
|
default: false, |
|
required: false |
|
} |
|
}, |
|
computed: { |
|
formDisabled() { |
|
// console.log("执行了") |
|
if (this.formBpm === true) { |
|
if (this.formData.disabled === false) { |
|
return false |
|
} |
|
return true |
|
} |
|
return this.disabled = false |
|
}, |
|
showFlowSubmitButton() { |
|
if (this.formBpm === true) { |
|
if (this.formData.disabled === false) { |
|
return true |
|
} |
|
} |
|
return false |
|
} |
|
}, |
|
created() { |
|
//如果是流程中表单,则需要加载流程表单data |
|
this.showFlowData() |
|
if (!this.isNew) { |
|
this.init() |
|
} |
|
let company = sessionStorage.getItem('PARENT_ID') |
|
let puwwcid = sessionStorage.getItem('PUWWC_Id') |
|
let userInfo = sessionStorage.getItem('USER_INFORMATION') |
|
// userInfo.company=company; |
|
this.popupCallback(company,userInfo,puwwcid); |
|
}, |
|
methods: { |
|
shuliang(){ |
|
this.addId |
|
}, |
|
//请数量输入 |
|
addid(val){ |
|
this.addId = val.row.id; |
|
// console.log(this.addId); |
|
}, |
|
//核算属性切换 |
|
isMaterialType(val){ |
|
if(val !== undefined){ |
|
this.accountingAttributesVal = val |
|
this.heid = false; |
|
this.fetchData(val); |
|
} |
|
}, |
|
async onSelect(record) { |
|
// console.log(record) |
|
let isMA= true; |
|
if(record.row.materialGroup !== '' && record.row.materialGroup !== undefined){ |
|
if(record.row.id !== undefined && record.row.id !== '' && record.row.materialGroup !== this.materialGroupId){ |
|
// console.log("执行materialGroup") |
|
if(this.rolePlay){ |
|
await this.fetchMerchandiseNewsZW(record.row.materialGroup, 1); |
|
}else{ |
|
await this.fetchMerchandiseNews(record.row.materialGroup, 1); |
|
} |
|
|
|
let valu = [ |
|
{ |
|
rowKey: record.row.id, |
|
values: { |
|
'equipment': '', |
|
'materialGroup': record.row.materialGroup, |
|
'materialName': '', |
|
'materialUnit': '', |
|
'supplierId': '', |
|
'materialPrice': '', |
|
'actualSendNumber': '', |
|
'materialAmount': '', |
|
'pleaseSendNumber': '', |
|
|
|
}, |
|
}, |
|
] |
|
// console.log(valu) |
|
this.$refs.processMaterialsDeliveryList.setValues(valu); |
|
this.materialGroupId = record.row.materialGroup; |
|
isMA = false; |
|
} |
|
|
|
} |
|
if(record.row.materialGroup !== '' && record.row.materialGroup !== undefined && record.row.equipment !== '' && record.row.equipment !== undefined && isMA ){ |
|
// console.log("执行materialNumber") |
|
let materialName = {} |
|
this.bigIdMerchandiseNewsList.forEach(item => { |
|
if (item.merchandiseNewsId === record.row.equipment) { |
|
materialName = { |
|
name: item.merchandiseName, |
|
unit: item.materialsUnit, |
|
supplierName: item.supplierName, |
|
price: item.materialPrice, |
|
residueNumber : item.residueNumber === undefined ? 0 : item.residueNumber, |
|
} |
|
} |
|
}) |
|
if(record.row.id !== undefined){ |
|
let values = [ |
|
{ |
|
rowKey: record.row.id, |
|
values: { |
|
'equipment': record.row.equipment, |
|
'materialGroup': record.row.materialGroup, |
|
'materialName': materialName.name, |
|
'materialUnit': materialName.unit, |
|
'supplierId': materialName.supplierName, |
|
'materialPrice': materialName.price, |
|
'actualSendNumber': materialName.residueNumber, |
|
'materialAmount': materialName.price * materialName.residueNumber, |
|
}, |
|
}, |
|
] |
|
this.$refs.processMaterialsDeliveryList.setValues(values); |
|
} |
|
|
|
} |
|
// 根据请发数量计算 |
|
if(record.row.pleaseSendNumber !== '' && record.row.pleaseSendNumber !== undefined && isMA ){ |
|
// console.log("执行了根据请发数量计算") |
|
let res = record.row; |
|
let materialName = {} |
|
this.bigIdMerchandiseNewsList.forEach(item => { |
|
if (item.merchandiseNewsId === record.row.equipment) { |
|
materialName = { |
|
residueNumber : item.residueNumber === undefined ? 0 : item.residueNumber, |
|
} |
|
} |
|
}) |
|
// console.log("materialName.residueNumber",materialName.residueNumber) |
|
if(parseInt( res.pleaseSendNumber) > parseInt( materialName.residueNumber )){ |
|
// console.log("大于") |
|
this.$message.warn("输入请发数不能大于库存数") |
|
res.pleaseSendNumber = materialName.residueNumber; |
|
res.actualSendNumber = materialName.residueNumber; |
|
}else{ |
|
// console.log("小于") |
|
res.actualSendNumber = res.pleaseSendNumber; |
|
} |
|
if(res.id !== undefined ){ |
|
let value = [ |
|
{ |
|
rowKey: res.id, |
|
values: { |
|
// 'equipment': res.equipment, |
|
// 'materialGroup': res.materialGroup, |
|
// 'materialName': res.materialName, |
|
// 'materialUnit': res.materialUnit, |
|
// 'supplier': res.supplier, |
|
// 'materialPrice': res.materialPrice, |
|
'actualSendNumber': res.actualSendNumber, |
|
'pleaseSendNumber': res.pleaseSendNumber, |
|
'materialAmount': res.materialPrice * res.actualSendNumber, |
|
}, |
|
}, |
|
] |
|
this.$nextTick(()=>{ |
|
this.$refs.processMaterialsDeliveryList.setValues(value); |
|
}) |
|
} |
|
|
|
} |
|
|
|
}, |
|
fetchMerchandiseNews(value){ //查询物料清单信息 |
|
//查询大品类数据 |
|
return new Promise((resolve, reject) => { |
|
//你的逻辑代码 |
|
let par = { |
|
delFlag: 0, |
|
descriptionId:value, |
|
|
|
} |
|
this.bigIdMerchandiseNewsList = []; |
|
let qc = []; |
|
let numberList = []; |
|
if(this.processMaterialsDeliveryListTable.columns[1].options.length > 0){ |
|
this.processMaterialsDeliveryListTable.columns[1].options = []; |
|
} |
|
this.$refs.processMaterialsDeliveryList.getValues((a,b,c)=>{ |
|
// console.log(a,b,c) |
|
b.forEach(item =>{ |
|
if(item.equipment !== '' && item.equipment !== undefined && item.equipment !== null){ |
|
numberList.push(item.materialNumber); |
|
} |
|
}); |
|
}); |
|
getAction(this.url.merchandiseNewsList,par).then((res)=>{ |
|
if(res.success){ |
|
console.log(res.result); |
|
let newList = res.result; |
|
// console.log("12312312:"+numberList.length); |
|
if(numberList.length > 0){ |
|
newList.forEach( item => { |
|
qc.push({ |
|
title : item.materialsNumber, |
|
value : item.merchandiseNewsId, |
|
disabled : false |
|
}) |
|
}) |
|
numberList.forEach( num => { |
|
qc.forEach( i => { |
|
if(num === i.value){ |
|
// console.log(num,i.value); |
|
i.disabled = true; |
|
} |
|
}); |
|
}) |
|
this.processMaterialsDeliveryListTable.columns[1].options = qc; |
|
}else{ |
|
newList.forEach( item => { |
|
this.processMaterialsDeliveryListTable.columns[1].options.push({ |
|
title : item.materialsNumber, |
|
value : item.merchandiseNewsId, |
|
disabled : false |
|
}) |
|
}) |
|
} |
|
// console.log(this.processUdgetPlanMaterialTable.columns[1].options); |
|
resolve(this.bigIdMerchandiseNewsList = res.result ); |
|
// return |
|
} |
|
}); |
|
|
|
}); |
|
|
|
}, |
|
fetchMerchandiseNewsZW(value){ //查询物料清单信息 |
|
//查询大品类数据 |
|
return new Promise((resolve, reject) => { |
|
//你的逻辑代码 |
|
let par = { |
|
delFlag: 0, |
|
descriptionId:value, |
|
|
|
} |
|
this.bigIdMerchandiseNewsList = []; |
|
let qc = []; |
|
let numberList = []; |
|
if(this.processMaterialsDeliveryListTable.columns[1].options.length > 0){ |
|
this.processMaterialsDeliveryListTable.columns[1].options = []; |
|
} |
|
this.$refs.processMaterialsDeliveryList.getValues((a,b,c)=>{ |
|
// console.log(a,b,c) |
|
b.forEach(item =>{ |
|
if(item.equipment !== '' && item.equipment !== undefined && item.equipment !== null){ |
|
numberList.push(item.materialNumber); |
|
} |
|
}); |
|
}); |
|
getAction(this.url.wasteMaterialsList,par).then((res)=>{ |
|
if(res.success){ |
|
// console.log(res.result); |
|
let newList = res.result; |
|
// console.log("12312312:"+numberList.length); |
|
if(numberList.length > 0){ |
|
newList.forEach( item => { |
|
qc.push({ |
|
title : item.materialsNumber, |
|
value : item.merchandiseNewsId, |
|
disabled : false |
|
}) |
|
}) |
|
numberList.forEach( num => { |
|
qc.forEach( i => { |
|
if(num === i.value){ |
|
// console.log(num,i.value); |
|
i.disabled = true; |
|
} |
|
}); |
|
}) |
|
this.processMaterialsDeliveryListTable.columns[1].options = qc; |
|
}else{ |
|
newList.forEach( item => { |
|
this.processMaterialsDeliveryListTable.columns[1].options.push({ |
|
title : item.materialsNumber, |
|
value : item.merchandiseNewsId, |
|
disabled : false |
|
}) |
|
}) |
|
} |
|
// console.log(this.processUdgetPlanMaterialTable.columns[1].options); |
|
resolve(this.bigIdMerchandiseNewsList = res.result ); |
|
// return |
|
} |
|
}); |
|
|
|
}); |
|
|
|
}, |
|
//table 值改变触发 |
|
// async onSelect(record) { |
|
// // console.log(record) |
|
// if(record.row.materialGroup !== '' && record.row.materialGroup !== undefined && record.row.equipment === ''){ |
|
// // console.log("执行materialGroup") |
|
// this.fetchMerchandiseNews(record.row.materialGroup,1); |
|
// } |
|
// if(record.row.materialGroup !== '' && record.row.materialGroup !== undefined && record.row.equipment !== '' && record.row.actualSendNumber === '' ){ |
|
// // console.log("执行materialNumber") |
|
// let materialName = {} |
|
// this.bigIdMerchandiseNewsList.forEach(item => { |
|
// if (item.merchandiseNewsId === record.row.equipment) { |
|
// materialName = { |
|
// name: item.merchandiseName, |
|
// unit: item.materialsUnit, |
|
// supplierName: item.supplierName, |
|
// price: item.price, |
|
// batch: item.batch, |
|
// MaterialsDeliveryId : item.id |
|
// // residueNumber : item.residueNumber === undefined ? 0 : item.residueNumber, |
|
// } |
|
// } |
|
// }) |
|
// let values = [ |
|
// { |
|
// rowKey: record.row.id, |
|
// values: { |
|
// 'equipment': record.row.equipment, |
|
// 'materialGroup': record.row.materialGroup, |
|
// 'materialName': materialName.name, |
|
// 'materialUnit': materialName.unit, |
|
// 'supplier': materialName.supplierName, |
|
// 'materialPrice': materialName.price, |
|
// 'batch' : materialName.batch, |
|
// 'MaterialsDeliveryId': materialName.MaterialsDeliveryId |
|
// // 'actualSendNumber': materialName.residueNumber, |
|
// // 'materialAmount': materialName.price * materialName.residueNumber, |
|
// }, |
|
// }, |
|
// ] |
|
// this.$refs.processMaterialsDeliveryList.setValues(values); |
|
// } |
|
// let a = false; |
|
// // 根据请发数量计算 |
|
// if(record.row.pleaseSendNumber !== '' && record.row.pleaseSendNumber !== undefined){ |
|
// console.log("record.row",record.row); |
|
// let numberStar = 0; |
|
// let numberEnd = 0; |
|
// // record.row.materialAmount = record.row.materialQuantity * record.row.materialPrice; |
|
// // 获取被逻辑删除的字段id |
|
// // let deleteIds = this.$refs.processMaterialsDeliveryList.getDeleteIds(); |
|
// // 获取所有表单的值,并进行验证 |
|
// let batcher = false; |
|
// let { error, values } = this.$refs.processMaterialsDeliveryList.getValuesSync({ }) |
|
// // console.log( values); |
|
// values.forEach( item => { |
|
// //判断是不是操作第一个 |
|
// if(item.id === record.row.id){ |
|
// let bat = record.row.batch.substring(0,record.row.batch.indexOf('/')); |
|
// if(parseInt(bat) === 1){ |
|
// // console.log("第一批"); |
|
// batcher = true; |
|
// } |
|
// } |
|
// //判断下面是不是有一样的物资 |
|
// if(item.id !== record.row.id && item.equipment === record.row.equipment ){ |
|
// //有 |
|
// let cf = record.row.pleaseSendNumber - record.row.actualSendNumber; |
|
// if(cf < 0 ){ |
|
// let ba = record.row.batch.substring(0,record.row.batch.indexOf('/')); |
|
// if(parseInt(ba) === 1 ){ |
|
// record.row.actualSendNumber = record.row.pleaseSendNumber; |
|
// //请减小 |
|
// let values = [ |
|
// { |
|
// rowKey: record.row.id, |
|
// values: { |
|
// 'equipment': record.row.equipment, |
|
// 'materialGroup': record.row.materialGroup, |
|
// 'materialName': record.row.materialName, |
|
// 'materialUnit': record.row.materialUnit, |
|
// 'supplier': record.row.supplier, |
|
// 'materialPrice': record.row.price , |
|
// 'actualSendNumber': record.row.actualSendNumber, |
|
// 'materialAmount': record.row.price * record.row.actualSendNumber, |
|
// 'pleaseSendNumber' : record.row.pleaseSendNumber, |
|
// 'batch' : record.row.batch, |
|
// }, |
|
// }, |
|
// ] |
|
// this.$refs.processMaterialsDeliveryList.setValues(values); |
|
// this.$refs.processMaterialsDeliveryList.removeRows(item.id); |
|
// }else { |
|
// |
|
// batcher =true; |
|
// } |
|
// |
|
// }else{ |
|
// //请变大 |
|
// this.$refs.processMaterialsDeliveryList.removeRows(item.id); |
|
// |
|
// } |
|
// } |
|
// |
|
// }) |
|
// //第二行操作 |
|
// if(batcher){ |
|
// // console.log("执行了123") |
|
// let num = 0; |
|
// this.bigIdMerchandiseNewsList.forEach( item =>{ |
|
// // console.log("item",item); |
|
// num = record.row.pleaseSendNumber - item.residueNumber; //第二行显示的数量 |
|
// if(num > 0){ |
|
// // 限制最大数量 |
|
// record.row.pleaseSendNumber = item.residueNumber; |
|
// record.row.actualSendNumber = record.row.pleaseSendNumber; |
|
// record.row.MaterialsDeliveryId = item.id; |
|
// //添加一行 |
|
// this.$refs.processMaterialsDeliveryList.handleClickAdd(); |
|
// this.jiy.push(this.addId); |
|
// a =true; |
|
// }else{ |
|
// record.row.actualSendNumber = record.row.pleaseSendNumber; |
|
// record.row.MaterialsDeliveryId = item.id; |
|
// // console.log("执行了222" ,record.row.actualSendNumber); |
|
// } |
|
// |
|
// }); |
|
// let drop = record.row.materialGroup; |
|
// let values = [ |
|
// { |
|
// rowKey: record.row.id, |
|
// values: { |
|
// 'equipment': record.row.equipment, |
|
// 'materialGroup': record.row.materialGroup, |
|
// 'materialName': record.row.materialName, |
|
// 'materialUnit': record.row.materialUnit, |
|
// 'supplier': record.row.supplier, |
|
// 'materialPrice': record.row.materialPrice, |
|
// 'actualSendNumber': record.row.actualSendNumber, |
|
// 'materialAmount': record.row.actualSendNumber * record.row.materialPrice, |
|
// 'pleaseSendNumber' : record.row.pleaseSendNumber, |
|
// 'batch' : record.row.batch, |
|
// 'MaterialsDeliveryId': record.row.MaterialsDeliveryId, |
|
// }, |
|
// }, |
|
// ] |
|
// this.$refs.processMaterialsDeliveryList.setValues(values); |
|
// //重新赋值 |
|
// if(a){ |
|
// let merchandiseNewser = {}; |
|
// let merchandiseNews = {}; |
|
// let is = false; |
|
// let onIs= false; |
|
// do{ |
|
// if(is){ |
|
// this.$refs.processMaterialsDeliveryList.handleClickAdd(); |
|
// merchandiseNewser =await this.fetchMerchandiseNews(drop,parseInt(numberStar)); |
|
// }else{ |
|
// merchandiseNewser =await this.fetchMerchandiseNews(drop,2); |
|
// } |
|
// merchandiseNewser.forEach( item => { |
|
// merchandiseNews = item; |
|
// }); |
|
// // console.log("numberStar",numberStar) |
|
// numberStar = merchandiseNews.batch.substring(0,merchandiseNews.batch.indexOf("/")); |
|
// numberEnd = merchandiseNews.batch.slice(numberStar.length+1); |
|
// // console.log(merchandiseNews); |
|
// let sum = num - merchandiseNews.residueNumber; //剩余数量 |
|
// let isLose = parseInt(numberEnd) - parseInt(numberStar); |
|
// // console.log("isLose",isLose); |
|
// if(isLose === 0 ){ |
|
// onIs = true; |
|
// } |
|
// if( sum > 0 ){ |
|
// //第三批 |
|
// is = true; |
|
// numberStar = parseInt(numberStar)+1; |
|
// sum = merchandiseNews.residueNumber; |
|
// }else{ |
|
// sum = num; |
|
// // console.log("sum=================>",sum); |
|
// is = false; |
|
// |
|
// } |
|
// let values = [ |
|
// { |
|
// rowKey: this.addId, |
|
// values: { |
|
// 'equipment': record.row.equipment, |
|
// 'materialGroup': record.row.materialGroup, |
|
// 'materialName': record.row.materialName, |
|
// 'materialUnit': record.row.materialUnit, |
|
// 'supplier': record.row.supplier, |
|
// 'materialPrice': merchandiseNews.price ? merchandiseNews.price : 0 , |
|
// 'actualSendNumber': sum , |
|
// 'materialAmount': sum * merchandiseNews.price ? sum * merchandiseNews.price : 0, |
|
// 'pleaseSendNumber' : sum, |
|
// 'batch' : merchandiseNews.batch, |
|
// 'MaterialsDeliveryId': merchandiseNews.id, |
|
// }, |
|
// }, |
|
// ] |
|
// this.$refs.processMaterialsDeliveryList.setValues(values); |
|
// //减小num 数量 |
|
// num = num - merchandiseNews.residueNumber; |
|
// if(onIs){ |
|
// //还要继续查询 |
|
// |
|
// this.$message.warn('暂无更多库存!'); |
|
// is = false; |
|
// return; |
|
// } |
|
// }while (is); |
|
// } |
|
// |
|
// } |
|
// |
|
// } |
|
// |
|
// }, |
|
// fetchMerchandiseNews(value,batch){ //查询物料清单信息 |
|
// //查询大品类数据 |
|
// return new Promise((resolve, reject) => { |
|
// //你的逻辑代码 |
|
// let par = { |
|
// delFlag: 0, |
|
// descriptionId:value, |
|
// batchNum: batch, |
|
// } |
|
// this.bigIdMerchandiseNews = []; |
|
// this.bigIdMerchandiseNewsList = []; |
|
// let qc = []; |
|
// let numberList = []; |
|
// if(this.processMaterialsDeliveryListTable.columns[1].options.length > 0){ |
|
// this.processMaterialsDeliveryListTable.columns[1].options = []; |
|
// } |
|
// this.$refs.processMaterialsDeliveryList.getValues((a,b,c)=>{ |
|
// // console.log(a,b,c) |
|
// b.forEach(item =>{ |
|
// if(item.equipment !== '' && item.equipment !== undefined && item.equipment !== null){ |
|
// numberList.push(item.materialNumber); |
|
// } |
|
// }); |
|
// }); |
|
// getAction(this.url.merchandiseNewsList,par).then((res)=>{ |
|
// if(res.success){ |
|
// console.log(res.result); |
|
// let newList = res.result; |
|
// // console.log("12312312:"+numberList.length); |
|
// if(numberList.length > 0){ |
|
// newList.forEach( item => { |
|
// qc.push({ |
|
// title : item.materialsNumber, |
|
// value : item.merchandiseNewsId, |
|
// disabled : false |
|
// }) |
|
// }) |
|
// numberList.forEach( num => { |
|
// qc.forEach( i => { |
|
// if(num === i.value){ |
|
// // console.log(num,i.value); |
|
// i.disabled = true; |
|
// } |
|
// }); |
|
// }) |
|
// this.processMaterialsDeliveryListTable.columns[1].options = qc; |
|
// }else{ |
|
// newList.forEach( item => { |
|
// this.processMaterialsDeliveryListTable.columns[1].options.push({ |
|
// title : item.materialsNumber, |
|
// value : item.merchandiseNewsId, |
|
// disabled : false |
|
// }) |
|
// }) |
|
// } |
|
// // console.log(this.processUdgetPlanMaterialTable.columns[1].options); |
|
// resolve(this.bigIdMerchandiseNewsList = res.result ); |
|
// // return |
|
// } |
|
// }); |
|
// |
|
// }); |
|
// |
|
// }, |
|
fetchData(value) { //查询物料组 |
|
// console.log("this.data==============>",this.data) //部门id |
|
let params = {} |
|
params.id = sessionStorage.getItem('PUWWC_Id')//关联中间表id |
|
getAction(this.url.unitWasteWarehouseList, params).then((res) => { |
|
console.log(res) |
|
if (res.success) { |
|
// 查询大品类数据 账外库 |
|
let par = { |
|
delFlag: 0, |
|
accountingAttributes: value, |
|
sysOrgCode: this.data.sysOrgCode |
|
} |
|
getAction(this.url.wasteMaterialsUrl, par).then((res) => { |
|
console.log(res) |
|
if (res.success) { |
|
if (this.processMaterialsDeliveryListTable.columns[0].options.length > 0) { |
|
this.processMaterialsDeliveryListTable.columns[0].options = [] |
|
} |
|
res.result.forEach(item => { |
|
this.processMaterialsDeliveryListTable.columns[0].options.push({ |
|
title: item.descriptionName, |
|
value: item.descriptionId |
|
}) |
|
}) |
|
} |
|
}) |
|
this.rolePlay = true; |
|
} else { |
|
//查询大品类数据 总库 |
|
let par = { |
|
delFlag: 0, |
|
accountingAttributes: value |
|
} |
|
getAction(this.url.descriptionRake, par).then((res) => { |
|
if (res.success) { |
|
if (this.processMaterialsDeliveryListTable.columns[0].options.length > 0) { |
|
this.processMaterialsDeliveryListTable.columns[0].options = [] |
|
} |
|
res.result.forEach(item => { |
|
this.processMaterialsDeliveryListTable.columns[0].options.push({ |
|
title: item.descriptionName, |
|
value: item.descriptionId |
|
}) |
|
}) |
|
} |
|
}) |
|
this.rolePlay = false; |
|
} |
|
}) |
|
|
|
|
|
}, |
|
|
|
/*回显数据*/ |
|
init(){ |
|
this.btndisabled = true; |
|
var r = this.processData; |
|
this.getAction(this.url.queryById,{ |
|
id:r.tableId |
|
}).then((res)=>{ |
|
if (res.success){ |
|
let formData = res.result; |
|
formData.tableName = r.tableName; |
|
this.data = formData; |
|
console.log("表单回显数据",this.data) |
|
this.editAfter(); |
|
this.btndisabled = false; |
|
}else { |
|
this.$message.error(res.message) |
|
} |
|
}) |
|
}, |
|
close() { |
|
//todo 关闭后的回调 |
|
this.$emit('close') |
|
}, |
|
/*通过审批*/ |
|
passTask() { |
|
this.$emit('passTask') |
|
}, |
|
/*驳回审批*/ |
|
backTask() { |
|
this.$emit('backTask') |
|
}, |
|
handleSubmit (e) { |
|
this.getAllTable().then(tables => { |
|
return validateFormAndTables(this.form, tables) |
|
}).then(allValues=>{ |
|
|
|
if (typeof this.classifyIntoFormData !== 'function') { |
|
throw this.throwNotFunction('classifyIntoFormData') |
|
} |
|
let formData = this.classifyIntoFormData(allValues) |
|
formData.fileId = getStringArry(formData.fileId) |
|
console.log('所有数据',formData) |
|
if (new Date(formData.createTime).getTime()/100>new Date(formData.deliveryTime).getTime()/100){ |
|
this.$message.error("出库时间不能小于当前流程发起时间") |
|
return; |
|
} |
|
// if (formData.materialType === null || formData.materialType ==='' || formData.materialType === undefined){ |
|
// this.$message.error("物资类型不能为空") |
|
// return; |
|
// } |
|
// if (formData.deliveryTime === null || formData.deliveryTime ==='' || formData.deliveryTime === undefined){ |
|
// this.$message.error("出库时间不能为空") |
|
// return; |
|
// } |
|
for (let i = 0; i < formData.processMaterialsDeliveryListList.length; i++) { |
|
if (i==0){ |
|
this.describes=formData.processMaterialsDeliveryListList[i].materialName |
|
}else { |
|
this.describes=this.describes+"---"+formData.processMaterialsDeliveryListList[i].materialName |
|
} |
|
} |
|
formData.describes=this.describes; |
|
this.form.validateFields((err, values) => { |
|
if (!err) { |
|
formData.procDefId = this.processData.id; |
|
formData.procDeTitle = this.processData.name; |
|
formData.title=this.processData.description; |
|
formData.targetLibrary = this.libraryAssociationIdInvisible |
|
if (!formData.tableName)formData.tableName = this.processData.businessTable; |
|
console.log('格式化后的数据',formData) |
|
var url = this.url.add; |
|
let method='post'; |
|
if (!this.isNew){ |
|
url = this.url.edit; |
|
method='put'; |
|
} |
|
console.log('提交方法',method) |
|
this.btndisabled = true; |
|
httpAction(url,formData,method).then((res)=>{ |
|
if (res.success){ |
|
//this.$message.success("保存成功!") |
|
//todo 将表单的数据传给父组件 |
|
this.$emit('afterSubmit',formData) |
|
}else { |
|
this.$message.error(res.message) |
|
} |
|
}).finally(()=>{ |
|
this.btndisabled = false; |
|
}) |
|
} |
|
}) |
|
}) |
|
|
|
}, |
|
addBefore(){ |
|
this.form.resetFields() |
|
this.processMaterialsDeliveryListTable.dataSource=[] |
|
}, |
|
getAllTable() { |
|
let values = this.tableKeys.map(key => getRefPromise(this, key)) |
|
return Promise.all(values) |
|
}, |
|
/** 调用完edit()方法之后会自动调用此方法 */ |
|
editAfter() { |
|
if (this.data.id != null && this.data.id != '' && this.data.id != undefined && this.data.fileId != null && this.data.fileId != '') { |
|
//1、文件回显 |
|
this.data = getRecord(this.data) |
|
|
|
} |
|
console.log('回显数据',this.data) |
|
let fieldval = pick(this.data,'id','company','createTime','sysOrgCode','createBy','materialType','deliveryTime','fileId','opinion') |
|
this.$nextTick(() => { |
|
this.form.setFieldsValue(fieldval) |
|
}) |
|
// 加载子表数据 |
|
if (this.data.id) { |
|
let params = { id: this.data.id } |
|
this.requestSubTableData(this.url.processMaterialsDeliveryList.list, params, this.processMaterialsDeliveryListTable) |
|
} |
|
}, |
|
/** 整理成formData */ |
|
classifyIntoFormData(allValues) { |
|
let main = Object.assign(this.model, allValues.formValue) |
|
return { |
|
...main, // 展开 |
|
processMaterialsDeliveryListList: 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); |
|
} |
|
}) |
|
} |
|
}, |
|
validateError(msg){ |
|
this.$message.error(msg) |
|
}, |
|
popupCallback(company,row,puwwcid) { |
|
let res=JSON.parse(row); |
|
let params = {} |
|
params.id = puwwcid |
|
getAction(this.url.puwwlist, params).then((rest) => { |
|
if (rest.success) { |
|
this.libraryAssociationIdInvisible = rest.result.unit |
|
} |
|
}) |
|
console.log('获取我的数据',res.id) |
|
let param={} |
|
param.createBy=res.username; |
|
param.company=company; |
|
param.sysOrgCode=res.departIds; |
|
param.createTime= getCurrentTime(); |
|
this.data=param; |
|
let fieldval =pick(this.data, 'createBy','company','sysOrgCode','createTime') |
|
this.$nextTick(() => { |
|
this.form.setFieldsValue(fieldval) |
|
}) |
|
}, |
|
|
|
} |
|
} |
|
</script> |
|
|
|
<style scoped> |
|
.div_process{ |
|
margin-top: 30px; |
|
} |
|
</style> |