Merge branch 'material-ui' of http://192.168.0.56:3000/bonus/bonus-ui into material-ui

This commit is contained in:
jjLv 2024-11-14 17:31:53 +08:00
commit d481bb6f40
5 changed files with 2115 additions and 1 deletions

View File

@ -470,7 +470,7 @@ export default {
supplierInfoList() {
let param = {
pageNum: 1,
pageSize: 100,
pageSize: 1000,
keyWord:undefined
}
getListFacturer(param).then((response) => {

View File

@ -0,0 +1,895 @@
<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="unitName">
<el-input v-model="queryParams.unitName" placeholder="退料单位" clearable style="width: 240px" disabled/>
</el-form-item>
<el-form-item label="退料工程" prop="proName">
<el-input v-model="queryParams.proName" 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">维修管理</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="typeModel" :show-overflow-tooltip="true"/>
<el-table-column label="计量单位" align="center" prop="unitName" />
<el-table-column label="退料数量" align="center" prop="preNum" ></el-table-column>
<el-table-column label="已修数量" align="center" prop="num1" ></el-table-column>
<el-table-column label="待修数量" align="center" prop="num2" ></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="open" 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="maCodeList" width="100%" height="450px">
<el-table-column label="序号" type="index" width="55" align="center"/>
<el-table-column label="类型名称" prop="materialName" align="center" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="规格型号" prop="typeName" align="center" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="设备编码" prop="maCode" align="center" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="维修状态" prop="maStatus" 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="apDetection" 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">待报废</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="open=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"></el-table-column>
<el-table-column label="配件数量" prop="partNum" align="center" :show-overflow-tooltip="true"></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 :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 {
equipmentTypeTree,
} from '@/api/purchase/goodsArrived';
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: {
Id: {
type: [String, Number],
}
},
data() {
return {
//
loading: false,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
title: '',
//
queryParams: {
unitId:"111",
unitName:"安徽润森电力工程有限公司",
proId:"222",
proName:"安徽滁州天长-开元110",
repairCode:"X20240725-391",
equipmentList: [],
},
equipmentList: [],
//
open: false,
repairRowData:{},
maCodeList: [],//
//
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: 'typeName',
// multiple: false,
value: 'typeId',
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:[],
//
deviceTypeTree: [], //
//
deviceTypeTreeProps: {
children: 'children',
label: 'typeName',
// multiple: false,
value: 'typeId',
multiple: true,
},
//
deviceType: null,
createBy: '',
rowId: '',
}
},
mounted() {
this.GetViewByApply()
if (this.Id) {//
console.log(this.Id)
this.rowId = this.Id;
this.GetViewByApply()
}
this.supplierInfoList()
// getInfo().then((res) => {
// this.companyId = res.user.companyId
// this.createBy = res.user.userName
// })
},
computed: {
...mapState(['user']),
},
methods: {
//
async GetDeviceTypeTreeFn() {
const params = {
// agreementId: agreementId,
}
// equipmentTypeTree().then((response) => {
// this.deviceTypeTree = response.data
// })
//
const res = await equipmentTypeTree(params)
console.log('resgetUseTypeTreee==========', res)
this.deviceTypeTree = res.data;
//
let selectList = []
this.equipmentList.forEach((e) => {
selectList.push(
this.getParentsById(this.deviceTypeTree, e.typeId),
)
})
this.deviceType = selectList
this.$forceUpdate()
},
//
getParentsById(list, id) {
for (let i in list) {
if (list[i].typeId == id) {
//value
return [list[i].typeId]
}
if (list[i].children) {
let node = this.getParentsById(list[i].children, id)
if (node !== undefined) {
//
node.unshift(list[i].typeId)
return node
}
}
}
},
//
async deviceTypeChange(val) {
const deviceTypeList =
this.$refs.deviceTypeCascader.getCheckedNodes()
console.log(deviceTypeList)
let tempList = []
if (val.length > 0) {
const items = val.map((e) => {
return e[3]
})
for (let i of items) {
for (let z of deviceTypeList) {
if (z.data.typeId === i) {
const obj = JSON.parse(JSON.stringify(z.data))
console.log(obj)
obj.typeModel = obj.typeName
obj.typeName = deviceTypeList[2].data.typeName
// obj.preNum = 0
// obj.apDetection = ''
obj.maCodeList=[]
obj.bmFileInfos=[]
tempList.push(obj)
break
}
}
}
const newDataListNew = [...this.equipmentList, ...tempList]
const map = new Map()
for (let item of newDataListNew) {
if (!map.has(item.typeId)) {
map.set(item.typeId, item)
}
}
const newArray = [...map.values()]
let newArray_array = []
items.forEach((e) => {
newArray.forEach((j) => {
if (e == j.typeId) {
newArray_array.push(j)
}
})
})
this.equipmentList = newArray_array
} else {
this.equipmentList = []
}
},
//
async GetViewByApply(params) {
// const res = await getBackApplyInfo(this.rowId)
// console.log(res)
// const data = res.data
let data = {
backApplyInfo:{
unitId:"111",
unitName:"安徽润森电力工程有限公司",
proId:"222",
proName:"安徽滁州天长-开元110",
repairCode:"X20240725-391"
}
}
console.log(data)
this.queryParams.unitId = data.backApplyInfo.unitId
this.queryParams.unitName = data.backApplyInfo.unitName
this.queryParams.proId = data.backApplyInfo.proId
this.queryParams.proName = data.backApplyInfo.proName
this.queryParams.repairCode = data.backApplyInfo.repairCode
// this.equipmentList = data.backApplyDetailsList
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.createBy = this.user.name
// this.queryParams.companyId = this.companyId
// this.queryParams.backApplyInfo = {
// repairCode: this.queryParams.repairCode,
// remark: this.queryParams.remark,
// agreementId: this.queryParams.agreementId,
// backTime: this.queryParams.backTime,
// createBy: this.queryParams.createBy,
// companyId: this.queryParams.companyId,
// }
// let params = {
// id:this.rowId,
// 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.maCodeList=[]
this.repairRowData.maCodeList=[
{
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.maCodeList&&this.repairRowData.maCodeList.length>0){
this.maCodeList = this.repairRowData.maCodeList
}
this.open=true;
},
//
saveCodeDialog(){
console.log(this.repairRowData)
console.log(this.maCodeList)
this.repairRowData.maCodeList = this.maCodeList;
this.open=false
// console.log(this.equipmentList)
},
//
beforeFileUpload(row){
this.fileData = row
},
// -退
handleFileSuccess(response, file, fileList) {
if(response.code==200){
let obj = {
"name": response.data.name,
"url": response.data.url,
}
let index = this.equipmentList.findIndex(v=>v.typeId==this.fileData.typeId)
this.equipmentList[index].bmFileInfos=[obj]
}
},
// -
handleFileSuccess2(response, file, fileList) {
if(response.code==200){
let obj = {
"name": response.data.name,
"url": response.data.url,
}
let index = this.maCodeList.findIndex(v=>v.maCode==this.fileData.maCode)
this.maCodeList[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 equipmentTypeTree(params)
console.log('treeData==========', res)
this.partTypeTree = res.data;
//
let selectList = []
this.partTableList.forEach((e) => {
selectList.push(this.getSelectId(this.partTypeTree, e.typeId))
})
this.partType = selectList
this.$forceUpdate()
},
//-
getSelectId(list, id) {
for (let i in list) {
if (list[i].typeId == id) {
//value
return [list[i].typeId]
}
if (list[i].children) {
let node = this.getSelectId(list[i].children, id)
if (node !== undefined) {
//
node.unshift(list[i].typeId)
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[3]
})
for (let i of items) {
for (let z of partTypeList) {
if (z.data.typeId === i) {
const parent = z.parent
console.log(parent)
const obj = JSON.parse(JSON.stringify(z.data))
console.log(obj)
//typeName typeCode isCharge partNum
obj.typeCode = obj.typeName
obj.typeName = parent.label
obj.isCharge = "0"
obj.partNum = 0
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.typeId)) {
map.set(item.typeId, item)
}
}
const newArray = [...map.values()]
let newArray_array = []
items.forEach((e) => {
newArray.forEach((j) => {
if (e == j.typeId) {
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[3] === row.typeId) {
this.partType.splice(index, 1)
this.propsKey++
}
})
this.partTableList.forEach((item, index) => {
if (item.typeId == row.typeId) {
this.partTableList.splice(index, 1)
}
})
},
//-
saveInnerDialog(){
console.log(this.innerRowData)
console.log(this.partTableList)
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:0,
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
})
},
},
}
</script>
<style lang="scss">
.popper-select {
.el-cascader-panel .el-scrollbar .el-checkbox {
display: none;
}
.el-cascader-panel .el-scrollbar:nth-child(4) .el-checkbox {
display: block !important;
}
}
</style>

View File

@ -0,0 +1,305 @@
<template>
<div>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="创建时间" prop="time">
<el-date-picker
v-model="queryParams.time"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
type="daterange"
value-format="yyyy-MM-dd"
style="width: 240px"
></el-date-picker>
</el-form-item>
<el-form-item label="关键字" prop="keyWord">
<el-input
maxlength="50"
v-model="queryParams.keyWord"
placeholder="请输入关键字"
clearable
style="width: 240px"
/>
</el-form-item>
<el-form-item label="状态" prop="taskStatus">
<el-select
v-model="queryParams.taskStatus"
clearable
filterable
style="width: 240px"
placeholder="请选择"
>
<el-option
v-for="dict in dict.type.back_task_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>查询</el-button
>
<el-button
icon="el-icon-refresh"
size="mini"
@click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain size="mini" @click="handleAdd">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain size="mini">提交</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<!-- <el-table-column label="序号" align="center" width="80" type="index>
<template scope="scope">
<span>{{(queryParams.pageNum - 1) * 10 + scope.$index + 1}}</span>
</template>
</el-table-column> -->
<el-table-column align="center" label="序号" type="index"/>
<el-table-column label="退料单位" align="center" prop="unitName" :show-overflow-tooltip="true"/>
<el-table-column label="退料工程" align="center" prop="proName" :show-overflow-tooltip="true"/>
<el-table-column label="维修单号" align="center" prop="code" :show-overflow-tooltip="true"/>
<el-table-column label="物资类型" align="center" prop="typeName" :show-overflow-tooltip="true"/>
<el-table-column label="退料单号" align="center" prop="code" :show-overflow-tooltip="true"/>
<el-table-column label="维修班组" align="center" prop="backPerson" :show-overflow-tooltip="true"/>
<!-- <el-table-column label="退料人电话" align="center" prop="phone" :show-overflow-tooltip="true"/> -->
<el-table-column label="创建人" align="center" prop="createBy" :show-overflow-tooltip="true"/>
<el-table-column label="创建时间" align="center" prop="createTime" :show-overflow-tooltip="true"/>
<el-table-column label="状态" align="center" :show-overflow-tooltip="true" prop="taskStatus">
<template slot-scope="scope">
<dict-tag :options="dict.type.back_task_status" :value="scope.row.taskStatus"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="250">
<template slot-scope="scope">
<el-button size="mini" plain icon="el-icon-zoom-in" @click="handleSee(scope.row)" >查看</el-button>
<el-button size="mini" type="warning" plain icon="el-icon-edit" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button size="mini" type="danger" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0" :total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import {
getBackApplyList,
getProjectList,
getUnitList,
backApplyRemove
} from '@/api/back/index.js'
import { getInfo, h } from '@/api/login'
export default {
name: '',
dicts: ['back_task_status'],
data() {
return {
type: '',
isShowOneFlag: false,
priKey: '',
//
loading: false,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
tableList: [],
//
title: '',
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
keyWord: '', //
unitId: '', //id
proId: '', //id
taskStatus: '', //
typeId: '', //
time: [],//
agreementCode: '', //
startTime: '',
endTime: '',
},
companyId: '',
unitList: [],
proList: [],
}
},
created() {
this.getList();
// this.initSelectData()
// this.InitIGetInfo()
},
methods: {
//
InitIGetInfo() {
getInfo().then((res) => {
this.companyId = res.user.companyId
this.getList()
})
},
/** 查询列表 startTime,结束日期endTime */
async getList() {
this.loading = true
if (this.queryParams.time && this.queryParams.time.length > 0) {
this.queryParams.startTime = this.queryParams.time[0]
this.queryParams.endTime = this.queryParams.time[1]
}
try {
let params = {
companyId: this.companyId,
...this.queryParams,
}
const res = await getBackApplyList(params)
this.tableList = res.rows
this.total = res.total
this.loading = false
} catch (error) {}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams.time = []
// this.resetForm("queryForm");
this.$refs.queryForm.resetFields()
this.handleQuery()
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.dictId)
this.single = selection.length != 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.$emit('handelAdd')
},
/** 修改按钮操作 */
handleUpdate(row) {
this.$emit("handelEdit",row.id);
},
/** 查看按钮操作 */
handleSee(row) {
this.$emit("handelView",row.id);
},
/** 删除按钮操作 */
handleDelete(row) {
// let param = {
// id:row.id+ '',
// }
this.$modal
.confirm('是否确认删除所选择的数据项?')
.then(() => {
return backApplyRemove(row.id)
})
.then(() => {
this.getList()
this.$message.success('操作成功!')
})
.catch(() => {
})
},
/** 导出按钮操作 */
handleExport() {
this.download(
'material/backApply/export',
{
...this.queryParams
},
`退料申请单_${new Date().getTime()}.xlsx`,
)
},
},
}
</script>
<style lang="scss" scoped>
.submit_box {
display: flex;
justify-content: flex-start;
align-items: center;
.submit_box_title {
display: flex;
flex-direction: column;
margin-left: 15px;
:first-child {
font-size: 14px;
font-weight: 600;
}
:last-child {
margin-top: 6px;
font-size: 12px;
}
}
}
.submit_box_two {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
margin-left: 30%;
.submit_box_title {
display: flex;
flex-direction: column;
margin-left: 10px;
font-size: 18px;
font-weight: 600;
}
}
::v-deep.el-table .fixed-width .el-button--mini {
width: 60px !important;
margin-bottom: 10px;
}
.dialog-footer {
display: flex;
justify-content: flex-end;
align-items: center;
}
</style>

View File

@ -0,0 +1,851 @@
<template>
<div>
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:rules="queryRules"
:inline="true"
v-show="showSearch"
label-width="100px"
>
<el-row>
<el-form-item label="退料单位" prop="unitId">
<el-select
v-model="queryParams.unitId"
clearable
filterable
@change="GetProData"
style="width: 240px"
placeholder="请选择"
:disabled="isView"
>
<el-option
v-for="item in unitList"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="退料工程" prop="proId">
<el-select
v-model="queryParams.proId"
clearable
filterable
@change="GetUnitData"
style="width: 240px"
placeholder="请选择"
:disabled="isView"
>
<el-option
v-for="item in proList"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="协议号" prop="agreementCode">
<el-input
v-model="queryParams.agreementCode"
disabled
style="width: 240px"
></el-input>
</el-form-item> -->
<el-form-item label="退料人" prop="backPerson">
<el-input
v-model="queryParams.backPerson"
placeholder="请输入退料人"
clearable :disabled="isView"
style="width: 240px"
/>
</el-form-item>
<el-form-item label="退料人电话" prop="phone">
<el-input
v-model="queryParams.phone"
placeholder="请输入退料人电话"
clearable :disabled="isView"
style="width: 240px"
:maxlength="11"
/>
</el-form-item>
<!-- <el-form-item label="物品类型" prop="status">
<el-cascader
placeholder="请输入物品类型"
:options="deviceTypeTree"
:props="deviceTypeTreeProps"
v-model="deviceType"
@change="deviceTypeChange"
ref="deviceTypeCascader"
filterable
style="width: 240px"
></el-cascader>
</el-form-item> -->
<el-form-item label="退料时间" prop="backTime">
<el-date-picker
v-model="queryParams.backTime"
type="date" :disabled="isView"
value-format="yyyy-MM-dd"
placeholder="选择时间"
style="width: 240px"
>
</el-date-picker>
</el-form-item>
<el-form-item label="备注" prop="roleName">
<el-input
v-model="queryParams.remark"
placeholder="请输入备注"
clearable :disabled="isView"
rows="1"
type="textarea"
style="width: 240px"
/>
</el-form-item>
</el-row>
<el-row> </el-row>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-back"
size="mini"
@click="handleBack"
>退料管理</el-button
>
</el-col> -->
<!-- <el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>保存</el-button
>
</el-col> -->
<el-col :span="1.5">
<!-- <el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:role:export']"
>导出</el-button> -->
</el-col>
</el-row>
<el-table
v-loading="loading"
:data="backApplyDetails"
@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="typeCode"
:show-overflow-tooltip="true"
/>
<el-table-column
label="计量单位"
align="center"
prop="unitNames"
/>
<el-table-column
label="当前在用量"
align="center"
prop="useNum"
>
</el-table-column>
<el-table-column
label="管理模式"
align="center"
prop="unitNames"
/>
<el-table-column
label="退料数量"
align="center"
prop="createTime"
min-width="100"
>
<template slot-scope="scope">
<el-input
v-model.number="scope.row.num"
placeholder="退料数量"
type="number"
min="1"
clearable
@input="checkNum(scope.row)"
style="width: 100%"
/>
<div style="color: rgb(2, 167, 240);" @click="openAddCode(scope.row)">添加编码</div>
</template>
</el-table-column>
<el-table-column
label="外观判定"
align="center"
prop="look"
min-width="120"
>
<template slot-scope="scope">
<el-input
v-model.number="scope.row.look"
placeholder="外观判定"
type="text"
clearable maxlength="20"
style="width: 100%"
/>
</template>
</el-table-column>
<el-table-column
label="备注"
align="center"
prop="remark"
min-width="120"
>
<template slot-scope="scope">
<el-input
v-model="scope.row.remark"
placeholder="备注"
clearable maxlength="100"
style="width: 100%"
/>
</template>
</el-table-column>
<el-table-column
label="附件"
align="center"
prop="file"
>
<template slot-scope="scope">
<div style="color: rgb(2, 167, 240);">上传</div>
</template>
</el-table-column>
<!-- <el-table-column
label="操作"
align="center"
width="100px"
>
<template slot-scope="scope">
<el-button size="mini" type="danger"
@click="handleDelete({ ...scope.row, index: scope.$index })">删除</el-button>
</template>
</el-table-column> -->
</el-table>
<el-dialog title="编码退料" :visible.sync="open" width="1000px" append-to-body>
<el-row :gutter="10" class="mb8">
<el-col :span="6">
<div style="width: 100%;height: 100%;display: flex;align-items: center;">
<span style="width: 80px;">编码</span>
<el-input v-model="devCode" placeholder="请输入编码" clearable style="width: 100%"/>
</div>
</el-col>
<el-col :span="1.5">
<el-button type="primary" size="mini" @click="handleAddCode">保存</el-button>
</el-col>
</el-row>
<el-table :data="codeDataList" 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="devCode" align="center" :show-overflow-tooltip="true">
</el-table-column>
<el-table-column label="设备状态" prop="status" align="center" :show-overflow-tooltip="true">
</el-table-column>
<el-table-column label="外观判定" prop="look" align="center" width="150" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-input
v-model.number="scope.row.look"
placeholder="外观判定" maxlength="20"
type="text" clearable
style="width: 100%"
/>
</template>
</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="handleFileSuccess" :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.fileInfos&&scope.row.fileInfos.length>0">
查看
</el-button>
</div>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="120px">
<template slot-scope="scope">
<el-button size="mini" type="danger"
@click="handleDeleteCode({ ...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="saveDevCode">保存</el-button>
<el-button type="normal" size="mini" @click="open=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 {
equipmentTypeTree,
} from '@/api/purchase/goodsArrived';
// import {
// getProData,
// getUnitData,
// getDeviceTypeTree,
// getAgreementInfoById,
// submitLeaseApply,
// getUseTypeTreee,
// getUseNumByTypeId,
// } from '@/api/claimAndRefund/receive'
// import { submitBackApplyApi } from '@/api/claimAndRefund/return'
// import {
// materialReturnNoteByApply,
// submitRefuseBackApply,
// } from '@/api/claimAndRefund/return.js'
import { mapState } from 'vuex'
import { getInfo, h } from '@/api/login'
import { getToken } from '@/utils/auth'
export default {
name: 'ReturnApplyAdd',
props: {
backId: {
type: [String, Number],
},
agreementId: {
type: [String, Number],
},
isView: {
type: Boolean,
default:true
},
},
data() {
const validatePhone = (rule, value, callback) => {
const reg = /^[1][3-9][0-9]{9}$/
if (!reg.test(value)) {
this.queryParams.phone = ''
} else {
callback()
}
}
return {
//
loading: false,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
roleList: [],
//
title: '',
//
open: false,
rowData:{},
devCode:"",
codeDataList: [],
//
dialogImageUrl: '',
dialogVisible: false,
fileData:{},
//
upload: {
//
headers: { Authorization: 'Bearer ' + getToken() },
//
url: process.env.VUE_APP_BASE_API + '/file/upload'
},
//
queryParams: {
types: 2,
unitId: null,
proId: null,
agreementId: null, //id
agreementCode: null, //code
companyId: '', //
createBy: '', //
taskType: 29,
taskStatus: 30,
backTime: '', //
//退
leaseApplyInfo: {
backPerson: '',
phone: '',
remark: '',
},
//退
backApplyDetails: [],
},
backApplyDetails: [],
//退
leaseApplyDetailsItem: {
createBy: null,
companyId: null,
status: 0,
typeId: null, // 4 id
typeName: '', //
typeCode: '', //
unitNames: '', //
useNum: '', //
remark: '', //
preNum: 1, //
},
//
queryRules: {
unitId: [
{
required: true,
message: '请选择退料单位',
trigger: 'change',
type: 'number',
},
],
proId: [
{
required: true,
message: '请选择退料工程',
trigger: 'change',
type: 'number',
},
],
backPerson: [
{
required: true,
message: '请输入退料人',
trigger: 'blur',
},
],
backTime: [
{
required: true,
message: '请选择退料时间',
trigger: 'change',
},
],
phone: [
{
required: true,
trigger: 'blur',
message: '请输入退料人的手机号',
},
{
pattern: /^1[3456789]\d{9}$/,
message: '请输入正确的手机号码',
trigger: 'blur',
},
],
// phone: [
// { validator: validatePhone, trigger: "blur"},
// {required: true, message: '', trigger: 'change'},
// ],
},
unitList: [], //
proList: [], //
deviceTypeTree: [], //
//
deviceTypeTreeProps: {
children: 'children',
label: 'typeName',
// multiple: false,
value: 'typeId',
},
//
deviceType: null,
// defaultProps: {
// children: "children",
// label: "label"
// },
companyId: '',
createBy: '',
rowId: '',
}
},
mounted() {
this.GetDeviceTypeTreeFn()
// this.GetUnitData()
// this.GetProData()
if (this.backId) {//
console.log("查看")
console.log(this.backId)
console.log(this.isView)
this.rowId = this.backId;
this.GetViewByApply({id: this.backId,agreementId: this.agreementId})
}
// getInfo().then((res) => {
// this.companyId = res.user.companyId
// this.createBy = res.user.userName
// })
},
computed: {
...mapState(['user']),
},
methods: {
//
async GetUnitData() {
const params = {
id: this.queryParams.proId /* */,
}
// const res = await getUnitData(params)
// this.unitList = res.data
// this.GetAgreementInfoById()
},
//
async GetProData() {
const params = {
id: this.queryParams.unitId,
}
// const res = await getProData(params)
// this.proList = res.data
// this.GetAgreementInfoById()
},
//
async GetDeviceTypeTreeFn(agreementId) {
// const params = {
// agreementId: agreementId,
// }
equipmentTypeTree().then((response) => {
this.deviceTypeTree = response.data
})
// const res = await getUseTypeTreee(params)
// console.log('resgetUseTypeTreee==========', res)
// this.deviceTypeTree = res.data
},
// id
async GetAgreementInfoById() {
if (this.queryParams.unitId && this.queryParams.proId) {
const params = {
unitId: this.queryParams.unitId,
projectId: this.queryParams.proId,
}
// const res = await getAgreementInfoById(params)
// if (!(res.data && res.data.agreementId)) {
// this.$message.error('')
// this.queryParams.unitId = null
// this.queryParams.proId = null
// this.GetUnitData()
// this.GetProData()
// } else {
// this.queryParams.agreementId = res.data.agreementId
// this.queryParams.agreementCode = res.data.agreementCode
// this.GetDeviceTypeTreeFn(res.data.agreementId)
// }
}
},
//
async GetViewByApply(params) {
// const res = await materialReturnNoteByApply({
// id: params.id,
// agreementId: params.agreementId,
// })
// const data = res.data[0]
// // console.log(data)
// this.queryParams.unitId = data.unitId
// this.queryParams.proId = Number(data.proId)
// this.$set(this.queryParams, 'phone', data.phone)
// this.queryParams.backPerson = data.backPerson
// this.queryParams.backTime = data.backTime
// this.queryParams.agreementCode = data.agreementCode
// this.queryParams.agreementId = data.agreementId
// this.queryParams.remark = data.remark
// this.backApplyDetails = res.data
// this.GetDeviceTypeTreeFn(data.agreementId)
},
//
selectable(row) {
console.log(row)
if (row.num != 0) {
return true
} else {
return false
}
},
//
handleSelectionChange(selection) {
this.queryParams.backApplyDetails = selection
},
/** 保存按钮操作 */
handleAdd() {
this.$refs.queryForm.validate(async (valid) => {
if (!valid) {
return false
} else {
let backApplyInfo = []
if (this.queryParams.backApplyDetails.length == 0) {
this.$message.error('请添加数据')
return
}
// const isRemark = this.queryParams.backApplyDetails.some(
// (item) => item.remark == '' || item.remark == undefined
// );
const isNum = this.queryParams.backApplyDetails.some(
(item) => item.num == '' || item.num == undefined,
)
if (isNum) {
this.$message.error('退料数量不能为空!')
return
}
this.queryParams.createBy = this.user.name
this.queryParams.companyId = this.companyId
this.queryParams.backApplyInfo = {
backPerson: this.queryParams.backPerson,
phone: this.queryParams.phone,
remark: this.queryParams.remark,
backTime: this.queryParams.backTime,
companyId: this.companyId,
}
if (this.rowId != '') {
let params = {
companyId: this.companyId,
createBy: this.createBy,
id: this.rowId,
agreementId: this.queryParams.agreementId,
backApplyInfo: this.queryParams.backApplyInfo,
backApplyDetails:
this.queryParams.backApplyDetails,
}
// const res = await submitRefuseBackApply(params)
// if (res.code == 200) {
// this.$message({ type: 'success', message: res.msg })
// setTimeout(() => {
// this.$emit('goBackPage')
// // this.$tab.closeOpenPage({
// // path: '/claimAndRefund/return/returnApplyByCq',
// // })
// }, 1000)
// }
} else {
let params = {
companyId: this.companyId,
createBy: this.createBy,
agreementId: this.queryParams.agreementId,
backApplyInfo: this.queryParams.backApplyInfo,
backApplyDetails:
this.queryParams.backApplyDetails,
}
// const res = await submitBackApplyApi(params)
// if (res.code == 200) {
// this.$message({ type: 'success', message: res.msg })
// setTimeout(() => {
// this.$emit('goBackPage')
// // this.$tab.closeOpenPage({
// // path: '/claimAndRefund/return/returnApplyByCq',
// // })
// }, 1000)
// }
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
this.backApplyDetails.splice(row.index, 1)
},
/** 导出按钮操作 */
handleExport() {
this.download(
'system/role/export',
{
...this.queryParams,
},
`role_${new Date().getTime()}.xlsx`,
)
},
checkNum(row) {
let maxNum = row.useNum
if (row.num <= 1) {
row.num = 1
} else if (row.num >= maxNum) {
row.num = maxNum
}
},
///////
async deviceTypeChange(val) {
let nodes = null
console.log('vall1211221122',
this.$refs.deviceTypeCascader.getCheckedNodes().length,
this.$refs.deviceTypeCascader.getCheckedNodes(),
[this.$refs.deviceTypeCascader.panel.getNodeByValue(val)],
)
nodes =
this.$refs.deviceTypeCascader.getCheckedNodes().length > 0
? this.$refs.deviceTypeCascader.getCheckedNodes()
: [this.$refs.deviceTypeCascader.panel.getNodeByValue(val)]
console.log('nodes', nodes)
// const res = await getUseNumByTypeId({ typeId: nodes[0].data.typeId })
nodes[0].data.useNum = nodes[0].data.num
if (nodes[0].level != 4) {
return
}
if (nodes[0].data.useNum < 1) {
this.$modal.msgError('所选机具类型当前无在用!')
return
}
for (let i = 0; i < this.backApplyDetails.length; i++) {
if (this.backApplyDetails[i].typeId == nodes[0].data.typeId) {
this.backApplyDetails.splice(i, 1)
break
}
}
this.backApplyDetails.push(this.handelTableItemData(nodes[0]))
// this.$refs.cascader.$refs.panel.clearCheckedNodes()
// //
// this.$refs.cascader.$refs.panel.activePath = []
this.deviceType = {}
},
////
handelTableItemData(node) {
const template = JSON.parse(
JSON.stringify(this.leaseApplyDetailsItem),
)
template.createBy = this.createBy
template.typeId = node.data.typeId
template.companyId = node.data.companyId
// template.typeId = node.data.id
template.unitNames = node.data.unitNames
template.preNum = node.data.num
template.typeName = node.pathLabels[2]
template.typeCode = node.pathLabels[3]
template.num = node.data.num
template.useNum = node.data.useNum
return template
},
//
openAddCode(row){
this.rowData=row;
this.devCode=""
this.codeDataList=[]
if(this.rowData.codeDataList&&this.rowData.codeDataList.length>0){
this.codeDataList = this.rowData.codeDataList
}
this.open=true
},
handleAddCode(){
console.log(this.rowData)
if(this.devCode!=""){
let obj = {
typeName:this.rowData.typeName,
typeId:this.rowData.typeId,
typeCode:this.rowData.typeCode,
devCode:this.devCode,
status:this.rowData.status,
fileInfos:[],
look:"",
}
let index = this.codeDataList.findIndex(v=>v.devCode==this.devCode)
if(index>-1){
this.$message.error('设备编码已存在!')
}else{
this.codeDataList.push(obj)
}
}else{
this.$message.error('请先填写设备编码!')
}
},
/** 删除按钮操作 */
handleDeleteCode(row) {
this.codeDataList.splice(row.index, 1)
},
saveDevCode(){
console.log(this.rowData)
console.log(this.codeDataList)
this.rowData.codeDataList = this.codeDataList
console.log(this.backApplyDetails)
},
beforeFileUpload(row){
this.fileData = row
},
//
handleFileSuccess(response, file, fileList) {
if(response.code==200){
let obj = {
"taskId": "",
"taskType": "0",
"name": response.data.name,
"url": response.data.url,
"modelId": this.rowData.typeId,
// "fileType": this.rowData.fileType
}
let index = this.codeDataList.findIndex(v=>v.devCode==this.fileData.devCode)
this.codeDataList[index].fileInfos=[obj]
}
},
//
picturePreview(row) {
console.log(row)
console.log(row.fileInfos)
if(row.fileInfos.length>0){
let file = row.fileInfos[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
}
}
},
},
}
</script>

View File

@ -0,0 +1,63 @@
<template>
<!-- 退料申请 -->
<div class="app-container">
<PageHeader
v-if="isShowComponent !== 'Home'"
:pageContent="pageContent"
@goBack="goBack"
/>
<component
:is="isShowComponent"
:Id="Id"
:isView="isView"
@handelAdd="handelAdd"
@handelEdit="handelEdit"
@handelView="handelView"
@goBackPage="goBack"
/>
</div>
</template>
<script>
import PageHeader from '@/components/pageHeader'
import Home from './component/home.vue'
import EditPage from './component/edit.vue'
import viewPage from './component/view.vue'
export default {
components: {
PageHeader,
Home,
EditPage,
viewPage
},
data() {
return {
isShowComponent: 'Home',
pageContent: '',
Id: '',
isView: false,
}
},
methods: {
handelAdd() {
this.Id = ''
this.pageContent = '新建任务'
this.isShowComponent = 'EditPage'
},
handelEdit(id) {
this.Id = id
this.pageContent = '编辑任务'
this.isShowComponent = 'EditPage'
},
handelView(id) {
this.isView = true
this.Id = id
this.pageContent = '查看任务'
this.isShowComponent = 'viewPage'
},
goBack() {
this.isShowComponent = 'Home'
},
},
}
</script>