优化领料任务申请时保存bug

This commit is contained in:
BianLzhaoMin 2024-04-17 13:23:05 +08:00
parent 9deec6f550
commit 75c19d0d51
1 changed files with 254 additions and 258 deletions

View File

@ -3,27 +3,31 @@
<el-form :model="queryParams" ref="queryForm" size="small" :rules="queryRules" :inline="true" v-show="showSearch"> <el-form :model="queryParams" ref="queryForm" size="small" :rules="queryRules" :inline="true" v-show="showSearch">
<el-row> <el-row>
<el-form-item label="领料单位" prop="unitId"> <el-form-item label="领料单位" prop="unitId">
<el-select v-model="queryParams.unitId" filterable clearable @change="GetProData" style="width: 240px" placeholder="请选择"> <el-select
<el-option v-model="queryParams.unitId"
v-for="item in unitList" filterable
:key="item.id" clearable
:label="item.name" @change="GetProData"
:value="item.id"> style="width: 240px"
</el-option> placeholder="请选择"
>
<el-option v-for="item in unitList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="领料工程" prop="proId"> <el-form-item label="领料工程" prop="proId">
<el-select v-model="queryParams.proId" filterable clearable @change="GetUnitData" style="width: 240px" placeholder="请选择"> <el-select
<el-option v-model="queryParams.proId"
v-for="item in proList" filterable
:key="item.id" clearable
:label="item.name" @change="GetUnitData"
:value="item.id"> style="width: 240px"
</el-option> placeholder="请选择"
>
<el-option v-for="item in proList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="协议号" prop="agreementCode"> <el-form-item label="协议号" prop="agreementCode">
<el-input maxlength="50" v-model="queryParams.agreementCode" disabled></el-input maxlength="50" > <el-input maxlength="50" v-model="queryParams.agreementCode" disabled></el-input>
</el-form-item> </el-form-item>
<el-form-item label="物品类型" prop="status"> <el-form-item label="物品类型" prop="status">
<el-cascader <el-cascader
@ -33,60 +37,51 @@
v-model="deviceType" v-model="deviceType"
@change="deviceTypeChange" @change="deviceTypeChange"
ref="deviceTypeCascader" ref="deviceTypeCascader"
filterable></el-cascader> filterable
></el-cascader>
</el-form-item> </el-form-item>
<el-form-item label="领料人" prop="leasePerson"> <el-form-item label="领料人" prop="leasePerson">
<el-input maxlength="50" <el-input
maxlength="50"
v-model="queryParams.leaseApplyInfo.leasePerson" v-model="queryParams.leaseApplyInfo.leasePerson"
placeholder="请输入领料人" placeholder="请输入领料人"
clearable clearable
/> />
</el-form-item> </el-form-item>
<el-form-item label="领料人电话" prop="phone"> <el-form-item label="领料人电话" prop="phone">
<el-input maxlength="11" <el-input
maxlength="11"
v-model="queryParams.leaseApplyInfo.phone" v-model="queryParams.leaseApplyInfo.phone"
placeholder="请输入领料人电话" placeholder="请输入领料人电话"
clearable clearable
style="width: 240px" style="width: 240px"
/> />
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="roleName"> <el-form-item label="备注" prop="roleName">
<el-input maxlength="100" <el-input
maxlength="100"
v-model="queryParams.leaseApplyInfo.remark" v-model="queryParams.leaseApplyInfo.remark"
placeholder="请输入备注" placeholder="请输入备注"
clearable clearable
rows="1" rows="1"
type="textarea" type="textarea"
style="width: 240px" style="width: 240px"
/> />
</el-form-item> </el-form-item>
</el-row> </el-row>
<el-row> <el-row></el-row>
</el-row>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button type="success" plain icon="el-icon-back" size="mini" @click="handleBack">领料申请</el-button>
type="success"
plain
icon="el-icon-back"
size="mini"
@click="handleBack"
>领料申请</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button type="primary" plain icon="el-icon-plus" size="mini" v-if="isEdit == 'true'" @click="handleAdd">
type="primary" 保存
plain </el-button>
icon="el-icon-plus"
size="mini"
v-if="isEdit=='true'"
@click="handleAdd"
>保存</el-button>
</el-col> </el-col>
<!-- <el-col :span="1.5"> <!-- <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
@ -101,61 +96,60 @@
<el-table v-loading="loading" :data="leaseApplyDetails" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="leaseApplyDetails" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" /> --> <!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table-column label="序号" type="index" width="80" /> <el-table-column label="序号" type="index" width="80" />
<el-table-column label="类型名称" prop="typeCn" :show-overflow-tooltip="true" /> <el-table-column label="类型名称" prop="typeCn" :show-overflow-tooltip="true" />
<el-table-column label="规格型号" prop="guigeCn" :show-overflow-tooltip="true" /> <el-table-column label="规格型号" prop="guigeCn" :show-overflow-tooltip="true" />
<el-table-column label="计量单位" prop="unitCn"/> <el-table-column label="计量单位" prop="unitCn" />
<el-table-column label="库存数量" prop="num"/> <el-table-column label="库存数量" prop="num" />
<el-table-column label="预领数量" align="center"> <el-table-column label="预领数量" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
v-model.number="scope.row.preNum" v-model.number="scope.row.preNum"
placeholder="请输入预领数量" placeholder="请输入预领数量"
type="number" type="number"
min="1" @input="checkNum(scope.row)" min="1"
@input="checkNum(scope.row)"
clearable clearable
style="width: 100%" style="width: 100%"
/> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center"> <el-table-column label="备注" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input maxlength="100" <el-input maxlength="100" v-model="scope.row.remark" placeholder="请输入备注" clearable style="width: 100%" />
v-model="scope.row.remark"
placeholder="请输入备注"
clearable
style="width: 100%"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width" v-if="isEdit=='true'"> <el-table-column
label="操作"
align="center"
fixed="right"
class-name="small-padding fixed-width"
v-if="isEdit == 'true'"
>
<template slot-scope="scope"> <template slot-scope="scope">
<!-- <el-button--> <!-- <el-button-->
<!-- size="mini"--> <!-- size="mini"-->
<!-- type="text"--> <!-- type="text"-->
<!-- icon="el-icon-edit"--> <!-- icon="el-icon-edit"-->
<!-- @click="handleBack(scope.row)"--> <!-- @click="handleBack(scope.row)"-->
<!-- v-hasPermi="['system:role:edit']"--> <!-- v-hasPermi="['system:role:edit']"-->
<!-- >修改</el-button>--> <!-- >修改</el-button>-->
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete({...scope.row,index:scope.$index})" @click="handleDelete({ ...scope.row, index: scope.$index })"
>删除</el-button> >
删除
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
</template> </template>
<script> <script>
import { getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus, deptTreeSelect } from "@/api/system/role"; import { getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus, deptTreeSelect } from '@/api/system/role'
import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu"; import { treeselect as menuTreeselect, roleMenuTreeselect } from '@/api/system/menu'
import { import {
getProData, getProData,
getUnitData, getUnitData,
@ -165,25 +159,25 @@ import {
getLeaseListAll, getLeaseListAll,
editLeaseApply, editLeaseApply,
getLeaseApplyListAll, getLeaseApplyListAll,
getLeaseApplyAuditListAll getLeaseApplyAuditListAll,
} from '@/api/claimAndRefund/receive' } from '@/api/claimAndRefund/receive'
import { getInfo } from '@/api/login' import { getInfo } from '@/api/login'
export default { export default {
name: "ReceiveApplyAdd", name: 'ReceiveApplyAdd',
data() { data() {
const validatePhone = (rule, value, callback) => { const validatePhone = (rule, value, callback) => {
if (!value) { if (!value) {
callback(new Error("退料人电话不能为空")); callback(new Error('退料人电话不能为空'))
// this.$message.error(""); // this.$message.error("");
} else if (value.length < 11) { } else if (value.length < 11) {
callback(new Error("电话号码格式不正确")); callback(new Error('电话号码格式不正确'))
// this.$message.error(""); // this.$message.error("");
} else { } else {
callback(); callback()
} }
}; }
return { return {
user:null, // user: null, //
// //
loading: false, loading: false,
// //
@ -199,7 +193,7 @@ export default {
// //
roleList: [], roleList: [],
// //
title: "", title: '',
// //
open: false, open: false,
// //
@ -208,31 +202,31 @@ export default {
menuNodeAll: false, menuNodeAll: false,
deptExpand: true, deptExpand: true,
deptNodeAll: false, deptNodeAll: false,
isEdit:'true', isEdit: 'true',
// //
dateRange: [], dateRange: [],
// //
dataScopeOptions: [ dataScopeOptions: [
{ {
value: "1", value: '1',
label: "全部数据权限" label: '全部数据权限',
}, },
{ {
value: "2", value: '2',
label: "自定数据权限" label: '自定数据权限',
}, },
{ {
value: "3", value: '3',
label: "本部门数据权限" label: '本部门数据权限',
}, },
{ {
value: "4", value: '4',
label: "本部门及以下数据权限" label: '本部门及以下数据权限',
}, },
{ {
value: "5", value: '5',
label: "仅本人数据权限" label: '仅本人数据权限',
} },
], ],
// //
menuOptions: [], menuOptions: [],
@ -240,54 +234,59 @@ export default {
deptOptions: [], deptOptions: [],
// //
queryParams: { queryParams: {
types: 2,
types:2, unitId: null,
proId: null,
unitId:null, agreementId: null, //id
proId:null,
agreementId:null, //id
agreementCode: null, //code agreementCode: null, //code
companyId:'', // companyId: '', //
createBy: '', // createBy: '', //
taskType: 29, taskType: 29,
taskStatus: 30, taskStatus: 30,
// //
leaseApplyInfo:{ leaseApplyInfo: {
leasePerson: '', leasePerson: '',
phone: '', phone: '',
remark: '' remark: '',
}, },
// //
leaseApplyDetails:[] leaseApplyDetails: [],
}, },
leaseApplyDetails:[], leaseApplyDetails: [],
leaseApplyInfoList:[], leaseApplyInfoList: [],
// //
leaseApplyDetailsItem:{ leaseApplyDetailsItem: {
parenntId:null, parenntId: null,
createBy: null, createBy: null,
companyId: null, companyId: null,
status: 0, status: 0,
typeId: null, // 4 id typeId: null, // 4 id
typeCn:'', // typeCn: '', //
guigeCn:'', // guigeCn: '', //
unitCn:'', // unitCn: '', //
remark: '', // remark: '', //
preNum: 1, // preNum: 1, //
}, },
// //
queryRules:{ queryRules: {
unitId:[ unitId: [
{ {
required:true,message:'请选择来往单位',trigger:'change',type:'number' required: true,
} message: '请选择来往单位',
trigger: 'change',
type: 'number',
},
], ],
proId:[ proId: [
{ {
required:true,message:'请选择工程',trigger:'change',type:'number' required: true,
} message: '请选择工程',
trigger: 'change',
type: 'number',
},
], ],
// leasePerson: [ // leasePerson: [
// { // {
@ -300,16 +299,16 @@ export default {
// { min: 11, message: "11", trigger: "blur" }, // { min: 11, message: "11", trigger: "blur" },
// ], // ],
}, },
unitList:[], // unitList: [], //
proList:[], // proList: [], //
deviceTypeTree: [], // deviceTypeTree: [], //
taskId:null, // taskId: null, //
// //
deviceTypeTreeProps: { deviceTypeTreeProps: {
multiple:false, multiple: false,
value:'id' value: 'id',
}, },
// //
deviceType: null, deviceType: null,
@ -317,22 +316,16 @@ export default {
// //
form: {}, form: {},
defaultProps: { defaultProps: {
children: "children", children: 'children',
label: "label" label: 'label',
}, },
// //
rules: { rules: {
roleName: [ roleName: [{ required: true, message: '角色名称不能为空', trigger: 'blur' }],
{ required: true, message: "角色名称不能为空", trigger: "blur" } roleKey: [{ required: true, message: '权限字符不能为空', trigger: 'blur' }],
], roleSort: [{ required: true, message: '角色顺序不能为空', trigger: 'blur' }],
roleKey: [ },
{ required: true, message: "权限字符不能为空", trigger: "blur" } }
],
roleSort: [
{ required: true, message: "角色顺序不能为空", trigger: "blur" }
]
}
};
}, },
created() { created() {
this.GetUserInfo() this.GetUserInfo()
@ -343,29 +336,29 @@ export default {
this.GetDeviceTypeTree() this.GetDeviceTypeTree()
// this.getList(); // this.getList();
if(this.$route.query.taskId&&!this.$route.query.isBack){ if (this.$route.query.taskId && !this.$route.query.isBack) {
this.GetTaskDetail(this.$route.query.taskId) this.GetTaskDetail(this.$route.query.taskId)
} }
if(this.$route.query.taskId&&this.$route.query.isBack){ if (this.$route.query.taskId && this.$route.query.isBack) {
this.GetTaskDetail2(this.$route.query.taskId) this.GetTaskDetail2(this.$route.query.taskId)
} }
this.taskId = this.$route.query.taskId this.taskId = this.$route.query.taskId
this.isEdit = this.$route.query.isEdit; this.isEdit = this.$route.query.isEdit
// console.log(typeof(this.isEdit)) // console.log(typeof(this.isEdit))
// this.$set('isEdit',this.$route.query.isEdit) // this.$set('isEdit',this.$route.query.isEdit)
}, },
methods: { methods: {
// //
async GetUserInfo(){ async GetUserInfo() {
const res = await getInfo() const res = await getInfo()
this.user = res.user this.user = res.user
}, },
// //
async GetUnitData(){ async GetUnitData() {
const params = { const params = {
id:this.queryParams.proId id: this.queryParams.proId,
} }
const res = await getUnitData(params) const res = await getUnitData(params)
this.unitList = res.data this.unitList = res.data
@ -373,9 +366,9 @@ export default {
this.GetAgreementInfoById() this.GetAgreementInfoById()
}, },
// //
async GetProData(){ async GetProData() {
const params = { const params = {
id:this.queryParams.unitId id: this.queryParams.unitId,
} }
const res = await getProData(params) const res = await getProData(params)
this.proList = res.data this.proList = res.data
@ -384,30 +377,29 @@ export default {
}, },
// //
async GetDeviceTypeTree(){ async GetDeviceTypeTree() {
const params = { const params = {
level:4 level: 4,
} }
const res = await getDeviceTypeTree(params) const res = await getDeviceTypeTree(params)
this.deviceTypeTree = res.data this.deviceTypeTree = res.data
}, },
// id // id
async GetAgreementInfoById(){ async GetAgreementInfoById() {
if(this.queryParams.unitId && this.queryParams.proId){ if (this.queryParams.unitId && this.queryParams.proId) {
const params = { const params = {
unitId: this.queryParams.unitId, unitId: this.queryParams.unitId,
projectId: this.queryParams.proId projectId: this.queryParams.proId,
} }
const res = await getAgreementInfoById(params) const res = await getAgreementInfoById(params)
if( !(res.data && res.data.agreementId) ){ if (!(res.data && res.data.agreementId)) {
this.$message.error('当前单位和工程未上传'); this.$message.error('当前单位和工程未上传')
this.queryParams.unitId = null this.queryParams.unitId = null
this.queryParams.proId = null this.queryParams.proId = null
this.GetUnitData() this.GetUnitData()
this.GetProData() this.GetProData()
}else{ } else {
this.queryParams.agreementId = res.data.agreementId this.queryParams.agreementId = res.data.agreementId
this.queryParams.agreementCode = res.data.agreementCode this.queryParams.agreementCode = res.data.agreementCode
} }
@ -415,16 +407,16 @@ export default {
}, },
// //
async GetTaskDetail(taskId){ async GetTaskDetail(taskId) {
const res = await getLeaseApplyListAll({taskId}) const res = await getLeaseApplyListAll({ taskId })
const data = res.rows[0] const data = res.rows[0]
// unitId:null, // unitId:null,
// proId:null, // proId:null,
// agreementId:null, //id // agreementId:null, //id
// agreementCode: null, // agreementCode: null,
if(data.taskStatus==100){ if (data.taskStatus == 100) {
this.queryParams.taskStatus = 32 this.queryParams.taskStatus = 32
this.queryParams.examineStatusId = '32' this.queryParams.examineStatusId = '32'
} }
@ -437,21 +429,20 @@ export default {
this.queryParams.leaseApplyInfo.remark = data.leaseApplyInfoList[0].remark this.queryParams.leaseApplyInfo.remark = data.leaseApplyInfoList[0].remark
this.leaseApplyInfoList = data.leaseApplyInfoList this.leaseApplyInfoList = data.leaseApplyInfoList
this.leaseApplyDetails = data.leaseApplyDetails.map(item => { this.leaseApplyDetails = data.leaseApplyDetails.map(item => {
return this.handelEchoData(item) return this.handelEchoData(item)
}) })
}, },
// //
async GetTaskDetail2(taskId){ async GetTaskDetail2(taskId) {
const res = await getLeaseApplyAuditListAll({taskId}) const res = await getLeaseApplyAuditListAll({ taskId })
const data = res.rows[0] const data = res.rows[0]
// unitId:null, // unitId:null,
// proId:null, // proId:null,
// agreementId:null, //id // agreementId:null, //id
// agreementCode: null, // agreementCode: null,
if(data.taskStatus==100){ if (data.taskStatus == 100) {
this.queryParams.taskStatus = 32 this.queryParams.taskStatus = 32
this.queryParams.examineStatusId = '32' this.queryParams.examineStatusId = '32'
} }
@ -464,12 +455,11 @@ export default {
this.queryParams.leaseApplyInfo.remark = data.leaseApplyInfoList[0].remark this.queryParams.leaseApplyInfo.remark = data.leaseApplyInfoList[0].remark
this.leaseApplyInfoList = data.leaseApplyInfoList this.leaseApplyInfoList = data.leaseApplyInfoList
this.leaseApplyDetails = data.leaseApplyDetails.map(item => { this.leaseApplyDetails = data.leaseApplyDetails.map(item => {
return this.handelEchoData(item) return this.handelEchoData(item)
}) })
}, },
// //
handelEchoData(item){ handelEchoData(item) {
const template = JSON.parse(JSON.stringify(this.leaseApplyDetailsItem)) const template = JSON.parse(JSON.stringify(this.leaseApplyDetailsItem))
template.createBy = item.createBy template.createBy = item.createBy
template.companyId = item.companyId template.companyId = item.companyId
@ -483,39 +473,39 @@ export default {
template.parenntId = item.parenntId template.parenntId = item.parenntId
template.num = item.num template.num = item.num
return template return template
}, },
// //
reset() { reset() {
if (this.$refs.menu != undefined) { if (this.$refs.menu != undefined) {
this.$refs.menu.setCheckedKeys([]); this.$refs.menu.setCheckedKeys([])
} }
this.menuExpand = false, ;(this.menuExpand = false),
this.menuNodeAll = false, (this.menuNodeAll = false),
this.deptExpand = true, (this.deptExpand = true),
this.deptNodeAll = false, (this.deptNodeAll = false),
this.form = { (this.form = {
roleId: undefined, roleId: undefined,
roleName: undefined, roleName: undefined,
roleKey: undefined, roleKey: undefined,
roleSort: 0, roleSort: 0,
status: "0", status: '0',
menuIds: [], menuIds: [],
deptIds: [], deptIds: [],
menuCheckStrictly: true, menuCheckStrictly: true,
deptCheckStrictly: true, deptCheckStrictly: true,
remark: undefined remark: undefined,
}; })
this.resetForm("form"); this.resetForm('form')
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm('queryForm')
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
@ -526,77 +516,82 @@ export default {
// //
handleCommand(command, row) { handleCommand(command, row) {
switch (command) { switch (command) {
case "handleDataScope": case 'handleDataScope':
this.handleDataScope(row); this.handleDataScope(row)
break; break
case "handleAuthUser": case 'handleAuthUser':
this.handleAuthUser(row); this.handleAuthUser(row)
break; break
default: default:
break; break
} }
}, },
/** 保存按钮操作 */ /** 保存按钮操作 */
handleAdd() { handleAdd() {
this.$refs.queryForm.validate(async (valid) => { this.$refs.queryForm.validate(async valid => {
if(!valid){ if (!valid) {
return false return false
}else { } else {
this.queryParams.leaseApplyDetails = this.leaseApplyDetails this.queryParams.leaseApplyDetails = this.leaseApplyDetails
if( this.queryParams.leaseApplyDetails.length == 0 ){ if (this.queryParams.leaseApplyDetails.length == 0) {
this.$message.error('请添加数据'); this.$message.error('请添加数据')
return return
} }
this.queryParams.leaseApplyDetails.forEach(item=>{ this.queryParams.leaseApplyDetails.forEach(item => {
if(item.num==0){ /* if(item.num==0){
this.$message.error('机具类型库存量为零无法领料'); this.$message.error('机具类型库存量为零无法领料');
return return
} } */
if(item.preNum==''){ if (item.preNum == '') {
this.$message.error('请填写预领数量'); this.$message.error('请填写预领数量')
return return
} }
})
this.queryParams.createBy = this.user.userName
this.queryParams.companyId = this.user.companyId
let res
if (this.taskId) {
this.leaseApplyInfoList.forEach(v => {
v = Object.assign(v, this.queryParams.leaseApplyInfo)
this.$set(v, 'leaseApplyDetails', this.queryParams.leaseApplyDetails)
}) })
this.queryParams.createBy = this.user.userName
this.queryParams.companyId = this.user.companyId
let res;
if(this.taskId){ const params = {
this.leaseApplyInfoList.forEach(v => { ...this.queryParams,
v = Object.assign(v,this.queryParams.leaseApplyInfo) taskId: this.taskId,
this.$set(v,'leaseApplyDetails',this.queryParams.leaseApplyDetails) leaseApplyInfoList: this.leaseApplyInfoList,
})
const params = {
...this.queryParams,taskId:this.taskId,
leaseApplyInfoList:this.leaseApplyInfoList
}
res = await editLeaseApply(params)
}else {
// console.log(this.queryParams)
res = await submitLeaseApply(this.queryParams)
} }
if(res.code == 200){
this.$message({ res = await editLeaseApply(params)
type:'success', } else {
message: res.msg // console.log(this.queryParams)
}) let isNum = this.queryParams.leaseApplyDetails.every(e => e.num != 0)
this.$tab.closeOpenPage({ path: "/claimAndRefund/receive/receiveApply"});
if (!isNum) {
this.$message.error('机具类型库存量为零无法领料')
return
} }
res = await submitLeaseApply(this.queryParams)
} }
if (res.code == 200) {
this.$message({
type: 'success',
message: res.msg,
})
this.$tab.closeOpenPage({ path: '/claimAndRefund/receive/receiveApply' })
}
}
}) })
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleBack(row) { handleBack(row) {
this.$tab.closeOpenPage({ path: "/claimAndRefund/receive/receiveApply"}); this.$tab.closeOpenPage({ path: '/claimAndRefund/receive/receiveApply' })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
this.leaseApplyDetails.splice(row.index,1) this.leaseApplyDetails.splice(row.index, 1)
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
@ -604,38 +599,39 @@ export default {
// ...this.queryParams // ...this.queryParams
// }, `role_${new Date().getTime()}.xlsx`) // }, `role_${new Date().getTime()}.xlsx`)
}, },
checkNum(row){ checkNum(row) {
let maxNum = row.num let maxNum = row.num
if(row.preNum<=1){ if (row.preNum <= 1) {
row.preNum = 1 row.preNum = 1
}else if(row.preNum>=maxNum){ } else if (row.preNum >= maxNum) {
row.preNum = maxNum row.preNum = maxNum
} }
}, },
/////// ///////
deviceTypeChange(val){ deviceTypeChange(val) {
console.log(val) console.log(val)
let nodes = null; let nodes = null
nodes = this.$refs.deviceTypeCascader.getCheckedNodes().length > 0 ? this.$refs.deviceTypeCascader.getCheckedNodes() : [this.$refs.deviceTypeCascader.panel.getNodeByValue(val)] nodes =
if(nodes[0].level != 4){ this.$refs.deviceTypeCascader.getCheckedNodes().length > 0
? this.$refs.deviceTypeCascader.getCheckedNodes()
: [this.$refs.deviceTypeCascader.panel.getNodeByValue(val)]
if (nodes[0].level != 4) {
return return
} }
// console.log(this.leaseApplyDetails) // console.log(this.leaseApplyDetails)
// console.log(nodes[0].data.id) // console.log(nodes[0].data.id)
for(let i = 0; i < this.leaseApplyDetails.length; i++) { for (let i = 0; i < this.leaseApplyDetails.length; i++) {
if (this.leaseApplyDetails[i].typeId == nodes[0].data.id) { if (this.leaseApplyDetails[i].typeId == nodes[0].data.id) {
this.leaseApplyDetails.splice(i,1) this.leaseApplyDetails.splice(i, 1)
break; break
} }
} }
this.leaseApplyDetails.push( this.leaseApplyDetails.push(this.handelTableItemData(nodes[0]))
this.handelTableItemData(nodes[0]) this.deviceType = {}
)
this.deviceType = {}
}, },
//// ////
handelTableItemData(node){ handelTableItemData(node) {
const template = JSON.parse(JSON.stringify(this.leaseApplyDetailsItem)) const template = JSON.parse(JSON.stringify(this.leaseApplyDetailsItem))
template.createBy = this.user.name template.createBy = this.user.name
console.log(node.data) console.log(node.data)
@ -646,13 +642,13 @@ export default {
template.typeCn = node.pathLabels[2] template.typeCn = node.pathLabels[2]
template.guigeCn = node.pathLabels[3] template.guigeCn = node.pathLabels[3]
if(this.taskId){ if (this.taskId) {
const index = this.leaseApplyInfoList.find(key => key.companyId == node.data.companyId) const index = this.leaseApplyInfoList.find(key => key.companyId == node.data.companyId)
template.parenntId = index ? index.id : '' template.parenntId = index ? index.id : ''
} }
return template return template
} },
} },
}; }
</script> </script>