Browse Source

增加审计和告警状态

master
lihua 5 years ago
parent
commit
7e78f42e20
  1. 4
      src/api/material.js
  2. 1
      src/icons/svg/audit.svg
  3. 1
      src/icons/svg/export.svg
  4. 2
      src/icons/svg/warn.svg
  5. 6
      src/router/index.js
  6. 4
      src/store/getters.js
  7. 16
      src/store/modules/app.js
  8. 94
      src/views/layout/components/Navbar.vue
  9. 47
      src/views/material/audit/index.vue
  10. 10
      src/views/material/log/Log.vue
  11. 16
      src/views/material/log/LogDetail.vue
  12. 22
      src/views/material/warehouse/index.vue

4
src/api/material.js

@ -136,10 +136,14 @@ export function donwload() {
type: 'application/vnd.ms-excel' type: 'application/vnd.ms-excel'
}) })
const fileName = 'template.xlsx' const fileName = 'template.xlsx'
if (window.navigator.msSaveOrOpenBlob) {
navigator.msSaveBlob(blob, fileName)
} else {
var link = document.createElement('a') var link = document.createElement('a')
link.href = window.URL.createObjectURL(blob) link.href = window.URL.createObjectURL(blob)
link.download = fileName link.download = fileName
link.click() link.click()
window.URL.revokeObjectURL(link.href) window.URL.revokeObjectURL(link.href)
}
}) })
} }

1
src/icons/svg/audit.svg

@ -0,0 +1 @@
<svg t="1565773090501" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2132" width="128" height="128"><path d="M474.951056 656.919485h110.399944c4.599464 0 6.900619-2.299732 6.900618-6.900619V587.920409h-117.300562v68.999076zM288.651419 472.919579v50.599796h117.300562v-57.500414h-110.399943c-4.600887 1.545955-6.900619 3.845687-6.900619 6.900618zM288.651419 650.020288c0 4.599464 2.299732 6.900619 6.900619 6.900619h110.399943V587.920409h-117.300562v62.099879zM583.051268 466.020383h-108.100212v57.500415h114.999408V472.919579c-1.545955-3.054932-3.845687-5.354664-6.899196-6.899196z" fill="#1296db" p-id="2133"></path><path d="M866.7617 210.915092c-0.361244-39.088335-25.644076-67.299521-64.676945-68.427343-113.972564-3.744709-211.017847-50.521574-300.833979-116.021985-48.160686-35.133138-71.294541-35.33936-118.94465-0.305777C291.979417 92.581997 194.062312 139.154062 79.168149 142.743749c-38.210825 1.183288-63.344323 30.365851-63.344323 69.759964-0.517689 89.045288 1.433599 177.934131-0.517689 266.71773-2.204443 108.332033 33.188961 202.605407 99.511416 286.415497 80.017026 101.201015 182.032973 176.961331 288.928562 246.667251 26.00532 16.977058 53.649039 14.772615 79.604582-2.205866 83.811512-54.778283 164.033338-114.278341 234.100502-186.089148C792.184671 747.27606 851.478507 660.748105 862.762413 551.443272c6.25493-59.960858 1.127822-121.100738 1.127821-181.677418l2.871466 0.155023c0-53.088684 0.305778-106.072123 0-159.005785zM693.451211 394.720153c-6.145419 26.090653-19.190035 38.344514-39.099713 36.799981 4.599464 7.689952 6.900619 16.890302 6.900618 27.59963v216.200422c0 32.200517-17.645502 48.300064-52.899528 48.300064h-133.400109v39.099714c-1.545955 16.854747-13.046038 26.053676-34.500249 27.59963-23.000166 0-34.500249-8.445151-34.500249-25.299898v-41.399446h-133.400109c-36.799981 0-54.445483-15.310214-52.899529-46.000332V438.41933c-26.090653 3.090487-38.344514-8.409596-36.799981-34.500249V341.819202c-1.544533-36.799981 17.609947-55.200683 57.500415-55.200683h160.99974c-12.290838-24.509143-6.900619-40.610112 16.099547-48.300064 29.110029-12.255283 50.599796 3.845687 64.399611 48.300064h165.600626c35.254026 0 52.899528 16.099547 52.899529 48.300064-0.001422 24.546121-2.301154 44.491355-6.900619 59.80157z" fill="#1296db" p-id="2134"></path><path d="M619.851249 351.019553H256.450902c-4.599464 1.544533-6.900619 3.845687-6.900619 6.900619v41.399445h156.400276v-13.799815c0-16.854747 11.500083-26.055098 34.500249-27.59963 21.454211 1.544533 32.954294 10.744883 34.500248 27.59963v13.799815h147.199925c4.599464-12.255283 7.654396-24.509143 9.200351-36.799981-1.545955-6.109864-5.390219-9.954128-11.500083-11.500083z" fill="#1296db" p-id="2135"></path></svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

