index.vue 32 KB

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