engin_list.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886
  1. <template>
  2. <div class="app-container">
  3. <div v-show="!isShowDetail && !isShowExamine && !isShowForm && !isShowReturnForm">
  4. <!-- 筛选条件 -->
  5. <div class="screen-container">
  6. <Collapse :screen-form="screenForm">
  7. <template #left_btn>
  8. <el-radio-group size="mini" v-model="screenForm.status" @change="getList()">
  9. <el-radio-button label="">全部</el-radio-button>
  10. <el-radio-button v-for="(item, index) in statusList" :key="index" :label="item.value">{{
  11. item.label
  12. }}</el-radio-button>
  13. </el-radio-group>
  14. </template>
  15. <template #right_btn>
  16. <div>
  17. <el-button size="mini" @click="resetScreenForm">清空</el-button>
  18. <el-button type="primary" size="mini" @click="submitScreenForm">搜索</el-button>
  19. </div>
  20. </template>
  21. <template #search>
  22. <el-form ref="screenForm" :model="screenForm" label-width="100px" size="mini" label-position="left">
  23. <el-row :gutter="20">
  24. <el-col :xs="24" :sm="12" :lg="6">
  25. <el-form-item label="发货申请单" prop="orderNum">
  26. <el-input v-model="screenForm.orderNum" placeholder="请输入发货申请单" />
  27. </el-form-item>
  28. </el-col>
  29. <el-col :xs="24" :sm="12" :lg="6">
  30. <el-form-item label="仓库名称" prop="warehouse">
  31. <el-input v-model="screenForm.warehouse" placeholder="请输入仓库名称" />
  32. </el-form-item>
  33. </el-col>
  34. <el-col :xs="24" :sm="12" :lg="6">
  35. <el-form-item label="经销商编码" prop="jxsNum">
  36. <el-input v-model="screenForm.jxsNum" placeholder="请输入经销商编码" />
  37. </el-form-item>
  38. </el-col>
  39. <el-col :xs="24" :sm="12" :lg="6">
  40. <el-form-item label="经销商名称" prop="jxsName">
  41. <el-input v-model="screenForm.jxsName" placeholder="请输入经销商名称" />
  42. </el-form-item>
  43. </el-col>
  44. <el-col :xs="24" :sm="12" :lg="6">
  45. <el-form-item label="发货申请日期" prop="date">
  46. <el-date-picker
  47. v-model="screenForm.date"
  48. type="datetimerange"
  49. range-separator="至"
  50. style="width: 100%"
  51. value-format="yyyy-MM-dd HH:mm:ss"
  52. start-placeholder="开始日期"
  53. end-placeholder="结束日期"
  54. />
  55. </el-form-item>
  56. </el-col>
  57. <el-col :xs="24" :sm="12" :lg="6">
  58. <el-form-item label="产品名称" prop="chName">
  59. <el-input v-model="screenForm.chName" placeholder="请输入产品名称" />
  60. </el-form-item>
  61. </el-col>
  62. <el-col :xs="24" :sm="12" :lg="6">
  63. <el-form-item label="规格型号" prop="model">
  64. <el-input v-model="screenForm.model" placeholder="请输入规格型号" />
  65. </el-form-item>
  66. </el-col>
  67. <el-col :xs="24" :sm="12" :lg="6">
  68. <el-form-item label="订单类型" prop="orderType">
  69. <el-select v-model="screenForm.orderType" placeholder="请选择" clearable>
  70. <el-option
  71. v-for="item in orderTypeList"
  72. :key="item.value"
  73. :label="item.label"
  74. :value="item.value"
  75. />
  76. </el-select>
  77. </el-form-item>
  78. </el-col>
  79. <el-col :xs="24" :sm="12" :lg="6">
  80. <el-form-item label="订单号" prop="mainOrderId">
  81. <el-input v-model="screenForm.mainOrderId" placeholder="请输入订单号" />
  82. </el-form-item>
  83. </el-col>
  84. <el-col :xs="24" :sm="12" :lg="6">
  85. <el-form-item label="工程登录编号" prop="refEnginRecordNo">
  86. <el-input v-model="screenForm.refEnginRecordNo" placeholder="请输入工程登录编号" />
  87. </el-form-item>
  88. </el-col>
  89. <el-col :xs="24" :sm="12" :lg="6">
  90. <el-form-item label="使用单位" prop="refUseUnit">
  91. <el-input v-model="screenForm.refUseUnit" placeholder="请输入使用单位" />
  92. </el-form-item>
  93. </el-col>
  94. <el-col :xs="24" :sm="12" :lg="6">
  95. <el-form-item label="表头业务员" prop="k3ServiceId">
  96. <el-select
  97. v-model="screenForm.k3ServiceId"
  98. placeholder="选择表头业务员"
  99. clearable
  100. filterable
  101. style="width: 100%"
  102. >
  103. <el-option
  104. v-for="item in salesmanList"
  105. :key="item.adminUserId"
  106. :label="item.nickName"
  107. :value="item.adminUserId"
  108. />
  109. </el-select>
  110. </el-form-item>
  111. </el-col>
  112. <el-col :xs="24" :sm="12" :lg="6">
  113. <el-form-item label="表体业务员" prop="salesMan">
  114. <el-select
  115. v-model="screenForm.salesMan"
  116. placeholder="选择表体业务员"
  117. clearable
  118. filterable
  119. style="width: 100%"
  120. >
  121. <el-option
  122. v-for="item in salesmanList"
  123. :key="item.adminUserId"
  124. :label="item.nickName"
  125. :value="item.adminUserId"
  126. />
  127. </el-select>
  128. </el-form-item>
  129. </el-col>
  130. <el-col :xs="24" :sm="12" :lg="6">
  131. <el-form-item label="产品类别">
  132. <el-select
  133. v-model="screenForm.categoryId"
  134. style="width: 100%"
  135. placeholder="选择产品类别"
  136. filterable
  137. clearable
  138. >
  139. <el-option v-for="item in categoryList" :key="item.name" :label="item.name" :value="item.id" />
  140. </el-select>
  141. </el-form-item>
  142. </el-col>
  143. <el-col :xs="24" :sm="12" :lg="6">
  144. <el-form-item label="审核人" prop="approvalName">
  145. <el-input v-model="screenForm.approvalName" placeholder="请输入审核人" />
  146. </el-form-item>
  147. </el-col>
  148. <el-col :xs="24" :sm="12" :lg="6">
  149. <el-form-item label="区域" prop="refRegionWork">
  150. <el-input v-model="screenForm.refRegionWork" placeholder="请输入区域" />
  151. </el-form-item>
  152. </el-col>
  153. <el-col :xs="24" :sm="12" :lg="6">
  154. <el-form-item label="制单人" prop="createBy">
  155. <el-input v-model="screenForm.createBy" placeholder="请输入制单人" />
  156. </el-form-item>
  157. </el-col>
  158. </el-row>
  159. </el-form>
  160. </template>
  161. </Collapse>
  162. </div>
  163. <div class="mymain-container">
  164. <div class="btn-group clearfix">
  165. <div class="fl">
  166. <el-button
  167. v-if="$checkBtnRole('add', $route.meta.roles)"
  168. size="mini"
  169. type="primary"
  170. icon="el-icon-plus"
  171. @click="toForm()"
  172. >发货申请</el-button
  173. >
  174. <el-button
  175. v-if="$checkBtnRole('refund', $route.meta.roles)"
  176. size="mini"
  177. type="primary"
  178. icon="el-icon-plus"
  179. @click="toReturnForm()"
  180. >退货申请</el-button
  181. >
  182. <el-button
  183. v-if="$checkBtnRole('examine', $route.meta.roles)"
  184. size="mini"
  185. type="warning"
  186. icon="el-icon-finished"
  187. :disabled="multipleSelection.length < 1"
  188. @click="batchExamine"
  189. >批量审批</el-button
  190. >
  191. </div>
  192. <div class="fr">
  193. <ExportButton :ex-url="'invoice/listProjectExport'" :ex-params="exParams" />
  194. </div>
  195. </div>
  196. <div class="table">
  197. <el-table
  198. v-loading="listLoading"
  199. :data="dataList"
  200. element-loading-text="Loading"
  201. border
  202. fit
  203. :row-style="rowClass"
  204. show-summary
  205. :summary-method="$getSummaries"
  206. @selection-change="handleSelectionChange"
  207. >
  208. <!-- :selectable="selectable"-->
  209. <el-table-column align="center" type="selection" width="55" fixed="left" :selectable="selectable" />
  210. <el-table-column align="left" label="订单状态" prop="type" min-width="120" show-overflow-tooltip>
  211. <template slot-scope="scope">
  212. {{ scope.row.automaticStatus ? '非计划单推发货' : '计划单推发货' }}
  213. </template>
  214. </el-table-column>
  215. <el-table-column align="left" label="订单类型" prop="type" min-width="100" show-overflow-tooltip>
  216. <template slot-scope="scope">
  217. {{ scope.row.type | orderTypeFilter }}
  218. </template>
  219. </el-table-column>
  220. <el-table-column align="left" label="发货申请单" prop="id" min-width="130" show-overflow-tooltip>
  221. <template slot-scope="scope">
  222. <CopyButton :copy-text="scope.row.id" />
  223. <span>{{ scope.row.id }}</span>
  224. </template>
  225. </el-table-column>
  226. <el-table-column
  227. align="left"
  228. label="发货申请日期"
  229. prop="createTime"
  230. min-width="160"
  231. show-overflow-tooltip
  232. />
  233. <el-table-column align="left" label="仓库" prop="correspondName" min-width="100" show-overflow-tooltip>
  234. <template slot-scope="scope">
  235. {{ scope.row.type === 3 ? scope.row.stockName : scope.row.correspondName }}
  236. </template>
  237. </el-table-column>
  238. <el-table-column align="left" label="订单号" prop="enginOrderNo" min-width="140" show-overflow-tooltip>
  239. <template slot-scope="scope">
  240. <CopyButton :copy-text="scope.row.enginOrderNo" />
  241. <span>{{ scope.row.enginOrderNo }}</span>
  242. </template>
  243. </el-table-column>
  244. <el-table-column
  245. align="left"
  246. label="工程登录编号"
  247. prop="refEnginRecordNo"
  248. min-width="200"
  249. show-overflow-tooltip
  250. >
  251. <template slot-scope="scope">
  252. <CopyButton :copy-text="scope.row.refEnginRecordNo" />
  253. <span>{{ scope.row.refEnginRecordNo }}</span>
  254. </template>
  255. </el-table-column>
  256. <el-table-column
  257. align="left"
  258. label="项目名称"
  259. prop="refProjectName"
  260. min-width="120"
  261. show-overflow-tooltip
  262. />
  263. <el-table-column
  264. align="left"
  265. label="项目类别"
  266. prop="refProjectCategory"
  267. min-width="120"
  268. show-overflow-tooltip
  269. />
  270. <el-table-column align="left" label="使用单位" prop="refUseUnit" min-width="120" show-overflow-tooltip />
  271. <el-table-column
  272. align="left"
  273. label="经销商编码"
  274. prop="customerNumber"
  275. min-width="100"
  276. show-overflow-tooltip
  277. >
  278. <template slot-scope="scope">
  279. <CopyButton :copy-text="scope.row.customerNumber" />
  280. <span>{{ scope.row.customerNumber }}</span>
  281. </template>
  282. </el-table-column>
  283. <el-table-column align="left" label="经销商名称" prop="customerName" min-width="250" show-overflow-tooltip>
  284. <template slot-scope="scope">
  285. <CopyButton :copy-text="scope.row.customerName" />
  286. <span>{{ scope.row.customerName }}</span>
  287. </template>
  288. </el-table-column>
  289. <el-table-column align="left" label="物料编码" prop="materialCode" min-width="120" show-overflow-tooltip>
  290. <template slot-scope="scope">
  291. <CopyButton :copy-text="scope.row.materialCode" />
  292. <span>{{ scope.row.materialCode }}</span>
  293. </template>
  294. </el-table-column>
  295. <el-table-column
  296. align="left"
  297. label="产品编码"
  298. prop="materialOldNumber"
  299. min-width="140"
  300. show-overflow-tooltip
  301. >
  302. <template slot-scope="scope">
  303. <CopyButton :copy-text="scope.row.materialOldNumber" />
  304. <span>{{ scope.row.materialOldNumber }}</span>
  305. </template>
  306. </el-table-column>
  307. <el-table-column align="left" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip>
  308. <template slot-scope="scope">
  309. <CopyButton :copy-text="scope.row.materialName" />
  310. <span>{{ scope.row.materialName }}</span>
  311. </template>
  312. </el-table-column>
  313. <el-table-column align="left" label="规格型号" prop="specification" min-width="350" show-overflow-tooltip>
  314. <template slot-scope="scope">
  315. <CopyButton :copy-text="scope.row.specification" />
  316. <span>{{ scope.row.specification }}</span>
  317. </template>
  318. </el-table-column>
  319. <el-table-column align="left" label="产品类别" prop="categoryName" min-width="100" show-overflow-tooltip>
  320. <template slot-scope="scope">
  321. <span>{{ scope.row.categoryName }}</span>
  322. </template>
  323. </el-table-column>
  324. <el-table-column align="left" label="单位" prop="unit" min-width="100" show-overflow-tooltip />
  325. <el-table-column align="left" label="文件编号" prop="itemFileNo" min-width="100" show-overflow-tooltip />
  326. <el-table-column align="right" label="数量" prop="refundableQty" min-width="100" show-overflow-tooltip />
  327. <el-table-column align="right" label="含税单价" prop="singlePayPrice" min-width="100" show-overflow-tooltip>
  328. <template slot-scope="scope">
  329. {{ scope.row.singlePayPrice | numToFixed }}
  330. </template>
  331. </el-table-column>
  332. <el-table-column align="right" label="价税合计" prop="payAmount" min-width="100" show-overflow-tooltip>
  333. <template slot-scope="scope">
  334. {{ scope.row.payAmount | numToFixed }}
  335. </template>
  336. </el-table-column>
  337. <el-table-column
  338. align="right"
  339. label="返利金额"
  340. prop="payRebateAmount"
  341. min-width="100"
  342. show-overflow-tooltip
  343. >
  344. <template slot-scope="scope">
  345. {{ scope.row.payRebateAmount | numToFixed }}
  346. </template>
  347. </el-table-column>
  348. <el-table-column
  349. align="right"
  350. label="格力折扣"
  351. prop="totalDiscAmount"
  352. min-width="100"
  353. show-overflow-tooltip
  354. >
  355. <template slot-scope="scope">
  356. {{ scope.row.totalDiscAmount | numToFixed }}
  357. </template>
  358. </el-table-column>
  359. <el-table-column align="left" label="订单备注" prop="headerRemark" min-width="160" show-overflow-tooltip />
  360. <el-table-column align="left" label="发货申请备注" prop="remark" min-width="160" show-overflow-tooltip />
  361. <el-table-column align="left" label="表体备注" prop="invoiceRemark" min-width="160" show-overflow-tooltip />
  362. <el-table-column align="left" label="业务员" prop="serviceName" min-width="100" show-overflow-tooltip />
  363. <el-table-column
  364. align="left"
  365. label="表头业务员"
  366. prop="k3ServiceName"
  367. min-width="100"
  368. show-overflow-tooltip
  369. />
  370. <el-table-column align="left" label="制单人" prop="createBy" min-width="100" show-overflow-tooltip />
  371. <el-table-column align="left" label="制单日期" prop="createTime" min-width="160" show-overflow-tooltip />
  372. <el-table-column align="left" label="区域" prop="refRegionWork" min-width="160" show-overflow-tooltip />
  373. <el-table-column align="left" label="审核人" prop="approvalName" min-width="100" show-overflow-tooltip />
  374. <el-table-column align="left" label="审核日期" prop="approvalTime" min-width="160" show-overflow-tooltip />
  375. <el-table-column align="left" label="审核状态" prop="examineStatus" min-width="100" show-overflow-tooltip>
  376. <template slot-scope="scope">
  377. {{ scope.row.examineStatus | statusFilter }}
  378. </template>
  379. </el-table-column>
  380. <el-table-column
  381. v-if="this.$store.getters.customerNumber === '100093' || this.$store.getters.customerNumber === '600023'"
  382. align="left"
  383. label="同步到格匠采购入库单"
  384. prop="gejiangSync"
  385. min-width="160"
  386. show-overflow-tooltip
  387. >
  388. <template slot-scope="scope">
  389. {{ scope.row.gejiangSync === 1 ? '同步成功' : scope.row.gejiangSync === 0 ? '待同步' : '同步失败' }}
  390. </template>
  391. </el-table-column>
  392. <el-table-column
  393. align="left"
  394. v-if="this.$store.getters.customerNumber === '100093' || this.$store.getters.customerNumber === '600023'"
  395. label="同步格匠失败原因"
  396. prop="gejiangSyncRemark"
  397. min-width="160"
  398. show-overflow-tooltip
  399. />
  400. <el-table-column align="center" label="操作" width="180" fixed="right">
  401. <template slot-scope="scope">
  402. <el-popconfirm
  403. v-if="
  404. (!scope.row.automaticStatus &&
  405. $checkBtnRole('apply', $route.meta.roles) &&
  406. scope.row.examineStatus === 'SAVE') ||
  407. ($checkBtnRole('apply', $route.meta.roles) &&
  408. scope.row.examineStatus === 'SAVE' &&
  409. scope.row.automaticStatus &&
  410. scope.row.type === 2)
  411. "
  412. style="margin-right: 10px"
  413. title="确定申请吗?"
  414. @onConfirm="handleSubmit(scope.row.id, 'WAIT')"
  415. >
  416. <el-button slot="reference" type="text">申请</el-button>
  417. </el-popconfirm>
  418. <el-popconfirm
  419. v-if="
  420. (!scope.row.automaticStatus &&
  421. $checkBtnRole('apply', $route.meta.roles) &&
  422. scope.row.examineStatus === 'WAIT') ||
  423. ($checkBtnRole('apply', $route.meta.roles) &&
  424. scope.row.examineStatus === 'WAIT' &&
  425. scope.row.automaticStatus &&
  426. scope.row.type === 2)
  427. "
  428. style="margin-right: 10px"
  429. title="确定撤回吗?"
  430. @onConfirm="handleSubmit(scope.row.id, 'SAVE')"
  431. >
  432. <el-button slot="reference" type="text">撤回</el-button>
  433. </el-popconfirm>
  434. <el-popconfirm
  435. v-if="
  436. (!scope.row.automaticStatus &&
  437. $checkBtnRole('examine', $route.meta.roles) &&
  438. scope.row.examineStatus === 'OK') ||
  439. ($checkBtnRole('examine', $route.meta.roles) &&
  440. scope.row.examineStatus === 'OK' &&
  441. scope.row.automaticStatus &&
  442. scope.row.type === 2)
  443. "
  444. style="margin-right: 10px"
  445. title="确定弃审吗?"
  446. @onConfirm="handleAbandon(scope.row.id)"
  447. >
  448. <el-button slot="reference" type="text">弃审</el-button>
  449. </el-popconfirm>
  450. <el-button
  451. v-if="
  452. !scope.row.automaticStatus &&
  453. $checkBtnRole('edit', $route.meta.roles) &&
  454. (scope.row.examineStatus === 'SAVE' || scope.row.examineStatus === 'FAIL') &&
  455. scope.row.type === 1
  456. "
  457. type="text"
  458. @click="toForm(scope.row)"
  459. >
  460. 编辑
  461. </el-button>
  462. <el-button
  463. v-if="
  464. (!scope.row.automaticStatus &&
  465. $checkBtnRole('edit', $route.meta.roles) &&
  466. (scope.row.examineStatus === 'SAVE' || scope.row.examineStatus === 'FAIL') &&
  467. scope.row.type === 2) ||
  468. ($checkBtnRole('examine', $route.meta.roles) &&
  469. (scope.row.examineStatus === 'SAVE' || scope.row.examineStatus === 'FAIL') &&
  470. scope.row.automaticStatus &&
  471. scope.row.type === 2)
  472. "
  473. type="text"
  474. @click="toReturnForm(scope.row)"
  475. >
  476. 编辑
  477. </el-button>
  478. <el-button
  479. v-if="
  480. (!scope.row.automaticStatus &&
  481. $checkBtnRole('examine', $route.meta.roles) &&
  482. scope.row.examineStatus === 'WAIT') ||
  483. ($checkBtnRole('examine', $route.meta.roles) &&
  484. scope.row.examineStatus === 'WAIT' &&
  485. scope.row.automaticStatus &&
  486. scope.row.type === 2)
  487. "
  488. type="text"
  489. @click="toExamine(scope.row)"
  490. >
  491. 审单
  492. </el-button>
  493. <el-button type="text" @click="toDetail(scope.row)"> 详情 </el-button>
  494. <!-- !scope.row.automaticStatus && -->
  495. <el-popconfirm
  496. v-if="!scope.row.automaticStatus && scope.row.examineStatus !== 'OK'"
  497. style="margin-left: 10px"
  498. title="确定删除吗?"
  499. @onConfirm="handleDelete(scope.row.id)"
  500. >
  501. <el-button slot="reference" type="text" style="color: #f56c6c">删除</el-button>
  502. </el-popconfirm>
  503. </template>
  504. </el-table-column>
  505. </el-table>
  506. </div>
  507. </div>
  508. <div class="pagination clearfix">
  509. <div class="fr">
  510. <el-pagination
  511. :current-page="currentPage"
  512. :page-sizes="[10, 20, 30, 50]"
  513. :page-size="10"
  514. layout="total, sizes, prev, pager, next, jumper"
  515. :total="listTotal"
  516. @size-change="handleSizeChange"
  517. @current-change="handleCurrentChange"
  518. />
  519. </div>
  520. </div>
  521. </div>
  522. <ExamineDialog :is-show.sync="isShowExamineDialog" :examine-form.sync="examineForm" />
  523. <EnginDetail v-if="isShowDetail" ref="refDetail" :list-item="queryItem" @backListFormDetail="backList" />
  524. <EnginExamine v-if="isShowExamine" :list-item="queryItem" @backListFormDetail="backList" />
  525. <EnginForm v-if="isShowForm" :list-item="queryItem" @backListFormDetail="backList" />
  526. <EnginReturnForm v-if="isShowReturnForm" :list-item="queryItem" @backListFormDetail="backList" />
  527. </div>
  528. </template>
  529. <script>
  530. import { getEnginList, submitEngin, deleteEngin, abandonEngin, examineBatchEngin } from '@/api/supply/apply'
  531. import { getCategoryList, getSalesmanList } from '@/api/common'
  532. import EnginDetail from '@/views/supply/apply/components/engin_detail'
  533. import EnginExamine from '@/views/supply/apply/components/engin_examine'
  534. import EnginForm from '@/views/supply/apply/components/engin_form'
  535. import EnginReturnForm from '@/views/supply/apply/components/engin_return_form'
  536. import ExamineDialog from '@/components/Common/examine-dialog'
  537. let that
  538. export default {
  539. components: {
  540. EnginDetail,
  541. EnginExamine,
  542. EnginForm,
  543. EnginReturnForm,
  544. ExamineDialog
  545. },
  546. filters: {
  547. statusFilter(val) {
  548. const obj = that.statusList.find(o => o.value == val)
  549. return obj ? obj.label : ''
  550. },
  551. orderTypeFilter(val) {
  552. const obj = that.orderTypeList.find(o => o.value == val)
  553. return obj ? obj.label : ''
  554. }
  555. },
  556. data() {
  557. return {
  558. currentPage: 1, // 当前页码
  559. pageSize: 10, // 每页数量
  560. listTotal: 0, // 列表总数
  561. dataList: null, // 列表数据
  562. listLoading: false, // 列表加载loading
  563. screenForm: {
  564. // 筛选表单数据
  565. status: '',
  566. orderNum: '',
  567. warehouse: '',
  568. jxsNum: '',
  569. jxsName: '',
  570. date: '',
  571. chName: '',
  572. model: '',
  573. salesMan: '',
  574. orderType: '',
  575. mainOrderId: '',
  576. refEnginRecordNo: '',
  577. refUseUnit: '',
  578. k3ServiceId: '',
  579. categoryId: '',
  580. approvalName: '',
  581. refRegionWork: '',
  582. createBy: ''
  583. },
  584. statusList: [
  585. { label: '已保存', value: 'SAVE' },
  586. { label: '待审核', value: 'WAIT' },
  587. { label: '审核通过', value: 'OK' },
  588. // // { label: '审核驳回', value: 'FAIL' },,
  589. { label: '已关闭', value: 'CLOSE' }
  590. ],
  591. orderTypeList: [
  592. { label: '发货申请单', value: 1 },
  593. { label: '退货申请单', value: 2 },
  594. { label: '直调发货单', value: 3 }
  595. ],
  596. salesmanList: [],
  597. queryItem: {},
  598. isShowDetail: false,
  599. isShowExamine: false,
  600. isShowForm: false,
  601. isShowReturnForm: false,
  602. selectRow: [],
  603. multipleSelection: [],
  604. isShowExamineDialog: false,
  605. examineForm: {
  606. status: '',
  607. remark: ''
  608. },
  609. isShow: false,
  610. categoryList: []
  611. }
  612. },
  613. computed: {
  614. exParams() {
  615. return {
  616. id: this.screenForm.orderNum,
  617. correspondName: this.screenForm.warehouse,
  618. customerNumber: this.screenForm.jxsNum,
  619. customerName: this.screenForm.jxsName,
  620. productName: this.screenForm.chName,
  621. specification: this.screenForm.model,
  622. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  623. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  624. examineStatus: this.screenForm.status,
  625. serviceId: this.screenForm.salesMan,
  626. k3ServiceId: this.screenForm.k3ServiceId,
  627. type: this.screenForm.orderType,
  628. mainOrderId: this.screenForm.mainOrderId,
  629. createBy: this.screenForm.createBy,
  630. refEnginRecordNo: this.screenForm.refEnginRecordNo,
  631. refUseUnit: this.screenForm.refUseUnit,
  632. categoryId: this.screenForm.categoryId,
  633. approvalName: this.screenForm.approvalName,
  634. refRegionWork: this.screenForm.refRegionWork
  635. }
  636. }
  637. },
  638. watch: {
  639. multipleSelection(data) {
  640. // 监听选中状态
  641. this.selectRow = []
  642. if (data.length > 0) {
  643. data.forEach((item, index) => {
  644. this.selectRow.push(item.id)
  645. })
  646. }
  647. }
  648. },
  649. beforeCreate() {
  650. that = this
  651. },
  652. created() {
  653. this.getSalesmanList()
  654. this.getList()
  655. this.getCategoryList()
  656. this.isShow = false
  657. if (this.$route.query && this.$route.query.isShow) {
  658. this.isShow = this.$route.query.isShow
  659. this.toReturnForm()
  660. }
  661. },
  662. // activated() {
  663. // // keepAlice activated 主要是从发货单汇总调用退货申请按钮
  664. // this.isShow = false
  665. // if(this.$route.query && this.$route.query.isShow){
  666. // this.isShow = this.$route.query.isShow
  667. // this.toReturnForm()
  668. // }
  669. // },
  670. methods: {
  671. // 获取业务员列表
  672. getSalesmanList() {
  673. getSalesmanList({
  674. pageNum: 1,
  675. pageSize: -1,
  676. isCustomer: 0,
  677. status: true
  678. }).then(res => {
  679. this.salesmanList = res.data.records
  680. })
  681. },
  682. // 查询列表
  683. getList() {
  684. this.listLoading = true
  685. const params = {
  686. pageNum: this.currentPage,
  687. pageSize: this.pageSize,
  688. id: this.screenForm.orderNum,
  689. correspondName: this.screenForm.warehouse,
  690. customerNumber: this.screenForm.jxsNum,
  691. customerName: this.screenForm.jxsName,
  692. productName: this.screenForm.chName,
  693. specification: this.screenForm.model,
  694. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  695. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  696. examineStatus: this.screenForm.status,
  697. createBy: this.screenForm.createBy,
  698. serviceId: this.screenForm.salesMan,
  699. k3ServiceId: this.screenForm.k3ServiceId,
  700. type: this.screenForm.orderType,
  701. mainOrderId: this.screenForm.mainOrderId,
  702. refEnginRecordNo: this.screenForm.refEnginRecordNo,
  703. refUseUnit: this.screenForm.refUseUnit,
  704. categoryId: this.screenForm.categoryId,
  705. approvalName: this.screenForm.approvalName,
  706. refRegionWork: this.screenForm.refRegionWork
  707. }
  708. getEnginList(params).then(res => {
  709. res.data.records.forEach(item => {
  710. item.sums1 = ['refundableQty']
  711. item.sums2 = ['singlePayPrice', 'payAmount', 'payRebateAmount', 'totalDiscAmount']
  712. })
  713. this.dataList = res.data.records
  714. this.listTotal = res.data.total
  715. this.listLoading = false
  716. })
  717. },
  718. // 提交筛选表单
  719. submitScreenForm() {
  720. this.currentPage = 1
  721. this.getList()
  722. },
  723. // 重置筛选表单
  724. resetScreenForm() {
  725. this.$refs.screenForm.resetFields()
  726. this.currentPage = 1
  727. this.getList()
  728. },
  729. // 更改每页数量
  730. handleSizeChange(val) {
  731. this.pageSize = val
  732. this.currentPage = 1
  733. this.getList()
  734. },
  735. // 更改当前页
  736. handleCurrentChange(val) {
  737. this.currentPage = val
  738. this.getList()
  739. },
  740. // 进入表单
  741. toForm(item) {
  742. this.queryItem = item
  743. this.isShowForm = true
  744. },
  745. // 进入表单
  746. toReturnForm(item) {
  747. this.queryItem = item
  748. this.isShowReturnForm = true
  749. },
  750. // 进入审批
  751. toExamine(item) {
  752. this.queryItem = item
  753. this.isShowExamine = true
  754. },
  755. // 进入详情
  756. toDetail(item) {
  757. this.queryItem = item
  758. this.isShowDetail = true
  759. this.$nextTick(() => {
  760. this.$refs.refDetail.initPrint()
  761. })
  762. },
  763. backList() {
  764. this.queryItem = {}
  765. this.isShowDetail = false
  766. this.isShowExamine = false
  767. this.isShowForm = false
  768. this.isShowReturnForm = false
  769. },
  770. handleDelete(id) {
  771. deleteEngin({ id }).then(res => {
  772. this.$successMsg()
  773. this.getList()
  774. })
  775. },
  776. // 申请/撤回
  777. handleSubmit(id, examineStatus) {
  778. submitEngin({ id, examineStatus }).then(res => {
  779. this.$successMsg()
  780. this.getList()
  781. })
  782. },
  783. // 弃审
  784. handleAbandon(id) {
  785. abandonEngin({ id }).then(res => {
  786. this.$successMsg()
  787. this.getList()
  788. })
  789. },
  790. handleSelectionChange(val) {
  791. this.multipleSelection = val
  792. if (val) {
  793. this.selections = val
  794. } else {
  795. this.selections = []
  796. }
  797. },
  798. rowClass({ row, rowIndex }) {
  799. if (this.selectRow.includes(row.id)) {
  800. return { 'background-color': '#ecf5ff' }
  801. }
  802. },
  803. // 打开 批量审批
  804. batchExamine() {
  805. this.isShowExamineDialog = true
  806. },
  807. // 提交 批量审批
  808. submitExamineForm() {
  809. let ids = this.multipleSelection.map(item => {
  810. return item.id
  811. })
  812. ids = Array.from(new Set(ids))
  813. examineBatchEngin({
  814. ids: ids.join(','),
  815. examineStatus: this.examineForm.status,
  816. approvalRemark: this.examineForm.remark
  817. }).then(res => {
  818. this.isShowExamineDialog = false
  819. this.getList()
  820. this.$successMsg('审批成功')
  821. })
  822. },
  823. // 获取存货类别列表
  824. getCategoryList() {
  825. getCategoryList({
  826. pageNum: 1,
  827. pageSize: -1
  828. }).then(res => {
  829. this.categoryList = res.data.records
  830. })
  831. },
  832. /**
  833. * 根据条件禁用行复选框
  834. * 函数返回值为false则禁用选择(反之亦然)
  835. * @param {Object} row - 行数据
  836. * @param {String} index - 索引值
  837. * @return Boolean
  838. */
  839. selectable: function (row, index) {
  840. if (row.automaticStatus) {
  841. return false
  842. }
  843. return true
  844. // 函数必须有返回值且是布尔值
  845. // 页面刷新后该函数会执行 N 次进行判断(N 为表格行数)
  846. // 如果没有返回值则默认返回false(全部无法选中)
  847. }
  848. }
  849. }
  850. </script>
  851. <style lang="scss" scoped></style>