1
src/icons/svg/export.svg

@ -1 +0,0 @@
<svg t="1564385393375" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5418" width="200" height="200"><path d="M992 496L796.8 288v160H448v96h348.8v160z" p-id="5419" fill="#e6e6e6"></path><path d="M128 160h576V96H96c-19.2 0-32 12.8-32 32v736c0 19.2 12.8 32 32 32h608v-64H128V160z" p-id="5420" fill="#e6e6e6"></path></svg>

Before

Width:  |  Height:  |  Size: 365 B

2
src/icons/svg/warn.svg

@ -1 +1 @@
<svg t="1564385250534" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3846" width="200" height="200"><path d="M512.0164794921875 644.123504638672c18.583099365234375 0 33.703033447265625-15.119110107421877 33.703033447265625-33.704681396484375V360.8583374023437c0-18.583099365234375-15.119110107421877-33.703033447265625-33.70385742187501-33.703033447265625-18.58145141601562 0-33.7005615234375 15.119110107421877-33.7005615234375 33.703033447265625v249.56048583984378c0.0016479492187499998 18.5855712890625 15.119110107421877 33.704681396484375 33.7005615234375 33.704681396484375zM512.0164794921875 687.743896484375c-12.51617431640625 0-24.774444580078125 5.076507568359375-33.63629150390625 13.930938720703125-8.852783203125 8.8560791015625-13.930114746093748 21.115997314453125-13.930114746093748 33.638763427734375 0 12.5211181640625 5.077331542968749 24.781036376953125 13.930938720703125 33.6346435546875 8.85443115234375 8.852783203125 21.114349365234375 13.930114746093748 33.6346435546875 13.930114746093748 12.5211181640625 0 24.780212402343754-5.077331542968749 33.6346435546875-13.930938720703125 8.8560791015625-8.856903076171875 13.934234619140627-21.11517333984375 13.934234619140627-33.6346435546875 0-12.519470214843752-5.078155517578126-24.781036376953125-13.936706542968752-33.64041137695312-8.85772705078125-8.851959228515625-21.11517333984375-13.928466796875-33.632171630859375-13.928466796875z" fill="#e6e6e6" p-id="3847"></path><path d="M830.261016845703 886.9249267578125H193.73733520507812c-24.309722900390625 0-46.0799560546875-13.743896484375-58.23522949218751-36.7657470703125s-12.1552734375-50.510467529296875 0-73.53231811523438L453.7647705078125 173.8408203125c12.154449462890625-23.0218505859375 33.92550659179688-36.7657470703125 58.23522949218751-36.7657470703125 24.310546875 0 46.08160400390625 13.743896484375 58.23687744140626 36.7657470703125l318.26019287109375 602.7852172851562a78.69781494140625 78.69781494140625 0 0 1 0 73.53231811523438c-12.1552734375 23.0218505859375-33.92550659179688 36.7657470703125-58.23605346679688 36.7657470703125zM511.9991760253907 193.748046875c-2.6754455566406246 0-9.334808349609375 0.8206787109375-13.352508544921875 8.429260253906252L180.38565063476562 804.9625244140625c-4.016876220703125 7.608581542968748-1.3381347656250002 14.325622558593748 0 16.858520507812504 1.338958740234375 2.535369873046875 5.318756103515625 8.430908203125 13.352508544921875 8.430908203125h636.523681640625c8.034576416015625 0 12.014373779296875-5.89471435546875 13.352508544921875-8.430084228515625 1.338958740234375-2.5345458984375 4.0177001953125-9.250762939453125 0-16.85934448242187L525.3525085449219 202.17730712890625c-4.0177001953125-7.607757568359376-10.676239013671877-8.429260253906252-13.35333251953125-8.429260253906252z" fill="#e6e6e6" p-id="3848"></path></svg> <svg t="1565833318823" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2181" width="128" height="128"><path d="M512.22643174 898.08283145a71.02363359 71.02363359 0 0 1-54.68614717-25.70248916H385.21785518a129.87959942 129.87959942 0 0 0 41.76654433 59.47118524 135.4849295 135.4849295 0 0 0 170.41570664 0 138.90281396 138.90281396 0 0 0 41.76654434-59.47118524H566.84422109a71.02363359 71.02363359 0 0 1-54.61778935 25.70248915zM454.32747354 695.53901357l-44.97935625-44.97935537 98.02491855-98.02491855L426.98439951 472.14610332l142.79920225-143.07263262 44.97935537 44.97935625-98.02491856 98.02491856 80.38863633 80.38863633z" fill="#1296db" p-id="2182"></path><path d="M862.62791943 787.20666787l-61.11176923-122.15518066V448.08419815A290.52015644 290.52015644 0 0 0 576.82444326 164.80995664V126.25622247a64.32458028 64.32458028 0 1 0-128.58080362-1e-8V164.80995664A290.52015644 290.52015644 0 0 0 223.21014453 447.74240997v217.03564599l-61.11176924 122.15518154a29.87230781 29.87230781 0 0 0 1.64058399 30.55588417 33.15347666 33.15347666 0 0 0 27.34307402 16.06405606h642.97237412a33.15347666 33.15347666 0 0 0 27.34307315-16.06405606 34.17884209 34.17884209 0 0 0 1.23043886-30.2824538z m-620.75612724-17.63628222l40.19431817-82.02922032a46.96172842 46.96172842 0 0 0 3.21281102-14.491829V448.08419815a225.03349512 225.03349512 0 1 1 450.06699024 0v225.03349599a46.96172842 46.96172842 0 0 0 3.21281104 14.49182813l40.19431816 82.02922119z" fill="#1296db" p-id="2183"></path></svg>

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

6
src/router/index.js

@ -48,9 +48,10 @@ export const constantRouterMap = [
path: 'warehouse', path: 'warehouse',
component: () => import('@/views/material/warehouse/index'), component: () => import('@/views/material/warehouse/index'),
meta: { title: '物料仓库', icon: 'warehouse' } meta: { title: '物料仓库', icon: 'warehouse' }
}, { },
{
path: 'audit', path: 'audit',
admin: true, hidden: true,
component: () => import('@/views/material/audit/index'), component: () => import('@/views/material/audit/index'),
meta: { title: '出库审核', icon: 'export' } meta: { title: '出库审核', icon: 'export' }
}, },
@ -60,6 +61,7 @@ export const constantRouterMap = [
meta: { title: '出入库日志', icon: 'log' } meta: { title: '出入库日志', icon: 'log' }
}, { }, {
path: 'warn', path: 'warn',
hidden: true,
component: () => import('@/views/material/warn/index'), component: () => import('@/views/material/warn/index'),
meta: { title: '物料告警', icon: 'warn' } meta: { title: '物料告警', icon: 'warn' }
}] }]

4
src/store/getters.js

@ -3,6 +3,8 @@ const getters = {
device: state => state.app.device, device: state => state.app.device,
token: state => state.user.token, token: state => state.user.token,
name: state => state.user.name, name: state => state.user.name,
role: state => state.user.role role: state => state.user.role,
auditCount: state => state.app.auditCount,
warnCount: state => state.app.warnCount
} }
export default getters export default getters

16
src/store/modules/app.js

@ -6,7 +6,9 @@ const app = {
opened: !+Cookies.get('sidebarStatus'), opened: !+Cookies.get('sidebarStatus'),
withoutAnimation: false withoutAnimation: false
}, },
device: 'desktop' device: 'desktop',
auditCount: 0,
warnCount: 0
}, },
mutations: { mutations: {
TOGGLE_SIDEBAR: state => { TOGGLE_SIDEBAR: state => {
@ -25,6 +27,12 @@ const app = {
}, },
TOGGLE_DEVICE: (state, device) => { TOGGLE_DEVICE: (state, device) => {
state.device = device state.device = device
},
SET_AUDIT_COUNT: (state, count) => {
state.auditCount = count
},
SET_WARN_COUNT: (state, count) => {
state.warnCount = count
} }
}, },
actions: { actions: {
@ -36,6 +44,12 @@ const app = {
}, },
ToggleDevice({ commit }, device) { ToggleDevice({ commit }, device) {
commit('TOGGLE_DEVICE', device) commit('TOGGLE_DEVICE', device)
},
SetAuditCount({ commit }, count) {
commit('SET_AUDIT_COUNT', count)
},
SetWarnCount({ commit }, count) {
commit('SET_WARN_COUNT', count)
} }
} }
} }

