diff --git a/src/api/system/material.js b/src/api/system/material.js index 0005078..088f709 100644 --- a/src/api/system/material.js +++ b/src/api/system/material.js @@ -42,3 +42,11 @@ export function delMaterial(id) { method: 'delete' }) } + + +export function deleteMaterial(id) { + return request({ + url: '/work/material/delete/' + id, + method: 'delete' + }) +} diff --git a/src/views/work/resource/index.vue b/src/views/work/resource/index.vue index e29bde3..a09fdb2 100644 --- a/src/views/work/resource/index.vue +++ b/src/views/work/resource/index.vue @@ -174,13 +174,22 @@
- 确定 + 确定 + - 初始化 + 初始化 + + + 删除物料 +
@@ -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() +{ + +} }