parent
964aa37af0
commit
f52210dbe6
File diff suppressed because one or more lines are too long
@ -0,0 +1,852 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<template>
|
||||
<div :style="{margin: '0 auto',width:'100%'}">
|
||||
<el-row :gutter="15" class="">
|
||||
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px"
|
||||
label-position="right" :disabled="setting.readonly">
|
||||
<template v-if="!loading && formOperates">
|
||||
<!-- 具体表单 -->
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item>
|
||||
<JnpfGroupTitle content="单据类型" contentPosition="left">
|
||||
</JnpfGroupTitle>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item>
|
||||
<JnpfText
|
||||
:textStyle='{"color":"#000000","font-weight":"normal","text-decoration":"none","font-size":12,"line-height":32,"font-style":"normal","text-align":"left"}'
|
||||
content=" 不同的单据类型,需要选择不同的收货信息">
|
||||
</JnpfText>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="judgeShow('type')">
|
||||
<jnpf-form-tip-item label="单据类型" v-if="judgeShow('type')" prop="type">
|
||||
<JnpfRadio v-model="dataForm.type" @change="changeData('type',-1)"
|
||||
:disabled="judgeWrite('type')" optionType="button" direction="horizontal"
|
||||
size="medium" :options="typeOptions" :props="typeProps">
|
||||
</JnpfRadio>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item>
|
||||
<JnpfGroupTitle content="基础信息" contentPosition="left">
|
||||
</JnpfGroupTitle>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="judgeShow('code')">
|
||||
<jnpf-form-tip-item label="单据编号" v-if="judgeShow('code')" prop="code">
|
||||
<JnpfInput v-model="dataForm.code" @change="changeData('code',-1)"
|
||||
placeholder="系统自动生成" :disabled="judgeWrite('code')" readonly
|
||||
:style='{"width":"100%"}'>
|
||||
</JnpfInput>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="judgeShow('businessfactoryId')">
|
||||
<jnpf-form-tip-item label="工厂名称" v-if="judgeShow('businessfactoryId')"
|
||||
prop="businessfactoryId">
|
||||
<JnpfPopupSelect v-model="dataForm.businessfactoryId"
|
||||
@change="changeData('businessfactoryId',-1)" :rowIndex="null" :formData="dataForm"
|
||||
:templateJson="interfaceRes.businessfactoryId" placeholder="请选择"
|
||||
:disabled="judgeWrite('businessfactoryId')" hasPage propsValue="id"
|
||||
popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name'
|
||||
field='businessfactoryId' interfaceId="521651055751075845" :pageSize="20"
|
||||
:columnOptions="businessfactoryIdcolumnOptions" clearable :style='{"width":"100%"}'>
|
||||
</JnpfPopupSelect>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="judgeShow('businessId')">
|
||||
<jnpf-form-tip-item label="生产线" v-if="judgeShow('businessId')" prop="businessId">
|
||||
<JnpfPopupSelect v-model="dataForm.businessId" @change="changeData('businessId',-1)"
|
||||
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.businessId"
|
||||
placeholder="请选择" :disabled="judgeWrite('businessId')" hasPage propsValue="id"
|
||||
popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name'
|
||||
field='businessId' interfaceId="517979330417001669" :pageSize="20"
|
||||
:columnOptions="businessIdcolumnOptions" clearable :style='{"width":"100%"}'>
|
||||
</JnpfPopupSelect>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8" v-if="judgeShow('workTime')">
|
||||
<jnpf-form-tip-item label="加工时间" v-if="judgeShow('workTime')" prop="workTime">
|
||||
<JnpfDatePicker v-model="dataForm.workTime" @change="changeData('workTime',-1)"
|
||||
:startTime="dateTime(false,1,1,'','')" :endTime="dateTime(false,1,1,'','')"
|
||||
placeholder="请选择" :disabled="judgeWrite('workTime')" clearable
|
||||
:style='{"width":"100%"}' type="date" format="yyyy-MM-dd">
|
||||
</JnpfDatePicker>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="judgeShow('businessCode')">
|
||||
<jnpf-form-tip-item label="外部单据编号" v-if="judgeShow('businessCode')" prop="businessCode">
|
||||
<JnpfInput v-model="dataForm.businessCode" @change="changeData('businessCode',-1)"
|
||||
placeholder="请输入" :disabled="judgeWrite('businessCode')" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
</JnpfInput>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="judgeShow('teamId')">
|
||||
<jnpf-form-tip-item label="生产班组" v-if="judgeShow('teamId')" prop="teamId">
|
||||
<JnpfPopupSelect v-model="dataForm.teamId" @change="changeData('teamId',-1)"
|
||||
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.teamId"
|
||||
placeholder="请选择" :disabled="judgeWrite('teamId')" hasPage propsValue="id"
|
||||
popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='team_name'
|
||||
field='teamId' interfaceId="523050983727575621" :pageSize="20"
|
||||
:columnOptions="teamIdcolumnOptions" clearable :style='{"width":"100%"}'>
|
||||
</JnpfPopupSelect>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item label="状态" prop="status">
|
||||
<JnpfRadio v-model="dataForm.status" @change="changeData('status',-1)"
|
||||
optionType="button" direction="horizontal" size="medium" :options="statusOptions"
|
||||
:props="statusProps">
|
||||
</JnpfRadio>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" v-if="judgeShow('remark')">
|
||||
<jnpf-form-tip-item label="备注" v-if="judgeShow('remark')" prop="remark">
|
||||
<JnpfInput v-model="dataForm.remark" @change="changeData('remark',-1)"
|
||||
placeholder="请输入" :disabled="judgeWrite('remark')" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
</JnpfInput>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item>
|
||||
<JnpfGroupTitle content="加工成品" contentPosition="left">
|
||||
</JnpfGroupTitle>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="judgeShow('-${html.relationField}')">
|
||||
<jnpf-form-tip-item label-width="0">
|
||||
<!-- <div class="JNPF-common-title">
|
||||
<h2>设计子表</h2>
|
||||
</div> -->
|
||||
<el-table :data="dataForm.workOrderProductList" size='mini'>
|
||||
<el-table-column type="index" width="50" label="序号" align="center" />
|
||||
<el-table-column label="商品名称" v-if="judgeShow('workorderproduct-productId')"
|
||||
prop="productId">
|
||||
<template slot="header">
|
||||
<span class="required-sign"
|
||||
v-if="judgeRequired('workorderproductList-productId')">*</span>商品名称
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfPopupSelect v-model="scope.row.productId"
|
||||
@change="changeData('workorderproduct-productId',scope.$index)"
|
||||
:rowIndex="scope.$index" :formData="dataForm"
|
||||
:templateJson="interfaceRes.workorderproductproductId" placeholder="请选择"
|
||||
:disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-productId')"
|
||||
hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据"
|
||||
popupType="dialog" relationField='name' :field="'productId'+scope.$index"
|
||||
interfaceId="519505017699307077" :pageSize="20"
|
||||
:columnOptions="workorderproductproductIdcolumnOptions" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
</JnpfPopupSelect>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="加工单位" v-if="judgeShow('workorderproduct-unitId')"
|
||||
prop="unitId">
|
||||
<template slot="header">
|
||||
<span class="required-sign"
|
||||
v-if="judgeRequired('workorderproductList-unitId')">*</span>加工单位
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfPopupSelect v-model="scope.row.unitId"
|
||||
@change="changeData('workorderproduct-unitId',scope.$index)"
|
||||
:rowIndex="scope.$index" :formData="dataForm"
|
||||
:templateJson="interfaceRes.workorderproductunitId" placeholder="请选择"
|
||||
:disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-unitId')"
|
||||
hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据"
|
||||
popupType="dialog" relationField='unit_name' :field="'unitId'+scope.$index"
|
||||
interfaceId="523054191598383685" :pageSize="20"
|
||||
:columnOptions="workorderproductunitIdcolumnOptions" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
</JnpfPopupSelect>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="加工数量" v-if="judgeShow('workorderproduct-proportionNum')"
|
||||
prop="proportionNum">
|
||||
<template slot="header">
|
||||
<span class="required-sign"
|
||||
v-if="judgeRequired('workorderproductList-proportionNum')">*</span>加工数量
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfInput v-model="scope.row.proportionNum"
|
||||
@change="changeData('workorderproduct-proportionNum',scope.$index)"
|
||||
placeholder="请输入"
|
||||
:disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-proportionNum')"
|
||||
clearable :style='{"width":"100%"}'>
|
||||
</JnpfInput>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="BOM" v-if="judgeShow('workorderproduct-bomId')"
|
||||
prop="bomId">
|
||||
<template slot="header">
|
||||
<span class="required-sign"
|
||||
v-if="judgeRequired('workorderproductList-bomId')">*</span>BOM
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfPopupSelect v-model="scope.row.bomId"
|
||||
@change="changeData('workorderproduct-bomId',scope.$index)"
|
||||
:rowIndex="scope.$index" :formData="dataForm"
|
||||
:templateJson="interfaceRes.workorderproductbomId" placeholder="请选择"
|
||||
:disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-bomId')"
|
||||
hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据"
|
||||
popupType="dialog" relationField='bom_name' :field="'bomId'+scope.$index"
|
||||
interfaceId="523054588681531973" :pageSize="20"
|
||||
:columnOptions="workorderproductbomIdcolumnOptions" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
</JnpfPopupSelect>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="参考成本价" v-if="judgeShow('workorderproduct-cost')"
|
||||
prop="cost">
|
||||
<template slot="header">
|
||||
<span class="required-sign"
|
||||
v-if="judgeRequired('workorderproductList-cost')">*</span>参考成本价
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfInput v-model="scope.row.cost"
|
||||
@change="changeData('workorderproduct-cost',scope.$index)" placeholder="请输入"
|
||||
:disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-cost')"
|
||||
clearable :style='{"width":"100%"}'>
|
||||
</JnpfInput>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" v-if="judgeShow('workorderproduct-remark')"
|
||||
prop="remark">
|
||||
<template slot="header">
|
||||
<span class="required-sign"
|
||||
v-if="judgeRequired('workorderproductList-remark')">*</span>备注
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfInput v-model="scope.row.remark"
|
||||
@change="changeData('workorderproduct-remark',scope.$index)" placeholder="请输入"
|
||||
:disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-remark')"
|
||||
clearable :style='{"width":"100%"}'>
|
||||
</JnpfInput>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="50" v-if="!judgeWrite('workorderproductList')">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" class="JNPF-table-delBtn"
|
||||
@click="delworkorderproductList(scope.$index)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="table-actions" @click="addworkorderproductList()"
|
||||
v-if="!judgeWrite('workorderproductList')">
|
||||
<el-button type="text" icon="el-icon-plus">添加</el-button>
|
||||
</div>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item>
|
||||
<JnpfGroupTitle content="原材料" contentPosition="left">
|
||||
</JnpfGroupTitle>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="judgeShow('workorderproduct-${html.relationField}')">
|
||||
<jnpf-form-tip-item label-width="0">
|
||||
<!-- <div class="JNPF-common-title">
|
||||
<h2>设计子表</h2>
|
||||
</div> -->
|
||||
<el-table :data="dataForm.workOrderPrimaryList" size='mini'>
|
||||
<el-table-column type="index" width="50" label="序号" align="center" />
|
||||
<el-table-column label="商品id" v-if="judgeShow('workorderprimary-productId')"
|
||||
prop="productId">
|
||||
<template slot="header">
|
||||
<span class="required-sign"
|
||||
v-if="judgeRequired('workorderprimaryList-productId')">*</span>商品id
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfPopupSelect v-model="scope.row.productId"
|
||||
@change="changeData('workorderprimary-productId',scope.$index)"
|
||||
:rowIndex="scope.$index" :formData="dataForm"
|
||||
:templateJson="interfaceRes.workorderprimaryproductId" placeholder="请选择"
|
||||
hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据"
|
||||
popupType="dialog" relationField='name' :field="'productId'+scope.$index"
|
||||
interfaceId="519505017699307077" :pageSize="20"
|
||||
:columnOptions="workorderprimaryproductIdcolumnOptions" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
</JnpfPopupSelect>
|
||||
</template>
|
||||
|
||||
<!-- <template slot-scope="scope">
|
||||
<JnpfPopupSelect v-model="scope.row.productId"
|
||||
@change="changeData('workorderprimary-productId',scope.$index)"
|
||||
:rowIndex="scope.$index" :formData="dataForm"
|
||||
:templateJson="interfaceRes.workorderprimaryproductId" placeholder="请选择"
|
||||
:disabled="judgeWrite('workorderprimaryList')||judgeWrite('workorderprimaryList-productId')"
|
||||
hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据"
|
||||
popupType="dialog" relationField='name' :field="'productId'+scope.$index"
|
||||
interfaceId="519505017699307077" :pageSize="20"
|
||||
:columnOptions="workorderprimaryproductIdcolumnOptions" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
</JnpfPopupSelect>
|
||||
</template>
|
||||
-->
|
||||
</el-table-column>
|
||||
<el-table-column label="理论发料量" v-if="judgeShow('workorderprimary-theoryNum')"
|
||||
prop="theoryNum">
|
||||
<template slot="header">
|
||||
<span class="required-sign"
|
||||
v-if="judgeRequired('workorderprimaryList-theoryNum')">*</span>理论发料量
|
||||
</template>
|
||||
<!-- <template slot-scope="scope">
|
||||
<JnpfInput v-model="scope.row.theoryNum"
|
||||
@change="changeData('workorderprimary-theoryNum',scope.$index)"
|
||||
placeholder="请输入"
|
||||
:disabled="judgeWrite('workorderprimaryList')||judgeWrite('workorderprimaryList-theoryNum')"
|
||||
clearable :style='{"width":"100%"}'>
|
||||
</JnpfInput>
|
||||
</template> -->
|
||||
<template slot-scope="scope">
|
||||
<JnpfInput v-model="scope.row.theoryNum"
|
||||
@change="changeData('workorderprimary-theoryNum',scope.$index)"
|
||||
placeholder="请输入" clearable :style='{"width":"100%"}'>
|
||||
</JnpfInput>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="实际发料量" v-if="judgeShow('workorderprimary-realityNum')"
|
||||
prop="realityNum">
|
||||
<template slot="header">
|
||||
<span class="required-sign"
|
||||
v-if="judgeRequired('workorderprimaryList-realityNum')">*</span>实际发料量
|
||||
</template>
|
||||
<!-- <template slot-scope="scope">
|
||||
<JnpfInput v-model="scope.row.realityNum"
|
||||
@change="changeData('workorderprimary-realityNum',scope.$index)"
|
||||
placeholder="请输入"
|
||||
:disabled="judgeWrite('workorderprimaryList')||judgeWrite('workorderprimaryList-realityNum')"
|
||||
clearable :style='{"width":"100%"}'>
|
||||
</JnpfInput>
|
||||
</template> -->
|
||||
|
||||
<template slot-scope="scope">
|
||||
<JnpfInput v-model="scope.row.realityNum"
|
||||
@change="changeData('workorderprimary-realityNum',scope.$index)"
|
||||
placeholder="请输入" clearable :style='{"width":"100%"}'>
|
||||
</JnpfInput>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="50" v-if="!judgeWrite('workorderprimaryList')">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" class="JNPF-table-delBtn"
|
||||
@click="delworkorderprimaryList(scope.$index)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- <div class="table-actions" @click="addworkorderprimaryList()"
|
||||
v-if="!judgeWrite('workorderprimaryList')">
|
||||
<el-button type="text" icon="el-icon-plus">添加</el-button>
|
||||
</div> -->
|
||||
|
||||
<div class="table-actions" @click="addworkorderprimaryList()">
|
||||
<el-button type="text" icon="el-icon-plus">添加</el-button>
|
||||
</div>
|
||||
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<!-- 表单结束 -->
|
||||
</template>
|
||||
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm"
|
||||
ref="selectDialog" @select="addForSelect" @close="selectDialogVisible=false" />
|
||||
</el-form>
|
||||
</el-row>
|
||||
<UserBox v-if="userBoxVisible" ref="userBox" @submit="submit" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request from '@/utils/request'
|
||||
import { mapGetters } from "vuex";
|
||||
import { getFormById } from '@/api/workFlow/FormDesign'
|
||||
import comMixin from '@/views/workFlow/workFlowForm/mixin';
|
||||
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
|
||||
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
|
||||
import { getDefaultCurrentValueUserId } from '@/api/permission/user'
|
||||
import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize'
|
||||
import { getDateDay, getLaterData, getBeforeData, getBeforeTime, getLaterTime } from '@/components/Generator/utils/index.js'
|
||||
import { thousandsFormat } from "@/components/Generator/utils/index"
|
||||
export default {
|
||||
mixins: [comMixin],
|
||||
components: {},
|
||||
props: [],
|
||||
data() {
|
||||
return {
|
||||
dataFormSubmitType: 0,
|
||||
continueBtnLoading: false,
|
||||
index: 0,
|
||||
prevDis: false,
|
||||
nextDis: false,
|
||||
allList: [],
|
||||
visible: false,
|
||||
loading: false,
|
||||
btnLoading: false,
|
||||
formRef: 'formRef',
|
||||
setting: {},
|
||||
eventType: '',
|
||||
userBoxVisible: false,
|
||||
selectDialogVisible: false,
|
||||
currTableConf: {},
|
||||
dataValueAll: {},
|
||||
addTableConf: {
|
||||
workOrderProductList: { "popupType": "dialog", "hasPage": true, "popupTitle": "选择数据", "pageSize": 20, "columnOptions": [], "interfaceId": "", "interfaceName": "", "relationOptions": [], "templateJson": [], "popupWidth": "800px" },
|
||||
workOrderPrimaryList: { "popupType": "dialog", "hasPage": true, "popupTitle": "选择数据", "pageSize": 20, "columnOptions": [], "interfaceId": "", "interfaceName": "", "relationOptions": [], "templateJson": [], "popupWidth": "800px" },
|
||||
},
|
||||
//可选范围默认值
|
||||
ableAll: {
|
||||
},
|
||||
tableRows: {
|
||||
workOrderProductList: {
|
||||
productId: '',
|
||||
productIdOptions: [],
|
||||
unitId: '',
|
||||
unitIdOptions: [],
|
||||
proportionNum: '',
|
||||
proportionNumOptions: [],
|
||||
bomId: '',
|
||||
bomIdOptions: [],
|
||||
cost: '',
|
||||
costOptions: [],
|
||||
remark: '',
|
||||
remarkOptions: [],
|
||||
enabledmark: undefined
|
||||
},
|
||||
workOrderPrimaryList: {
|
||||
productId: '',
|
||||
productIdOptions: [],
|
||||
theoryNum: '',
|
||||
theoryNumOptions: [],
|
||||
realityNum: '',
|
||||
realityNumOptions: [],
|
||||
enabledmark: undefined
|
||||
},
|
||||
},
|
||||
Vmodel: "",
|
||||
currVmodel: "",
|
||||
dataForm: {
|
||||
type: undefined,
|
||||
code: undefined,
|
||||
businessfactoryId: undefined,
|
||||
businessId: undefined,
|
||||
workTime: undefined,
|
||||
businessCode: undefined,
|
||||
teamId: undefined,
|
||||
remark: undefined,
|
||||
status: "1",
|
||||
workOrderProductList: [],
|
||||
workOrderPrimaryList: [],
|
||||
version: 0,
|
||||
},
|
||||
tableRequiredData: {},
|
||||
dataRule:
|
||||
{
|
||||
type: [
|
||||
{
|
||||
required: true,
|
||||
message: '不能为空',
|
||||
trigger: 'change'
|
||||
},
|
||||
],
|
||||
businessfactoryId: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择',
|
||||
trigger: 'change'
|
||||
},
|
||||
],
|
||||
businessId: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择',
|
||||
trigger: 'change'
|
||||
},
|
||||
],
|
||||
workTime: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择',
|
||||
trigger: 'change'
|
||||
},
|
||||
],
|
||||
teamId: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择',
|
||||
trigger: 'change'
|
||||
},
|
||||
],
|
||||
status: [
|
||||
{
|
||||
required: true,
|
||||
message: '请至少选择一个',
|
||||
trigger: 'change'
|
||||
},
|
||||
],
|
||||
},
|
||||
statusOptions: [{ "fullName": "待加工", "id": "1" }, { "fullName": "加工重", "id": "2" }],
|
||||
statusProps: { "label": "fullName", "value": "id" },
|
||||
typeOptions: [{ "fullName": "完工入库", "id": "1" }, { "fullName": "计划加工", "id": "2" }, { "fullName": "其他加工", "id": "3" }],
|
||||
typeProps: { "label": "fullName", "value": "id" },
|
||||
businessfactoryIdcolumnOptions: [{ "label": "工厂编码", "value": "code" }, { "label": "工厂名称", "value": "name" },],
|
||||
businessIdcolumnOptions: [{ "label": "生产线编码", "value": "code" }, { "label": "生产线名称", "value": "name" },],
|
||||
teamIdcolumnOptions: [{ "label": "班组编码", "value": "team_code" }, { "label": "班组名称", "value": "team_name" },],
|
||||
workorderproductproductIdcolumnOptions: [{ "label": "商品编码", "value": "code" }, { "label": "商品名称", "value": "name" },],
|
||||
workorderproductunitIdcolumnOptions: [{ "label": "单位名称", "value": "unit_name" },],
|
||||
workorderproductbomIdcolumnOptions: [{ "label": "bom名称", "value": "bom_name" }, { "label": "bom编码", "value": "bom_code" },],
|
||||
workorderprimaryproductIdcolumnOptions: [{ "label": "商品编码", "value": "code" }, { "label": "商品名称", "value": "name" },],
|
||||
childIndex: -1,
|
||||
isEdit: false,
|
||||
interfaceRes: {
|
||||
type: [],
|
||||
code: [],
|
||||
businessfactoryId: [],
|
||||
businessId: [],
|
||||
workTime: [],
|
||||
businessCode: [],
|
||||
teamId: [],
|
||||
status: [],
|
||||
remark: [],
|
||||
workorderproductproductId: [],
|
||||
workorderproductunitId: [],
|
||||
workorderproductproportionNum: [],
|
||||
workorderproductbomId: [],
|
||||
workorderproductcost: [],
|
||||
workorderproductremark: [],
|
||||
workorderprimaryproductId: [],
|
||||
workorderprimarytheoryNum: [],
|
||||
workorderprimaryrealityNum: [],
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
formOperates() {
|
||||
return this.setting.formOperates
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
created() {
|
||||
this.getFormById()
|
||||
if (this.dataForm.id == null || this.dataForm.id == '' && this.dataForm.id == undefined || this.dataForm.id == 0) {
|
||||
this.initDefaultData()
|
||||
}
|
||||
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm))
|
||||
},
|
||||
mounted() { },
|
||||
methods: {
|
||||
changeData(model, index) {
|
||||
this.isEdit = false
|
||||
this.childIndex = index
|
||||
let modelAll = model.split("-");
|
||||
let faceMode = "";
|
||||
for (let i = 0; i < modelAll.length; i++) {
|
||||
faceMode += modelAll[i];
|
||||
}
|
||||
for (let key in this.interfaceRes) {
|
||||
if (key != faceMode) {
|
||||
let faceReList = this.interfaceRes[key]
|
||||
for (let i = 0; i < faceReList.length; i++) {
|
||||
if (faceReList[i].relationField == model) {
|
||||
let options = 'get' + key + 'Options';
|
||||
if (this[options]) {
|
||||
this[options]()
|
||||
}
|
||||
this.changeData(key, index)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
changeDataFormData(type, data, model, index, defaultValue) {
|
||||
if (!this.isEdit) {
|
||||
if (type == 2) {
|
||||
for (let i = 0; i < this.dataForm[data].length; i++) {
|
||||
if (index == -1) {
|
||||
this.dataForm[data][i][model] = defaultValue
|
||||
} else if (index == i) {
|
||||
this.dataForm[data][i][model] = defaultValue
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.dataForm[data] = defaultValue
|
||||
}
|
||||
}
|
||||
},
|
||||
dataAll() {
|
||||
},
|
||||
selfGetInfo(dataForm) {
|
||||
this.dataInfo(dataForm)
|
||||
},
|
||||
beforeSubmit() {
|
||||
const _data = this.dataList()
|
||||
return _data
|
||||
},
|
||||
selfInit() {
|
||||
this.dataAll()
|
||||
},
|
||||
getFormById() {
|
||||
getFormById("523046103495488069").then(res => {
|
||||
this.dataForm.flowId = res.data && res.data.flowId
|
||||
// this.encode = res.data&&res.data.encode
|
||||
})
|
||||
},
|
||||
exist() {
|
||||
let isOk = true
|
||||
for (let key in this.tableRequiredData) {
|
||||
if (this.dataForm[key] && Array.isArray(this.dataForm[key])) {
|
||||
for (let i = 0; i < this.dataForm[key].length; i++) {
|
||||
let item = this.dataForm[key][i]
|
||||
inner: for (let id in item) {
|
||||
let arr = this.tableRequiredData[key].filter(o => o.id === id) || []
|
||||
if (!arr.length) continue inner
|
||||
if (arr[0].required) {
|
||||
let msg = `${arr[0].name}不能为空`
|
||||
let boo = true
|
||||
if (arr[0].dataType === 'array') {
|
||||
boo = !this.jnpf.isEmptyArray(item[id])
|
||||
} else {
|
||||
boo = !this.jnpf.isEmpty(item[id])
|
||||
}
|
||||
if (!boo) {
|
||||
this.$message({
|
||||
message: msg,
|
||||
type: 'error',
|
||||
duration: 1000
|
||||
})
|
||||
isOk = false
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!this.workorderproductExist()) return
|
||||
if (!this.workorderprimaryExist()) return
|
||||
return isOk
|
||||
},
|
||||
workorderproductExist() {
|
||||
let isOk = true;
|
||||
for (let i = 0; i < this.dataForm.workOrderProductList.length; i++) {
|
||||
const e = this.dataForm.workOrderProductList[i];
|
||||
if (!e.productId) {
|
||||
this.$message({
|
||||
message: '商品名称不能为空',
|
||||
type: 'error',
|
||||
duration: 1000
|
||||
});
|
||||
isOk = false
|
||||
break
|
||||
}
|
||||
if (!e.unitId) {
|
||||
this.$message({
|
||||
message: '加工单位不能为空',
|
||||
type: 'error',
|
||||
duration: 1000
|
||||
});
|
||||
isOk = false
|
||||
break
|
||||
}
|
||||
if (!e.proportionNum) {
|
||||
this.$message({
|
||||
message: '加工数量不能为空',
|
||||
type: 'error',
|
||||
duration: 1000
|
||||
});
|
||||
isOk = false
|
||||
break
|
||||
}
|
||||
if (!e.bomId) {
|
||||
this.$message({
|
||||
message: 'BOM不能为空',
|
||||
type: 'error',
|
||||
duration: 1000
|
||||
});
|
||||
isOk = false
|
||||
break
|
||||
}
|
||||
}
|
||||
return isOk;
|
||||
},
|
||||
workorderprimaryExist() {
|
||||
let isOk = true;
|
||||
for (let i = 0; i < this.dataForm.workOrderPrimaryList.length; i++) {
|
||||
const e = this.dataForm.workOrderPrimaryList[i];
|
||||
if (!e.productId) {
|
||||
this.$message({
|
||||
message: '商品id不能为空',
|
||||
type: 'error',
|
||||
duration: 1000
|
||||
});
|
||||
isOk = false
|
||||
break
|
||||
}
|
||||
}
|
||||
return isOk;
|
||||
},
|
||||
clearData() {
|
||||
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
|
||||
},
|
||||
//初始化默认数据
|
||||
initDefaultData() {
|
||||
|
||||
},
|
||||
addworkorderproductList() {
|
||||
let item = {
|
||||
productId: '',
|
||||
unitId: '',
|
||||
proportionNum: undefined,
|
||||
bomId: '',
|
||||
cost: undefined,
|
||||
remark: undefined,
|
||||
}
|
||||
this.getworkorderproductList(item)
|
||||
},
|
||||
delworkorderproductList(index) {
|
||||
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.dataForm.workOrderProductList.splice(index, 1);
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
getworkorderproductList(value) {
|
||||
let item = { ...this.tableRows.workOrderProductList, ...value }
|
||||
this.dataForm.workOrderProductList.push(item)
|
||||
this.childIndex = this.dataForm.workOrderProductList.length - 1
|
||||
this.isEdit = true
|
||||
this.isEdit = false
|
||||
this.childIndex = -1
|
||||
},
|
||||
addworkorderprimaryList() {
|
||||
let item = {
|
||||
productId: '',
|
||||
theoryNum: undefined,
|
||||
realityNum: undefined,
|
||||
}
|
||||
this.getworkorderprimaryList(item)
|
||||
},
|
||||
delworkorderprimaryList(index) {
|
||||
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.dataForm.workOrderPrimaryList.splice(index, 1);
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
getworkorderprimaryList(value) {
|
||||
let item = { ...this.tableRows.workOrderPrimaryList, ...value }
|
||||
this.dataForm.workOrderPrimaryList.push(item)
|
||||
this.childIndex = this.dataForm.workOrderPrimaryList.length - 1
|
||||
this.isEdit = true
|
||||
this.isEdit = false
|
||||
this.childIndex = -1
|
||||
},
|
||||
openSelectDialog(key) {
|
||||
this.currTableConf = this.addTableConf[key]
|
||||
this.currVmodel = key
|
||||
this.selectDialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.selectDialog.init()
|
||||
})
|
||||
},
|
||||
addForSelect(data) {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
let t = data[i]
|
||||
if (this['get' + this.currVmodel]) {
|
||||
this['get' + this.currVmodel](t)
|
||||
}
|
||||
}
|
||||
},
|
||||
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
|
||||
let timeDataValue = null;
|
||||
let timeValue = Number(timeValueData)
|
||||
if (timeRule) {
|
||||
if (timeType == 1) {
|
||||
timeDataValue = timeValue
|
||||
} else if (timeType == 2) {
|
||||
timeDataValue = dataValue
|
||||
} else if (timeType == 3) {
|
||||
timeDataValue = new Date().getTime()
|
||||
} else if (timeType == 4) {
|
||||
let previousDate = '';
|
||||
if (timeTarget == 1 || timeTarget == 2) {
|
||||
previousDate = getDateDay(timeTarget, timeType, timeValue)
|
||||
timeDataValue = new Date(previousDate).getTime()
|
||||
} else if (timeTarget == 3) {
|
||||
previousDate = getBeforeData(timeValue)
|
||||
timeDataValue = new Date(previousDate).getTime()
|
||||
} else {
|
||||
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime()
|
||||
}
|
||||
} else if (timeType == 5) {
|
||||
let previousDate = '';
|
||||
if (timeTarget == 1 || timeTarget == 2) {
|
||||
previousDate = getDateDay(timeTarget, timeType, timeValue)
|
||||
timeDataValue = new Date(previousDate).getTime()
|
||||
} else if (timeTarget == 3) {
|
||||
previousDate = getLaterData(timeValue)
|
||||
timeDataValue = new Date(previousDate).getTime()
|
||||
} else {
|
||||
timeDataValue = getLaterTime(timeTarget, timeValue).getTime()
|
||||
}
|
||||
}
|
||||
}
|
||||
return timeDataValue;
|
||||
},
|
||||
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
|
||||
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType
|
||||
let timeDataValue = null
|
||||
if (timeRule) {
|
||||
if (timeType == 1) {
|
||||
timeDataValue = timeValue || '00:00:00'
|
||||
if (timeDataValue.split(':').length == 3) {
|
||||
timeDataValue = timeDataValue
|
||||
} else {
|
||||
timeDataValue = timeDataValue + ':00'
|
||||
}
|
||||
} else if (timeType == 2) {
|
||||
timeDataValue = dataValue
|
||||
} else if (timeType == 3) {
|
||||
timeDataValue = this.jnpf.toDate(new Date(), format)
|
||||
} else if (timeType == 4) {
|
||||
let previousDate = '';
|
||||
previousDate = getBeforeTime(timeTarget, timeValue)
|
||||
timeDataValue = this.jnpf.toDate(previousDate, format)
|
||||
} else if (timeType == 5) {
|
||||
let previousDate = '';
|
||||
previousDate = getLaterTime(timeTarget, timeValue)
|
||||
timeDataValue = this.jnpf.toDate(previousDate, format)
|
||||
}
|
||||
}
|
||||
return timeDataValue;
|
||||
},
|
||||
dataList() {
|
||||
var _data = this.dataForm;
|
||||
return _data;
|
||||
},
|
||||
dataInfo(dataAll) {
|
||||
let _dataAll = dataAll
|
||||
this.dataForm = _dataAll
|
||||
this.isEdit = true
|
||||
this.dataAll()
|
||||
for (let i = 0; i < _dataAll.workOrderProductList.length; i++) {
|
||||
this.childIndex = i
|
||||
}
|
||||
for (let i = 0; i < _dataAll.workOrderPrimaryList.length; i++) {
|
||||
this.childIndex = i
|
||||
}
|
||||
this.childIndex = -1
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
</script>
|
@ -1,613 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<template>
|
||||
<div :style="{margin: '0 auto',width:'100%'}">
|
||||
<el-row :gutter="15" class="">
|
||||
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px" label-position="right" :disabled="setting.readonly" >
|
||||
<template v-if="!loading && formOperates">
|
||||
<!-- 具体表单 -->
|
||||
<el-col :span="24" >
|
||||
<jnpf-form-tip-item>
|
||||
<JnpfGroupTitle
|
||||
content="单据类型" contentPosition="left" >
|
||||
</JnpfGroupTitle>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24" >
|
||||
<jnpf-form-tip-item>
|
||||
<JnpfText
|
||||
:textStyle='{"color":"#000000","font-weight":"normal","text-decoration":"none","font-size":12,"line-height":32,"font-style":"normal","text-align":"left"}' content=" 不同的单据类型,需要选择不同的收货信息">
|
||||
</JnpfText>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="judgeShow('type')" >
|
||||
<jnpf-form-tip-item
|
||||
label="单据类型" v-if="judgeShow('type')" prop="type" >
|
||||
<JnpfRadio v-model="dataForm.type" @change="changeData('type',-1)"
|
||||
:disabled="judgeWrite('type')" optionType="button" direction="horizontal" size="medium" :options="typeOptions" :props="typeProps" >
|
||||
</JnpfRadio>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24" >
|
||||
<jnpf-form-tip-item>
|
||||
<JnpfGroupTitle
|
||||
content="基础信息" contentPosition="left" >
|
||||
</JnpfGroupTitle>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="judgeShow('code')" >
|
||||
<jnpf-form-tip-item
|
||||
label="单据编号" v-if="judgeShow('code')" prop="code" >
|
||||
<JnpfInput v-model="dataForm.code" @change="changeData('code',-1)"
|
||||
placeholder="系统自动生成" :disabled="judgeWrite('code')" readonly :style='{"width":"100%"}'>
|
||||
</JnpfInput>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="judgeShow('businessfactoryId')" >
|
||||
<jnpf-form-tip-item
|
||||
label="工厂名称" v-if="judgeShow('businessfactoryId')" prop="businessfactoryId" >
|
||||
<JnpfPopupSelect v-model="dataForm.businessfactoryId" @change="changeData('businessfactoryId',-1)"
|
||||
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.businessfactoryId" placeholder="请选择" :disabled="judgeWrite('businessfactoryId')" hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name' field='businessfactoryId' interfaceId="521651055751075845" :pageSize="20" :columnOptions="businessfactoryIdcolumnOptions" clearable :style='{"width":"100%"}'>
|
||||
</JnpfPopupSelect>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="judgeShow('businessId')" >
|
||||
<jnpf-form-tip-item
|
||||
label="生产线" v-if="judgeShow('businessId')" prop="businessId" >
|
||||
<JnpfPopupSelect v-model="dataForm.businessId" @change="changeData('businessId',-1)"
|
||||
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.businessId" placeholder="请选择" :disabled="judgeWrite('businessId')" hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name' field='businessId' interfaceId="517979330417001669" :pageSize="20" :columnOptions="businessIdcolumnOptions" clearable :style='{"width":"100%"}'>
|
||||
</JnpfPopupSelect>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8" v-if="judgeShow('workTime')" >
|
||||
<jnpf-form-tip-item
|
||||
label="加工时间" v-if="judgeShow('workTime')" prop="workTime" >
|
||||
<JnpfDatePicker v-model="dataForm.workTime" @change="changeData('workTime',-1)"
|
||||
:startTime="dateTime(false,1,1,'','')" :endTime="dateTime(false,1,1,'','')" placeholder="请选择" :disabled="judgeWrite('workTime')" clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd" >
|
||||
</JnpfDatePicker>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="judgeShow('businessCode')" >
|
||||
<jnpf-form-tip-item
|
||||
label="外部单据编号" v-if="judgeShow('businessCode')" prop="businessCode" >
|
||||
<JnpfInput v-model="dataForm.businessCode" @change="changeData('businessCode',-1)"
|
||||
placeholder="请输入" :disabled="judgeWrite('businessCode')" clearable :style='{"width":"100%"}'>
|
||||
</JnpfInput>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="judgeShow('teamId')" >
|
||||
<jnpf-form-tip-item
|
||||
label="生产班组" v-if="judgeShow('teamId')" prop="teamId" >
|
||||
<JnpfPopupSelect v-model="dataForm.teamId" @change="changeData('teamId',-1)"
|
||||
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.teamId" placeholder="请选择" :disabled="judgeWrite('teamId')" hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name' field='teamId' interfaceId="523050983727575621" :pageSize="20" :columnOptions="teamIdcolumnOptions" clearable :style='{"width":"100%"}'>
|
||||
</JnpfPopupSelect>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="judgeShow('remark')" >
|
||||
<jnpf-form-tip-item
|
||||
label="备注" v-if="judgeShow('remark')" prop="remark" >
|
||||
<JnpfInput v-model="dataForm.remark" @change="changeData('remark',-1)"
|
||||
placeholder="请输入" :disabled="judgeWrite('remark')" clearable :style='{"width":"100%"}'>
|
||||
</JnpfInput>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24" >
|
||||
<jnpf-form-tip-item>
|
||||
<JnpfGroupTitle
|
||||
content="加工成品" contentPosition="left" >
|
||||
</JnpfGroupTitle>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="judgeShow('-${html.relationField}')" >
|
||||
<jnpf-form-tip-item label-width="0">
|
||||
<div class="JNPF-common-title">
|
||||
<h2>设计子表</h2>
|
||||
</div>
|
||||
<el-table :data="dataForm.workorderproductList" size='mini' >
|
||||
<el-table-column type="index" width="50" label="序号" align="center" />
|
||||
<el-table-column
|
||||
label="商品名称" v-if="judgeShow('workorderproduct-productId')" prop="productId" >
|
||||
<template slot="header" >
|
||||
<span class="required-sign" v-if="judgeRequired('workorderproductList-productId')" >*</span>商品名称
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfPopupSelect v-model="scope.row.productId" @change="changeData('workorderproduct-productId',scope.$index)"
|
||||
:rowIndex="scope.$index" :formData="dataForm" :templateJson="interfaceRes.workorderproductproductId" placeholder="请选择" :disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-productId')" hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name' :field="'productId'+scope.$index" interfaceId="519505017699307077" :pageSize="20" :columnOptions="workorderproductproductIdcolumnOptions" clearable :style='{"width":"100%"}'>
|
||||
</JnpfPopupSelect>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="加工单位" v-if="judgeShow('workorderproduct-unitId')" prop="unitId" >
|
||||
<template slot="header" >
|
||||
<span class="required-sign" v-if="judgeRequired('workorderproductList-unitId')" >*</span>加工单位
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfPopupSelect v-model="scope.row.unitId" @change="changeData('workorderproduct-unitId',scope.$index)"
|
||||
:rowIndex="scope.$index" :formData="dataForm" :templateJson="interfaceRes.workorderproductunitId" placeholder="请选择" :disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-unitId')" hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name' :field="'unitId'+scope.$index" interfaceId="523054191598383685" :pageSize="20" :columnOptions="workorderproductunitIdcolumnOptions" clearable :style='{"width":"100%"}'>
|
||||
</JnpfPopupSelect>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="加工数量" v-if="judgeShow('workorderproduct-proportionNum')" prop="proportionNum" >
|
||||
<template slot="header" >
|
||||
<span class="required-sign" v-if="judgeRequired('workorderproductList-proportionNum')" >*</span>加工数量
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfInput v-model="scope.row.proportionNum" @change="changeData('workorderproduct-proportionNum',scope.$index)"
|
||||
placeholder="请输入" :disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-proportionNum')" clearable :style='{"width":"100%"}'>
|
||||
</JnpfInput>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="BOM" v-if="judgeShow('workorderproduct-bomId')" prop="bomId" >
|
||||
<template slot="header" >
|
||||
<span class="required-sign" v-if="judgeRequired('workorderproductList-bomId')" >*</span>BOM
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfPopupSelect v-model="scope.row.bomId" @change="changeData('workorderproduct-bomId',scope.$index)"
|
||||
:rowIndex="scope.$index" :formData="dataForm" :templateJson="interfaceRes.workorderproductbomId" placeholder="请选择" :disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-bomId')" hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name' :field="'bomId'+scope.$index" interfaceId="523054588681531973" :pageSize="20" :columnOptions="workorderproductbomIdcolumnOptions" clearable :style='{"width":"100%"}'>
|
||||
</JnpfPopupSelect>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="参考成本价" v-if="judgeShow('workorderproduct-cost')" prop="cost" >
|
||||
<template slot="header" >
|
||||
<span class="required-sign" v-if="judgeRequired('workorderproductList-cost')" >*</span>参考成本价
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfInput v-model="scope.row.cost" @change="changeData('workorderproduct-cost',scope.$index)"
|
||||
placeholder="请输入" :disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-cost')" clearable :style='{"width":"100%"}'>
|
||||
</JnpfInput>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="备注" v-if="judgeShow('workorderproduct-remark')" prop="remark" >
|
||||
<template slot="header" >
|
||||
<span class="required-sign" v-if="judgeRequired('workorderproductList-remark')" >*</span>备注
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfInput v-model="scope.row.remark" @change="changeData('workorderproduct-remark',scope.$index)"
|
||||
placeholder="请输入" :disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-remark')" clearable :style='{"width":"100%"}'>
|
||||
</JnpfInput>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="50" v-if="!judgeWrite('workorderproductList')">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" class="JNPF-table-delBtn" @click="delworkorderproductList(scope.$index)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="table-actions" @click="addworkorderproductList()" v-if="!judgeWrite('workorderproductList')">
|
||||
<el-button type="text" icon="el-icon-plus">添加</el-button>
|
||||
</div>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<!-- 表单结束 -->
|
||||
</template>
|
||||
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm"
|
||||
ref="selectDialog" @select="addForSelect" @close="selectDialogVisible=false"/>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<UserBox v-if="userBoxVisible" ref="userBox" @submit="submit" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request from '@/utils/request'
|
||||
import {mapGetters} from "vuex";
|
||||
import {getFormById} from '@/api/workFlow/FormDesign'
|
||||
import comMixin from '@/views/workFlow/workFlowForm/mixin';
|
||||
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
|
||||
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
|
||||
import { getDefaultCurrentValueUserId } from '@/api/permission/user'
|
||||
import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize'
|
||||
import { getDateDay, getLaterData, getBeforeData, getBeforeTime, getLaterTime } from '@/components/Generator/utils/index.js'
|
||||
import { thousandsFormat } from "@/components/Generator/utils/index"
|
||||
export default {
|
||||
mixins: [comMixin],
|
||||
components: { },
|
||||
props: [],
|
||||
data() {
|
||||
return {
|
||||
dataFormSubmitType: 0,
|
||||
continueBtnLoading: false,
|
||||
index: 0,
|
||||
prevDis: false,
|
||||
nextDis: false,
|
||||
allList: [],
|
||||
visible: false,
|
||||
loading: false,
|
||||
btnLoading: false,
|
||||
formRef: 'formRef',
|
||||
setting:{},
|
||||
eventType: '',
|
||||
userBoxVisible:false,
|
||||
selectDialogVisible: false,
|
||||
currTableConf:{},
|
||||
dataValueAll:{},
|
||||
addTableConf:{
|
||||
workorderproductList :{"popupType":"dialog","hasPage":true,"popupTitle":"选择数据","pageSize":20,"columnOptions":[],"interfaceId":"","interfaceName":"","relationOptions":[],"templateJson":[],"popupWidth":"800px"},
|
||||
},
|
||||
//可选范围默认值
|
||||
ableAll:{
|
||||
},
|
||||
tableRows:{
|
||||
workorderproductList:{
|
||||
productId : '',
|
||||
productIdOptions:[],
|
||||
unitId : '',
|
||||
unitIdOptions:[],
|
||||
proportionNum : '',
|
||||
proportionNumOptions:[],
|
||||
bomId : '',
|
||||
bomIdOptions:[],
|
||||
cost : '',
|
||||
costOptions:[],
|
||||
remark : '',
|
||||
remarkOptions:[],
|
||||
enabledmark:undefined
|
||||
},
|
||||
},
|
||||
Vmodel:"",
|
||||
currVmodel:"",
|
||||
dataForm: {
|
||||
type : undefined,
|
||||
code : undefined,
|
||||
businessfactoryId : undefined,
|
||||
businessId : undefined,
|
||||
workTime : undefined,
|
||||
businessCode : undefined,
|
||||
teamId : undefined,
|
||||
remark : undefined,
|
||||
workorderproductList:[],
|
||||
version: 0,
|
||||
},
|
||||
tableRequiredData: {},
|
||||
dataRule:
|
||||
{
|
||||
type: [
|
||||
{
|
||||
required: true,
|
||||
message: '不能为空',
|
||||
trigger: 'change'
|
||||
},
|
||||
],
|
||||
businessfactoryId: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择',
|
||||
trigger: 'change'
|
||||
},
|
||||
],
|
||||
businessId: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择',
|
||||
trigger: 'change'
|
||||
},
|
||||
],
|
||||
workTime: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择',
|
||||
trigger: 'change'
|
||||
},
|
||||
],
|
||||
teamId: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择',
|
||||
trigger: 'change'
|
||||
},
|
||||
],
|
||||
},
|
||||
typeOptions:[{"fullName":"完工入库","id":"1"},{"fullName":"计划加工","id":"2"},{"fullName":"其他加工","id":"3"}],
|
||||
typeProps:{"label":"fullName","value":"id" },
|
||||
businessfactoryIdcolumnOptions:[ {"label":"工厂编码","value":"code"}, {"label":"工厂名称","value":"name"},],
|
||||
businessIdcolumnOptions:[ {"label":"生产线编码","value":"code"}, {"label":"生产线名称","value":"name"},],
|
||||
teamIdcolumnOptions:[ {"label":"班组编码","value":"team_code"}, {"label":"班组名称","value":"team_name"},],
|
||||
workorderproductproductIdcolumnOptions:[ {"label":"商品编码","value":"code"}, {"label":"商品名称","value":"name"},],
|
||||
workorderproductunitIdcolumnOptions:[ {"label":"单位名称","value":"unit_name"},],
|
||||
workorderproductbomIdcolumnOptions:[ {"label":"bom名称","value":"bom_name"}, {"label":"bom编码","value":"bom_code"},],
|
||||
childIndex:-1,
|
||||
isEdit:false,
|
||||
interfaceRes: {
|
||||
type:[] ,
|
||||
code:[] ,
|
||||
businessfactoryId:[] ,
|
||||
businessId:[] ,
|
||||
workTime:[] ,
|
||||
businessCode:[] ,
|
||||
teamId:[] ,
|
||||
remark:[] ,
|
||||
workorderproductproductId: [] ,
|
||||
workorderproductunitId: [] ,
|
||||
workorderproductproportionNum: [] ,
|
||||
workorderproductbomId: [] ,
|
||||
workorderproductcost: [] ,
|
||||
workorderproductremark: [] ,
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
formOperates() {
|
||||
return this.setting.formOperates
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
created() {
|
||||
this.getFormById()
|
||||
if(this.dataForm.id == null || this.dataForm.id == '' && this.dataForm.id == undefined || this.dataForm.id == 0) {
|
||||
this.initDefaultData()
|
||||
}
|
||||
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm))
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
changeData(model, index) {
|
||||
this.isEdit = false
|
||||
this.childIndex = index
|
||||
let modelAll = model.split("-");
|
||||
let faceMode = "";
|
||||
for (let i = 0; i < modelAll.length; i++) {
|
||||
faceMode += modelAll[i];
|
||||
}
|
||||
for (let key in this.interfaceRes) {
|
||||
if (key != faceMode) {
|
||||
let faceReList = this.interfaceRes[key]
|
||||
for (let i = 0; i < faceReList.length; i++) {
|
||||
if (faceReList[i].relationField == model) {
|
||||
let options = 'get' + key + 'Options';
|
||||
if(this[options]){
|
||||
this[options]()
|
||||
}
|
||||
this.changeData(key, index)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
changeDataFormData(type, data, model,index,defaultValue) {
|
||||
if(!this.isEdit) {
|
||||
if (type == 2) {
|
||||
for (let i = 0; i < this.dataForm[data].length; i++) {
|
||||
if (index == -1) {
|
||||
this.dataForm[data][i][model] = defaultValue
|
||||
} else if (index == i) {
|
||||
this.dataForm[data][i][model] = defaultValue
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.dataForm[data] = defaultValue
|
||||
}
|
||||
}
|
||||
},
|
||||
dataAll(){
|
||||
},
|
||||
selfGetInfo(dataForm) {
|
||||
this.dataInfo(dataForm)
|
||||
},
|
||||
beforeSubmit(){
|
||||
const _data =this.dataList()
|
||||
return _data
|
||||
},
|
||||
selfInit() {
|
||||
this.dataAll()
|
||||
},
|
||||
getFormById() {
|
||||
getFormById("523046103495488069").then(res => {
|
||||
this.dataForm.flowId = res.data&&res.data.flowId
|
||||
// this.encode = res.data&&res.data.encode
|
||||
})
|
||||
},
|
||||
exist() {
|
||||
let isOk = true
|
||||
for (let key in this.tableRequiredData) {
|
||||
if (this.dataForm[key] && Array.isArray(this.dataForm[key])) {
|
||||
for (let i = 0; i < this.dataForm[key].length; i++) {
|
||||
let item = this.dataForm[key][i]
|
||||
inner: for (let id in item) {
|
||||
let arr = this.tableRequiredData[key].filter(o => o.id === id) || []
|
||||
if (!arr.length) continue inner
|
||||
if (arr[0].required) {
|
||||
let msg = `${arr[0].name}不能为空`
|
||||
let boo = true
|
||||
if (arr[0].dataType === 'array') {
|
||||
boo = !this.jnpf.isEmptyArray(item[id])
|
||||
} else {
|
||||
boo = !this.jnpf.isEmpty(item[id])
|
||||
}
|
||||
if (!boo) {
|
||||
this.$message({
|
||||
message: msg,
|
||||
type: 'error',
|
||||
duration: 1000
|
||||
})
|
||||
isOk = false
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!this.workorderproductExist()) return
|
||||
return isOk
|
||||
},
|
||||
workorderproductExist() {
|
||||
let isOk = true;
|
||||
for(let i=0;i<this.dataForm.workorderproductList.length;i++){
|
||||
const e = this.dataForm.workorderproductList[i];
|
||||
if (!e.productId) {
|
||||
this.$message({
|
||||
message: '商品名称不能为空',
|
||||
type: 'error',
|
||||
duration: 1000
|
||||
});
|
||||
isOk = false
|
||||
break
|
||||
}
|
||||
if (!e.unitId) {
|
||||
this.$message({
|
||||
message: '加工单位不能为空',
|
||||
type: 'error',
|
||||
duration: 1000
|
||||
});
|
||||
isOk = false
|
||||
break
|
||||
}
|
||||
if (!e.proportionNum) {
|
||||
this.$message({
|
||||
message: '加工数量不能为空',
|
||||
type: 'error',
|
||||
duration: 1000
|
||||
});
|
||||
isOk = false
|
||||
break
|
||||
}
|
||||
if (!e.bomId) {
|
||||
this.$message({
|
||||
message: 'BOM不能为空',
|
||||
type: 'error',
|
||||
duration: 1000
|
||||
});
|
||||
isOk = false
|
||||
break
|
||||
}
|
||||
}
|
||||
return isOk;
|
||||
},
|
||||
clearData(){
|
||||
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
|
||||
},
|
||||
//初始化默认数据
|
||||
initDefaultData() {
|
||||
|
||||
},
|
||||
addworkorderproductList(){
|
||||
let item = {
|
||||
productId:'',
|
||||
unitId:'',
|
||||
proportionNum:undefined,
|
||||
bomId:'',
|
||||
cost:undefined,
|
||||
remark:undefined,
|
||||
}
|
||||
this.getworkorderproductList(item)
|
||||
},
|
||||
delworkorderproductList(index) {
|
||||
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.dataForm.workorderproductList.splice(index, 1);
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
getworkorderproductList(value){
|
||||
let item={...this.tableRows.workorderproductList,...value}
|
||||
this.dataForm.workorderproductList.push(item)
|
||||
this.childIndex=this.dataForm.workorderproductList.length-1
|
||||
this.isEdit = true
|
||||
this.isEdit = false
|
||||
this.childIndex = -1
|
||||
},
|
||||
openSelectDialog(key) {
|
||||
this.currTableConf=this.addTableConf[key]
|
||||
this.currVmodel=key
|
||||
this.selectDialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.selectDialog.init()
|
||||
})
|
||||
},
|
||||
addForSelect(data) {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
let t = data[i]
|
||||
if(this['get'+this.currVmodel]){
|
||||
this['get'+this.currVmodel](t)
|
||||
}
|
||||
}
|
||||
},
|
||||
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
|
||||
let timeDataValue = null;
|
||||
let timeValue = Number(timeValueData)
|
||||
if (timeRule) {
|
||||
if (timeType == 1) {
|
||||
timeDataValue = timeValue
|
||||
} else if (timeType == 2) {
|
||||
timeDataValue = dataValue
|
||||
} else if (timeType == 3) {
|
||||
timeDataValue = new Date().getTime()
|
||||
} else if (timeType == 4) {
|
||||
let previousDate = '';
|
||||
if (timeTarget == 1 || timeTarget == 2) {
|
||||
previousDate = getDateDay(timeTarget, timeType, timeValue)
|
||||
timeDataValue = new Date(previousDate).getTime()
|
||||
} else if (timeTarget == 3) {
|
||||
previousDate = getBeforeData(timeValue)
|
||||
timeDataValue = new Date(previousDate).getTime()
|
||||
} else {
|
||||
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime()
|
||||
}
|
||||
} else if (timeType == 5) {
|
||||
let previousDate = '';
|
||||
if (timeTarget == 1 || timeTarget == 2) {
|
||||
previousDate = getDateDay(timeTarget, timeType, timeValue)
|
||||
timeDataValue = new Date(previousDate).getTime()
|
||||
} else if (timeTarget == 3) {
|
||||
previousDate = getLaterData(timeValue)
|
||||
timeDataValue = new Date(previousDate).getTime()
|
||||
} else {
|
||||
timeDataValue = getLaterTime(timeTarget, timeValue).getTime()
|
||||
}
|
||||
}
|
||||
}
|
||||
return timeDataValue;
|
||||
},
|
||||
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
|
||||
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType
|
||||
let timeDataValue = null
|
||||
if (timeRule) {
|
||||
if (timeType == 1) {
|
||||
timeDataValue = timeValue || '00:00:00'
|
||||
if (timeDataValue.split(':').length == 3) {
|
||||
timeDataValue = timeDataValue
|
||||
} else {
|
||||
timeDataValue = timeDataValue + ':00'
|
||||
}
|
||||
} else if (timeType == 2) {
|
||||
timeDataValue = dataValue
|
||||
} else if (timeType == 3) {
|
||||
timeDataValue = this.jnpf.toDate(new Date(), format)
|
||||
} else if (timeType == 4) {
|
||||
let previousDate = '';
|
||||
previousDate = getBeforeTime(timeTarget, timeValue)
|
||||
timeDataValue = this.jnpf.toDate(previousDate, format)
|
||||
} else if (timeType == 5) {
|
||||
let previousDate = '';
|
||||
previousDate = getLaterTime(timeTarget, timeValue)
|
||||
timeDataValue = this.jnpf.toDate(previousDate, format)
|
||||
}
|
||||
}
|
||||
return timeDataValue;
|
||||
},
|
||||
dataList(){
|
||||
var _data = this.dataForm;
|
||||
return _data;
|
||||
},
|
||||
dataInfo(dataAll){
|
||||
let _dataAll =dataAll
|
||||
this.dataForm = _dataAll
|
||||
this.isEdit = true
|
||||
this.dataAll()
|
||||
for(let i=0;i<_dataAll.workorderproductList.length;i++){
|
||||
this.childIndex = i
|
||||
}
|
||||
this.childIndex=-1
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
</script>
|
Loading…
Reference in new issue