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.
 
 
 

1025 lines
35 KiB

<template>
<a-spin :spinning="confirmLoading" style="height: 650px">
<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%" 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="['departId']" 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" v-decorator="['materialType']" @change="isMaterialType"
:trigger-change="true" dictCode="material_type" placeholder="请选择物资类型" />
</a-form-item>
</a-col>
<!-- <a-col :span="8">-->
<!-- <a-form-item label="关联出库流程" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!-- <h-delivery v-decorator="['processOutflowId']" code="demo" field="name" orgFields="name" @mounted="getPlanList" @callType="getcallType" @PlanIds="getPlanIds" destFields="name"/>-->
<!-- </a-form-item>-->
<!-- </a-col>-->
<a-col :span="8">
<a-form-item label="文件" :labelCol="labelCol3" :wrapperCol="wrapperCol3" style="z-index: 10000">
<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">
<b-editable-table
ref="processSmaterialsScrapList"
:loading="processSmaterialsScrapListTable.loading"
:columns="processSmaterialsScrapListTable.columns"
:dataSource="processSmaterialsScrapListTable.dataSource"
:maxHeight="300"
:disabled="formDisabled"
:isabled="isabled"
:dragSortType="accounting"
:sections = section
:rowNumber="true"
:rowSelection="true"
@valueChange ="onSelect"
:actionButton="true"
@descriptionFetch = "searchInformation"
/>
</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>
&lt;!&ndash;<a-input type="textarea" v-decorator="[ 'opinion' ]" :rows="4" />&ndash;&gt;
</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" type="primary" :disabled="disabled||btndisabled" @click="applySubmit">提交申请</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 JSearchSelectTag from '@/components/dict/JSearchSelectTag'
import JSelectCompany from '../../../components/jeecgbiz/JSelectCompany'
import BEditableTable from '@comp/jeecg/BEditableTable'
import moment from 'moment'
import { accMul } from '../../../../common/common'
export default {
name: 'ProcessSmaterialsScrapForm',
mixins: [JEditableTableMixin],
components: {
JFormContainer,
JDate,
JUpload,
JSelectDepart,
JSelectUserByDep,
JDictSelectTag,
JSearchSelectTag,
JSelectCompany,
BEditableTable
},
data() {
return {
heid: true,
isabled : true,
qeihuan : true, //切换类型
deliveryType : true, //查询物资库类型
disabl : true, //输入控制
section: { }, //部门id
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 }
},
labelCol3: {
xs: { span: 24 },
sm: { span: 6 }
},
wrapperCol3: {
xs: { span: 24 },
sm: { span: 5 }
},
// 新增时子表默认添加几行空数据
addDefaultRowNum: 1,
processOutflowId: '',
processOutflowIds:'',
describes:'',
refKeys: ['processSmaterialsScrapList'],
tableKeys: ['processSmaterialsScrapList'],
activeKey: 'processSmaterialsScrapList',
// 物资报废流程报废清单
processSmaterialsScrapListTable: {
loading: false,
dataSource: [],
columns: [
{
title: '物料组',
key: 'materialGroup',
type: FormTypes.sel_search,
disabled: true,
dictCode: '',
width: '200px',
placeholder: '请输入${title}',
options:[]
},
{
title: '物料编号',
key: 'equipment',
type: FormTypes.sel_search,
dictCode: '',
width: '200px',
placeholder: '请输入${title}',
defaultValue: '',
disabled: this.disabled,
options:[]
},
{
title: 'WBS',
key: 'wbs',
type: FormTypes.input,
dictCode: '',
disabled: this.disabled,
width: '200px',
placeholder: '请输入${title}',
defaultValue: ''
},
{
title: '物料名称及规格型号',
key: 'materialName',
type: FormTypes.sel_search,
disabled: this.disabled,
dictCode: '',
width: '200px',
placeholder: '请输入${title}',
options:[]
},
{
title: '单位',
key: 'materialUnit',
type: FormTypes.select,
disabled: true,
dictCode: '',
width: '200px',
placeholder: '请输入${title}',
defaultValue: ''
},
{
title: '报废数量',
key: 'scrapNumber',
type: FormTypes.inputNumber,
disabled: this.disabled,
width: '130px',
placeholder: '请输入${title}',
defaultValue: ''
},
{
title: '实际报废数量',
key: 'actualNumber',
type: FormTypes.inputNumber,
disabled: !this.disabled,
width: '130px',
placeholder: '请输入${title}',
defaultValue: ''
},
{
title: '单价(元)',
key: 'materialPrice',
type: FormTypes.inputNumber,
disabled: true,
width: '130px',
placeholder: '请输入${title}',
defaultValue: ''
},
{
title: '金额(元)',
key: 'materialAmount',
type: FormTypes.inputNumber,
disabled: true,
width: '130px',
placeholder: '请输入${title}',
defaultValue: ''
},
{
title: '报废时间',
key: 'scrapTime',
type: FormTypes.date,
width: '200px',
placeholder: '请输入${title}',
defaultValue: '',
disabled: this.disabled
},
{
title: '供货商',
key: 'supplierId',
type: FormTypes.sel_search,
disabled: true,
dictCode: '',
width: '200px',
placeholder: '请输入${title}',
defaultValue: ''
},
{
title: '报废原因',
key: 'scrapCause',
type: FormTypes.input,
width: '200px',
placeholder: '请输入${title}',
defaultValue: '',
disabled: this.disabled
},
{
title: '',
key: 'wasteMaterialsId',
type: FormTypes.input,
width: '0px',
defaultValue:'',
},
]
},
url: {
queryByIdDescription: "/description/processDescription/queryById",
queryByIdMerchandiseNews: "/merchandisenews/processMerchandiseNews/queryById",
queryPageDepare: '/hy/processMaterialsDelivery/queryPageDepare',//查询部门
wasteMaterialsUrlList: '/wastematerials/processWasteMaterials/list', //查询账外物料组数据
getForm: '/actBusiness/getForm',
add: '/hy/processSmaterialsScrap/add',
edit: '/hy/processSmaterialsScrap/edit',
addScrapApply: '/hy/processSmaterialsScrap/addScrapApply',
editScrapApply: '/hy/processSmaterialsScrap/editScrapApply',
queryById: '/hy/processSmaterialsScrap/queryById',
list:"/hy/processMaterialsDelivery/queryProcessMaterialsDeliveryListByMainIds",
getFirstNode:'/actProcessIns/getFirstNode',
processSmaterialsScrapList: {
list: '/hy/processSmaterialsScrap/queryProcessSmaterialsScrapListByMainId'
}
},
btndisabled: false,
assignees:'',
validatorRules: {
// 'blur'是鼠标失去焦点的时候会触发验证
// processOutflowId: {rules: [{ required: true, message: '关联出库流程不能为空!' }]},
// processReturnId: {rules:[{ required: true, message: '关联归还流程不能为空!' }]},
// processPlan: {rules:[ { required: true, message: '请选择流程计划!'}]}
},
equipmentList:[],
accounting: undefined, //类型
historyNumList : [], //列表数据
}
},
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
},
hidden: {
type: Boolean,
default: false,
required: false
}
},
computed: {
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) {
return true
}
}
return false
},
},
created() {
//如果是流程中表单,则需要加载流程表单data
this.showFlowData()
let company = sessionStorage.getItem('PARENT_ID')
let userInfo = sessionStorage.getItem('USER_INFORMATION')
this.department(userInfo);
// userInfo.company=company;
if (!this.isNew){
this.init();
}else {
this.popupCallback(company, userInfo)
}
},
methods: {
pastSla() { //取列表值
return new Promise((resolve, reject) => {
this.$refs.processSmaterialsScrapList.getValuesPromise().then(re => {
this.historyNumList = re;
})
resolve(this.historyNumList);
})
},
fuZhi(id,value){ //赋值
let materialName ={};
this.equipmentList.forEach( item =>{
// console.log(item)
if(item.merchandiseNewsId == value){
materialName = {
equipment : item.merchandiseNewsId,
materialName: item.materialDescription,
materialUnit: item.materialsUnit,
materialGroup: item.materialGroup,
supplierName: item.supplierId,
materialPrice: item.materialPrice,
descriptionId: item.descriptionId,
wasteMaterialsId: item.id
}
}
})
let values = [
{
rowKey: id,
values: {
'equipment': materialName.equipment,
'materialGroup': materialName.materialGroup,
'materialName': materialName.materialName,
'materialUnit': materialName.materialUnit,
'supplierId': materialName.supplierName,
'materialPrice': materialName.materialPrice,
// 'actualSendNumber': materialName.residueNumber,
'wasteMaterialsId': materialName.wasteMaterialsId
// 'materialAmount': materialName.price * materialName.residueNumber
}
}
]
this.$refs.processSmaterialsScrapList.setValues(values);
},
qingKong(id){ //清空
let values = [
{
rowKey: id,
values: {
'equipment': undefined,
'materialGroup': undefined,
'materialName': undefined,
'materialUnit': null,
'supplierId': null,
'materialPrice': null,
// 'actualSendNumber': materialName.residueNumber,
'wasteMaterialsId': null
// 'materialAmount': materialName.price * materialName.residueNumber
}
}
]
this.$refs.processSmaterialsScrapList.setValues(values);
},
async jinYong(){ //禁用
let aa = this.processSmaterialsScrapListTable.columns[1].options;
await this.pastSla();
aa.forEach(i => {
i.disabled = false;
})
this.historyNumList.forEach( item =>{
aa.forEach(i => {
if(item.equipment == i.value){
i.disabled = true;
}
})
});
this.processSmaterialsScrapListTable.columns[1].options = aa;
},
async onSelect(record){
//物料号
if(record.column.key == "equipment" && !!record.row.id || record.column.key == "materialName" && !!record.row.id ){
await this.pastSla();
let l = false;
this.historyNumList.forEach( item =>{
// console.log("111",item);
if(item.equipment == record.value){
l =true;
}
});
if(l){
this.qingKong(record.row.id);
}else{
let sous = false;
this.equipmentList.forEach( item =>{
// console.log(item)
if(item.merchandiseNewsId == record.value){
sous = true;
}
})
if(!sous){
await this.searchInformation(record.value);
}
this.fuZhi(record.row.id,record.value);
}
await this.jinYong();
}
//计算金额
if(record.column.key = "materialAmount" && !!record.row.scrapNumber && this.disabled){
let values = [
{
rowKey: record.row.id,
values: {
// 'scrapNumber': record.row.scrapNumber > 0 ? record.row.scrapNumber : 1 ,
'materialAmount': accMul(record.row.materialAmount,record.row.materialPrice) > 0 ? accMul(record.row.materialAmount,record.row.materialPrice) : 1 * record.row.materialPrice,
}
}
]
this.$refs.processSmaterialsScrapList.setValues(values);
}
},
//核算属性切换
async isMaterialType(val) {
// console.log("this.section",this.section);
if (val !== undefined) {
this.isabled = false;
this.qeihuan = val;
this.accounting = val;
this.searchInformation();
}
},
//查询账外数据
searchInformation(value){
return new Promise( (resolve, reject) => {
let par = {
accountingAttributes: this.accounting
}
if(this.section.orgType == "2"){
par.departId = this.section.departIds;
}
if(this.section.orgType == "3"){
par.departId = this.section.parentId;
}
if(!!value){
par.merchandiseNewsId = value;
}
// console.log("par",par);
let numberList = [];
this.$refs.processSmaterialsScrapList.getValues((a, b, c) => {
// console.log(a, b, c)
b.forEach(item => {
if (!!item.equipment) {
numberList.push(item.equipment)
}
})
})
//查询数据
console.log("=-=-=-",par);
getAction(this.url.wasteMaterialsUrlList,par).then(res =>{
if(res.success){
console.log("156465",res.result.records);
this.equipmentList = res.result.records;
let nu = res.result.records || res.result;
let qc = [];
if (this.processSmaterialsScrapListTable.columns[1].options.length > 0) {
this.processSmaterialsScrapListTable.columns[1].options = []
}
nu.forEach(item =>{
qc.push({
title: item.materialNumber,
value: item.merchandiseNewsId,
disabled: false
})
})
numberList.forEach( it => {
// console.log("000000",it);
qc.forEach(item =>{
if( it == item.value ){
item.disabled = true;
}
})
})
this.processSmaterialsScrapListTable.columns[1].options = qc;
}
resolve();
})
})
},
department(userInfo){ //查询部门
let res = JSON.parse(userInfo);
// console.log("执行账外",res);
if(res.orgType === "3"){
getAction(this.url.queryPageDepare,{id:res.departIds}).then(res=>{
if(res.success){
// console.log("1231234",res.result);
this.section = res.result;
}
})
}else{
this.section = res;
}
},
materialType(val) {
if (val !== undefined) {
this.heid = false
}
},
/*回显数据*/
init() {
this.btndisabled = true
var r = this.processData;
this.getAssignees(r);
if (!r.tableId){
return
}
this.getAction(this.url.queryById, {
id: r.tableId
}).then((res) => {
// console.log("res.result1111111111",res.result);
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)
}
})
},
getPlanIds(val){
let ids=[]
if (!!val){
for (let i = 0; i < val.length; i++) {
ids.push(val[i].id);
}
}
this.processOutflowIds=ids.join(",");
this.processSmaterialsScrapListTable.dataSource.forEach(item =>{
let par = { id : item.materialGroup,}
let param = {id : item.equipment,}
getAction(this.url.queryByIdDescription,par).then( res=>{
// console.log("1111111111111",res);
if(res.success){
this.processSmaterialsScrapListTable.columns[0].options= [{
title : res.result.materialClassify,
value : item.materialGroup,
disabled : true }];
}
})
getAction(this.url.queryByIdMerchandiseNews,param).then( res=>{
// console.log("222222222222",res);
if(res.success){
this.processSmaterialsScrapListTable.columns[1].options= [{
title : res.result.materialsNumber,
value : item.equipment,
disabled : true }];
}
})
})
},
async getPlanList (val){
console.log("getPlanList",val)
let ids=[]
if (!!val){
for (let i = 0; i < val.length; i++) {
ids.push(val[i].id);
}
}
this.processOutflowIds=ids.join(",");
// console.log(this.processOutflowIds,"传值-------------------------")
let params = {}
params.ids = JSON.stringify(ids)
await this.requestSubTableDatas(this.url.list, params, this.processSmaterialsScrapListTable)
},
/** 查询某个tab的数据 */
requestSubTableDatas(url, params, tab, success) {
tab.loading = true
getAction(url, params).then(res => {
let { result } = res
let dataSource = []
if (result) {
if (Array.isArray(result)) {
dataSource = result
} else if (Array.isArray(result.records)) {
dataSource = result.records
}
}
tab.dataSource = dataSource;
tab.dataSource.forEach(item =>{
let par = { id : item.materialGroup,}
let param = {id : item.equipment,}
getAction(this.url.queryByIdDescription,par).then( res=>{
// console.log(res);
if(res.success){
this.processSmaterialsScrapListTable.columns[0].options= [{
title : res.result.materialClassify,
value : item.materialGroup,
disabled : true }];
}
})
getAction(this.url.queryByIdMerchandiseNews,param).then( res=>{
console.log(res);
if(res.success){
this.processSmaterialsScrapListTable.columns[1].options= [{
title : res.result.materialsNumber,
value : item.equipment,
disabled : true }];
}
})
})
typeof success === 'function' ? success(res) : ''
}).finally(() => {
tab.loading = false
})
},
close() {
//todo 关闭后的回调
this.$emit('close')
},
/*通过审批*/
passTask() {
// if(!this.allotShuNumber){
// this.getAllTable().then(tables => {
// return validateFormAndTables(this.form, tables)
// }).then(allValues => {
// console.log('所有数据', allValues)
// if(!!allValues.tablesValue[0].values[0] ){
// let all = false;
// allValues.tablesValue[0].values.forEach( it => {
// if(!it.allotSendNumber){
// this.$message.warning("请填写实发调拨数据!");
// all = true;
// }
// });
// if(all){
// return
// }else{
// let formData = this.classifyIntoFormData(allValues);
// // console.log("124234123",formData);
// let method = 'put'
// httpAction(this.url.edit, formData, method).then((res) => {
// if (res.success) {
// this.$emit('passTask')
// }
// }).finally(() => {
// })
// }
// }
// })
//
// }else{
// this.$emit('passTask')
// }
this.$emit('passTask')
},
/*驳回审批*/
backTask() {
this.$emit('backTask')
},
/*提交申请*/
applySubmit(e) {
this.getAllTable().then(tables => {
return validateFormAndTables(this.form, tables)
}).then(allValues => {
console.log('所有数据', allValues)
if (typeof this.classifyIntoFormData !== 'function') {
throw this.throwNotFunction('classifyIntoFormData')
}
let formData = this.classifyIntoFormData(allValues)
for (let i = 0; i < formData.processSmaterialsScrapListList.length; i++) {
if (i == 0) {
this.describes = formData.processSmaterialsScrapListList[i].materialName
} else {
this.describes = this.describes + '---' + formData.processSmaterialsScrapListList[i].materialName
}
}
formData.describes = this.describes
formData.fileId = getStringArry(formData.fileId)
let is_project=sessionStorage.getItem('IS_PROJECT');
let projcet= JSON.parse(is_project)
if (projcet.departId){
formData.departCode=projcet.departId
}
this.form.validateFields((err, values) => {
if (!err) {
formData.procDefId = this.processData.id
formData.procDeTitle = this.processData.name
formData.title = this.processData.description
formData.processOutflowId=this.processOutflowIds;
if (!formData.tableName) formData.tableName = this.processData.businessTable
console.log('格式化后的数据', formData)
let cx = false;
formData.processSmaterialsScrapListList.forEach(item =>{
if(!item.scrapNumber){
cx = true;
}
})
if(cx){
this.$message.warning("请填写报废数量");
return ;
}
var url = this.url.addScrapApply
let method = 'post'
if (!this.isNew) {
url = this.url.editScrapApply
method = 'put';
formData.assignees=this.assignees
formData.tableName = this.processData.tableName;
formData.procDefId = this.processData.procDefId;
formData.procDeTitle = this.processData.processName;
formData.title=this.processData.title;
formData.processInstanceId=this.processData.id;
if (!this.assignees){
this.$message.error('审批节点未分配候选审批人员,请联系管理员!')
return;
}
}
console.log('提交方法', method)
if(this.btndisabled === false){
this.btndisabled = true
httpAction(url, formData, method).then((res) => {
if (res.success) {
this.$message.success('提交申请成功!')
//todo 将表单的数据传给父组件
this.$emit('loadData')
this.close();
} else {
this.$message.error(res.message)
}
}).finally(() => {
this.btndisabled = false
})
}
}
})
})
},
handleSubmit(e) {
this.getAllTable().then(tables => {
return validateFormAndTables(this.form, tables)
}).then(allValues => {
console.log('所有数据', allValues)
if (typeof this.classifyIntoFormData !== 'function') {
throw this.throwNotFunction('classifyIntoFormData')
}
let formData = this.classifyIntoFormData(allValues)
for (let i = 0; i < formData.processSmaterialsScrapListList.length; i++) {
if (i == 0) {
this.describes = formData.processSmaterialsScrapListList[i].materialName
} else {
this.describes = this.describes + '---' + formData.processSmaterialsScrapListList[i].materialName
}
}
formData.describes = this.describes
formData.fileId = getStringArry(formData.fileId)
let is_project=sessionStorage.getItem('IS_PROJECT');
let projcet= JSON.parse(is_project)
if (projcet.departId){
formData.departCode=projcet.departId
}
this.form.validateFields((err, values) => {
if (!err) {
formData.procDefId = this.processData.id
formData.procDeTitle = this.processData.name
formData.title = this.processData.description
formData.processOutflowId=this.processOutflowIds;
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)
if(this.btndisabled === false){
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
})
}
}
})
})
},
getcallType(type){
// console.log("type",type)
this.data.materialType = type.materialType;
// this.data.processOutflowId=type.id
let fieldval =pick(this.data,'materialType')
this.$nextTick(() => {
this.form.setFieldsValue(fieldval)
})
},
addBefore() {
this.form.resetFields()
this.processSmaterialsScrapListTable.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('000000000000>', this.data)
let fieldval = pick(this.data, 'id', 'company', 'createTime', 'departId', 'createBy', 'materialType', 'processOutflowId', 'fileId', 'opinion')
this.$nextTick(() => {
this.form.setFieldsValue(fieldval)
})
// 加载子表数据
if (this.data.id) {
let params = { id: this.data.id }
this.requestSubTableData(this.url.processSmaterialsScrapList.list, params, this.processSmaterialsScrapListTable)
// console.log(this.processSmaterialsScrapListTable,"this.processSmaterialsScrapListTable")
}
},
/** 整理成formData */
classifyIntoFormData(allValues) {
let main = Object.assign(this.model, allValues.formValue)
return {
...main, // 展开
processSmaterialsScrapListList: 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) {
let res = JSON.parse(row)
let param = {}
console.log('获取我的数据》》》》》》》》》》》', res)
param.createBy = res.username
param.company = company
param.departId = res.departIds
param.createTime = getCurrentTime()
this.data = param
// console.log("23412341234",this.data)
let fieldval = pick(this.data, 'createBy', 'company', 'departId', 'createTime')
this.$nextTick(() => {
this.form.setFieldsValue(fieldval)
})
},
getAssignees(v){
getAction(this.url.getFirstNode,{procDefId:v.procDefId,tableId:v.tableId,tableName:v.tableName}).then(res => {
if (res.success) {
if (res.result.users && res.result.users.length > 0) {
// 默认勾选
let ids = [];
res.result.users.forEach(e => {
ids.push(e.username);
});
this.assignees = ids.join(",");
}
}
});
}
}
}
</script>
<style scoped>
.div_process {
margin-top: 30px;
}
.ant-col-8{
height: 50px;
}
</style>