|  |  |  | 
|---|
|  |  |  | <template> | 
|---|
|  |  |  | <GlobalWindow title="选择物料" :visible.sync="isShowModal" :confirm-working="isLoading" width="900px" @close="close" | 
|---|
|  |  |  | <GlobalWindow title="选择物料" :visible.sync="isShowModal" :confirm-working="isLoading" width="1000px" @close="close" | 
|---|
|  |  |  | @confirm="confirm"> | 
|---|
|  |  |  | <el-form ref="searchForm" :model="searchForm" label-width="100px" inline> | 
|---|
|  |  |  | <el-form-item prop="areaType" label="物料信息"> | 
|---|
|  |  |  | <el-input v-model="searchForm.aaa" placeholder="请输入物料编码/名称" @keypress.enter.native="search"></el-input> | 
|---|
|  |  |  | <el-form-item prop="code" label="物料信息"> | 
|---|
|  |  |  | <el-input v-model="searchForm.code" placeholder="请输入物料编码/名称" @keypress.enter.native="search"></el-input> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item prop="areaIds" label="物料分类"> | 
|---|
|  |  |  | <el-cascader v-model="searchForm.areaIds" @change="changeSel" placeholder="请选择物料分类" clearable | 
|---|
|  |  |  | :options="cateList" :props="{ | 
|---|
|  |  |  | label: 'name', | 
|---|
|  |  |  | value: 'id', | 
|---|
|  |  |  | children: 'childCategoryList' | 
|---|
|  |  |  | children: 'childCategoryList', | 
|---|
|  |  |  | checkStrictly: true | 
|---|
|  |  |  | }"></el-cascader> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <span> | 
|---|
|  |  |  | <el-button type="primary" @click="getList">搜索</el-button> | 
|---|
|  |  |  | <el-button type="primary" @click="getList(1)">搜索</el-button> | 
|---|
|  |  |  | <el-button @click="reset">重置</el-button> | 
|---|
|  |  |  | </span> | 
|---|
|  |  |  | </el-form> | 
|---|
|  |  |  | <!--  --> | 
|---|
|  |  |  | <el-table @selection-change="handleSelectionChange" :data="list" stripe> | 
|---|
|  |  |  | <el-table-column type="selection"  width="55" /> | 
|---|
|  |  |  | <el-table-column prop="categoryName" label="物料编码" min-width="100px"></el-table-column> | 
|---|
|  |  |  | <el-table-column prop="creatorName" label="物料名称" min-width="80px"></el-table-column> | 
|---|
|  |  |  | <el-table-column prop="createDate" label="条码" min-width="100px"></el-table-column> | 
|---|
|  |  |  | <el-table-column prop="dealUserName" label="品牌" min-width="80px"></el-table-column> | 
|---|
|  |  |  | <el-table-column prop="dealUserName" label="规格型号" min-width="80px"></el-table-column> | 
|---|
|  |  |  | <el-table-column prop="dealUserName" label="单位" min-width="80px"></el-table-column> | 
|---|
|  |  |  | <el-table-column prop="dealUserName" label="库存" min-width="80px"></el-table-column> | 
|---|
|  |  |  | <el-table-column type="selection" width="55" /> | 
|---|
|  |  |  | <el-table-column prop="code" label="物料编码" min-width="100px"></el-table-column> | 
|---|
|  |  |  | <el-table-column prop="name" label="物料名称" min-width="80px"></el-table-column> | 
|---|
|  |  |  | <el-table-column prop="qrcode" label="条码" min-width="100px"></el-table-column> | 
|---|
|  |  |  | <el-table-column prop="brand" label="品牌" min-width="80px"></el-table-column> | 
|---|
|  |  |  | <el-table-column prop="attr" label="规格型号" min-width="80px"></el-table-column> | 
|---|
|  |  |  | <el-table-column prop="unitName" label="单位" min-width="80px"></el-table-column> | 
|---|
|  |  |  | <el-table-column v-if="isOut" prop="maxStock" label="库存" min-width="80px"></el-table-column> | 
|---|
|  |  |  | </el-table> | 
|---|
|  |  |  | <Pagination @size-change="handleSizeChange" @current-change="getList" :pagination="pagination"> | 
|---|
|  |  |  | <Pagination class="mt10" @size-change="handleSizeChange" @current-change="getList" :pagination="pagination"> | 
|---|
|  |  |  | </Pagination> | 
|---|
|  |  |  | </GlobalWindow> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | 
|---|
|  |  |  | import BaseOpera from '@/components/base/BaseOpera' | 
|---|
|  |  |  | import GlobalWindow from '@/components/common/GlobalWindow' | 
|---|
|  |  |  | import Pagination from '@/components/common/Pagination' | 
|---|
|  |  |  | import { fetchList } from '@/api/ywMaterial' | 
|---|
|  |  |  | import { ywStockPage } from '@/api/store/index' | 
|---|
|  |  |  | import { fetchList as getCateList } from '@/api/business/category.js' | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | name: 'OperaCategoryWindow', | 
|---|
|  |  |  | 
|---|
|  |  |  | page: 1, | 
|---|
|  |  |  | total: 0 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | isOut: false, | 
|---|
|  |  |  | warehouseId: false, | 
|---|
|  |  |  | list: [], | 
|---|
|  |  |  | selList: [], | 
|---|
|  |  |  | cateList: [], | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | created() { | 
|---|
|  |  |  | this.initData() | 
|---|
|  |  |  | this.getCate() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | confirm() { | 
|---|
|  |  |  | 
|---|
|  |  |  | this.selList = val | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | getList(page) { | 
|---|
|  |  |  | const { pagination, searchForm } = this | 
|---|
|  |  |  | const { pagination, searchForm, isOut, warehouseId } = this | 
|---|
|  |  |  | this.listLoading = true | 
|---|
|  |  |  | if(page){pagination.page = page} | 
|---|
|  |  |  | fetchList({ | 
|---|
|  |  |  | if (page) { pagination.page = page } | 
|---|
|  |  |  | console.log('isOut', isOut) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | let fn = isOut ? ywStockPage : fetchList | 
|---|
|  |  |  | fn({ | 
|---|
|  |  |  | capacity: pagination.pageSize, | 
|---|
|  |  |  | page: pagination.page, | 
|---|
|  |  |  | model: {...searchForm} | 
|---|
|  |  |  | model: { ...searchForm, status: 0, warehouseId } | 
|---|
|  |  |  | }).then((res) => { | 
|---|
|  |  |  | this.listLoading = false | 
|---|
|  |  |  | this.list = res.records | 
|---|
|  |  |  | this.pagination.total = res.total || 0 | 
|---|
|  |  |  | if (isOut) { | 
|---|
|  |  |  | this.list.forEach(item => { | 
|---|
|  |  |  | item.brand = item.materialBrand | 
|---|
|  |  |  | item.attr = item.materialAttr | 
|---|
|  |  |  | item.name = item.materialName | 
|---|
|  |  |  | item.id = item.materialId | 
|---|
|  |  |  | item.code = item.materialCode | 
|---|
|  |  |  | item.qrcode = item.materialQrcode | 
|---|
|  |  |  | item.unitName = item.materialUnitName | 
|---|
|  |  |  | item.maxStock = item.stock | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, () => { | 
|---|
|  |  |  | this.listLoading = false | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | initData() { | 
|---|
|  |  |  | getCate() { | 
|---|
|  |  |  | getCateList({ | 
|---|
|  |  |  | model: { type: 3 }, | 
|---|
|  |  |  | model: { type: 7 }, | 
|---|
|  |  |  | capacity: 1000, | 
|---|
|  |  |  | page: 1, | 
|---|
|  |  |  | }).then(res => { | 
|---|
|  |  |  | 
|---|
|  |  |  | changeSel(e) { | 
|---|
|  |  |  | if (e && e.length == 2) { | 
|---|
|  |  |  | this.$set(this.searchForm, 'cateId', e[1]) | 
|---|
|  |  |  | this.$set(this.searchForm, 'parentCateId', '') | 
|---|
|  |  |  | } else if ((e && e.length == 1)) { | 
|---|
|  |  |  | this.$set(this.searchForm, 'parentCateId', e[0]) | 
|---|
|  |  |  | this.$set(this.searchForm, 'cateId', '') | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.$set(this.searchForm, 'cateId', '') | 
|---|
|  |  |  | } | 
|---|