123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979 |
- <template>
- <div id="demandSummary">
- <div v-if="isList">
- <el-card style="position: relative;">
- <el-form class="search_area" label-width="100px">
- <el-row :gutter="10">
- <el-col :span="1.5">
- <el-form-item label="行状态">
- <el-select multiple v-model="queryParams.rowStatus" size="mini" style="width: 200px" clearable>
- <el-option v-for="dict in dict.type.sys_row_status" :key="dict.value" :label="dict.label" :value="dict.value">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="采购员">
- <el-select clearable size="mini" v-model="queryParams.buyer" @clear="cleanBuyer" @focus="chooseRefer('CONTACTS_PARAM', true, '采购员')" style="width: 200px">
- <el-option v-for="item in personOptions" :key="item.id" :label="item.name" :value="item.code" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="品类">
- <el-select
- v-model="queryParams.materialClassifyFour"
- size="mini"
- multiple
- collapse-tags
- clearable
- @focus="chooseTreeRefer('MATERIALCLASSIFY_PARAM', false, '选择品类')"
- style="width: 200px"
- >
- <el-option v-for="item in classOptions" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="生产厂家">
- <el-input
- v-model.trim="queryParams.manufacturer"
- size="mini"
- clearable
- style="width: 200px"
- />
- </el-form-item>
- </el-col>
- <!-- <el-col :span="1.5"> -->
- <!-- <el-form-item label="" label-width="20px"> -->
- <div style="position: absolute;top: 3px;right: 10px;">
- <el-button type="primary" size="mini" @click="search">搜索</el-button>
- <el-button size="mini" plain @click="reset">重置</el-button>
- </div>
- <!-- </el-form-item> -->
- <!-- </el-col> -->
- </el-row>
- <CollapseTransition>
- <div v-show="expanded">
- <el-row :gutter="10">
- <el-col :span="1.5">
- <el-form-item label="预测分类">
- <el-select v-model="queryParams.forecastClassification" size="mini" style="width: 200px" clearable>
- <el-option
- v-for="dict in dict.type.predictive_classify" :key="dict.value" :label="dict.label" :value="dict.label">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="审核人">
- <el-select clearable size="mini" v-model="queryParams.puManagerAuditor" @focus="chooseRefer('CONTACTS_PARAM', true, '审核人')" style="width: 200px">
- <el-option v-for="item in auditOptions" :key="item.id" :label="item.name" :value="item.code" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="注册人">
- <el-input
- v-model.trim="queryParams.registrant"
- size="mini"
- clearable
- style="width: 200px"
- />
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="业务类型">
- <el-select v-model="queryParams.businessType" size="mini" style="width: 200px" clearable>
- <el-option
- v-for="dict in dict.type.sys_business" :key="dict.value" :label="dict.label" :value="dict.value">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="10">
- <el-col :span="1.5">
- <el-form-item label="单据来源">
- <el-select v-model="queryParams.billSource" size="mini" style="width: 200px" clearable>
- <el-option
- v-for="dict in dict.type.sys_bill_source" :key="dict.value" :label="dict.label" :value="dict.value">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="需求客户">
- <el-select clearable size="mini" v-model="queryParams.customer" @focus="chooseRefer('CUSTOMER_PARAM', true, '需求客户')" style="width: 200px">
- <el-option v-for="item in customerOptions" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="供应仓库">
- <el-select clearable size="mini" v-model="queryParams.lastWarehouse" @focus="chooseRefer('WAREHOUSE_PARAM', true, '供应仓库')" style="width: 200px">
- <el-option v-for="item in lastWarehouseOptions" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="供应库位">
- <el-select clearable size="mini" v-model="queryParams.lastAllocation" @focus="chooseRefer('ALLOCATION_PARAM', true, '供应库位', queryParams.lastWarehouse)" style="width: 200px">
- <el-option v-for="item in lastAllocationOptions" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="10">
- <el-col :span="1.5">
- <el-form-item label="物料编码">
- <el-popover
- placement="top-start"
- width="200"
- trigger="hover"
- :content="queryParams.names">
- <el-input slot="reference" clearable size="mini" v-model="queryParams.names" @clear="clearMaterial" style="width: 200px" @paste.native="pasteMe($event)">
- <el-button size="mini" slot="append" icon="el-icon-more" @click="chooseMaterial"></el-button>
- </el-input>
- </el-popover>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="默认采购组织">
- <el-select clearable size="mini" v-model="queryParams.purchaseOrg" @focus="chooseRefer('ORG_PARAM', true, '默认采购组织')" style="width: 200px">
- <el-option v-for="item in orgOptions" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="需求日期">
- <el-date-picker
- v-model="queryParams.demandDate"
- type="date"
- value-format="yyyy-MM-dd"
- size="mini"
- style="width: 200px"
- >
- </el-date-picker>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="采购需求单号">
- <el-input
- v-model.trim="queryParams.code"
- size="mini"
- clearable
- style="width: 200px"
- />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="10">
- <el-col :span="1.5">
- <el-form-item label="审批结束日期">
- <el-date-picker
- v-model="queryParams.approverFinishTime"
- type="date"
- clearable
- value-format="yyyy-MM-dd"
- size="mini"
- style="width: 200px"
- >
- </el-date-picker>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="是否客户指定">
- <el-select clearable v-model="queryParams.isCustomerSpecified" size="mini" style="width: 200px">
- <el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1.5">
- <el-form-item label="是否紧急需求">
- <el-select clearable v-model="queryParams.isUrgency" size="mini" style="width: 200px">
- <el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- </div>
- </CollapseTransition>
- </el-form>
- <el-divider class="lines"><i style="cursor: pointer;" :class="expanded?'el-icon-arrow-up':'el-icon-arrow-down'" @click="drop"></i></el-divider>
-
-
- <div class="btn_grooup">
- <el-button type="primary" size="mini" @click="editList">编辑</el-button>
- <el-button type="danger" size="mini" v-if="!lineDisable" @click="cancelEdit">取消编辑</el-button>
- <el-button type="success" size="mini" v-if="!lineDisable" @click="saveList">保存</el-button>
- <el-button type="primary" size="mini" v-if="lineDisable" @click="confirms">确认</el-button>
- <el-button type="primary" size="mini" v-if="lineDisable" @click="cancels">取消</el-button>
- <!-- <el-button type="primary" size="mini" v-if="lineDisable" @click="cancelAudit">取消审批</el-button> -->
- <el-button type="primary" size="mini" v-if="lineDisable" @click="audits">审核</el-button>
- <el-button type="primary" size="mini" v-if="lineDisable" @click="closeLine">行关闭</el-button>
- <el-button size="mini" type="primary" style="margin: 0 10px;" v-if="lineDisable" @click="handleCommand">
- 导出
- </el-button>
- <!-- <el-button type="primary" size="mini">转请购</el-button> -->
- </div>
- <el-table
- v-loading="loading"
- :data="tableList"
- :cell-style="{ borderColor: '#c0c0c0' }"
- :header-cell-style="{ borderColor: '#c0c0c0' }"
- class="exporttable"
- border
- show-summary
- :summary-method="getSummaries"
- highlight-current-row
- max-height="620"
- style="font-size: 12px;"
- :cell-class-name="cellClassName"
- @selection-change="handleSelectionChange"
- @row-click="rowSelect"
- @row-dblclick="doubleClick"
- ref="table"
- >
- <el-table-column type="selection" width="60" fixed="left"/>
- <el-table-column show-overflow-tooltip label="序号" type="index" align="center" width="50px" fixed="left"/>
- <!-- <el-table-column show-overflow-tooltip v-if="showColumn.status" label="行号" align="center" prop="rowNo"/> -->
- <el-table-column show-overflow-tooltip v-if="showColumn.status" label="行状态" align="center" prop="status" width="50px" :formatter="hangStatus"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.finalBuyQty" label="最终采购量" align="center" prop="finalBuyQty" width="80px">
- <template slot-scope="scope">
- <el-input size="mini" :disabled="scope.row.status !== '1' || lineDisable" v-model="scope.row.finalBuyQty" @change="jilu(scope.$index)"/>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip v-if="showColumn.artificialAdjust" label="人工调整数" align="center" prop="artificialAdjust" width="50px">
- <template slot-scope="scope">
- {{scope.row.artificialAdjust = scope.row.finalBuyQty - scope.row.suggestionPurchase}}
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip v-if="showColumn.materialClassifyOneName" label="一级品类" align="center" prop="materialClassifyOneName" width="50"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.materialCode" label="物料编码" align="center" prop="materialCode" width="50px"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.materialName" label="品名" align="center" prop="materialName" width="50px"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.specification" label="规格" align="center" prop="specification" width="50px"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.unit" label="单位" align="center" prop="unit" width="50"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.manufacturer" label="生产厂家/代理人" align="center" prop="manufacturer" width="80px"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.demandNum" label="需求单位数" align="center" prop="demandNum" width="50px"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.netDemandNum" label="总最终净需求量" align="center" prop="netDemandNum" width="80px">
- <template slot-scope="scope">
- {{scope.row.netDemandNum ? parseFloat(scope.row.netDemandNum).toFixed(2) : '0.00'}}
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip v-if="showColumn.evensalesforyear" label="近1月月均需求" align="center" prop="evensalesforyear" width="50">
- <template slot-scope="scope">
- {{scope.row.evensalesforyear ? parseFloat(scope.row.evensalesforyear).toFixed(2) : '0.00'}}
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip v-if="showColumn.evensalesforthrmonth" label="近3月月均需求" align="center" prop="evensalesforthrmonth" width="50">
- <template slot-scope="scope">
- {{scope.row.evensalesforthrmonth ? parseFloat(scope.row.evensalesforthrmonth).toFixed(2) : '0.00'}}
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip v-if="showColumn.totalMonthlySales" label="总月销量" align="center" prop="totalMonthlySales" width="50">
- <template slot-scope="scope">
- {{scope.row.totalMonthlySales ? parseFloat(scope.row.totalMonthlySales).toFixed(2) : '0.00'}}
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip v-if="showColumn.demandCycle" label="需求可用周期" align="center" prop="demandCycle" width="50px">
- <template slot-scope="scope">
- {{scope.row.demandCycle ? parseFloat(scope.row.demandCycle).toFixed(1) : '-'}}
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip v-if="showColumn.dullQut" label="呆滞量" align="center" prop="dullQut" width="50px">
- <template slot-scope="scope">
- {{parseFloat(scope.row.dullQut).toFixed(2)}}
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip v-if="showColumn.buyPeriod" label="采购周期" align="center" prop="buyPeriod" width="50px" />
- <el-table-column show-overflow-tooltip v-if="showColumn.centralPublicStock" label="中心公共库存" align="center" prop="centralPublicStock" width="50"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.centralWarehouse" label="中心仓专属货位" align="center" prop="centralWarehouse" width="50"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.eachWarehouseStock" label="各项目仓库存" align="center" prop="eachWarehouseStock" width="50"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.commerceWarehouse" label="电商仓库" align="center" prop="commerceWarehouse" width="50" />
- <el-table-column show-overflow-tooltip v-if="showColumn.regionPublicStock" label="区域分仓公共库存" align="center" prop="regionPublicStock" width="50"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.buyTransit" label="采购在途" align="center" prop="buyTransit" width="80px" />
- <el-table-column show-overflow-tooltip v-if="showColumn.lendTransit" label="借出在途" align="center" prop="lendTransit" width="80px" />
- <el-table-column show-overflow-tooltip v-if="showColumn.transferTransit" label="调拨在途" align="center" prop="transferTransit" width="80px"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.stockTotal" label="库存总计" align="center" prop="stockTotal" width="80px"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.minPackage" label="最小包装量" align="center" prop="minPackage" width="80px"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.minOrder" label="最小订货量" align="center" prop="minOrder" width="80px"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.minBatch" label="最小批量" align="center" prop="minBatch" width="80px"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.modifyReason" label="修改原因" align="center" prop="modifyReason" width="150px">
- <template slot-scope="scope">
- <el-input size="mini" :disabled="scope.row.status !== '1'|| lineDisable || scope.row.artificialAdjust == '0'" v-model="scope.row.modifyReason" @change="jilu(scope.$index)"/>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip v-if="showColumn.suggestionPurchase" label="建议采购量" align="center" prop="suggestionPurchase" width="80px"/>
- <!-- <el-table-column show-overflow-tooltip v-if="showColumn.status" label="建议净采购量" align="center" prop="suggestBuyQty" width="100px"/> -->
- <el-table-column show-overflow-tooltip v-if="showColumn.materialClassifyTwoName" label="二级品类" align="center" prop="materialClassifyTwoName" width="120px"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.materialClassifyThreeName" label="三级品类" align="center" prop="materialClassifyThreeName" width="120px"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.materialClassifyFourName" label="四级品类" align="center" prop="materialClassifyFourName" width="120px"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.buyerName" label="采购员" align="center" prop="buyerName" width="150px">
- <template slot-scope="scope">
- <el-input readonly :disabled="scope.row.status !== '1' || lineDisable" size="mini" v-model="scope.row.buyerName">
- <el-button size="mini" :disabled="scope.row.status !== '1' || lineDisable" slot="append" icon="el-icon-more" @click="chooseSon(scope.$index, 'CONTACTS_PARAM', true, '明细采购员')"></el-button>
- </el-input>
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip v-if="showColumn.purchaseOrgName" label="默认采购组织" align="center" prop="purchaseOrgName" width="150px">
- <!-- <template slot-scope="scope">
- <el-input readonly :disabled="scope.row.status !== '1' || lineDisable" size="mini" v-model="scope.row.purchaseOrgName">
- <el-button size="mini" :disabled="scope.row.status !== '1' || lineDisable" slot="append" icon="el-icon-more" @click="chooseSon(scope.$index, 'ORG_PARAM', true, '明细默认采购组织')"></el-button>
- </el-input>
- </template> -->
- </el-table-column>
- <el-table-column show-overflow-tooltip v-if="showColumn.validityPeriod" label="有效期" align="center" prop="validityPeriod"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.validityPeriodUnit" label="有效期单位" align="center" prop="validityPeriodUnit" width="80px"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.businessType" label="业务类型" align="center" prop="businessType" :formatter="formatterBusinessType"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.safetyStock" label="安全库存量" align="center" prop="safetyStock" width="80px">
- <template slot-scope="scope">
- {{scope.row.safetyStock ? parseFloat(scope.row.safetyStock).toFixed(2) : '0.00'}}
- </template>
- </el-table-column>
- <el-table-column show-overflow-tooltip v-if="showColumn.billSource" label="单据来源" align="center" prop="billSource" :formatter="formatterSource"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.registrant" label="注册人" align="center" prop="registrant" width="120px"/>
- <!-- <el-table-column label="可用量" align="center" prop="qty"/> -->
- <el-table-column show-overflow-tooltip v-if="showColumn.buyDiscrepancy" label="总需与终采差异" align="center" prop="buyDiscrepancy" width="80px"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.forecastClassification" label="集团预测分类" align="center" prop="forecastClassification" width="80px"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.centerBinPossession" label="中心仓占有量" align="center" prop="centerBinPossession" width="80px"/>
- <el-table-column show-overflow-tooltip v-if="showColumn.centralWarehouseAvailable" label="中心仓可用量" align="center" prop="centralWarehouseAvailable" width="80px"/>
- <!-- <el-table-column label="物料类别" align="center" prop="materialCategory" width="150px"/> -->
- <!-- <el-table-column label="业务部门" align="center" prop="departmentName" width="150px"/> -->
- <!-- <el-table-column show-overflow-tooltip v-if="showColumn.status" label="需求单位" align="center" prop="demandUnit"/> -->
- <el-table-column show-overflow-tooltip v-if="showColumn.puManagerAuditor" label="采购经理审核人" align="center" prop="puManagerAuditor" width="120px"/>
- <el-table-column
- fixed="right"
- label="操作"
- align="center"
- width="100"
- >
- <template slot-scope="scope">
- <el-button type="text" size="mini" @click="check(scope.row)">查看</el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-button size="mini" style="position: absolute;left: 20px;bottom: 20px;" @click="tols.open = true">隐藏列</el-button>
- <colTol :isVisible.sync="tols.open" @reDraw="reDraw" :showColumn.sync="showColumn" :arrs.sync="arrs"/>
- <el-pagination
- background
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="queryParams.pageNum"
- :page-sizes="[10, 20, 50, 100, 200, 500]"
- :page-size="50"
- layout="total, sizes, prev, pager, next, jumper"
- :total=total>
- </el-pagination>
- </el-card>
- </div>
- <Add v-model="isList" v-if="!isList" :pageStu="page" :disable="disable" :row="rowDetail" :query="queryParams" @refresh="search"/>
-
- <Refers ref="refer" @doSubmit="selectionsToInput" :single="true"/>
- <TreeRefers ref="tree" @doSubmit="selectionsToInput2" :single="true"/>
- <popDialog ref="materialRefer" @doSubmit="selectMaterial" :single="false" />
- </div>
- </template>
- <script>
- import Add from './add'
- import colTol from './colTol.vue'
- import Refers from '@/components/Refers/refers.vue'
- import TreeRefers from '@/components/Refers/treeRefer.vue'
- import popDialog from '@/components/PopDialog/index.vue'
- import CollapseTransition from '@/components/MyCollapse/collapse.vue'
- // 用于物料参照框数据
- import {getRefer} from '@/api/purchase/basic.js'
- import {getSummaryList, auditSummary, cancelAudits, confirmSummary , cancelSummary , shutDownSummary, editSummaryList, exportList, exportItems } from '@/api/purchase/DemandSummary.js'
- export default {
- name: 'demandSummary',
- dicts: ['sys_row_status', 'predictive_classify', 'sys_period_unit', 'sys_business', 'sys_bill_source'],
- components: {
- Add,
- colTol,
- CollapseTransition,
- Refers,
- TreeRefers,
- popDialog
- },
- data() {
- return {
- loading: true,
- showColumn: {},
- arrs:[],
- tols: {
- open: false
- },
- hangStatus(row) {
- switch (row.status) {
- case '0':
- return '需补货'
- case '1':
- return '待计划确认'
- case '2':
- return '计划已确认'
- case '3':
- return '计划已审核'
- case '4':
- return '行关闭'
- case '5':
- return '总供应可满足'
- }
- },
- formatterBusinessType(row) {
- switch (row.businessType) {
- case 'ZQBH':
- return '周期备货'
- case 'FXXQ':
- return '分销需求'
- case 'TSXQ':
- return '特殊采购需求'
- case 'BDXQ':
- return '补单需求'
- case 'JJXQ':
- return '紧急需求单'
- case 'XPXQ':
- return '新品需求'
- case 'HZBM':
- return '合作部门需求'
- }
- },
- formatterSource(row) {
- switch (row.billSource) {
- case '1':
- return '手工导入'
- case '2':
- return '按客户计算'
- case '3':
- return '按仓库计算'
- case '4':
- return '手工新增'
- }
- },
- expanded: false,
- // 页面配置
- isList: true,
- // 页面状态
- page: '',
- queryParams: {
- rowStatus: ['1'],
- buyer: '',
- buyerName: '',
- materialClassifyFour: [],
- manufacturer: '',
- forecastClassification: '',
- periodUnit: '',
- departmentName: '',
- puManagerAuditor: '',
- // zqgdh: '',
- code: '',
- registrant: '',
- businessType: '',
- billSource: '',
- customer: '',
- lastWarehouse: '',
- lastAllocation: '',
- materialCodeList: [],
- names: '',
- purchaseOrg: '',
- demandDate: '',
- approverFinishTime: '',
- isCustomerSpecified: '',
- isUrgency: '',
- pageNum: 1,
- pageSize: 50
- },
- personOptions: [],
- classOptions: [],
- deptOptions: [],
- auditOptions: [],
- customerOptions: [],
- lastWarehouseOptions: [],
- lastAllocationOptions: [],
- orgOptions: [],
- options: [{
- value: 'Y', label: '是',
- }, {
- value: 'N', label: '否'
- }],
- referCondition: {
- type: '',
- isPage: true,
- title: ''
- },
- tableList: [],
- total: 0,
- rowDetail: {},
- disable: false,
- lineDisable: true,
- ids: [],
- allSelection: [],
- // 子表index
- tableIndex: null,
- // referConditionMx: {
- // type: '',
- // isPage: true,
- // title: ''
- // }
- // 用于保存临时记录修改行的数组
- record:[]
- }
- },
- created() {
- this.getList(this.queryParams)
- },
- methods: {
- reDraw() {
- this.$refs.table.doLayout();
- },
- // 单元格标红
- cellClassName({row, column, rowIndex, columnIndex}) {
- if(column.label == "需求可用周期" && Number(row.demandCycle) > 1.5 ) {
- return 'success-row';
- }
- },
- // 指定列合计
- getSummaries(param) {
- const { columns, data } = param;
- const sums = [];
- columns.forEach((column, index) => {
- if (index === 0) {
- sums[index] = '合计';
- return;
- }
- const values = data.map(item => Number(item[column.property]));
- if (column.property === 'demandNum' || column.property === 'netDemandNum' || column.property === 'artificialAdjust' || column.property === 'suggestBuyQty' || column.property === 'finalBuyQty') {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[index];
- }
- });
- return sums
- },
- // 搜索
- search() {
- this.getList(this.queryParams)
- },
- reset() {
- this.queryParams = {
- rowStatus: ['1'],
- buyer: '',
- buyerName: '',
- materialClassifyFour: [],
- manufacturer: '',
- forecastClassification: '',
- periodUnit: '',
- departmentName: '',
- puManagerAuditor: '',
- // zqgdh: '',
- code: '',
- registrant: '',
- businessType: '',
- billSource: '',
- customer: '',
- lastWarehouse: '',
- lastAllocation: '',
- materialCodeList: [],
- names: '',
- purchaseOrg: '',
- demandDate: '',
- approverFinishTime: '',
- isCustomerSpecified: '',
- isUrgency: '',
- pageNum: 1,
- pageSize: 50
- }
- this.getList(this.queryParams)
- },
- getList(params){
- getSummaryList(params).then(res => {
- if (res.code === 200) {
- this.tableList = res.rows
- this.total = res.total
- let arrs = []
- this.$refs.table.$children.forEach(item => {
- if (item.label != undefined && item.prop != undefined) {
- arrs.push({
- label: item.label,
- prop: item.prop
- })
- }
- })
- this.arrs = arrs
- console.log('获取表头数据', arrs)
- }
- }).then(() => {
- // 合计不显示重绘
- this.$refs.table.doLayout()
- this.loading = false
- }).catch(err => {
- this.loading = false
- })
- },
- handleSelectionChange(selection) {
- console.log('选中', selection)
- this.allSelection = selection
- this.ids = selection.map(item => item.demandItemId)
- console.log('选中数组', this.ids.join())
- },
- handleCommand() {
- this.$modal.loading("正在导出数据,请稍后...");
- let param = this.queryParams
- param.pageSize = this.total
- exportItems(param).then(res => {
- this.$modal.closeLoading();
- const blob = new Blob([res], {
- type: "application/vnd.ms-excel;charset=UTF-8",
- });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
- const downloadElement = document.createElement("a"); //创建a标签
- const href = window.URL.createObjectURL(blob); // 创建下载的链接
- // var temp = res.headers["content-disposition"];
- // var fileName = decodeURIComponent(temp.split("filename=")[1]); // 中文需要转码 (前端乱码)
- // var name = fileName.split(";")[0]; //切割成文件名
- downloadElement.href = href; //下载地址
- downloadElement.download = '采购需求处理导出'+ this.parseTime(new Date().getTime()) + ".xlsx"; // 下载后文件名
- document.body.appendChild(downloadElement);
- downloadElement.click(); // 点击下载
- document.body.removeChild(downloadElement); // 下载完成移除元素
- window.URL.revokeObjectURL(href); // 释放blob对象
- })
- },
- check(row) {
- this.isList = false
- this.page = 'check'
- this.rowDetail = row
- this.disable = true
- },
- doubleClick(row) {
- this.isList = false
- this.page = 'check'
- this.rowDetail = row
- this.disable = true
- },
- // 表格选中数据
- rowSelect(row) {
- this.$refs.table.toggleRowSelection(row);
- },
- handleSizeChange(val) {
- console.log(`每页 ${val} 条`);
- this.queryParams.pageSize = val
- this.getList(this.queryParams)
- },
- handleCurrentChange(val) {
- console.log(`当前页: ${val}`);
- this.queryParams.pageNum = val
- this.getList(this.queryParams)
- },
- drop() {
- this.expanded = !this.expanded
- },
- editList() {
- console.log('Lists`````',this.tableList)
- this.lineDisable = false
- },
- cancelEdit() {
- this.lineDisable = true
- this.getList(this.queryParams)
- },
- saveList() {
- // console.log('记录',this.record)
- // 对记录的数据进行去重
- let newRecord = Array.from(new Set(this.record))
- // console.log('去重后的', newRecord)
- let changeList = newRecord.map(i => {
- return this.tableList[i]
- })
- // console.log('shuzu', changeList)
- editSummaryList(changeList).then(res => {
- if (res.code === 200) {
- this.$modal.notifySuccess("保存成功");
- this.lineDisable = true
- this.getList(this.queryParams)
- }
- })
- },
- confirms() {
- if (this.ids.length == 0) {
- this.$modal.notifyWarning("请选中至少一条数据");
- } else {
- confirmSummary(this.allSelection).then(res => {
- if (res.code === 200) {
- this.$modal.notifySuccess("确认成功");
- this.getList(this.queryParams)
- }
- })
- }
- },
- cancels() {
- if (this.ids.length == 0) {
- this.$modal.notifyWarning("请选中至少一条数据");
- } else {
- let param = this.ids.join()
- cancelSummary(param).then(res => {
- if (res.code === 200) {
- this.$modal.notifySuccess("取消成功");
- this.getList(this.queryParams)
- }
- })
- }
- },
- cancelAudit() {
- if(this.ids.length == 0) {
- this.$modal.notifyWarning("请选中至少一条数据");
- } else {
- let param = this.ids.join()
- cancelAudits(param).then(res => {
- if (res.code === 200) {
- this.$modal.notifySuccess("审核成功");
- this.getList(this.queryParams)
- }
- })
- }
- },
- audits() {
- if(this.ids.length == 0) {
- this.$modal.notifyWarning("请选中至少一条数据");
- } else {
- let param = this.ids.join()
- auditSummary(param).then(res => {
- if (res.code === 200) {
- this.$modal.notifySuccess("审核成功");
- this.getList(this.queryParams)
- }
- }).catch(err => {
- this.getList(this.queryParams)
- })
- }
- },
- // 行关闭
- closeitem() {
- let param = this.ids.join()
- shutDownSummary(param).then(res => {
- if (res.code === 200) {
- this.$modal.notifySuccess("操作成功");
- this.getList(this.queryParams)
- }
- })
- },
- closeLine() {
- if (this.ids.length == 0) {
- this.$modal.notifyWarning("请选中至少一条数据");
- } else {
- console.log('选中数组', this.allSelection)
- let item = this.allSelection.some(item => {
- return item.demandNum >= 2
- })
- if (item) {
- this.$modal.confirm('选中项有多个需求单位,是否确定关闭?').then(function () {
- }).then(() => {
- this.closeitem()
- }).catch(() => {})
- } else {
- this.closeitem()
- }
- }
- },
- // 搜索区参照选择
- chooseRefer(type, isPage, title, stordocId) {
- this.referCondition.type = type
- this.referCondition.isPage = isPage
- this.referCondition.title = title
- this.referCondition.stordocId = stordocId
- this.$refs.refer.init(this.referCondition)
- },
- selectionsToInput(selection) {
- if (this.referCondition.title == '采购员') {
- this.personOptions = selection
- this.queryParams.buyer = selection[0].code
- this.queryParams.buyerName = selection[0].name
- }
- if (this.referCondition.title == '业务部门') {
- this.deptOptions = selection
- this.queryParams.departmentName = selection[0].id
- }
- if (this.referCondition.title == '审核人') {
- this.auditOptions = selection
- this.queryParams.puManagerAuditor = selection[0].code
- }
- if (this.referCondition.title == '需求客户') {
- this.customerOptions = selection
- this.queryParams.customer = selection[0].id
- }
- if (this.referCondition.title == '供应仓库') {
- this.lastWarehouseOptions = selection
- this.queryParams.lastWarehouse = selection[0].id
- }
- if (this.referCondition.title == '供应库位') {
- this.lastAllocationOptions = selection
- this.queryParams.lastAllocation = selection[0].id
- }
- if (this.referCondition.title == '默认采购组织') {
- this.orgOptions = selection
- this.queryParams.purchaseOrg = selection[0].id
- }
- if (this.referCondition.title == '明细采购员') {
- console.log('选择进了吗',this.tableList)
- this.record.push(this.tableIndex)
- this.tableList[this.tableIndex].buyer = selection[0].code
- this.tableList[this.tableIndex].buyerName = selection[0].name
- }
- // if (this.referCondition.title == '明细默认采购组织') {
- // console.log('选择进了吗',this.tableList)
- // this.tableList[this.tableIndex].purchaseOrg = selection[0].id
- // this.tableList[this.tableIndex].purchaseOrgName = selection[0].name
- // }
- },
- // 搜索区树形选择
- chooseTreeRefer(type, isPage, title) {
- this.referCondition.type = type
- this.referCondition.isPage = isPage
- this.referCondition.title = title
- this.$refs.tree.init(this.referCondition)
- },
- selectionsToInput2(selection) {
- this.classOptions = selection
- this.queryParams.materialClassifyFour = selection.map(item => {return item.id})
- },
- // 搜索区物料编码
- chooseMaterial() {
- this.$refs.materialRefer.init()
- },
- selectMaterial(selection) {
- console.log('选择的物料', selection)
- this.queryParams.materialCodeList = selection.map(item => {return item.code})
- console.log(this.queryParams.materialCodeList)
- this.queryParams.names = (selection.map(item => {return item.name})).join(',')
- },
- // 清空物料搜索框
- clearMaterial() {
- this.queryParams.names = ''
- this.queryParams.materialCodeList = []
- },
- // 粘贴来的数据
- async pasteMe(e) {
- this.$modal.loading("正在粘贴数据...");
- e.preventDefault() //阻止默认粘贴事件
- let source = e.clipboardData.getData("Text");
- console.log('source', source)
- // 这里区分普通复制和在表格内复制,判断是否包含','
- // 没找到,就通过表格复制
- if (source.indexOf(",") === -1) {
- // 首先对源头进行解析
- let rows = source.split("\r\n"); // 拆成一个数组
- // 数组去除空字符串
- rows = rows.filter(item => {
- return item && item.trim()
- })
- await getRefer({ type: 'MATERIAL_PARAM', materialCodeList: rows }).then(res => {
- this.$modal.closeLoading();
- if (res.code === 200) {
- let rowList = res.rows
- console.log('粘贴的', rowList)
- this.queryParams.materialCodeList = rowList.map(item => {return item.code})
- this.queryParams.names = (rowList.map(item => {return item.code})).join(',')
- }
- }).catch(err => {
- this.$modal.closeLoading();
- })
- } else {
- // 找到了,按,分割
- let codelist = source.split(',')
- console.log('按照逗号分隔', codelist)
- // 数组去除空字符串
- codelist = codelist.filter(item => {
- return item && item.trim()
- })
- this.queryParams.materialCodeList = codelist
- this.queryParams.names = codelist.join(',')
- this.$modal.closeLoading();
- }
- },
- // 明细行选择业务部门参照带出业务部门数据
- chooseSon(index, type, isPage, title) {
- this.tableIndex = index
- this.referCondition.type = type
- this.referCondition.isPage = isPage
- this.referCondition.title = title
- this.$refs.refer.init(this.referCondition)
- },
- jilu(index) {
- this.record.push(index)
- },
- // 清空搜索区采购员
- cleanBuyer() {
- this.queryParams.buyer = ''
- this.queryParams.buyerName = ''
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- #demandSummary {
- padding: 12px;
- box-sizing: border-box;
- overflow-y: scroll;
- }
- .btn_grooup {
- margin-bottom: 10px;
- display: flex;
- justify-content: flex-end;
- }
- .lines {
- margin-top: 0;
- }
- .hang {
- margin: auto;
- }
- .hang ::v-deep .el-form-item__content{
- margin-left: 0px !important;
- }
- .el-pagination {
- margin-top: 10px;
- text-align: right;
- }
- ::v-deep .el-table__row > td {
- border-right: none;
- }
- ::v-deep .el-card .el-form-item {
- margin-bottom: 3px;
- }
- ::v-deep .el-table__row .success-row {
- background-color: #ff8a8a!important;
- }
- </style>
- <style>
- .exporttable {
- border: solid 1px #c0c0c0;
- }
- </style>
|