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.

1080 lines
39 KiB

<template>
<view class="jnpf-wrap jnpf-wrap-form" v-if="!loading">
<u-form :model="dataForm" :rules="rules" ref="dataForm" :errorType="['toast']" label-position="left"
label-align="right" :label-width="labelwidth" class="jnpf-form">
<view class="u-p-l-20 u-p-r-20 ">
<u-form-item>
<jnpf-group value="基础信息" content="基础信息" contentPosition="left">
</jnpf-group>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('inspectionCode')" :required="requiredList.inspectionCode" label="质检单编号"
prop="inspectionCode">
<u-input v-model="dataForm.inspectionCode" disabled @change="changeData('inspectionCode',-1)"
input-align='right' placeholder="系统自动生成" :style='{"width":"100%"}' readonly>
</u-input>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('creatorTime')" :required="requiredList.creatorTime" label="制单时间"
prop="creatorTime">
<jnpf-open-data v-model="dataForm.creatorTime" disabled @change="changeData('creatorTime',-1)"
placeholder="系统自动生成" type="currTime" :style='{"width":"100%"}' readonly>
</jnpf-open-data>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('inspectionType')" :required="requiredList.inspectionType" label="质检类型"
prop="inspectionType">
<jnpf-select v-model="dataForm.inspectionType" :disabled="judgeWrite('inspectionType')"
@change="changeData('inspectionType',-1)" clearable placeholder="请选择"
:props="inspectionTypeProps" :options="inspectionTypeOptions" :style='{"width":"100%"}'>
</jnpf-select>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('belongUserId')" :required="requiredList.belongUserId" label="质检人员"
prop="belongUserId">
<jnpf-user-select v-model="dataForm.belongUserId" :disabled="judgeWrite('belongUserId')"
@change="changeData('belongUserId',-1)" selectType="all" :ableIds="ableAll.belongUserIdableIds"
clearable placeholder="请选择" :style='{"width":"100%"}'>
</jnpf-user-select>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('inspectionTime')" :required="requiredList.inspectionTime" label="质检时间"
prop="inspectionTime">
<jnpf-date-time v-model="dataForm.inspectionTime" :disabled="judgeWrite('inspectionTime')"
@change="changeData('inspectionTime',-1)" :startTime="dateTime(false,1,1,'','')"
:endTime="dateTime(false,1,1,'','')" format="yyyy-MM-dd HH:mm" clearable placeholder="请选择"
type="date" :style='{"width":"100%"}'>
</jnpf-date-time>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('remark')" :required="requiredList.remark" label="备注" prop="remark">
<u-input v-model="dataForm.remark" :disabled="judgeWrite('remark')"
@change="changeData('remark',-1)" input-align='right' clearable placeholder="请输入"
:style='{"width":"100%"}'>
</u-input>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 ">
<u-form-item>
<jnpf-group value="关联信息" content="关联信息" contentPosition="left">
</jnpf-group>
</u-form-item>
</view>
<view class="jnpf-table" v-if="judgeShow('warehousinginspectionvoucherList')">
<view class="jnpf-table-item" v-for="(item,i) in dataForm.warehousingInspectionVoucherList" :key="i">
<view class="jnpf-table-item-title u-flex u-row-between">
<text class="jnpf-table-item-title-num">({{i+1}})</text>
<view class="jnpf-table-item-title-action"
v-if=" !judgeWrite('warehousinginspectionvoucherList') && dataForm.warehousingInspectionVoucherList.length>0"
@click="delwarehousinginspectionvoucherList(i)">删除</view>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('warehousinginspectionvoucherList-voucheId')"
:required="requiredList['warehousinginspectionvoucherList-voucheId']" label="凭证单据编号">
<jnpf-popup-select v-model="dataForm.warehousingInspectionVoucherList[i].voucheId"
:disabled="judgeWrite('warehousinginspectionvoucherList')||judgeWrite('warehousinginspectionvoucherList-voucheId')"
@change="changeData('warehousinginspectionvoucher-voucheId',i)" :rowIndex="i"
:formData="dataForm" :templateJson="interfaceRes.warehousinginspectionvouchervoucheId"
clearable propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog"
relationField='voucher_code' :vModel="'voucheId'+i"
:columnOptions="warehousinginspectionvouchervoucheIdColumnOptions"
interfaceId="530709323597241349" :pageSize="20" placeholder="请选择" type="popup"
:style='{"width":"100%"}'>
</jnpf-popup-select>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('warehousinginspectionvoucherList-documentType1')"
:required="requiredList['warehousinginspectionvoucherList-documentType1']" label="单据类型">
<u-input v-model="dataForm.warehousingInspectionVoucherList[i].documentType1"
:disabled="judgeWrite('warehousinginspectionvoucherList')||judgeWrite('warehousinginspectionvoucherList-documentType1')"
@change="changeData('warehousinginspectionvoucher-documentType1',i)" input-align='right'
clearable placeholder="请输入" :style='{"width":"100%"}'>
</u-input>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('warehousinginspectionvoucherList-voucherType1')"
:required="requiredList['warehousinginspectionvoucherList-voucherType1']" label="凭证类型">
<u-input v-model="dataForm.warehousingInspectionVoucherList[i].voucherType1"
:disabled="judgeWrite('warehousinginspectionvoucherList')||judgeWrite('warehousinginspectionvoucherList-voucherType1')"
@change="changeData('warehousinginspectionvoucher-voucherType1',i)" input-align='right'
clearable placeholder="请输入" :style='{"width":"100%"}'>
</u-input>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('warehousinginspectionvoucherList-poundCode')"
:required="requiredList['warehousinginspectionvoucherList-poundCode']" label="磅单编号">
<u-input v-model="dataForm.warehousingInspectionVoucherList[i].poundCode"
:disabled="judgeWrite('warehousinginspectionvoucherList')||judgeWrite('warehousinginspectionvoucherList-poundCode')"
@change="changeData('warehousinginspectionvoucher-poundCode',i)" input-align='right'
clearable placeholder="请输入" :style='{"width":"100%"}'>
</u-input>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('warehousinginspectionvoucherList-vehicleNumber')"
:required="requiredList['warehousinginspectionvoucherList-vehicleNumber']" label="车辆信息">
<u-input v-model="dataForm.warehousingInspectionVoucherList[i].vehicleNumber"
:disabled="judgeWrite('warehousinginspectionvoucherList')||judgeWrite('warehousinginspectionvoucherList-vehicleNumber')"
@change="changeData('warehousinginspectionvoucher-vehicleNumber',i)" input-align='right'
clearable placeholder="请输入" :style='{"width":"100%"}'>
</u-input>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('warehousinginspectionvoucherList-grossWeight')"
:required="requiredList['warehousinginspectionvoucherList-grossWeight']" label="毛重">
<u-input v-model="dataForm.warehousingInspectionVoucherList[i].grossWeight"
:disabled="judgeWrite('warehousinginspectionvoucherList')||judgeWrite('warehousinginspectionvoucherList-grossWeight')"
@change="changeData('warehousinginspectionvoucher-grossWeight',i)" input-align='right'
clearable placeholder="请输入" :style='{"width":"100%"}'>
</u-input>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('warehousinginspectionvoucherList-tareWeight')"
:required="requiredList['warehousinginspectionvoucherList-tareWeight']" label="皮重">
<u-input v-model="dataForm.warehousingInspectionVoucherList[i].tareWeight"
:disabled="judgeWrite('warehousinginspectionvoucherList')||judgeWrite('warehousinginspectionvoucherList-tareWeight')"
@change="changeData('warehousinginspectionvoucher-tareWeight',i)" input-align='right'
clearable placeholder="请输入" :style='{"width":"100%"}'>
</u-input>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('warehousinginspectionvoucherList-buckleWeight')"
:required="requiredList['warehousinginspectionvoucherList-buckleWeight']" label="扣重">
<u-input v-model="dataForm.warehousingInspectionVoucherList[i].buckleWeight"
:disabled="judgeWrite('warehousinginspectionvoucherList')||judgeWrite('warehousinginspectionvoucherList-buckleWeight')"
@change="changeData('warehousinginspectionvoucher-buckleWeight',i)" input-align='right'
clearable placeholder="请输入" :style='{"width":"100%"}'>
</u-input>
</u-form-item>
</view>
</view>
<view class="jnpf-table-addBtn" @click="addwarehousinginspectionvoucherList"
v-if="!judgeWrite('warehousinginspectionvoucherList')">
<u-icon name="plus" color="#2979ff"></u-icon>
<span>{{dataForm.warehousingInspectionVoucherList.length==0?"添加":"添加"}}</span>
</view>
</view>
<view class="u-p-l-20 u-p-r-20 ">
<u-form-item>
<jnpf-group value="商品数据" content="商品数据" contentPosition="left">
</jnpf-group>
</u-form-item>
</view>
<view class="jnpf-table" v-if="judgeShow('warehousinginspectionproductList')">
<view class="jnpf-table-item" v-for="(item,i) in dataForm.warehousingInspectionProductList" :key="i">
<view class="jnpf-table-item-title u-flex u-row-between">
<text class="jnpf-table-item-title-num">({{i+1}})</text>
<view class="jnpf-table-item-title-action"
v-if=" !judgeWrite('warehousinginspectionproductList') && dataForm.warehousingInspectionProductList.length>0"
@click="delwarehousinginspectionproductList(i)">删除</view>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('warehousinginspectionproductList-productId')"
:required="requiredList['warehousinginspectionproductList-productId']" label="商品名称">
<jnpf-popup-select v-model="dataForm.warehousingInspectionProductList[i].productId"
:disabled="judgeWrite('warehousinginspectionproductList')||judgeWrite('warehousinginspectionproductList-productId')"
@change="changeData('warehousinginspectionproduct-productId',i)" :rowIndex="i"
:formData="dataForm" :templateJson="interfaceRes.warehousinginspectionproductproductId"
hasPage clearable propsValue="id" popupWidth="800px" popupTitle="选择数据"
popupType="dialog" relationField='name' :vModel="'productId'+i"
:columnOptions="warehousinginspectionproductproductIdColumnOptions"
interfaceId="530714636022995973" :pageSize="20" placeholder="请选择" type="popup"
:style='{"width":"100%"}'>
</jnpf-popup-select>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('warehousinginspectionproductList-spec')"
:required="requiredList['warehousinginspectionproductList-spec']" label="规格">
<u-input v-model="dataForm.warehousingInspectionProductList[i].spec"
:disabled="judgeWrite('warehousinginspectionproductList')||judgeWrite('warehousinginspectionproductList-spec')"
@change="changeData('warehousinginspectionproduct-spec',i)" input-align='right'
clearable placeholder="请输入" :style='{"width":"100%"}'>
</u-input>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('warehousinginspectionproductList-inventoryUnitIds')"
:required="requiredList['warehousinginspectionproductList-inventoryUnitIds']" label="库存单位">
<u-input v-model="dataForm.warehousingInspectionProductList[i].inventoryUnitIds"
:disabled="judgeWrite('warehousinginspectionproductList')||judgeWrite('warehousinginspectionproductList-inventoryUnitIds')"
@change="changeData('warehousinginspectionproduct-inventoryUnitIds',i)"
input-align='right' clearable placeholder="请输入" :style='{"width":"100%"}'>
</u-input>
</u-form-item>
</view>
</view>
<view class="jnpf-table-addBtn" @click="addwarehousinginspectionproductList"
v-if="!judgeWrite('warehousinginspectionproductList')">
<u-icon name="plus" color="#2979ff"></u-icon>
<span>{{dataForm.warehousingInspectionProductList.length==0?"添加":"添加"}}</span>
</view>
</view>
<view class="u-p-l-20 u-p-r-20 ">
<u-form-item>
<jnpf-group value="检测结论" content="检测结论" contentPosition="left">
</jnpf-group>
</u-form-item>
</view>
<view class="jnpf-table" v-if="judgeShow('warehousinginspectionconclusionList')">
<view class="jnpf-table-item" v-for="(item,i) in dataForm.warehousingInspectionConclusionList" :key="i">
<view class="jnpf-table-item-title u-flex u-row-between">
<text class="jnpf-table-item-title-num">({{i+1}})</text>
<view class="jnpf-table-item-title-action"
v-if=" !judgeWrite('warehousinginspectionconclusionList') && dataForm.warehousingInspectionConclusionList.length>0"
@click="delwarehousinginspectionconclusionList(i)">删除</view>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('warehousinginspectionconclusionList-grossWeight')"
:required="requiredList['warehousinginspectionconclusionList-grossWeight']" label="毛重">
<u-input v-model="dataForm.warehousingInspectionConclusionList[i].grossWeight"
:disabled="judgeWrite('warehousinginspectionconclusionList')||judgeWrite('warehousinginspectionconclusionList-grossWeight')"
@change="changeData('warehousinginspectionconclusion-grossWeight',i)"
input-align='right' clearable placeholder="请输入" :style='{"width":"100%"}'>
</u-input>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('warehousinginspectionconclusionList-tareWeight')"
:required="requiredList['warehousinginspectionconclusionList-tareWeight']" label="皮重">
<u-input v-model="dataForm.warehousingInspectionConclusionList[i].tareWeight"
:disabled="judgeWrite('warehousinginspectionconclusionList')||judgeWrite('warehousinginspectionconclusionList-tareWeight')"
@change="changeData('warehousinginspectionconclusion-tareWeight',i)" input-align='right'
clearable placeholder="请输入" :style='{"width":"100%"}'>
</u-input>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('warehousinginspectionconclusionList-buckleWeight')"
:required="requiredList['warehousinginspectionconclusionList-buckleWeight']" label="扣重">
<u-input v-model="dataForm.warehousingInspectionConclusionList[i].buckleWeight"
:disabled="judgeWrite('warehousinginspectionconclusionList')||judgeWrite('warehousinginspectionconclusionList-buckleWeight')"
@change="changeData('warehousinginspectionconclusion-buckleWeight',i)"
input-align='right' clearable placeholder="请输入" :style='{"width":"100%"}'>
</u-input>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('warehousinginspectionconclusionList-netWeight')"
:required="requiredList['warehousinginspectionconclusionList-netWeight']" label="净重(自动计算)">
<u-input v-model="dataForm.warehousingInspectionConclusionList[i].netWeight"
:disabled="judgeWrite('warehousinginspectionconclusionList')||judgeWrite('warehousinginspectionconclusionList-netWeight')"
@change="changeData('warehousinginspectionconclusion-netWeight',i)" input-align='right'
clearable placeholder="请输入" :style='{"width":"100%"}'>
</u-input>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('warehousinginspectionconclusionList-reduceLevel')"
:required="requiredList['warehousinginspectionconclusionList-reduceLevel']" label="是否降级">
<jnpf-select v-model="dataForm.warehousingInspectionConclusionList[i].reduceLevel"
:disabled="judgeWrite('warehousinginspectionconclusionList')||judgeWrite('warehousinginspectionconclusionList-reduceLevel')"
@change="changeData('warehousinginspectionconclusion-reduceLevel',i)" clearable
placeholder="请选择" :props="warehousinginspectionconclusionreduceLevelProps"
:options="warehousinginspectionconclusionreduceLevelOptions" :style='{"width":"100%"}'>
</jnpf-select>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('warehousinginspectionconclusionList-grade')"
:required="requiredList['warehousinginspectionconclusionList-grade']" label="等级">
<u-input v-model="dataForm.warehousingInspectionConclusionList[i].grade"
:disabled="judgeWrite('warehousinginspectionconclusionList')||judgeWrite('warehousinginspectionconclusionList-grade')"
@change="changeData('warehousinginspectionconclusion-grade',i)" input-align='right'
clearable placeholder="请输入" :style='{"width":"100%"}'>
</u-input>
</u-form-item>
</view>
</view>
<view class="jnpf-table-addBtn" @click="addwarehousinginspectionconclusionList"
v-if="!judgeWrite('warehousinginspectionconclusionList')">
<u-icon name="plus" color="#2979ff"></u-icon>
<span>{{dataForm.warehousingInspectionConclusionList.length==0?"添加":"添加"}}</span>
</view>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('conclusionType')" :required="requiredList.conclusionType" label="检测结论"
prop="conclusionType">
<jnpf-select v-model="dataForm.conclusionType" :disabled="judgeWrite('conclusionType')"
@change="changeData('conclusionType',-1)" clearable placeholder="请选择"
:props="conclusionTypeProps" :options="conclusionTypeOptions" :style='{"width":"100%"}'>
</jnpf-select>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('conclusionRemark')" :required="requiredList.conclusionRemark" label="检验结果"
prop="conclusionRemark">
<u-input v-model="dataForm.conclusionRemark" :disabled="judgeWrite('conclusionRemark')"
@change="changeData('conclusionRemark',-1)" input-align='right' clearable placeholder="请输入"
:style='{"width":"100%"}'>
</u-input>
</u-form-item>
</view>
</u-form>
<u-modal v-model="show" :content="content" width='70%' border-radius="16"
:content-style="{fontSize: '28rpx',padding: '20rpx',lineHeight: '44rpx',textAlign: 'left'}"
:titleStyle="{padding: '20rpx'}" :confirm-style="{height: '80rpx',lineHeight: '80rpx'}" :title="title"
confirm-text="确定">
</u-modal>
</view>
</template>
<script>
import {
getDictionaryDataSelector,
getDataInterfaceRes,
getDefaultCurrentValueUserId,
getDefaultCurrentValueDepartmentId
} from '@/api/common'
import comMixin from '../../../workFlow/workFlowForm/mixin'
import {
getDateDay,
getLaterData,
getBeforeData,
getBeforeTime,
getLaterTime
} from '@/components/index.js'
import request from '@/utils/request'
export default {
mixins: [comMixin],
data() {
return {
idList: [],
index: 0,
actionList: [],
actionListLength: false,
showAction: false,
btnLoading: false,
loading: false,
text: '提示:测试文本',
tableKey: '',
dataForm: {
id: "",
inspectionCode: '',
creatorTime: "",
inspectionType: "",
belongUserId: '',
inspectionTime: "",
remark: '',
conclusionType: "",
conclusionRemark: '',
warehousingInspectionVoucherList: [],
warehousingInspectionProductList: [],
warehousingInspectionConclusionList: [],
},
rules: {
inspectionType: [{
required: true,
message: '质检类型请选择',
}, ],
belongUserId: [{
required: true,
message: '质检人员请选择',
}, ],
inspectionTime: [{
required: true,
message: '质检时间请选择',
}, ],
conclusionType: [{
required: true,
message: '检测结论请选择',
}, ],
},
inspectionTypeOptions: [{
"fullName": "入库质检",
"id": "1"
}, {
"fullName": "出库质检",
"id": "2"
}],
inspectionTypeProps: {
"label": "fullName",
"value": "id",
"multiple": false,
"children": ""
},
conclusionTypeOptions: [{
"fullName": "合格",
"id": "1"
}, {
"fullName": "不合格",
"id": "2"
}],
conclusionTypeProps: {
"label": "fullName",
"value": "id",
"multiple": false,
"children": ""
},
warehousinginspectionvouchervoucheIdColumnOptions: [{
"label": "凭证编号",
"value": "voucher_code"
},
{
"label": "单据类型",
"value": "documentTypes"
},
{
"label": "凭证类型",
"value": "voucherTypes"
},
{
"label": "车辆信息",
"value": "vehicle_number"
},
],
warehousinginspectionproductproductIdColumnOptions: [{
"label": "商品名称",
"value": "name"
},
{
"label": "规格",
"value": "spec"
},
],
warehousinginspectionconclusionreduceLevelOptions: [{
"fullName": "是",
"id": "1"
}, {
"fullName": "否",
"id": "2"
}],
warehousinginspectionconclusionreduceLevelProps: {
"label": "fullName",
"value": "id",
"multiple": false,
"children": ""
},
labelwidth: 100 * 1.5,
menuId: '',
jurisdictionType: '',
ruleList: {
warehousingInspectionVoucherList: {
'voucheId': '凭证单据编号不能为空',
},
warehousingInspectionProductList: {
'productId': '商品名称不能为空',
},
warehousingInspectionConclusionList: {
'netWeight': '净重(自动计算)不能为空',
},
},
interfaceRes: {
inspectionCode: [],
creatorTime: [],
inspectionType: [],
belongUserId: [],
inspectionTime: [],
remark: [],
conclusionType: [],
conclusionRemark: [],
warehousinginspectionvouchervoucheId: [{
fieldName: "这是质检单的类型",
field: "inspectionType",
defaultValue: "",
jnpfKey: "select",
dataType: "varchar",
id: "q3dbiy1",
required: "1",
relationField: "inspectionType",
}, ],
warehousinginspectionvoucherdocumentType1: [],
warehousinginspectionvouchervoucherType1: [],
warehousinginspectionvoucherpoundCode: [],
warehousinginspectionvouchervehicleNumber: [],
warehousinginspectionvouchergrossWeight: [],
warehousinginspectionvouchertareWeight: [],
warehousinginspectionvoucherbuckleWeight: [],
warehousinginspectionproductproductId: [{
fieldName: "根据凭证带出的商品进行查询",
field: "product",
defaultValue: "",
jnpfKey: "billRule",
dataType: "varchar",
id: "rBzgiy1",
required: "1",
relationField: "inspectionCode",
}, ],
warehousinginspectionproductspec: [],
warehousinginspectionproductinventoryUnitIds: [],
warehousinginspectionconclusiongrossWeight: [],
warehousinginspectionconclusiontareWeight: [],
warehousinginspectionconclusionbuckleWeight: [],
warehousinginspectionconclusionnetWeight: [],
warehousinginspectionconclusionreduceLevel: [],
warehousinginspectionconclusiongrade: [],
},
regList: {
warehousingInspectionVoucherList: {
voucheId: [],
documentType1: [],
voucherType1: [],
poundCode: [],
vehicleNumber: [],
grossWeight: [],
tareWeight: [],
buckleWeight: [],
},
warehousingInspectionProductList: {
productId: [],
spec: [],
inventoryUnitIds: [],
},
warehousingInspectionConclusionList: {
grossWeight: [],
tareWeight: [],
buckleWeight: [],
netWeight: [],
reduceLevel: [],
grade: [],
},
},
ableAll: {
belongUserIdableIds: [],
},
childIndex: -1,
dataValue: {},
isEdit: false,
userInfo: {},
formatType: {
"yyyy": "yyyy",
"yyyy-MM": "yyyy-mm",
"yyyy-MM-dd": "yyyy-mm-dd",
"yyyy-MM-dd HH:mm": "yyyy-mm-dd hh:MM",
"yyyy-MM-dd HH:mm:ss": "yyyy-mm-dd hh:MM:ss",
"HH:mm:ss": "hh:MM:ss",
"HH:mm": "hh:MM"
},
content: '',
title: '',
show: false,
}
},
onLoad(option) {
uni.$on('linkPageConfirm', (subVal) => {
if (this.tableKey) {
for (let i = 0; i < subVal.length; i++) {
let t = subVal[i]
if (this['get' + this.tableKey]) {
this['get' + this.tableKey](t)
}
}
this.childIndex = -1
this.collapse()
}
})
this.jurisdictionType = option.jurisdictionType
this.menuId = option.menuId
this.userInfo = uni.getStorageSync('userInfo') || {}
this.dataForm.id = option.id || 0
let _title = ""
if (option.jurisdictionType == 'btn_edit') {
_title = "编辑"
}
if (option.jurisdictionType == 'btn_detail') {
_title = "详情"
}
if (option.jurisdictionType == 'btn_add') {
_title = "新增"
}
if (_title) {
uni.setNavigationBarTitle({
title: _title
})
}
this.selfInit()
this.initDefaultData()
this.dataAll()
this.initData()
this.dataValue = JSON.parse(JSON.stringify(this.dataForm))
this.idList = option.idList ? option.idList.split(",") : []
for (let i = 0; i < this.idList.length; i++) {
if (this.idList[i] == option.id) {
this.index = i;
}
}
if (!option.id) {
this.actionList.push({
text: '确定并新增',
id: 'save_add'
})
} else {
let upper = {
text: '上一条',
id: 'upper',
disabled: this.index == 0 ? true : false
}
this.actionList.push(upper)
let lower = {
text: '下一条',
id: 'lower',
disabled: this.index == this.idList.length - 1 ? true : false
}
this.actionList.push(lower)
this.actionList.push({
text: '确定并继续',
id: 'save_proceed'
})
this.collapse()
}
},
onReady() {
this.$nextTick(() => {
setTimeout(() => {
this.$refs.dataForm.setRules(this.rules);
}, 100)
})
},
watch: {
dataForm: {
handler(val, oldVal) {
this.warehousinginspectionvoucher()
this.warehousinginspectionproduct()
this.warehousinginspectionconclusion()
},
deep: true
}
},
methods: {
handleAction(index) {
if (this.actionList[index].id === 'save_add' || this.actionList[index].id === 'save_proceed') {
this.submitForm(1)
} else {
this.calculation(this.actionList[index].id, index)
}
},
calculation(type, index) {
if (type === 'upper') {
this.index--
this.actionList[index + 1].disabled = false
if (this.index == 0) this.actionList[index].disabled = true
} else {
this.index++
this.actionList[index - 1].disabled = false
if (this.index == this.idList.length - 1) this.actionList[index].disabled = true
}
this.dataForm.id = this.idList[this.index]
this.initData()
},
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, edit) {
if (!edit) {
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
}
}
},
clickIcon(label, tipLabel) {
this.content = tipLabel
this.title = label
this.show = true
},
exist() {
let title = [];
let _ruleList = this.ruleList
for (let k in _ruleList) {
let childData = this.dataForm[k]
childData.forEach((item, index) => {
for (let model in _ruleList[k]) {
if (item[model] instanceof Array) {
if (item[model].length == 0) {
title.push(_ruleList[k][model])
}
} else if (!item[model]) {
title.push(_ruleList[k][model])
}
}
})
}
let _regList = this.regList
for (let k in _regList) {
let childData = this.dataForm[k]
for (let n in _regList[k]) {
for (let i = 0; i < _regList[k][n].length; i++) {
const element = _regList[k][n][i]
if (element.pattern) {
element.pattern = element.pattern.toString()
let start = element.pattern.indexOf('/')
let stop = element.pattern.lastIndexOf('/')
let str = element.pattern.substring(start + 1, stop)
let reg = new RegExp(str)
element.pattern = reg
}
childData.forEach((item, index) => {
if (item[n] && !element.pattern.test(item[n])) {
title.push(element.message)
}
})
}
}
}
if (title.length > 0) {
return title[0]
}
},
resetForm() {
uni.navigateBack()
},
dataAll() {
this.collapse()
},
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
let timeDataValue = null;
let timeValue = Number(timeValueData)
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValueData ? timeValue : null
} 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 && timeValue) {
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;
},
warehousinginspectionvoucher() {
let table = this.dataForm.warehousingInspectionVoucherList
let summaryField = []
let summaryFieldName = {}
let data = {}
let thousandsField = []
for (let i in summaryField) {
let map = {}
let val = 0
for (let j = 0; j < table.length; j++) {
let summary = table[j][summaryField[i]];
if (summary) {
let data = isNaN(summary) ? 0 : Number(summary)
val += data
}
}
map.id = summaryField[i];
map.name = summaryFieldName[summaryField[i]];
map.val = (thousandsField.includes(summaryField[i])) ? Number(val).toLocaleString('zh', {
maximumFractionDigits: '2'
}) : val;
data[summaryField[i]] = map;
}
return data;
},
warehousinginspectionproduct() {
let table = this.dataForm.warehousingInspectionProductList
let summaryField = []
let summaryFieldName = {}
let data = {}
let thousandsField = []
for (let i in summaryField) {
let map = {}
let val = 0
for (let j = 0; j < table.length; j++) {
let summary = table[j][summaryField[i]];
if (summary) {
let data = isNaN(summary) ? 0 : Number(summary)
val += data
}
}
map.id = summaryField[i];
map.name = summaryFieldName[summaryField[i]];
map.val = (thousandsField.includes(summaryField[i])) ? Number(val).toLocaleString('zh', {
maximumFractionDigits: '2'
}) : val;
data[summaryField[i]] = map;
}
return data;
},
warehousinginspectionconclusion() {
let table = this.dataForm.warehousingInspectionConclusionList
let summaryField = []
let summaryFieldName = {}
let data = {}
let thousandsField = []
for (let i in summaryField) {
let map = {}
let val = 0
for (let j = 0; j < table.length; j++) {
let summary = table[j][summaryField[i]];
if (summary) {
let data = isNaN(summary) ? 0 : Number(summary)
val += data
}
}
map.id = summaryField[i];
map.name = summaryFieldName[summaryField[i]];
map.val = (thousandsField.includes(summaryField[i])) ? Number(val).toLocaleString('zh', {
maximumFractionDigits: '2'
}) : val;
data[summaryField[i]] = map;
}
return data;
},
initData() {
this.$nextTick(function() {
if (this.dataForm.id) {
this.loading = true
request({
url: '/api/scm/WarehousingInspection/' + this.dataForm.id,
method: 'get',
}).then(res => {
this.dataInfo(res.data)
this.loading = false
})
} else {
this.initDefaultData()
}
})
},
beforeSubmit() {
const _data = this.dataList()
return _data
},
initDefaultData() {
this.dataForm.belongUserId = this.userInfo.userId
this.dataForm.inspectionTime = new Date().getTime()
},
selfInit() {
this.$store.commit('base/UPDATE_RELATION_DATA', {})
this.dataAll()
this.initDefaultData()
this.collapse()
},
selfGetInfo(dataForm) {
this.dataForm.id = this.dataForm.id
this.dataInfo(dataForm)
},
addwarehousinginspectionvoucherList() {
let value = {}
this.tableKey = 'warehousinginspectionvoucherList';
this.getwarehousinginspectionvoucherList(value)
this.childIndex = -1
this.collapse()
},
delwarehousinginspectionvoucherList(index) {
var that = this
uni.showModal({
title: '提示',
content: '确认删除该条信息吗?',
success: function(res) {
if (res.confirm) {
that.dataForm.warehousingInspectionVoucherList.splice(index, 1);
that.collapse()
}
}
})
},
getwarehousinginspectionvoucherList(value) {
let item = {
voucheId: "",
documentType1: '',
voucherType1: '',
poundCode: '',
vehicleNumber: '',
grossWeight: '',
tareWeight: '',
buckleWeight: '',
}
let result = {
...item,
...value
}
this.dataForm.warehousingInspectionVoucherList.push(result)
this.childIndex = this.dataForm.warehousingInspectionVoucherList.length - 1
this.isEdit = true
this.isEdit = false
},
addwarehousinginspectionproductList() {
let value = {}
this.tableKey = 'warehousinginspectionproductList';
this.getwarehousinginspectionproductList(value)
this.childIndex = -1
this.collapse()
},
delwarehousinginspectionproductList(index) {
var that = this
uni.showModal({
title: '提示',
content: '确认删除该条信息吗?',
success: function(res) {
if (res.confirm) {
that.dataForm.warehousingInspectionProductList.splice(index, 1);
that.collapse()
}
}
})
},
getwarehousinginspectionproductList(value) {
let item = {
productId: "",
spec: '',
inventoryUnitIds: '',
}
let result = {
...item,
...value
}
this.dataForm.warehousingInspectionProductList.push(result)
this.childIndex = this.dataForm.warehousingInspectionProductList.length - 1
this.isEdit = true
this.isEdit = false
},
addwarehousinginspectionconclusionList() {
let value = {}
this.tableKey = 'warehousinginspectionconclusionList';
this.getwarehousinginspectionconclusionList(value)
this.childIndex = -1
this.collapse()
},
delwarehousinginspectionconclusionList(index) {
var that = this
uni.showModal({
title: '提示',
content: '确认删除该条信息吗?',
success: function(res) {
if (res.confirm) {
that.dataForm.warehousingInspectionConclusionList.splice(index, 1);
that.collapse()
}
}
})
},
getwarehousinginspectionconclusionList(value) {
let item = {
grossWeight: '',
tareWeight: '',
buckleWeight: '',
netWeight: '',
reduceLevel: "",
grade: '',
}
let result = {
...item,
...value
}
this.dataForm.warehousingInspectionConclusionList.push(result)
this.childIndex = this.dataForm.warehousingInspectionConclusionList.length - 1
this.isEdit = true
this.isEdit = false
},
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.warehousingInspectionVoucherList.length; i++) {
this.childIndex = i
}
for (let i = 0; i < _dataAll.warehousingInspectionProductList.length; i++) {
this.childIndex = i
}
for (let i = 0; i < _dataAll.warehousingInspectionConclusionList.length; i++) {
this.childIndex = i
}
this.childIndex = -1
this.collapse()
},
collapse() {
setTimeout(() => {}, 1000);
},
},
}
</script>
<style>
page {
background-color: #f0f2f6;
}
</style>