| | |
| | | :rules="rules.baseGoodsTemplateId" |
| | | > |
| | | <el-select |
| | | v-model="goodsItem.baseGoodsTemplateId" |
| | | v-model="goodsItem.baseGoodsTemplateId" |
| | | placeholder="请先择物品分类" |
| | | filterable |
| | | :disabled="!goodsItem.baseCategoryId" |
| | |
| | | {{ scope.row.unit }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="price" label="单价(元)" align="center"> |
| | | <el-table-column prop="priceYuan" label="单价(元)" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-form-item |
| | | label-width="0" |
| | | style="margin-bottom: 0" |
| | | :prop="`procureGoods[${goodsIndex}].models[${scope.$index}].price`" |
| | | :rules="rules.price" |
| | | :prop="`procureGoods[${goodsIndex}].models[${scope.$index}].priceYuan`" |
| | | :rules="rules.priceYuan" |
| | | > |
| | | <el-input type="number" v-model.number="scope.row.price"></el-input> |
| | | <el-input |
| | | type="number" |
| | | v-model.number="scope.row.priceYuan" |
| | | @change="priceChange($event, goodsIndex, scope.$index)" |
| | | ></el-input> |
| | | </el-form-item> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | return callback(new Error('请选择')); |
| | | } |
| | | let temp = this.formData.procureGoods.filter((v) => v.baseGoodsTemplateId == value); |
| | | if (!temp || temp.length!=1) { |
| | | if (!temp || temp.length != 1) { |
| | | return callback(new Error('已选过此物品')); |
| | | } |
| | | callback(); |
| | | }; |
| | | // 金额校验 |
| | | var checkPrice = (rule, value, callback) => { |
| | | console.log(value); |
| | | if (!value) { |
| | | return callback(new Error('请输入')); |
| | | } |
| | |
| | | }; |
| | | // 数量校验 |
| | | var checkCounts = (rule, value, callback) => { |
| | | console.log(value) |
| | | console.log(value); |
| | | if (!value) { |
| | | return callback(new Error('请输入')); |
| | | } |
| | |
| | | }, |
| | | modelsItem: { |
| | | baseGoodsModelsId: '', // 规格型号编号 |
| | | price: null, // 单价(采购需要,调拨不需要) |
| | | priceYuan: null, // 单价(元) |
| | | price: null, // 单价(分 采购需要,调拨不需要) |
| | | counts: null, // 操作数量 |
| | | unit: null, //单位 |
| | | }, |
| | |
| | | baseCategoryIds: [{ required: true, message: '请选择', trigger: 'change' }], |
| | | baseGoodsTemplateId: [{ validator: checkGoodsTemplateId, trigger: ['blur', 'change'] }], |
| | | modelsIds: [{ required: true, message: '请选择', trigger: 'change' }], |
| | | price: [{ validator: checkPrice, trigger: 'blur' }], |
| | | priceYuan: [{ validator: checkPrice, trigger: 'blur' }], |
| | | counts: [{ validator: checkCounts, trigger: 'blur' }], |
| | | }, |
| | | |
| | |
| | | ); |
| | | this.getgoodsTemplate(item.baseCategoryId, index); |
| | | this.getgoodsModel(item.baseGoodsTemplateId, index); |
| | | item.models.forEach((child, childIndex) => { |
| | | this.$set(this.formData.procureGoods[index].models[childIndex], 'priceYuan', child.price / 100); |
| | | }); |
| | | return item; |
| | | }); |
| | | } |
| | |
| | | this.formData.procureGoods[index].models.splice(delIndex, 1); |
| | | }, |
| | | |
| | | // 价格input监听 转为分 |
| | | priceChange(e, goodsIndex, index) { |
| | | this.formData.procureGoods[goodsIndex].models[index].price = e * 100; |
| | | }, |
| | | |
| | | // 上传 |
| | | uploadChange() { |
| | | let arr = this.$refs.uploadRef.fileList; |
| | |
| | | handleSubmit() { |
| | | this.$refs['ruleForm'].validate((valid) => { |
| | | if (valid) { |
| | | console.log('this.formData', this.formData); |
| | | console.log('formData', this.formData); |
| | | debugger; |
| | | if (!this.setting.id) { |
| | | procureAdd(this.formData) |
| | | .then((res) => { |