| | |
| | | <template> |
| | | <win-md class="stock-edit" :title="`${setting.title}出库`" @close="close" :width="'800px'"> |
| | | <el-form class="form" ref="ruleForm" :model="formData" :rules="rules" label-width="120px"> |
| | | <el-form v-loading="loading" class="form" ref="ruleForm" :model="formData" :rules="rules" label-width="120px"> |
| | | <div class="main-w"> |
| | | <el-row :gutter="24" class="headerHeight"> |
| | | <el-col :span="12"> |
| | |
| | | </el-form> |
| | | <div slot="footer" align="center" class="dialog-footer"> |
| | | <my-button name="取消" site="form" @click="close" /> |
| | | <my-button name="保存" site="form" @click="handleSubmit" /> |
| | | <el-button name="保存" type="primary" size="medium" :loading="btnloading" @click="handleSubmit">保存</el-button> |
| | | </div> |
| | | </win-md> |
| | | </template> |
| | | <script> |
| | | import { |
| | | goodsTemplate, |
| | | goodsModel, |
| | | selectTenantWarehouse, |
| | | warehouseSelectNumber, |
| | | } from '@/api/baseSetting/finsystenant'; |
| | | import { outputAdd } from '@/api/stock/accessStock'; |
| | | import { getTree } from '@/api/foudation/classification'; |
| | | import {goodsModel, goodsTemplate, selectTenantWarehouse, warehouseSelectNumber,} from '@/api/baseSetting/finsystenant'; |
| | | import {outputAdd} from '@/api/stock/accessStock'; |
| | | import {getTree} from '@/api/foudation/classification'; |
| | | import MyButton from '@/components/myButton/myButton'; |
| | | import winMd from '@/components/win/win-md'; |
| | | import upload from '@/components/upload/index'; |
| | | import { getUploadUrl } from '@/utils/base'; |
| | | import { mapGetters } from 'vuex'; |
| | | import {getUploadUrl} from '@/utils/base'; |
| | | import {mapGetters} from 'vuex'; |
| | | |
| | | export default { |
| | | components: { MyButton, winMd, upload }, |
| | |
| | | callback(); |
| | | }; |
| | | return { |
| | | loading: false, |
| | | loading: true, |
| | | btnloading: false, |
| | | warehouseOptions: [], // 出库仓库列表 |
| | | categoryOptions: [], // 物品分类列表 |
| | | modelList: [], //型号列表 |
| | |
| | | }, |
| | | methods: { |
| | | async init() { |
| | | this.getWarehouseList(); |
| | | this.getgoodsTemplate(); |
| | | this.getgoodsModel(); |
| | | await this.getWarehouseList(); |
| | | await this.getgoodsTemplate(); |
| | | await this.getgoodsModel(); |
| | | // 获取物品分类列表 |
| | | const treeRes = await getTree(); |
| | | this.categoryOptions = this.removeEmptyChildren(treeRes); |
| | | this.loading = false |
| | | }, |
| | | |
| | | // 获取出库仓库列表 |
| | | getWarehouseList() { |
| | | selectTenantWarehouse({ agencyId: this.userInfo.tenantId }) |
| | | async getWarehouseList() { |
| | | await selectTenantWarehouse({ agencyId: this.userInfo.tenantId }) |
| | | .then((res) => { |
| | | this.warehouseOptions = res; |
| | | if (res.length) { |
| | |
| | | }, |
| | | |
| | | // 获取物品名称列表 |
| | | getgoodsTemplate(id, index) { |
| | | goodsTemplate({ categoryId: id || '' }).then((res) => { |
| | | async getgoodsTemplate(id, index) { |
| | | await goodsTemplate({ categoryId: id || '' }).then((res) => { |
| | | if (index || index == 0) { |
| | | this.$set(this.formData.goods[index], 'goodsOptions', res); |
| | | } else { |
| | |
| | | }, |
| | | |
| | | // 规格型号 |
| | | getgoodsModel(id, index) { |
| | | goodsModel({ goodsTemplatesId: id || '' }).then((res) => { |
| | | async getgoodsModel(id, index) { |
| | | await goodsModel({ goodsTemplatesId: id || '' }).then((res) => { |
| | | if (index || index == 0) { |
| | | this.$set(this.formData.goods[index], 'modelsOptions', res); |
| | | } else { |
| | |
| | | handleSubmit() { |
| | | this.$refs['ruleForm'].validate((valid) => { |
| | | if (valid) { |
| | | if (this.loading) return |
| | | this.loading = true; |
| | | this.btnloading = true; |
| | | console.log('this.formData', this.formData); |
| | | outputAdd(this.formData) |
| | | .then((res) => { |
| | | this.$message.success('保存成功!'); |
| | | this.btnloading = false; |
| | | this.loading = false; |
| | | this.close(); |
| | | this.$emit('search'); |
| | | }) |
| | | .catch((err) => { |
| | | console.log('edit err', err); |
| | | this.btnloading = false; |
| | | this.loading = false; |
| | | this.$message.error('保存失败'); |
| | | }); |
| | | } else { |
| | | this.$message.error('校验未通过,请检查。'); |
| | | this.btnloading = false; |
| | | } |
| | | }); |
| | | }, |