质检单和bom

jg-waiwang-pro
XI_TENG\xixi_ 5 months ago
parent 1994989c5a
commit 4aaddcb100

@ -460,6 +460,18 @@
"style": {
"navigationBarTitleText": ""
}
},
{
"path": "bom/index",
"style": {
"navigationBarTitleText": ""
}
},
{
"path": "warehousingInspection/index",
"style": {
"navigationBarTitleText": ""
}
}
]
},

@ -0,0 +1,787 @@
<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 form-item-box">
<u-form-item v-if="judgeShow('bomCode')" :required="requiredList.bomCode" label="BOM编号" prop="bomCode">
<u-input v-model="dataForm.bomCode" disabled @change="changeData('bomCode',-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('bomName')" :required="requiredList.bomName" label="BOM名称" prop="bomName">
<u-input v-model="dataForm.bomName" :disabled="judgeWrite('bomName')"
@change="changeData('bomName',-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('bomNm')" :required="requiredList.bomNm" label="BOM简称" prop="bomNm">
<u-input v-model="dataForm.bomNm" :disabled="judgeWrite('bomNm')" @change="changeData('bomNm',-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('bomitemList')">
<view class="jnpf-table-item" v-for="(item,i) in dataForm.bomItemList" :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('bomitemList') && dataForm.bomItemList.length>0"
@click="delbomitemList(i)">删除</view>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('bomitemList-productId')"
:required="requiredList['bomitemList-productId']" label="商品名称">
<jnpf-popup-select v-model="dataForm.bomItemList[i].productId"
:disabled="judgeWrite('bomitemList')||judgeWrite('bomitemList-productId')"
@change="changeData('bomitem-productId',i)" :rowIndex="i" :formData="dataForm"
:templateJson="interfaceRes.bomitemproductId" hasPage clearable propsValue="id"
popupWidth="800px" popupTitle="选择数据商品" popupType="dialog" relationField='name'
:vModel="'productId'+i" :columnOptions="bomitemproductIdColumnOptions"
interfaceId="519505017699307077" :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('bomitemList-spec')" :required="requiredList['bomitemList-spec']"
label="商品规格">
<u-input v-model="dataForm.bomItemList[i].spec"
:disabled="judgeWrite('bomitemList')||judgeWrite('bomitemList-spec')"
@change="changeData('bomitem-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('bomitemList-inventoryTypes')"
:required="requiredList['bomitemList-inventoryTypes']" label="类型">
<u-input v-model="dataForm.bomItemList[i].inventoryTypes"
:disabled="judgeWrite('bomitemList')||judgeWrite('bomitemList-inventoryTypes')"
@change="changeData('bomitem-inventoryTypes',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('bomitemList-inventoryUnitIds')"
:required="requiredList['bomitemList-inventoryUnitIds']" label="库存单位">
<u-input v-model="dataForm.bomItemList[i].inventoryUnitIds"
:disabled="judgeWrite('bomitemList')||judgeWrite('bomitemList-inventoryUnitIds')"
@change="changeData('bomitem-inventoryUnitIds',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('bomitemList-salesMainUnitIds')"
:required="requiredList['bomitemList-salesMainUnitIds']" label="销售单位">
<u-input v-model="dataForm.bomItemList[i].salesMainUnitIds"
:disabled="judgeWrite('bomitemList')||judgeWrite('bomitemList-salesMainUnitIds')"
@change="changeData('bomitem-salesMainUnitIds',i)" input-align='right' clearable
placeholder="请输入" :style='{"width":"100%"}'>
</u-input>
</u-form-item>
</view>
</view>
<view class="jnpf-table-addBtn" @click="addbomitemList" v-if="!judgeWrite('bomitemList')">
<u-icon name="plus" color="#2979ff"></u-icon>
<span>{{dataForm.bomItemList.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('bomitemvalueList')">
<view class="jnpf-table-item" v-for="(item,i) in dataForm.bomItemValueList" :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('bomitemvalueList') && dataForm.bomItemValueList.length>0"
@click="delbomitemvalueList(i)">删除</view>
</view>
<view class="u-p-l-20 u-p-r-20 form-item-box">
<u-form-item v-if="judgeShow('bomitemvalueList-productId')"
:required="requiredList['bomitemvalueList-productId']" label="商品名称">
<jnpf-popup-select v-model="dataForm.bomItemValueList[i].productId"
:disabled="judgeWrite('bomitemvalueList')||judgeWrite('bomitemvalueList-productId')"
@change="changeData('bomitemvalue-productId',i)" :rowIndex="i" :formData="dataForm"
:templateJson="interfaceRes.bomitemvalueproductId" hasPage clearable propsValue="id"
popupWidth="800px" popupTitle="选择数据商品" popupType="dialog" relationField='name'
:vModel="'productId'+i" :columnOptions="bomitemvalueproductIdColumnOptions"
interfaceId="519505017699307077" :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('bomitemvalueList-inventoryTypes')"
:required="requiredList['bomitemvalueList-inventoryTypes']" label="存货类型">
<u-input v-model="dataForm.bomItemValueList[i].inventoryTypes"
:disabled="judgeWrite('bomitemvalueList')||judgeWrite('bomitemvalueList-inventoryTypes')"
@change="changeData('bomitemvalue-inventoryTypes',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('bomitemvalueList-spec')"
:required="requiredList['bomitemvalueList-spec']" label="规格">
<u-input v-model="dataForm.bomItemValueList[i].spec"
:disabled="judgeWrite('bomitemvalueList')||judgeWrite('bomitemvalueList-spec')"
@change="changeData('bomitemvalue-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('bomitemvalueList-inventoryUnitIds')"
:required="requiredList['bomitemvalueList-inventoryUnitIds']" label="库存单位">
<u-input v-model="dataForm.bomItemValueList[i].inventoryUnitIds"
:disabled="judgeWrite('bomitemvalueList')||judgeWrite('bomitemvalueList-inventoryUnitIds')"
@change="changeData('bomitemvalue-inventoryUnitIds',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('bomitemvalueList-barCode')"
:required="requiredList['bomitemvalueList-barCode']" label="条码">
<u-input v-model="dataForm.bomItemValueList[i].barCode"
:disabled="judgeWrite('bomitemvalueList')||judgeWrite('bomitemvalueList-barCode')"
@change="changeData('bomitemvalue-barCode',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('bomitemvalueList-proportionNum')"
:required="requiredList['bomitemvalueList-proportionNum']" label="比例数量">
<u-input v-model="dataForm.bomItemValueList[i].proportionNum"
:disabled="judgeWrite('bomitemvalueList')||judgeWrite('bomitemvalueList-proportionNum')"
@change="changeData('bomitemvalue-proportionNum',i)" input-align='right' clearable
placeholder="请输入" :style='{"width":"100%"}'>
</u-input>
</u-form-item>
</view>
</view>
<view class="jnpf-table-addBtn" @click="addbomitemvalueList" v-if="!judgeWrite('bomitemvalueList')">
<u-icon name="plus" color="#2979ff"></u-icon>
<span>{{dataForm.bomItemValueList.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: "",
bomCode: '',
bomName: '',
bomNm: '',
bomStatus: "1",
bomItemList: [],
bomItemValueList: [],
},
rules: {
bomName: [{
required: true,
message: 'BOM名称请输入',
}, ],
bomNm: [{
required: true,
message: 'BOM简称请输入',
}, ],
},
bomStatusOptions: [{
"fullName": "启用",
"id": "1"
}, {
"fullName": "禁用",
"id": "2"
}],
bomStatusProps: {
"label": "fullName",
"value": "id",
"multiple": false,
"children": ""
},
bomitemproductIdColumnOptions: [{
"label": "商品编码",
"value": "code"
},
{
"label": "商品名称",
"value": "name"
},
{
"label": "规格",
"value": "spec"
},
],
bomitemvalueproductIdColumnOptions: [{
"label": "商品编码",
"value": "code"
},
{
"label": "商品名称",
"value": "name"
},
{
"label": "规格",
"value": "spec"
},
],
labelwidth: 100 * 1.5,
menuId: '',
jurisdictionType: '',
ruleList: {
bomItemList: {},
bomItemValueList: {
'proportionNum': '比例数量不能为空',
},
},
interfaceRes: {
bomCode: [],
bomName: [],
bomNm: [],
bomStatus: [],
bomitemproductId: [],
bomitemspec: [],
bomiteminventoryTypes: [],
bomiteminventoryUnitIds: [],
bomitemsalesMainUnitIds: [],
bomitemvalueproductId: [],
bomitemvalueinventoryTypes: [],
bomitemvaluespec: [],
bomitemvalueinventoryUnitIds: [],
bomitemvaluebarCode: [],
bomitemvalueproportionNum: [],
},
regList: {
bomItemList: {
productId: [],
spec: [],
inventoryTypes: [],
inventoryUnitIds: [],
salesMainUnitIds: [],
},
bomItemValueList: {
productId: [],
inventoryTypes: [],
spec: [],
inventoryUnitIds: [],
barCode: [],
proportionNum: [],
},
},
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.bomitem()
this.bomitemvalue()
},
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;
},
bomitem() {
let table = this.dataForm.bomItemList
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;
},
bomitemvalue() {
let table = this.dataForm.bomItemValueList
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/Bom/' + 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() {},
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)
},
addbomitemList() {
let value = {}
this.tableKey = 'bomItemList';
this.getbomitemList(value)
this.childIndex = -1
this.collapse()
},
delbomitemList(index) {
var that = this
uni.showModal({
title: '提示',
content: '确认删除该条信息吗?',
success: function(res) {
if (res.confirm) {
that.dataForm.bomItemList.splice(index, 1);
that.collapse()
}
}
})
},
getbomitemList(value) {
let item = {
productId: "",
spec: '',
inventoryTypes: '',
inventoryUnitIds: '',
salesMainUnitIds: '',
}
let result = {
...item,
...value
}
this.dataForm.bomItemList.push(result)
this.childIndex = this.dataForm.bomItemList.length - 1
this.isEdit = true
this.isEdit = false
},
addbomitemvalueList() {
let value = {}
this.tableKey = 'bomItemValueList';
this.getbomitemvalueList(value)
this.childIndex = -1
this.collapse()
},
delbomitemvalueList(index) {
var that = this
uni.showModal({
title: '提示',
content: '确认删除该条信息吗?',
success: function(res) {
if (res.confirm) {
that.dataForm.bomItemValueList.splice(index, 1);
that.collapse()
}
}
})
},
getbomitemvalueList(value) {
let item = {
productId: "",
inventoryTypes: '',
spec: '',
inventoryUnitIds: '',
barCode: '',
proportionNum: '',
}
let result = {
...item,
...value
}
this.dataForm.bomItemValueList.push(result)
this.childIndex = this.dataForm.bomItemValueList.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.bomItemList.length; i++) {
this.childIndex = i
}
for (let i = 0; i < _dataAll.bomItemValueList.length; i++) {
this.childIndex = i
}
this.childIndex = -1
this.collapse()
},
collapse() {
setTimeout(() => {}, 1000);
},
},
}
</script>
<style>
page {
background-color: #f0f2f6;
}
</style>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,539 @@
<template>
<view class="dynamicModel-list-v">
<view class="head-warp com-dropdown">
<u-dropdown class="u-dropdown" ref="uDropdown" @open="openData" >
<u-dropdown-item title="排序">
<view class="dropdown-slot-content">
<view class="dropdown-slot-content-main">
<u-cell-group>
<u-cell-item @click="cellClick(item)" :arrow="false" :title="item.label"
v-for="(item, index) in sortOptions" :key="index" :title-style="{color: sortValue == item.value ? '#2979ff' : '#606266' }">
<u-icon v-if="sortValue == item.value" name="checkbox-mark" color="#2979ff" size="32"></u-icon>
</u-cell-item>
</u-cell-group>
</view>
</view>
</u-dropdown-item>
<u-dropdown-item title="筛选" >
<view class="dropdown-slot-content">
<view class="dropdown-slot-content-main search-main">
<scroll-view scroll-y="true" style="height: 1000rpx;">
<view class="u-p-l-20 u-p-r-20 search-form">
<u-form :model="searchForm" ref="searchForm" :errorType="['toast']" label-position="left" label-width="150">
</u-form>
</view>
</scroll-view>
<view class="buttom-actions">
<u-button class="buttom-btn" @click="reset"></u-button>
<u-button class="buttom-btn" type="primary" @click="closeDropdown"></u-button>
</view>
<view class="dropdown-slot-bg" @click="$refs.uDropdown.close()"></view>
</view>
</view>
</u-dropdown-item>
</u-dropdown>
</view>
<view class="list-warp">
<mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption" top="100">
<view class="list">
<view class="list-box">
<uni-swipe-action ref="swipeAction">
<uni-swipe-action-item v-for="(item, index) in list" :key="item.id" :threshold="0" :right-options="options">
<view class="item" @click="goDetail(item.id,item)">
<view class="u-line-1 item-cell" v-for="(column,i) in columnList" :key="i">
<view v-if="column.jnpfKey != 'table'">
<view class="" v-if="column.jnpfKey == 'relationForm'">
<text class="listTit u-line-1">{{column.label}}:</text>
<text class="listContent"
@click.stop="relationFormClick(item,column)"
style="color: blue;">{{item[column.prop]}}</text>
</view>
<view v-else class="u-line-1">
<text class="listTit u-line-1">{{column.label}}:</text>
<text class="listContent" v-if="['calculate','inputNumber'].includes(column.jnpfKey) && column.thousands">{{toThousands(item[column.prop],column)}}</text>
<text class="listContent" v-else>{{item[column.prop]}}</text>
</view>
</view>
<view class="collapse-box u-flex" v-else>
<tableCell :label="column.label" :childList="item[column.prop]" @cRelationForm="relationFormClick"
:children="column.children" ref="tableCell" :pageLen="3"></tableCell>
</view>
</view>
<view class="item-cell">
<text>审批状态</text>
<text :class="getFlowStatus(item.flowState).statusCss">
{{getFlowStatus(item.flowState).text}}
</text>
</view>
</view>
<template v-slot:right>
<view class="right-option-box">
<view class="right-option" v-for="(it,i) in options" @click="handleClick(index)"
:key="i">
<text>{{it.text}}</text>
</view>
</view>
</template>
</uni-swipe-action-item>
</uni-swipe-action>
</view>
</view>
</mescroll-uni>
</view>
<view class="com-addBtn" @click="addPage()" >
<u-icon name="plus" size="60" color="#fff" />
</view>
<u-picker mode="selector" v-model="show" :default-selector="[0]" title="请选择流程" :range="templateList" range-key="fullName" @confirm="confirm"></u-picker>
</view>
</template>
<script>
import {
FlowJsonList
} from '@/api/workFlow/flowEngine'
import resources from '@/libs/resources.js'
import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
import tableCell from '../dynamicModel/components/tableCell.vue'
import {getFormById} from '@/api/workFlow/workFlowForm'
import {
getDictionaryDataSelector,
getDataInterfaceRes,
getDefaultCurrentValueUserIdAsync,
getDefaultCurrentValueDepartmentIdAsync
} from '@/api/common'
import request from '@/utils/request'
export default {
mixins: [MescrollMixin],
components: {
tableCell
},
data() {
return {
show: false,
templateList: [],
sortValue: '',
searchForm: {
},
downOption: {
use: true,
auto: false
},
dataOptions:{
},
upOption: {
page: {
num: 0,
size: 20,
time: null,
},
empty: {
use: true,
icon: resources.message.nodata,
tip: "暂无数据",
fixed: true,
top: "300rpx",
zIndex: 5,
},
textNoMore: '没有更多数据',
toTop: {
bottom: 250
}
},
list: [],
appColumnList:[{"jnpfKey":"billRule","fullName":"BOM编号","label":"BOM编号","sortable":false,"align":"left","__config__":{"formId":101,"visibility":["pc","app"],"jnpfKey":"billRule","noShow":false,"tipLabel":"","dragDisabled":false,"rule":"bomCode","className":[],"label":"BOM编号","trigger":"change","showLabel":true,"required":false,"tableName":"jg_bom","renderKey":1706593198696,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-documents","ruleName":"BOM编码","tag":"JnpfInput","span":8},"readonly":true,"prop":"bomCode","width":0,"__vModel__":"bomCode","style":{"width":"100%"},"fixed":"none","placeholder":"系统自动生成","id":"bomCode"},{"clearable":true,"jnpfKey":"input","suffixIcon":"","fullName":"BOM名称","label":"BOM名称","sortable":false,"align":"left","addonAfter":"","__config__":{"formId":102,"visibility":["pc","app"],"jnpfKey":"input","noShow":false,"tipLabel":"","dragDisabled":false,"className":[],"label":"BOM名称","trigger":"blur","showLabel":true,"required":true,"tableName":"jg_bom","renderKey":1706593335070,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-input","unique":false,"tag":"JnpfInput","regList":[],"span":8},"readonly":false,"prop":"bomName","showWordLimit":false,"width":0,"__vModel__":"bomName","showPassword":false,"style":{"width":"100%"},"disabled":false,"fixed":"none","placeholder":"请输入","id":"bomName","prefixIcon":"","addonBefore":"","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}","blur":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}},{"popupType":"dialog","hasPage":true,"pageSize":20,"columnOptions":[{"label":"商品编码","value":"code"},{"label":"商品名称","value":"name"},{"label":"规格","value":"spec"}],"align":"left","templateJson":[],"__config__":{"formId":110,"relationTable":"jg_bom_item","visibility":["pc","app"],"jnpfKey":"popupSelect","defaultValue":"","noShow":false,"parentVModel":"tableField106","tipLabel":"","dragDisabled":false,"className":[],"label":"商品名称","trigger":"change","showLabel":true,"required":false,"tableName":"jg_bom","renderKey":1706593694630,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-popup","isSubTable":true,"tag":"JnpfPopupSelect","regList":[],"span":24},"prop":"tableField106-productId","__vModel__":"productId","disabled":false,"placeholder":"请选择","interfaceName":"查询商品列表","id":"tableField106-productId","popupWidth":"800px","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"},"clearable":true,"jnpfKey":"popupSelect","fullName":"-商品名称","label":"-商品名称","sortable":false,"relationField":"name","popupTitle":"选择数据商品","width":0,"style":{"width":"100%"},"interfaceHasPage":false,"fixed":"none","interfaceId":"519505017699307077","propsValue":"id"},{"border":false,"jnpfKey":"radio","fullName":"BOM状态","label":"BOM状态","sortable":false,"align":"left","props":{"label":"fullName","value":"id"},"optionType":"button","__config__":{"formId":129,"visibility":["pc","app"],"jnpfKey":"radio","defaultValue":"1","noShow":true,"dataType":"static","dictionaryType":"","tipLabel":"","dragDisabled":false,"className":[],"label":"BOM状态","trigger":"change","propsUrl":"","templateJson":[],"showLabel":true,"required":false,"tableName":"jg_bom","renderKey":1706594664036,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-radio","propsName":"","tag":"JnpfRadio","regList":[],"span":8},"size":"small","prop":"bomStatus","width":0,"options":[{"fullName":"启用","id":"1"},{"fullName":"禁用","id":"2"}],"__vModel__":"bomStatus","style":{},"disabled":false,"interfaceHasPage":false,"fixed":"none","id":"bomStatus","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"},"direction":"horizontal"}],
listQuery: {
moduleId:'522003185808710981',
sort: 'desc',
sidx: '',
keyword: '',
json: ''
},
options: [
{
text: '删除',
style: {
backgroundColor: '#dd524d'
}
}
],
sortOptions:[
],
ableAll:{
},
interfaceRes:{
},
menuId:'',
enCode: 'bom',
formId: '522003185808710981',
columnList:[],
isTree:false,
type:'1',
key:new Date(),
dataValue:{},
userInfo:{},
firstInitSearchData:false,
thousandsField:[],
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"},
}
},
onLoad(e){
this.userInfo = uni.getStorageSync('userInfo') || {}
this.menuId = e.menuId
uni.$on('refresh', () => {
this.list = [];
this.mescroll.resetUpScroll();
})
this.dataAll()
this.getColumnList()
this.getFormById()
},
onUnload() {
uni.$off('refresh')
},
methods:{
toThousands(val, column) {
let num = Number(val)
let newVal = this.thousandsField.includes(column.__vModel__) ? num.toLocaleString('zh', {maximumFractionDigits: '2',minimumFractionDigits: '2'}): num.toFixed(2);
return newVal
},
getJsonList() {
FlowJsonList(this.flowId,'1').then(res => {
this.templateList = res.data;
})
},
getFormById() {
getFormById(this.formId).then(res => {
this.flowId = res.data&&res.data.id
this.enCode = res.data&&res.data.enCode
this.getJsonList()
})
},
dataAll(){
},
openData(e){
if(e==1){
//this.reset()
}
},
//
async initSearchData() {
this.dataValue = JSON.parse(JSON.stringify(this.searchForm))
},
relationFormClick(item,column) {
let vModel = column.__vModel__?column.__vModel__+"_id":column.__vModel__
let id = item[vModel]
if(vModel){
let [attr,attr1]=vModel.split("_jnpf_")
if(attr&&attr1){
attr = attr.replace('jnpf_','')
id = item[attr]&&item[attr][attr1]
}
}
let modelId = column.modelId
if (!id || !modelId) return
let config = {
modelId: modelId,
id: id,
formTitle: '详情',
noShowBtn: 1
}
this.$nextTick(() => {
const url ='/pages/apply/dynamicModel/detail?config=' + this.base64.encode(JSON.stringify(config),"UTF-8")
uni.navigateTo({
url: url
})
})
},
async upCallback(page) {
if(!this.firstInitSearchData) {
await this.initSearchData()
this.firstInitSearchData = true
}
const query = {
currentPage: page.num,
pageSize: page.size,
menuId : this.menuId,
...this.listQuery,
...this.searchForm,
dataType:0,
}
request({
url: '/api/scm/Bom/getList',
method: 'post',
data: query,
}).then(res => {
let _list = this.columnList.length?res.data.list:[];
this.mescroll.endSuccess(_list.length);
if (page.num == 1) this.list = [];
const list = _list.map(o => ({
show: false,
...o
}));
this.list = this.list.concat(_list);
}).catch(() => {
this.mescroll.endErr();
})
},
handleClick(index, index1) {
const item = this.list[index]
if([1,2,3,5].includes(item.flowState)){
this.$u.toast("流程正在审核,请勿删除")
this.list[index].show = false
return
}
request({
url: '/api/scm/Bom/' + item.id,
method: 'delete'
}).then(res => {
uni.showToast({
title: res.msg,
complete: () => {
this.$u.toast(res.msg)
this.mescroll.resetUpScroll()
}
})
})
},
open(index) {
this.list[index].show = true;
this.list.map((val, idx) => {
if (index != idx) this.list[idx].show = false;
})
},
search() {
if (this.isPreview == '1') return
this.searchTimer && clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(() => {
this.list = [];
this.mescroll.resetUpScroll();
}, 300)
},
goDetail(id, item) {
let flowtaskid = item.flowtaskid
let flowState =item.flowState
let flowId =item.flowId
let btnType = ''
let btnList = []
btnList.push('btn_edit')
btnList.push('btn_detail')
if(btnList.includes('btn_detail')){
btnType = "btn_detail"
}
if(btnList.includes('btn_edit')){
btnType = "btn_edit"
}
if(!btnType) return
let ids = flowtaskid?flowtaskid:id
this.flowId = flowId?flowId:this.templateList[0].id
this.jumPage(ids, flowState,btnType)
},
addPage() {
if (!this.templateList.length) return this.$u.toast('流程不存在')
if (this.templateList.length > 1) {
this.show = true
} else {
this.flowId = this.templateList[0].id
this.jumPage()
}
},
confirm(e) {
this.flowId = this.templateList[e[0]].id
this.jumPage()
},
jumPage(id, status,btnType){
if (!id && !status) btnType = 'btn_add'
let _title=""
if(btnType=='btn_add'){
_title = "新增"
}
if(btnType=='btn_detail'){
_title = "详情"
}
if(btnType=='btn_edit'){
_title = "编辑"
}
let opType = '-1'
if ([1,2,5].includes(status)) opType = 0
const config = {
id: id || '',
enCode: this.enCode,
flowId: this.flowId,
formType: 1,
type: 1,
opType,
status: status || '',
fullName: _title,
jurisdictionType: btnType || ''
}
uni.navigateTo({
url: '/pages/workFlow/flowBefore/index?config=' + this.base64.encode(JSON.stringify(config), "UTF-8")
})
},
getFlowStatus(val) {
let status
switch (val) {
case 0:
status = {
text: '等待提交',
statusCss: 'u-type-info'
}
break;
case 1:
status = {
text: '等待审核',
statusCss: 'u-type-primary'
}
break;
case 2:
status = {
text: '审核通过',
statusCss: 'u-type-success'
}
break;
case 3:
status = {
text: '审核驳回',
statusCss: 'u-type-error'
}
break;
case 4:
status = {
text: '审核撤回',
statusCss: 'u-type-error'
}
break;
case 5:
status = {
text: '审核终止',
statusCss: 'u-type-info'
}
break;
default:
status = {
text: '等待提交',
statusCss: 'u-type-info'
}
break;
}
return status
},
getColumnList() {
let columnPermissionList = []
let _appColumnList =this.appColumnList
for (let i = 0; i < _appColumnList.length; i++) {
columnPermissionList.push(_appColumnList[i])
}
this.columnList = this.transformColumnList(columnPermissionList, this.dataOptions)
},
transformColumnList(columnList, dataOptions) {
let list = []
for (let i = 0; i < columnList.length; i++) {
let e = columnList[i]
let columProp = e.prop
let label = e.label
let option = null
let options = columProp + "Options"
if (!columProp.includes('-')) {
columProp = columProp
if(this.type=='4'){
columProp = columProp +"_name"
}
if(label.length>4){
label = label.substring(0, 4)
}
e.label = label
e.prop = columProp
e.option = option
list.push(e)
} else {
e.vModel = columProp.split('-')[1]
e.childLabel = e.label.split('-')[1]
options = e.vModel + "Options"
let prop = columProp.split('-')[0]
let label = e.label.split('-')[0]
let newItem = {
align: "center",
jnpfKey: "table",
prop,
label,
children: []
}
if (!list.some(o => o.prop === prop)) list.push(newItem)
for (let i = 0; i < list.length; i++) {
if (list[i].prop === prop) {
e.prop = e.prop
e.vModel = e.vModel
if(this.type=='4'){
e.prop = e.prop+"_name"
e.vModel = e.vModel+"_name"
}
e.option = option
list[i].children.push(e)
break
}
}
}
}
return list
},
cellClick(item) {
if (this.sortValue === item.value) return
this.listQuery.sort = item.sort
this.listQuery.sidx = item.sidx
this.sortValue = item.value
this.$refs.uDropdown.close();
this.$nextTick(() => {
this.list = [];
this.mescroll.resetUpScroll();
})
},
reset() {
this.searchForm = JSON.parse(JSON.stringify(this.dataValue))
this.key = new Date()
},
closeDropdown() {
this.$refs.uDropdown.close();
this.$nextTick(() => {
this.list = [];
this.mescroll.resetUpScroll();
})
},
dataList(data){
let _list =data.list
return _list;
},
},
}
</script>
<style lang="scss">
page {
background-color: #f0f2f6;
height: 100%;
/* #ifdef MP-ALIPAY */
position: absolute;
top: 0;
left: 0;
width: 100%;
/* #endif */
}
.right-option-box {
display: flex;
width: max-content;
.right-option {
width: 144rpx;
height: 100%;
font-size: 16px;
color: #fff;
background-color: #dd524d;
display: flex;
align-items: center;
justify-content: center;
}
.more-option {
background-color: #1890ff;
}
}
</style>

