更新前端

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'
})
}
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;">
<el-button style="margin-right: 0;"
@click="success"
>确定</el-button>
<el-button style="margin-right: 0;"
@click="success"
>确定
</el-button>
<el-button style="margin-left: 20px;"
@click="clear"
>初始化</el-button>
<el-button style="margin-left: 20px;"
@click="clear"
>初始化
</el-button>
<el-button style="margin-left: 20px;"
type="danger"
@click="removeMaterial"
:disabled="indexSelect!==0"
>删除物料
</el-button>
</div>
<div id="hxjx_popup" class="hxjx_popup" v-if="showFault">
@@ -250,7 +259,8 @@ import {
messageUpdate,
updateResource
} 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 {
name: 'index',
@@ -263,6 +273,7 @@ export default {
dataList: [],
indexSelect: 0,
technologyId: '',
selectMaterial: [],
// 粗轧请求参数
params: {
state: 0,
@@ -283,7 +294,6 @@ export default {
if (this.dataList.length === 0) {
alert('钽靶原料列表为空,不可提交')
return
// TODO 考虑原料列表队列问题 及上一批材料未处理完毕 又来了一批材料
}
let data = {
batchId: this.dataList[0].batchId,
@@ -296,92 +306,110 @@ export default {
alert('钽靶原料成功提交至轧制')
this.dataList = []
} else if(res.data===0){
alert('提交失败,检查工艺是否相同')
}else if (res.data ===2){
alert('提交失败,请检查此物料工艺是否存在于数据库中')
} else if (res.data === 0) {
alert('提交失败,检查是否存在物料')
} else if (res.data === 2) {
alert('提交成功,但工艺出现差异,已将差异物料提交异常')
}
})
},
// 选择材料
getTechnologyInfo(index) {
this.indexSelect = index
let params = this.params
params.technologyId = this.dataList[index].technology
this.technologyId = params.technologyId
if (params.technologyId == null) {
removeMaterial() {
if (this.indexSelect === 0) {
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(() => {
newIP()
this.getFault()
this.getDataList() // 接口方法
}, 3000)
if (params.technologyId == null) {
return
}
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
})
},
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>