123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294 |
- <!-- 库存管理 -->
- <template>
- <div class="stock">
- <template v-if="!detailVisible && !addOrUpdateVisible && !noticeChangeAttachVisible">
- <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
- <el-form-item label="名称">
- <el-input v-model="dataForm.materialName" placeholder="请输入名称" clearable/>
- </el-form-item>
- <el-form-item label="类别">
- <el-cascader
- v-model="dataForm.materialTypeId"
- placeholder="请输入"
- :options="optionsCate"
- :props="{ expandTrigger: 'hover' }">
- </el-cascader>
- </el-form-item>
- <el-form-item>
- <el-button @click="getDataList()">查询</el-button>
- <!-- <el-button v-if="isAuth('wh:stockmanagement:exported')" type="primary" @click="exportExcel()">导出Excel</el-button>-->
- <el-button v-if="isAuth('wh:stockmanagement:noteChangeConfig')" type="primary" @click="setNoticeChangeHandel()">库存更改通知设置</el-button>
- </el-form-item>
- </el-form>
- <el-table
- :data="dataList"
- border
- v-loading="dataListLoading"
- @selection-change="selectionChangeHandle"
- style="width: 100%;">
- <el-table-column
- type="selection"
- header-align="center"
- align="center"
- width="50">
- </el-table-column>
- <el-table-column
- label="序号"
- type="index"
- width="50"
- align="center">
- </el-table-column>
- <el-table-column
- prop="materialCode"
- header-align="center"
- align="center"
- min-width="180"
- :show-tooltip-when-overflow="true"
- label="编码">
- </el-table-column>
- <el-table-column
- prop="categoryName"
- header-align="center"
- align="center"
- label="类别">
- </el-table-column>
- <el-table-column
- prop="materialName"
- header-align="center"
- align="center"
- min-width="180"
- :show-overflow-tooltip="true"
- label="名称">
- </el-table-column>
- <el-table-column
- prop="specifications"
- header-align="center"
- align="center"
- width="140"
- :show-overflow-tooltip="true"
- label="规格">
- </el-table-column>
- <el-table-column
- prop="isInventory"
- header-align="center"
- align="center"
- :formatter="formatState"
- label="状态">
- </el-table-column>
- <el-table-column
- prop="lockCnt"
- header-align="center"
- align="center"
- label="锁库数量">
- </el-table-column>
- <el-table-column
- prop="unitName"
- header-align="center"
- align="center"
- label="单位">
- </el-table-column>
- <el-table-column
- prop="cnt"
- header-align="center"
- align="center"
- label="库存">
- </el-table-column>
- <el-table-column
- prop="safeQuantity"
- header-align="center"
- align="center"
- label="安全库存">
- </el-table-column>
- <el-table-column
- prop="amount"
- header-align="center"
- align="center"
- label="金额">
- </el-table-column>
- <el-table-column
- prop="shelveName"
- header-align="center"
- align="center"
- width="140"
- :show-overflow-tooltip="true"
- label="存放货架">
- </el-table-column>
- <el-table-column
- prop="notes"
- header-align="center"
- align="center"
- width="160"
- :show-overflow-tooltip="true"
- label="备注">
- </el-table-column>
- <el-table-column
- fixed="right"
- header-align="center"
- align="center"
- width="150"
- label="操作">
- <template slot-scope="scope">
- <el-button v-if="isAuth('wh:stockmanagement:info')" type="text" size="small" @click="details(scope.row.materialId)">查看</el-button>
- <el-button v-if="isAuth('wh:stockmanagement:editor')" type="text" size="small" @click="addOrUpdateHandle(scope.row.materialId)">编辑</el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-pagination
- @size-change="sizeChangeHandle"
- @current-change="currentChangeHandle"
- :current-page="pageIndex"
- :page-sizes="[10, 20, 50, 100]"
- :page-size="pageSize"
- :total="totalPage"
- layout="total, sizes, prev, pager, next, jumper">
- </el-pagination>
- </template>
- <stock-details v-if="detailVisible" ref="details" @onChose="onChose"/>
- <stock-add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @onChose="onChose"/>
- <notice-change-setting v-if="noticeChangeAttachVisible" ref="noticeChangeSetting" @onChose="onChose"/>
- </div>
- </template>
- <script>
- import StockDetails from './stock-details'
- import StockAddOrUpdate from './stock-add-or-update'
- import NoticeChangeSetting from './stock-notice-change-setting'
- import Vue from 'vue'
- export default {
- name: 'stock',
- components: {
- StockAddOrUpdate,
- StockDetails,
- NoticeChangeSetting
- },
- data () {
- return {
- dataForm: {
- materialName: ''
- },
- dataList: [],
- pageIndex: 1,
- pageSize: 10,
- totalPage: 0,
- dataListLoading: false,
- dataListSelections: [],
- detailVisible: false,
- addOrUpdateVisible: false,
- noticeChangeAttachVisible: false,
- optionsCate: [] // 类别
- }
- },
- activated () {
- this.getCate()
- this.getDataList()
- },
- methods: {
- onChose () {
- this.addOrUpdateVisible = false
- this.detailVisible = false
- this.noticeChangeAttachVisible = false
- },
- // 获取类别
- getCate () {
- this.$http({
- url: this.$http.adornUrl('/biz-service/stock-mg-ctl/listCategory'),
- method: 'get'
- }).then(({data}) => {
- if (data && data.code === '200') {
- this.optionsCate = data.data
- }
- })
- },
- // 获取数据列表
- getDataList () {
- this.dataListLoading = true
- this.$http({
- url: this.$http.adornUrl('/biz-service/stock-mg-ctl/list'),
- method: 'get',
- params: this.$http.adornParams({
- 'current': this.pageIndex,
- 'size': this.pageSize,
- 'materialName': this.dataForm.materialName,
- 'materialTypeId': this.dataForm.materialTypeId ? this.dataForm.materialTypeId[0] : ''
- })
- }).then(({data}) => {
- if (data && data.code === '200') {
- this.dataList = data.data.records
- this.totalPage = Number(data.data.total)
- } else {
- this.dataList = []
- this.totalPage = 0
- }
- this.dataListLoading = false
- })
- },
- exportExcel () {
- let url = this.$http.adornUrl('/biz-service/stock-mg-ctl/exportedExcel')
- this.$http({
- url: url,
- method: 'get',
- params: this.$http.adornParams({
- 'materialName': this.dataForm.materialName
- })
- }).then(({data}) => {
- if (data && data.code && data.code !== '200') {
- this.$message.error(data.msg || '系统错误,请联系管理员')
- } else {
- window.open(url + '?_token=' + Vue.cookie.get('token') + '&materialName=' + this.dataForm.materialName, '_blank')
- }
- })
- },
- // 每页数
- sizeChangeHandle (val) {
- this.pageSize = val
- this.pageIndex = 1
- this.getDataList()
- },
- // 当前页
- currentChangeHandle (val) {
- this.pageIndex = val
- this.getDataList()
- },
- // 多选
- selectionChangeHandle (val) {
- this.dataListSelections = val
- },
- details (id) {
- this.detailVisible = true
- this.$nextTick(() => {
- this.$refs.details.init(id)
- })
- },
- // 新增、修改
- addOrUpdateHandle (id) {
- this.addOrUpdateVisible = true
- this.$nextTick(() => {
- this.$refs.addOrUpdate.init(id)
- })
- },
- // 转换属性“状态”
- formatState (row) {
- if (row.isInventory && Number(row.isInventory) === 1 && row.lockCnt && Number(row.lockCnt) > 0) {
- return '盘点中'
- } else if (row.isInventory && Number(row.isInventory) === 1) {
- return '盘点中'
- } else if (row.lockCnt && Number(row.lockCnt) > 0) {
- return '锁定中'
- } else {
- return '正常'
- }
- },
- // 变更通知人设置
- setNoticeChangeHandel () {
- this.noticeChangeAttachVisible = true
- this.$nextTick(() => {
- this.$refs.noticeChangeSetting.init()
- })
- }
- }
- }
- </script>
- <style scoped>
- </style>
|