| | |
| | | <template> |
| | | <win-md :title="setting.title" @close="close" :width="'800px'"> |
| | | <win-md :title="`${setting.title}预警设置`" @close="close" :width="'800px'"> |
| | | <el-form ref="ruleForm" :model="formData" :rules="rules" class="demo-ruleForm" label-width="100px"> |
| | | <el-row :gutter="24"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="物品分类" prop="code"> |
| | | <el-input disabled v-model="formData.code" clearable maxlength="20" show-word-limit style="width: 100%" /> |
| | | <el-form-item label="物品分类"> |
| | | <el-cascader |
| | | v-model="formData.baseCategoryIds" |
| | | :options="categoryOptions" |
| | | :props="{ value: 'id' }" |
| | | style="width: 100%" |
| | | ></el-cascader> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="物品名称" prop="name"> |
| | | <el-input v-model="formData.name" clearable maxlength="20" show-word-limit style="width: 100%" /> |
| | | <el-form-item label="物品名称"> |
| | | <el-select |
| | | :value="formData.baseGoodsTemplateId" |
| | | placeholder="请先择物品分类" |
| | | filterable |
| | | style="width: 100%" |
| | | > |
| | | <el-option v-for="item in goodsTemplatelAll" :key="item.id" :label="item.goodsName" :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="24"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="规格型号"> |
| | | <el-input v-model="formData.adss" clearable maxlength="20" show-word-limit style="width: 100%" /> |
| | | <el-select |
| | | v-model="formData.modelsIds" |
| | | multiple |
| | | placeholder="请先择物品名称" |
| | | @change="modelChange($event)" |
| | | @remove-tag="modelRemoveTag($event)" |
| | | style="width: 100%" |
| | | > |
| | | <el-option v-for="item in goodsModelAll" :key="item.id" :label="item.modelName" :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-table :data="formData.models" :stripe="true"> |
| | | <el-table-column prop="baseGoodsModelsId" label="规格型号" align="center"> </el-table-column> |
| | | <el-table-column prop="baseGoodsModelsId" label="保底库存" align="center"> |
| | | <el-table-column prop="bdcount" label="保底库存" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.baseGoodsModelsId"></el-input> |
| | | <el-input v-model="scope.row.bdcount"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="baseGoodsModelsId" label="封顶库存" align="center"> |
| | | <el-table-column prop="count" label="封顶库存" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.baseGoodsModelsId"></el-input> |
| | | <el-input v-model="scope.row.count"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | import winMd from '@/components/win/win-md'; |
| | | import myButton from '@/components/myButton/myButton'; |
| | | import * as finsystenant from '@/api/baseSetting/finsystenant'; |
| | | import { |
| | | getCategorySelectTree, |
| | | goodsModel, |
| | | warehouseSelectNumber, |
| | | goodsTemplate, |
| | | } from '@/api/baseSetting/finsystenant'; |
| | | |
| | | export default { |
| | | components: { winMd, myButton }, |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | checkAll: false, |
| | | checkedList: [], |
| | | agencyOptions: [], // 调拨机构 |
| | | categoryOptions: [], // 物品分类列表 |
| | | modelList: [], //型号列表 |
| | | formData: { |
| | | baseCategoryIds: '', // 分类编号数组 |
| | | baseCategoryId: '', // 分类编号 |
| | | baseGoodsTemplateId: '', // 物品模版编号 |
| | | modelsIds: [], //规格型号 |
| | | models:[] |
| | | models: [], |
| | | }, |
| | | modelsItem: { |
| | | baseGoodsModelsId: '', // 规格型号编号 |
| | |
| | | if (this.setting.info) { |
| | | this.formData = Object.assign({}, JSON.parse(this.setting.info)); |
| | | } |
| | | this.init(); |
| | | }, |
| | | methods: { |
| | | async init() { |
| | | this.getCategoryTree(); |
| | | this.getgoodsTemplate(); |
| | | this.getgoodsModel(); |
| | | }, |
| | | |
| | | async getCategoryTree() { |
| | | // 获取物品分类列表 |
| | | const treeRes = await getCategorySelectTree(); |
| | | this.categoryOptions = this.removeEmptyChildren(treeRes); |
| | | console.log('categoryOptions', this.categoryOptions); |
| | | }, |
| | | |
| | | // 获取物品名称列表 |
| | | getgoodsTemplate(id) { |
| | | goodsTemplate({ categoryId: id || '', agencyId: this.formData.outAgencyId }).then((res) => { |
| | | this.goodsTemplatelAll = res; |
| | | }); |
| | | }, |
| | | |
| | | // 规格型号 |
| | | getgoodsModel(id) { |
| | | goodsModel({ goodsTemplatesId: id || '' }).then((res) => { |
| | | this.goodsModelAll = res; |
| | | }); |
| | | }, |
| | | |
| | | // 物品分类选择 |
| | | categoryChange(e) { |
| | | this.formData.goodsOptions = []; |
| | | this.formData.baseGoodsTemplateId = ''; |
| | | this.formData.goodsTemplateName = ''; |
| | | this.formData.modelsOptions = []; |
| | | this.formData.modelsIds = []; |
| | | this.formData.models = []; |
| | | |
| | | this.formData.transferGoods.baseCategoryId = e[e.length - 1]; |
| | | // 根据选中分类请求物品名称列表 |
| | | this.getgoodsTemplate(e[e.length - 1]); |
| | | }, |
| | | |
| | | // 物品名称列表选择 |
| | | goodsTemplateChange(e, index) { |
| | | let temp = this.formData.transferGoods.find((v) => v.baseGoodsTemplateId == e); |
| | | if (temp) { |
| | | this.$message.warning('已选过此物品'); |
| | | return; |
| | | } else { |
| | | this.formData.transferGoods[index].baseGoodsTemplateId = e; |
| | | } |
| | | this.formData.transferGoods[index].modelsOptions = []; |
| | | this.formData.transferGoods[index].modelsIds = []; |
| | | this.formData.transferGoods[index].models = []; |
| | | |
| | | this.formData.transferGoods[index].goodsTemplateName = this.getGoodsTemplateName(e); |
| | | // 根据选中物品名称id获取规格型号列表 |
| | | this.getgoodsModel(e, index); |
| | | }, |
| | | |
| | | removeEmptyChildren(arr) { |
| | | arr.forEach((item) => { |
| | | if (!item.children || !item.children.length) { |
| | | delete item.children; |
| | | } else { |
| | | this.removeEmptyChildren(item.children); |
| | | } |
| | | }); |
| | | return arr; |
| | | }, |
| | | |
| | | // 规格型号选择 |
| | | modelChange(e) { |
| | | let arr = [...this.formData.models]; |
| | | let str = JSON.stringify(arr); |
| | | e.forEach((item) => { |
| | | if (str.indexOf(item) == -1) { |
| | | arr.push({ baseGoodsModelsId: item, bdcount: null,count:null }); |
| | | } |
| | | }); |
| | | this.formData.models = arr; |
| | | }, |
| | | |
| | | // 规格型号移除 |
| | | modelRemoveTag(e) { |
| | | let arr = this.formData.models; |
| | | let delIndex = arr.findIndex((v) => v.baseGoodsModelsId == e); |
| | | this.formData.models.splice(delIndex, 1); |
| | | }, |
| | | |
| | | getEditInfo(id) {}, |
| | | close() { |
| | | this.$emit('close'); |