deliveryDetail.vue 42 KB

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