Commit 4eaee894 authored by wangdanlei's avatar wangdanlei

Merge branch 'dev' of http://94.191.100.41/tfmom/tf-mom-web into dev

parents 6b5ffc2c 6d8dfbaa
/**
* @Description: 采购入库导入
* @author xioln
* @date 2023-06-21
* @FilePath: applications/dee-mes/src/privateComponents/components/ProcurementWarehousingImport/index.vue
*/
<template>
<div class="procurement-Warehousing-import">
<dee-dialog
:dialog-visible="dialogVisible"
title="导入"
width="40%"
>
<el-form ref="fileForm" label-width="100px">
<el-form-item label="选择文件">
<el-upload
ref="upload"
class="upload-demo"
accept=".xlsx, .xlsm, .xls"
:auto-upload="false"
action="#"
:limit="1"
:file-list="fileList"
:on-change="handleChange"
:on-exceed="handleExceed"
:on-remove="handleRemove"
>
<el-button size="small" style="width: 400px; text-align: right">
<i class="fa fa-folder-open-o" />
</el-button>
</el-upload>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button
type="primary"
:disabled="uploading"
@click="handleImportExcel"
>确定导入</el-button>
</div>
</dee-dialog>
</div>
</template>
<script>
import { post } from '@/utils/http'
export default {
componentName: '导入',
name: 'ProcurementWarehousingImport', // name写在组件的最前方,自定义组件为必填
components: {},
props: {
param: {
type: Object,
required: true
}
// baseComInfo: {
// type: Object,
// default: () => { }
// }
},
data() {
return {
dialogVisible: false,
fileList: [], // 文件列表
file: {},
uploading: true // 默认置灰确定导入按钮
}
},
computed: {},
created() {
// 初始化数据
},
mounted() {
this.$nextTick(() => {
// this.handleExcel()
})
},
methods: {
open() {
this.dialogVisible = true
},
close() {
this.dialogVisible = false
},
// 文件状态改变触发
handleChange(file) { // (file,fileList)参数
this.uploading = false
this.file = file
},
// 文件超出个数限制
handleExceed() {
this.$message.warning('仅允许上传一个文件!')
},
// 移除文件
handleRemove() {
this.uploading = true
},
// 导入excel
handleImportExcel() {
if (!this.file.size) {
this.$message.warning('请选择上传的文件')
return
}
this.uploading = true
if (this.param.id) {
this.upLoadExcel(this.param.id)
} else {
post('/InventoryRequest/batch/recursionAdd', this.param).then(res => {
if (res.items.id) {
this.upLoadExcel(res.items.id)
}
}).catch((err) => {
console.log(err)
})
}
},
// 上传excel
upLoadExcel(id) {
const formData = new FormData()
formData.append('file', this.file.raw)
this.$api.apiUploadFile(`/InStorageRequestItem/importByExcel?id=${id}`, formData).then(res => { // 调用接口
this.uploading = false
if (res.code === '0') {
this.$message.success(res.message)
this.close()
} else {
this.$message.error(res.message)
}
}).catch(err => {
this.$message.error(err)
})
}
}
}
</script>
<style lang='scss'>
.procurement-Warehousing-import {
.dialog-footer{
float: right;
}
}
</style>
......@@ -163,6 +163,13 @@ export default {
trigger: ['blur', 'change']
}
],
sorties: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
serialNo: [
{
required: true,
......@@ -238,6 +245,7 @@ export default {
this.$set(this.form, 'operator', 'ADD')
} else if (type === 'ADD') {
this.parentId = row.rowId
this.$set(this.form, 'operator', 'ADD')
} else if (type === 'MODIFY') {
console.log('row', row)
console.log('this.basicData', this.basicData.operator)
......
......@@ -6,6 +6,7 @@
*/
<template>
<div class="className">
<dee-tools :tools="topTools" mode="normal" style="justify-content: end;" />
<dee-form
ref="form"
label-width="120"
......@@ -16,29 +17,27 @@
@on-cancel="cancel"
/>
<div class="sub-title"> 采购入库申请明细 </div>
<dee-table
:data="tableData"
:columns="columns"
:options="optionsTree"
:index-row="{ title: '序号', width: '70' }"
>
<dee-table :data="tableData" :columns="columns" :options="optionsTree" :index-row="{ title: '序号', width: '70' }">
<div slot="header" class="table-title-wrap">
<dee-tools :tools="tools" mode="normal" />
</div>
</dee-table>
<span style="position: absolute;top: calc(100% - 70px);left: calc(50% + 30px);}">
<el-button type="primary" class="searchBtn" @click="submit">保存</el-button>
<span style="position: absolute;top: calc(100% - 70px);left: calc(50% - 70px);}">
<el-button type="primary" class="searchBtn" @click="submit">完成</el-button>
<el-button type="primary" class="searchBtn" @click="back">取消</el-button>
</span>
<storage-details ref="storageDetailsCreatOrEdit" :basic-data="detailsPropData" @addTableData="addTableData" />
<import-file ref="importFile" :param="importParam" />
</div>
</template>
<script>
import { post, del, get } from '@/utils/http'
import StorageDetails from './component/storageDetailsCreateCom'
import ImportFile from './component/importFile'
export default {
componentName: '采购入库申请创建编辑',
name: 'PurchasingWarehousingNewOrEdit', // name写在组件的最前方,自定义组件为必填
components: { StorageDetails },
components: { StorageDetails, ImportFile },
props: {
// basicData: {
// type: Object,
......@@ -190,7 +189,8 @@ export default {
}
]
},
tools: [{
tools: [
{
name: '添加入库物料',
icon: '/icons/components/new/add.png',
handler: {
......@@ -205,7 +205,35 @@ export default {
})
}
}
}],
},
{
name: '导入',
icon: '/icons/components/new/addAffectedData.png',
handler: {
click: () => {
this.$refs.form.validate((isok) => {
if (isok) {
// 校验通过
this.$refs.importFile.open()
} else {
this.$utils.showMessageWarning('请填写基本信息!')
}
})
}
}
}
],
topTools: [
{
name: '返回',
icon: '/icons/toleft.png',
handler: {
click: () => {
that.back()
}
}
}
],
optionsTree: {
'row-key': 'rowId', // value值需为可以标识该对象唯一的值
lazy: false,
......@@ -225,7 +253,8 @@ export default {
},
icon: '/icons/components/new/add.png',
showFun: (row) => {
if (row.parentId || this.detailsPropData.materialTypeName.label === '外购成品') {
const value = row.extMaterial ? row.extMaterial.resType2.typeName : ''
if (!row.isRoot || row.parentId || value !== '外购成品') {
return false
}
return true
......@@ -288,31 +317,43 @@ export default {
}
},
{ title: '所属设备', key: 'subEquipment', headerAlign: 'center' },
{ title: '物料类型', key: 'typeName', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
{
title: '物料类型', key: 'typeName', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
const value = row.extMaterial ? row.extMaterial.resType2.typeName : row.materialTypeName
return value
} },
{ title: '编码', key: 'typeCode', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
}
},
{
title: '编码', key: 'typeCode', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
const value = row.extMaterial ? row.extMaterial.resCode : row.resCode
return value
} },
}
},
{ title: '机型', key: 'airModel', headerAlign: 'center' },
{ title: '架次', key: 'sorties', headerAlign: 'center' },
{ title: '计量单位', key: 'unitName', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
{
title: '计量单位', key: 'unitName', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
console.log('2123123123', { ...row })
const value = row.extMaterial ? row.extMaterial.extUnit.unitName : row.reqUnit
return value
} },
}
},
{ title: '入库数量', key: 'reqAmount', headerAlign: 'center' },
{ title: '供应商', key: 'supplierFullName', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
{
title: '供应商', key: 'supplierFullName', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
const value = row.extDxSipplier ? row.extDxSipplier.supplierFullName : row.supplier
return value
} },
}
},
// { title: '是否合格供应商', key: 'extDxSipplier.isValid', headerAlign: 'center' },
{ title: '制造商', key: 'manufacturer', headerAlign: 'center' },
{ title: '到货日期', key: 'arrivalDate', headerAlign: 'center' },
{ title: '生产日期', key: 'producedTime', headerAlign: 'center' },
{ title: '随产品资料', key: 'withProductMaterial', headerAlign: 'center' },
{
title: '随产品资料', key: 'withProductMaterial', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
return Array.isArray(row.withProductMaterial) ? row.withProductMaterial.join(';') : row.withProductMaterial
}
},
{ title: '紧急程度', key: 'urgency', headerAlign: 'center' },
{ title: '入库单价', key: 'stockUnitPrice', headerAlign: 'center' },
{ title: '入库金额', key: 'stockPrice', headerAlign: 'center' },
......@@ -320,10 +361,12 @@ export default {
{ title: '含税金额', key: 'taxPrice', headerAlign: 'center' },
{ title: '税率', key: 'taxRate', headerAlign: 'center' },
{ title: '报检人', key: 'applyUserName', headerAlign: 'center' },
{ title: '接受仓库', key: 'extname', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
{
title: '接受仓库', key: 'extname', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
const value = row.storageZone ? row.storageZone.extname : row.storageZoneName
return value
} },
}
},
{ title: '合同号', key: 'contractNo', headerAlign: 'center' },
{ title: '备注', key: 'remark', headerAlign: 'center' },
{ title: '状态', key: 'state', headerAlign: 'center' },
......@@ -340,6 +383,27 @@ export default {
supplierFullName: this.formData[0].data.find(item => item.key === 'extDxSipplierId').component.options.find(item => item.value === this.form.extDxSipplierId),
...this.form
}
},
importParam: function() {
if (this.form.id) {
return {
'id': this.form.id
}
} else {
return {
'operator': 'ADD',
'materialTypeIdType': 'ExtDxProcessResourceType',
'extDxProductAreaIdType': 'ExtDxProductArea',
'extDxSipplierIdType': 'ExtDxSipplier',
'subTypeName': 'InStoragePurchase',
'reqStatus': 'Apply',
'billType': this.form.billType,
'arrivalDate': this.form.arrivalDate,
'materialTypeId': this.form.materialTypeId,
'extDxProductAreaId': this.form.extDxProductAreaId,
'extDxSipplierId': this.form.extDxSipplierId
}
}
}
},
created() {
......@@ -349,6 +413,12 @@ export default {
this.form.operator = 'ADD'
},
methods: {
back() {
this.$router.push({
path: '/page/86a5fa19-e245-4732-aff6-c48b18e2b5c7',
query: { title: '采购入库', menuRootAppId: '1626781924331' }
})
},
initData() {
this.getInventoryRequest()
this.getDictData()
......@@ -526,6 +596,7 @@ export default {
},
// 组装表格数据
addTableData(formData) {
console.log('formData', formData)
const tableDataItem = {
...formData,
subEquipment: formData.materialTypeName,
......
......@@ -21,14 +21,41 @@
<dee-tools :tools="tools" mode="normal" :collapse="false" />
</div>
<task-detail-basicInfo :basic-data="basicData" />
<!-- <div v-if="approvalObject.length">
<div v-if="approvalObject.length">
<div class="sub-title" style="padding-bottom:12px">审批对象</div>
<div v-for="(x,index) in approvalObject" :key="index">
<dee-dynamic-com v-if="x.type==='customComponent'" :ref="name.configName" :com-item="name" :basic-data="basicData" :participant-data="participantData" />
<component :is="x.comName" v-else-if="x.comName" :ref="x.configName" :lay-info="x" :basic-data="basicData.businessObject" @to-detail="toDetail" />
<component :is="x.configName" v-else :ref="x.configName" :lay-info="x" :basic-data="basicData.businessObject" @to-detail="toDetail" />
<div v-for="(name,index) in approvalObject" :key="index">
<!-- 高级组件: globalComponents -->
<component :is="name.configName" v-if="name && name.type && name.type === 'globalComponents'" :ref="name.refKey" :com-item="name" :basic-data="basicData" :participant-data="participantData" />
<!-- 自定义组件: privateComponent -->
<dee-as-com
v-else-if="name && name.type && name.type === 'privateComponent'"
:ref="name.refKey"
:component-prop="{...name, selfComponentPath: name.selfComponentPath}"
:lay-config="{
component: {
registrationType: 'custom',
codeApp: name.webServerName,
codePath: name.selfComponentPath
}
}"
:basic-data="basicData"
:participant-data="participantData"
@saveStatusChangeEvent="onSaveStatusChangeEvent"
/>
<!-- 表单配置: formConfig -->
<dee-as-com
v-else-if="name && name.type && name.type === 'formConfig'"
:ref="name.refKey"
:lay-config="{
typeName: name.modelName,
layKey: name.keyName
}"
editor-immediately
:basic-data="basicData"
:participant-data="participantData"
/>
</div>
</div>
</div> -->
<div v-if="basicData && basicData.basicInfo && !basicData.basicInfo.forwardFlag">
<div class="sub-title" style="padding-bottom:12px">任务处理</div>
<div v-for="(name,index) in dynamicComponents" :key="index">
......@@ -531,7 +558,13 @@ export default {
el.comName = el.configName
}
})
this.approvalObject = res.items.approvalObject.filter(r => r.isShow)
this.approvalObject = res.items.approvalObject.filter(r => r.isShow).map(m => {
return {
...m,
// 设置组件引用key
refKey: this.$utils.guid()
}
})
}
this.participantData = {
......@@ -714,6 +747,19 @@ export default {
finishTask(flag, params, callback, errCallBack) {
this.$nextTick(function() {
const validateArray = []
// 审批对象表单
this.approvalObject.forEach(item => {
const vm = this.$refs[item.refKey][0]
if (!vm) return
if (vm.hasOwnProperty('validate')) {
validateArray.push(vm.validate())
} else if (vm.$refs.asCom && vm.$refs.asCom.hasOwnProperty('validate')) {
validateArray.push(vm.$refs.asCom.validate())
} else if (vm.$refs.asCom.$refs && vm.$refs.asCom.$refs.deeForm && vm.$refs.asCom.$refs.deeForm.hasOwnProperty('validate')) {
validateArray.push(vm.$refs.asCom.$refs.deeForm.validate())
}
})
// 任务处理
this.dynamicComponents.forEach(item => {
if (this.$refs.hasOwnProperty(item.configName)) {
if (this.$refs[item.configName][0].hasOwnProperty('validate')) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment