移动端费用单

jg-waiwang-pro
XI_TENG\xixi_ 5 months ago
parent 9bcb8f8d87
commit 631630390c

@ -484,6 +484,18 @@
"style": { "style": {
"navigationBarTitleText": "" "navigationBarTitleText": ""
} }
},
{
"path": "warehousingReportloss/index",
"style": {
"navigationBarTitleText": ""
}
},
{
"path": "cwCost/index",
"style": {
"navigationBarTitleText": ""
}
} }
] ]
}, },

@ -0,0 +1,913 @@
<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('code')" :required="requiredList.code" label="单据编号" prop="code">
<u-input v-model="dataForm.code" disabled @change="changeData('code',-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('institutionId')" :required="requiredList.institutionId" label="费用归属"
prop="institutionId">
<jnpf-com-select v-model="dataForm.institutionId" :disabled="judgeWrite('institutionId')"
@change="changeData('institutionId',-1)" selectType="all"
:ableIds="ableAll.institutionIdableIds" clearable placeholder="请选择" type="organize"
:style='{"width":"100%"}'>
</jnpf-com-select>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('subjectId')" :required="requiredList.subjectId" label="往来单位"
prop="subjectId">
<jnpf-popup-select v-model="dataForm.subjectId" :disabled="judgeWrite('subjectId')"
@change="changeData('subjectId',-1)" :rowIndex="null" :formData="dataForm"
:templateJson="interfaceRes.subjectId" hasPage clearable propsValue="id" popupWidth="800px"
popupTitle="选择数据" popupType="dialog" relationField='name' vModel='subjectId'
:columnOptions="subjectIdColumnOptions" interfaceId="542305697765799941" :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('costTime')" :required="requiredList.costTime" label="费用发生时间"
prop="costTime">
<jnpf-date-time v-model="dataForm.costTime" :disabled="judgeWrite('costTime')"
@change="changeData('costTime',-1)" :startTime="dateTime(false,1,1,'','')"
:endTime="dateTime(false,1,1,'','')" format="yyyy-MM-dd" 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('businessCode')" :required="requiredList.businessCode" label="关联数据"
prop="businessCode">
<u-input v-model="dataForm.businessCode" :disabled="judgeWrite('businessCode')"
@change="changeData('businessCode',-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 form-item-box">
<u-form-item v-if="judgeShow('costType')" :required="requiredList.costType" label="费用单类型"
prop="costType">
<jnpf-select v-model="dataForm.costType" :disabled="judgeWrite('costType')"
@change="changeData('costType',-1)" clearable placeholder="请选择" :props="costTypeProps"
:options="costTypeOptions" :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('remark')" :required="requiredList.remark" label="备注" prop="remark">
<u-input v-model="dataForm.remark" :disabled="judgeWrite('remark')"
@change="changeData('remark',-1)" input-align='right' placeholder="请输入" :maxlength="300"
type="textarea" :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="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('costProject')" :required="requiredList.costProject" label="费用项目"
prop="costProject">
<jnpf-cascader v-model="dataForm.costProject" :disabled="judgeWrite('costProject')"
@change="changeData('costProject',-1)" clearable placeholder="请选择" :props="costProjectProps"
:options="costProjectOptions" :style='{"width":"100%"}'>
</jnpf-cascader>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('type')" :required="requiredList.type" label="收付类型" prop="type">
<jnpf-radio v-model="dataForm.type" :disabled="judgeWrite('type')" @change="changeData('type',-1)"
optionType="default" direction="horizontal" :props="typeProps" :options="typeOptions">
</jnpf-radio>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('wayType')" :required="requiredList.wayType" label="付款方式" prop="wayType">
<jnpf-radio v-model="dataForm.wayType" :disabled="judgeWrite('wayType')"
@change="changeData('wayType',-1)" optionType="default" direction="horizontal"
:props="wayTypeProps" :options="wayTypeOptions">
</jnpf-radio>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('wayStatus')" :required="requiredList.wayStatus" label="付款状态"
prop="wayStatus">
<jnpf-radio v-model="dataForm.wayStatus" :disabled="judgeWrite('wayStatus')"
@change="changeData('wayStatus',-1)" optionType="default" direction="horizontal"
:props="wayStatusProps" :options="wayStatusOptions">
</jnpf-radio>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('costPrice')" :required="requiredList.costPrice" label="费用金额"
prop="costPrice">
<u-input v-model="dataForm.costPrice" :disabled="judgeWrite('costPrice')"
@change="changeData('costPrice',-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 form-item-box">
<u-form-item v-if="judgeShow('payment')" :required="requiredList.payment" label="收付款单号" prop="payment">
<u-input v-model="dataForm.payment" :disabled="judgeWrite('payment')"
@change="changeData('payment',-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 form-item-box">
<u-form-item v-if="judgeShow('pictures')" :required="requiredList.pictures" label="图片" prop="pictures">
<jnpf-upload v-model="dataForm.pictures" :disabled="judgeWrite('pictures')"
@change="changeData('pictures',-1)" sizeUnit="MB" :fileSize="10" :limit="1"
pathType="defaultPath" :isAccount="0" :value="dataForm.pictures">
</jnpf-upload>
</u-form-item>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('annexFile')" :required="requiredList.annexFile" label="附件文件"
prop="annexFile">
<jnpf-file v-model="dataForm.annexFile" :disabled="judgeWrite('annexFile')"
@change="changeData('annexFile',-1)" :list="dataForm.annexFile" sizeUnit="MB" :fileSize="10"
:limit="1" pathType="defaultPath" :isAccount="0">
</jnpf-file>
</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: "",
code: '',
institutionId: [],
subjectId: "",
costTime: "",
businessCode: '',
costType: "",
remark: '',
costProject: [],
type: '',
wayType: '',
wayStatus: '',
costPrice: '',
payment: '',
pictures: [],
annexFile: [],
},
rules: {
institutionId: [{
required: true,
message: '费用归属请至少选择一个',
type: 'array',
}, ],
subjectId: [{
required: true,
message: '往来单位请选择',
}, ],
costTime: [{
required: true,
message: '费用发生时间请选择',
}, ],
costType: [{
required: true,
message: '费用单类型请选择',
}, ],
remark: [{
required: true,
message: '备注请输入',
}, ],
costProject: [{
required: true,
message: '费用项目请至少选择一个',
type: 'array',
}, ],
type: [{
required: true,
message: '收付类型不能为空',
}, ],
wayType: [{
required: true,
message: '付款方式不能为空',
}, ],
wayStatus: [{
required: true,
message: '付款状态不能为空',
}, ],
costPrice: [{
required: true,
message: '费用金额请输入',
},
{
pattern: /^([1-9][\d]*|0)(\.[\d]+)?$/,
message: '费用金额请输入正确的金额',
},
],
pictures: [{
required: true,
message: '图片请至少选择一个',
type: 'array',
}, ],
annexFile: [{
required: true,
message: '附件文件请至少选择一个',
type: 'array',
}, ],
},
subjectIdColumnOptions: [{
"label": "类型",
"value": "subjectBasicTypes"
},
{
"label": "名称",
"value": "name"
},
],
costTypeOptions: [{
"fullName": "常规费用",
"id": "1"
}, {
"fullName": "抵扣保证金",
"id": "2"
}, {
"fullName": "抵扣利息",
"id": "3"
}, {
"fullName": "抵扣金额",
"id": "4"
}, {
"fullName": "预付款",
"id": "5"
}, {
"fullName": "预付款抵扣",
"id": "6"
}],
costTypeProps: {
"label": "fullName",
"value": "id",
"multiple": false,
"children": ""
},
costProjectOptions: [{
"children": [{
"fullName": "交易服务费",
"id": "E1001"
}, {
"fullName": "保险费",
"id": "E1002"
}, {
"fullName": "包装费",
"id": "E1003"
}, {
"fullName": "运费",
"id": "E1004"
}, {
"fullName": "装卸费",
"id": "E1005"
}, {
"fullName": "服务费",
"id": "E1011"
}, {
"fullName": "管理服务费",
"id": "E1012"
}, {
"fullName": "管理服务费退回",
"id": "E1013"
}, {
"fullName": "海关税费",
"id": "E1014"
}, {
"fullName": "技术服务费",
"id": "E1015"
}, {
"fullName": "技术服务费退回",
"id": "E1016"
}, {
"fullName": "交易手续费",
"id": "E1017"
}, {
"fullName": "交易手续费-常规交易",
"id": "E1018"
}, {
"fullName": "交易手续费退回",
"id": "E1019"
}, {
"fullName": "金融服务费-预付回款",
"id": "E1020"
}, {
"fullName": "金融服务费退回-垫资回款",
"id": "E1021"
}, {
"fullName": "金融服务费-垫资回款",
"id": "E1022"
}, {
"fullName": "运费",
"id": "E1023"
}, {
"fullName": "运费退回",
"id": "E1024"
}, {
"fullName": "平台服务费-账户管理费",
"id": "E1025"
}, {
"fullName": "平台服务费-平台分销",
"id": "E1026"
}, {
"fullName": "手续费",
"id": "E1029"
}, {
"fullName": "手续费补贴",
"id": "E1030"
}, {
"fullName": "保障服务费退回-退货运费",
"id": "E1031"
}, {
"fullName": "保障服务费-退货运费",
"id": "E1032"
}, {
"fullName": "保障服务费-担保费",
"id": "E1033"
}],
"fullName": "销售服务",
"id": "E1000"
}, {
"children": [{
"fullName": "采购保证金",
"id": "E2000"
}, {
"fullName": "质量保证金",
"id": "E2001"
}, {
"fullName": "销售保证金",
"id": "E2002"
}, {
"fullName": "合作保证金",
"id": "E2003"
}],
"fullName": "保证金",
"id": "E200"
}, {
"children": [{
"fullName": "广告费",
"id": "E3001"
}, {
"fullName": "促销费用",
"id": "E3002"
}, {
"fullName": "节庆费",
"id": "E3003"
}, {
"fullName": "订单返现费用",
"id": "E3009"
}],
"fullName": "营销活动",
"id": "E3000"
}, {
"children": [{
"fullName": "赔付",
"id": "E4001"
}, {
"fullName": "水费",
"id": "E4002"
}, {
"fullName": "电费",
"id": "E4003"
}, {
"fullName": "气费",
"id": "E4004"
}, {
"fullName": "物业管理费",
"id": "E4005"
}, {
"fullName": "物料消耗",
"id": "E4006"
}, {
"fullName": "信息使用费",
"id": "E4007"
}, {
"fullName": "展览费",
"id": "E4008"
}, {
"fullName": "租赁费",
"id": "E4009"
}, {
"fullName": "修理费",
"id": "E4010"
}],
"fullName": "销售场地",
"id": "E4000"
}, {
"children": [{
"fullName": "折旧费",
"id": "E5001"
}, {
"fullName": "人员工资",
"id": "E5002"
}, {
"fullName": "职工福利费",
"id": "E5003"
}, {
"fullName": "差旅费",
"id": "E5004"
}],
"fullName": "销售人员",
"id": "E5000"
}, {
"children": [{
"fullName": "办公费",
"id": "E6001"
}, {
"fullName": "委托代销手续费",
"id": "E6002"
}, {
"fullName": "销售提成",
"id": "E6003"
}, {
"fullName": "采购奖励",
"id": "E6004"
}, {
"fullName": "佣金退回撤销-分销",
"id": "E6006"
}, {
"fullName": "佣金退回-销售员",
"id": "E6007"
}, {
"fullName": "佣金退回-分销",
"id": "E6008"
}, {
"fullName": "佣金-销售员",
"id": "E6009"
}, {
"fullName": "佣金-分销",
"id": "E6011"
}, {
"fullName": "奖励",
"id": "E6012"
}],
"fullName": "委托销售",
"id": "E6000"
}],
costProjectProps: {
"label": "fullName",
"value": "id",
"multiple": false,
"children": "children"
},
typeOptions: [{
"fullName": "收款",
"id": "1"
}, {
"fullName": "付款",
"id": "2"
}],
typeProps: {
"label": "fullName",
"value": "id",
"multiple": false,
"children": ""
},
wayTypeOptions: [{
"fullName": "单独收款",
"id": "1"
}, {
"fullName": "账扣",
"id": "2"
}, {
"fullName": "单据付款",
"id": "3"
}, {
"fullName": "账扣",
"id": "4"
}],
wayTypeProps: {
"label": "fullName",
"value": "id",
"multiple": false,
"children": ""
},
wayStatusOptions: [{
"fullName": "未收款",
"id": "1"
}, {
"fullName": "已收款",
"id": "2"
}, {
"fullName": "未付款",
"id": "3"
}, {
"fullName": "已付款",
"id": "4"
}],
wayStatusProps: {
"label": "fullName",
"value": "id",
"multiple": false,
"children": ""
},
labelwidth: 100 * 1.5,
menuId: '',
jurisdictionType: '',
ruleList: {},
interfaceRes: {
code: [],
institutionId: [],
subjectId: [],
costTime: [],
businessCode: [],
costType: [],
remark: [],
costProject: [],
type: [],
wayType: [],
wayStatus: [],
costPrice: [],
payment: [],
pictures: [],
annexFile: [],
},
regList: {},
ableAll: {
institutionIdableIds: [],
},
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) {},
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;
},
initData() {
this.$nextTick(function() {
if (this.dataForm.id) {
this.loading = true
request({
url: '/api/scm/CwCost/' + 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() {
if (this.userInfo.organizeIdList instanceof Array && this.userInfo.organizeIdList.length > 0) {
this.dataForm.institutionId = this.userInfo.organizeIdList
}
this.dataForm.costTime = 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)
},
dataList() {
var _data = this.dataForm;
return _data;
},
dataInfo(dataAll) {
let _dataAll = dataAll
this.dataForm = _dataAll
this.isEdit = true
this.dataAll()
this.childIndex = -1
this.collapse()
},
collapse() {
setTimeout(() => {}, 1000);
},
},
}
</script>
<style>
page {
background-color: #f0f2f6;
}
</style>

@ -0,0 +1,808 @@
<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('reportlossCode')" :required="requiredList.reportlossCode" label="报损单编号"
prop="reportlossCode">
<u-input v-model="dataForm.reportlossCode" disabled @change="changeData('reportlossCode',-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('reportlossType')" :required="requiredList.reportlossType" label="单据类型"
prop="reportlossType">
<jnpf-select v-model="dataForm.reportlossType" :disabled="judgeWrite('reportlossType')"
@change="changeData('reportlossType',-1)" clearable placeholder="请选择"
:props="reportlossTypeProps" :options="reportlossTypeOptions" :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('reportlossTime')" :required="requiredList.reportlossTime" label="报损时间"
prop="reportlossTime">
<jnpf-date-time v-model="dataForm.reportlossTime" :disabled="judgeWrite('reportlossTime')"
@change="changeData('reportlossTime',-1)" :startTime="dateTime(false,1,1,'','')"
:endTime="dateTime(false,1,1,'','')" format="yyyy-MM-dd" 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('reportlossReason')" :required="requiredList.reportlossReason" label="报损原因"
prop="reportlossReason">
<jnpf-select v-model="dataForm.reportlossReason" :disabled="judgeWrite('reportlossReason')"
@change="changeData('reportlossReason',-1)" clearable placeholder="请选择"
:props="reportlossReasonProps" :options="reportlossReasonOptions" :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('warehouseId')" :required="requiredList.warehouseId" label="仓库名称"
prop="warehouseId">
<jnpf-popup-select v-model="dataForm.warehouseId" :disabled="judgeWrite('warehouseId')"
@change="changeData('warehouseId',-1)" :rowIndex="null" :formData="dataForm"
:templateJson="interfaceRes.warehouseId" hasPage clearable propsValue="id" popupWidth="800px"
popupTitle="选择数据" popupType="dialog" relationField='name' vModel='warehouseId'
:columnOptions="warehouseIdColumnOptions" interfaceId="529617754022498181" :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('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('warehousingreportlossproductList')">
<view class="jnpf-table-item" v-for="(item,i) in dataForm.warehousingReportlossProductList" :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('warehousingreportlossproductList') && dataForm.warehousingReportlossProductList.length>0"
@click="delwarehousingreportlossproductList(i)">删除</view>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('warehousingreportlossproductList-productId')"
:required="requiredList['warehousingreportlossproductList-productId']" label="商品名称">
<jnpf-popup-select v-model="dataForm.warehousingReportlossProductList[i].productId"
:disabled="judgeWrite('warehousingreportlossproductList')||judgeWrite('warehousingreportlossproductList-productId')"
@change="changeData('warehousingreportlossproduct-productId',i)" :rowIndex="i"
:formData="dataForm" :templateJson="interfaceRes.warehousingreportlossproductproductId"
clearable propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog"
relationField='name' :vModel="'productId'+i"
:columnOptions="warehousingreportlossproductproductIdColumnOptions"
interfaceId="529994958833209925" :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('warehousingreportlossproductList-reportlossUnit')"
:required="requiredList['warehousingreportlossproductList-reportlossUnit']" label="报损单位">
<u-input v-model="dataForm.warehousingReportlossProductList[i].reportlossUnit"
:disabled="judgeWrite('warehousingreportlossproductList')||judgeWrite('warehousingreportlossproductList-reportlossUnit')"
@change="changeData('warehousingreportlossproduct-reportlossUnit',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('warehousingreportlossproductList-spec')"
:required="requiredList['warehousingreportlossproductList-spec']" label="规格">
<u-input v-model="dataForm.warehousingReportlossProductList[i].spec"
:disabled="judgeWrite('warehousingreportlossproductList')||judgeWrite('warehousingreportlossproductList-spec')"
@change="changeData('warehousingreportlossproduct-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('warehousingreportlossproductList-inventoryUnitId')"
:required="requiredList['warehousingreportlossproductList-inventoryUnitId']" label="库存单位">
<u-input v-model="dataForm.warehousingReportlossProductList[i].inventoryUnitId"
:disabled="judgeWrite('warehousingreportlossproductList')||judgeWrite('warehousingreportlossproductList-inventoryUnitId')"
@change="changeData('warehousingreportlossproduct-inventoryUnitId',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('warehousingreportlossproductList-availableStock')"
:required="requiredList['warehousingreportlossproductList-availableStock']" label="可用库存">
<u-input v-model="dataForm.warehousingReportlossProductList[i].availableStock"
:disabled="judgeWrite('warehousingreportlossproductList')||judgeWrite('warehousingreportlossproductList-availableStock')"
@change="changeData('warehousingreportlossproduct-availableStock',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('warehousingreportlossproductList-reportlossNumber')"
:required="requiredList['warehousingreportlossproductList-reportlossNumber']" label="报损数量">
<u-input v-model="dataForm.warehousingReportlossProductList[i].reportlossNumber"
:disabled="judgeWrite('warehousingreportlossproductList')||judgeWrite('warehousingreportlossproductList-reportlossNumber')"
@change="changeData('warehousingreportlossproduct-reportlossNumber',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('warehousingreportlossproductList-cargoId')"
:required="requiredList['warehousingreportlossproductList-cargoId']" label="货区名称">
<jnpf-popup-select v-model="dataForm.warehousingReportlossProductList[i].cargoId"
:disabled="judgeWrite('warehousingreportlossproductList')||judgeWrite('warehousingreportlossproductList-cargoId')"
@change="changeData('warehousingreportlossproduct-cargoId',i)" :rowIndex="i"
:formData="dataForm" :templateJson="interfaceRes.warehousingreportlossproductcargoId"
hasPage clearable propsValue="id" popupWidth="800px" popupTitle="选择数据"
popupType="dialog" relationField='cargo_name' :vModel="'cargoId'+i"
:columnOptions="warehousingreportlossproductcargoIdColumnOptions"
interfaceId="530700536261903749" :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('warehousingreportlossproductList-batchNumber')"
:required="requiredList['warehousingreportlossproductList-batchNumber']" label="批次号">
<jnpf-popup-select v-model="dataForm.warehousingReportlossProductList[i].batchNumber"
:disabled="judgeWrite('warehousingreportlossproductList')||judgeWrite('warehousingreportlossproductList-batchNumber')"
@change="changeData('warehousingreportlossproduct-batchNumber',i)" :rowIndex="i"
:formData="dataForm"
:templateJson="interfaceRes.warehousingreportlossproductbatchNumber" hasPage clearable
propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog"
relationField='batchNumber' :vModel="'batchNumber'+i"
:columnOptions="warehousingreportlossproductbatchNumberColumnOptions"
interfaceId="551302018883414213" :pageSize="20" placeholder="请选择" type="popup"
:style='{"width":"100%"}'>
</jnpf-popup-select>
</u-form-item>
</view>
</view>
<view class="jnpf-table-addBtn" @click="addwarehousingreportlossproductList"
v-if="!judgeWrite('warehousingreportlossproductList')">
<u-icon name="plus" color="#2979ff"></u-icon>
<span>{{dataForm.warehousingReportlossProductList.length==0?"添加":"添加"}}</span>
</view>
</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: "",
reportlossCode: '',
reportlossType: "",
reportlossTime: "",
reportlossReason: "",
warehouseId: "",
remark: '',
warehousingReportlossProductList: [],
},
rules: {
reportlossType: [{
required: true,
message: '单据类型请选择',
}, ],
reportlossTime: [{
required: true,
message: '报损时间请选择',
}, ],
reportlossReason: [{
required: true,
message: '报损原因请选择',
}, ],
warehouseId: [{
required: true,
message: '仓库名称请选择',
}, ],
},
reportlossTypeOptions: [{
"fullName": "采购报损",
"id": "1"
}, {
"fullName": "销售报损",
"id": "2"
}, {
"fullName": "仓库报损",
"id": "3"
}, {
"fullName": "加工报损",
"id": "4"
}, {
"fullName": "其他报损",
"id": "5"
}],
reportlossTypeProps: {
"label": "fullName",
"value": "id",
"multiple": false,
"children": ""
},
reportlossReasonOptions: [{
"fullName": "质量问题",
"id": "1"
}, {
"fullName": "客户退回",
"id": "2"
}, {
"fullName": "试用",
"id": "3"
}, {
"fullName": "临期报废",
"id": "4"
}, {
"fullName": "其他",
"id": "5"
}],
reportlossReasonProps: {
"label": "fullName",
"value": "id",
"multiple": false,
"children": ""
},
warehouseIdColumnOptions: [{
"label": "仓库名称",
"value": "name"
},
{
"label": "仓库编码",
"value": "code"
},
],
warehousingreportlossproductproductIdColumnOptions: [{
"label": "商品名称",
"value": "name"
},
{
"label": "商品编码",
"value": "code"
},
{
"label": "批次号",
"value": "batch_number"
},
],
warehousingreportlossproductcargoIdColumnOptions: [{
"label": "货区名称",
"value": "cargo_name"
}, ],
warehousingreportlossproductbatchNumberColumnOptions: [{
"label": "批次号",
"value": "batchNumber"
},
{
"label": "商品名称",
"value": "name"
},
],
labelwidth: 100 * 1.5,
menuId: '',
jurisdictionType: '',
ruleList: {
warehousingReportlossProductList: {
'cargoId': '货区名称不能为空',
'batchNumber': '批次号不能为空',
},
},
interfaceRes: {
reportlossCode: [],
reportlossType: [],
reportlossTime: [],
reportlossReason: [],
warehouseId: [],
remark: [],
warehousingreportlossproductproductId: [],
warehousingreportlossproductreportlossUnit: [],
warehousingreportlossproductspec: [],
warehousingreportlossproductinventoryUnitId: [],
warehousingreportlossproductavailableStock: [],
warehousingreportlossproductreportlossNumber: [],
warehousingreportlossproductcargoId: [{
fieldName: "",
field: "businessOrganizeId",
defaultValue: "",
jnpfKey: "popupSelect",
dataType: "varchar",
id: "AyAmdw1",
required: "0",
relationField: "warehouseId",
}, ],
warehousingreportlossproductbatchNumber: [{
fieldName: "",
field: "warehouseId",
defaultValue: "warehouseId",
jnpfKey: "popupSelect",
dataType: "varchar",
id: "TGHGo32",
required: "0",
relationField: "warehouseId",
},
{
fieldName: "",
field: "productId",
defaultValue: "productId",
jnpfKey: "popupSelect",
dataType: "varchar",
id: "SsNGo32",
required: "0",
relationField: "warehousingreportlossproductList-productId",
},
{
fieldName: "",
field: "cargoId",
defaultValue: "",
jnpfKey: "popupSelect",
dataType: "varchar",
id: "aIZs442",
required: "0",
relationField: "warehousingreportlossproductList-cargoId",
},
],
},
regList: {
warehousingReportlossProductList: {
productId: [],
reportlossUnit: [],
spec: [],
inventoryUnitId: [],
availableStock: [],
reportlossNumber: [],
cargoId: [],
batchNumber: [],
},
},
ableAll: {},
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.warehousingreportlossproduct()
},
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;
},
warehousingreportlossproduct() {
let table = this.dataForm.warehousingReportlossProductList
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/WarehousingReportloss/' + 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.reportlossTime = 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)
},
addwarehousingreportlossproductList() {
let value = {}
this.tableKey = 'warehousingreportlossproductList';
this.getwarehousingreportlossproductList(value)
this.childIndex = -1
this.collapse()
},
delwarehousingreportlossproductList(index) {
var that = this
uni.showModal({
title: '提示',
content: '确认删除该条信息吗?',
success: function(res) {
if (res.confirm) {
that.dataForm.warehousingReportlossProductList.splice(index, 1);
that.collapse()
}
}
})
},
getwarehousingreportlossproductList(value) {
let item = {
productId: "",
reportlossUnit: '',
spec: '',
inventoryUnitId: '',
availableStock: '',
reportlossNumber: '',
cargoId: "",
batchNumber: "",
}
let result = {
...item,
...value
}
this.dataForm.warehousingReportlossProductList.push(result)
this.childIndex = this.dataForm.warehousingReportlossProductList.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.warehousingReportlossProductList.length; i++) {
this.childIndex = i
}
this.childIndex = -1
this.collapse()
},
collapse() {
setTimeout(() => {}, 1000);
},
},
}
</script>
<style>
page {
background-color: #f0f2f6;
}
</style>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -76,6 +76,16 @@
@eventReceiver="eventReceiver" @eventReceiver="eventReceiver"
v-if="config.formEnCode === 'produceLine'" v-if="config.formEnCode === 'produceLine'"
/> />
<warehousingReportloss
ref="form"
@eventReceiver="eventReceiver"
v-if="config.formEnCode === 'warehousingReportloss'"
/>
<cwCost
ref="form"
@eventReceiver="eventReceiver"
v-if="config.formEnCode === 'costCode'"
/>
</template> </template>
<template v-if="config.formType == 2"> <template v-if="config.formType == 2">
<dynamicForm <dynamicForm
@ -104,6 +114,8 @@ import bom from "@/pages/scm/form/bom/index.vue";
import warehousingInspection from "@/pages/scm/form/warehousingInspection/index.vue"; import warehousingInspection from "@/pages/scm/form/warehousingInspection/index.vue";
import workshopLine from "@/pages/scm/form/businessLine1/workshopLineIndex.vue"; import workshopLine from "@/pages/scm/form/businessLine1/workshopLineIndex.vue";
import produceLine from "@/pages/scm/form/businessLine1/produceLineIndex.vue"; import produceLine from "@/pages/scm/form/businessLine1/produceLineIndex.vue";
import warehousingReportloss from "@/pages/scm/form/warehousingReportloss/index.vue";
import cwCost from "@/pages/scm/form/cwCost/index.vue";
export default { export default {
components: { components: {
@ -121,7 +133,9 @@ export default {
bom, bom,
warehousingInspection, warehousingInspection,
workshopLine, workshopLine,
produceLine produceLine,
warehousingReportloss,
cwCost
}, },
props: { props: {
config: { config: {

Loading…
Cancel
Save