engin_list.vue 34 KB

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