new_engin.vue 31 KB

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