@ -0,0 +1,539 @@
<template>
<view class="dynamicModel-list-v">
<view class="head-warp com-dropdown">
<u-dropdown class="u-dropdown" ref="uDropdown" @open="openData" >
<u-dropdown-item title="排序">
<view class="dropdown-slot-content">
<view class="dropdown-slot-content-main">
<u-cell-group>
<u-cell-item @click="cellClick(item)" :arrow="false" :title="item.label"
v-for="(item, index) in sortOptions" :key="index" :title-style="{color: sortValue == item.value ? '#2979ff' : '#606266' }">
<u-icon v-if="sortValue == item.value" name="checkbox-mark" color="#2979ff" size="32"></u-icon>
</u-cell-item>
</u-cell-group>
</view>
</view>
</u-dropdown-item>
<u-dropdown-item title="筛选" >
<view class="dropdown-slot-content">
<view class="dropdown-slot-content-main search-main">
<scroll-view scroll-y="true" style="height: 1000rpx;">
<view class="u-p-l-20 u-p-r-20 search-form">
<u-form :model="searchForm" ref="searchForm" :errorType="['toast']" label-position="left" label-width="150">
</u-form>
</view>
</scroll-view>
<view class="buttom-actions">
<u-button class="buttom-btn" @click="reset"></u-button>
<u-button class="buttom-btn" type="primary" @click="closeDropdown"></u-button>
</view>
<view class="dropdown-slot-bg" @click="$refs.uDropdown.close()"></view>
</view>
</view>
</u-dropdown-item>
</u-dropdown>
</view>
<view class="list-warp">
<mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption" top="100">
<view class="list">
<view class="list-box">
<uni-swipe-action ref="swipeAction">
<uni-swipe-action-item v-for="(item, index) in list" :key="item.id" :threshold="0" :right-options="options">
<view class="item" @click="goDetail(item.id,item)">
<view class="u-line-1 item-cell" v-for="(column,i) in columnList" :key="i">
<view v-if="column.jnpfKey != 'table'">
<view class="" v-if="column.jnpfKey == 'relationForm'">
<text class="listTit u-line-1">{{column.label}}:</text>
<text class="listContent"
@click.stop="relationFormClick(item,column)"
style="color: blue;">{{item[column.prop]}}</text>
</view>
<view v-else class="u-line-1">
<text class="listTit u-line-1">{{column.label}}:</text>
<text class="listContent" v-if="['calculate','inputNumber'].includes(column.jnpfKey) && column.thousands">{{toThousands(item[column.prop],column)}}</text>
<text class="listContent" v-else>{{item[column.prop]}}</text>
</view>
</view>
<view class="collapse-box u-flex" v-else>
<tableCell :label="column.label" :childList="item[column.prop]" @cRelationForm="relationFormClick"
:children="column.children" ref="tableCell" :pageLen="3"></tableCell>
</view>
</view>
<view class="item-cell">
<text>审批状态</text>
<text :class="getFlowStatus(item.flowState).statusCss">
{{getFlowStatus(item.flowState).text}}
</text>
</view>
</view>
<template v-slot:right>
<view class="right-option-box">
<view class="right-option" v-for="(it,i) in options" @click="handleClick(index)"
:key="i">
<text>{{it.text}}</text>
</view>
</view>
</template>
</uni-swipe-action-item>
</uni-swipe-action>
</view>
</view>
</mescroll-uni>
</view>
<view class="com-addBtn" @click="addPage()" >
<u-icon name="plus" size="60" color="#fff" />
</view>
<u-picker mode="selector" v-model="show" :default-selector="[0]" title="请选择流程" :range="templateList" range-key="fullName" @confirm="confirm"></u-picker>
</view>
</template>
<script>
import {
FlowJsonList
} from '@/api/workFlow/flowEngine'
import resources from '@/libs/resources.js'
import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
import tableCell from '../dynamicModel/components/tableCell.vue'
import {getFormById} from '@/api/workFlow/workFlowForm'
import {
getDictionaryDataSelector,
getDataInterfaceRes,
getDefaultCurrentValueUserIdAsync,
getDefaultCurrentValueDepartmentIdAsync
} from '@/api/common'
import request from '@/utils/request'
export default {
mixins: [MescrollMixin],
components: {
tableCell
},
data() {
return {
show: false,
templateList: [],
sortValue: '',
searchForm: {
},
downOption: {
use: true,
auto: false
},
dataOptions:{
},
upOption: {
page: {
num: 0,
size: 20,
time: null,
},
empty: {
use: true,
icon: resources.message.nodata,
tip: "暂无数据",
fixed: true,
top: "300rpx",
zIndex: 5,
},
textNoMore: '没有更多数据',
toTop: {
bottom: 250
}
},
list: [],
appColumnList:[{"jnpfKey":"billRule","fullName":"质检单编号","label":"质检单编号","sortable":false,"align":"left","__config__":{"formId":102,"visibility":["pc","app"],"jnpfKey":"billRule","noShow":false,"tipLabel":"","dragDisabled":false,"rule":"warehousingInspection","className":[],"label":"质检单编号","trigger":"change","showLabel":true,"required":false,"tableName":"jg_warehousing_inspection","renderKey":1708665599300,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-documents","ruleName":"质检单","tag":"JnpfInput","span":10},"readonly":true,"prop":"inspectionCode","width":0,"__vModel__":"inspectionCode","style":{"width":"100%"},"fixed":"none","placeholder":"系统自动生成","id":"inspectionCode"},{"jnpfKey":"createTime","fullName":"制单时间","label":"制单时间","sortable":false,"align":"left","type":"currTime","__config__":{"formId":103,"visibility":["pc","app"],"jnpfKey":"createTime","defaultValue":"","noShow":false,"tipLabel":"","dragDisabled":false,"className":[],"label":"制单时间","showLabel":true,"required":false,"tableName":"jg_warehousing_inspection","renderKey":1708665647691,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-createtime","tag":"JnpfOpenData","span":10},"readonly":true,"prop":"creatorTime","width":0,"__vModel__":"creatorTime","style":{"width":"100%"},"fixed":"none","placeholder":"","id":"creatorTime"},{"filterable":false,"clearable":true,"jnpfKey":"select","multiple":false,"fullName":"质检类型","label":"质检类型","sortable":false,"align":"left","props":{"label":"fullName","value":"id"},"__config__":{"formId":113,"visibility":["pc","app"],"jnpfKey":"select","defaultValue":"","noShow":false,"dataType":"static","dictionaryType":"","tipLabel":"","dragDisabled":false,"className":[],"label":"质检类型","trigger":"change","propsUrl":"","templateJson":[],"showLabel":true,"required":true,"tableName":"jg_warehousing_inspection","renderKey":1708665744875,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-select","propsName":"","tag":"JnpfSelect","regList":[],"span":8},"prop":"inspectionType","width":0,"options":[{"fullName":"入库质检","id":"1"},{"fullName":"出库质检","id":"2"}],"__vModel__":"inspectionType","style":{"width":"100%"},"disabled":false,"interfaceHasPage":false,"fixed":"none","placeholder":"请选择","id":"inspectionType","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}},{"clearable":true,"jnpfKey":"userSelect","ableIds":[],"multiple":false,"fullName":"质检人员","label":"质检人员","sortable":false,"align":"left","relationField":"","__config__":{"formId":114,"visibility":["pc","app"],"jnpfKey":"userSelect","noShow":false,"tipLabel":"","dragDisabled":false,"className":[],"label":"质检人员","trigger":"change","showLabel":true,"required":true,"relationField":"","tableName":"jg_warehousing_inspection","renderKey":1708665776213,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-user","defaultCurrent":false,"tag":"JnpfUserSelect","regList":[],"span":8},"prop":"belongUserId","width":0,"__vModel__":"belongUserId","style":{"width":"100%"},"selectType":"all","disabled":false,"fixed":"none","placeholder":"请选择","id":"belongUserId","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}},{"clearable":true,"jnpfKey":"datePicker","format":"yyyy-MM-dd HH:mm","fullName":"质检时间","label":"质检时间","sortable":false,"align":"left","type":"datetime","__config__":{"endRelationField":"","defaultValue":"","dragDisabled":false,"className":[],"showLabel":true,"required":true,"tableName":"jg_warehousing_inspection","renderKey":1708665793517,"tagIcon":"icon-ym icon-ym-generator-date","startRelationField":"","defaultCurrent":false,"tag":"JnpfDatePicker","formId":115,"visibility":["pc","app"],"jnpfKey":"datePicker","noShow":false,"endTimeTarget":1,"tipLabel":"","startTimeType":1,"endTimeRule":false,"label":"质检时间","startTimeRule":false,"startTimeValue":"","trigger":"change","endTimeValue":"","endTimeType":1,"layout":"colFormItem","startTimeTarget":1,"regList":[],"span":8},"readonly":false,"prop":"inspectionTime","width":0,"__vModel__":"inspectionTime","style":{"width":"100%"},"disabled":false,"fixed":"none","placeholder":"请选择","id":"inspectionTime","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}","blur":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}}],
listQuery: {
moduleId:'530702377393609733',
sort: 'desc',
sidx: '',
keyword: '',
json: ''
},
options: [
{
text: '删除',
style: {
backgroundColor: '#dd524d'
}
}
],
sortOptions:[
],
ableAll:{
},
interfaceRes:{
},
menuId:'',
enCode: 'warehousingInspection',
formId: '530702377393609733',
columnList:[],
isTree:false,
type:'1',
key:new Date(),
dataValue:{},
userInfo:{},
firstInitSearchData:false,
thousandsField:[],
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"},
}
},
onLoad(e){
this.userInfo = uni.getStorageSync('userInfo') || {}
this.menuId = e.menuId
uni.$on('refresh', () => {
this.list = [];
this.mescroll.resetUpScroll();
})
this.dataAll()
this.getColumnList()
this.getFormById()
},
onUnload() {
uni.$off('refresh')
},
methods:{
toThousands(val, column) {
let num = Number(val)
let newVal = this.thousandsField.includes(column.__vModel__) ? num.toLocaleString('zh', {maximumFractionDigits: '2',minimumFractionDigits: '2'}): num.toFixed(2);
return newVal
},
getJsonList() {
FlowJsonList(this.flowId,'1').then(res => {
this.templateList = res.data;
})
},
getFormById() {
getFormById(this.formId).then(res => {
this.flowId = res.data&&res.data.id
this.enCode = res.data&&res.data.enCode
this.getJsonList()
})
},
dataAll(){
},
openData(e){
if(e==1){
//this.reset()
}
},
//
async initSearchData() {
this.dataValue = JSON.parse(JSON.stringify(this.searchForm))
},
relationFormClick(item,column) {
let vModel = column.__vModel__?column.__vModel__+"_id":column.__vModel__
let id = item[vModel]
if(vModel){
let [attr,attr1]=vModel.split("_jnpf_")
if(attr&&attr1){
attr = attr.replace('jnpf_','')
id = item[attr]&&item[attr][attr1]
}
}
let modelId = column.modelId
if (!id || !modelId) return
let config = {
modelId: modelId,
id: id,
formTitle: '详情',
noShowBtn: 1
}
this.$nextTick(() => {
const url ='/pages/apply/dynamicModel/detail?config=' + this.base64.encode(JSON.stringify(config),"UTF-8")
uni.navigateTo({
url: url
})
})
},
async upCallback(page) {
if(!this.firstInitSearchData) {
await this.initSearchData()
this.firstInitSearchData = true
}
const query = {
currentPage: page.num,
pageSize: page.size,
menuId : this.menuId,
...this.listQuery,
...this.searchForm,
dataType:0,
}
request({
url: '/api/scm/WarehousingInspection/getList',
method: 'post',
data: query,
}).then(res => {
let _list = this.columnList.length?res.data.list:[];
this.mescroll.endSuccess(_list.length);
if (page.num == 1) this.list = [];
const list = _list.map(o => ({
show: false,
...o
}));
this.list = this.list.concat(_list);
}).catch(() => {
this.mescroll.endErr();
})
},
handleClick(index, index1) {
const item = this.list[index]
if([1,2,3,5].includes(item.flowState)){
this.$u.toast("流程正在审核,请勿删除")
this.list[index].show = false
return
}
request({
url: '/api/scm/WarehousingInspection/' + item.id,
method: 'delete'
}).then(res => {
uni.showToast({
title: res.msg,
complete: () => {
this.$u.toast(res.msg)
this.mescroll.resetUpScroll()
}
})
})
},
open(index) {
this.list[index].show = true;
this.list.map((val, idx) => {
if (index != idx) this.list[idx].show = false;
})
},
search() {
if (this.isPreview == '1') return
this.searchTimer && clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(() => {
this.list = [];
this.mescroll.resetUpScroll();
}, 300)
},
goDetail(id, item) {
let flowtaskid = item.flowtaskid
let flowState =item.flowState
let flowId =item.flowId
let btnType = ''
let btnList = []
btnList.push('btn_edit')
btnList.push('btn_detail')
if(btnList.includes('btn_detail')){
btnType = "btn_detail"
}
if(btnList.includes('btn_edit')){
btnType = "btn_edit"
}
if(!btnType) return
let ids = flowtaskid?flowtaskid:id
this.flowId = flowId?flowId:this.templateList[0].id
this.jumPage(ids, flowState,btnType)
},
addPage() {
if (!this.templateList.length) return this.$u.toast('流程不存在')
if (this.templateList.length > 1) {
this.show = true
} else {
this.flowId = this.templateList[0].id
this.jumPage()
}
},
confirm(e) {
this.flowId = this.templateList[e[0]].id
this.jumPage()
},
jumPage(id, status,btnType){
if (!id && !status) btnType = 'btn_add'
let _title=""
if(btnType=='btn_add'){
_title = "新增"
}
if(btnType=='btn_detail'){
_title = "详情"
}
if(btnType=='btn_edit'){
_title = "编辑"
}
let opType = '-1'
if ([1,2,5].includes(status)) opType = 0
const config = {
id: id || '',
enCode: this.enCode,
flowId: this.flowId,
formType: 1,
type: 1,
opType,
status: status || '',
fullName: _title,
jurisdictionType: btnType || ''
}
uni.navigateTo({
url: '/pages/workFlow/flowBefore/index?config=' + this.base64.encode(JSON.stringify(config), "UTF-8")
})
},
getFlowStatus(val) {
let status
switch (val) {
case 0:
status = {
text: '等待提交',
statusCss: 'u-type-info'
}
break;
case 1:
status = {
text: '等待审核',
statusCss: 'u-type-primary'
}
break;
case 2:
status = {
text: '审核通过',
statusCss: 'u-type-success'
}
break;
case 3:
status = {
text: '审核驳回',
statusCss: 'u-type-error'
}
break;
case 4:
status = {
text: '审核撤回',
statusCss: 'u-type-error'
}
break;
case 5:
status = {
text: '审核终止',
statusCss: 'u-type-info'
}
break;
default:
status = {
text: '等待提交',
statusCss: 'u-type-info'
}
break;
}
return status
},
getColumnList() {
let columnPermissionList = []
let _appColumnList =this.appColumnList
for (let i = 0; i < _appColumnList.length; i++) {
columnPermissionList.push(_appColumnList[i])
}
this.columnList = this.transformColumnList(columnPermissionList, this.dataOptions)
},
transformColumnList(columnList, dataOptions) {
let list = []
for (let i = 0; i < columnList.length; i++) {
let e = columnList[i]
let columProp = e.prop
let label = e.label
let option = null
let options = columProp + "Options"
if (!columProp.includes('-')) {
columProp = columProp
if(this.type=='4'){
columProp = columProp +"_name"
}
if(label.length>4){
label = label.substring(0, 4)
}
e.label = label
e.prop = columProp
e.option = option
list.push(e)
} else {
e.vModel = columProp.split('-')[1]
e.childLabel = e.label.split('-')[1]
options = e.vModel + "Options"
let prop = columProp.split('-')[0]
let label = e.label.split('-')[0]
let newItem = {
align: "center",
jnpfKey: "table",
prop,
label,
children: []
}
if (!list.some(o => o.prop === prop)) list.push(newItem)
for (let i = 0; i < list.length; i++) {
if (list[i].prop === prop) {
e.prop = e.prop
e.vModel = e.vModel
if(this.type=='4'){
e.prop = e.prop+"_name"
e.vModel = e.vModel+"_name"
}
e.option = option
list[i].children.push(e)
break
}
}
}
}
return list
},
cellClick(item) {
if (this.sortValue === item.value) return
this.listQuery.sort = item.sort
this.listQuery.sidx = item.sidx
this.sortValue = item.value
this.$refs.uDropdown.close();
this.$nextTick(() => {
this.list = [];
this.mescroll.resetUpScroll();
})
},
reset() {
this.searchForm = JSON.parse(JSON.stringify(this.dataValue))
this.key = new Date()
},
closeDropdown() {
this.$refs.uDropdown.close();
this.$nextTick(() => {
this.list = [];
this.mescroll.resetUpScroll();
})
},
dataList(data){
let _list =data.list
return _list;
},
},
}
</script>
<style lang="scss">
page {
background-color: #f0f2f6;
height: 100%;
/* #ifdef MP-ALIPAY */
position: absolute;
top: 0;
left: 0;
width: 100%;
/* #endif */
}
.right-option-box {
display: flex;
width: max-content;
.right-option {
width: 144rpx;
height: 100%;
font-size: 16px;
color: #fff;
background-color: #dd524d;
display: flex;
align-items: center;
justify-content: center;
}
.more-option {
background-color: #1890ff;
}
}
</style>

@ -56,6 +56,16 @@
@eventReceiver="eventReceiver"
v-if="config.formEnCode === 'energyConsumption'"
/>
<bom
ref="form"
@eventReceiver="eventReceiver"
v-if="config.formEnCode === 'bom'"
/>
<warehousingInspection
ref="form"
@eventReceiver="eventReceiver"
v-if="config.formEnCode === 'warehousingInspection'"
/>
</template>
<template v-if="config.formType == 2">
<dynamicForm
@ -80,7 +90,8 @@ import productWarehouse from "@/pages/scm/form/productWarehouse/index.vue";
import purchaseOrder from "@/pages/scm/form/businessOrder/purchaseIndex.vue";
import saleOrder from "@/pages/scm/form/businessOrder/saleIndex.vue";
import energyConsumption from "@/pages/scm/form/energyConsumption/index.vue";
import bom from "@/pages/scm/form/bom/index.vue";
import warehousingInspection from "@/pages/scm/form/warehousingInspection/index.vue";
export default {
components: {
crmOrder,
@ -93,7 +104,9 @@ export default {
productWarehouse,
purchaseOrder,
saleOrder,
energyConsumption
energyConsumption,
bom,
warehousingInspection
},
props: {
config: {

Loading…
Cancel
Save