更新前端

This commit is contained in:
2025-08-09 17:32:19 +08:00
parent df31963334
commit b25868e092
2 changed files with 115 additions and 79 deletions

View File

@@ -42,3 +42,11 @@ export function delMaterial(id) {
method: 'delete' method: 'delete'
}) })
} }
export function deleteMaterial(id) {
return request({
url: '/work/material/delete/' + id,
method: 'delete'
})
}

View File

@@ -174,13 +174,22 @@
<!-- 按钮操作 --> <!-- 按钮操作 -->
<div style="display: flex;justify-content: center;"> <div style="display: flex;justify-content: center;">
<el-button style="margin-right: 0;" <el-button style="margin-right: 0;"
@click="success" @click="success"
>确定</el-button> >确定
</el-button>
<el-button style="margin-left: 20px;" <el-button style="margin-left: 20px;"
@click="clear" @click="clear"
>初始化</el-button> >初始化
</el-button>
<el-button style="margin-left: 20px;"
type="danger"
@click="removeMaterial"
:disabled="indexSelect!==0"
>删除物料
</el-button>
</div> </div>
<div id="hxjx_popup" class="hxjx_popup" v-if="showFault"> <div id="hxjx_popup" class="hxjx_popup" v-if="showFault">
@@ -250,7 +259,8 @@ import {
messageUpdate, messageUpdate,
updateResource updateResource
} from '@/api/system/resource' } from '@/api/system/resource'
import { getFaultMessage, newIP } from '@/api/system/common' import {getFaultMessage, newIP} from '@/api/system/common'
import {deleteMaterial} from "../../../api/system/material";
export default { export default {
name: 'index', name: 'index',
@@ -263,6 +273,7 @@ export default {
dataList: [], dataList: [],
indexSelect: 0, indexSelect: 0,
technologyId: '', technologyId: '',
selectMaterial: [],
// 粗轧请求参数 // 粗轧请求参数
params: { params: {
state: 0, state: 0,
@@ -283,7 +294,6 @@ export default {
if (this.dataList.length === 0) { if (this.dataList.length === 0) {
alert('钽靶原料列表为空,不可提交') alert('钽靶原料列表为空,不可提交')
return return
// TODO 考虑原料列表队列问题 及上一批材料未处理完毕 又来了一批材料
} }
let data = { let data = {
batchId: this.dataList[0].batchId, batchId: this.dataList[0].batchId,
@@ -296,92 +306,110 @@ export default {
alert('钽靶原料成功提交至轧制') alert('钽靶原料成功提交至轧制')
this.dataList = [] this.dataList = []
} else if(res.data===0){ } else if (res.data === 0) {
alert('提交失败,检查工艺是否相同') alert('提交失败,检查是否存在物料')
}else if (res.data ===2){ } else if (res.data === 2) {
alert('提交失败,请检查此物料工艺是否存在于数据库中') alert('提交成功,但工艺出现差异,已将差异物料提交异常')
} }
}) })
}, },
// 选择材料 removeMaterial() {
getTechnologyInfo(index) { if (this.indexSelect === 0) {
this.indexSelect = index
let params = this.params
params.technologyId = this.dataList[index].technology
this.technologyId = params.technologyId
if (params.technologyId == null) {
return return
} else {
this.$modal.confirm('是否确认删除钽靶编号为"' + this.dataList[this.indexSelect].id + '"的数据项?').then(function () {
return deleteMaterial(this.dataList[this.indexSelect].id)
}).then(() => {
this.getDataList()
this.$modal.msgSuccess("删除成功");
})
} }
listTechnology(params).then(res => {
this.technologyInfoList = res.rows
})
let params2 = this.params2
params2.technologyId = this.dataList[index].technology
listTechnology(params2).then(res => {
this.technologyInfoListByFour = res.rows
})
},
getDataList() {
//state==0表示并未送进轧制页面的新进材料
let params = {
state: 0
}
listMaterial1(params).then(res => {
this.dataList = res.rows
console.log(res.rows)
if (res.rows[0].id != null && this.indexSelect === 0) {
this.getTechnologyInfo(0)
}
})
},
getFault() {
getFaultMessage().then(res => {
if (res.data !== 0) {
this.showFault = true
messageData(this.MessageParams).then(res => {
this.messageData = res.data
})
}
})
},
ensure() {
let data = {
state: 1
}
messageUpdate(data).then(res => {
this.showFault = false
})
},
clear() {
materialClear().then(res => {
alert('初始化成功')
})
} }
}, },
mounted() {
clearInterval(this.intervalTime) // 选择材料
getTechnologyInfo(index) {
this.indexSelect = index
this.getDataList() // 接口方法 let params = this.params
params.technologyId = this.dataList[index].technology
this.technologyId = params.technologyId
this.intervalTime = setInterval(() => { if (params.technologyId == null) {
newIP() return
this.getFault() }
this.getDataList() // 接口方法 listTechnology(params).then(res => {
}, 3000) this.technologyInfoList = res.rows
})
let params2 = this.params2
params2.technologyId = this.dataList[index].technology
listTechnology(params2).then(res => {
this.technologyInfoListByFour = res.rows
})
}, },
created() {
getDataList() {
//state==0表示并未送进轧制页面的新进材料
let params = {
state: 0
}
listMaterial1(params).then(res => {
this.dataList = res.rows
console.log(res.rows)
if (res.rows[0].id != null && this.indexSelect === 0) {
this.getTechnologyInfo(0)
}
})
},
getFault() {
getFaultMessage().then(res => {
if (res.data !== 0) {
this.showFault = true
messageData(this.MessageParams).then(res => {
this.messageData = res.data
})
}
})
},
ensure() {
let data = {
state: 1
}
messageUpdate(data).then(res => {
this.showFault = false
})
},
clear() {
materialClear().then(res => {
alert('初始化成功')
})
} }
}
,
mounted()
{
clearInterval(this.intervalTime)
this.getDataList() // 接口方法
this.intervalTime = setInterval(() => {
newIP()
this.getFault()
this.getDataList() // 接口方法
}, 3000)
}
,
created()
{
}
} }
</script> </script>