deliveryDetail.vue 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300
  1. <template>
  2. <!-- 待出库 -->
  3. <div>
  4. <!-- <div class="common-card">
  5. <h3>订单状态</h3>
  6. <yl-step></yl-step>
  7. </div> -->
  8. <!-- <div class="right-button">
  9. <el-button class="lake-Blue" @click="handleConfirm">出库</el-button>
  10. <el-button type="danger" @click="handleRefuse">关闭订单</el-button>
  11. </div> -->
  12. <div class="common-card">
  13. <h3>基本信息</h3>
  14. <el-form
  15. :model="listForm"
  16. ref="listform"
  17. label-width="237px"
  18. class="grid-form-class"
  19. >
  20. <div class="form-body">
  21. <div class="flex-css">
  22. <el-form-item label="采购单号" prop="id">
  23. <div class="content">
  24. {{ listForm.id }}
  25. </div>
  26. </el-form-item>
  27. <el-form-item label="采购品种" prop="detlCnt">
  28. <div class="content">
  29. {{ listForm.detlCnt }}
  30. </div>
  31. </el-form-item>
  32. <el-form-item label="采购总数量" prop="qtySum">
  33. <div class="content">
  34. {{ listForm.qtySum }}
  35. </div>
  36. </el-form-item>
  37. </div>
  38. <div class="flex-css">
  39. <el-form-item label="总金额" prop="purcAmt">
  40. <div class="content">
  41. {{ listForm.purcAmt }}
  42. </div>
  43. </el-form-item>
  44. <el-form-item label="部门名称" prop="deptName">
  45. <div class="content">
  46. {{ listForm.deptName }}
  47. </div>
  48. </el-form-item>
  49. <el-form-item label="医院名称" prop="branchName">
  50. <div class="content">
  51. {{ listForm.branchName }}
  52. </div>
  53. </el-form-item>
  54. </div>
  55. <div class="flex-css">
  56. <el-form-item label="当前状态" prop="stas">
  57. <div class="content">
  58. {{ listForm.stas }}
  59. </div>
  60. </el-form-item>
  61. <el-form-item label="采购时间" prop="docmkDate">
  62. <div class="content">
  63. {{ listForm.docmkDate }}
  64. </div>
  65. </el-form-item>
  66. <el-form-item label=" " prop="">
  67. <div class="content">
  68. <!-- {{ listForm.docmker }} -->
  69. </div>
  70. </el-form-item>
  71. </div>
  72. </div>
  73. </el-form>
  74. </div>
  75. <div class="common-card">
  76. <h3>商品明细</h3>
  77. <el-form :model="tableData" ref="tabledata">
  78. <el-table
  79. :data="tableData"
  80. v-loading="loding"
  81. element-loading-text="加载中..."
  82. border
  83. :span-method="handleSpan"
  84. >
  85. <template slot="empty">
  86. <img src="@/assets/nopage.png" alt />
  87. <p>暂无数据</p>
  88. </template>
  89. <el-table-column fixed type="index" label="序号" width="60" />
  90. <el-table-column label="耗材编码" prop="materialId" />
  91. <el-table-column label="医保编码" prop="hiCode" />
  92. <el-table-column label="耗材名称" width="300">
  93. <template slot-scope="scope">
  94. <mcs-info :info="scope.row"></mcs-info>
  95. </template>
  96. </el-table-column>
  97. <el-table-column label="规格" prop="spec" />
  98. <el-table-column label="型号" prop="mol" />
  99. <el-table-column label="材质" prop="matl" />
  100. <el-table-column label="是否集采" prop="isFas" >
  101. <template #default="{ row }">
  102. <span v-if="row.isFas == '1'">否</span>
  103. <span v-if="row.isFas == '0'">是</span>
  104. </template>
  105. </el-table-column>
  106. <el-table-column label="计价单位" prop="prcUnt" />
  107. <el-table-column label="采购单位" prop="purcUnt" />
  108. <el-table-column label="包装内数量" prop="convrat" />
  109. <el-table-column label="单价" prop="purcPric" />
  110. <el-table-column label="批号" prop="lotNum" width="120">
  111. <template slot-scope="scope">
  112. <el-form-item
  113. label-width="0"
  114. class="item"
  115. :prop="scope.$index + '.lotNum'"
  116. :rules="[
  117. {
  118. required: true,
  119. message: '请输入',
  120. trigger: 'blur',
  121. },
  122. ]"
  123. >
  124. <el-input placeholder="请输入" v-model="scope.row.lotNum"></el-input>
  125. </el-form-item>
  126. </template>
  127. </el-table-column>
  128. <el-table-column label="生产日期" prop="manuDate" width="220">
  129. <template slot-scope="scope">
  130. <el-form-item
  131. label-width="0"
  132. class="item"
  133. :prop="scope.$index + '.manuDate'"
  134. :rules="[
  135. {
  136. required: true,
  137. message: '请选择生产日期',
  138. trigger: 'change',
  139. },
  140. ]"
  141. >
  142. <el-date-picker
  143. style="width: 100%"
  144. v-model="scope.row.manuDate"
  145. type="date"
  146. placeholder="请选择生产日期"
  147. value-format="yyyy-MM-dd"
  148. />
  149. </el-form-item>
  150. </template>
  151. </el-table-column>
  152. <el-table-column label="有效期至" width="220" prop="prodExpy">
  153. <template slot-scope="scope">
  154. <el-form-item
  155. label-width="0"
  156. class="item"
  157. :prop="scope.$index + '.prodExpy'"
  158. :rules="[
  159. {
  160. required: true,
  161. message: '请选择有效期',
  162. trigger: 'change',
  163. },
  164. ]"
  165. >
  166. <el-date-picker
  167. style="width: 100%"
  168. v-model="scope.row.prodExpy"
  169. type="date"
  170. placeholder="请选择有效期"
  171. value-format="yyyy-MM-dd"
  172. />
  173. </el-form-item>
  174. </template>
  175. </el-table-column>
  176. <el-table-column label="需求数量" prop="purcCnt" />
  177. <el-table-column label="已出库数量" prop="delvCntYck" width="90px" />
  178. <el-table-column label="剩余出库量" prop="toDelvCnt" width="90px" />
  179. <el-table-column label="本次出库数量" prop="delvCnt" width="150">
  180. <template slot-scope="scope">
  181. <el-form-item
  182. label-width="0"
  183. class="item"
  184. :prop="scope.$index + '.delvCnt'"
  185. :rules="[
  186. {
  187. required: true,
  188. pattern: /^[0-9]\d*$/,
  189. message: '请输入正整数',
  190. trigger: 'blur',
  191. },
  192. ]"
  193. >
  194. <el-input-number v-model="scope.row.delvCnt" controls-position="right" @change="updateNum(scope.row,scope.$index)" :min="0"></el-input-number>
  195. </el-form-item>
  196. </template>
  197. </el-table-column>
  198. <el-table-column label="报关单" prop="invoFileId" width="200">
  199. <template slot-scope="scope">
  200. <yl-upload
  201. v-if="scope.row.prodSouc=='进口'"
  202. :fileId="scope.row.invoFileId"
  203. @getUpload="getUpload1"
  204. urlName="acco"
  205. :index="scope.$index"
  206. >
  207. <template v-slot:dec>只能上传pdf文件</template>
  208. </yl-upload>
  209. </template>
  210. </el-table-column>
  211. <!-- <el-table-column label="随货单" prop="dyntFileId" width="200">
  212. <template slot-scope="scope">
  213. <yl-upload
  214. :fileId="scope.row.dyntFileId"
  215. @getUpload="getUpload"
  216. urlName="acco"
  217. :index="scope.$index"
  218. >
  219. <template v-slot:dec>只能上传pdf文件</template>
  220. </yl-upload>
  221. </template>
  222. </el-table-column> -->
  223. <el-table-column label="备注" prop="memo" width="120">
  224. <template slot-scope="scope">
  225. <el-form-item
  226. label-width="0"
  227. class="item"
  228. >
  229. <el-input placeholder="请输入" v-model="scope.row.memo"></el-input>
  230. </el-form-item>
  231. </template>
  232. </el-table-column>
  233. <el-table-column align="center" fixed="right" label="操作" width="120">
  234. <template slot-scope="scope">
  235. <el-button
  236. v-if="scope.row.showDeleteButton"
  237. class="red"
  238. type="text"
  239. @click="handleDelete(scope.row, scope.$index)"
  240. >删除</el-button
  241. >
  242. <el-button v-else type="text" @click="handleBatch(scope.row, scope.$index)"
  243. >添加批次
  244. </el-button>
  245. </template>
  246. </el-table-column>
  247. </el-table>
  248. </el-form>
  249. <div class="foot-button" style="margin-top: 30px">
  250. <el-button
  251. type="primary"
  252. @click="handleDelivery"
  253. v-if="listForm.stas === '待出库'"
  254. >出库</el-button
  255. >
  256. <el-button
  257. type="primary"
  258. @click="handleDelivery"
  259. v-if="listForm.stas === '部分出库'"
  260. >出库</el-button
  261. >
  262. <!-- <el-button type="danger" @click="handleOrderEnd" v-show="endBtn" :loading="endLoad">结束订单</el-button> -->
  263. <el-button type="success" @click="handleBack" >返回</el-button>
  264. </div>
  265. </div>
  266. <!-- 选择发票 -->
  267. <el-dialog title="选择发票" :visible.sync="dialogFa" width="55%">
  268. <el-form :model="faForm" ref="faForm" :inline="true">
  269. <el-form-item label="发票信息" prop="billInfo">
  270. <el-input v-model="faForm.billInfo" placeholder="请输入发票名称"></el-input>
  271. </el-form-item>
  272. <el-form-item>
  273. <el-button type="primary" @click="getFaData('search')">查询</el-button>
  274. <el-button @click="faReset">重置</el-button>
  275. </el-form-item>
  276. </el-form>
  277. <el-table
  278. v-loading="faLoading"
  279. element-loading-text="加载中"
  280. :data="faData"
  281. fit
  282. stripe
  283. border
  284. >
  285. <template slot="empty">
  286. <img src="@/assets/nopage.png" alt />
  287. <p>暂无数据</p>
  288. </template>
  289. <el-table-column type="index" label="序号" width="60" />
  290. <el-table-column label="发票名称" prop="billName" />
  291. <el-table-column label="开票金额" prop="billAmt" />
  292. <el-table-column label="发票号码" prop="invoNum" />
  293. <el-table-column label="开票时间" prop="billDate" />
  294. <el-table-column label="上传时间" prop="upldDate" />
  295. <el-table-column fixed="right" label="操作" width="100">
  296. <template slot-scope="scope">
  297. <el-button type="primary" plain @click="handleRow(scope.row)">选择</el-button>
  298. </template>
  299. </el-table-column>
  300. </el-table>
  301. <!--分页-->
  302. <yl-pagination
  303. v-show="faTotal > 0"
  304. :total="faTotal"
  305. :page.sync="faForm.current"
  306. :limit.sync="faForm.size"
  307. @pagination="getFaData"
  308. />
  309. </el-dialog>
  310. <!-- 选择同行单 -->
  311. <el-dialog title="选择同行单" :visible.sync="dialogTong" width="55%">
  312. <el-form :model="tongForm" ref="tongForm" :inline="true">
  313. <el-form-item label="发票信息" prop="billInfo">
  314. <el-input v-model="tongForm.billInfo" placeholder="请输入同行单名称"></el-input>
  315. </el-form-item>
  316. <el-form-item>
  317. <el-button type="primary" @click="getTongData('search')">查询</el-button>
  318. <el-button @click="tongReset()">重置</el-button>
  319. </el-form-item>
  320. </el-form>
  321. <el-table
  322. v-loading="tongLoading"
  323. element-loading-text="加载中"
  324. :data="tongData"
  325. fit
  326. stripe
  327. border
  328. >
  329. <template slot="empty">
  330. <img src="@/assets/nopage.png" alt />
  331. <p>暂无数据</p>
  332. </template>
  333. <el-table-column type="index" label="序号" width="60" />
  334. <el-table-column label="票据名称" prop="billName" />
  335. <el-table-column label="票据金额" prop="billAmt" />
  336. <el-table-column label="票据单号" prop="invoNum" />
  337. <el-table-column label="开票时间" prop="billDate" />
  338. <el-table-column label="上传时间" prop="upldDate" />
  339. <el-table-column fixed="right" label="操作" width="100">
  340. <template slot-scope="scope">
  341. <el-button type="primary" plain @click="handleRowTong(scope.row)"
  342. >选择</el-button
  343. >
  344. </template>
  345. </el-table-column>
  346. </el-table>
  347. <!--分页-->
  348. <yl-pagination
  349. v-show="tongTotal > 0"
  350. :total="tongTotal"
  351. :page.sync="tongForm.current"
  352. :limit.sync="tongForm.size"
  353. @pagination="getTongData"
  354. />
  355. </el-dialog>
  356. <!-- PDF预览 -->
  357. <el-dialog
  358. title="PDF预览"
  359. class="dd"
  360. :visible.sync="dialogVisible"
  361. width="70%"
  362. center
  363. >
  364. <iframe :src="pdfSrc" frameborder="0" style="width: 100%; height: 100%"></iframe>
  365. </el-dialog>
  366. <!-- 出库单预览 -->
  367. <el-dialog title="出库单预览" :visible.sync="printVisible" width="70%">
  368. <div id="printMe">
  369. <table cellspacing="0" cellpadding="0" border="1" width="100%" class="chuTable">
  370. <tr height="50px">
  371. <th :colspan="12" :rowspan="1" style="font-size: 26px; font-weight: 800">
  372. 送货单
  373. </th>
  374. <th :colspan="8" :rowspan="1" style="font-size: 20px">
  375. NO:<span style="color: red">{{ listForm.id }}</span>
  376. </th>
  377. </tr>
  378. <tr class="hang">
  379. <th :colspan="2">医院名称:</th>
  380. <th :colspan="8">
  381. {{ listForm.branchName }}
  382. </th>
  383. <!-- <th>
  384. 制单人:
  385. </th>
  386. <th :colspan="4">
  387. {{ listForm.docmker }}
  388. </th> -->
  389. <th :colspan="2">制单时间:</th>
  390. <th :colspan="8">
  391. {{ listForm.docmkDate }}
  392. </th>
  393. </tr>
  394. <tr class="hang">
  395. <th :colspan="2">出库人:</th>
  396. <th :colspan="8">
  397. {{ $store.state.user.username }}
  398. </th>
  399. <th :colspan="2">出库日期:</th>
  400. <th :colspan="8">
  401. {{ listForm.OutboundDate }}
  402. </th>
  403. </tr>
  404. <tr class="hang">
  405. <th>序号</th>
  406. <th>耗材编码</th>
  407. <th>医保编码</th>
  408. <th>耗材名称</th>
  409. <th>商品类别</th>
  410. <th>规格</th>
  411. <th>型号</th>
  412. <th>材质</th>
  413. <th>生产来源</th>
  414. <th>注册证号</th>
  415. <th>生产企业</th>
  416. <th>单价</th>
  417. <th>批号</th>
  418. <th>生产日期</th>
  419. <th>有效期至</th>
  420. <th>需求数量</th>
  421. <th>已出库数量</th>
  422. <th>剩余出库量</th>
  423. <th>本次出库数量</th>
  424. </tr>
  425. <tr v-for="(item, index) in chuList" :key="index" class="hang">
  426. <td align="center">
  427. {{ index + 1 }}
  428. </td>
  429. <td align="center">
  430. {{ item.materialId }}
  431. </td>
  432. <td align="center">
  433. {{ item.hiCode }}
  434. </td>
  435. <td align="center">
  436. {{ item.prodName }}
  437. </td>
  438. <td align="center">
  439. <span v-if="item.mcsType=='0'">普通耗材</span>
  440. <span v-if="item.mcsType=='1'">高值耗材</span>
  441. <span v-if="item.mcsType=='2'">试剂</span>
  442. </td>
  443. <td align="center">
  444. {{ item.spec }}
  445. </td>
  446. <td align="center">
  447. {{ item.mol }}
  448. </td>
  449. <!-- 材质 -->
  450. <td align="center">
  451. {{ item.matl }}
  452. </td>
  453. <td align="center">
  454. <span v-if="item.prodSouc=='1'">国产</span>
  455. <span v-if="item.prodSouc=='2'">进口</span>
  456. </td>
  457. <td align="center">
  458. {{ item.regcertno }}
  459. </td>
  460. <td align="center">
  461. {{ item.prodEntp }}
  462. </td>
  463. <td align="center">
  464. {{ item.purcPric }}
  465. </td>
  466. <td align="center">
  467. {{ item.lotNum }}
  468. </td>
  469. <td align="center">
  470. {{ item.manuDate }}
  471. </td>
  472. <td align="center">
  473. {{ item.prodExpy }}
  474. </td>
  475. <td align="center">
  476. {{ item.purcCnt }}
  477. </td>
  478. <td align="center">
  479. {{ item.delvCntYck }}
  480. </td>
  481. <td align="center">
  482. {{ item.toDelvCnt }}
  483. </td>
  484. <td align="center">
  485. {{ item.delvCnt }}
  486. </td>
  487. </tr>
  488. <tr class="hang">
  489. <th align="left" :colspan="6" >合计</th>
  490. <td :colspan="13" align="left">
  491. {{ moneySum | toChineseAmount }}
  492. </td>
  493. <!-- <td align="center"> -->
  494. <!-- {{ numSum }} -->
  495. <!-- </td> -->
  496. </tr>
  497. <tr class="hang">
  498. <th :colspan="6" align="left">发货金额(人民币)大写:</th>
  499. <td :colspan="13">
  500. {{ moneySum | toChineseAmount }}
  501. </td>
  502. </tr>
  503. <tr height="50px">
  504. <th :colspan="6" align="left">备注:</th>
  505. <td :colspan="13"></td>
  506. </tr>
  507. <!-- <tr class="hang">
  508. <th align="left" :colspan="6">收货人:</th>
  509. <td :colspan="13"></td>
  510. </tr> -->
  511. </table>
  512. </div>
  513. <div class="foot-button" style="margin-top: 40px">
  514. <el-button type="primary" :loading="comfirmLoad" @click="handleConfirm"
  515. >确认</el-button
  516. >
  517. <el-button type="primary" v-print="printObj">打印</el-button>
  518. </div>
  519. </el-dialog>
  520. </div>
  521. </template>
  522. <script>
  523. import ylStep from "@/components/yl-step";
  524. import ylPagination from "@/components/yl-pagination";
  525. import ylUpload from "@/components/yl-upload";
  526. import mcsInfo from "@/views/components/mcs-info.vue";
  527. import { countNumPrice, getTotalAmount } from "@/utils/utils";
  528. import moment from "moment";
  529. import {
  530. getMcsOrdDckDetl,
  531. saveDelvOrd,
  532. finishMcsDelvOrd,
  533. finishDelvOrd,
  534. getBillPage,
  535. submitMcsDelvOrd,
  536. } from "@/api/orderManage-sup/index";
  537. export default {
  538. components: {
  539. ylStep,
  540. ylPagination,
  541. ylUpload,
  542. mcsInfo
  543. },
  544. data() {
  545. return {
  546. pdfSrc: "",
  547. dialogVisible: false,
  548. saveLoad: false,
  549. confirmLoad: false,
  550. endLoad: false,
  551. number: [],
  552. listForm: {
  553. id: "",
  554. detlCnt: "",
  555. orgName: "",
  556. docmker: "",
  557. docmkDate: "",
  558. stas: "",
  559. deptName:"",
  560. branchName:"",
  561. },
  562. stasOptions: [
  563. { value: "A", lable: "未受理" },
  564. { value: "B", lable: "未出库" },
  565. { value: "R", lable: "被驳回" },
  566. { value: "C", lable: "已出库" },
  567. { value: "D", lable: "部分出库" },
  568. { value: "Y", lable: "已入库" },
  569. { value: "P", lable: "部分入库" },
  570. ],
  571. essdrugOptions: ["非基药", "基药"],
  572. tableData: [],
  573. loading: false,
  574. cellList: [],
  575. count: null,
  576. // 选择发票
  577. dialogFa: false,
  578. faForm: {
  579. billType: "invo",
  580. billInfo: "",
  581. billName: "",
  582. current: 1,
  583. size: 10,
  584. },
  585. faLoading: false,
  586. faData: [],
  587. faTotal: 0,
  588. faIndex: "",
  589. // 选择同行单
  590. dialogTong: false,
  591. tongForm: {
  592. billType: "acco",
  593. billInfo: "",
  594. billName: "",
  595. current: 1,
  596. size: 10,
  597. },
  598. tongLoading: false,
  599. tongData: [],
  600. tongTotal: 0,
  601. tongIndex: "",
  602. code: "",
  603. // 出库单预览
  604. printVisible: false,
  605. chuList: [],
  606. // 打印
  607. printObj: {
  608. id: "printMe",
  609. popTitle: "", // 打印配置页上方标题
  610. extraHead: "", //最上方的头部文字,附加在head标签上的额外标签,使用逗号分隔
  611. preview: "", // 是否启动预览模式,默认是false(开启预览模式,可以先预览后打印)
  612. previewTitle: "", // 打印预览的标题(开启预览模式后出现),
  613. previewPrintBtnLabel: "", // 打印预览的标题的下方按钮文本,点击可进入打印(开启预览模式后出现)
  614. zIndex: "", // 预览的窗口的z-index,默认是 20002(此值要高一些,这涉及到预览模式是否显示在最上面)
  615. previewBeforeOpenCallback() {}, //预览窗口打开之前的callback(开启预览模式调用)
  616. previewOpenCallback() {}, // 预览窗口打开之后的callback(开启预览模式调用)
  617. beforeOpenCallback: () => {}, // 开启打印前的回调事件
  618. openCallback() {}, // 调用打印之后的回调事件
  619. closeCallback() {}, //关闭打印的回调事件(无法确定点击的是确认还是取消)
  620. url: "",
  621. standard: "",
  622. extraCss: "",
  623. },
  624. fileIndex:null,
  625. fileIndex1:null,
  626. endBtn:false,
  627. };
  628. },
  629. created() {
  630. this.listForm.id = this.$route.query.id;
  631. // this.listForm.materialId = this.$route.query.materialId;
  632. this.listForm.detlCnt = this.$route.query.detlCnt;
  633. this.listForm.qtySum = this.$route.query.qtySum;
  634. this.listForm.purcAmt = this.$route.query.purcAmt;
  635. this.listForm.docmker = this.$route.query.docmker;
  636. this.listForm.stas = this.$route.query.stas;
  637. this.listForm.docmkDate = this.$route.query.docmkDate;
  638. this.listForm.OutboundDate = moment(new Date()).format("YYYY-MM-DD HH:mm:ss");
  639. this.listForm.branchName = this.$route.query.branchName;
  640. this.listForm.deptName = this.$route.query.deptName;
  641. if(this.listForm.stas=='部分出库'){
  642. this.endBtn = true
  643. }
  644. // this.stasOptions.forEach((i)=>{
  645. // if(i.value == this.$route.query.stas){
  646. // this.listForm.stas = i.lable
  647. // }
  648. // })
  649. // console.log(this.listForm.stas,"listForm.stas")
  650. },
  651. computed: {
  652. numSum: function () {
  653. return this.chuList
  654. .map((row) => row.delvCnt)
  655. .reduce((acc, cur) => (parseFloat(acc) + parseFloat(cur)).toFixed(2), 0);
  656. },
  657. moneySum: function () {
  658. return this.chuList
  659. .map((row) => row.price)
  660. .reduce((acc, cur) => (parseFloat(acc) + parseFloat(cur)).toFixed(2), 0);
  661. },
  662. },
  663. filters: {
  664. toChineseAmount(money) {
  665. var cnNums = ["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"];
  666. var cnIntRadice = ["", "拾", "佰", "仟"];
  667. var cnIntUnits = ["", "万", "亿", "兆"];
  668. var cnDecUnits = ["角", "分", "毫", "厘"];
  669. var cnInteger = "整";
  670. var cnIntLast = "元";
  671. var maxNum = 999999999999999.9999;
  672. var integerNum;
  673. var decimalNum;
  674. var chineseStr = "";
  675. var parts;
  676. if (money === "") {
  677. return "";
  678. }
  679. money = parseFloat(money);
  680. if (money >= maxNum) {
  681. return "";
  682. }
  683. if (money === 0) {
  684. chineseStr = cnNums[0] + cnIntLast + cnInteger;
  685. return chineseStr;
  686. }
  687. money = money.toString();
  688. if (money.indexOf(".") === -1) {
  689. integerNum = money;
  690. decimalNum = "";
  691. } else {
  692. parts = money.split(".");
  693. integerNum = parts[0];
  694. decimalNum = parts[1].substr(0, 4);
  695. }
  696. if (parseInt(integerNum, 10) > 0) {
  697. var zeroCount = 0;
  698. var IntLen = integerNum.length;
  699. for (var i = 0; i < IntLen; i++) {
  700. var n = integerNum.substr(i, 1);
  701. var p = IntLen - i - 1;
  702. var q = p / 4;
  703. var m = p % 4;
  704. if (n === "0") {
  705. zeroCount++;
  706. } else {
  707. if (zeroCount > 0) {
  708. chineseStr += cnNums[0];
  709. }
  710. zeroCount = 0;
  711. chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
  712. }
  713. if (m === 0 && zeroCount < 4) {
  714. chineseStr += cnIntUnits[q];
  715. }
  716. }
  717. chineseStr += cnIntLast;
  718. }
  719. if (decimalNum !== "") {
  720. var decLen = decimalNum.length;
  721. for (i = 0; i < decLen; i++) {
  722. n = decimalNum.substr(i, 1);
  723. if (n !== "0") {
  724. chineseStr += cnNums[Number(n)] + cnDecUnits[i];
  725. }
  726. }
  727. }
  728. if (chineseStr === "") {
  729. chineseStr += cnNums[0] + cnIntLast + cnInteger;
  730. } else if (decimalNum === "") {
  731. chineseStr += cnInteger;
  732. }
  733. return chineseStr;
  734. },
  735. },
  736. mounted() {
  737. this.getData();
  738. },
  739. methods: {
  740. getData() {
  741. this.listLoading = true;
  742. getMcsOrdDckDetl({ id: this.$route.query.id })
  743. .then((res) => {
  744. this.tableData = res.data;
  745. this.chuList = res.data;
  746. this.listLoading = false;
  747. this.computeCell(this.tableData);
  748. this.tableData.forEach((item) => {
  749. if (!item.delvCnt) {
  750. // item.delvCnt = 0;
  751. this.$set(item, "delvCnt", 0);
  752. }
  753. item.essdrugType = this.essdrugOptions[item.essdrugType * 1];
  754. });
  755. // 将待出库数量放入number数组
  756. // this.number = this.tableData.map((i)=>{
  757. // return i.toDelvCnt
  758. // })
  759. })
  760. .catch((err) => {
  761. this.listLoading = false;
  762. });
  763. },
  764. // 出库数量变更
  765. updateNum(row, index) {
  766. // const aa = this.tableData.findIndex((item) => item.id === row.id);
  767. // if(this.number[aa]){
  768. // this.shanchu2(row,aa);
  769. // }else{
  770. // this.shanchu(row);
  771. // }
  772. this.shanchu3(row);
  773. this.numOrPriceChange(index, row);
  774. },
  775. numOrPriceChange(index, row) {
  776. this.$set(
  777. this.tableData[index],
  778. "price",
  779. getTotalAmount(row.delvCnt, row.purcPric)
  780. );
  781. this.amount = countNumPrice(this.tableData);
  782. },
  783. //获取出库数量和
  784. numAll(row) {
  785. let num = 0;
  786. this.tableData.forEach((item) => {
  787. if (item.materialId == row.materialId) {
  788. num += item.delvCnt;
  789. }
  790. });
  791. return num;
  792. },
  793. //公共函数
  794. shanchu(row) {
  795. this.tableData.forEach(async (item) => {
  796. await this.numAll(row);
  797. console.log(this.numAll(row), "he");
  798. if (item.id == row.id) {
  799. if (this.numAll(row) > item.purcCnt) {
  800. this.$message.info("出库数量不能大于订货数");
  801. row.delvCnt = 0;
  802. item.toDelvCnt = item.purcCnt - this.numAll(row);
  803. return;
  804. }
  805. item.toDelvCnt = item.purcCnt - this.numAll(row);
  806. }
  807. let choose = this.tableData;
  808. this.tableData = choose;
  809. });
  810. },
  811. shanchu2(row, index) {
  812. this.tableData.forEach(async (item) => {
  813. await this.numAll(row);
  814. console.log(this.numAll(row), "he");
  815. if (item.id == row.id) {
  816. if (this.numAll(row) > this.number[index]) {
  817. this.$message.info("出库数量不能大于待出库数量");
  818. row.delvCnt = 0;
  819. row.toDelvCnt = this.number[index];
  820. item.toDelvCnt = this.number[index] - this.numAll(row);
  821. return;
  822. }
  823. item.toDelvCnt = this.number[index] - this.numAll(row);
  824. }
  825. let choose = this.tableData;
  826. this.tableData = choose;
  827. });
  828. },
  829. shanchu3(row) {
  830. this.tableData.forEach(async (item) => {
  831. await this.numAll(row);
  832. console.log(this.numAll(row), "he");
  833. if (item.materialId == row.materialId) {
  834. if (this.numAll(row) > item.toDelvCnt) {
  835. this.$message.warning("出库数量不能大于待出库数量");
  836. row.delvCnt = 0;
  837. row.price = 0;
  838. return;
  839. }
  840. }
  841. let choose = this.tableData;
  842. this.tableData = choose;
  843. });
  844. },
  845. // 预览文件
  846. dataURLtoBlob(e) {
  847. let bstr = atob(e);
  848. let n = bstr.length;
  849. let u8arr = new Uint8Array(n);
  850. while (n--) {
  851. u8arr[n] = bstr.charCodeAt(n);
  852. } //确定解析格式
  853. let blob = new Blob([u8arr], { type: "application/pdf;chartset=UTF-8" });
  854. let url = window.URL.createObjectURL(blob);
  855. return url;
  856. },
  857. // 详情
  858. openPdf(row) {
  859. // let file = {
  860. // id: row.fileId,
  861. // };
  862. // uploadCheck(file).then((res) => {
  863. // if (res.success == true) {
  864. // this.dialogVisible = true;
  865. // const a = this.dataURLtoBlob(res.data.fileContent);
  866. // this.pdfSrc = a;
  867. // }
  868. // });
  869. },
  870. // 添加批次
  871. handleBatch(row, index) {
  872. let list = {
  873. prodCode:row.prodCode,
  874. regcertno:row.regcertno,
  875. delvCnt: "",
  876. delvCntYck:row.delvCntYck,
  877. docmkDate:row.docmkDate,
  878. docmker:row.docmker,
  879. essdrugType:row.essdrugType,
  880. prodEntp: row.prodEntp,
  881. materialId: row.materialId,
  882. prodName: row.prodName,
  883. hiCode:row.hiCode,
  884. mol: row.mol,
  885. matl: row.matl,
  886. memo:row.memo,
  887. mcsType:row.mcsType,
  888. purcPric: row.purcPric,
  889. purcAmt: row.purcAmt,
  890. purcCnt: row.purcCnt,
  891. prodSouc:row.prodSouc,
  892. spec: row.spec,
  893. toDelvCnt: row.toDelvCnt,
  894. invoFileId: "",
  895. lotNum: "",
  896. manuDate: "",
  897. prodExpy: "",
  898. dyntFileId: "",
  899. };
  900. this.tableData.splice(index + 1, 0, list);
  901. list.showDeleteButton = true;
  902. this.computeCell(this.tableData);
  903. console.log(this.tableData,"tableData")
  904. // const aa = this.tableData.findIndex((item) => item.id === row.id);
  905. // this.number.splice(aa+1,0,this.number[aa])
  906. },
  907. // 筛选合并项
  908. computeCell(tableData) {
  909. this.cellList = [];
  910. this.count = null;
  911. for (let i = 0; i < tableData.length; i++) {
  912. if (i == 0) {
  913. // 先设置第一项
  914. this.cellList.push(1); // 初为1,若下一项和此项相同,就往cellList数组中追加0
  915. this.count = 0;
  916. console.log("索引", 0, this.count);
  917. } else {
  918. // 判断当前项与上项的设备类别是否相同,因为是合并这一列的单元格
  919. if (tableData[i].materialId == tableData[i - 1].materialId) {
  920. this.cellList[this.count] += 1; // 增加计数
  921. this.cellList.push(0); // 相等就往cellList数组中追加0
  922. console.log("索引", i, this.count);
  923. } else {
  924. this.cellList.push(1); // 不等就往cellList数组中追加1
  925. this.count = i; // 将索引赋值为计数
  926. console.log("索引", i, this.count);
  927. }
  928. }
  929. }
  930. },
  931. // 合并列
  932. handleSpan({ row, column, rowIndex, columnIndex }) {
  933. if (
  934. columnIndex === 1 ||
  935. columnIndex === 2 ||
  936. columnIndex === 3 ||
  937. columnIndex === 4 ||
  938. columnIndex === 5 ||
  939. columnIndex === 6 ||
  940. columnIndex === 7 ||
  941. columnIndex === 8 ||
  942. columnIndex === 9 ||
  943. columnIndex === 10 ||
  944. columnIndex === 11 ||
  945. columnIndex === 15 ||
  946. columnIndex === 16 ||
  947. columnIndex === 17
  948. ) {
  949. // console.log("单元格数组,若下一项为0,则代表合并上一项", this.cellList);
  950. const rowCell = this.cellList[rowIndex];
  951. if (rowCell > 0) {
  952. const colCell = 1;
  953. // console.log(`动态竖向合并单元格, 第${colCell}列,竖向合并${rowCell}个单元格 `);
  954. return {
  955. rowspan: rowCell,
  956. colspan: colCell,
  957. };
  958. } else {
  959. // 清除原有的单元格,必须要加,否则就会出现单元格会被横着挤到后面了!!!
  960. // 本例中数据是写死的不会出现,数据若是动态后端获取的,就会出现了!!!
  961. return {
  962. rowspan: 0,
  963. colspan: 0,
  964. };
  965. }
  966. }
  967. // if (columnIndex === 2 && rowIndex == 0) {
  968. // return {
  969. // rowspan: this.pos,
  970. // colspan: 1
  971. // };
  972. // }else{
  973. // for(let i=1;i<this.pos;i++){
  974. // if(rowIndex === this.pos-i && columnIndex == 2){
  975. // return {
  976. // rowspan: 0,
  977. // colspan: 0
  978. // };
  979. // }
  980. // }
  981. // }
  982. },
  983. //删除
  984. handleDelete(row, i) {
  985. const index = this.tableData.findIndex((item) => item.materialId === row.materialId);
  986. if (index !== -1) {
  987. let qwe = this.tableData.findIndex(function (item) {
  988. return item.materialId == row.materialId;
  989. });
  990. this.tableData.splice(i, 1);
  991. this.cellList.splice(i, 1);
  992. this.cellList[qwe]--;
  993. }
  994. row.showDeleteButton = false;
  995. this.shanchu3(row);
  996. // if(this.number[index]){
  997. // this.shanchu2(row,index);
  998. // }else{
  999. // this.shanchu(row);
  1000. // }
  1001. // this.number.splice(i,1);
  1002. },
  1003. getUpload1(id,index) {
  1004. this.tableData[index].invoFileId = id
  1005. if (id) {
  1006. this.$refs.tabledata.clearValidate("invoFileId");
  1007. } else {
  1008. this.$refs.tabledata.validateField("invoFileId");
  1009. }
  1010. },
  1011. getUpload(id,index) {
  1012. this.tableData[index].dyntFileId = id
  1013. if (id) {
  1014. this.$refs.tabledata.clearValidate("dyntFileId");
  1015. } else {
  1016. this.$refs.tabledata.validateField("dyntFileId");
  1017. }
  1018. },
  1019. // 获取发票信息
  1020. getFaData(type) {
  1021. if (type == "search") {
  1022. this.faForm.current = 1;
  1023. }
  1024. this.faLoading = true;
  1025. getBillPage(this.faForm)
  1026. .then((res) => {
  1027. this.faData = res.data.records;
  1028. this.faTotal = res.data.total;
  1029. this.faLoading = false;
  1030. })
  1031. .catch((err) => {
  1032. this.faLoading = false;
  1033. });
  1034. // this.faData = [{aa:"资质文件.pdf",bb:"1111"},{aa:"出库文件.pdf",bb:"2222"}];
  1035. // this.faTotal = 1
  1036. },
  1037. faReset() {
  1038. this.$refs.faForm.resetFields();
  1039. this.getFaData();
  1040. },
  1041. // 选择发票
  1042. handleFa(e, row) {
  1043. this.faIndex = e;
  1044. this.dialogFa = true;
  1045. this.getFaData();
  1046. this.code = "";
  1047. this.code = row.id;
  1048. },
  1049. // 选择发票 确认选择
  1050. handleRow(row) {
  1051. this.tableData[this.faIndex].invoFileId = row.fileId;
  1052. // this.tableData.forEach((i)=>{
  1053. // if(i.id == this.code){
  1054. // i.invoFileId = row.fileId
  1055. // }
  1056. // })
  1057. this.computeCell(this.tableData);
  1058. this.dialogFa = false;
  1059. },
  1060. // 获取同行单信息
  1061. getTongData(type) {
  1062. if (type == "search") {
  1063. this.tongForm.current = 1;
  1064. }
  1065. this.tongLoading = true;
  1066. getBillPage(this.tongForm)
  1067. .then((res) => {
  1068. this.tongData = res.data.records;
  1069. this.tongTotal = res.data.total;
  1070. this.tongLoading = false;
  1071. })
  1072. .catch((err) => {
  1073. this.tongLoading = false;
  1074. });
  1075. // this.tongData = [{aa:"资质文件.pdf",bb:"1111"},{aa:"出库文件.pdf",bb:"2222"}];
  1076. // this.tongTotal = 1
  1077. },
  1078. tongReset() {
  1079. this.$refs.tongForm.resetFields();
  1080. this.getTongData();
  1081. },
  1082. // 选择同行单
  1083. handleTong(e, row) {
  1084. this.tongIndex = e;
  1085. this.dialogTong = true;
  1086. this.getTongData();
  1087. this.code = "";
  1088. this.code = row.id;
  1089. },
  1090. // 选择同行单 确认选择
  1091. handleRowTong(row) {
  1092. // this.tableData[this.tongIndex].dyntFileId = row.fileId;
  1093. this.tableData.forEach((i) => {
  1094. if (i.id == this.code) {
  1095. i.dyntFileId = row.fileId;
  1096. }
  1097. });
  1098. this.computeCell(this.tableData);
  1099. this.dialogTong = false;
  1100. },
  1101. // 出库
  1102. handleDelivery() {
  1103. this.tableData.forEach((item) => {
  1104. // console.log(item, "item");
  1105. if (item.delvCnt=='0') {
  1106. this.$message({
  1107. message: "本次出库数量必须大于0",
  1108. type: "warning",
  1109. });
  1110. throw new Error("本次出库数量必须大于0");
  1111. }
  1112. if (item.prodSouc=="进口" && !item.invoFileId) {
  1113. this.$message({
  1114. // message: "请填写相应信息,并选择报关单和随货单",
  1115. message: "请填写相应信息,并选择报关单",
  1116. type: "warning",
  1117. });
  1118. throw new Error("请填写相应信息,并选择报关单");
  1119. }
  1120. });
  1121. this.$refs.tabledata.validate((valid) => {
  1122. if (valid) {
  1123. this.$confirm("确认出库", "提示", {
  1124. confirmButtonText: "确定",
  1125. cancelButtonText: "取消",
  1126. type: "warning",
  1127. }).then(() => {
  1128. this.printVisible = true;
  1129. });
  1130. } else {
  1131. this.$message({
  1132. type: "warning",
  1133. message: "请填写必填项信息",
  1134. });
  1135. }
  1136. });
  1137. },
  1138. // 出库确认
  1139. handleConfirm() {
  1140. console.log(this.tableData,"this.tableData")
  1141. this.$confirm("确认出库", "提示", {
  1142. confirmButtonText: "确定",
  1143. cancelButtonText: "取消",
  1144. type: "warning",
  1145. }).then(() => {
  1146. let data = this.tableData.map((i) => {
  1147. console.log(i,"1111")
  1148. return {
  1149. materialId: i.prodCode,
  1150. memo:i.memo,
  1151. delvCnt: i.delvCnt,
  1152. hiCode:i.hiCode,
  1153. delvPric:i.purcPric,
  1154. lotNum: i.lotNum,
  1155. manuDate: i.manuDate,
  1156. prodExpy: i.prodExpy,
  1157. invoFileId: i.invoFileId,
  1158. dyntFileId: i.dyntFileId,
  1159. noRow:i.index
  1160. };
  1161. });
  1162. let data2 = {
  1163. delvOrdId: "",
  1164. purcOrdId: this.$route.query.id,
  1165. detlList: data,
  1166. deptId: this.$route.query.deptId,
  1167. spdId: this.$route.query.spdId,
  1168. deptName: this.$route.query.deptName,
  1169. };
  1170. console.log(data, "data");
  1171. submitMcsDelvOrd(data2)
  1172. .then((res) => {
  1173. this.printVisible = false;
  1174. this.$router.push("purOrderDelivery");
  1175. })
  1176. .catch((err) => {
  1177. // this.confirmLoadLoad = false;
  1178. });
  1179. });
  1180. },
  1181. // 保存
  1182. handleSave() {
  1183. let data = this.tableData.map((i) => {
  1184. return {
  1185. drugListId: i.drugListId,
  1186. delvCnt: i.delvCnt,
  1187. lotNum: i.lotNum,
  1188. manuDate: i.manuDate,
  1189. prodExpy: i.prodExpy,
  1190. invoFileId: i.invoFileId,
  1191. dyntFileId: i.dyntFileId,
  1192. };
  1193. });
  1194. let data2 = {
  1195. delvOrdId: "",
  1196. purcOrdId: this.$route.query.id,
  1197. detlList: data,
  1198. };
  1199. console.log(data, "data");
  1200. this.saveLoad = true;
  1201. saveDelvOrd(data2)
  1202. .then((res) => {
  1203. this.saveLoad = false;
  1204. })
  1205. .catch((err) => {
  1206. this.saveLoad = false;
  1207. });
  1208. },
  1209. // 结束订单
  1210. handleOrderEnd() {
  1211. // console.log(this.tableData, "tanleData");
  1212. // this.tableData.forEach((item) => {
  1213. // if (!item.invoFileId || !item.dyntFileId) {
  1214. // this.$message({
  1215. // message: "请填写相应信息,并选择发票和同行单",
  1216. // type: "warning",
  1217. // });
  1218. // throw new Error("请填写相应信息,并选择发票和同行单");
  1219. // }
  1220. // });
  1221. // this.$refs.tabledata.validate((valid) => {
  1222. // if (valid) {
  1223. this.$confirm("确认结束订单", "提示", {
  1224. confirmButtonText: "确定",
  1225. cancelButtonText: "取消",
  1226. type: "warning",
  1227. }).then(() => {
  1228. let data = {
  1229. delvOrdId: this.$route.query.id,
  1230. };
  1231. this.endLoad = true;
  1232. finishMcsDelvOrd(data)
  1233. .then((res) => {
  1234. this.endLoad = false;
  1235. this.$router.push({
  1236. name: "purOrderDelivery",
  1237. });
  1238. })
  1239. .catch((err) => {
  1240. this.endLoad = false;
  1241. });
  1242. });
  1243. // } else {
  1244. // this.$message({
  1245. // type: "warning",
  1246. // message: "请填写必填项信息",
  1247. // });
  1248. // }
  1249. // });
  1250. },
  1251. // 返回
  1252. handleBack(){
  1253. this.$router.push({
  1254. name: "purOrderDelivery",
  1255. query:{spdId:this.$route.query.spdId,activeName:this.$route.query.activeName}
  1256. });
  1257. }
  1258. },
  1259. };
  1260. </script>
  1261. <style lang="scss" scoped>
  1262. ::v-deep .el-table__body tr.hover-row > td {
  1263. background-color: transparent !important;
  1264. }
  1265. ::v-deep .el-table {
  1266. th.el-table__cell.is-leaf,
  1267. td.el-table__cell {
  1268. border-bottom: 1px solid #eee;
  1269. }
  1270. }
  1271. ::v-deep .dd .el-dialog {
  1272. height: 90%;
  1273. margin-top: 30px !important;
  1274. }
  1275. ::v-deep .dd .el-dialog__body {
  1276. height: 90%;
  1277. padding: 0 25px 0px;
  1278. }
  1279. .chuTable {
  1280. color: #000;
  1281. }
  1282. .hang {
  1283. height: 30px;
  1284. }
  1285. </style>