This commit is contained in:
parent
9a0130db4b
commit
6d1055041b
|
|
@ -44,6 +44,8 @@
|
|||
style="width: 100%"
|
||||
v-model="form.process"
|
||||
placeholder="请选择工序"
|
||||
clearable
|
||||
filterable
|
||||
:options="processList"
|
||||
@change="processChange"
|
||||
></el-cascader>
|
||||
|
|
@ -55,6 +57,8 @@
|
|||
style="width: 100%"
|
||||
v-model="form.category"
|
||||
:options="categoryList"
|
||||
clearable
|
||||
filterable
|
||||
placeholder="请选择装备类目"
|
||||
@change="categoryChange"
|
||||
></el-cascader>
|
||||
|
|
@ -124,6 +128,11 @@
|
|||
value-format="yyyy-MM-dd"
|
||||
type="date"
|
||||
style="width: 100%"
|
||||
:picker-options="{
|
||||
disabledDate(time) {
|
||||
return time.getTime() < Date.now()
|
||||
},
|
||||
}"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
|
|
@ -266,7 +275,7 @@
|
|||
</div>
|
||||
<el-row :gutter="24" style="padding-top: 10px">
|
||||
<el-col>
|
||||
<el-form-item label="展示图" prop="mainFileList">
|
||||
<el-form-item label="装备外观" prop="mainFileList">
|
||||
<ImageUpload
|
||||
v-model="form.mainFileList"
|
||||
:value="form.mainFileList"
|
||||
|
|
@ -527,7 +536,10 @@ export default {
|
|||
},
|
||||
// 价格输入处理
|
||||
handlePriceInput(v) {
|
||||
this.form.originalValue = v.replace(/[^\d.]/g, '')
|
||||
this.form.originalValue = this.form.originalValue
|
||||
.replace(/[^\d.]/g, '') // 删除所有非数字和点
|
||||
.replace(/\.{2,}/g, '.') // 多个点 -> 单点
|
||||
.replace(/^(\d+)\.(.*)\./, '$1.$2'); // 只允许一个点
|
||||
},
|
||||
// 处理图片上传变化
|
||||
handleImageChange(files) {
|
||||
|
|
@ -629,10 +641,10 @@ export default {
|
|||
// 判断特征项是否填写 propertyVoList 每个propertyValue 都要有值
|
||||
if (this.propertyVoList && this.propertyVoList.length > 0) {
|
||||
const unfilledIndex = this.propertyVoList.findIndex(
|
||||
(item) => !item.propertyValue || item.propertyValue === '',
|
||||
(item) => (!item.propertyValue || item.propertyValue === '') && item.mustHave != '0',
|
||||
)
|
||||
if (unfilledIndex !== -1) {
|
||||
this.$message.warning(`请填写第 ${unfilledIndex + 1} 个特征项`)
|
||||
this.$message.warning(`第 ${unfilledIndex + 1} 个特征项为必填项,请填写完整`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@ -770,4 +782,7 @@ export default {
|
|||
justify-content: flex-end;
|
||||
gap: 10px; // 按钮间距
|
||||
}
|
||||
::v-deep .el-input-number.is-without-controls .el-input__inner {
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -150,7 +150,6 @@
|
|||
align="center"
|
||||
width="55"
|
||||
type="index"
|
||||
fixed
|
||||
:index="(index) => (queryParams.pageNum - 1) * queryParams.pageSize + index + 1"
|
||||
>
|
||||
<template slot="header" slot-scope="scope">
|
||||
|
|
@ -172,57 +171,215 @@
|
|||
column-key="orderNumber"
|
||||
min-width="200"
|
||||
/>
|
||||
<el-table-column prop="major" label="专业" align="center" show-overflow-tooltip min-width="100" />
|
||||
<el-table-column label="工序" align="center" show-overflow-tooltip min-width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.mainProcess }}{{ scope.row.subProcess ? '>' + scope.row.subProcess : '' }}
|
||||
<el-table-column prop="major" label="专业" align="center" show-overflow-tooltip min-width="200px">
|
||||
<template slot-scope="{ row }">
|
||||
<span v-if="!row.isNew">{{ row.major }}</span>
|
||||
<el-select
|
||||
v-else
|
||||
v-model="row.major"
|
||||
placeholder="请选择专业"
|
||||
clearable
|
||||
filterable
|
||||
@change="(val) => majorChange(val, row)"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option v-for="item in row.majorList" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工序" align="center" show-overflow-tooltip min-width="200px">
|
||||
<template slot-scope="{ row }">
|
||||
<span v-if="!row.isNew">{{ row.mainProcess }}{{ row.subProcess ? '>' + row.subProcess : '' }}</span>
|
||||
<el-cascader
|
||||
v-else
|
||||
v-model="row.process"
|
||||
placeholder="请选择工序"
|
||||
clearable
|
||||
filterable
|
||||
:options="row.processList"
|
||||
@change="(val) => processChange(val, row)"
|
||||
style="width: 100%"
|
||||
></el-cascader>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="装备类目" show-overflow-tooltip align="center" min-width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.mainCategory ? scope.row.mainCategory + '>' : '' }}
|
||||
{{ scope.row.branch ? scope.row.subCategory + '>' : scope.row.subCategory }}{{ scope.row.branch }}
|
||||
<el-table-column label="装备类目" show-overflow-tooltip align="center" min-width="200px">
|
||||
<template slot-scope="{ row }">
|
||||
<span v-if="!row.isNew">
|
||||
{{ row.mainCategory ? row.mainCategory + '>' : '' }}
|
||||
{{ row.branch ? row.subCategory + '>' : row.subCategory }}{{ row.branch }}
|
||||
</span>
|
||||
<el-cascader
|
||||
v-else
|
||||
v-model="row.category"
|
||||
:options="row.categoryList"
|
||||
clearable
|
||||
filterable
|
||||
placeholder="请选择装备类目"
|
||||
@change="(val) => categoryChange(val, row)"
|
||||
style="width: 100%"
|
||||
></el-cascader>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="name" label="装备名称" show-overflow-tooltip align="center" min-width="100" />
|
||||
<el-table-column prop="name" label="装备名称" show-overflow-tooltip align="center" min-width="200px">
|
||||
<template v-slot="{ row }">
|
||||
<span v-if="!row.isNew">{{ row.name }}</span>
|
||||
<el-input v-else maxlength="50" v-model="row.name" placeholder="请输入装备名称" clearable />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="specificationModel"
|
||||
label="规格型号"
|
||||
show-overflow-tooltip
|
||||
align="center"
|
||||
min-width="100"
|
||||
/>
|
||||
min-width="200px"
|
||||
>
|
||||
<template v-slot="{ row }">
|
||||
<span v-if="!row.isNew">{{ row.specificationModel }}</span>
|
||||
<el-input v-else maxlength="50" v-model="row.specificationModel" placeholder="请输入规格型号" clearable />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="originalCode"
|
||||
label="装备原始编码"
|
||||
show-overflow-tooltip
|
||||
align="center"
|
||||
min-width="100"
|
||||
/>
|
||||
<el-table-column prop="unit" label="计量单位" show-overflow-tooltip align="center" min-width="100" />
|
||||
<el-table-column prop="manufacturer" label="生产厂家" show-overflow-tooltip align="center" min-width="100" />
|
||||
<el-table-column prop="productionDate" label="出厂日期" show-overflow-tooltip align="center" min-width="100" />
|
||||
<el-table-column prop="purchaseDate" label="采购日期" align="center" />
|
||||
min-width="200px"
|
||||
>
|
||||
<template v-slot="{ row }">
|
||||
<span v-if="!row.isNew">{{ row.originalCode }}</span>
|
||||
<el-input v-else maxlength="50" v-model="row.originalCode" placeholder="请输入装备原始编码" clearable />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="unit" label="计量单位" show-overflow-tooltip align="center" min-width="200px">
|
||||
<template v-slot="{ row }">
|
||||
<span v-if="!row.isNew">{{ row.unit }}</span>
|
||||
<el-select v-else v-model="row.unit" placeholder="请选择计数单位" clearable style="width: 100%">
|
||||
<el-option
|
||||
v-for="dict in dict.type.dev_unit_type"
|
||||
:key="dict.label"
|
||||
:label="dict.label"
|
||||
:value="dict.label"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="manufacturer" label="生产厂家" show-overflow-tooltip align="center" min-width="200px">
|
||||
<template v-slot="{ row }">
|
||||
<span v-if="!row.isNew">{{ row.manufacturer }}</span>
|
||||
<el-select v-else v-model="row.manufacturerId" placeholder="请选择生产厂家" clearable style="width: 100%">
|
||||
<el-option v-for="item in manufacturerList" :key="item.id" :label="item.label" :value="item.id" />
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="productionDate" label="出厂日期" show-overflow-tooltip align="center" min-width="200px">
|
||||
<template v-slot="{ row }">
|
||||
<span v-if="!row.isNew">{{ row.productionDate }}</span>
|
||||
<el-date-picker
|
||||
v-else
|
||||
v-model="row.productionDate"
|
||||
type="date"
|
||||
placeholder="请选择出厂日期"
|
||||
value-format="yyyy-MM-dd"
|
||||
style="width: 100%"
|
||||
:picker-options="{
|
||||
disabledDate(time) {
|
||||
return time.getTime() > Date.now()
|
||||
},
|
||||
}"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="purchaseDate" label="采购日期" align="center" min-width="200px">
|
||||
<template v-slot="{ row }">
|
||||
<span v-if="!row.isNew">{{ row.purchaseDate }}</span>
|
||||
<el-date-picker
|
||||
v-else
|
||||
v-model="row.purchaseDate"
|
||||
type="date"
|
||||
placeholder="请选择采购日期"
|
||||
value-format="yyyy-MM-dd"
|
||||
style="width: 100%"
|
||||
:picker-options="{
|
||||
disabledDate(time) {
|
||||
return time.getTime() > Date.now()
|
||||
},
|
||||
}"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="originalValue"
|
||||
label="资产原值(万元)"
|
||||
show-overflow-tooltip
|
||||
align="center"
|
||||
min-width="100"
|
||||
/>
|
||||
<el-table-column prop="maxServiceLifeYears" label="最大使用年限(年)" align="center" />
|
||||
<el-table-column prop="nextMaintenanceDate" label="下次维保日期" align="center" />
|
||||
<el-table-column prop="province" label="所属省份" show-overflow-tooltip align="center" min-width="100" />
|
||||
<el-table-column prop="appearanceImages" label="装备外观" show-overflow-tooltip align="center" min-width="100">
|
||||
min-width="200px"
|
||||
>
|
||||
<template v-slot="{ row }">
|
||||
<span style="color: #00a288; cursor: pointer" @click="handleView(row, 1)">查看</span>
|
||||
<span v-if="!row.isNew">{{ row.originalValue }}</span>
|
||||
<el-input
|
||||
v-else
|
||||
maxlength="20"
|
||||
v-model="row.originalValue"
|
||||
placeholder="请输入资产原值(万元)"
|
||||
clearable
|
||||
@input="(val) => handlePriceInput(val, row)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="certificates" label="合格证" show-overflow-tooltip align="center" min-width="100">
|
||||
<el-table-column prop="maxServiceLifeYears" label="最大使用年限(年)" align="center" min-width="200px">
|
||||
<template v-slot="{ row }">
|
||||
<span style="color: #00a288; cursor: pointer" @click="handleView(row, 2)">查看</span>
|
||||
<span v-if="!row.isNew">{{ row.maxServiceLifeYears }}</span>
|
||||
<el-input-number
|
||||
v-else
|
||||
clearable
|
||||
maxlength="20"
|
||||
placeholder="请输入最大使用年限"
|
||||
v-model="row.maxServiceLifeYears"
|
||||
:min="1"
|
||||
:max="100"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="nextMaintenanceDate" label="下次维保日期" align="center" min-width="200px">
|
||||
<template v-slot="{ row }">
|
||||
<span v-if="!row.isNew">{{ row.nextMaintenanceDate }}</span>
|
||||
<el-date-picker
|
||||
v-else
|
||||
v-model="row.nextMaintenanceDate"
|
||||
type="date"
|
||||
placeholder="请选择下次维保日期"
|
||||
value-format="yyyy-MM-dd"
|
||||
style="width: 100%"
|
||||
:picker-options="{
|
||||
disabledDate(time) {
|
||||
return time.getTime() < Date.now()
|
||||
},
|
||||
}"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="province" label="所属省份" show-overflow-tooltip align="center" min-width="200px" />
|
||||
<el-table-column
|
||||
prop="appearanceImages"
|
||||
label="装备外观"
|
||||
show-overflow-tooltip
|
||||
align="center"
|
||||
min-width="200px"
|
||||
>
|
||||
<template v-slot="{ row }">
|
||||
<span style="color: #00a288; cursor: pointer" v-if="row.isNew" @click="handleFileUpload(row, 1)">上传</span>
|
||||
<span style="color: #00a288; cursor: pointer; margin-left: 10px" @click="handleView(row, 1)">查看</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="certificates" label="合格证" show-overflow-tooltip align="center" min-width="200px">
|
||||
<template v-slot="{ row }">
|
||||
<span style="color: #00a288; cursor: pointer" v-if="row.isNew" @click="handleFileUpload(row, 2)">上传</span>
|
||||
<span style="color: #00a288; cursor: pointer; margin-left: 10px" @click="handleView(row, 2)">查看</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
|
|
@ -230,15 +387,23 @@
|
|||
label="定期检验报告"
|
||||
show-overflow-tooltip
|
||||
align="center"
|
||||
min-width="100"
|
||||
min-width="200px"
|
||||
>
|
||||
<template v-slot="{ row }">
|
||||
<span style="color: #00a288; cursor: pointer" @click="handleView(row, 3)">查看</span>
|
||||
<span style="color: #00a288; cursor: pointer" v-if="row.isNew" @click="handleFileUpload(row, 3)">上传</span>
|
||||
<span style="color: #00a288; cursor: pointer; margin-left: 10px" @click="handleView(row, 3)">查看</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="purchaseInvoices" label="采购发票" show-overflow-tooltip align="center" min-width="100">
|
||||
<el-table-column
|
||||
prop="purchaseInvoices"
|
||||
label="采购发票"
|
||||
show-overflow-tooltip
|
||||
align="center"
|
||||
min-width="200px"
|
||||
>
|
||||
<template v-slot="{ row }">
|
||||
<span style="color: #00a288; cursor: pointer" @click="handleView(row, 4)">查看</span>
|
||||
<span style="color: #00a288; cursor: pointer" v-if="row.isNew" @click="handleFileUpload(row, 4)">上传</span>
|
||||
<span style="color: #00a288; cursor: pointer; margin-left: 10px" @click="handleView(row, 4)">查看</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
|
|
@ -249,11 +414,55 @@
|
|||
show-overflow-tooltip
|
||||
:label="item.label"
|
||||
:prop="item.prop"
|
||||
min-width="200px"
|
||||
>
|
||||
<template v-slot="{ row }" v-if="/^feature(Item|Value)\d+$/.test(item.prop)">
|
||||
<span>
|
||||
{{ getFeatureValue(row, item.prop) }}
|
||||
</span>
|
||||
<div
|
||||
v-if="
|
||||
(index + 1) % 2 === 0 &&
|
||||
row.isNew &&
|
||||
row.propertyVoList.length > 0 &&
|
||||
row.propertyVoList[(index + 1) / 2 - 1]
|
||||
"
|
||||
>
|
||||
<el-input
|
||||
v-if="row.propertyVoList[(index + 1) / 2 - 1].inputType == 1"
|
||||
autocomplete="off"
|
||||
maxlength="30"
|
||||
v-model="row.propertyVoList[(index + 1) / 2 - 1].propertyValue"
|
||||
clearable
|
||||
/>
|
||||
<el-select
|
||||
v-if="row.propertyVoList[(index + 1) / 2 - 1].inputType == 2"
|
||||
v-model="row.propertyVoList[(index + 1) / 2 - 1].propertyValue"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in row.propertyVoList[(index + 1) / 2 - 1].valueList"
|
||||
:key="index"
|
||||
:label="item.value"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<el-select
|
||||
v-if="row.propertyVoList[(index + 1) / 2 - 1].inputType == 3"
|
||||
v-model="row.propertyVoList[(index + 1) / 2 - 1].propertyValues"
|
||||
placeholder="请选择"
|
||||
multiple
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item2, index) in row.propertyVoList[(index + 1) / 2 - 1].valueList2"
|
||||
:key="index"
|
||||
:label="item2.value"
|
||||
:value="item2.value"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
<span v-else>{{ getFeatureValue(row, item.prop) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column
|
||||
|
|
@ -262,7 +471,7 @@
|
|||
show-overflow-tooltip
|
||||
align="center"
|
||||
fixed="right"
|
||||
min-width="100"
|
||||
min-width="200px"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="orderCreateTime"
|
||||
|
|
@ -270,7 +479,7 @@
|
|||
show-overflow-tooltip
|
||||
align="center"
|
||||
fixed="right"
|
||||
min-width="100"
|
||||
min-width="200px"
|
||||
/> -->
|
||||
<el-table-column
|
||||
prop="entryStatus"
|
||||
|
|
@ -278,7 +487,7 @@
|
|||
show-overflow-tooltip
|
||||
label="审批状态"
|
||||
fixed="right"
|
||||
min-width="100"
|
||||
min-width="200px"
|
||||
>
|
||||
<template slot-scope="{ row }">
|
||||
<el-tag v-if="row.entryStatus == 0" size="small" type="warning">待审批</el-tag>
|
||||
|
|
@ -288,13 +497,26 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" min-width="300" fixed="right">
|
||||
<template slot-scope="{ row }">
|
||||
<el-button type="text" @click="handleViewDetail(row)"> <i class="el-icon-view"></i> 查看 </el-button>
|
||||
<el-button type="text" @click="editRowInfo(row)" v-if="row.orderStatus == '3' && !isAddVisible">
|
||||
<i class="el-icon-edit"></i> 编辑
|
||||
<template slot-scope="{ row, $index }">
|
||||
<el-button v-if="!row.isNew" type="text" icon="el-icon-view" @click="handleViewDetail(row)">
|
||||
查看
|
||||
</el-button>
|
||||
<el-button type="text" @click="deleteRowInfo(row)" v-if="row.orderStatus == '3' && !isAddVisible">
|
||||
<i class="el-icon-delete"></i> 删除
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="editRowInfo(row)"
|
||||
v-if="row.orderStatus == '3' && !isAddVisible"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button type="text" icon="el-icon-edit" @click="submitRow(row)" v-if="row.isNew"> 保存 </el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="deleteRowInfo(row, $index)"
|
||||
v-if="(row.orderStatus == '3' && !isAddVisible) || row.isNew"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -314,6 +536,21 @@
|
|||
:is-view="isViewMode"
|
||||
@getOrderId="getOrderId"
|
||||
/>
|
||||
<!-- 图片上传 -->
|
||||
<el-dialog :title="uploadTitle" :visible.sync="uploadVisible" width="40%">
|
||||
<FileUpload
|
||||
v-model="fileList"
|
||||
:value="fileList"
|
||||
:limit="uploadLimit"
|
||||
:fileSize="fileSize"
|
||||
:fileType="uploadFileType"
|
||||
@input="handleFileList"
|
||||
/>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="uploadVisible = false">关 闭</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<!-- 弹框 -->
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="40%">
|
||||
<el-table :data="dialogList" fit highlight-current-row style="width: 100%" height="546">
|
||||
|
|
@ -374,14 +611,22 @@ import {
|
|||
equipmentSubmitApiNew,
|
||||
removeDeviceApi,
|
||||
getEquipmentAddIdApi,
|
||||
addInterDevice,
|
||||
equipmentEditApiNew,
|
||||
firstLevel,
|
||||
secondAndThirdLevel,
|
||||
fourthToSixthLevel,
|
||||
getEquipmentPropertyTypeApi,
|
||||
} from '@/api/EquipmentEntryApply'
|
||||
import { getManufacturerSelectApi } from '@/api/EquipmentLedger/index.js'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import FileUpload from '@/components/FileImageUpload'
|
||||
|
||||
export default {
|
||||
name: 'EquipmentInput',
|
||||
components: { EquipmentEntryEditDialog },
|
||||
components: { EquipmentEntryEditDialog, FileUpload },
|
||||
emits: ['update:isVisible', 'submit'], // 声明事件
|
||||
dicts: ['dev_unit_type'],
|
||||
created() {
|
||||
console.log('🚀 ~ this.$route:', this.$route)
|
||||
this.orderId = this.$route.query && this.$route.query.orderId
|
||||
|
|
@ -440,8 +685,16 @@ export default {
|
|||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
currentRow: null,
|
||||
uploadType: 1, // 1:装备外观,2:合格证,3:定期检验报告,4:采购发票
|
||||
uploadVisible: false,
|
||||
uploadTitle: '',
|
||||
uploadLimit: 3,
|
||||
fileSize: 10,
|
||||
uploadFileType: ['jpg', 'png', 'pdf'],
|
||||
fileList: null,
|
||||
orderNumber: '',
|
||||
manufacturerList: [],
|
||||
manufacturerList: [], // 生产厂家列表
|
||||
// 可添加表单数据
|
||||
formData: {
|
||||
// 示例字段,可根据实际需求修改
|
||||
|
|
@ -578,14 +831,22 @@ export default {
|
|||
},
|
||||
|
||||
// 删除按钮
|
||||
async deleteRowInfo(row) {
|
||||
async deleteRowInfo(row, index) {
|
||||
this.$confirm('是否确定删除?', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(() => {
|
||||
return removeDeviceApi([row.maId])
|
||||
if (row.maId) {
|
||||
return removeDeviceApi([row.maId])
|
||||
} else {
|
||||
this.tableData.splice(index, 1)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功',
|
||||
})
|
||||
}
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 200) {
|
||||
|
|
@ -729,6 +990,79 @@ export default {
|
|||
}
|
||||
this.dialogVisible = true
|
||||
},
|
||||
// 上传
|
||||
handleFileUpload(row, type) {
|
||||
this.uploadType = type
|
||||
this.currentRow = row
|
||||
if (type == 1) {
|
||||
this.uploadTitle = '装备外观'
|
||||
this.fileList = row.fileList1
|
||||
this.uploadLimit = 6
|
||||
this.fileSize = 5
|
||||
this.uploadFileType = ['jpg', 'png', 'jpeg']
|
||||
} else if (type == 2) {
|
||||
this.uploadTitle = '合格证'
|
||||
this.fileList = row.fileList2
|
||||
this.uploadLimit = 3
|
||||
this.fileSize = 10
|
||||
this.uploadFileType = ['jpg', 'png', 'pdf']
|
||||
} else if (type == 3) {
|
||||
this.uploadTitle = '定期检验报告'
|
||||
this.fileList = row.fileList3
|
||||
this.uploadLimit = 3
|
||||
this.fileSize = 10
|
||||
this.uploadFileType = ['jpg', 'png', 'pdf']
|
||||
} else if (type == 4) {
|
||||
this.uploadTitle = '采购发票'
|
||||
this.fileList = row.fileList4
|
||||
this.uploadLimit = 3
|
||||
this.fileSize = 10
|
||||
this.uploadFileType = ['jpg', 'png', 'pdf']
|
||||
}
|
||||
this.uploadVisible = true
|
||||
},
|
||||
handleFileList(file) {
|
||||
console.log('🚀 ~ file:', file)
|
||||
if (this.uploadType == 1) {
|
||||
this.currentRow.fileList1 = file
|
||||
if (!file) {
|
||||
this.currentRow.appearanceImages = []
|
||||
return
|
||||
}
|
||||
this.currentRow.appearanceImages = this.formatFileList(file)
|
||||
} else 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,
|
||||
}
|
||||
})
|
||||
},
|
||||
importTemplate() {
|
||||
this.download('/material-mall/order/template', {}, `装备信息导入模板_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
|
|
@ -746,6 +1080,7 @@ export default {
|
|||
})
|
||||
}
|
||||
const newRow = {
|
||||
isNew: true, // 标记为新行
|
||||
orderNumber: this.orderNumber,
|
||||
major: '', // 专业
|
||||
process: [], // 工序
|
||||
|
|
@ -767,12 +1102,199 @@ export default {
|
|||
inspectionReports: [], // 检测证书
|
||||
purchaseInvoices: [], // 采购发票
|
||||
propertyVoList: [], // 特征属性
|
||||
|
||||
majorList: [], // 专业列表
|
||||
processList: [], // 工序列表
|
||||
categoryList: [], // 类目列表
|
||||
manufacturerList: [], // 生产厂家列表
|
||||
fileList1: null, // 装备图片
|
||||
fileList2: null, // 合格证
|
||||
fileList3: null, // 检测证书
|
||||
fileList4: null, // 采购发票
|
||||
}
|
||||
await this.getFirstLevel(newRow)
|
||||
this.tableData.unshift(newRow)
|
||||
console.log('🚀 ~ this.tableData:', this.tableData)
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ error:', error)
|
||||
}
|
||||
},
|
||||
// 转换为树形结构
|
||||
convertToSubTree(list) {
|
||||
const map = {}
|
||||
const tree = []
|
||||
|
||||
// 构建节点映射
|
||||
list.forEach((item) => {
|
||||
map[item.value] = {
|
||||
value: item.value.toString(),
|
||||
label: item.label,
|
||||
}
|
||||
})
|
||||
|
||||
// 构建树形关系
|
||||
list.forEach((item) => {
|
||||
const current = map[item.value]
|
||||
const parent = map[item.parentId]
|
||||
|
||||
if (parent) {
|
||||
if (!parent.children) {
|
||||
parent.children = []
|
||||
}
|
||||
parent.children.push(current)
|
||||
} else {
|
||||
tree.push(current)
|
||||
}
|
||||
})
|
||||
|
||||
return tree
|
||||
},
|
||||
getFirstLevel(row) {
|
||||
console.log('🚀 ~ row:', row)
|
||||
firstLevel().then((res) => {
|
||||
if (res.code === 200) {
|
||||
row.majorList = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
majorChange(item, row) {
|
||||
console.log('🚀 ~ item, row:', item, row)
|
||||
if (!item) {
|
||||
row.processList = []
|
||||
row.process = []
|
||||
} else {
|
||||
secondAndThirdLevel({ firstLevelId: item }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
row.processList = this.convertToSubTree(res.data)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
processChange(item, row) {
|
||||
console.log('🚀 ~ processChange ~ item:', item)
|
||||
if (item.length === 0) {
|
||||
row.categoryList = []
|
||||
row.category = []
|
||||
} else {
|
||||
fourthToSixthLevel({ thirdLevelId: item[item.length - 1] }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
row.categoryList = this.convertToSubTree(res.data)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
categoryChange(item, row) {
|
||||
console.log('🚀 ~ processChange ~ item:', item)
|
||||
row.propertyVoList = []
|
||||
this.getPropertyVoList(item[item.length - 1], row)
|
||||
},
|
||||
// 获取特征值
|
||||
async getPropertyVoList(typeId, row) {
|
||||
try {
|
||||
const res = await getEquipmentPropertyTypeApi(typeId)
|
||||
console.log('特征值-->:', res)
|
||||
row.propertyVoList = res.data || []
|
||||
row.propertyVoList.forEach((item) => {
|
||||
if (item.inputType == 2) {
|
||||
item.valueList = this.handleData(item.value)
|
||||
}
|
||||
if (item.inputType == 3) {
|
||||
item.valueList2 = this.handleData(item.value)
|
||||
// item.propertyValues = null
|
||||
this.$set(item, 'propertyValues', null)
|
||||
}
|
||||
})
|
||||
console.log('🚀 ~ row.propertyVoList:', row.propertyVoList)
|
||||
} catch (error) {
|
||||
console.log('获取特征值失败:', error)
|
||||
}
|
||||
},
|
||||
// 价格输入处理
|
||||
handlePriceInput(v, row) {
|
||||
row.originalValue = row.originalValue
|
||||
.replace(/[^\d.]/g, '') // 删除所有非数字和点
|
||||
.replace(/\.{2,}/g, '.') // 多个点 -> 单点
|
||||
.replace(/^(\d+)\.(.*)\./, '$1.$2') // 只允许一个点
|
||||
},
|
||||
submitRow(row) {
|
||||
console.log('🚀 ~ row:', row)
|
||||
try {
|
||||
row.orderId = this.orderId
|
||||
row.typeId = row.category.length > 0 ? row.category[row.category.length - 1] : null
|
||||
// 校验必填项
|
||||
if (!row.major) return this.$message.warning(`请选择专业`)
|
||||
if (row.process.length == 0) return this.$message.warning(`请选择工序`)
|
||||
if (row.category.length == 0) return this.$message.warning(`请选择类目`)
|
||||
if (!row.name) return this.$message.warning(`请填写装备名称`)
|
||||
if (!row.specificationModel) return this.$message.warning(`请填写规格型号`)
|
||||
if (!row.originalCode) return this.$message.warning(`请填写装备原始编码`)
|
||||
if (!row.unit) return this.$message.warning(`请选择计量单位`)
|
||||
if (!row.manufacturerId) return this.$message.warning(`请选择生产厂家`)
|
||||
if (!row.productionDate) return this.$message.warning(`请选择出厂日期`)
|
||||
if (!row.purchaseDate) return this.$message.warning(`请选择采购日期`)
|
||||
if (!row.originalValue) return this.$message.warning(`请填写资产原值`)
|
||||
if (!row.maxServiceLifeYears) return this.$message.warning(`请填写最大使用年限`)
|
||||
if (!row.nextMaintenanceDate) return this.$message.warning(`请选择下次维保日期`)
|
||||
if (row.appearanceImages.length == 0) return this.$message.warning(`请上传装备外观`)
|
||||
if (row.certificates.length == 0) return this.$message.warning(`请上传合格证`)
|
||||
if (row.inspectionReports.length == 0) return this.$message.warning(`请上传定期检验报告`)
|
||||
|
||||
row.propertyVoList.forEach((item) => {
|
||||
if (item.inputType == 3 && Array.isArray(item.propertyValues)) {
|
||||
item.propertyValue = item.propertyValues.join(',')
|
||||
}
|
||||
})
|
||||
// 判断特征项是否填写
|
||||
if (row.propertyVoList && row.propertyVoList.length > 0) {
|
||||
const unfilledIndex = row.propertyVoList.findIndex(
|
||||
(item) => (!item.propertyValue || item.propertyValue === '') && item.mustHave != '0',
|
||||
)
|
||||
|
||||
if (unfilledIndex !== -1) {
|
||||
this.$message.warning(`第 ${unfilledIndex + 1} 个特征项为必填项,请填写完整`)
|
||||
return
|
||||
}
|
||||
}
|
||||
console.log('🚀 ~ row.propertyVoList:', row.propertyVoList)
|
||||
|
||||
// 二次确认
|
||||
this.$confirm('确定要提交吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}).then(async () => {
|
||||
if (this.isSubmit) return
|
||||
this.isSubmit = true
|
||||
const loading = this.$loading()
|
||||
try {
|
||||
if (row.maId) {
|
||||
await equipmentEditApiNew(row)
|
||||
} else {
|
||||
await addInterDevice(row)
|
||||
}
|
||||
this.getList()
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ error:', error)
|
||||
} finally {
|
||||
this.isSubmit = false
|
||||
loading.close()
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ error:', error)
|
||||
}
|
||||
},
|
||||
// 处理数据
|
||||
handleData(data) {
|
||||
console.log('处理数据:', data)
|
||||
if (!data) return []
|
||||
return data.split(',').map((item) => {
|
||||
return {
|
||||
label: item,
|
||||
value: item,
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
@ -885,4 +1407,7 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
::v-deep .el-input-number.is-without-controls .el-input__inner {
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Reference in New Issue