index.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759
  1. <template>
  2. <div id="demandSummary">
  3. <div v-if="isList">
  4. <el-form class="search_area" label-width="100px">
  5. <el-row :gutter="10">
  6. <el-col :span="1.5">
  7. <el-form-item label="行状态">
  8. <el-select multiple v-model="queryParams.rowStatus" size="small" style="width: 200px" clearable>
  9. <el-option v-for="dict in dict.type.sys_row_status" :key="dict.value" :label="dict.label" :value="dict.value">
  10. </el-option>
  11. </el-select>
  12. </el-form-item>
  13. </el-col>
  14. <el-col :span="1.5">
  15. <el-form-item label="采购员">
  16. <el-select clearable size="small" v-model="queryParams.buyer" @focus="chooseRefer('CONTACTS_PARAM', true, '采购员')" style="width: 200px">
  17. <el-option v-for="item in personOptions" :key="item.id" :label="item.name" :value="item.code" />
  18. </el-select>
  19. </el-form-item>
  20. </el-col>
  21. <el-col :span="1.5">
  22. <el-form-item label="品类">
  23. <el-select
  24. v-model="queryParams.materialClassifyFourName"
  25. size="small"
  26. clearable
  27. @focus="chooseTreeRefer('MATERIALCLASSIFY_PARAM', false, '选择品类')"
  28. style="width: 200px"
  29. >
  30. <el-option v-for="item in classOptions" :key="item.id" :label="item.name" :value="item.name" />
  31. </el-select>
  32. </el-form-item>
  33. </el-col>
  34. <el-col :span="1.5">
  35. <el-form-item label="" label-width="20px">
  36. <el-button type="primary" size="small" icon="el-icon-search" plain @click="search">搜索</el-button>
  37. <el-button size="small" icon="el-icon-refresh" plain @click="reset">重置</el-button>
  38. </el-form-item>
  39. </el-col>
  40. </el-row>
  41. <CollapseTransition>
  42. <div v-show="expanded">
  43. <el-row :gutter="10">
  44. <el-col :span="1.5">
  45. <el-form-item label="生产厂家">
  46. <el-input
  47. v-model="queryParams.manufacturer"
  48. size="small"
  49. clearable
  50. style="width: 200px"
  51. />
  52. </el-form-item>
  53. </el-col>
  54. <el-col :span="1.5">
  55. <el-form-item label="预测分类">
  56. <el-select v-model="queryParams.forecastClassification" size="small" style="width: 200px" clearable>
  57. <el-option
  58. v-for="dict in dict.type.predictive_classify" :key="dict.value" :label="dict.label" :value="dict.label">
  59. </el-option>
  60. </el-select>
  61. </el-form-item>
  62. </el-col>
  63. <el-col :span="1.5">
  64. <el-form-item label="审核人">
  65. <el-select clearable size="small" v-model="queryParams.puManagerAuditor" @focus="chooseRefer('CONTACTS_PARAM', true, '审核人')" style="width: 200px">
  66. <el-option v-for="item in auditOptions" :key="item.id" :label="item.name" :value="item.code" />
  67. </el-select>
  68. </el-form-item>
  69. </el-col>
  70. <!-- <el-col :span="1.5">
  71. <el-form-item label="周期单位">
  72. <el-select v-model="queryParams.periodUnit" size="small" style="width: 200px" clearable>
  73. <el-option
  74. v-for="dict in dict.type.sys_period_unit" :key="dict.value" :label="dict.label" :value="dict.value">
  75. </el-option>
  76. </el-select>
  77. </el-form-item>
  78. </el-col> -->
  79. </el-row>
  80. <el-row :gutter="10">
  81. <!-- <el-col :span="1.5">
  82. <el-form-item label="转请购单号">
  83. <el-input
  84. v-model="queryParams.zqgdh"
  85. size="small"
  86. placeholder=""
  87. clearable
  88. style="width: 200px"
  89. />
  90. </el-form-item>
  91. </el-col> -->
  92. <!-- <el-col :span="1.5">
  93. <el-form-item label="业务部门">
  94. <el-select clearable size="small" v-model="queryParams.departmentName" @focus="chooseRefer('DEPT_PARAM', true, '业务部门')" style="width: 200px">
  95. <el-option v-for="item in deptOptions" :key="item.id" :label="item.name" :value="item.id" />
  96. </el-select>
  97. </el-form-item>
  98. </el-col> -->
  99. </el-row>
  100. <el-row :gutter="10">
  101. <el-col :span="1.5">
  102. <el-form-item label="注册人">
  103. <el-input
  104. v-model="queryParams.registrant"
  105. size="small"
  106. clearable
  107. style="width: 200px"
  108. />
  109. </el-form-item>
  110. </el-col>
  111. <el-col :span="1.5">
  112. <el-form-item label="业务类型">
  113. <el-select v-model="queryParams.businessType" size="small" style="width: 200px" clearable>
  114. <el-option
  115. v-for="dict in dict.type.sys_business" :key="dict.value" :label="dict.label" :value="dict.value">
  116. </el-option>
  117. </el-select>
  118. </el-form-item>
  119. </el-col>
  120. <el-col :span="1.5">
  121. <el-form-item label="单据来源">
  122. <el-select v-model="queryParams.billSource" size="small" style="width: 200px" clearable>
  123. <el-option
  124. v-for="dict in dict.type.sys_bill_source" :key="dict.value" :label="dict.label" :value="dict.value">
  125. </el-option>
  126. </el-select>
  127. </el-form-item>
  128. </el-col>
  129. </el-row>
  130. <el-row :gutter="10">
  131. <el-col :span="1.5">
  132. <el-form-item label="需求客户">
  133. <el-select clearable size="small" v-model="queryParams.customer" @focus="chooseRefer('CUSTOMER_PARAM', true, '需求客户')" style="width: 200px">
  134. <el-option v-for="item in customerOptions" :key="item.id" :label="item.name" :value="item.id" />
  135. </el-select>
  136. </el-form-item>
  137. </el-col>
  138. <el-col :span="1.5">
  139. <el-form-item label="末级供应仓库">
  140. <el-select clearable size="small" v-model="queryParams.lastWarehouse" @focus="chooseRefer('WAREHOUSE_PARAM', true, '末级供应仓库')" style="width: 200px">
  141. <el-option v-for="item in lastWarehouseOptions" :key="item.id" :label="item.name" :value="item.id" />
  142. </el-select>
  143. </el-form-item>
  144. </el-col>
  145. <el-col :span="1.5">
  146. <el-form-item label="末级供应库位">
  147. <el-select clearable size="small" v-model="queryParams.lastAllocation" @focus="chooseRefer('ALLOCATION_PARAM', true, '末级供应库位')" style="width: 200px">
  148. <el-option v-for="item in lastAllocationOptions" :key="item.id" :label="item.name" :value="item.id" />
  149. </el-select>
  150. </el-form-item>
  151. </el-col>
  152. <!-- <el-col :span="1.5">
  153. <el-form-item label="转请购时间">
  154. <el-select v-model="queryParams.ywlx" size="small" style="width: 200px" clearable>
  155. <el-option
  156. v-for="item in options"
  157. :key="item.value"
  158. :label="item.label"
  159. :value="item.value">
  160. </el-option>
  161. </el-select>
  162. </el-form-item>
  163. </el-col> -->
  164. </el-row>
  165. <el-row :gutter="10">
  166. <el-col :span="1.5">
  167. <el-form-item label="物料编码">
  168. <el-input clearable size="small" v-model="queryParams.names" @focus="chooseMaterial" style="width: 200px">
  169. <el-button size="small" slot="append" icon="el-icon-more" @click="chooseMaterial"></el-button>
  170. </el-input>
  171. <el-input v-show="false" v-model="queryParams.materialCode"></el-input>
  172. </el-form-item>
  173. </el-col>
  174. <el-col :span="1.5">
  175. <el-form-item label="默认采购组织">
  176. <el-select clearable size="small" v-model="queryParams.purchaseOrg" @focus="chooseRefer('ORG_PARAM', true, '默认采购组织')" style="width: 200px">
  177. <el-option v-for="item in orgOptions" :key="item.id" :label="item.name" :value="item.id" />
  178. </el-select>
  179. </el-form-item>
  180. </el-col>
  181. <el-col :span="1.5">
  182. <el-form-item label="需求日期">
  183. <el-date-picker
  184. v-model="queryParams.demandDate"
  185. type="date"
  186. value-format="yyyy-MM-dd"
  187. size="small"
  188. style="width: 200px"
  189. >
  190. </el-date-picker>
  191. </el-form-item>
  192. </el-col>
  193. </el-row>
  194. <el-row :gutter="10">
  195. <el-col :span="1.5">
  196. <el-form-item label="采购需求单号">
  197. <el-input
  198. v-model.trim="queryParams.code"
  199. size="small"
  200. clearable
  201. style="width: 200px"
  202. />
  203. </el-form-item>
  204. </el-col>
  205. <el-col :span="1.5">
  206. <el-form-item label="审批结束日期">
  207. <el-date-picker
  208. v-model="queryParams.approverFinishTime"
  209. type="date"
  210. clearable
  211. value-format="yyyy-MM-dd"
  212. size="small"
  213. style="width: 200px"
  214. >
  215. </el-date-picker>
  216. </el-form-item>
  217. </el-col>
  218. </el-row>
  219. </div>
  220. </CollapseTransition>
  221. </el-form>
  222. <el-divider class="lines"><i style="cursor: pointer;" :class="expanded?'el-icon-arrow-up':'el-icon-arrow-down'" @click="drop"></i></el-divider>
  223. <el-card>
  224. <div class="btn_grooup">
  225. <el-button type="primary" size="small" @click="editList">编辑</el-button>
  226. <el-button type="success" size="small" v-if="!lineDisable" @click="saveList">保存</el-button>
  227. <el-button type="primary" size="small" @click="confirms">确认</el-button>
  228. <el-button type="primary" size="small" @click="cancels">取消</el-button>
  229. <el-button type="primary" size="small" @click="audits">审核</el-button>
  230. <!-- <el-button type="primary" size="small" @click="cancelAudits">弃审</el-button> -->
  231. <el-dropdown size="small" @command="handleCommand">
  232. <el-button size="small" type="primary" style="margin: 0 10px;">
  233. 导出<i class="el-icon-arrow-down el-icon--right"></i>
  234. </el-button>
  235. <el-dropdown-menu slot="dropdown">
  236. <el-dropdown-item command="Excel导出">Excel导出</el-dropdown-item>
  237. <el-dropdown-item command="导出明细">导出明细</el-dropdown-item>
  238. </el-dropdown-menu>
  239. </el-dropdown>
  240. <!-- <el-button type="primary" size="small">转请购</el-button> -->
  241. </div>
  242. <el-table
  243. :data="tableList"
  244. fit
  245. show-summary
  246. :summary-method="getSummaries"
  247. max-height="480"
  248. @selection-change="handleSelectionChange"
  249. :key="isUpdate"
  250. >
  251. <el-table-column type="selection" width="60" />
  252. <!-- <el-table-column show-overflow-tooltip label="行号" align="center" prop="rowNo"/> -->
  253. <el-table-column show-overflow-tooltip label="行状态" align="center" prop="status" width="120px" :formatter="hangStatus"/>
  254. <el-table-column show-overflow-tooltip label="一级品类" align="center" prop="materialClassifyOneName" width="120px"/>
  255. <el-table-column show-overflow-tooltip label="物料编码" align="center" prop="materialCode" width="180px"/>
  256. <el-table-column show-overflow-tooltip label="品名" align="center" prop="materialName" width="180px"/>
  257. <el-table-column show-overflow-tooltip label="规格" align="center" prop="specification" width="200px"/>
  258. <el-table-column show-overflow-tooltip label="单位" align="center" prop="unit"/>
  259. <el-table-column show-overflow-tooltip label="生产厂家/代理人" align="center" prop="manufacturer" width="180px"/>
  260. <el-table-column show-overflow-tooltip label="需求单位数" align="center" prop="demandNum" width="120px"/>
  261. <el-table-column show-overflow-tooltip label="近1月月均需求" align="center" prop="evensalesforyear" width="120px"/>
  262. <el-table-column show-overflow-tooltip label="近3月月均需求" align="center" prop="evensalesforthrmonth" width="120px"/>
  263. <el-table-column show-overflow-tooltip label="总最终净需求量" align="center" prop="netDemandNum" width="120px"/>
  264. <el-table-column show-overflow-tooltip label="总月销量" align="center" prop="totalMonthlySales"/>
  265. <el-table-column show-overflow-tooltip label="需求可用周期" align="center" prop="demandCycle" width="180px"/>
  266. <el-table-column show-overflow-tooltip label="呆滞量" align="center" prop="dullQut"/>
  267. <el-table-column show-overflow-tooltip label="采购周期" align="center" prop="buyPeriod"/>
  268. <el-table-column show-overflow-tooltip label="中心公共库存" align="center" prop="centralPublicStock" width="120px"/>
  269. <el-table-column show-overflow-tooltip label="中心仓专属货位" align="center" prop="centralWarehouse" width="120px"/>
  270. <el-table-column show-overflow-tooltip label="区域分仓公共库存" align="center" prop="regionPublicStock" width="130px"/>
  271. <el-table-column show-overflow-tooltip label="各项目仓库存" align="center" prop="eachWarehouseStock" width="120px"/>
  272. <el-table-column show-overflow-tooltip label="电商仓库" align="center" prop="commerceWarehouse"/>
  273. <el-table-column show-overflow-tooltip label="采购在途" align="center" prop="buyTransit"/>
  274. <el-table-column show-overflow-tooltip label="借出在途" align="center" prop="lendTransit"/>
  275. <el-table-column show-overflow-tooltip label="调拨在途" align="center" prop="transferTransit"/>
  276. <el-table-column show-overflow-tooltip label="库存总计" align="center" prop="stockTotal"/>
  277. <el-table-column show-overflow-tooltip label="最小包装量" align="center" prop="minPackage" width="100px"/>
  278. <el-table-column show-overflow-tooltip label="最小订货量" align="center" prop="minOrder" width="100px"/>
  279. <el-table-column show-overflow-tooltip label="最小批量" align="center" prop="minBatch"/>
  280. <el-table-column show-overflow-tooltip label="人工调整数" align="center" prop="artificialAdjust" width="100px"/>
  281. <el-table-column show-overflow-tooltip label="修改原因" align="center" prop="modifyReason" width="150px">
  282. <template slot-scope="scope">
  283. <el-input :disabled="lineDisable" v-model="scope.row.modifyReason"/>
  284. </template>
  285. </el-table-column>
  286. <el-table-column show-overflow-tooltip label="建议采购量" align="center" prop="suggestionPurchase" width="100px"/>
  287. <el-table-column show-overflow-tooltip label="建议净采购量" align="center" prop="suggestBuyQty" width="100px"/>
  288. <el-table-column show-overflow-tooltip label="最终采购量" align="center" prop="finalBuyQty" width="150">
  289. <template slot-scope="scope">
  290. <el-input :disabled="lineDisable" v-model="scope.row.finalBuyQty"/>
  291. </template>
  292. </el-table-column>
  293. <el-table-column show-overflow-tooltip label="二级品类" align="center" prop="materialClassifyTwoName" width="150px"/>
  294. <el-table-column show-overflow-tooltip label="三级品类" align="center" prop="materialClassifyThreeName" width="150px"/>
  295. <el-table-column show-overflow-tooltip label="四级品类" align="center" prop="materialClassifyFourName" width="150px"/>
  296. <el-table-column show-overflow-tooltip label="采购员" align="center" prop="buyerName" width="150px">
  297. <template slot-scope="scope">
  298. <el-input :disabled="lineDisable" size="small" v-model="scope.row.buyerName">
  299. <el-button size="small" :disabled="lineDisable" slot="append" icon="el-icon-more" @click="chooseSon(scope.$index, 'CONTACTS_PARAM', true, '采购员')"></el-button>
  300. </el-input>
  301. </template>
  302. </el-table-column>
  303. <el-table-column show-overflow-tooltip label="默认采购组织" align="center" prop="purchaseOrgName" width="280px">
  304. <template slot-scope="scope">
  305. <el-input :disabled="lineDisable" size="small" v-model="scope.row.purchaseOrgName">
  306. <el-button size="small" :disabled="lineDisable" slot="append" icon="el-icon-more" @click="chooseSon(scope.$index, 'ORG_PARAM', true, '默认采购组织')"></el-button>
  307. </el-input>
  308. </template>
  309. </el-table-column>
  310. <el-table-column show-overflow-tooltip label="有效期" align="center" prop="validityPeriod"/>
  311. <el-table-column show-overflow-tooltip label="有效期单位" align="center" prop="validityPeriodUnit" width="100px"/>
  312. <el-table-column show-overflow-tooltip label="业务类型" align="center" prop="businessType" :formatter="formatterBusinessType"/>
  313. <el-table-column show-overflow-tooltip label="安全库存量" align="center" prop="safetyStock" width="100px"/>
  314. <el-table-column show-overflow-tooltip label="单据来源" align="center" prop="billSource" :formatter="formatterSource"/>
  315. <el-table-column show-overflow-tooltip label="注册人" align="center" prop="registrant"/>
  316. <!-- <el-table-column label="可用量" align="center" prop="qty"/> -->
  317. <el-table-column show-overflow-tooltip label="总需与终采差异" align="center" prop="buyDiscrepancy" width="120px"/>
  318. <el-table-column show-overflow-tooltip label="集团预测分类" align="center" prop="forecastClassification" width="100px"/>
  319. <el-table-column show-overflow-tooltip label="中心仓占有量" align="center" prop="centerBinPossession" width="100px"/>
  320. <el-table-column show-overflow-tooltip label="中心仓可用量" align="center" prop="centralWarehouseAvailable" width="100px"/>
  321. <!-- <el-table-column label="物料类别" align="center" prop="materialCategory" width="150px"/> -->
  322. <!-- <el-table-column label="业务部门" align="center" prop="departmentName" width="150px"/> -->
  323. <el-table-column show-overflow-tooltip label="需求单位" align="center" prop="demandUnit"/>
  324. <el-table-column show-overflow-tooltip label="采购经理审核人" align="center" prop="puManagerAuditor" width="120px"/>
  325. <el-table-column
  326. fixed="right"
  327. label="操作"
  328. align="center"
  329. width="100"
  330. >
  331. <template slot-scope="scope">
  332. <el-button type="text" size="small" @click="check(scope.row)">查看</el-button>
  333. </template>
  334. </el-table-column>
  335. </el-table>
  336. <el-pagination
  337. @size-change="handleSizeChange"
  338. @current-change="handleCurrentChange"
  339. :current-page="1"
  340. :page-sizes="[5, 10, 15, 20]"
  341. :page-size="100"
  342. layout="total, sizes, prev, pager, next, jumper"
  343. :total=total>
  344. </el-pagination>
  345. </el-card>
  346. </div>
  347. <Add v-model="isList" v-if="!isList" :pageStu="page" :disable="disable" :row="rowDetail" @refresh="reset"/>
  348. <Refers ref="refer" @doSubmit="selectionsToInput" :single="true"/>
  349. <TreeRefers ref="tree" @doSubmit="selectionsToInput2" :single="true"/>
  350. <popDialog ref="materialRefer" @doSubmit="selectMaterial" :single="true" />
  351. </div>
  352. </template>
  353. <script>
  354. import Add from './add.vue'
  355. import Refers from '@/components/Refers/refers.vue'
  356. import TreeRefers from '@/components/Refers/treeRefer.vue'
  357. import popDialog from '@/components/PopDialog/index.vue'
  358. import CollapseTransition from '@/components/MyCollapse/collapse.vue'
  359. import {getSummaryList, auditSummary, confirmSummary , cancelSummary , cancelAuditSummary, editSummaryList } from '@/api/purchase/DemandSummary.js'
  360. export default {
  361. name: 'demandSummary',
  362. dicts: ['sys_row_status', 'predictive_classify', 'sys_period_unit', 'sys_business', 'sys_bill_source'],
  363. components: {
  364. Add,
  365. CollapseTransition,
  366. Refers,
  367. TreeRefers,
  368. popDialog
  369. },
  370. data() {
  371. return {
  372. hangStatus(row) {
  373. switch (row.status) {
  374. case '0':
  375. return '需补货'
  376. case '1':
  377. return '待计划确认'
  378. case '2':
  379. return '计划已确认'
  380. case '3':
  381. return '计划已审核'
  382. case '4':
  383. return '行关闭'
  384. case '5':
  385. return '总供应可满足'
  386. }
  387. },
  388. formatterBusinessType(row) {
  389. switch (row.businessType) {
  390. case 'ZQBH':
  391. return '周期备货'
  392. case 'FXXQ':
  393. return '分销需求'
  394. case 'TSXQ':
  395. return '特殊采购需求'
  396. case 'BDXQ':
  397. return '补单需求'
  398. case 'JJXQ':
  399. return '紧急需求单'
  400. case 'XPXQ':
  401. return '新品需求'
  402. case 'HZBM':
  403. return '合作部门需求'
  404. }
  405. },
  406. formatterSource(row) {
  407. switch (row.billSource) {
  408. case '1':
  409. return '手工导入'
  410. case '2':
  411. return '按客户计算'
  412. case '3':
  413. return '按仓库计算'
  414. case '4':
  415. return '手工新增'
  416. }
  417. },
  418. isUpdate: false,
  419. expanded: false,
  420. // 页面配置
  421. isList: true,
  422. // 页面状态
  423. page: '',
  424. queryParams: {
  425. rowStatus: [],
  426. buyer: '',
  427. buyerName: '',
  428. materialClassifyFourName: '',
  429. manufacturer: '',
  430. forecastClassification: '',
  431. periodUnit: '',
  432. departmentName: '',
  433. puManagerAuditor: '',
  434. // zqgdh: '',
  435. code: '',
  436. registrant: '',
  437. businessType: '',
  438. billSource: '',
  439. customer: '',
  440. lastWarehouse: '',
  441. lastAllocation: '',
  442. materialCode: '',
  443. names: '',
  444. purchaseOrg: '',
  445. demandDate: '',
  446. approverFinishTime: '',
  447. pageNum: 1,
  448. pageSize: 5
  449. },
  450. personOptions: [],
  451. classOptions: [],
  452. deptOptions: [],
  453. auditOptions: [],
  454. customerOptions: [],
  455. lastWarehouseOptions: [],
  456. lastAllocationOptions: [],
  457. orgOptions: [],
  458. options: [{
  459. value: 'Y', label: '是',
  460. }, {
  461. value: 'N', label: '否'
  462. }],
  463. referCondition: {
  464. type: '',
  465. isPage: true,
  466. title: ''
  467. },
  468. tableList: [],
  469. total: 0,
  470. rowDetail: {},
  471. disable: false,
  472. lineDisable: true,
  473. ids: [],
  474. allSelection: [],
  475. // 子表index
  476. tableIndex: null,
  477. referConditionMx: {
  478. type: '',
  479. isPage: true,
  480. title: ''
  481. }
  482. }
  483. },
  484. created() {
  485. this.getList(this.queryParams)
  486. },
  487. methods: {
  488. // 指定列合计
  489. getSummaries(param) {
  490. const { columns, data } = param;
  491. const sums = [];
  492. columns.forEach((column, index) => {
  493. if (index === 0) {
  494. sums[index] = '合计';
  495. return;
  496. }
  497. const values = data.map(item => Number(item[column.property]));
  498. if (column.property === 'demandNum' || column.property === 'netDemandNum' || column.property === 'artificialAdjust' || column.property === 'suggestBuyQty' || column.property === 'finalBuyQty') {
  499. sums[index] = values.reduce((prev, curr) => {
  500. const value = Number(curr);
  501. if (!isNaN(value)) {
  502. return prev + curr;
  503. } else {
  504. return prev;
  505. }
  506. }, 0);
  507. sums[index];
  508. }
  509. });
  510. return sums
  511. },
  512. // 搜索
  513. search() {
  514. this.getList(this.queryParams)
  515. },
  516. reset() {
  517. this.queryParams = {
  518. rowStatus: [],
  519. buyer: '',
  520. buyerName: '',
  521. materialClassifyFourName: '',
  522. manufacturer: '',
  523. forecastClassification: '',
  524. periodUnit: '',
  525. departmentName: '',
  526. puManagerAuditor: '',
  527. // zqgdh: '',
  528. code: '',
  529. registrant: '',
  530. businessType: '',
  531. billSource: '',
  532. customer: '',
  533. lastWarehouse: '',
  534. lastAllocation: '',
  535. materialCode: '',
  536. names: '',
  537. purchaseOrg: '',
  538. demandDate: '',
  539. approverFinishTime: '',
  540. pageNum: 1,
  541. pageSize: 5
  542. }
  543. this.getList(this.queryParams)
  544. },
  545. getList(params){
  546. getSummaryList(params).then(res => {
  547. if (res.code === 200) {
  548. this.tableList = res.rows
  549. this.total = res.total
  550. }
  551. })
  552. },
  553. handleSelectionChange(selection) {
  554. console.log('选中', selection)
  555. this.allSelection = selection
  556. this.ids = selection.map(item => item.demandItemId)
  557. console.log('选中数组', this.ids.join())
  558. },
  559. handleCommand(command) {
  560. alert(command)
  561. },
  562. check(row) {
  563. this.isList = false
  564. this.page = 'check'
  565. this.rowDetail = row
  566. this.disable = true
  567. },
  568. handleSizeChange(val) {
  569. console.log(`每页 ${val} 条`);
  570. this.queryParams.pageSize = val
  571. this.getList(this.queryParams)
  572. },
  573. handleCurrentChange(val) {
  574. console.log(`当前页: ${val}`);
  575. this.queryParams.pageNum = val
  576. this.getList(this.queryParams)
  577. },
  578. drop() {
  579. this.expanded = !this.expanded
  580. },
  581. editList() {
  582. console.log('Lists`````',this.tableList)
  583. this.lineDisable = false
  584. },
  585. saveList() {
  586. editSummaryList(this.tableList).then(res => {
  587. if (res.code === 200) {
  588. this.$modal.msgSuccess("保存成功");
  589. this.lineDisable = true
  590. this.getList(this.queryParams)
  591. }
  592. })
  593. },
  594. confirms() {
  595. if (this.ids.length == 0) {
  596. this.$modal.msgWarning("请选中至少一条数据");
  597. } else {
  598. confirmSummary(this.allSelection).then(res => {
  599. this.$modal.msgSuccess("确认成功");
  600. this.getList(this.queryParams)
  601. })
  602. }
  603. },
  604. cancels() {
  605. if (this.ids.length == 0) {
  606. this.$modal.msgWarning("请选中至少一条数据");
  607. } else {
  608. let param = this.ids.join()
  609. cancelSummary(param).then(res => {
  610. if (res.code === 200) {
  611. this.$modal.msgSuccess("取消成功");
  612. this.getList(this.queryParams)
  613. }
  614. })
  615. }
  616. },
  617. audits() {
  618. if(this.ids.length == 0) {
  619. this.$modal.msgWarning("请选中至少一条数据");
  620. } else {
  621. let param = this.ids.join()
  622. auditSummary(param).then(res => {
  623. if (res.code === 200) {
  624. this.$modal.msgSuccess("审核成功");
  625. this.getList(this.queryParams)
  626. }
  627. })
  628. }
  629. },
  630. cancelAudits() {
  631. if (this.ids.length == 0) {
  632. this.$modal.msgWarning("请选中至少一条数据");
  633. } else {
  634. let param = this.ids.join()
  635. cancelAuditSummary(param).then(res => {
  636. if (res.code === 200) {
  637. this.$modal.msgSuccess("操作成功");
  638. this.getList(this.queryParams)
  639. }
  640. })
  641. }
  642. },
  643. // 搜索区参照选择
  644. chooseRefer(type, isPage, title) {
  645. this.referCondition.type = type
  646. this.referCondition.isPage = isPage
  647. this.referCondition.title = title
  648. this.$refs.refer.init(this.referCondition)
  649. },
  650. selectionsToInput(selection) {
  651. if (this.referCondition.title == '采购员') {
  652. this.personOptions = selection
  653. this.queryParams.buyer = selection[0].code
  654. this.queryParams.buyerName = selection[0].name
  655. }
  656. if (this.referCondition.title == '业务部门') {
  657. this.deptOptions = selection
  658. this.queryParams.departmentName = selection[0].id
  659. }
  660. if (this.referCondition.title == '审核人') {
  661. this.auditOptions = selection
  662. this.queryParams.puManagerAuditor = selection[0].code
  663. }
  664. if (this.referCondition.title == '需求客户') {
  665. this.customerOptions = selection
  666. this.queryParams.customer = selection[0].id
  667. }
  668. if (this.referCondition.title == '末级供应仓库') {
  669. this.lastWarehouseOptions = selection
  670. this.queryParams.lastWarehouse = selection[0].id
  671. }
  672. if (this.referCondition.title == '末级供应库位') {
  673. this.lastAllocationOptions = selection
  674. this.queryParams.lastAllocation = selection[0].id
  675. }
  676. if (this.referCondition.title == '默认采购组织') {
  677. this.orgOptions = selection
  678. this.queryParams.purchaseOrg = selection[0].id
  679. }
  680. if (this.referConditionMx.title == '采购员') {
  681. console.log('选择进了吗',this.tableList)
  682. this.tableList[this.tableIndex].buyer = selection[0].code
  683. this.tableList[this.tableIndex].buyerName = selection[0].name
  684. }
  685. if (this.referConditionMx.title == '默认采购组织') {
  686. console.log('选择进了吗',this.tableList)
  687. this.tableList[this.tableIndex].purchaseOrg = selection[0].id
  688. this.tableList[this.tableIndex].purchaseOrgName = selection[0].name
  689. }
  690. },
  691. // 搜索区树形选择
  692. chooseTreeRefer(type, isPage, title) {
  693. this.referCondition.type = type
  694. this.referCondition.isPage = isPage
  695. this.referCondition.title = title
  696. this.$refs.tree.init(this.referCondition)
  697. },
  698. selectionsToInput2(selection) {
  699. this.classOptions.push(selection)
  700. this.queryParams.materialClassifyFourName = selection.name
  701. },
  702. // 搜索区物料编码
  703. chooseMaterial() {
  704. this.$refs.materialRefer.init()
  705. },
  706. selectMaterial(selection) {
  707. this.queryParams.materialCode = selection[0].code
  708. this.queryParams.names = selection[0].name
  709. },
  710. // 明细行选择业务部门参照带出业务部门数据
  711. chooseSon(index, type, isPage, title) {
  712. this.tableIndex = index
  713. this.referConditionMx.type = type
  714. this.referConditionMx.isPage = isPage
  715. this.referConditionMx.title = title
  716. this.$refs.refer.init(this.referConditionMx)
  717. }
  718. }
  719. }
  720. </script>
  721. <style lang="scss" scoped>
  722. #demandSummary {
  723. height: calc(100vh - 84px);
  724. padding: 12px;
  725. box-sizing: border-box;
  726. overflow-y: scroll;
  727. }
  728. .btn_grooup {
  729. margin-bottom: 10px;
  730. display: flex;
  731. justify-content: flex-end;
  732. }
  733. .lines {
  734. margin-top: 0;
  735. }
  736. .hang {
  737. margin: auto;
  738. }
  739. .hang ::v-deep .el-form-item__content{
  740. margin-left: 0px !important;
  741. }
  742. </style>