Blame view

src/components/resource/viewResourceMyGoodsInfo.vue 5.14 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
325bf296   wuxw   测试完成采购流程
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
    <el-card class="box-card">
      <div slot="header" class="flex justify-between">
        <span>{{ $t('viewResourceMyGoodsInfo.goodsInfo') }}</span>
        <div class="action-buttons">
          <el-button 
            type="primary" 
            size="small" 
            @click="handleGoBack">
            <i class="el-icon-close"></i>
            {{ $t('viewResourceMyGoodsInfo.back') }}
          </el-button>
          <el-button 
            type="primary" 
            size="small"
            @click="handleOpenSelectModal">
            <i class="el-icon-search"></i>
            {{ $t('viewResourceMyGoodsInfo.selectGoods') }}
          </el-button>
        </div>
      </div>
  
      <el-table 
        :data="resourceStores" 
        border 
        style="width: 100%">
        <el-table-column 
          prop="resName" 
          :label="$t('viewResourceMyGoodsInfo.goodsName')" 
          align="center" />
        <el-table-column 
          prop="resCode" 
          :label="$t('viewResourceMyGoodsInfo.goodsCode')" 
          align="center" />
        <el-table-column 
          :label="$t('viewResourceMyGoodsInfo.goodsType')" 
          align="center">
          <template slot-scope="scope">
            {{ scope.row.parentRstName || '-' }} > {{ scope.row.rstName || '-' }}
          </template>
        </el-table-column>
        <el-table-column 
          prop="isFixedName" 
          :label="$t('viewResourceMyGoodsInfo.isFixedGoods')" 
          align="center" />
        <el-table-column 
          :label="$t('viewResourceMyGoodsInfo.goodsStock')" 
          align="center">
          <template slot-scope="scope">
            {{ scope.row.stock }}{{ scope.row.unitCodeName }}
          </template>
        </el-table-column>
        <el-table-column 
          :label="$t('viewResourceMyGoodsInfo.miniStock')" 
          align="center">
          <template slot-scope="scope">
            {{ scope.row.miniStock }}{{ scope.row.miniUnitCodeName }}
          </template>
        </el-table-column>
        <el-table-column 
          :label="$t('viewResourceMyGoodsInfo.lossQuantity')" 
          align="center">
          <template slot-scope="scope">
            <el-input-number
              v-model="scope.row.giveQuantity"
              :min="0"
              :max="parseFloat(scope.row.miniStock)"
              :precision="2"
              controls-position="right"
              style="width: 120px">
            </el-input-number>
            {{ scope.row.miniUnitCodeName }}
          </template>
        </el-table-column>
        <el-table-column 
          :label="$t('viewResourceMyGoodsInfo.usageType')" 
          align="center">
          <template slot-scope="scope">
            <el-select 
              v-model="scope.row.state" 
              style="width: 100%">
              <el-option 
                :label="$t('viewResourceMyGoodsInfo.selectUsageType')" 
                value=""></el-option>
              <el-option 
                :label="$t('viewResourceMyGoodsInfo.scrapRecycle')" 
                value="1001"></el-option>
              <el-option 
                :label="$t('viewResourceMyGoodsInfo.publicLoss')" 
                value="3003"></el-option>
            </el-select>
          </template>
        </el-table-column>
        <el-table-column 
          :label="$t('viewResourceMyGoodsInfo.remark')" 
          align="center">
          <template slot-scope="scope">
            <el-input 
              v-model="scope.row.purchaseRemark" 
              :placeholder="$t('viewResourceMyGoodsInfo.requiredRemark')">
            </el-input>
          </template>
        </el-table-column>
        <el-table-column 
          :label="$t('viewResourceMyGoodsInfo.operation')" 
          align="center">
          <template slot-scope="scope">
            <el-button 
              type="danger" 
              size="mini" 
              @click="handleRemoveItem(scope.row.resId, scope.$index)">
              <i class="el-icon-delete"></i>
              {{ $t('viewResourceMyGoodsInfo.remove') }}
            </el-button>
          </template>
        </el-table-column>
      </el-table>
  
      <choose-resource-staff 
        ref="chooseResourceStaff"
        @setSelectResourceStores="handleSetSelectedStores">
      </choose-resource-staff>
    </el-card>
  </template>
  
  <script>
  import ChooseResourceStaff from './chooseResourceStaff.vue'
  
  export default {
    name: 'ViewResourceMyGoodsInfo',
    components: {
      ChooseResourceStaff
    },
    props: {
      callBackListener: {
        type: String,
        default: ''
      },
      callBackFunction: {
        type: String,
        default: ''
      }
    },
    data() {
      return {
        resourceStores: [],
        index: 0
      }
    },
    methods: {
      handleGoBack() {
        this.$router.go(-1)
      },
      handleOpenSelectModal() {
        this.$refs.chooseResourceStaff.open()
      },
      handleSetSelectedStores(resourceStores) {
        this.resourceStores = resourceStores.map(item => {
          return {
            ...item,
            state: '',
            purchaseRemark: '',
            giveQuantity: 0
          }
        })
        this.$emit(this.callBackFunction, this.resourceStores)
      },
      handleRemoveItem(resId, index) {
        this.resourceStores.splice(index, 1)
        this.$emit(this.callBackFunction, this.resourceStores)
        this.$refs.chooseResourceStaff.removeSelectedItem(resId)
      }
    }
  }
  </script>
  
  <style scoped>
  .action-buttons {
    float: right;
  }
  </style>