设备维保返厂维修
This commit is contained in:
parent
20dc420b73
commit
d1e7247422
|
|
@ -11,8 +11,30 @@
|
|||
@close="cancel"
|
||||
>
|
||||
<div class="form_box_one">
|
||||
<div style="font-size: 16px;margin-bottom: 10px;">总金额(元):{{ totalPrice }}</div>
|
||||
<div style="font-size: 16px;margin-bottom: 10px;" v-if="dynamicValidateForm.repairType == 1">总金额(元):{{ totalPrice }}</div>
|
||||
<el-form ref="dynamicValidateForm" :model="dynamicValidateForm" class="demo-dynamic" label-width="140px" >
|
||||
<el-form-item label="维修类型:" prop="repairType"
|
||||
:rules="{
|
||||
required: true,
|
||||
validator: repairTypeValidator,
|
||||
trigger: 'blur',
|
||||
}">
|
||||
<el-select
|
||||
v-model="dynamicValidateForm.repairType"
|
||||
placeholder="请选择"
|
||||
size="small"
|
||||
filterable
|
||||
style="width: 350px"
|
||||
@change="handleChangeRepairType"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in repairTypeList"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="规格型号:" prop="equipmentId" label-width="140px"
|
||||
:rules="{
|
||||
required: true,
|
||||
|
|
@ -53,8 +75,8 @@
|
|||
:value="dict.maId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<div v-for="(domain, index) in dynamicValidateForm.premiumList" :key="domain.key" >
|
||||
</el-form-item>
|
||||
<div v-for="(domain, index) in dynamicValidateForm.premiumList" v-if="dynamicValidateForm.repairType == 1">
|
||||
<p class="form_box_title"></p>
|
||||
<div class="form_box_line"></div>
|
||||
<div >
|
||||
|
|
@ -277,6 +299,129 @@
|
|||
>
|
||||
</div>
|
||||
</div>
|
||||
<div v-for="(domain, index) in dynamicValidateForm.premiumListTwo" :key="domain.key" class="bor_box" v-if="dynamicValidateForm.repairType == 2">
|
||||
<p class="form_box_title"></p>
|
||||
<div class="form_box_line"></div>
|
||||
<div >
|
||||
<el-form-item :prop="'premiumListTwo.' + index + '.repairRemark'" label="技术鉴定:">
|
||||
<el-input
|
||||
v-model="domain.repairRemark"
|
||||
placeholder="请输入"
|
||||
size="small"
|
||||
style="width: 350px"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:prop="'premiumListTwo.' + index + '.repairNum'"
|
||||
label="维修数量:"
|
||||
:rules="{
|
||||
required: true,
|
||||
validator: numberIntegerValidator,
|
||||
trigger: 'blur',
|
||||
}"
|
||||
>
|
||||
<el-input
|
||||
v-model="domain.repairNum"
|
||||
placeholder="请输入"
|
||||
size="small"
|
||||
maxlength="10"
|
||||
style="width: 350px"
|
||||
:disabled="showSelect"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="配件名称:">
|
||||
<el-input
|
||||
v-model="domain.partName"
|
||||
placeholder="请输入"
|
||||
size="small"
|
||||
maxlength="50"
|
||||
style="width: 350px"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:prop="'premiumListTwo.' + index + '.partNum'"
|
||||
label="配件数量:"
|
||||
:rules="{
|
||||
required: false,
|
||||
validator: numberIntegerValidatorPart,
|
||||
trigger: 'blur',
|
||||
}"
|
||||
>
|
||||
<el-input
|
||||
v-model="domain.partNum"
|
||||
placeholder="请输入"
|
||||
size="small"
|
||||
maxlength="10"
|
||||
style="width: 350px"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :prop="'premiumListTwo.' + index + '.repairContentBefore'" label="维修前情况:">
|
||||
<el-input
|
||||
v-model="domain.repairContentBefore"
|
||||
maxlength="100"
|
||||
placeholder="请输入"
|
||||
show-word-limit
|
||||
size="small"
|
||||
style="width: 350px"
|
||||
type="textarea"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :prop="'premiumListTwo.' + index + '.repairContent'" label="维修处理情况:">
|
||||
<el-input
|
||||
v-model="domain.repairContent"
|
||||
maxlength="100"
|
||||
placeholder="请输入"
|
||||
show-word-limit
|
||||
size="small"
|
||||
style="width: 350px"
|
||||
type="textarea"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :prop="'premiumListTwo.' + index + '.fileList'" label="附件:">
|
||||
<el-upload
|
||||
ref="upload_attach"
|
||||
class="upload-demo"
|
||||
:action="uploadUrl"
|
||||
:headers="headers"
|
||||
:data="{ fileType: 'sx' }"
|
||||
list-type="picture-card"
|
||||
accept="image/*,application/pdf,.doc,.docx"
|
||||
:multiple="false"
|
||||
:limit="5"
|
||||
:file-list="domain.fileList"
|
||||
:before-upload="beforeUpload"
|
||||
:on-exceed="handleExceed"
|
||||
:on-success="(res, file, fileList) => handleSuccess(file, fileList, domain)"
|
||||
style="width: 350px"
|
||||
>
|
||||
<i slot="default" class="el-icon-plus"></i>
|
||||
<div slot="file" slot-scope="{ file }">
|
||||
<img
|
||||
v-if="/\.(pdf|PDF)$/i.test(file.fileName)"
|
||||
class="el-upload-list__item-thumbnail"
|
||||
:src="pdfImg"
|
||||
alt=""
|
||||
/>
|
||||
<img
|
||||
v-else-if="/\.(doc|docx)$/i.test(file.fileName)"
|
||||
class="el-upload-list__item-thumbnail"
|
||||
:src="wordImg"
|
||||
alt=""
|
||||
/>
|
||||
<img v-else class="el-upload-list__item-thumbnail" :src="file.fileUrl" alt="" />
|
||||
<span class="el-upload-list__item-actions">
|
||||
<span class="el-upload-list__item-preview" @click="handlePreview(file)">
|
||||
<i class="el-icon-zoom-in" />
|
||||
</span>
|
||||
<span class="el-upload-list__item-delete" @click="handleRemove(file, domain)">
|
||||
<i class="el-icon-delete" />
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer" >
|
||||
<el-button @click="cancel">取消</el-button>
|
||||
|
|
@ -369,6 +514,7 @@ export default {
|
|||
dynamicValidateForm: {
|
||||
equipmentId: null ,
|
||||
maId:'',
|
||||
repairType: null,
|
||||
premiumList: [
|
||||
{
|
||||
selected: 'Y',
|
||||
|
|
@ -385,6 +531,23 @@ export default {
|
|||
repairRemark: '', // 技术鉴定
|
||||
},
|
||||
],
|
||||
premiumListTwo: [
|
||||
{
|
||||
selected: 'Y',
|
||||
premium: undefined,
|
||||
rate: undefined,
|
||||
feeRate: undefined,
|
||||
fee: undefined,
|
||||
baofei1_unit: '',
|
||||
shangyoufeiyonge_unit: '',
|
||||
downRate: undefined,
|
||||
downFee: undefined,
|
||||
xiayoufeiyonge_unit: '',
|
||||
fileList: [],
|
||||
repairRemark: '', // 技术鉴定
|
||||
repairContent: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
deptList: [],
|
||||
userSelectList: [],
|
||||
|
|
@ -406,6 +569,7 @@ export default {
|
|||
equipmentId: undefined,
|
||||
maId: '',
|
||||
maCodeSelectList: [],
|
||||
repairTypeList:[{label:'内部维修',value:1},{label:'返厂维修',value:2}],
|
||||
// rules: {
|
||||
// equipmentId: [
|
||||
// { required: true, message: '规格型号为必填项', trigger: 'change' }
|
||||
|
|
@ -507,6 +671,16 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
repairTypeValidator(rule, value, callback) {
|
||||
console.log("cccccc",value)
|
||||
// 直接使用传入的 value 参数
|
||||
if (!value) { // 包括 null, undefined, '' 等情况
|
||||
callback(new Error('维修类型不能为空'));
|
||||
} else {
|
||||
callback(); // 验证通过
|
||||
}
|
||||
},
|
||||
|
||||
typeCodeValidator(rule, value, callback) {
|
||||
console.log("cccccc",this.dynamicValidateForm.maId)
|
||||
// 直接使用传入的 value 参数
|
||||
|
|
@ -566,6 +740,9 @@ export default {
|
|||
this.dynamicValidateForm.premiumList.forEach((domain) => {
|
||||
domain.repairNum = 1
|
||||
})
|
||||
this.dynamicValidateForm.premiumListTwo.forEach((domain) => {
|
||||
domain.repairNum = 1
|
||||
})
|
||||
})
|
||||
}else{
|
||||
this.showSelect = false
|
||||
|
|
@ -584,6 +761,20 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
handleChangeRepairType(value) {
|
||||
console.log("gggggggg",value)
|
||||
this.$nextTick(() => {
|
||||
this.$refs.dynamicValidateForm.validateField('repairType');
|
||||
});
|
||||
if(value==2){
|
||||
this.dynamicValidateForm.premiumList = []
|
||||
this.addDomainTwo()
|
||||
}else if(value==1){
|
||||
this.dynamicValidateForm.premiumListTwo = []
|
||||
this.addDomainOne()
|
||||
}
|
||||
},
|
||||
|
||||
// 获取 设备树结构数据
|
||||
async GetDeviceTypeTree() {
|
||||
const params = {
|
||||
|
|
@ -625,26 +816,43 @@ export default {
|
|||
this.dynamicValidateForm = {
|
||||
equipmentId: null,
|
||||
maId: '',
|
||||
premiumList: []
|
||||
repairType: null,
|
||||
premiumList: [],
|
||||
premiumListTwo: [],
|
||||
};
|
||||
console.log("xxxxxxxxxxxxxxx",this.rowObj)
|
||||
if(this.rowObj!=null && this.rowObj.id){
|
||||
const res = await getEquipmentInfo({ id: this.rowObj.id})
|
||||
this.dynamicValidateForm.maId = res.data.maId
|
||||
this.dynamicValidateForm.equipmentId = res.data.typeId
|
||||
this.dynamicValidateForm.premiumList = res.data.partList.map((item, index) => ({
|
||||
...item,
|
||||
key: `${Date.now()}_${index}` // 生成唯一 key
|
||||
}))
|
||||
this.dynamicValidateForm.premiumList.forEach((domain, index) => {
|
||||
if (domain.partId) {
|
||||
this.handleSelectTreeEdit(domain.partId, index)
|
||||
this.dynamicValidateForm.maId = res.data.maId
|
||||
this.dynamicValidateForm.repairType = res.data.repairType
|
||||
this.maCodeSelectList = []
|
||||
if(res.data.repairType==1){
|
||||
// 内部维修
|
||||
this.dynamicValidateForm.premiumList = res.data.partList.map((item, index) => ({
|
||||
...item,
|
||||
key: `${Date.now()}_${index}` // 生成唯一 key
|
||||
}))
|
||||
this.dynamicValidateForm.premiumList.forEach((domain, index) => {
|
||||
if (domain.partId) {
|
||||
this.handleSelectTreeEdit(domain.partId, index)
|
||||
}
|
||||
})
|
||||
if(res.data.partList.length==0){
|
||||
this.dynamicValidateForm.premiumList.push({repairer:res.data.repairer,updateTime:res.data.repairTime,repairNum:res.data.repairNum})
|
||||
}
|
||||
}else{
|
||||
// 返厂维修
|
||||
this.dynamicValidateForm.premiumListTwo = res.data.partList.map((item, index) => ({
|
||||
...item,
|
||||
}))
|
||||
if(res.data.partList.length==0){
|
||||
this.dynamicValidateForm.premiumListTwo.push({repairNum:res.data.repairNum})
|
||||
}
|
||||
}
|
||||
|
||||
this.maCodeSelectList = []
|
||||
console.log("cccccccccccc",this.deviceTypeTreeData)
|
||||
this.selectedNodeData = this.findNodeDevice(this.deviceTypeTreeData, res.data.typeId);
|
||||
console.log("jjjjjjjjjjj",this.selectedNodeData)
|
||||
|
||||
if(this.selectedNodeData.manageType==0){
|
||||
GetMaCodeSelectApi({
|
||||
typeId: res.data.typeId,
|
||||
|
|
@ -657,12 +865,9 @@ export default {
|
|||
this.showSelect = false
|
||||
this.dynamicValidateForm.maId = ''
|
||||
}
|
||||
})
|
||||
if(res.data.partList.length==0){
|
||||
this.dynamicValidateForm.premiumList.push({repairer:res.data.repairer,updateTime:res.data.repairTime,repairNum:res.data.repairNum})
|
||||
}
|
||||
|
||||
}else{
|
||||
this.addDomainOne()
|
||||
// this.addDomainOne()
|
||||
}
|
||||
|
||||
// 获取用户信息和用户选择列表
|
||||
|
|
@ -681,7 +886,9 @@ export default {
|
|||
this.$refs.dynamicValidateForm.resetFields();
|
||||
this.dialogShowFlag = false
|
||||
this.dynamicValidateForm.premiumList = [];
|
||||
this.dynamicValidateForm.premiumListTwo = [];
|
||||
this.dynamicValidateForm.maId = '';
|
||||
this.dynamicValidateForm.repairType = null;
|
||||
this.dynamicValidateForm.equipmentId = null;
|
||||
this.selectedNodeData = null;
|
||||
this.maCodeSelectList = [];
|
||||
|
|
@ -719,7 +926,7 @@ export default {
|
|||
fileList: [],
|
||||
partChange: '',
|
||||
partChangeNum: '',
|
||||
updateTime: formatDate(new Date()),
|
||||
updateTime: formatDate(new Date()),
|
||||
};
|
||||
this.dynamicValidateForm.premiumList.push(newDomain);
|
||||
},
|
||||
|
|
@ -729,20 +936,52 @@ export default {
|
|||
)
|
||||
|
||||
},
|
||||
|
||||
// 返厂
|
||||
addDomainTwo() {
|
||||
this.dynamicValidateForm.premiumListTwo.push({
|
||||
selected: 'N',
|
||||
partName: '',
|
||||
repairer: '',
|
||||
partType: 0,
|
||||
partNum: '',
|
||||
partCost: '',
|
||||
repairContent: '',
|
||||
repairContentBefore: '',
|
||||
repairNum: 1,
|
||||
key: Date.now(),
|
||||
repairRemark: '',
|
||||
fileList: [],
|
||||
})
|
||||
},
|
||||
|
||||
submit() {
|
||||
this.$refs['dynamicValidateForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
//新增
|
||||
if(this.rowObj==null || this.rowObj.id==''){
|
||||
// 编码管理传递参数
|
||||
console.log('this.dynamicValidateForm.premiumList1111)', this.dynamicValidateForm.premiumList)
|
||||
let params = {
|
||||
maId: this.dynamicValidateForm.maId === '' ? null : this.dynamicValidateForm.maId,
|
||||
typeId: this.selectedNodeData.id,
|
||||
companyId: this.companyId,
|
||||
partStrList: JSON.stringify(this.dynamicValidateForm.premiumList),
|
||||
manageType: this.selectedNodeData.manageType,
|
||||
repairNum: this.dynamicValidateForm.premiumList[0]?.repairNum ?? 1,
|
||||
let params = {}
|
||||
// 如果是内部维修
|
||||
if(this.dynamicValidateForm.repairType==1){
|
||||
params = {
|
||||
repairType: this.dynamicValidateForm.repairType,
|
||||
maId: this.dynamicValidateForm.maId === '' ? null : this.dynamicValidateForm.maId,
|
||||
typeId: this.selectedNodeData.id,
|
||||
companyId: this.companyId,
|
||||
partStrList: JSON.stringify(this.dynamicValidateForm.premiumList),
|
||||
manageType: this.selectedNodeData.manageType,
|
||||
repairNum: this.dynamicValidateForm.premiumList[0]?.repairNum ?? 1,
|
||||
}
|
||||
}else if(this.dynamicValidateForm.repairType==2){
|
||||
params = {
|
||||
repairType: this.dynamicValidateForm.repairType,
|
||||
maId: this.dynamicValidateForm.maId === '' ? null : this.dynamicValidateForm.maId,
|
||||
typeId: this.selectedNodeData.id,
|
||||
companyId: this.companyId,
|
||||
partStrList: JSON.stringify(this.dynamicValidateForm.premiumListTwo),
|
||||
manageType: this.selectedNodeData.manageType,
|
||||
repairNum: this.dynamicValidateForm.premiumListTwo[0]?.repairNum ?? 1,
|
||||
}
|
||||
}
|
||||
this.fullscreenLoading = true
|
||||
submitEquipmentApiNew(params)
|
||||
|
|
@ -761,18 +1000,33 @@ export default {
|
|||
this.fullscreenLoading = false
|
||||
})
|
||||
}else{
|
||||
//编辑
|
||||
// 编码管理传递参数
|
||||
console.log('this.dynamicValidateForm.premiumList1111)', this.dynamicValidateForm.premiumList)
|
||||
let params = {
|
||||
id: this.rowObj.id,
|
||||
maId: this.dynamicValidateForm.maId === '' ? null : this.dynamicValidateForm.maId,
|
||||
typeId: this.selectedNodeData.id,
|
||||
companyId: this.companyId,
|
||||
partStrList: JSON.stringify(this.dynamicValidateForm.premiumList),
|
||||
manageType: this.selectedNodeData.manageType,
|
||||
repairNum: this.dynamicValidateForm.premiumList[0]?.repairNum ?? 1,
|
||||
// 编辑
|
||||
let params = {}
|
||||
// 如果是内部维修
|
||||
if(this.dynamicValidateForm.repairType==1){
|
||||
params = {
|
||||
id: this.rowObj.id,
|
||||
repairType: this.dynamicValidateForm.repairType,
|
||||
maId: this.dynamicValidateForm.maId === '' ? null : this.dynamicValidateForm.maId,
|
||||
typeId: this.selectedNodeData.id,
|
||||
companyId: this.companyId,
|
||||
partStrList: JSON.stringify(this.dynamicValidateForm.premiumList),
|
||||
manageType: this.selectedNodeData.manageType,
|
||||
repairNum: this.dynamicValidateForm.premiumList[0]?.repairNum ?? 1,
|
||||
}
|
||||
}else if(this.dynamicValidateForm.repairType==2){
|
||||
params = {
|
||||
id: this.rowObj.id,
|
||||
repairType: this.dynamicValidateForm.repairType,
|
||||
maId: this.dynamicValidateForm.maId === '' ? null : this.dynamicValidateForm.maId,
|
||||
typeId: this.selectedNodeData.id,
|
||||
companyId: this.companyId,
|
||||
partStrList: JSON.stringify(this.dynamicValidateForm.premiumListTwo),
|
||||
manageType: this.selectedNodeData.manageType,
|
||||
repairNum: this.dynamicValidateForm.premiumListTwo[0]?.repairNum ?? 1,
|
||||
}
|
||||
}
|
||||
|
||||
this.fullscreenLoading = true
|
||||
editEquipmentApiNew(params)
|
||||
.then((res) => {
|
||||
|
|
@ -952,6 +1206,7 @@ export default {
|
|||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
font-size: 12px;
|
||||
margin-left:20px;
|
||||
}
|
||||
|
||||
.form_box_line {
|
||||
|
|
|
|||
|
|
@ -95,6 +95,12 @@
|
|||
<el-table-column label="维修数量" align="center" prop="repairNum" show-overflow-tooltip width="100px"/>
|
||||
<el-table-column label="维修人" align="center" prop="repairer" show-overflow-tooltip />
|
||||
<el-table-column label="维修时间" align="center" prop="repairTime" show-overflow-tooltip />
|
||||
<el-table-column label="维修类型" align="center" prop="repairType" show-overflow-tooltip >
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.repairType == 1">内部维修</span>
|
||||
<span v-if="scope.row.repairType == 2">返厂维修</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="维保状态" align="center" prop="repairStatus" show-overflow-tooltip >
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.repairStatus === 1">
|
||||
|
|
@ -453,7 +459,7 @@ export default {
|
|||
{
|
||||
...this.queryParams
|
||||
},
|
||||
`维报列表清单_${new Date().getTime()}.xlsx`,
|
||||
`维保列表清单_${new Date().getTime()}.xlsx`,
|
||||
)
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue