896 lines
38 KiB
Vue
896 lines
38 KiB
Vue
<template>
|
||
<div>
|
||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
|
||
<el-row>
|
||
<el-form-item label="退料单位" prop="backUnit">
|
||
<el-input v-model="queryParams.backUnit" placeholder="退料单位" clearable style="width: 240px" disabled/>
|
||
</el-form-item>
|
||
<el-form-item label="退料工程" prop="backPro">
|
||
<el-input v-model="queryParams.backPro" placeholder="退料工程" clearable style="width: 240px" disabled/>
|
||
</el-form-item>
|
||
<el-form-item label="维修单号" prop="repairCode">
|
||
<el-input v-model="queryParams.repairCode" placeholder="维修单号" clearable style="width: 240px" disabled/>
|
||
</el-form-item>
|
||
|
||
</el-row>
|
||
</el-form>
|
||
|
||
<el-row :gutter="10" class="mb8">
|
||
<el-col :span="1.5">
|
||
<el-button type="primary" plain icon="el-icon-back" size="mini" @click="goBack ">维修管理</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button type="success" plain icon="el-icon-plus" size="mini" @click="handleAdd">合格</el-button>
|
||
</el-col>
|
||
</el-row>
|
||
<el-table v-loading="loading" :data="equipmentList" @selection-change="handleSelectionChange">
|
||
<el-table-column type="selection" min-width="55" align="center" :selectable="selectable"/>
|
||
<el-table-column label="序号" type="index" align="center" min-width="80" />
|
||
<el-table-column label="类型名称" align="center" prop="typeName" :show-overflow-tooltip="true"/>
|
||
<el-table-column label="规格型号" align="center" prop="type" :show-overflow-tooltip="true"/>
|
||
<el-table-column label="计量单位" align="center" prop="unitName" />
|
||
<el-table-column label="退料数量" align="center" prop="repairNum" ></el-table-column>
|
||
<el-table-column label="已修数量" align="center" prop="repairedNum" ></el-table-column>
|
||
<el-table-column label="待修数量" align="center" prop="disrepairNum" ></el-table-column>
|
||
<el-table-column label="管理模式" align="center" prop="manageType">
|
||
<template slot-scope="scope">
|
||
<!-- 0编码1数量 -->
|
||
<div v-if="scope.row.manageType==0">编码管理</div>
|
||
<div v-if="scope.row.manageType==1">数量管理</div>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="操作" align="center" width="200px">
|
||
<template slot-scope="scope">
|
||
<el-button size="mini" type="warning" @click="handleRepair(scope.row)">维修</el-button>
|
||
<el-button size="mini" type="success" >合格</el-button>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
<!-- 编码维修 -->
|
||
<el-dialog title="编码维修" :visible.sync="openCode" width="1200px" append-to-body>
|
||
<el-row :gutter="10" class="mb8">
|
||
<el-col :span="1.5">
|
||
<el-button type="primary" size="mini">合格</el-button>
|
||
</el-col>
|
||
</el-row>
|
||
<el-table :data="repairDeviceList" width="100%" height="450px">
|
||
<el-table-column label="序号" type="index" width="55" align="center"/>
|
||
<el-table-column label="类型名称" prop="typeName" align="center" :show-overflow-tooltip="true"></el-table-column>
|
||
<el-table-column label="规格型号" prop="type" align="center" :show-overflow-tooltip="true"></el-table-column>
|
||
<el-table-column label="设备编码" prop="code" align="center" :show-overflow-tooltip="true"></el-table-column>
|
||
<el-table-column label="维修状态" prop="status" align="center" :show-overflow-tooltip="true">
|
||
<!-- <template slot-scope="scope">
|
||
<dict-tag :options="dict.type.ma_machine_status" :value="scope.row.maStatus"/>
|
||
</template> -->
|
||
</el-table-column>
|
||
<el-table-column label="配件信息" prop="partInfo" align="center" width="150" :show-overflow-tooltip="true"></el-table-column>
|
||
<el-table-column label="附件" align="center" width="100">
|
||
<template slot-scope="scope">
|
||
<div style="display: flex;align-items: center;justify-content: center;">
|
||
<el-upload ref="upload" :limit="1" :headers="upload.headers"
|
||
:action="upload.url" :show-file-list="false" accept=".png, .jpg, .jpeg, .pdf, .doc, .docx"
|
||
:on-success="handleFileSuccess2" :auto-upload="true">
|
||
<el-button size="mini" type="text" @click="beforeFileUpload(scope.row)">
|
||
上传
|
||
</el-button>
|
||
</el-upload>
|
||
<el-button size="mini" type="text" @click="picturePreview(scope.row)" v-if="scope.row.bmFileInfos&&scope.row.bmFileInfos.length>0">
|
||
查看
|
||
</el-button>
|
||
</div>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="操作" align="center" width="300px">
|
||
<template slot-scope="scope">
|
||
<el-button size="mini" type="warning" @click="openInnerDialog(scope.row)">内部维修</el-button>
|
||
<el-button size="mini" type="warning" @click="openBackDialog(scope.row)">返场维修</el-button>
|
||
<el-button size="mini" type="danger" @click="openScrapDialog(scope.row)">待报废</el-button>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
<div style="width: 100%;height: 50px;display: flex;justify-content: flex-end;align-items: center;">
|
||
<el-button type="primary" size="mini" @click="saveCodeDialog">保存</el-button>
|
||
<el-button type="normal" size="mini" @click="openCode=false">取消</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
<!-- 内部维修 -->
|
||
<el-dialog title="内部维修" :visible.sync="openInner" width="900px" append-to-body>
|
||
<el-row :gutter="18" class="mb8">
|
||
<el-col :span="12">
|
||
<div style="width: 100%;height: 100%;display: flex;align-items: center;">
|
||
<span style="width: 80px;">配件型号:</span>
|
||
<el-cascader v-model="partType"
|
||
:key="propsKey"
|
||
:show-all-levels="false"
|
||
:options="partTypeTree"
|
||
:props="partTypeTreeProps"
|
||
filterable
|
||
collapse-tags
|
||
style="width: 80%;"
|
||
placeholder="请选择规格型号"
|
||
ref="partTypeCascader"
|
||
popper-class="popper-select"
|
||
@change="partTypeChange"
|
||
></el-cascader>
|
||
</div>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button type="primary" size="mini" @click="resetInner">重置</el-button>
|
||
</el-col>
|
||
</el-row>
|
||
<el-table :data="partTableList" width="100%" height="450px">
|
||
<el-table-column label="序号" type="index" width="55" align="center"/>
|
||
<el-table-column label="配件名称" prop="typeName" align="center" :show-overflow-tooltip="true"></el-table-column>
|
||
<el-table-column label="规格型号" prop="typeCode" align="center" :show-overflow-tooltip="true"></el-table-column>
|
||
<el-table-column label="是否收费" prop="isCharge" align="center" :show-overflow-tooltip="true">
|
||
<template slot-scope="scope">
|
||
<el-select
|
||
v-model="scope.row.isCharge"
|
||
placeholder="是否收费"
|
||
filterable
|
||
clearable
|
||
>
|
||
<el-option label="是" value="1"></el-option>
|
||
<el-option label="否" value="0"></el-option>
|
||
</el-select>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="配件数量" prop="partNum" align="center" :show-overflow-tooltip="true">
|
||
<template slot-scope="scope">
|
||
<el-input
|
||
v-model.number="scope.row.partNum"
|
||
placeholder="配件数量"
|
||
type="number" min="1"
|
||
clearable style="width: 100%"
|
||
/>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="操作" align="center" width="120px">
|
||
<template slot-scope="scope">
|
||
<el-button size="mini" type="danger" @click="handleDeletePart({ ...scope.row, index: scope.$index })">删除</el-button>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
<div style="width: 100%;height: 50px;display: flex;justify-content: flex-end;align-items: center;">
|
||
<el-button type="primary" size="mini" @click="saveInnerDialog">保存</el-button>
|
||
<el-button type="normal" size="mini" @click="openInner=false">取消</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
<!-- 返场维修 -->
|
||
<el-dialog title="返场维修" :visible.sync="openBack" width="900px" append-to-body>
|
||
<el-form :model="backForm" ref="backForm" size="small" :rules="rules" :inline="true" label-width="100px">
|
||
<el-form-item label="物资厂家" prop="supplierId">
|
||
<el-select
|
||
v-model="backForm.supplierId"
|
||
placeholder="物资厂家"
|
||
clearable filterable style="width: 240px">
|
||
<el-option
|
||
v-for="item in supplierList"
|
||
:key="item.supplierId"
|
||
:label="item.supplier"
|
||
:value="item.supplierId" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="备注" prop="remark">
|
||
<el-input
|
||
v-model="backForm.remark"
|
||
placeholder="请输入备注"
|
||
clearable maxlength="150" type="textarea"
|
||
style="width: 240px" rows="1"/>
|
||
</el-form-item>
|
||
</el-form>
|
||
<el-table :data="backTableList" width="100%" height="450px">
|
||
<el-table-column label="序号" type="index" width="55" align="center"/>
|
||
<el-table-column label="配件名称" prop="partName" align="center" :show-overflow-tooltip="true">
|
||
<template v-slot="scope">
|
||
<el-input
|
||
v-model="scope.row.partName"
|
||
style="width: 100%" maxlength="20"></el-input>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="是否收费" prop="isCharge" align="center" :show-overflow-tooltip="true">
|
||
<template slot-scope="scope">
|
||
<el-select
|
||
v-model="scope.row.isCharge"
|
||
placeholder="是否收费"
|
||
filterable
|
||
clearable
|
||
>
|
||
<el-option label="是" value="1"></el-option>
|
||
<el-option label="否" value="0"></el-option>
|
||
</el-select>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="配件数量" prop="partNum" align="center" :show-overflow-tooltip="true">
|
||
<template v-slot="scope">
|
||
<el-input-number
|
||
v-model="scope.row.partNum"
|
||
controls-position="right"
|
||
style="width: 100%"
|
||
:min="0"
|
||
></el-input-number>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="维修金额" prop="backCost" align="center" :show-overflow-tooltip="true">
|
||
<template v-slot="scope">
|
||
<el-input-number
|
||
v-model="scope.row.backCost"
|
||
controls-position="right"
|
||
style="width: 100%"
|
||
:min="0"
|
||
></el-input-number>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="操作" align="center" width="80px">
|
||
<template slot-scope="scope">
|
||
<div style="width: 100%;height: 40px;display: flex;align-items: center;justify-content: space-between;">
|
||
<i class="el-icon-plus" style="font-size: 20px;color: blue;" @click="handleAddBack"></i>
|
||
<i class="el-icon-minus" style="font-size: 20px;color: red;" @click="handleDeleteBack({ ...scope.row, index: scope.$index })"></i>
|
||
</div>
|
||
<!-- <el-button size="mini" type="primary" @click="handleAddBack">添加</el-button>
|
||
<el-button size="mini" type="danger" @click="handleDeleteBack({ ...scope.row, index: scope.$index })">删除</el-button> -->
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
<div style="width: 100%;height: 50px;display: flex;justify-content: flex-end;align-items: center;">
|
||
<el-button type="primary" size="mini" @click="saveBackDialog">保存</el-button>
|
||
<el-button type="normal" size="mini" @click="openBack=false">取消</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
<!-- 待报废 -->
|
||
<el-dialog title="待报废" :visible.sync="openScrap" width="900px" append-to-body>
|
||
<div style="height: 300px;width: 100%;">
|
||
<el-form :model="scrapForm" ref="scrapForm" size="small" :rules="scrapRules" :inline="true" label-width="100px">
|
||
<el-form-item label="报废原因" prop="scrapReason">
|
||
<el-select
|
||
v-model="scrapForm.scrapReason"
|
||
placeholder="损坏原因"
|
||
clearable filterable style="width: 250px">
|
||
<el-option
|
||
v-for="item in damageReasonList"
|
||
:key="item.id"
|
||
:label="item.label"
|
||
:value="item.id" />
|
||
</el-select>
|
||
|
||
</el-form-item>
|
||
<el-form-item label="损坏原因" prop="damageReason">
|
||
<el-select
|
||
v-model="scrapForm.damageReason"
|
||
placeholder="损坏原因"
|
||
clearable filterable style="width: 250px">
|
||
<el-option
|
||
v-for="item in damageReasonList"
|
||
:key="item.id"
|
||
:label="item.label"
|
||
:value="item.id" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="其他原因" prop="remark">
|
||
<el-input
|
||
v-model="scrapForm.otherReason"
|
||
placeholder="请输入其他原因"
|
||
clearable maxlength="150" type="textarea"
|
||
style="width: 250px" rows="4"/>
|
||
</el-form-item>
|
||
<el-form-item label="照片" prop="picture">
|
||
<el-upload ref="upload" :limit="1" :headers="upload.headers" drag
|
||
:action="upload.url" :show-file-list="false" accept=".png, .jpg, .jpeg, .pdf, .doc, .docx"
|
||
:on-success="handleFileSuccess3" :auto-upload="true">
|
||
<i class="el-icon-upload"></i>
|
||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||
<!-- <div class="el-upload__tip" slot="tip">只能上传jpg/png文件,且不超过500kb</div> -->
|
||
</el-upload>
|
||
</el-form-item>
|
||
</el-form>
|
||
</div>
|
||
|
||
<div style="width: 100%;height: 50px;display: flex;justify-content: flex-end;align-items: center;">
|
||
<el-button type="primary" size="mini">保存</el-button>
|
||
<el-button type="normal" size="mini" @click="openScrap=false">取消</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
|
||
<!-- 图片查看弹窗 -->
|
||
<el-dialog :visible.sync="dialogVisible" width="500px" height="500px" >
|
||
<img width="100%" height="500px" :src="dialogImageUrl" />
|
||
</el-dialog>
|
||
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import { getListFacturer } from '@/api/ma/supplier';
|
||
|
||
import {
|
||
getAppRepairMaTypeList,
|
||
partTypeTreeList
|
||
} from '@/api/repair/repair.js'
|
||
|
||
import {
|
||
getProjectList,
|
||
getUnitList,
|
||
getAgreementInfoById,
|
||
getDeviceTreeByAgreementId,
|
||
addBackApply,
|
||
getBackApplyInfo,
|
||
editBackApply,
|
||
} from '@/api/back/index.js'
|
||
|
||
import { mapState } from 'vuex'
|
||
import { getInfo, h } from '@/api/login'
|
||
import { getToken } from '@/utils/auth'
|
||
export default {
|
||
name: '',
|
||
dicts: ['ma_machine_status'],
|
||
props: {
|
||
repairRow: {
|
||
type: [Object],
|
||
}
|
||
},
|
||
data() {
|
||
return {
|
||
// 遮罩层
|
||
loading: false,
|
||
// 选中数组
|
||
ids: [],
|
||
// 非单个禁用
|
||
single: true,
|
||
// 非多个禁用
|
||
multiple: true,
|
||
// 显示搜索条件
|
||
showSearch: true,
|
||
// 总条数
|
||
total: 0,
|
||
// 弹出层标题
|
||
title: '',
|
||
// 查询参数
|
||
queryParams: {
|
||
backUnit:"",
|
||
backPro:"",
|
||
repairCode:"",
|
||
equipmentList: [],
|
||
},
|
||
equipmentList: [],
|
||
|
||
//编码维修
|
||
openCode: false,
|
||
repairRowData:{},
|
||
repairDeviceList: [],//编码表格
|
||
//图片查看弹窗
|
||
dialogImageUrl: '',
|
||
dialogVisible: false,
|
||
fileData:{},
|
||
//上传
|
||
upload: {
|
||
// 设置上传的请求头部
|
||
headers: { Authorization: 'Bearer ' + getToken() },
|
||
// 上传的地址
|
||
url: process.env.VUE_APP_BASE_API + '/file/upload'
|
||
},
|
||
|
||
//内部维修
|
||
openInner: false,
|
||
innerRowData:{},
|
||
//配件表格数据
|
||
partTableList:[],
|
||
//选中的配件
|
||
partType: null,
|
||
// 配件树结构数据
|
||
partTypeTree: [],
|
||
// 配件树配置
|
||
partTypeTreeProps: {
|
||
children: 'children',
|
||
label: 'label',
|
||
// multiple: false,
|
||
value: 'id',
|
||
multiple: true,
|
||
},
|
||
propsKey: 1000,
|
||
|
||
//返场维修
|
||
openBack: false,
|
||
backRowData:{},
|
||
//表格数据
|
||
backTableList:[],
|
||
backForm:{
|
||
//返场厂家
|
||
supplierId:null,
|
||
//备注
|
||
remark:"",
|
||
},
|
||
rules: {
|
||
supplierId: [
|
||
{
|
||
required: true,
|
||
message: '请选择厂家',
|
||
trigger: 'change',
|
||
},
|
||
],
|
||
remark: [
|
||
{
|
||
required: true,
|
||
message: '请填写备注',
|
||
trigger: 'blur',
|
||
},
|
||
],
|
||
},
|
||
//厂商下拉选
|
||
supplierList:[],
|
||
|
||
//待报废
|
||
openScrap: false,
|
||
scrapRowData:{},
|
||
scrapForm:{
|
||
scrapReason:"",
|
||
damageReason:"",
|
||
otherReason:"",
|
||
fileName:"",
|
||
fileUrl:"",
|
||
},
|
||
damageReasonList:[{label:"自然损坏",id:"自然损坏"},{label:"人为损坏",id:"人为损坏"}],//自然损坏、人为损坏
|
||
scrapRules:{
|
||
|
||
},
|
||
//树状勾选
|
||
deviceTypeTree: [], // 设备 树结构数据
|
||
// 设备 树显示 配置
|
||
deviceTypeTreeProps: {
|
||
children: 'children',
|
||
label: 'label',
|
||
// multiple: false,
|
||
value: 'id',
|
||
multiple: true,
|
||
},
|
||
// 选中的设备类型
|
||
deviceType: null,
|
||
companyId: '',
|
||
createBy: '',
|
||
}
|
||
},
|
||
mounted() {
|
||
console.log(this.repairRow)
|
||
this.GetViewByApply()
|
||
this.supplierInfoList()
|
||
// getInfo().then((res) => {
|
||
// this.companyId = res.user.companyId
|
||
// this.createBy = res.user.userName
|
||
// })
|
||
},
|
||
computed: {
|
||
...mapState(['user']),
|
||
},
|
||
methods: {
|
||
goBack(){
|
||
this.$emit('goBackPage')
|
||
},
|
||
// 获取 任务详情数据
|
||
async GetViewByApply() {
|
||
console.log(this.repairRow)
|
||
this.queryParams.backUnit = this.repairRow.backUnit
|
||
this.queryParams.backPro = this.repairRow.backPro
|
||
this.queryParams.repairCode = this.repairRow.repairCode
|
||
let param = {
|
||
taskId:this.repairRow.taskId,
|
||
keyword:""
|
||
}
|
||
console.log(param)
|
||
const res = await getAppRepairMaTypeList(param)
|
||
console.log(res)
|
||
this.equipmentList = res.data
|
||
this.equipmentList.forEach((e) => {
|
||
e.disrepairNum=Number(e.repairNum)-Number(e.repairedNum)
|
||
})
|
||
// this.equipmentList = [
|
||
// {
|
||
// typeName:"牵引机",
|
||
// typeModel:"90kN",
|
||
// unitName:"台",
|
||
// preNum:"10",
|
||
// num1:"0",
|
||
// num2:"10",
|
||
// manageType:"0"
|
||
// },
|
||
// {
|
||
// typeName:"单轮滑车",
|
||
// typeModel:"φ508",
|
||
// unitName:"台",
|
||
// preNum:"100",
|
||
// num1:"0",
|
||
// num2:"100",
|
||
// manageType:"1"
|
||
// },
|
||
// ]
|
||
|
||
// this.GetDeviceTypeTreeFn(data.backApplyInfo.agreementId)
|
||
},
|
||
// 多选框选中数据
|
||
handleSelectionChange(selection) {
|
||
this.queryParams.equipmentList = selection
|
||
},
|
||
/** 批量合格按钮操作 */
|
||
handleAdd() {
|
||
if (this.queryParams.equipmentList.length == 0) {
|
||
this.$message.error('请先勾选数据')
|
||
return
|
||
}
|
||
console.log(this.queryParams)
|
||
// this.queryParams.backApplyInfo = {
|
||
// remark: this.queryParams.remark,
|
||
// agreementId: this.queryParams.agreementId,
|
||
// backTime: this.queryParams.backTime,
|
||
// }
|
||
// let params = {
|
||
// backApplyInfo: this.queryParams.backApplyInfo,
|
||
// backApplyDetailsList:
|
||
// this.queryParams.equipmentList,
|
||
// }
|
||
// const res = await editBackApply(params)
|
||
// if (res.code == 200) {
|
||
// this.$message({ type: 'success', message: res.msg })
|
||
// setTimeout(() => {
|
||
// this.$emit('goBackPage')
|
||
// }, 1000)
|
||
// }
|
||
},
|
||
//是否可用勾选框
|
||
selectable(row) {
|
||
// console.log(row)
|
||
// if (row.preNum != 0) {
|
||
return true
|
||
// } else {
|
||
// return false
|
||
// }
|
||
},
|
||
checkNum(row) {
|
||
// let maxNum = row.num
|
||
// if (row.preNum <= 1) {
|
||
// row.preNum = 1
|
||
// } else if (row.preNum >= maxNum) {
|
||
// row.preNum = maxNum
|
||
// }
|
||
},
|
||
/** 删除按钮操作 */
|
||
// handleDelete(row) {
|
||
// this.$modal
|
||
// .confirm('是否确认删除所选择的数据项?')
|
||
// .then(() => {
|
||
// this.deviceType.forEach((e, index) => {
|
||
// if (e[3] === row.typeId) {
|
||
// this.deviceType.splice(index, 1)
|
||
// this.propsKey++
|
||
// }
|
||
// })
|
||
// this.equipmentList.forEach((item, index) => {
|
||
// if (item.id == row.id) {
|
||
// this.equipmentList.splice(index, 1)
|
||
// }
|
||
// })
|
||
// })
|
||
// .catch(() => {})
|
||
// // this.equipmentList.splice(row.index, 1)
|
||
// },
|
||
|
||
//编码类型-弹窗
|
||
|
||
/** 编码维修按钮操作 */
|
||
handleRepair(row){
|
||
this.repairRowData=row;
|
||
this.repairDeviceList=[]
|
||
// this.repairRowData.repairDeviceList=[
|
||
// {
|
||
// materialName:"速差自控器",
|
||
// typeName:"G-J-10",
|
||
// maId:"1",
|
||
// maCode:"W202407-00001",
|
||
// maStatus:"待修",
|
||
// apDetection:"",
|
||
// partTableList:[],
|
||
// backTableList:[],
|
||
// bmFileInfos:[]
|
||
// },
|
||
// {
|
||
// materialName:"速差自控器",
|
||
// typeName:"G-J-10",
|
||
// maId:"2",
|
||
// maCode:"W202407-00002",
|
||
// maStatus:"待修",
|
||
// apDetection:"",
|
||
// partTableList:[],
|
||
// backTableList:[],
|
||
// bmFileInfos:[]
|
||
// },
|
||
// {
|
||
// materialName:"速差自控器",
|
||
// typeName:"G-J-10",
|
||
// maId:"3",
|
||
// maCode:"W202407-00003",
|
||
// maStatus:"待修",
|
||
// apDetection:"",
|
||
// partTableList:[],
|
||
// backTableList:[],
|
||
// bmFileInfos:[]
|
||
// },
|
||
// ]
|
||
if(this.repairRowData.repairDeviceList&&this.repairRowData.repairDeviceList.length>0){
|
||
this.repairDeviceList = this.repairRowData.repairDeviceList
|
||
}
|
||
this.openCode=true;
|
||
},
|
||
// 编码维修弹窗保存
|
||
saveCodeDialog(){
|
||
console.log(this.repairRowData)
|
||
console.log(this.repairDeviceList)
|
||
this.repairRowData.repairDeviceList = this.repairDeviceList;
|
||
this.openCode=false
|
||
// console.log(this.equipmentList)
|
||
},
|
||
//编码维修弹窗文件上传前
|
||
beforeFileUpload(row){
|
||
this.fileData = row
|
||
},
|
||
// 编码维修弹窗文件上传成功处理-编码弹窗上传
|
||
handleFileSuccess2(response, file, fileList) {
|
||
if(response.code==200){
|
||
let obj = {
|
||
"name": response.data.name,
|
||
"url": response.data.url,
|
||
}
|
||
let index = this.repairDeviceList.findIndex(v=>v.maCode==this.fileData.maCode)
|
||
this.repairDeviceList[index].bmFileInfos=[obj]
|
||
}
|
||
},
|
||
//维修弹窗图片查看
|
||
picturePreview(row) {
|
||
console.log(row)
|
||
console.log(row.bmFileInfos)
|
||
if(row.bmFileInfos.length>0){
|
||
let file = row.bmFileInfos[0]
|
||
this.dialogImageUrl = file.url;
|
||
const parts = file.name.split('.');
|
||
const extension = parts.pop();
|
||
if(extension === 'doc'||extension === 'docx'||extension === 'pdf'){
|
||
const windowName = file.name;
|
||
window.open(file.url,windowName)
|
||
}else{
|
||
this.dialogVisible = true
|
||
}
|
||
}
|
||
},
|
||
|
||
//内部维修
|
||
openInnerDialog(row){
|
||
this.innerRowData = row;
|
||
this.partTableList=[]
|
||
if(this.innerRowData.partTableList&&this.innerRowData.partTableList.length>0){
|
||
this.partTableList = this.innerRowData.partTableList
|
||
}
|
||
this.getPartTypeTreeData()
|
||
this.openInner=true;
|
||
},
|
||
//内部维修-配件树
|
||
async getPartTypeTreeData() {
|
||
const params = {}
|
||
const res = await partTypeTreeList(params)
|
||
console.log('treeData==========', res)
|
||
this.partTypeTree = res.data;
|
||
//反显
|
||
let selectList = []
|
||
this.partTableList.forEach((e) => {
|
||
selectList.push(this.getSelectId(this.partTypeTree, e.id))
|
||
})
|
||
this.partType = selectList
|
||
this.$forceUpdate()
|
||
},
|
||
//内部维修- 反显 树结构数据获取父
|
||
getSelectId(list, id) {
|
||
for (let i in list) {
|
||
if (list[i].id == id) {
|
||
//查询到就返回该数组对象的value
|
||
return [list[i].id]
|
||
}
|
||
if (list[i].children) {
|
||
let node = this.getSelectId(list[i].children, id)
|
||
if (node !== undefined) {
|
||
//查询到把父节把父节点加到数组前面
|
||
node.unshift(list[i].id)
|
||
return node
|
||
}
|
||
}
|
||
}
|
||
},
|
||
//内部维修- 切换 设备类型树
|
||
async partTypeChange(val) {
|
||
const partTypeList =
|
||
this.$refs.partTypeCascader.getCheckedNodes()
|
||
console.log(partTypeList)
|
||
let tempList = []
|
||
if (val.length > 0) {
|
||
const items = val.map((e) => {
|
||
return e[2]
|
||
})
|
||
for (let i of items) {
|
||
for (let z of partTypeList) {
|
||
if (z.data.id === i) {
|
||
const parent = z.parent
|
||
console.log(parent)
|
||
const obj = JSON.parse(JSON.stringify(z.data))
|
||
console.log(obj)
|
||
obj.typeCode = obj.label
|
||
obj.typeName = parent.label
|
||
obj.isCharge = "0"
|
||
obj.partNum = 1
|
||
console.log(obj)
|
||
tempList.push(obj)
|
||
break
|
||
}
|
||
}
|
||
}
|
||
const newDataListNew = [...this.partTableList, ...tempList]
|
||
const map = new Map()
|
||
for (let item of newDataListNew) {
|
||
if (!map.has(item.id)) {
|
||
map.set(item.id, item)
|
||
}
|
||
}
|
||
const newArray = [...map.values()]
|
||
let newArray_array = []
|
||
items.forEach((e) => {
|
||
newArray.forEach((j) => {
|
||
if (e == j.id) {
|
||
newArray_array.push(j)
|
||
}
|
||
})
|
||
})
|
||
this.partTableList = newArray_array
|
||
} else {
|
||
this.partTableList = []
|
||
}
|
||
},
|
||
//内部维修- 重置按钮操作
|
||
resetInner(){
|
||
this.partType=[]
|
||
this.partTableList=[]
|
||
},
|
||
//内部维修- 删除
|
||
handleDeletePart(row){
|
||
this.partType.forEach((e, index) => {
|
||
if (e[2] === row.id) {
|
||
this.partType.splice(index, 1)
|
||
this.propsKey++
|
||
}
|
||
})
|
||
this.partTableList.forEach((item, index) => {
|
||
if (item.id == row.id) {
|
||
this.partTableList.splice(index, 1)
|
||
}
|
||
})
|
||
},
|
||
//内部维修- 弹窗保存
|
||
saveInnerDialog(){
|
||
console.log(this.innerRowData)
|
||
console.log(this.partTableList)
|
||
const isNum = this.partTableList.some((item) => item.partNum == 0 || item.partNum == undefined,)
|
||
if (isNum) {
|
||
this.$message.error('配件数量不能为0!')
|
||
return
|
||
}
|
||
this.innerRowData.partTableList = this.partTableList;
|
||
this.openInner=false
|
||
// console.log(this.equipmentList)
|
||
},
|
||
|
||
// 返场维修-打开
|
||
openBackDialog(row){
|
||
this.backRowData = row;
|
||
this.backTableList=[]
|
||
this.backForm={
|
||
//返场厂家
|
||
supplierId:null,
|
||
//备注
|
||
remark:"",
|
||
}
|
||
if(this.backRowData.backTableList&&this.backRowData.backTableList.length>0){
|
||
this.backTableList = this.backRowData.backTableList;
|
||
}else{
|
||
let obj={
|
||
partName:"",
|
||
isCharge:"0",
|
||
partNum:1,
|
||
backCost:0,
|
||
}
|
||
this.backTableList.push(obj)
|
||
}
|
||
this.openBack=true;
|
||
},
|
||
//返场维修- 删除
|
||
handleAddBack(){
|
||
let obj={
|
||
partName:"",
|
||
isCharge:"0",
|
||
partNum:0,
|
||
backCost:0,
|
||
}
|
||
this.backTableList.push(obj)
|
||
},
|
||
//返场维修- 删除
|
||
handleDeleteBack(row){
|
||
this.backTableList.splice(row.index, 1)
|
||
},
|
||
//返场维修- 弹窗保存
|
||
saveBackDialog(){
|
||
console.log(this.backRowData)
|
||
console.log(this.backTableList)
|
||
if (this.backTableList.length > 0) {
|
||
this.$refs['backForm'].validate((valid) => {
|
||
if (valid) {
|
||
const isName = this.backTableList.some((item) => item.partName == '' || item.partName == undefined,)
|
||
if (isName) {
|
||
this.$message.error('配件名称不能为空!')
|
||
return
|
||
}
|
||
const isNum = this.backTableList.some((item) => item.partNum == 0 || item.partNum == undefined,)
|
||
if (isNum) {
|
||
this.$message.error('配件数量不能为0!')
|
||
return
|
||
}
|
||
const isCost = this.backTableList.some((item) => item.backCost == 0 || item.backCost == undefined,)
|
||
if (isCost) {
|
||
this.$message.error('维修金额不能为0!')
|
||
return
|
||
}
|
||
this.backRowData.backTableList = this.backTableList;
|
||
this.openBack=false
|
||
}
|
||
})
|
||
}else {
|
||
this.$modal.msgError('请添加配件!')
|
||
}
|
||
},
|
||
/** 返场维修-物资厂家-下拉选 */
|
||
supplierInfoList() {
|
||
let param = {
|
||
pageNum: 1,
|
||
pageSize: 1000,
|
||
keyWord:undefined
|
||
}
|
||
getListFacturer(param).then((response) => {
|
||
this.supplierList = response.rows
|
||
})
|
||
},
|
||
|
||
// 待报废-打开
|
||
openScrapDialog(row){
|
||
this.scrapRowData = row;
|
||
// if(this.scrapRowData.backTableList&&this.scrapRowData.backTableList.length>0){
|
||
// this.scrapForm = this.scrapRowData.scrapForm;
|
||
// }else{
|
||
this.scrapForm={}
|
||
// }
|
||
this.openScrap=true;
|
||
},
|
||
// 待报废弹窗文件上传成功处理-编码弹窗上传
|
||
handleFileSuccess3(response, file, fileList) {
|
||
if(response.code==200){
|
||
let obj = {
|
||
"name": response.data.name,
|
||
"url": response.data.url,
|
||
}
|
||
// this.scrapForm={}
|
||
}
|
||
},
|
||
|
||
},
|
||
}
|
||
</script>
|
||
<style lang="scss">
|
||
.popper-select {
|
||
.el-cascader-panel .el-scrollbar .el-checkbox {
|
||
display: none;
|
||
}
|
||
|
||
.el-cascader-panel .el-scrollbar:nth-child(3) .el-checkbox {
|
||
display: block !important;
|
||
}
|
||
}
|
||
</style> |