维修暂存

This commit is contained in:
hongchao 2025-07-15 17:36:42 +08:00
parent 71da8bb658
commit d3c92ea059
6 changed files with 851 additions and 99 deletions

View File

@ -93,6 +93,35 @@ export function submitRepairApplyApiNew(data) {
data: data
})
}
//机具设备管理--保存
export function saveRepairApplyApiNew(data) {
return request({
url: '/material/base/repair/saveRepairApplyNew',
method: 'post',
contentType: 'application/json',
data: data
})
}
//清除 维修暂存
export function clearSaveApi(data) {
return request({
url: '/material/base/repair/clearSaveRepairApplyNew',
method: 'post',
contentType: 'application/json',
data: data
})
}
//机具设备管理--获取维修暂存信息
export function getSaveInfo(params) {
return request({
url: '/material/base/repair/getSaveInfo',
method: 'get',
params
})
}
// 用户下拉选
export function getUserSelectApi(params) {
return request({

View File

@ -230,7 +230,9 @@
</el-form>
<div slot="footer" class="dialog-footer" v-if="rowObj.code !== null && rowObj.code !== ''">
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="submit">保存</el-button>
<el-button @click="clearSave" v-if="rowObj.submitStatus==1">清除保存</el-button>
<el-button type="primary" @click="save">保存</el-button>
<el-button type="success" @click="submit">提交</el-button>
</div>
</div>
<div class="form_box_two">
@ -477,7 +479,9 @@
</el-form>
<div slot="footer" class="dialog-footer" v-if="rowObj.code == null || rowObj.code == ''">
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="submitTwo">保存</el-button>
<el-button @click="clearSaveTwo" v-if="rowObj.submitStatus==1">清除保存</el-button>
<el-button type="primary" @click="saveTwo">保存</el-button>
<el-button type="success" @click="submitTwo">提交</el-button>
</div>
</div>
</el-dialog>
@ -489,7 +493,10 @@ import {
listPartType,
getCostByPidAndNumApi,
submitRepairApplyApiNew
submitRepairApplyApiNew,
saveRepairApplyApiNew,
getSaveInfo,
clearSaveApi,
} from '@/api/repairTest/repair'
// import { listPartType, } from "@/api/store/tools";
import Treeselect from '@riophae/vue-treeselect'
@ -549,7 +556,7 @@ export default {
},
// manageType
formToWatch() {
return this.rowObj.manageType === 0 ? this.dynamicValidateForm.premiumList : this.dynamicValidateFormTwo.premiumListTwo;
return this.rowObj.manageType == 0 ? this.dynamicValidateForm.premiumList : this.dynamicValidateFormTwo.premiumListTwo;
}
},
data() {
@ -654,7 +661,7 @@ export default {
if (value === '' || reg.test(value)) {
callback()
} else {
callback(new Error('请输入大于0的数,最多2小数'))
callback(new Error('请输入大于0的数,最多2小数'))
}
},
//--
@ -715,37 +722,69 @@ export default {
}
})
},
init() {
async init() {
console.log('this.rowObj', this.rowObj)
getInfo()
.then((res) => {
this.companyId = res.user.companyId
this.currentUserId = res.user.userId
// getUserSelectApi Promise
return getUserSelectApi({ roleIds: [133] })
try {
//
this.dynamicValidateForm.premiumList = []
this.dynamicValidateFormTwo.premiumListTwo = []
if (this.rowObj.submitStatus === 1 && this.rowObj.manageType ==1) {
const res = await getSaveInfo({ typeId: this.rowObj.typeId,maId:this.rowObj.maId })
this.dynamicValidateFormTwo.premiumListTwo = res.data.partList.map((item, index) => ({
...item,
key: `${Date.now()}_${index}` // key
}))
this.dynamicValidateFormTwo.premiumListTwo.forEach((domain, index) => {
if (domain.partId) {
this.handleSelectTreeNum(domain.partId, index)
}
})
if(res.data.partList.length==0){
this.dynamicValidateFormTwo.premiumListTwo.push({repairer:res.data.repairer,updateTime:res.data.createTime,repairNum:res.data.repairNum})
}
}else if(this.rowObj.submitStatus === 1 && this.rowObj.manageType ==0){
const res = await getSaveInfo({ typeId: this.rowObj.typeId,maId:this.rowObj.maId })
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.handleSelectTreeNum(domain.partId, index)
}
})
if(res.data.partList.length==0){
this.dynamicValidateForm.premiumList.push({repairer:res.data.repairer,updateTime:res.data.createTime,repairNum:res.data.repairNum})
}
}else {
if (this.rowObj.manageType === 0) {
this.addDomainOne()
} else {
this.addDomainTwo()
}
this.dynamicValidateForm.premiumList.forEach((item) => {
item.repairRemark = this.rowObj.repairRemark
})
.then((response) => {
this.userSelectList = response.data
if (this.rowObj.manageType == 0) {
this.dynamicValidateForm.premiumList = []
this.dynamicValidateFormTwo.premiumListTwo = []
this.addDomainOne()
} else {
this.dynamicValidateForm.premiumList = []
this.dynamicValidateFormTwo.premiumListTwo = []
this.addDomainTwo()
}
this.dynamicValidateForm.premiumList.forEach((item) => {
item.repairRemark = this.rowObj.repairRemark
})
this.dynamicValidateFormTwo.premiumListTwo.forEach((item) => {
item.repairRemark = this.rowObj.repairRemark
})
})
.catch((error) => {
console.error('初始化出错:', error)
})
},
this.dynamicValidateFormTwo.premiumListTwo.forEach((item) => {
item.repairRemark = this.rowObj.repairRemark
})
}
//
const userInfoRes = await getInfo()
this.companyId = userInfoRes.user.companyId
this.currentUserId = userInfoRes.user.userId
const userSelectRes = await getUserSelectApi({ roleIds: [133] })
this.userSelectList = userSelectRes.data
} catch (error) {
console.error('初始化出错:', error)
}
},
//
cancel() {
this.dialogShowFlag = false
@ -831,7 +870,6 @@ export default {
if (valid) {
//
console.log('this.dynamicValidateForm.premiumList1111)', this.dynamicValidateForm.premiumList)
let params = {
maId: this.rowObj.maId,
typeId: this.rowObj.typeId,
@ -864,9 +902,53 @@ export default {
}
})
},
save() {
this.$refs['dynamicValidateForm'].validate((valid) => {
if (valid) {
//
console.log('this.dynamicValidateForm.premiumList1111)', this.dynamicValidateForm.premiumList)
let params = {
maId: this.rowObj.maId,
typeId: this.rowObj.typeId,
id: this.rowObj.id,
repairType: 1,
companyId: this.companyId,
partStrList: JSON.stringify(this.dynamicValidateForm.premiumList),
manageType: 0,
repairNum: this.dynamicValidateForm.premiumList[0]?.repairNum ?? 1,
maId: this.rowObj.maId,
}
this.fullscreenLoading = true
saveRepairApplyApiNew(params)
.then((res) => {
if (res.code == 200) {
this.getList()
this.fullscreenLoading = false
this.dialogShowFlag = false
this.index = null
this.$message.success('操作成功!')
this.$emit('domainChangeTwo', res.code)
}
})
.catch(() => {
this.index = null
this.fullscreenLoading = false
})
} else {
return false
}
})
},
submitTwo() {
this.$refs['dynamicValidateFormTwo'].validate((valid) => {
if (valid) {
if(this.dynamicValidateFormTwo.premiumListTwo[0]?.repairNum > this.rowObj.repairNotFinishNum){
this.$message.error('维修数量不能大于待维修数量')
return
}
//
let params = {
maId: this.rowObj.maId,
@ -900,6 +982,131 @@ export default {
}
})
},
//
saveTwo() {
this.$refs['dynamicValidateFormTwo'].validate((valid) => {
if (valid) {
if(this.dynamicValidateFormTwo.premiumListTwo[0]?.repairNum > this.rowObj.repairNotFinishNum){
this.$message.error('维修数量不能大于待维修数量')
return
}
//
let params = {
maId: this.rowObj.maId,
typeId: this.rowObj.typeId,
id: this.rowObj.id,
companyId: this.companyId,
repairType: 1,
partStrList: JSON.stringify(this.dynamicValidateFormTwo.premiumListTwo),
manageType: 1,
repairNum: this.dynamicValidateFormTwo.premiumListTwo[0]?.repairNum ?? 1,
}
this.fullscreenLoading = true
console.log("xxxxxxxxxxxxxxxxxxx",params)
saveRepairApplyApiNew(params)
.then((res) => {
if (res.code == 200) {
this.getList()
this.fullscreenLoading = false
this.dialogShowFlag = false
this.index = null
this.$message.success('操作成功!')
this.$emit('domainChange', res.code)
}
})
.catch(() => {
this.index = null
this.fullscreenLoading = false
})
} else {
return false
}
})
},
async clearSave() {
try {
//
await this.$confirm('是否确认清除保存?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
});
//
const params = {
maId: this.rowObj.maId,
typeId: this.rowObj.typeId,
id: this.rowObj.id
};
this.fullscreenLoading = true
const res = await clearSaveApi(params);
if (res.code === 200) {
//
this.$message.success('清除保存成功');
this.fullscreenLoading = false
this.dialogShowFlag = false
this.$emit('domainChangeTwo', res.code)
} else {
//
this.fullscreenLoading = false
this.$message.error('清除保存失败,请稍后重试');
}
} catch (error) {
if (error !== 'cancel') {
//
this.fullscreenLoading = false
this.$message.error('操作出错,请稍后重试');
}
}
},
async clearSaveTwo() {
try {
//
await this.$confirm('是否确认清除保存?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
});
//
const params = {
maId: this.rowObj.maId,
typeId: this.rowObj.typeId,
id: this.rowObj.id
};
this.fullscreenLoading = true
const res = await clearSaveApi(params);
if (res.code === 200) {
//
this.$message.success('清除保存成功');
this.fullscreenLoading = false
this.dialogShowFlag = false
this.$emit('domainChange', res.code)
} else {
//
this.fullscreenLoading = false
this.$message.error('清除保存失败,请稍后重试');
}
} catch (error) {
if (error !== 'cancel') {
//
this.fullscreenLoading = false
this.$message.error('操作出错,请稍后重试');
}
}
},
handleSelectTree(value, index) {
if (value) {
this.isRequired = true;
@ -979,6 +1186,7 @@ export default {
console.log('🚀 ~ domain.fileList:', domain.fileList)
},
handlePreview(file) {
console.log("ccccccccccccccccc",file)
if (file.response) {
window.open(file.response.data.fileUrl)
} else {

View File

@ -73,7 +73,9 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="submit">保存</el-button>
<el-button @click="clearSave" v-if="rowObj.submitStatus==1">清除保存</el-button>
<el-button type="primary" @click="save">保存</el-button>
<el-button type="success" @click="submit">提交</el-button>
</div>
</div>
<div class="form_box_two" v-if="isShow">
@ -155,7 +157,9 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="submitTwo">保存</el-button>
<el-button @click="clearSaveTwo" v-if="rowObj.submitStatus==1">清除保存</el-button>
<el-button type="primary" @click="saveTwo">保存</el-button>
<el-button type="success" @click="submitTwo">提交</el-button>
</div>
</div>
</el-dialog>
@ -163,7 +167,7 @@
<script>
import uploadImage from './uploadImage.vue'
import upload from './upload.vue'
import { submitRepairApplyApi, getRepairMaTypeListApi,submitRepairApplyApiNew } from '@/api/repairTest/repair'
import { submitRepairApplyApi, getRepairMaTypeListApi,submitRepairApplyApiNew,saveRepairApplyApiNew,getSaveInfo,clearSaveApi } from '@/api/repairTest/repair'
import { getInfo } from '@/api/login'
export default {
components: {
@ -250,6 +254,7 @@ export default {
// return this.$confirm(` ${file.name}`);
},
handleSuccess(response, fileList) {
console.log('xxxxxxxxxxxxxxxxxxx', fileList)
this.fileList = fileList
fileList.map(item => {
this.fileIds = fileList.map(item => item.response.data.id).join(',')
@ -288,7 +293,13 @@ export default {
fileName: item.response.data.fileName,
fileUrl: item.response.data.fileUrl,
})
}else if(item.name){
fileList.push({
fileName: item.name,
fileUrl: item.url,
})
}
})
}
console.log('fileList', fileList)
@ -330,8 +341,9 @@ export default {
}
})
},
submitTwo() {
this.$refs['dynamicValidateFormTwo'].validate(valid => {
save() {
this.$refs['dynamicValidateForm'].validate(valid => {
if (valid) {
let fileList = []
if (this.fileList.length > 0) {
@ -341,10 +353,79 @@ export default {
fileName: item.response.data.fileName,
fileUrl: item.response.data.fileUrl,
})
}else if(item.name){
fileList.push({
fileName: item.name,
fileUrl: item.url,
})
}
})
}
console.log('fileList', fileList)
//
let params = {
maId: this.rowObj.maId,
typeId: this.rowObj.typeId,
id: this.rowObj.id,
repairType: 3,
companyId: this.companyId,
scrapReason: this.dynamicValidateForm.scrapReason,
scrapType: this.dynamicValidateForm.scrapType,
fileIds: this.fileIds.length > 0 ? this.fileIds : '',
scrapNum: 1,
repairNum: 1,
repairRemark: this.dynamicValidateForm.repairRemark,
fileList: fileList,
manageType: 0,
maId: this.rowObj.maId,
}
this.fullscreenLoading = true
saveRepairApplyApiNew(params)
.then(res => {
if (res.code == 200) {
this.fileList = []
this.fileIds = []
this.getList()
this.$message.success('操作成功!')
this.fullscreenLoading = false
this.dialogShowFlag = false
this.$emit('domainChangeTwo', res.code)
}
})
.catch(() => {
this.fullscreenLoading = false
})
} else {
return false
}
})
},
submitTwo() {
this.$refs['dynamicValidateFormTwo'].validate(valid => {
if (valid) {
if(this.dynamicValidateFormTwo.scrapNum > this.rowObj.repairNotFinishNum){
this.$message.error('报废数量不能大于待维修数量')
return
}
let fileList = []
if (this.fileList.length > 0) {
this.fileList.forEach(item => {
if (item.response && item.response.code == 200) {
fileList.push({
fileName: item.response.data.fileName,
fileUrl: item.response.data.fileUrl,
})
}else if(item.name){
fileList.push({
fileName: item.name,
fileUrl: item.url,
})
}
})
}
console.log('fileList', fileList)
//
let params = {
maId: this.rowObj.maId,
@ -385,51 +466,228 @@ export default {
}
})
},
//
saveTwo() {
this.$refs['dynamicValidateFormTwo'].validate(valid => {
if (valid) {
if(this.dynamicValidateFormTwo.scrapNum > this.rowObj.repairNotFinishNum){
this.$message.error('报废数量不能大于待维修数量')
return
}
let fileList = []
if (this.fileList.length > 0) {
this.fileList.forEach(item => {
if (item.response && item.response.code == 200) {
fileList.push({
fileName: item.response.data.fileName,
fileUrl: item.response.data.fileUrl,
})
}else if(item.name){
fileList.push({
fileName: item.name,
fileUrl: item.url,
})
}
})
}
console.log('fileList', fileList)
//
let params = {
maId: this.rowObj.maId,
typeId: this.rowObj.typeId,
id: this.rowObj.id,
companyId: this.companyId,
repairType: 3,
companyId: this.companyId,
scrapReason: this.dynamicValidateFormTwo.scrapReason,
scrapType: this.dynamicValidateFormTwo.scrapType,
fileIds: this.fileIds.length > 0 ? this.fileIds : '',
scrapNum: this.dynamicValidateFormTwo.scrapNum,
repairNum: this.dynamicValidateFormTwo.scrapNum,
repairRemark: this.dynamicValidateFormTwo.repairRemark,
fileList: fileList,
manageType: 1,
}
this.fullscreenLoading = true
saveRepairApplyApiNew(params)
.then(res => {
if (res.code == 200) {
this.$refs.dynamicValidateFormTwo.clearValidate()
this.fileList = []
this.fileIds = []
this.getList()
this.$message.success('操作成功!')
this.fullscreenLoading = false
this.dialogShowFlag = false
this.$emit('domainChange', res.code)
}
})
.catch(() => {
this.$refs.dynamicValidateFormTwo.clearValidate()
this.fullscreenLoading = false
})
} else {
return false
}
})
},
fileListChange(data) {
data.map(item => {
this.fileIds = data.map(item => item.id).join(',')
})
},
init() {
console.log('init', this.rowObj)
//
if (this.$refs.dynamicValidateForm) this.$refs.dynamicValidateForm.clearValidate()
if (this.$refs.dynamicValidateFormTwo) this.$refs.dynamicValidateFormTwo.clearValidate()
if (this.rowObj.manageType == 0) {
this.dynamicValidateForm = {
scrapReason: '',
scrapType: 1,
repairRemark: this.rowObj.repairRemark || '',
async clearSave() {
try {
//
await this.$confirm('是否确认清除保存?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
});
//
const params = {
maId: this.rowObj.maId,
typeId: this.rowObj.typeId,
id: this.rowObj.id
};
this.fullscreenLoading = true
const res = await clearSaveApi(params);
if (res.code === 200) {
//
this.$message.success('清除保存成功');
this.fullscreenLoading = false
this.dialogShowFlag = false
this.$emit('domainChangeTwo', res.code)
} else {
//
this.fullscreenLoading = false
this.$message.error('清除保存失败,请稍后重试');
}
} catch (error) {
if (error !== 'cancel') {
//
this.fullscreenLoading = false
this.$message.error('操作出错,请稍后重试');
}
}
this.dynamicValidateFormTwo = {
scrapNum: '',
scrapReason: '',
scrapType: 1,
repairRemark: this.rowObj.repairRemark || '',
}
this.isShow = false
} else {
this.dynamicValidateForm = {
scrapReason: '',
scrapType: 1,
repairRemark: this.rowObj.repairRemark || '',
}
this.dynamicValidateFormTwo = {
scrapNum: '',
scrapReason: '',
scrapType: 1,
repairRemark: this.rowObj.repairRemark || '',
}
this.isShow = true
}
// this.dynamicValidateForm.repairRemark = this.rowObj.repairRemark
// this.dynamicValidateFormTwo.repairRemark = this.rowObj.repairRemark
getInfo().then(res => {
this.companyId = res.user.companyId
})
this.fileList = []
this.fileIds = []
},
async clearSaveTwo() {
try {
//
await this.$confirm('是否确认清除保存?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
});
//
const params = {
maId: this.rowObj.maId,
typeId: this.rowObj.typeId,
id: this.rowObj.id
};
this.fullscreenLoading = true
const res = await clearSaveApi(params);
if (res.code === 200) {
//
this.$message.success('清除保存成功');
this.fullscreenLoading = false
this.dialogShowFlag = false
this.$emit('domainChange', res.code)
} else {
//
this.fullscreenLoading = false
this.$message.error('清除保存失败,请稍后重试');
}
} catch (error) {
if (error !== 'cancel') {
//
this.fullscreenLoading = false
this.$message.error('操作出错,请稍后重试');
}
}
},
async init() {
console.log('this.rowObj', this.rowObj)
try {
if (this.$refs.dynamicValidateForm) this.$refs.dynamicValidateForm.clearValidate()
if (this.$refs.dynamicValidateFormTwo) this.$refs.dynamicValidateFormTwo.clearValidate()
if (this.rowObj.submitStatus === 1 && this.rowObj.manageType ==1) {
const res = await getSaveInfo({ typeId: this.rowObj.typeId,maId:this.rowObj.maId })
this.dynamicValidateFormTwo = res.data.partList[0]
this.fileList = res.data.partList[0].fileList.map(file => ({
...file,
name: file.fileName,
url:file.fileUrl
}))
}else if(this.rowObj.submitStatus === 1 && this.rowObj.manageType ==0){
const res = await getSaveInfo({ typeId: this.rowObj.typeId,maId:this.rowObj.maId })
const responseData = res.data.partList[0];
//
this.dynamicValidateForm = res.data.partList[0]
this.fileList = res.data.partList[0].fileList.map(file => ({
...file,
name: file.fileName,
url:file.fileUrl
}))
this.isShow = false
}else {
if (this.rowObj.manageType === 0) {
this.dynamicValidateForm = {
scrapReason: '',
scrapType: 1,
repairRemark: this.rowObj.repairRemark || '',
}
this.dynamicValidateFormTwo = {
scrapNum: '',
scrapReason: '',
scrapType: 1,
repairRemark: this.rowObj.repairRemark || '',
}
this.isShow = false
} else {
this.dynamicValidateForm = {
scrapReason: '',
scrapType: 1,
repairRemark: this.rowObj.repairRemark || '',
}
this.dynamicValidateFormTwo = {
scrapNum: '',
scrapReason: '',
scrapType: 1,
repairRemark: this.rowObj.repairRemark || '',
}
this.isShow = true
}
this.fileList = []
this.fileIds = []
}
const userInfoRes = await getInfo()
this.companyId = userInfoRes.user.companyId
} catch (error) {
console.error('初始化出错:', error)
}
},
//
cancel() {
// this.$refs.dynamicValidateFormTwo.clearValidate()

View File

@ -187,7 +187,9 @@
</el-form>
<div slot="footer" class="dialog-footer" v-if="rowObj.code !== null && rowObj.code !== ''">
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="submit">保存</el-button>
<el-button @click="clearSave" v-if="rowObj.submitStatus==1">清除保存</el-button>
<el-button type="primary" @click="save">保存</el-button>
<el-button type="success" @click="submit">提交</el-button>
</div>
</div>
<div class="form_box_two">
@ -399,7 +401,9 @@
</el-form>
<div slot="footer" class="dialog-footer" v-if="rowObj.code == null || rowObj.code == ''">
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="submitTwo">保存</el-button>
<el-button @click="clearSaveTwo" v-if="rowObj.submitStatus==1">清除保存</el-button>
<el-button type="primary" @click="saveTwo">保存</el-button>
<el-button type="success" @click="submitTwo">提交</el-button>
</div>
</div>
</el-dialog>
@ -412,6 +416,9 @@ import {
listPartType,
getSupplierSelectApi,
submitRepairApplyApiNew,
saveRepairApplyApiNew,
getSaveInfo,
clearSaveApi
} from '@/api/repairTest/repair'
// import { listPartType, } from "@/api/store/tools";
import Treeselect from '@riophae/vue-treeselect'
@ -579,25 +586,69 @@ export default {
}
})
},
init() {
if (this.rowObj.manageType == 0) {
this.dynamicValidateForm.premiumList = []
this.dynamicValidateFormTwo.premiumListTwo = []
// init() {
// if (this.rowObj.manageType == 0) {
// this.dynamicValidateForm.premiumList = []
// this.dynamicValidateFormTwo.premiumListTwo = []
// this.addDomainOne()
// } else {
// this.dynamicValidateForm.premiumList = []
// this.dynamicValidateFormTwo.premiumListTwo = []
// this.addDomainTwo()
// }
// this.dynamicValidateForm.premiumList.forEach((item) => {
// item.repairRemark = this.rowObj.repairRemark
// })
// this.dynamicValidateFormTwo.premiumListTwo.forEach((item) => {
// item.repairRemark = this.rowObj.repairRemark
// })
// getSupplierSelectApi().then((res) => {
// this.supplierSelectList = res.data
// })
// },
async init() {
console.log('this.rowObj', this.rowObj)
try {
//
this.dynamicValidateForm.premiumList = []
this.dynamicValidateFormTwo.premiumListTwo = []
if (this.rowObj.submitStatus === 1 && this.rowObj.manageType ==1) {
const res = await getSaveInfo({ typeId: this.rowObj.typeId,maId:this.rowObj.maId })
this.dynamicValidateFormTwo.premiumListTwo = res.data.partList.map((item, index) => ({
...item,
}))
}else if(this.rowObj.submitStatus === 1 && this.rowObj.manageType ==0){
const res = await getSaveInfo({ typeId: this.rowObj.typeId,maId:this.rowObj.maId })
this.dynamicValidateForm.premiumList = res.data.partList.map((item, index) => ({
...item,
}))
}else {
if (this.rowObj.manageType === 0) {
this.addDomainOne()
} else {
this.dynamicValidateForm.premiumList = []
this.dynamicValidateFormTwo.premiumListTwo = []
} else {
this.addDomainTwo()
}
this.dynamicValidateForm.premiumList.forEach((item) => {
item.repairRemark = this.rowObj.repairRemark
})
this.dynamicValidateFormTwo.premiumListTwo.forEach((item) => {
item.repairRemark = this.rowObj.repairRemark
})
}
this.dynamicValidateForm.premiumList.forEach((item) => {
item.repairRemark = this.rowObj.repairRemark
})
this.dynamicValidateFormTwo.premiumListTwo.forEach((item) => {
item.repairRemark = this.rowObj.repairRemark
})
getSupplierSelectApi().then((res) => {
this.supplierSelectList = res.data
})
// //
// const userInfoRes = await getInfo()
// this.companyId = userInfoRes.user.companyId
// this.currentUserId = userInfoRes.user.userId
// const userSelectRes = await getUserSelectApi({ roleIds: [133] })
// this.userSelectList = userSelectRes.data
} catch (error) {
console.error('初始化出错:', error)
}
},
//
@ -690,10 +741,62 @@ export default {
}
})
},
save() {
this.$refs['dynamicValidateForm'].validate((valid) => {
if (valid) {
this.dynamicValidateForm.premiumList.forEach((item) => {
item.partCost = item.partPrice
})
this.dynamicValidateForm.premiumList.forEach((e) => {
if (e.partType == 0) {
e.partCost = ''
}
})
// this.dynamicValidateForm.premiumList[0].partCost = this.dynamicValidateForm.premiumList[0].partPrice;
//
console.log('this.dynamicValidateForm.premiumList1111)', this.dynamicValidateForm.premiumList)
let params = {
maId: this.rowObj.maId,
typeId: this.rowObj.typeId,
id: this.rowObj.id,
repairType: 2,
companyId: this.companyId,
repairNum: 1,
manageType: 0,
partStrList: JSON.stringify(this.dynamicValidateForm.premiumList),
repairNum: this.dynamicValidateForm.premiumList[0]?.repairNum ?? 1,
maId: this.rowObj.maId,
}
this.fullscreenLoading = true
saveRepairApplyApiNew(params)
.then((res) => {
if (res.code == 200) {
this.getList()
this.fullscreenLoading = false
this.dialogShowFlag = false
this.$message.success('操作成功!')
this.$emit('domainChangeTwo', res.code)
}
})
.catch(() => {
this.fullscreenLoading = false
})
} else {
return false
}
})
},
submitTwo() {
this.$refs['dynamicValidateFormTwo'].validate((valid) => {
if (valid) {
// this.dynamicValidateFormTwo.premiumListTwo[0].partCost = this.dynamicValidateFormTwo.premiumListTwo[0].partPrice;
if(this.dynamicValidateFormTwo.premiumListTwo[0]?.repairNum > this.rowObj.repairNotFinishNum){
this.$message.error('维修数量不能大于待维修数量')
return
}
this.dynamicValidateFormTwo.premiumListTwo.forEach((item) => {
item.partCost = item.partPrice
})
@ -708,6 +811,7 @@ export default {
'this.dynamicValidateFormTwo.premiumListTwo2222',
this.dynamicValidateFormTwo.premiumListTwo,
)
//
let params = {
maId: this.rowObj.maId,
@ -738,6 +842,143 @@ export default {
}
})
},
saveTwo() {
this.$refs['dynamicValidateFormTwo'].validate((valid) => {
if (valid) {
// this.dynamicValidateFormTwo.premiumListTwo[0].partCost = this.dynamicValidateFormTwo.premiumListTwo[0].partPrice;
if(this.dynamicValidateFormTwo.premiumListTwo[0]?.repairNum > this.rowObj.repairNotFinishNum){
this.$message.error('维修数量不能大于待维修数量')
return
}
this.dynamicValidateFormTwo.premiumListTwo.forEach((item) => {
item.partCost = item.partPrice
})
this.dynamicValidateFormTwo.premiumListTwo.forEach((e) => {
if (e.partType == 0) {
e.partCost = ''
}
})
console.log(
'this.dynamicValidateFormTwo.premiumListTwo2222',
this.dynamicValidateFormTwo.premiumListTwo,
)
//
let params = {
maId: this.rowObj.maId,
typeId: this.rowObj.typeId,
id: this.rowObj.id,
repairType: 2,
companyId: this.companyId,
repairNum: this.dynamicValidateFormTwo.premiumListTwo[0]?.repairNum ?? 1,
manageType: 1,
partStrList: JSON.stringify(this.dynamicValidateFormTwo.premiumListTwo),
}
this.fullscreenLoading = true
saveRepairApplyApiNew(params)
.then((res) => {
if (res.code == 200) {
this.getList()
this.fullscreenLoading = false
this.dialogShowFlag = false
this.$message.success('操作成功!')
this.$emit('domainChange', res.code)
}
})
.catch(() => {
this.fullscreenLoading = false
})
} else {
return false
}
})
},
async clearSave() {
try {
//
await this.$confirm('是否确认清除保存?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
});
//
const params = {
maId: this.rowObj.maId,
typeId: this.rowObj.typeId,
id: this.rowObj.id
};
this.fullscreenLoading = true
const res = await clearSaveApi(params);
if (res.code === 200) {
//
this.$message.success('清除保存成功');
this.fullscreenLoading = false
this.dialogShowFlag = false
this.$emit('domainChangeTwo', res.code)
} else {
//
this.fullscreenLoading = false
this.$message.error('清除保存失败,请稍后重试');
}
} catch (error) {
if (error !== 'cancel') {
//
this.fullscreenLoading = false
this.$message.error('操作出错,请稍后重试');
}
}
},
async clearSaveTwo() {
try {
//
await this.$confirm('是否确认清除保存?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
});
//
const params = {
maId: this.rowObj.maId,
typeId: this.rowObj.typeId,
id: this.rowObj.id
};
this.fullscreenLoading = true
const res = await clearSaveApi(params);
if (res.code === 200) {
//
this.$message.success('清除保存成功');
this.fullscreenLoading = false
this.dialogShowFlag = false
this.$emit('domainChange', res.code)
} else {
//
this.fullscreenLoading = false
this.$message.error('清除保存失败,请稍后重试');
}
} catch (error) {
if (error !== 'cancel') {
//
this.fullscreenLoading = false
this.$message.error('操作出错,请稍后重试');
}
}
},
handleRemove(file, domain) {
domain.fileList.splice(domain.fileList.indexOf(file), 1)
console.log('🚀 ~ domain.fileList:', domain.fileList)

View File

@ -139,9 +139,21 @@
<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="internalRepair(scope.row)">内部维修</el-dropdown-item>
<el-dropdown-item @click.native="backRepair(scope.row)">返厂维修</el-dropdown-item>
<el-dropdown-item @click.native="broken(scope.row)">预报废</el-dropdown-item>
<el-dropdown-item
@click.native="internalRepair(scope.row)"
:disabled="scope.row.submitStatus === 1 && scope.row.repairType !== 1"
:style="{ color: scope.row.submitStatus === 1 && scope.row.repairType === 1 ? 'red' : '' }"
>内部维修</el-dropdown-item>
<el-dropdown-item
@click.native="backRepair(scope.row)"
:disabled="scope.row.submitStatus === 1 && scope.row.repairType !== 2"
:style="{ color: scope.row.submitStatus === 1 && scope.row.repairType === 2 ? 'red' : '' }"
>返厂维修</el-dropdown-item>
<el-dropdown-item
@click.native="broken(scope.row)"
:disabled="scope.row.submitStatus === 1 && scope.row.repairType !== 3"
:style="{ color: scope.row.submitStatus === 1 && scope.row.repairType === 3 ? 'red' : '' }"
>预报废</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<!-- manageType 0 时打开维修对话框 -->
@ -453,18 +465,21 @@
size="mini"
type="primary"
@click="internalRepair(scope.row)"
:disabled="scope.row.submitStatus === 1 && scope.row.repairType !== 1"
>内部维修</el-button
>
<el-button
size="mini"
type="success"
@click="backRepair(scope.row)"
:disabled="scope.row.submitStatus === 1 && scope.row.repairType !== 2"
>返厂维修</el-button
>
<el-button
size="mini"
type="info"
@click="broken(scope.row)"
:disabled="scope.row.submitStatus === 1 && scope.row.repairType !== 3"
>预报废</el-button
>
<!-- <el-button size="mini" type="warning" @click="complete(scope.row)"

View File

@ -431,6 +431,7 @@
<div style="padding: 0 30px">
<h2 style="text-align: center; font-size: 33px">重庆市送变电工程有限公司</h2>
<h3 style="text-align: center; font-size: 28px">设备维修保养记录表</h3>
<div style="text-align: right;font-size: 20px;margin-bottom: 10px;">维修保养时间{{ upkeepObj.createTime }}</div>
<div
style="
border: 1px solid #000;