|
|
@ -105,7 +105,7 @@ |
|
|
|
label="操作" |
|
|
|
min-width="10%"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button type="text" size="small" @click="handleSub(scope.row)">出库</el-button> |
|
|
|
<el-button v-if="scope.row.num > 0" type="text" size="small" @click="handleSub(scope.row)">出库</el-button> |
|
|
|
<el-button v-if="admin" type="text" size="small" @click="handleEdit(scope.row)">编辑</el-button> |
|
|
|
<el-button v-if="admin" type="text" size="small" @click="handleDelete(scope.row.id, scope.$index)">删除</el-button> |
|
|
|
</template> |
|
|
@ -221,7 +221,8 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { add, sub, edit, del, search, exports, uploadImport, uploadExport, exportFail, donwload } from '@/api/material' |
|
|
|
import { mapActions } from 'vuex' |
|
|
|
import { add, sub, edit, del, search, exports, uploadImport, uploadExport, exportFail, donwload, warn, queryLog } from '@/api/material' |
|
|
|
import { isAdmin } from '@/api/user' |
|
|
|
export default { |
|
|
|
name: 'Material', |
|
|
@ -284,6 +285,17 @@ export default { |
|
|
|
this.fetchMaterialList(null, null, this.pageNum, this.pageSize) |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
...mapActions(['SetAuditCount', 'SetWarnCount']), |
|
|
|
fetchMaterialWarnCount() { |
|
|
|
warn(1, 1).then(response => { |
|
|
|
this.SetWarnCount(response.data.total) |
|
|
|
}) |
|
|
|
}, |
|
|
|
fetchMaterialAuditCount() { |
|
|
|
queryLog(1, 0, null, null, null, null, 1, 1).then(response => { |
|
|
|
this.SetAuditCount(response.data.total) |
|
|
|
}) |
|
|
|
}, |
|
|
|
beforeUpload(file) { |
|
|
|
const extension = file.name.split('.') |
|
|
|
if (extension && extension.length > 1) { |
|
|
@ -300,6 +312,7 @@ export default { |
|
|
|
if (response.status === 200 && response.data.code === 0) { |
|
|
|
this.$message.success('入库成功') |
|
|
|
this.fetchMaterialList(null, null, this.pageNum, this.pageSize) |
|
|
|
this.fetchMaterialWarnCount() |
|
|
|
} else { |
|
|
|
this.$message.error('入库失败') |
|
|
|
} |
|
|
@ -314,8 +327,10 @@ export default { |
|
|
|
} else { |
|
|
|
if (this.admin) { |
|
|
|
this.$message.success('出库成功') |
|
|
|
this.fetchMaterialWarnCount() |
|
|
|
} else { |
|
|
|
this.$message.success('已提交管理员审核') |
|
|
|
this.fetchMaterialAuditCount() |
|
|
|
} |
|
|
|
} |
|
|
|
this.fetchMaterialList(null, null, this.pageNum, this.pageSize) |
|
|
@ -397,7 +412,7 @@ export default { |
|
|
|
} |
|
|
|
if (this.subVisible) { |
|
|
|
sub(this.form).then(response => { |
|
|
|
console.log(response) |
|
|
|
this.fetchMaterialAuditCount() |
|
|
|
}) |
|
|
|
this.subVisible = false |
|
|
|
} |
|
|
@ -408,6 +423,7 @@ export default { |
|
|
|
this.editVisible = false |
|
|
|
} |
|
|
|
this.handleSearch() |
|
|
|
this.fetchMaterialWarnCount() |
|
|
|
this.visible = false |
|
|
|
} else { |
|
|
|
console.log('error submit!!') |
|
|
|