94
src/views/layout/components/Navbar.vue

@ -2,7 +2,18 @@
<div class="navbar"> <div class="navbar">
<hamburger :toggle-click="toggleSideBar" :is-active="sidebar.opened" class="hamburger-container"/> <hamburger :toggle-click="toggleSideBar" :is-active="sidebar.opened" class="hamburger-container"/>
<i>北京中电红石科技股份有限公司</i> <i>北京中电红石科技股份有限公司</i>
<el-dropdown class="avatar-container" trigger="click"> <div class="right-menu">
<div class="right-menu-item hover-effect">
<el-badge :value="warnCount" :hidden="badgeWarnHidden" style="margin-top: 10px;margin-right: 30px;">
<svg-icon icon-class="warn" style="font-size: 36px;" @click="handleWarn"/>
</el-badge>
</div>
<div class="right-menu-item hover-effect">
<el-badge :value="auditCount" :hidden="badgeAuditHidden" style="margin-top: 10px;margin-right: 30px;">
<svg-icon icon-class="audit" style="font-size: 36px;" @click="handleAudit"/>
</el-badge>
</div>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
<div class="avatar-wrapper"> <div class="avatar-wrapper">
<img src="../../../assets/user.png" class="user-avatar"> <img src="../../../assets/user.png" class="user-avatar">
<i class="el-icon-caret-bottom"/> <i class="el-icon-caret-bottom"/>
@ -19,7 +30,7 @@
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</div>
<el-dialog <el-dialog
:visible.sync="visible" :visible.sync="visible"
:before-close="handleCancel" :before-close="handleCancel"
@ -54,9 +65,10 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters, mapActions } from 'vuex'
import Hamburger from '@/components/Hamburger' import Hamburger from '@/components/Hamburger'
import { modifyPassword, getInfo, edit } from '@/api/user' import { modifyPassword, getInfo, edit } from '@/api/user'
import { queryLog, warn } from '@/api/material'
export default { export default {
components: { components: {
Hamburger Hamburger
@ -75,11 +87,34 @@ export default {
}, },
computed: { computed: {
...mapGetters([ ...mapGetters([
'sidebar' 'sidebar',
'warnCount',
'auditCount'
// 'avatar' // 'avatar'
]) ]),
badgeWarnHidden() {
return this.warnCount <= 0
},
badgeAuditHidden() {
return this.auditCount <= 0
}
},
created() {
this.fetchMaterialAuditCount()
this.fetchMaterialWarnCount()
}, },
methods: { methods: {
...mapActions(['SetAuditCount', 'SetWarnCount']),
fetchMaterialAuditCount() {
queryLog(1, 0, null, null, null, null, 1, 1).then(response => {
this.SetAuditCount(response.data.total)
})
},
fetchMaterialWarnCount() {
warn(1, 1).then(response => {
this.SetWarnCount(response.data.total)
})
},
toggleSideBar() { toggleSideBar() {
this.$store.dispatch('ToggleSideBar') this.$store.dispatch('ToggleSideBar')
}, },
@ -127,6 +162,12 @@ export default {
message: '取消修改' message: '取消修改'
}) })
}) })
},
handleAudit() {
this.$router.push({ path: '/material/audit' })
},
handleWarn() {
this.$router.push({ path: '/material/warn' })
} }
} }
} }
@ -143,28 +184,48 @@ export default {
float: left; float: left;
padding: 0 10px; padding: 0 10px;
} }
.screenfull { .right-menu {
position: absolute; float: right;
right: 90px; height: 100%;
top: 16px; line-height: 50px;
color: red;
&:focus {
outline: none;
} }
.avatar-container {
height: 50px; .right-menu-item {
display: inline-block; display: inline-block;
position: absolute; padding: 0 8px;
right: 35px; height: 100%;
.avatar-wrapper { font-size: 18px;
color: #5a5e66;
vertical-align: text-bottom;
&.hover-effect {
cursor: pointer; cursor: pointer;
transition: background .3s;
&:hover {
background: rgba(0, 0, 0, .025)
}
}
}
.avatar-container {
margin-right: 30px;
.avatar-wrapper {
margin-top: 5px; margin-top: 5px;
position: relative; position: relative;
line-height: initial;
.user-avatar { .user-avatar {
cursor: pointer;
width: 40px; width: 40px;
height: 40px; height: 40px;
border-radius: 10px; border-radius: 10px;
} }
.el-icon-caret-bottom { .el-icon-caret-bottom {
cursor: pointer;
position: absolute; position: absolute;
right: -20px; right: -20px;
top: 25px; top: 25px;
@ -173,5 +234,6 @@ export default {
} }
} }
} }
}
</style> </style>

47
src/views/material/audit/index.vue

@ -16,7 +16,8 @@
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
<el-select v-model="field" placeholder="请选择字段"> <el-select v-model="field" placeholder="请选择字段">
<el-option label="操作人员" value="user_name" /> <el-option label="批号" value="batch" />
<el-option v-if="admin" label="操作人员" value="user_name" />
<el-option label="物料编号" value="code" /> <el-option label="物料编号" value="code" />
<el-option label="值" value="value"/> <el-option label="值" value="value"/>
<el-option label="型号" value="model_num"/> <el-option label="型号" value="model_num"/>
@ -35,9 +36,12 @@
<el-col :span="2"> <el-col :span="2">
<el-button style="margin-left: 10px" @click="handleSearch">搜索</el-button> <el-button style="margin-left: 10px" @click="handleSearch">搜索</el-button>
</el-col> </el-col>
<el-col :span="2"> <el-col v-if="admin" :span="2">
<el-button style="margin-left: 10px" type="primary" plain @click="handleAudit">同意出库</el-button> <el-button style="margin-left: 10px" type="primary" plain @click="handleAudit">同意出库</el-button>
</el-col> </el-col>
<el-col :span="1">
<el-button style="margin-left: 20px" @click="handleRefresh">刷新</el-button>
</el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-table <el-table
@ -46,13 +50,19 @@
style="width: 100%" style="width: 100%"
@selection-change="handleSelectionChange"> @selection-change="handleSelectionChange">
<el-table-column <el-table-column
v-if="admin"
type="selection" type="selection"
label="全选" label="全选"
min-width="10%"/> min-width="10%"/>
<el-table-column <el-table-column
v-if="admin"
prop="userName" prop="userName"
label="操作人员" label="操作人员"
min-width="10%"/> min-width="10%"/>
<el-table-column
prop="batch"
label="批号"
min-width="10%"/>
<el-table-column <el-table-column
prop="code" prop="code"
label="物料编号" label="物料编号"
@ -102,6 +112,10 @@
v-loading="listLoading" v-loading="listLoading"
:data="materialFailList" :data="materialFailList"
style="width: 100%"> style="width: 100%">
<el-table-column
prop="batch"
label="批号"
min-width="10%"/>
<el-table-column <el-table-column
prop="code" prop="code"
label="物料编号" label="物料编号"
@ -144,7 +158,9 @@
</template> </template>
<script> <script>
import { queryLog, audit, exportFail } from '@/api/material' import { queryLog, audit, exportFail, warn } from '@/api/material'
import { isAdmin } from '@/api/user'
import { mapActions } from 'vuex'
export default { export default {
name: 'Index', name: 'Index',
data() { data() {
@ -183,7 +199,7 @@ export default {
} }
}] }]
}, },
field: 'user_name', field: 'batch',
content: '', content: '',
dateRange: [new Date(new Date().setDate(new Date().getDate() - 7)), new Date(new Date().setDate(new Date().getDate() + 1))], dateRange: [new Date(new Date().setDate(new Date().getDate() - 7)), new Date(new Date().setDate(new Date().getDate() + 1))],
listLoading: false, listLoading: false,
@ -193,10 +209,26 @@ export default {
materialFailList: [] materialFailList: []
} }
}, },
computed: {
admin() {
return isAdmin()
}
},
created() { created() {
this.fetchMaterialAuditList(this.field, this.content, this.dateRange[0], this.dateRange[1]) this.fetchMaterialAuditList(this.field, this.content, this.dateRange[0], this.dateRange[1])
}, },
methods: { methods: {
...mapActions(['SetAuditCount', 'SetWarnCount']),
fetchMaterialAuditCount() {
queryLog(1, 0, null, null, null, null, 1, 1).then(response => {
this.SetAuditCount(response.data.total)
})
},
fetchMaterialWarnCount() {
warn(1, 1).then(response => {
this.SetWarnCount(response.data.total)
})
},
fetchMaterialAuditList(field, content, startTm, endTm) { fetchMaterialAuditList(field, content, startTm, endTm) {
this.listLoading = true this.listLoading = true
queryLog(1, 0, field, content, startTm, endTm).then(response => { queryLog(1, 0, field, content, startTm, endTm).then(response => {
@ -217,6 +249,7 @@ export default {
} else { } else {
this.$message.success('出库成功') this.$message.success('出库成功')
} }
this.handleRefresh()
} else { } else {
this.$message.error('出库失败') this.$message.error('出库失败')
} }
@ -224,7 +257,6 @@ export default {
} else { } else {
this.$message.warning('请选择同意出库选项!') this.$message.warning('请选择同意出库选项!')
} }
this.handleSearch()
}, },
handleSearch() { handleSearch() {
this.fetchMaterialAuditList(this.field, this.content, this.dateRange[0], this.dateRange[1]) this.fetchMaterialAuditList(this.field, this.content, this.dateRange[0], this.dateRange[1])
@ -234,6 +266,11 @@ export default {
}, },
handleCancel() { handleCancel() {
this.failVisible = false this.failVisible = false
},
handleRefresh() {
this.handleSearch()
this.fetchMaterialWarnCount()
this.fetchMaterialAuditCount()
} }
} }
} }

