index.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764
  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, '末级供应库位', queryParams.lastWarehouse)" 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="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="480"
  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. @size-change="handleSizeChange"
  339. @current-change="handleCurrentChange"
  340. :current-page="1"
  341. :page-sizes="[5, 10, 15, 20]"
  342. :page-size="100"
  343. layout="total, sizes, prev, pager, next, jumper"
  344. :total=total>
  345. </el-pagination>
  346. </el-card>
  347. </div>
  348. <Add v-model="isList" v-if="!isList" :pageStu="page" :disable="disable" :row="rowDetail" @refresh="reset"/>
  349. <Refers ref="refer" @doSubmit="selectionsToInput" :single="true"/>
  350. <TreeRefers ref="tree" @doSubmit="selectionsToInput2" :single="true"/>
  351. <popDialog ref="materialRefer" @doSubmit="selectMaterial" :single="true" />
  352. </div>
  353. </template>
  354. <script>
  355. import Add from './add.vue'
  356. import Refers from '@/components/Refers/refers.vue'
  357. import TreeRefers from '@/components/Refers/treeRefer.vue'
  358. import popDialog from '@/components/PopDialog/index.vue'
  359. import CollapseTransition from '@/components/MyCollapse/collapse.vue'
  360. import {getSummaryList, auditSummary, confirmSummary , cancelSummary , cancelAuditSummary, editSummaryList } from '@/api/purchase/DemandSummary.js'
  361. export default {
  362. name: 'demandSummary',
  363. dicts: ['sys_row_status', 'predictive_classify', 'sys_period_unit', 'sys_business', 'sys_bill_source'],
  364. components: {
  365. Add,
  366. CollapseTransition,
  367. Refers,
  368. TreeRefers,
  369. popDialog
  370. },
  371. data() {
  372. return {
  373. hangStatus(row) {
  374. switch (row.status) {
  375. case '0':
  376. return '需补货'
  377. case '1':
  378. return '待计划确认'
  379. case '2':
  380. return '计划已确认'
  381. case '3':
  382. return '计划已审核'
  383. case '4':
  384. return '行关闭'
  385. case '5':
  386. return '总供应可满足'
  387. }
  388. },
  389. formatterBusinessType(row) {
  390. switch (row.businessType) {
  391. case 'ZQBH':
  392. return '周期备货'
  393. case 'FXXQ':
  394. return '分销需求'
  395. case 'TSXQ':
  396. return '特殊采购需求'
  397. case 'BDXQ':
  398. return '补单需求'
  399. case 'JJXQ':
  400. return '紧急需求单'
  401. case 'XPXQ':
  402. return '新品需求'
  403. case 'HZBM':
  404. return '合作部门需求'
  405. }
  406. },
  407. formatterSource(row) {
  408. switch (row.billSource) {
  409. case '1':
  410. return '手工导入'
  411. case '2':
  412. return '按客户计算'
  413. case '3':
  414. return '按仓库计算'
  415. case '4':
  416. return '手工新增'
  417. }
  418. },
  419. isUpdate: false,
  420. expanded: false,
  421. // 页面配置
  422. isList: true,
  423. // 页面状态
  424. page: '',
  425. queryParams: {
  426. rowStatus: [],
  427. buyer: '',
  428. buyerName: '',
  429. materialClassifyFourName: '',
  430. manufacturer: '',
  431. forecastClassification: '',
  432. periodUnit: '',
  433. departmentName: '',
  434. puManagerAuditor: '',
  435. // zqgdh: '',
  436. code: '',
  437. registrant: '',
  438. businessType: '',
  439. billSource: '',
  440. customer: '',
  441. lastWarehouse: '',
  442. lastAllocation: '',
  443. materialCode: '',
  444. names: '',
  445. purchaseOrg: '',
  446. demandDate: '',
  447. approverFinishTime: '',
  448. pageNum: 1,
  449. pageSize: 5
  450. },
  451. personOptions: [],
  452. classOptions: [],
  453. deptOptions: [],
  454. auditOptions: [],
  455. customerOptions: [],
  456. lastWarehouseOptions: [],
  457. lastAllocationOptions: [],
  458. orgOptions: [],
  459. options: [{
  460. value: 'Y', label: '是',
  461. }, {
  462. value: 'N', label: '否'
  463. }],
  464. referCondition: {
  465. type: '',
  466. isPage: true,
  467. title: ''
  468. },
  469. tableList: [],
  470. total: 0,
  471. rowDetail: {},
  472. disable: false,
  473. lineDisable: true,
  474. ids: [],
  475. allSelection: [],
  476. // 子表index
  477. tableIndex: null,
  478. referConditionMx: {
  479. type: '',
  480. isPage: true,
  481. title: ''
  482. }
  483. }
  484. },
  485. created() {
  486. this.getList(this.queryParams)
  487. },
  488. methods: {
  489. // 指定列合计
  490. getSummaries(param) {
  491. const { columns, data } = param;
  492. const sums = [];
  493. columns.forEach((column, index) => {
  494. if (index === 0) {
  495. sums[index] = '合计';
  496. return;
  497. }
  498. const values = data.map(item => Number(item[column.property]));
  499. if (column.property === 'demandNum' || column.property === 'netDemandNum' || column.property === 'artificialAdjust' || column.property === 'suggestBuyQty' || column.property === 'finalBuyQty') {
  500. sums[index] = values.reduce((prev, curr) => {
  501. const value = Number(curr);
  502. if (!isNaN(value)) {
  503. return prev + curr;
  504. } else {
  505. return prev;
  506. }
  507. }, 0);
  508. sums[index];
  509. }
  510. });
  511. return sums
  512. },
  513. // 搜索
  514. search() {
  515. this.getList(this.queryParams)
  516. },
  517. reset() {
  518. this.queryParams = {
  519. rowStatus: [],
  520. buyer: '',
  521. buyerName: '',
  522. materialClassifyFourName: '',
  523. manufacturer: '',
  524. forecastClassification: '',
  525. periodUnit: '',
  526. departmentName: '',
  527. puManagerAuditor: '',
  528. // zqgdh: '',
  529. code: '',
  530. registrant: '',
  531. businessType: '',
  532. billSource: '',
  533. customer: '',
  534. lastWarehouse: '',
  535. lastAllocation: '',
  536. materialCode: '',
  537. names: '',
  538. purchaseOrg: '',
  539. demandDate: '',
  540. approverFinishTime: '',
  541. pageNum: 1,
  542. pageSize: 5
  543. }
  544. this.getList(this.queryParams)
  545. },
  546. getList(params){
  547. getSummaryList(params).then(res => {
  548. if (res.code === 200) {
  549. this.tableList = res.rows
  550. this.total = res.total
  551. }
  552. })
  553. },
  554. handleSelectionChange(selection) {
  555. console.log('选中', selection)
  556. this.allSelection = selection
  557. this.ids = selection.map(item => item.demandItemId)
  558. console.log('选中数组', this.ids.join())
  559. },
  560. handleCommand(command) {
  561. alert(command)
  562. },
  563. check(row) {
  564. this.isList = false
  565. this.page = 'check'
  566. this.rowDetail = row
  567. this.disable = true
  568. },
  569. handleSizeChange(val) {
  570. console.log(`每页 ${val} 条`);
  571. this.queryParams.pageSize = val
  572. this.getList(this.queryParams)
  573. },
  574. handleCurrentChange(val) {
  575. console.log(`当前页: ${val}`);
  576. this.queryParams.pageNum = val
  577. this.getList(this.queryParams)
  578. },
  579. drop() {
  580. this.expanded = !this.expanded
  581. },
  582. editList() {
  583. console.log('Lists`````',this.tableList)
  584. this.lineDisable = false
  585. },
  586. cancelEdit() {
  587. this.lineDisable = true
  588. },
  589. saveList() {
  590. editSummaryList(this.tableList).then(res => {
  591. if (res.code === 200) {
  592. this.$modal.msgSuccess("保存成功");
  593. this.lineDisable = true
  594. this.getList(this.queryParams)
  595. }
  596. })
  597. },
  598. confirms() {
  599. if (this.ids.length == 0) {
  600. this.$modal.msgWarning("请选中至少一条数据");
  601. } else {
  602. confirmSummary(this.allSelection).then(res => {
  603. this.$modal.msgSuccess("确认成功");
  604. this.getList(this.queryParams)
  605. })
  606. }
  607. },
  608. cancels() {
  609. if (this.ids.length == 0) {
  610. this.$modal.msgWarning("请选中至少一条数据");
  611. } else {
  612. let param = this.ids.join()
  613. cancelSummary(param).then(res => {
  614. if (res.code === 200) {
  615. this.$modal.msgSuccess("取消成功");
  616. this.getList(this.queryParams)
  617. }
  618. })
  619. }
  620. },
  621. audits() {
  622. if(this.ids.length == 0) {
  623. this.$modal.msgWarning("请选中至少一条数据");
  624. } else {
  625. let param = this.ids.join()
  626. auditSummary(param).then(res => {
  627. if (res.code === 200) {
  628. this.$modal.msgSuccess("审核成功");
  629. this.getList(this.queryParams)
  630. }
  631. })
  632. }
  633. },
  634. cancelAudits() {
  635. if (this.ids.length == 0) {
  636. this.$modal.msgWarning("请选中至少一条数据");
  637. } else {
  638. let param = this.ids.join()
  639. cancelAuditSummary(param).then(res => {
  640. if (res.code === 200) {
  641. this.$modal.msgSuccess("操作成功");
  642. this.getList(this.queryParams)
  643. }
  644. })
  645. }
  646. },
  647. // 搜索区参照选择
  648. chooseRefer(type, isPage, title, stordocId) {
  649. this.referCondition.type = type
  650. this.referCondition.isPage = isPage
  651. this.referCondition.title = title
  652. this.referCondition.stordocId = stordocId
  653. this.$refs.refer.init(this.referCondition)
  654. },
  655. selectionsToInput(selection) {
  656. if (this.referCondition.title == '采购员') {
  657. this.personOptions = selection
  658. this.queryParams.buyer = selection[0].code
  659. this.queryParams.buyerName = selection[0].name
  660. }
  661. if (this.referCondition.title == '业务部门') {
  662. this.deptOptions = selection
  663. this.queryParams.departmentName = selection[0].id
  664. }
  665. if (this.referCondition.title == '审核人') {
  666. this.auditOptions = selection
  667. this.queryParams.puManagerAuditor = selection[0].code
  668. }
  669. if (this.referCondition.title == '需求客户') {
  670. this.customerOptions = selection
  671. this.queryParams.customer = selection[0].id
  672. }
  673. if (this.referCondition.title == '末级供应仓库') {
  674. this.lastWarehouseOptions = selection
  675. this.queryParams.lastWarehouse = selection[0].id
  676. }
  677. if (this.referCondition.title == '末级供应库位') {
  678. this.lastAllocationOptions = selection
  679. this.queryParams.lastAllocation = selection[0].id
  680. }
  681. if (this.referCondition.title == '默认采购组织') {
  682. this.orgOptions = selection
  683. this.queryParams.purchaseOrg = selection[0].id
  684. }
  685. if (this.referConditionMx.title == '采购员') {
  686. console.log('选择进了吗',this.tableList)
  687. this.tableList[this.tableIndex].buyer = selection[0].code
  688. this.tableList[this.tableIndex].buyerName = selection[0].name
  689. }
  690. if (this.referConditionMx.title == '默认采购组织') {
  691. console.log('选择进了吗',this.tableList)
  692. this.tableList[this.tableIndex].purchaseOrg = selection[0].id
  693. this.tableList[this.tableIndex].purchaseOrgName = selection[0].name
  694. }
  695. },
  696. // 搜索区树形选择
  697. chooseTreeRefer(type, isPage, title) {
  698. this.referCondition.type = type
  699. this.referCondition.isPage = isPage
  700. this.referCondition.title = title
  701. this.$refs.tree.init(this.referCondition)
  702. },
  703. selectionsToInput2(selection) {
  704. this.classOptions.push(selection)
  705. this.queryParams.materialClassifyFourName = selection.name
  706. },
  707. // 搜索区物料编码
  708. chooseMaterial() {
  709. this.$refs.materialRefer.init()
  710. },
  711. selectMaterial(selection) {
  712. this.queryParams.materialCode = selection[0].code
  713. this.queryParams.names = selection[0].name
  714. },
  715. // 明细行选择业务部门参照带出业务部门数据
  716. chooseSon(index, type, isPage, title) {
  717. this.tableIndex = index
  718. this.referConditionMx.type = type
  719. this.referConditionMx.isPage = isPage
  720. this.referConditionMx.title = title
  721. this.$refs.refer.init(this.referConditionMx)
  722. }
  723. }
  724. }
  725. </script>
  726. <style lang="scss" scoped>
  727. #demandSummary {
  728. height: calc(100vh - 84px);
  729. padding: 12px;
  730. box-sizing: border-box;
  731. overflow-y: scroll;
  732. }
  733. .btn_grooup {
  734. margin-bottom: 10px;
  735. display: flex;
  736. justify-content: flex-end;
  737. }
  738. .lines {
  739. margin-top: 0;
  740. }
  741. .hang {
  742. margin: auto;
  743. }
  744. .hang ::v-deep .el-form-item__content{
  745. margin-left: 0px !important;
  746. }
  747. </style>