Commit e5d626e1f5445e4358f17f9c9cac1122ef0af9cd

Authored by 陈翱
1 parent a8af3b86

入库组盘页面,库存状态显示字典值

ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiveModal.vue
... ... @@ -29,6 +29,12 @@
29 29 <a-button type="primary" @click="selectContainer(record)">选取容器</a-button>
30 30 </span>
31 31  
  32 + <span slot="inventoryStatus" slot-scope="inventoryStatus">
  33 + <a-tag :key="inventoryStatus" color="blue" :color="getStatusColor(inventoryStatus)">
  34 + {{ solutionInvStatus(inventoryStatus) }}
  35 + </a-tag>
  36 + </span>
  37 +
32 38 </a-table>
33 39 <select-inv-container-header ref="selectContainerForm" v-on:getContainer="getContainerCode"></select-inv-container-header>
34 40 </j-modal>
... ... @@ -42,7 +48,7 @@ import { JeecgListMixin } from &#39;@/mixins/JeecgListMixin&#39;
42 48 import { filterMultiDictText } from '@/components/dict/JDictSelectUtil'
43 49 import { validateDuplicateValue } from '@/utils/util'
44 50 import { searchMaterialByCode } from '@/api/api'
45   -import { listReceiveByReceiptId } from '@/api/api'
  51 +import { listReceiveByReceiptId,ajaxGetDictItems } from '@/api/api'
46 52 import SelectInvContainerHeader from "./SelectInvContainerHeader";
47 53  
48 54 export default {
... ... @@ -63,6 +69,7 @@ export default {
63 69 materialList: {},
64 70 querySource: {},
65 71 dataSource: [],
  72 + invStatus:[],
66 73 model: {},
67 74 labelCol: {
68 75 xs: { span: 24 },
... ... @@ -89,7 +96,8 @@ export default {
89 96 title: '库存状态',
90 97 dataIndex: 'inventoryStatus',
91 98 align: 'center',
92   - width: 96
  99 + width: 96,
  100 + scopedSlots: {customRender: 'inventoryStatus'}
93 101 },
94 102 {
95 103 title: '批次',
... ... @@ -134,14 +142,42 @@ export default {
134 142 // this.searchReceive()
135 143 this.getSuperFieldList()
136 144 // this.modelDefault = JSON.parse(JSON.stringify(this.model))
  145 + this.loadFrom();
137 146 },
138 147 methods: {
  148 + loadFrom(){
  149 + ajaxGetDictItems('inventory_status').then((res) => {
  150 + if (res.success) {
  151 + this.invStatus = res.result
  152 + }
  153 + })
  154 + },
  155 + getStatusColor(status) {
  156 + const colors = {
  157 + 'good ': 'green',
  158 + 'defective': 'red',
  159 + 'discussed ': 'grey',
  160 + 'scrap': 'purple',
  161 + default: 'blue'
  162 + };
  163 + return colors[status] || colors.default;
  164 + },
139 165 getContainerCode(e){
140 166 this.$nextTick(function (){
141 167 let record={containerCode: e}
142 168 this.model = Object.assign({}, record)
143 169 })
144 170 },
  171 + solutionInvStatus(value) {
  172 + var actions = []
  173 + Object.keys(this.invStatus).some(key => {
  174 + if (this.invStatus[key].value == '' + value) {
  175 + actions.push(this.invStatus[key].text)
  176 + return true
  177 + }
  178 + })
  179 + return actions.join('')
  180 + },
145 181 // add() {
146 182 // this.edit(this.modelDefault)
147 183 // this.model.inventoryStatus = 'good'
... ...