入库管理
This commit is contained in:
parent
df25270f48
commit
10c6840eb9
|
|
@ -265,3 +265,30 @@ export const getEquipmentPropertyTypeApi = (typeId) => {
|
|||
method: 'GET',
|
||||
})
|
||||
}
|
||||
|
||||
// 入库申请/审核-列表
|
||||
export const getWarehousingListApi = (data) => {
|
||||
return request({
|
||||
url: '/material-mall/warehousing/list',
|
||||
method: 'GET',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
// 入库申请-暂存
|
||||
export const addWarehousingApi = (data) => {
|
||||
return request({
|
||||
url: '/material-mall/warehousing/add',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 入库申请-暂存更新
|
||||
export const updateWarehousingApi = (data) => {
|
||||
return request({
|
||||
url: '/material-mall/warehousing/updateById',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
: variables.menuLightColor
|
||||
"
|
||||
:unique-opened="true"
|
||||
active-text-color="#fff"
|
||||
active-text-color="#00a288"
|
||||
:collapse-transition="false"
|
||||
mode="vertical"
|
||||
>
|
||||
|
|
@ -134,6 +134,6 @@ export default {
|
|||
color: inherit !important;
|
||||
}
|
||||
::v-deep .el-menu-item.is-active {
|
||||
background-color: #EA7F31 !important;
|
||||
background-color: #FFFFFFCC !important;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,138 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<GoBack :title="'入库申请'" @goBack="goBack" />
|
||||
<el-tabs v-model="activeName" @tab-click="handleClick" :before-leave="beforeClick">
|
||||
<el-tab-pane label="装备" name="equip"></el-tab-pane>
|
||||
<el-tab-pane label="数量工具" name="toolNum"></el-tab-pane>
|
||||
<el-tab-pane label="编码工具" name="toolCode"></el-tab-pane>
|
||||
</el-tabs>
|
||||
<component ref="componentRef" :is="isShowComponent" @isSubmit="isSubmit" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import GoBack from '@/components/GoBack'
|
||||
import EquipmentAdd from '@/views/stockManagement/entryApply/components/EquipmentAdd'
|
||||
import AddNum from '@/views/stockManagement/entryApply/components/AddNum'
|
||||
import AddCode from '@/views/stockManagement/entryApply/components/AddCode'
|
||||
|
||||
export default {
|
||||
name: 'ApplyDetails',
|
||||
components: {
|
||||
GoBack,
|
||||
EquipmentAdd,
|
||||
AddNum,
|
||||
AddCode,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isShowComponent: 'EquipmentAdd',
|
||||
activeName: 'equip',
|
||||
}
|
||||
},
|
||||
created() {
|
||||
let title = '新增'
|
||||
const routerParams = this.$route.query
|
||||
if (routerParams.isEdit) {
|
||||
title = '编辑'
|
||||
}
|
||||
const obj = Object.assign({}, this.$route, { title })
|
||||
this.$tab.updatePage(obj)
|
||||
},
|
||||
methods: {
|
||||
goBack() {
|
||||
this.$router.push({ path: '/stockManagement/entryApply' }).then(() => {
|
||||
this.$tab.closePage({ path: '/stockManagement/entryApply/apply' })
|
||||
})
|
||||
},
|
||||
beforeClick(activeName, oldActiveName) {
|
||||
console.log('🚀 ~ oldActiveName:', oldActiveName)
|
||||
console.log('🚀 ~ activeName:', activeName)
|
||||
// this.$refs.componentRef
|
||||
console.log('🚀 ~ this.$refs.componentRef:', this.$refs.componentRef)
|
||||
// 如果是同一个 tab,直接放行
|
||||
if (activeName === oldActiveName) return true
|
||||
let isEmpty = false
|
||||
let allHasOrderId = false
|
||||
if (oldActiveName == 'equip') {
|
||||
const tableList = this.$refs.componentRef.tableData || []
|
||||
isEmpty = tableList.length === 0
|
||||
allHasOrderId = tableList.every((item) => !!item.orderId)
|
||||
} else if (oldActiveName == 'toolNum') {
|
||||
const tableList = this.$refs.componentRef.dialogList || []
|
||||
isEmpty = tableList.length === 0
|
||||
allHasOrderId = tableList.every((item) => !!item.applyId)
|
||||
} else if (oldActiveName == 'toolCode') {
|
||||
const tableList = this.$refs.componentRef.dialogList || []
|
||||
isEmpty = tableList.length === 0
|
||||
allHasOrderId = tableList.every((item) => !!item.applyId)
|
||||
}
|
||||
console.log('🚀 ~ isEmpty:', isEmpty)
|
||||
console.log('🚀 ~ allHasOrderId:', allHasOrderId)
|
||||
if (isEmpty || allHasOrderId) {
|
||||
if (activeName == 'equip') {
|
||||
this.isShowComponent = 'EquipmentAdd'
|
||||
} else if (activeName == 'toolNum') {
|
||||
this.isShowComponent = 'AddNum'
|
||||
} else if (activeName == 'toolCode') {
|
||||
this.isShowComponent = 'AddCode'
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
return this.confirmLeave().then(async (res) => {
|
||||
console.log('🚀 ~ res-确定保存:', res)
|
||||
console.log('🚀 ~ 确定保存-->>>:')
|
||||
if (!res) {
|
||||
if (activeName == 'equip') {
|
||||
this.isShowComponent = 'EquipmentAdd'
|
||||
} else if (activeName == 'toolNum') {
|
||||
this.isShowComponent = 'AddNum'
|
||||
} else if (activeName == 'toolCode') {
|
||||
this.isShowComponent = 'AddCode'
|
||||
}
|
||||
return
|
||||
}
|
||||
if (oldActiveName == 'equip') {
|
||||
// 调用保存
|
||||
// this.$refs.componentRef.submit()
|
||||
} else if (oldActiveName == 'toolNum') {
|
||||
} else if (oldActiveName == 'code') {
|
||||
}
|
||||
})
|
||||
},
|
||||
confirmLeave(message = '是否暂存已添加的装备?', title = '提示') {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.$confirm(message, title, {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(() => {
|
||||
console.log('用户点击「确定」')
|
||||
resolve(true)
|
||||
})
|
||||
.catch(() => {
|
||||
console.log('用户点击「取消」')
|
||||
resolve(false)
|
||||
})
|
||||
})
|
||||
},
|
||||
handleClick(tab, event) {
|
||||
console.log('🚀 ~ tab, event:', tab.index)
|
||||
// if (tab.index == 0) {
|
||||
// this.isShowComponent = 'EquipmentAdd'
|
||||
// } else if (tab.index == 1) {
|
||||
// this.isShowComponent = 'AddNum'
|
||||
// } else if (tab.index == 2) {
|
||||
// this.isShowComponent = 'AddCode'
|
||||
// }
|
||||
},
|
||||
isSubmit(val) {
|
||||
console.log('🚀 ~ val:', val)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
@ -0,0 +1,653 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-card style="margin-bottom: 20px">
|
||||
<el-form
|
||||
ref="dialogForm"
|
||||
:model="dialogForm"
|
||||
:rules="rules"
|
||||
size="small"
|
||||
inline
|
||||
@submit.native.prevent
|
||||
style="height: 32px"
|
||||
>
|
||||
<el-form-item label="规格型号">
|
||||
<el-cascader
|
||||
v-model="typeIdList"
|
||||
:options="options"
|
||||
:props="{ value: 'typeId', label: 'typeName' }"
|
||||
clearable
|
||||
@change="handleChange"
|
||||
style="width: 240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- 厂家 -->
|
||||
<el-form-item label="生产厂家" prop="supplierId">
|
||||
<div>
|
||||
<i
|
||||
class="el-icon-circle-plus-outline"
|
||||
style="color: #13ce66; margin-right: 5px; cursor: pointer"
|
||||
@click="openAddress"
|
||||
/>
|
||||
<el-select v-model="dialogForm.supplierId" placeholder="请选择厂家" clearable style="width: 240px">
|
||||
<el-option
|
||||
v-for="item in manufacturerSelect"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<!-- 出厂日期 -->
|
||||
<el-form-item label="出厂日期" prop="productionDate">
|
||||
<el-date-picker
|
||||
v-model="dialogForm.productionDate"
|
||||
type="date"
|
||||
clearable
|
||||
placeholder="选择出厂日期"
|
||||
value-format="yyyy-MM-dd"
|
||||
style="width: 240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- 申请数量 -->
|
||||
<el-form-item label="申请数量" prop="applyNum">
|
||||
<el-input-number
|
||||
v-model="dialogForm.applyNum"
|
||||
:min="1"
|
||||
:max="9999"
|
||||
:controls="false"
|
||||
placeholder="请输入申请数量"
|
||||
style="width: 240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item style="float: right">
|
||||
<el-button type="primary" icon="el-icon-plus" :disabled="typeIdList.length == 0" @click="handleAdd"
|
||||
>点击填充</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card v-loading="isLoading">
|
||||
<el-row :gutter="10" class="mb8" justify="end">
|
||||
<el-col :span="24" style="display: flex; justify-content: flex-end">
|
||||
<el-button type="primary" :disabled="dialogList.length == 0" @click="submit">暂存</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-table :data="dialogList" border stripe highlight-current-row height="546" style="width: 100%">
|
||||
<el-table-column type="index" width="55" label="序号" align="center" />
|
||||
<el-table-column
|
||||
v-for="(column, index) in dialogColumns"
|
||||
:width="column.width"
|
||||
:show-overflow-tooltip="!column.unShowTooltip"
|
||||
:key="index"
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
align="center"
|
||||
>
|
||||
<!-- 插槽 -->
|
||||
<template #header>
|
||||
<span>
|
||||
<span v-if="column.required" style="color: red">*</span>
|
||||
{{ column.label }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot="{ row }">
|
||||
<el-select
|
||||
v-if="column.prop == 'supplierId'"
|
||||
v-model="row.supplierId"
|
||||
placeholder="请选择厂家"
|
||||
style="width: 150px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in manufacturerSelect"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
<el-date-picker
|
||||
v-else-if="column.prop == 'productionDate'"
|
||||
v-model="row.productionDate"
|
||||
type="date"
|
||||
clearable
|
||||
placeholder="选择出厂日期"
|
||||
value-format="yyyy-MM-dd"
|
||||
style="width: 150px"
|
||||
/>
|
||||
<el-input
|
||||
v-else-if="column.prop == 'originCost'"
|
||||
v-model="row.originCost"
|
||||
placeholder="请输入"
|
||||
maxlength="9999"
|
||||
@input="handlePriceInput(row)"
|
||||
style="width: 120px"
|
||||
/>
|
||||
<el-input
|
||||
v-else-if="column.prop == 'identifyCode'"
|
||||
v-model="row.identifyCode"
|
||||
placeholder="请输入"
|
||||
maxlength="999"
|
||||
style="width: 120px"
|
||||
/>
|
||||
<span v-else-if="column.prop == 'fileList'">
|
||||
<span style="color: #00a288; cursor: pointer" @click="handleFileListUpload(row)">报告管理</span>
|
||||
</span>
|
||||
<!-- 其他列默认显示文本 -->
|
||||
<span v-else>{{ row[column.prop] }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template slot-scope="{ row, $index }">
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete($index)" style="color: red"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<!-- 上传 -->
|
||||
<el-dialog :title="uploadTitle" :visible.sync="uploadVisible" width="40%">
|
||||
<FileUpload
|
||||
v-model="fileList"
|
||||
:value="fileList"
|
||||
:limit="3"
|
||||
:fileSize="10"
|
||||
:fileType="['jpg', 'png', 'pdf']"
|
||||
@input="handleFileList"
|
||||
/>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="uploadVisible = false">关 闭</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<!-- 查看 -->
|
||||
<el-dialog :title="viewTitle" :visible.sync="viewVisible" width="40%">
|
||||
<el-table :data="viewList" fit highlight-current-row style="width: 100%" height="546">
|
||||
<el-table-column type="index" width="55" label="序号" align="center" />
|
||||
<el-table-column label="附件名称" prop="fileName" align="center">
|
||||
<!-- 插槽 -->
|
||||
<template v-slot="{ row }">
|
||||
<span style="color: #00a288; cursor: pointer" @click="handleFile(row)">{{ row.fileName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="viewVisible = false">关 闭</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<!-- 地址 -->
|
||||
<el-dialog title="新增" v-if="showHouse" :visible.sync="showHouse" width="55%" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="135px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="统一社会信用代码" prop="supplierCode">
|
||||
<el-input v-model="form.supplierCode" placeholder="请输入统一社会信用代码" maxlength="64" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="厂家名称" prop="supplierName">
|
||||
<el-input v-model="form.supplierName" placeholder="请输入厂家名称" maxlength="128" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="联系人" prop="contactPerson">
|
||||
<el-input v-model="form.contactPerson" placeholder="请输入联系人" maxlength="64" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="联系电话" prop="contactPhone">
|
||||
<el-input v-model="form.contactPhone" placeholder="请输入联系电话" maxlength="11" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="厂家地址" prop="address">
|
||||
<el-input v-model="form.address" placeholder="请输入厂家地址" maxlength="255" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="资质/执照编号" prop="qualification">
|
||||
<el-input v-model="form.qualification" placeholder="请输入资质信息或执照编号" maxlength="255" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="form.status" placeholder="请选择状态" style="width: 100%">
|
||||
<el-option label="启用" :value="1" />
|
||||
<el-option label="停用" :value="0" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
type="textarea"
|
||||
:rows="6"
|
||||
placeholder="请输入备注"
|
||||
v-model="form.remark"
|
||||
maxlength="255"
|
||||
show-word-limit
|
||||
>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="showHouse = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!-- 报告管理 -->
|
||||
<el-dialog title="报告管理" :visible.sync="openReport" width="900px" append-to-body>
|
||||
<el-table :data="fileDataList" width="100%" height="350px">
|
||||
<el-table-column label="序号" type="index" width="55" align="center" />
|
||||
<el-table-column label="报告类型" align="center" prop="dictLabel" :show-overflow-tooltip="true">
|
||||
<template v-slot="{ row }">
|
||||
<span v-if="row.type == 2 || row.type == 3">
|
||||
<span style="color: red">*</span>
|
||||
{{ row.dictLabel }}
|
||||
</span>
|
||||
<span v-else>{{ row.dictLabel }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="100">
|
||||
<template slot-scope="{ row, $index }">
|
||||
<div style="display: flex; align-items: center; justify-content: center">
|
||||
<el-button size="mini" type="text" @click="handleFileUpload(currentRow, row.type)">上传</el-button>
|
||||
<el-button
|
||||
v-if="
|
||||
(row.type == 2 && currentRow.certificates.length > 0) ||
|
||||
(row.type == 3 && currentRow.inspectionReports.length > 0) ||
|
||||
(row.type == 4 && currentRow.purchaseInvoices.length > 0)
|
||||
"
|
||||
size="mini"
|
||||
type="text"
|
||||
@click="handleView(currentRow, row.type)"
|
||||
>
|
||||
查看
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getTreeSelectApi, addApplyCodeApi, addToolApi } from '@/api/toolsManage'
|
||||
import { getManufacturerSelectApi } from '@/api/EquipmentLedger'
|
||||
import { addFacturer } from '@/api/ma/supplier'
|
||||
import { addWarehousingApi, updateWarehousingApi } from '@/api/EquipmentEntryApply'
|
||||
import FileUpload from '@/components/FileImageUpload'
|
||||
|
||||
export default {
|
||||
components: { FileUpload },
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
dialogTitle: '新增编码工具',
|
||||
dialogVisible: false,
|
||||
dialogForm: {
|
||||
applyId: null,
|
||||
typeId: null,
|
||||
supplierId: null,
|
||||
supplierName: null,
|
||||
productionDate: null,
|
||||
applyNum: 1,
|
||||
},
|
||||
rules: {
|
||||
applyNum: [{ required: true, message: '请输入申请数量', trigger: 'blur' }],
|
||||
},
|
||||
typeIdList: [],
|
||||
dialogColumns: [
|
||||
{ label: '工具专业', prop: 'fourthParentName' },
|
||||
{ label: '施工类型', prop: 'greatGrandparentName' },
|
||||
{ label: '工具类型', prop: 'grandparentTypeName' },
|
||||
{ label: '工具名称', prop: 'parentTypeName' },
|
||||
{ label: '规格型号', prop: 'typeName' },
|
||||
{ label: '计量单位', prop: 'unitName' },
|
||||
{ label: '生产厂家', prop: 'supplierId', width: 180, required: true },
|
||||
{ label: '出厂日期', prop: 'productionDate', width: 180, required: true },
|
||||
{ label: '资产原值(万元)', prop: 'originCost', width: 150, required: true },
|
||||
{ label: '原始编码', prop: 'identifyCode', width: 150, required: true },
|
||||
{ label: '相关配套资料', prop: 'fileList', width: 150, required: true },
|
||||
// { label: '合格证', prop: 'certificates', width: 100, required: true },
|
||||
// { label: '检测证书', prop: 'inspectionReports', width: 100, required: true },
|
||||
// { label: '采购发票', prop: 'purchaseInvoices', width: 100 },
|
||||
],
|
||||
openReport: false,
|
||||
fileDataList: [
|
||||
{ dictLabel: '合格证', type: '2' },
|
||||
{ dictLabel: '检测证书', type: '3' },
|
||||
{ dictLabel: '采购发票', type: '4' },
|
||||
],
|
||||
dialogList: [],
|
||||
options: [],
|
||||
activeLabels: [],
|
||||
lastNode: null,
|
||||
manufacturerSelect: [],
|
||||
certificates: [], // 合格证
|
||||
inspectionReports: [], // 检测证书
|
||||
purchaseInvoices: [], // 采购发票
|
||||
uploadType: '',
|
||||
currentRow: null,
|
||||
uploadTitle: '',
|
||||
uploadVisible: false,
|
||||
fileList: [],
|
||||
viewVisible: false,
|
||||
viewTitle: '',
|
||||
viewList: [],
|
||||
showHouse: false,
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
supplierCode: [{ required: true, message: '统一社会信用代码不能为空', trigger: 'blur' }],
|
||||
supplierName: [{ required: true, message: '厂家名称不能为空', trigger: 'blur' }],
|
||||
contactPhone: [
|
||||
{ required: false, message: '请输入联系电话', trigger: 'blur' },
|
||||
{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: '请输入正确的手机号码', trigger: 'blur' },
|
||||
],
|
||||
status: [{ required: true, message: '请选择状态', trigger: 'change' }],
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const applyId = this.$route.query.applyId || ''
|
||||
this.openDialog(applyId)
|
||||
},
|
||||
methods: {
|
||||
openDialog(applyId) {
|
||||
this.dialogForm.applyId = applyId
|
||||
this.dialogForm.supplierId = null
|
||||
this.dialogForm.productionDate = null
|
||||
this.dialogForm.applyNum = 1
|
||||
this.typeIdList = []
|
||||
this.dialogList = []
|
||||
this.dialogVisible = true
|
||||
this.getTreeSelect()
|
||||
this.getManufacturerSelect()
|
||||
if (applyId) {
|
||||
this.getList()
|
||||
}
|
||||
},
|
||||
async getList() {
|
||||
try {
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ error:', error)
|
||||
}
|
||||
},
|
||||
async getTreeSelect() {
|
||||
try {
|
||||
const res = await getTreeSelectApi({ manageType: 0 })
|
||||
this.options = res.data
|
||||
this.handleTree(this.options)
|
||||
} catch (error) {}
|
||||
},
|
||||
handleTree(tree) {
|
||||
for (const node of tree) {
|
||||
if (node.level === '5') {
|
||||
// 删除 children
|
||||
delete node.children
|
||||
} else if (node.children && node.children.length > 0) {
|
||||
// 继续递归下级
|
||||
this.handleTree(node.children)
|
||||
}
|
||||
}
|
||||
},
|
||||
handleChange(val) {
|
||||
this.dialogForm.typeId = val ? val[val.length - 1] : ''
|
||||
this.activeLabels = this.getLabelsFromValuePath(val, this.options)
|
||||
this.lastNode = this.findNodeById(this.options, val[val.length - 1])
|
||||
console.log('选中的 labels:', this.activeLabels)
|
||||
},
|
||||
getLabelsFromValuePath(valuePath, options) {
|
||||
let labels = []
|
||||
let currentLevel = options
|
||||
|
||||
for (const val of valuePath) {
|
||||
const node = currentLevel.find((item) => item.typeId === val)
|
||||
if (node) {
|
||||
labels.push(node.typeName)
|
||||
currentLevel = node.children || []
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
return labels
|
||||
},
|
||||
findNodeById(tree, id) {
|
||||
for (const node of tree) {
|
||||
if (node.typeId === id) return node // 找到了就返回
|
||||
if (node.children) {
|
||||
const result = this.findNodeById(node.children, id)
|
||||
if (result) return result // 子节点中找到了
|
||||
}
|
||||
}
|
||||
return null // 没找到
|
||||
},
|
||||
handleAdd() {
|
||||
const typeId = this.typeIdList[this.typeIdList.length - 1]
|
||||
|
||||
for (let i = 0; i < this.dialogForm.applyNum; i++) {
|
||||
this.dialogList.unshift({
|
||||
applyId: this.dialogForm.applyId,
|
||||
typeId,
|
||||
fourthParentName: this.activeLabels[0],
|
||||
greatGrandparentName: this.activeLabels[1],
|
||||
grandparentTypeName: this.activeLabels[2],
|
||||
parentTypeName: this.activeLabels[3],
|
||||
typeName: this.activeLabels[4],
|
||||
unitName: this.lastNode.unitName,
|
||||
applyNum: 1,
|
||||
supplierId: this.dialogForm.supplierId,
|
||||
supplierName: this.dialogForm.supplierName,
|
||||
productionDate: this.dialogForm.productionDate,
|
||||
originCost: null,
|
||||
identifyCode: null,
|
||||
certificates: [], // 合格证
|
||||
inspectionReports: [], // 检测证书
|
||||
purchaseInvoices: [], // 采购发票
|
||||
})
|
||||
}
|
||||
},
|
||||
handleDelete(index) {
|
||||
this.dialogList.splice(index, 1)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!',
|
||||
})
|
||||
},
|
||||
// 获取厂家
|
||||
async getManufacturerSelect() {
|
||||
try {
|
||||
const res = await getManufacturerSelectApi()
|
||||
this.manufacturerSelect = res.data
|
||||
} catch (error) {}
|
||||
},
|
||||
// 提交
|
||||
async submit() {
|
||||
try {
|
||||
// 循环this.dialogList 校验 厂家 出厂日期 资产原值 原始编码 合格证 检测证书 发票 是否填写
|
||||
for (let i = 0; i < this.dialogList.length; i++) {
|
||||
const item = this.dialogList[i]
|
||||
if (!item.supplierId) {
|
||||
this.$message.error(`第${i + 1}行厂家不能为空`)
|
||||
return
|
||||
}
|
||||
if (!item.productionDate) {
|
||||
this.$message.error(`第${i + 1}行出厂日期不能为空`)
|
||||
return
|
||||
}
|
||||
if (!item.originCost) {
|
||||
this.$message.error(`第${i + 1}行资产原值不能为空`)
|
||||
return
|
||||
}
|
||||
if (!item.identifyCode) {
|
||||
this.$message.error(`第${i + 1}行原始编码不能为空`)
|
||||
return
|
||||
}
|
||||
if (item.certificates.length == 0) {
|
||||
this.$message.error(`第${i + 1}行合格证不能为空`)
|
||||
return
|
||||
}
|
||||
if (item.inspectionReports.length == 0) {
|
||||
this.$message.error(`第${i + 1}行检测证书不能为空`)
|
||||
return
|
||||
}
|
||||
// if (item.purchaseInvoices.length == 0) {
|
||||
// this.$message.error(`第${i + 1}行采购发票不能为空`)
|
||||
// return
|
||||
// }
|
||||
}
|
||||
this.isLoading = true
|
||||
this.dialogForm.applyId = this.$route.query.applyId || ''
|
||||
if (!this.dialogForm.applyId) {
|
||||
const res = await addApplyCodeApi()
|
||||
this.dialogForm.applyId = res.data.id
|
||||
// 更新路由传参
|
||||
this.$router.replace({
|
||||
query: {
|
||||
applyId: res.data.id,
|
||||
},
|
||||
})
|
||||
this.dialogList.forEach((item) => {
|
||||
item.applyId = res.data.id
|
||||
})
|
||||
}
|
||||
const orderId = this.$route.query.orderId || ''
|
||||
const isEdit = this.$route.query.isEdit || ''
|
||||
const id = this.$route.query.id || ''
|
||||
if (isEdit && id) {
|
||||
await updateWarehousingApi({ orderId, applyId: this.dialogForm.applyId })
|
||||
} else {
|
||||
await addToolApi(this.dialogList)
|
||||
await addWarehousingApi({ orderId, applyId: this.dialogForm.applyId })
|
||||
}
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '操作成功!',
|
||||
})
|
||||
this.dialogVisible = false
|
||||
// this.$emit('getList', { applyId: this.dialogForm.applyId })
|
||||
} catch (error) {
|
||||
} finally {
|
||||
this.isLoading = false
|
||||
}
|
||||
},
|
||||
openAddress() {
|
||||
this.showHouse = true
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs['form'].validate(async (valid) => {
|
||||
if (valid) {
|
||||
addFacturer(this.form).then((response) => {
|
||||
this.$modal.msgSuccess('新增成功')
|
||||
this.showHouse = false
|
||||
this.getManufacturerSelect()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handlePriceInput(row) {
|
||||
let val = String(row.originCost ?? '')
|
||||
|
||||
// 1️⃣ 只保留数字和 .
|
||||
val = val.replace(/[^\d.]/g, '')
|
||||
|
||||
// 2️⃣ 只保留第一个小数点
|
||||
const dotIndex = val.indexOf('.')
|
||||
if (dotIndex !== -1) {
|
||||
val = val.slice(0, dotIndex + 1) + val.slice(dotIndex + 1).replace(/\./g, '')
|
||||
}
|
||||
row.originCost = val
|
||||
},
|
||||
handleFile(row) {
|
||||
// 打开文件预览
|
||||
window.open(row.fileUrl, '_blank')
|
||||
},
|
||||
// 查看
|
||||
handleView(row, type) {
|
||||
if (type == 2) {
|
||||
this.viewTitle = '合格证'
|
||||
this.viewList = row.certificates || []
|
||||
} else if (type == 3) {
|
||||
this.viewTitle = '检测证书'
|
||||
this.viewList = row.inspectionReports || []
|
||||
} else if (type == 4) {
|
||||
this.viewTitle = '采购发票'
|
||||
this.viewList = row.purchaseInvoices || []
|
||||
}
|
||||
this.viewVisible = true
|
||||
},
|
||||
handleFileListUpload(row) {
|
||||
this.currentRow = row
|
||||
this.openReport = true
|
||||
},
|
||||
// 上传
|
||||
handleFileUpload(row, type) {
|
||||
this.uploadType = type
|
||||
// this.currentRow = row
|
||||
if (type == 2) {
|
||||
this.uploadTitle = '合格证'
|
||||
this.fileList = this.currentRow.fileList2
|
||||
} else if (type == 3) {
|
||||
this.uploadTitle = '定期检验报告'
|
||||
this.fileList = this.currentRow.fileList3
|
||||
} else if (type == 4) {
|
||||
this.uploadTitle = '采购发票'
|
||||
this.fileList = this.currentRow.fileList4
|
||||
}
|
||||
this.uploadVisible = true
|
||||
},
|
||||
handleFileList(file) {
|
||||
if (this.uploadType == 2) {
|
||||
this.currentRow.fileList2 = file
|
||||
if (!file) {
|
||||
this.currentRow.certificates = []
|
||||
return
|
||||
}
|
||||
this.currentRow.certificates = this.formatFileList(file)
|
||||
} else if (this.uploadType == 3) {
|
||||
this.currentRow.fileList3 = file
|
||||
if (!file) {
|
||||
this.currentRow.inspectionReports = []
|
||||
return
|
||||
}
|
||||
this.currentRow.inspectionReports = this.formatFileList(file)
|
||||
} else if (this.uploadType == 4) {
|
||||
this.currentRow.fileList4 = file
|
||||
if (!file) {
|
||||
this.currentRow.purchaseInvoices = []
|
||||
return
|
||||
}
|
||||
this.currentRow.purchaseInvoices = this.formatFileList(file)
|
||||
}
|
||||
},
|
||||
formatFileList(file) {
|
||||
const arr = file.split(',')
|
||||
return arr.map((item) => {
|
||||
const parts = item.split('/')
|
||||
return {
|
||||
fileName: parts[parts.length - 1],
|
||||
fileUrl: item,
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
@ -0,0 +1,434 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-card style="margin-bottom: 20px">
|
||||
<el-form ref="dialogForm" :model="dialogForm" size="small" inline @submit.native.prevent style="height: 32px">
|
||||
<el-form-item label="规格型号">
|
||||
<el-cascader
|
||||
v-model="typeIdList"
|
||||
:options="options"
|
||||
:props="{ value: 'typeId', label: 'typeName', checkStrictly: false }"
|
||||
clearable
|
||||
@change="handleChange"
|
||||
style="width: 240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- 移除原来的“点击填充”按钮 -->
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card v-loading="isLoading">
|
||||
<el-row :gutter="10" class="mb8" justify="end">
|
||||
<el-col :span="24" style="display: flex; justify-content: flex-end">
|
||||
<el-button type="primary" :disabled="dialogList.length == 0" @click="submit">暂存</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-table :data="dialogList" border stripe highlight-current-row height="546" style="width: 100%">
|
||||
<el-table-column type="index" width="55" label="序号" align="center" />
|
||||
<el-table-column
|
||||
v-for="(column, index) in dialogColumns"
|
||||
:width="column.width"
|
||||
:show-overflow-tooltip="!column.unShowTooltip"
|
||||
:key="index"
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
align="center"
|
||||
>
|
||||
<!-- 合并插槽逻辑:用 v-if + v-else-if 区分不同列的输入框 -->
|
||||
<template v-slot="{ row }">
|
||||
<!-- 申请数量输入框 -->
|
||||
<el-input-number
|
||||
v-if="column.prop == 'applyNum'"
|
||||
v-model="row.applyNum"
|
||||
:min="1"
|
||||
:max="9999"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
style="width: 120px"
|
||||
/>
|
||||
<!-- 单价输入框 -->
|
||||
<el-input-number
|
||||
v-else-if="column.prop == 'originCost'"
|
||||
v-model="row.originCost"
|
||||
:min="0"
|
||||
:max="999999.99"
|
||||
:precision="2"
|
||||
:controls="false"
|
||||
style="width: 120px"
|
||||
/>
|
||||
<span v-else-if="column.prop == 'fileList'">
|
||||
<span style="color: #00a288; cursor: pointer" @click="handleFileListUpload(row)">报告管理</span>
|
||||
</span>
|
||||
<!-- 其他列默认显示文本 -->
|
||||
<span v-else>{{ row[column.prop] }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template slot-scope="{ row, $index }">
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(index)" style="color: red"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<!-- 上传 -->
|
||||
<el-dialog :title="uploadTitle" :visible.sync="uploadVisible" width="40%">
|
||||
<FileUpload
|
||||
v-model="fileList"
|
||||
:value="fileList"
|
||||
:limit="3"
|
||||
:fileSize="10"
|
||||
:fileType="['jpg', 'png', 'pdf']"
|
||||
@input="handleFileList"
|
||||
/>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="uploadVisible = false">关 闭</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<!-- 查看 -->
|
||||
<el-dialog :title="viewTitle" :visible.sync="viewVisible" width="40%">
|
||||
<el-table :data="viewList" fit highlight-current-row style="width: 100%" height="546">
|
||||
<el-table-column type="index" width="55" label="序号" align="center" />
|
||||
<el-table-column label="附件名称" prop="fileName" align="center">
|
||||
<!-- 插槽 -->
|
||||
<template v-slot="{ row }">
|
||||
<span style="color: #00a288; cursor: pointer" @click="handleFile(row)">{{ row.fileName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="viewVisible = false">关 闭</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<!-- 报告管理 -->
|
||||
<el-dialog title="报告管理" :visible.sync="openReport" width="900px" append-to-body>
|
||||
<el-table :data="fileDataList" width="100%" height="350px">
|
||||
<el-table-column label="序号" type="index" width="55" align="center" />
|
||||
<el-table-column label="报告类型" align="center" prop="dictLabel" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="操作" align="center" width="100">
|
||||
<template slot-scope="{ row, $index }">
|
||||
<div style="display: flex; align-items: center; justify-content: center">
|
||||
<el-button size="mini" type="text" @click="handleFileUpload(currentRow, row.type)">上传</el-button>
|
||||
<el-button
|
||||
v-if="
|
||||
(row.type == 2 && currentRow.certificates.length > 0) ||
|
||||
(row.type == 3 && currentRow.inspectionReports.length > 0) ||
|
||||
(row.type == 4 && currentRow.purchaseInvoices.length > 0)
|
||||
"
|
||||
size="mini"
|
||||
type="text"
|
||||
@click="handleView(currentRow, row.type)"
|
||||
>
|
||||
查看
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getTreeSelectApi, addApplyCodeApi, addToolApi } from '@/api/toolsManage'
|
||||
import { addWarehousingApi, updateWarehousingApi } from '@/api/EquipmentEntryApply'
|
||||
import FileUpload from '@/components/FileImageUpload'
|
||||
|
||||
export default {
|
||||
components: { FileUpload },
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
dialogTitle: '新增数量工具',
|
||||
dialogVisible: false,
|
||||
dialogForm: {
|
||||
applyId: null,
|
||||
typeId: null,
|
||||
},
|
||||
typeIdList: [],
|
||||
dialogColumns: [
|
||||
{ label: '工具专业', prop: 'fourthParentName' },
|
||||
{ label: '施工类型', prop: 'greatGrandparentName' },
|
||||
{ label: '工具类型', prop: 'grandparentTypeName' },
|
||||
{ label: '工具名称', prop: 'parentTypeName' },
|
||||
{ label: '规格型号', prop: 'typeName' },
|
||||
{ label: '计量单位', prop: 'unitName' },
|
||||
{ label: '单价', prop: 'originCost', width: 150 },
|
||||
{ label: '申请数量', prop: 'applyNum', width: 150 },
|
||||
{ label: '相关配套资料', prop: 'fileList', width: 150, required: true },
|
||||
// { label: '合格证', prop: 'certificates' },
|
||||
// { label: '检测证书', prop: 'inspectionReports' },
|
||||
// { label: '采购发票', prop: 'purchaseInvoices' },
|
||||
],
|
||||
dialogList: [],
|
||||
openReport: false,
|
||||
fileDataList: [
|
||||
{ dictLabel: '合格证', type: '2' },
|
||||
{ dictLabel: '检测证书', type: '3' },
|
||||
{ dictLabel: '采购发票', type: '4' },
|
||||
],
|
||||
options: [],
|
||||
activeLabels: [],
|
||||
lastNode: null,
|
||||
certificates: [], // 合格证
|
||||
inspectionReports: [], // 检测证书
|
||||
purchaseInvoices: [], // 采购发票
|
||||
uploadType: '',
|
||||
currentRow: null,
|
||||
uploadTitle: '',
|
||||
uploadVisible: false,
|
||||
fileList: [],
|
||||
viewVisible: false,
|
||||
viewTitle: '',
|
||||
viewList: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const applyId = this.$route.query.applyId || ''
|
||||
this.openDialog(applyId)
|
||||
},
|
||||
methods: {
|
||||
openDialog(applyId) {
|
||||
console.log('🚀 ~ applyId:', applyId)
|
||||
this.dialogForm.applyId = applyId
|
||||
this.typeIdList = []
|
||||
this.dialogList = []
|
||||
this.dialogVisible = true
|
||||
this.getTreeSelect()
|
||||
if (applyId) {
|
||||
this.getList()
|
||||
}
|
||||
},
|
||||
async getList() {
|
||||
try {
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ error:', error)
|
||||
}
|
||||
},
|
||||
async getTreeSelect() {
|
||||
try {
|
||||
const res = await getTreeSelectApi({ manageType: 1 })
|
||||
console.log('🚀 ~ res:', res)
|
||||
this.options = res.data
|
||||
this.handleTree(this.options)
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ error:', error)
|
||||
}
|
||||
},
|
||||
handleTree(tree) {
|
||||
for (const node of tree) {
|
||||
if (node.level === '5') {
|
||||
// 删除 children,标记为最终可选节点
|
||||
delete node.children
|
||||
} else if (node.children && node.children.length > 0) {
|
||||
// 继续递归下级
|
||||
this.handleTree(node.children)
|
||||
}
|
||||
}
|
||||
},
|
||||
handleChange(val) {
|
||||
console.log('🚀 ~ 选中的节点ID路径:', val)
|
||||
// 1. 空值(取消选择)直接返回
|
||||
if (!val || val.length === 0) {
|
||||
this.dialogForm.typeId = ''
|
||||
this.activeLabels = []
|
||||
this.lastNode = null
|
||||
return
|
||||
}
|
||||
|
||||
// 2. 获取最后一级节点信息
|
||||
this.dialogForm.typeId = val[val.length - 1]
|
||||
this.activeLabels = this.getLabelsFromValuePath(val, this.options)
|
||||
this.lastNode = this.findNodeById(this.options, this.dialogForm.typeId)
|
||||
|
||||
// 3. 仅当选中最后一级节点(level=5)时,自动填充表格
|
||||
if (this.lastNode?.level === '5') {
|
||||
this.autoAddToTable()
|
||||
}
|
||||
},
|
||||
// 自动添加到表格的核心逻辑(提取原handleAdd的逻辑)
|
||||
autoAddToTable() {
|
||||
const typeId = this.dialogForm.typeId
|
||||
// 去重判断:已添加则提示并返回
|
||||
if (this.dialogList.some((item) => item.typeId === typeId)) {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '该工具已添加,请勿重复选择!',
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 初始化默认值并添加到表格
|
||||
const originCost = this.lastNode?.originCost || 0
|
||||
this.dialogList.unshift({
|
||||
applyId: this.dialogForm.applyId,
|
||||
typeId,
|
||||
fourthParentName: this.activeLabels[0] || '',
|
||||
greatGrandparentName: this.activeLabels[1] || '',
|
||||
grandparentTypeName: this.activeLabels[2] || '',
|
||||
parentTypeName: this.activeLabels[3] || '',
|
||||
typeName: this.activeLabels[4] || '',
|
||||
unitName: this.lastNode.unitName || '',
|
||||
originCost,
|
||||
applyNum: 1,
|
||||
certificates: [], // 合格证
|
||||
inspectionReports: [], // 检测证书
|
||||
purchaseInvoices: [], // 采购发票
|
||||
})
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '工具已添加到列表!',
|
||||
duration: 1500, // 缩短提示时长,提升体验
|
||||
})
|
||||
},
|
||||
getLabelsFromValuePath(valuePath, options) {
|
||||
let labels = []
|
||||
let currentLevel = options
|
||||
|
||||
for (const val of valuePath) {
|
||||
const node = currentLevel.find((item) => item.typeId === val)
|
||||
if (node) {
|
||||
labels.push(node.typeName)
|
||||
currentLevel = node.children || []
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
return labels
|
||||
},
|
||||
findNodeById(tree, id) {
|
||||
for (const node of tree) {
|
||||
if (node.typeId === id) return node // 找到了就返回
|
||||
if (node.children) {
|
||||
const result = this.findNodeById(node.children, id)
|
||||
if (result) return result // 子节点中找到了
|
||||
}
|
||||
}
|
||||
return null // 没找到
|
||||
},
|
||||
handleDelete(index) {
|
||||
this.dialogList.splice(index, 1)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!',
|
||||
})
|
||||
},
|
||||
async submit() {
|
||||
try {
|
||||
this.isLoading = true
|
||||
this.dialogForm.applyId = this.$route.query.applyId || ''
|
||||
if (!this.dialogForm.applyId) {
|
||||
const res = await addApplyCodeApi()
|
||||
console.log('🚀 ~ res:', res)
|
||||
this.dialogForm.applyId = res.data.id
|
||||
// 更新路由传参
|
||||
this.$router.replace({
|
||||
query: {
|
||||
applyId: res.data.id,
|
||||
},
|
||||
})
|
||||
this.dialogList.forEach((item) => {
|
||||
item.applyId = res.data.id
|
||||
})
|
||||
}
|
||||
const orderId = this.$route.query.orderId || ''
|
||||
const isEdit = this.$route.query.isEdit || ''
|
||||
const id = this.$route.query.id || ''
|
||||
if (isEdit && id) {
|
||||
await updateWarehousingApi({ orderId, applyId: this.dialogForm.applyId })
|
||||
} else {
|
||||
await addToolApi(this.dialogList)
|
||||
await addWarehousingApi({ orderId, applyId: this.dialogForm.applyId })
|
||||
}
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '操作成功!',
|
||||
})
|
||||
this.dialogVisible = false
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ error:', error)
|
||||
} finally {
|
||||
this.isLoading = false
|
||||
}
|
||||
},
|
||||
handleFile(row) {
|
||||
// 打开文件预览
|
||||
window.open(row.fileUrl, '_blank')
|
||||
},
|
||||
// 查看
|
||||
handleView(row, type) {
|
||||
if (type == 2) {
|
||||
this.viewTitle = '合格证'
|
||||
this.viewList = row.certificates || []
|
||||
} else if (type == 3) {
|
||||
this.viewTitle = '检测证书'
|
||||
this.viewList = row.inspectionReports || []
|
||||
} else if (type == 4) {
|
||||
this.viewTitle = '采购发票'
|
||||
this.viewList = row.purchaseInvoices || []
|
||||
}
|
||||
this.viewVisible = true
|
||||
},
|
||||
handleFileListUpload(row) {
|
||||
this.currentRow = row
|
||||
this.openReport = true
|
||||
},
|
||||
// 上传
|
||||
handleFileUpload(row, type) {
|
||||
this.uploadType = type
|
||||
// this.currentRow = row
|
||||
if (type == 2) {
|
||||
this.uploadTitle = '合格证'
|
||||
this.fileList = this.currentRow.fileList2
|
||||
} else if (type == 3) {
|
||||
this.uploadTitle = '定期检验报告'
|
||||
this.fileList = this.currentRow.fileList3
|
||||
} else if (type == 4) {
|
||||
this.uploadTitle = '采购发票'
|
||||
this.fileList = this.currentRow.fileList4
|
||||
}
|
||||
this.uploadVisible = true
|
||||
},
|
||||
handleFileList(file) {
|
||||
console.log('🚀 ~ file:', file)
|
||||
if (this.uploadType == 2) {
|
||||
this.currentRow.fileList2 = file
|
||||
if (!file) {
|
||||
this.currentRow.certificates = []
|
||||
return
|
||||
}
|
||||
this.currentRow.certificates = this.formatFileList(file)
|
||||
} else if (this.uploadType == 3) {
|
||||
this.currentRow.fileList3 = file
|
||||
if (!file) {
|
||||
this.currentRow.inspectionReports = []
|
||||
return
|
||||
}
|
||||
this.currentRow.inspectionReports = this.formatFileList(file)
|
||||
} else if (this.uploadType == 4) {
|
||||
this.currentRow.fileList4 = file
|
||||
if (!file) {
|
||||
this.currentRow.purchaseInvoices = []
|
||||
return
|
||||
}
|
||||
this.currentRow.purchaseInvoices = this.formatFileList(file)
|
||||
}
|
||||
},
|
||||
formatFileList(file) {
|
||||
const arr = file.split(',')
|
||||
return arr.map((item) => {
|
||||
const parts = item.split('/')
|
||||
return {
|
||||
fileName: parts[parts.length - 1],
|
||||
fileUrl: item,
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -81,11 +81,20 @@
|
|||
:prop="column.prop"
|
||||
align="center"
|
||||
>
|
||||
<template v-slot="{ row }">
|
||||
<span v-if="column.prop == 'status'">
|
||||
<el-tag v-if="row.status == 0" size="small" type="info">草稿</el-tag>
|
||||
<el-tag v-if="row.status == 1" size="small" type="warning">待审批</el-tag>
|
||||
<el-tag v-if="row.status == 2" size="small" type="success">审批通过</el-tag>
|
||||
<el-tag v-if="row.status == 3" size="small" type="danger">驳回</el-tag>
|
||||
</span>
|
||||
<span v-else>{{ row[column.prop] }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 操作 -->
|
||||
<el-table-column label="操作" align="center" width="150">
|
||||
<template slot-scope="{ row }">
|
||||
<el-button type="text" size="mini" @click="handleEdit">编辑</el-button>
|
||||
<template v-slot="{ row }">
|
||||
<el-button type="text" size="mini" @click="handleEdit(row)">编辑</el-button>
|
||||
<el-button type="text" style="color: red" size="mini" @click="handleDelete">删除</el-button>
|
||||
<el-button type="text" size="mini" @click="submit">提交</el-button>
|
||||
</template>
|
||||
|
|
@ -104,6 +113,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { getWarehousingListApi } from '@/api/EquipmentEntryApply'
|
||||
|
||||
export default {
|
||||
name: 'EntryApply',
|
||||
data() {
|
||||
|
|
@ -125,16 +136,17 @@ export default {
|
|||
{ label: '录入单号', prop: 'code' },
|
||||
{ label: '装备数量', prop: 'equipNum' },
|
||||
{ label: '工具数量', prop: 'toolNum' },
|
||||
{ label: '申请人', prop: 'applyName' },
|
||||
{ label: '申请时间', prop: 'applyTime' },
|
||||
{ label: '申请人', prop: 'createUser' },
|
||||
{ label: '申请时间', prop: 'createTime' },
|
||||
{ label: '审批状态', prop: 'status' },
|
||||
],
|
||||
// 表格数据
|
||||
tableList: [{ code: 1 }, { code: 1 }, { code: 1 }],
|
||||
tableList: [],
|
||||
statusList: [
|
||||
{ label: '草稿', value: '1' },
|
||||
{ label: '驳回', value: '2' },
|
||||
{ label: '审批中', value: '3' },
|
||||
{ label: '草稿', value: '0' },
|
||||
{ label: '待审批', value: '1' },
|
||||
{ label: '审批通过', value: '2' },
|
||||
{ label: '驳回', value: '3' },
|
||||
],
|
||||
selectedRowKeys: [],
|
||||
}
|
||||
|
|
@ -167,10 +179,10 @@ export default {
|
|||
}
|
||||
delete params.timeRange
|
||||
console.log('🚀 ~ getList ~ params:', params)
|
||||
// const res = await (params)
|
||||
// console.log('🚀 ~ 获取列表 ~ res:', res)
|
||||
// this.tableList = res.data.rows || []
|
||||
// this.total = res.data.total || 0
|
||||
const res = await getWarehousingListApi(params)
|
||||
console.log('🚀 ~ 获取列表 ~ res:', res)
|
||||
this.tableList = res.rows || []
|
||||
this.total = res.total || 0
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ 获取列表 ~ error:', error)
|
||||
this.tableList = []
|
||||
|
|
@ -184,9 +196,28 @@ export default {
|
|||
this.selectedRowKeys = val.map((item) => item.id)
|
||||
},
|
||||
// 新增
|
||||
handleAdd() {},
|
||||
handleAdd() {
|
||||
this.$router.push({
|
||||
path: '/stockManagement/entryApply/apply',
|
||||
query: { isAddVisible: false, isApprovalVisible: false },
|
||||
}).then(() => {
|
||||
this.$tab.closePage({ path: '/stockManagement/entryApply' })
|
||||
})
|
||||
},
|
||||
// 编辑
|
||||
handleEdit() {},
|
||||
handleEdit(row) {
|
||||
this.$router.push({
|
||||
path: '/stockManagement/entryApply/apply',
|
||||
query: {
|
||||
id: row.id,
|
||||
orderId: row.orderId,
|
||||
applyId: row.applyId,
|
||||
isAddVisible: false,
|
||||
isApprovalVisible: false,
|
||||
isEdit: true,
|
||||
},
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
async handleDelete() {
|
||||
// 确认
|
||||
|
|
|
|||
|
|
@ -81,10 +81,20 @@
|
|||
:prop="column.prop"
|
||||
align="center"
|
||||
>
|
||||
<template v-slot="{ row }">
|
||||
<span v-if="column.prop == 'status'">
|
||||
<el-tag v-if="row.status == 0" size="small" type="info">草稿</el-tag>
|
||||
<el-tag v-if="row.status == 1" size="small" type="warning">待审批</el-tag>
|
||||
<el-tag v-if="row.status == 2" size="small" type="success">审批通过</el-tag>
|
||||
<el-tag v-if="row.status == 3" size="small" type="danger">驳回</el-tag>
|
||||
</span>
|
||||
<span v-else>{{ row[column.prop] }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 操作 -->
|
||||
<el-table-column label="操作" align="center" width="150">
|
||||
<template slot-scope="{ row }">
|
||||
<el-button type="text" size="mini" @click="handleView">查看</el-button>
|
||||
<el-button type="text" size="mini" @click="submit">审核</el-button>
|
||||
<el-button type="text" style="color: red" size="mini" @click="handleReject">驳回</el-button>
|
||||
</template>
|
||||
|
|
@ -103,6 +113,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { getWarehousingListApi } from '@/api/EquipmentEntryApply'
|
||||
|
||||
export default {
|
||||
name: 'InventoryAudit',
|
||||
data() {
|
||||
|
|
@ -131,7 +143,7 @@ export default {
|
|||
{ label: '装备/工具名称', prop: 'name' },
|
||||
],
|
||||
// 表格数据
|
||||
tableList: [{ code: 1 }, { code: 1 }, { code: 1 }],
|
||||
tableList: [{ status: 1 }, { status: 2 }, { status: 3 }, { status: 0 }],
|
||||
typeList: [
|
||||
{ label: '设备', value: '1' },
|
||||
{ label: '全部工具', value: '2' },
|
||||
|
|
@ -169,10 +181,10 @@ export default {
|
|||
}
|
||||
delete params.timeRange
|
||||
console.log('🚀 ~ getList ~ params:', params)
|
||||
// const res = await (params)
|
||||
// console.log('🚀 ~ 获取列表 ~ res:', res)
|
||||
// this.tableList = res.data.rows || []
|
||||
// this.total = res.data.total || 0
|
||||
const res = await getWarehousingListApi(params)
|
||||
console.log('🚀 ~ 获取列表 ~ res:', res)
|
||||
this.tableList = res.rows || []
|
||||
this.total = res.total || 0
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ 获取列表 ~ error:', error)
|
||||
this.tableList = []
|
||||
|
|
@ -197,6 +209,7 @@ export default {
|
|||
}
|
||||
})
|
||||
},
|
||||
handleView(row) {},
|
||||
// 提交
|
||||
async submit() {
|
||||
// 确认
|
||||
|
|
|
|||
Loading…
Reference in New Issue