10
src/views/material/log/Log.vue

@ -4,7 +4,7 @@
<el-main> <el-main>
<el-row style="margin-top: 16px"> <el-row style="margin-top: 16px">
<el-tabs v-model="activeName"> <el-tabs v-model="activeName">
<el-tab-pane label="入库日志" name="in"> <el-tab-pane v-if="admin" label="入库日志" name="in">
<log-detail v-if="activeName === 'in'" :operate="0" :status="0"/> <log-detail v-if="activeName === 'in'" :operate="0" :status="0"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="出库日志" name="out"> <el-tab-pane label="出库日志" name="out">
@ -18,12 +18,18 @@
<script> <script>
import LogDetail from './LogDetail' import LogDetail from './LogDetail'
import { isAdmin } from '@/api/user'
export default { export default {
name: 'Log', name: 'Log',
components: { LogDetail }, components: { LogDetail },
data() { data() {
return { return {
activeName: 'in' activeName: 'out'
}
},
computed: {
admin() {
return isAdmin()
} }
} }
} }

16
src/views/material/log/LogDetail.vue

@ -15,7 +15,8 @@
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
<el-select v-model="field" placeholder="请选择字段"> <el-select v-model="field" placeholder="请选择字段">
<el-option label="操作人员" value="user_name" /> <el-option label="批次" value="batch" />
<el-option v-if="admin" label="操作人员" value="user_name" />
<el-option label="物料编号" value="code" /> <el-option label="物料编号" value="code" />
<el-option label="值" value="value"/> <el-option label="值" value="value"/>
<el-option label="型号" value="model_num"/> <el-option label="型号" value="model_num"/>
@ -47,9 +48,14 @@
:data="materialLogList" :data="materialLogList"
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
v-if="admin"
prop="userName" prop="userName"
label="操作人员" label="操作人员"
min-width="10%"/> min-width="10%"/>
<el-table-column
prop="batch"
label="批次"
min-width="10%"/>
<el-table-column <el-table-column
prop="code" prop="code"
label="物料编号" label="物料编号"
@ -102,6 +108,7 @@
<script> <script>
import { queryLog } from '@/api/material' import { queryLog } from '@/api/material'
import { isAdmin } from '@/api/user'
export default { export default {
name: 'LogDetail', name: 'LogDetail',
props: { props: {
@ -151,7 +158,7 @@ export default {
}] }]
}, },
realStatus: this.status, realStatus: this.status,
field: 'user_name', field: 'batch',
content: '', content: '',
dateRange: [new Date(), new Date(new Date().setDate(new Date().getDate() + 1))], dateRange: [new Date(), new Date(new Date().setDate(new Date().getDate() + 1))],
exports: 'success', exports: 'success',
@ -162,6 +169,11 @@ export default {
pageSize: 10 pageSize: 10
} }
}, },
computed: {
admin() {
return isAdmin()
}
},
created() { created() {
this.handleSearch() this.handleSearch()
}, },

22
src/views/material/warehouse/index.vue

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

Loading…
Cancel
Save