Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

drugStockOutOrder.vue 40KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. <el-button
  6. size="small"
  7. @click="AddNewOrder"
  8. class="filter-item"
  9. style="float:right;"
  10. type="primary"
  11. icon="el-icon-circle-plus-outline"
  12. >新增</el-button>
  13. </div>
  14. <div class="app-container">
  15. <div class="cell clearfix">
  16. <el-input
  17. size="small"
  18. style="width: 400px;"
  19. class="filter-item"
  20. v-model.trim="searchKey"
  21. placeholder="单据编码/制单人/厂商"
  22. />
  23. <el-button
  24. size="small"
  25. class="filter-item"
  26. type="primary"
  27. icon="el-icon-search"
  28. @click="search"
  29. >搜索</el-button
  30. >
  31. <div style="margin-left:10px;">
  32. <label class="title"><span class="name">出库时间</span> : </label>
  33. <el-date-picker
  34. size="small"
  35. v-model="start_time"
  36. prefix-icon="el-icon-date"
  37. :editable="false"
  38. style="width: 196px;"
  39. type="date"
  40. placeholder="选择日期时间"
  41. align="right"
  42. format="yyyy-MM-dd"
  43. value-format="yyyy-MM-dd"
  44. @change="startTimeChange"
  45. ></el-date-picker>
  46. <span class="cellLine"> - </span>
  47. <el-date-picker
  48. size="small"
  49. v-model="end_time"
  50. prefix-icon="el-icon-date"
  51. :editable="false"
  52. style="width: 196px;"
  53. type="date"
  54. placeholder="选择日期时间"
  55. align="right"
  56. format="yyyy-MM-dd"
  57. value-format="yyyy-MM-dd"
  58. @change="endTimeChange"
  59. ></el-date-picker>
  60. </div>
  61. </div>
  62. <div class="cell clearfix">
  63. <el-checkbox
  64. style="width: 70px"
  65. v-model="checked"
  66. @change="changeAllSelected"
  67. >全选</el-checkbox
  68. >
  69. <el-button size="small" icon="el-icon-delete" @click="batchDelete">删除</el-button>
  70. <el-button size="small" type="primary" @click="toPrint">打印</el-button>
  71. <el-button size="small" type="primary" @click="toExport">导出</el-button>
  72. </div>
  73. <el-table
  74. @current-change="handleSearch"
  75. :data="warehouseOutDate"
  76. :class="signAndWeighBoxPatients"
  77. style="width: 100%"
  78. border
  79. highlight-current-row
  80. ref="multipleTable"
  81. @selection-change="select"
  82. :row-style="{ color: '#303133' }"
  83. :header-cell-style="{
  84. backgroundColor: 'rgb(245, 247, 250)',
  85. color: '#606266'
  86. }"
  87. >
  88. <el-table-column type="selection" width="55" align="center"> </el-table-column>
  89. <el-table-column label="单据日期" align="center">
  90. <template slot-scope="scope">
  91. {{ scope.row.warehouse_out_time | parseTime("{y}-{m}-{d}") }}
  92. </template>
  93. </el-table-column>
  94. <el-table-column label="单据编号" align="center">
  95. <template slot-scope="scope">
  96. {{ scope.row.warehouse_out_order_number }}
  97. </template>
  98. </el-table-column>
  99. <el-table-column label="制单人" align="center">
  100. <template slot-scope="scope">
  101. {{ getXuserName(scope.row.creater) }}
  102. </template>
  103. </el-table-column>
  104. <el-table-column min-width="35" align="center">
  105. <template slot="header" slot-scope="scope">
  106. <span>出库方式</span>
  107. </template>
  108. <template slot-scope="scope">
  109. <span v-if="scope.row.is_sys == 1">{{"自动出库"}}</span>
  110. <span v-if="scope.row.is_sys != 1">{{"手动出库"}}</span>
  111. </template>
  112. </el-table-column>
  113. <!-- <el-table-column label="厂家" align="center">
  114. <template slot-scope="scope">
  115. {{scope.row.manufacturers ? scope.row.manufacturers.manufacturer_name:''}}
  116. </template>
  117. </el-table-column>
  118. <el-table-column label="经销商" align="center">
  119. <template slot-scope="scope">
  120. {{scope.row.dealers ? scope.row.dealers.dealer_name:''}}
  121. </template>
  122. </el-table-column> -->
  123. <el-table-column label="操作" align="center" width="240">
  124. <template slot-scope="scope">
  125. <el-tooltip
  126. class="item"
  127. effect="dark"
  128. content="编辑"
  129. placement="top"
  130. >
  131. <el-button
  132. size="mini"
  133. type="primary"
  134. icon="el-icon-edit-outline"
  135. @click="handleEdit(scope.$index, scope.row)"
  136. >
  137. </el-button>
  138. </el-tooltip>
  139. <el-tooltip
  140. class="item"
  141. effect="dark"
  142. content="删除"
  143. placement="top"
  144. >
  145. <el-button
  146. size="mini"
  147. type="danger"
  148. :disabled="scope.row.is_sys == 1"
  149. icon="el-icon-delete"
  150. @click="handleDelete(scope.$index, scope.row)"
  151. >
  152. </el-button>
  153. </el-tooltip>
  154. </template>
  155. </el-table-column>
  156. </el-table>
  157. <el-pagination
  158. @size-change="handleSizeChange"
  159. @current-change="handleCurrentChange"
  160. :page-sizes="[5, 10, 50, 100]"
  161. :page-size="5"
  162. background
  163. style="margin-top:20px;text-align: right"
  164. layout="total, sizes, prev, pager, next, jumper"
  165. :total="total"
  166. >
  167. </el-pagination>
  168. <!-- 使用详情 -->
  169. <div v-show="tableShow" style="margin-top:10px">
  170. <el-table
  171. :data="tableList"
  172. :class="signAndWeighBoxPatients"
  173. style="width: 100%"
  174. border
  175. highlight-current-row
  176. ref="multipleTableOne"
  177. @selection-change="select"
  178. :row-style="{ color: '#303133' }"
  179. :header-cell-style="{
  180. backgroundColor: 'rgb(245, 247, 250)',
  181. color: '#606266'
  182. }"
  183. >
  184. <el-table-column label="药品名称" align="center">
  185. <template slot-scope="scope">
  186. {{scope.row.drug_name}}
  187. </template>
  188. </el-table-column>
  189. <el-table-column label="药品类型" align="center">
  190. <template slot-scope="scope">
  191. {{getDrugType(scope.row.drug_type)}}
  192. </template>
  193. </el-table-column>
  194. <el-table-column label="规格&单位" align="center">
  195. <template slot-scope="scope">
  196. {{scope.row.dose}}&nbsp;{{scope.row.dose_unit}}*{{scope.row.min_number}}{{scope.row.min_unit}}/{{scope.row.max_unit}}
  197. </template>
  198. </el-table-column>
  199. <el-table-column label="国家编码" align="center">
  200. <template slot-scope="scope">
  201. {{scope.row.medical_insurance_number}}
  202. </template>
  203. </el-table-column>
  204. <el-table-column label="出库数量" align="center">
  205. <template slot-scope="scope">
  206. <!-- <span v-if="scope.row.is_sys == 0">{{getTotalCount(scope.row.drug_id,scope.row.min_number,scope.row.max_unit,scope.row.min_unit)}}</span> -->
  207. <span> {{getTotalCountOne(scope.row.drug_id,scope.row.min_number,scope.row.max_unit,scope.row.min_unit)}}</span>
  208. </template>
  209. </el-table-column>
  210. <el-table-column label="出货单价" align="center">
  211. <template slot-scope="scope">
  212. {{scope.row.price}}
  213. </template>
  214. </el-table-column>
  215. <!-- <el-table-column label="拆零零售价" align="center">
  216. <template slot-scope="scope">
  217. {{scope.row.retail_price}}
  218. </template>
  219. </el-table-column> -->
  220. <el-table-column label="总价" align="center">
  221. <template slot-scope="scope">
  222. <span>{{getAllPriceOne(scope.row.drug_id,scope.row.price,scope.row.min_price).toFixed(2)}}</span>
  223. </template>
  224. </el-table-column>
  225. <el-table-column label="生产厂家" align="center">
  226. <template slot-scope="scope">
  227. {{getManufacturerName(scope.row.manufacturer)}}
  228. </template>
  229. </el-table-column>
  230. <el-table-column label="生产日期" align="center">
  231. <template slot-scope="scope">
  232. {{getTime(scope.row.product_date)}}
  233. </template>
  234. </el-table-column>
  235. <el-table-column label="有效日期" align="center">
  236. <template slot-scope="scope">
  237. {{getTime(scope.row.expiry_date)}}
  238. </template>
  239. </el-table-column>
  240. <el-table-column label="经销商" align="center">
  241. <template slot-scope="scope">
  242. {{getDealerName(scope.row.dealer)}}
  243. </template>
  244. </el-table-column>
  245. <el-table-column label="批准文号" align="center">
  246. <template slot-scope="scope">
  247. <span v-if="scope.row.number!=''">{{scope.row.number}}</span>
  248. <span v-if="scope.row.number == '0'"></span>
  249. </template>
  250. </el-table-column>
  251. <el-table-column label="备注" align="center">
  252. <template slot-scope="scope">
  253. {{scope.row.remark}}
  254. </template>
  255. </el-table-column>
  256. <el-table-column label="操作" align="center">
  257. <template slot-scope="scope">
  258. <span style="color: #589ff8" @click="toDetail(scope.row)">使用明细</span>
  259. </template>
  260. </el-table-column>
  261. </el-table>
  262. </div>
  263. </div>
  264. <el-dialog
  265. title="提示"
  266. :visible.sync="drugDialogVisible"
  267. width="90%">
  268. <span>
  269. <el-table :data="userList" :class="signAndWeighBoxPatients" style="width: 50%"
  270. border :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  271. >
  272. <el-table-column min-width="35" align="center">
  273. <template slot="header" slot-scope="scope">
  274. <span>序号</span>
  275. </template>
  276. <template slot-scope="scope">
  277. {{scope.$index+1}}
  278. </template>
  279. </el-table-column>
  280. <el-table-column min-width="35" align="center">
  281. <template slot="header" slot-scope="scope">
  282. <span>使用人</span>
  283. </template>
  284. <template slot-scope="scope">
  285. {{scope.row.user.name}}
  286. </template>
  287. </el-table-column>
  288. <el-table-column min-width="35" align="center">
  289. <template slot="header" slot-scope="scope">
  290. <span>使用数量</span>
  291. </template>
  292. <template slot-scope="scope">
  293. <span >{{scope.row.count}}{{scope.row.count_unit}}</span>
  294. </template>
  295. </el-table-column>
  296. <el-table-column min-width="35" align="center">
  297. <template slot="header" slot-scope="scope">
  298. <span>使用时间</span>
  299. </template>
  300. <template slot-scope="scope">
  301. <span>{{scope.row.ctime | parseTime('{y}-{m}-{d} {h}:{i}')}} </span>
  302. </template>
  303. </el-table-column>
  304. </el-table>
  305. </span>
  306. <span slot="footer" class="dialog-footer">
  307. <el-button @click="drugDialogVisible = false">取 消</el-button>
  308. <el-button type="primary" @click="drugDialogVisible = false">确 定</el-button>
  309. </span>
  310. </el-dialog>
  311. <el-dialog
  312. title="提示"
  313. :visible.sync="drugDialogVisibleTwo"
  314. width="90%">
  315. <span>
  316. <el-table :data="userListOne" :class="signAndWeighBoxPatients" style="width: 50%"
  317. border :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  318. >
  319. <el-table-column min-width="35" align="center">
  320. <template slot="header" slot-scope="scope">
  321. <span>序号</span>
  322. </template>
  323. <template slot-scope="scope">
  324. {{scope.$index+1}}
  325. </template>
  326. </el-table-column>
  327. <el-table-column min-width="35" align="center">
  328. <template slot="header" slot-scope="scope">
  329. <span>使用人</span>
  330. </template>
  331. <template slot-scope="scope">
  332. <span>系统</span>
  333. </template>
  334. </el-table-column>
  335. <el-table-column min-width="35" align="center">
  336. <template slot="header" slot-scope="scope">
  337. <span>使用数量</span>
  338. </template>
  339. <template slot-scope="scope">
  340. {{scope.row.count}}{{scope.row.count_unit}}
  341. </template>
  342. </el-table-column>
  343. <el-table-column min-width="35" align="center">
  344. <template slot="header" slot-scope="scope">
  345. <span>使用时间</span>
  346. </template>
  347. <template slot-scope="scope">
  348. <span>{{scope.row.ctime | parseTime('{y}-{m}-{d} {h}:{i}')}} </span>
  349. </template>
  350. </el-table-column>
  351. </el-table>
  352. </span>
  353. <span slot="footer" class="dialog-footer">
  354. <el-button @click="drugDialogVisibleTwo = false">取 消</el-button>
  355. <el-button type="primary" @click="drugDialogVisibleTwo = false">确 定</el-button>
  356. </span>
  357. </el-dialog>
  358. </div>
  359. </template>
  360. <script>
  361. import { uParseTime } from "@/utils/tools";
  362. import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from "@/api/doctor";
  363. import {
  364. deleteDrugWarehouseOut,
  365. GetAllConfig,
  366. getDrugWarehouseOutList,
  367. getDrugWarehouseOutUser,
  368. getDrugAutoMaticList,
  369. getSinleOrderDetail,
  370. getAutoDrugDetail,
  371. getDrugCountList,
  372. getExportOutOrderDrugList
  373. } from "@/api/drug/drug_stock";
  374. import BreadCrumb from "../../components/bread-crumb";
  375. import { getInitializtion } from '@/api/stock'
  376. export default {
  377. name: "salesReturnOrder",
  378. components: { BreadCrumb },
  379. created() {
  380. var nowDate = new Date();
  381. var nowYear = nowDate.getFullYear();
  382. var nowMonth = nowDate.getMonth() + 1;
  383. var nowDay = nowDate.getDate();
  384. this.end_time =
  385. nowYear +
  386. "-" +
  387. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  388. "-" +
  389. (nowDay < 10 ? "0" + nowDay : nowDay);
  390. nowDate.setMonth(nowDate.getMonth() - 1);
  391. nowYear = nowDate.getFullYear();
  392. nowMonth = nowDate.getMonth() + 1;
  393. nowDay = nowDate.getDate();
  394. this.start_time =
  395. nowYear +
  396. "-" +
  397. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  398. "-" +
  399. (nowDay < 10 ? "0" + nowDay : nowDay);
  400. this.GetWarehouseOut();
  401. this.fetchAllAdminUsers();
  402. this.getDrugCountList()
  403. this.getInitializtion()
  404. },
  405. data() {
  406. return {
  407. searchKey: "",
  408. crumbs: [
  409. { path: false, name: "库存管理" },
  410. { path: false, name: "出库单" }
  411. ],
  412. page: 1,
  413. limit: 5,
  414. checked: false,
  415. total: 0,
  416. pageTotal: 0,
  417. pageSelect: 0,
  418. adminUserOptions: [],
  419. multipleSelection: [],
  420. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  421. start_time: "",
  422. warehouseOutDate: [],
  423. end_time: "",
  424. goodType: [],
  425. goodInfo: [],
  426. manufacturer: [],
  427. selectedTableData: [],
  428. dealer: [],
  429. type: 1,
  430. dialogVisible:false,
  431. dialogVisibleTwo:false,
  432. warehousingOutInfo: {
  433. loading: false,
  434. warehousingOutData: [],
  435. info: {}
  436. },
  437. userList:[],
  438. list:[],
  439. drugConfig:{},
  440. drugList:[],
  441. tableList:[],
  442. drugTypeList:[],
  443. tableShow:false,
  444. manufacturerList:[],
  445. drugDialogVisible:false,
  446. drugDialogVisibleTwo:false,
  447. order_id:0,
  448. dealerList:[],
  449. countList:[],
  450. outCountList:[],
  451. autoCountList:[],
  452. keyword:"",
  453. drug_type:0,
  454. minCount:[],
  455. drugOutList:[],
  456. outList:[],
  457. userListOne:[],
  458. exportList:[],
  459. batchNumberList:[],
  460. drugFlowList:[],
  461. };
  462. },
  463. methods: {
  464. search: function() {
  465. const Params = {
  466. page: this.page,
  467. limit: this.limit,
  468. start_time: this.start_time,
  469. end_time: this.end_time,
  470. type: this.type,
  471. keywords: this.searchKey
  472. };
  473. this.warehouseOutDate = [];
  474. getDrugWarehouseOutList(Params).then(response => {
  475. if (response.data.state == 0) {
  476. this.$message.error(response.data.msg);
  477. return false;
  478. } else {
  479. this.total = response.data.data.total;
  480. for (let i = 0; i < response.data.data.list.length; i++) {
  481. this.warehouseOutDate.push(response.data.data.list[i]);
  482. }
  483. }
  484. });
  485. },
  486. AddNewOrder: function() {
  487. this.$router.push({
  488. name: "drugStockOutOrderAdd",
  489. query: { type: this.type }
  490. });
  491. },
  492. GetWarehouseOut: function() {
  493. const Params = {
  494. page: this.page,
  495. limit: this.limit,
  496. start_time: this.start_time,
  497. end_time: this.end_time,
  498. type: this.type,
  499. keywords: this.searchKey
  500. };
  501. this.warehouseOutDate = [];
  502. getDrugWarehouseOutList(Params).then(response => {
  503. if (response.data.state == 0) {
  504. this.$message.error(response.data.msg);
  505. return false;
  506. } else {
  507. this.total = response.data.data.total;
  508. for (let i = 0; i < response.data.data.list.length; i++) {
  509. this.warehouseOutDate.push(response.data.data.list[i]);
  510. }
  511. }
  512. });
  513. },
  514. getXuserName(id) {
  515. if (id <= 0) {
  516. return "";
  517. }
  518. var name = "";
  519. if (
  520. this.adminUserOptions == null ||
  521. typeof this.adminUserOptions.length === "undefined"
  522. ) {
  523. return name;
  524. }
  525. var leng = this.adminUserOptions.length;
  526. if (leng == 0) {
  527. return name;
  528. }
  529. for (let index = 0; index < leng; index++) {
  530. if (this.adminUserOptions[index].id == id) {
  531. name = this.adminUserOptions[index].name;
  532. break;
  533. }
  534. }
  535. return name;
  536. },
  537. fetchAllAdminUsers() {
  538. fetchAllAdminUsers().then(response => {
  539. if (response.data.state == 1) {
  540. this.adminUserOptions = response.data.data.users;
  541. var alen = this.adminUserOptions.length;
  542. for (let index = 0; index < alen; index++) {
  543. if (this.adminUserOptions[index].user_type == 2) {
  544. // this.doctorOptions.push(this.adminUserOptions[index]);
  545. }
  546. }
  547. }
  548. });
  549. },
  550. handleSelectionChange: function(val) {
  551. this.multipleSelection = val;
  552. },
  553. handleSizeChange(val) {
  554. this.limit = val;
  555. this.GetWarehouseOut();
  556. },
  557. handleCurrentChange(val) {
  558. this.page = val;
  559. this.GetWarehouseOut();
  560. },
  561. startTimeChange(val) {
  562. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  563. if (time > 0) {
  564. this.$message.error("结束时间不能小于开始时间");
  565. this.start_time = "";
  566. } else {
  567. this.GetWarehouseOut();
  568. }
  569. },
  570. endTimeChange(val) {
  571. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  572. if (time < 0) {
  573. this.$message.error("结束时间不能小于开始时间");
  574. this.end_time = "";
  575. } else {
  576. this.GetWarehouseOut();
  577. }
  578. },
  579. getTimestamp(time) {
  580. // 把时间日期转成时间戳
  581. return new Date(time).getTime() / 1000;
  582. },
  583. calculate: function(val) {
  584. return Math.round(parseFloat(val) * 100) / 100;
  585. },
  586. GetConfigInfo: function() {
  587. GetAllConfig().then(response => {
  588. if (response.data.state == 0) {
  589. this.$message.error(response.data.msg);
  590. return false;
  591. } else {
  592. this.manufacturer = response.data.data.manufacturer;
  593. this.dealer = response.data.data.dealer;
  594. }
  595. });
  596. },
  597. handleEdit: function(index, row) {
  598. this.$router.push({path:"/drug/out/drugstockoutorderedit?id="+row.id+"&type="+this.type+"&is_sys="+row.is_sys})
  599. },
  600. handleSearch(val){
  601. this.getInitializtion()
  602. this.getSinleOrderDetail(val.id,val.warehouse_out_time,val.is_sys)
  603. this.list = []
  604. },
  605. handleDelete: function(index, row) {
  606. const ids = [];
  607. ids.push(row.id);
  608. const idStr = ids.join(",");
  609. const params = {
  610. ids: idStr
  611. };
  612. this.$confirm("确认删除出库单记录?", "删除出库单记录", {
  613. confirmButtonText: "确定",
  614. cancelButtonText: "取消",
  615. type: "warning"
  616. })
  617. .then(() => {
  618. deleteDrugWarehouseOut(params).then(response => {
  619. if (response.data.state == 0) {
  620. this.$message.error(response.data.msg);
  621. return false;
  622. } else {
  623. this.$notify({
  624. title: "成功",
  625. message: "删除成功",
  626. type: "success",
  627. duration: 2000
  628. });
  629. for (let i = 0; i < ids.length; i++) {
  630. for (let y = 0; y < this.warehouseOutDate.length; y++) {
  631. if (ids[i] == this.warehouseOutDate[y].id) {
  632. this.warehouseOutDate.splice(y, 1);
  633. }
  634. }
  635. }
  636. }
  637. });
  638. })
  639. .catch(() => {});
  640. },
  641. changeAllSelected: function(val) {
  642. if (val) {
  643. this.$refs.multipleTable.toggleAllSelection();
  644. } else {
  645. this.$refs.multipleTable.clearSelection();
  646. }
  647. },
  648. select(selection) {
  649. var ids= []
  650. for(let i=0;i<selection.length;i++){
  651. ids.push(selection[i].id)
  652. }
  653. this.order_id = ids.join(",")
  654. this.selectedTableData = selection;
  655. this.getExportOutOrderDrugList()
  656. },
  657. batchDelete() {
  658. if (this.selectedTableData.length <= 0) {
  659. this.$message.error("请选择要删除的记录");
  660. return;
  661. }
  662. const ids = [];
  663. for (let i = 0; i < this.selectedTableData.length; i++) {
  664. if(this.selectedTableData[i].is_sys == 1){
  665. this.$message.error("自动出库数据不能删除!")
  666. return false
  667. }
  668. if(this.selectedTableData[i].is_sys == 0){
  669. ids.push(this.selectedTableData[i].id);
  670. }
  671. }
  672. const idStr = ids.join(",");
  673. const params = {
  674. ids: idStr
  675. };
  676. this.$confirm("确认删除出库单记录?", "删除出库单记录", {
  677. confirmButtonText: "确定",
  678. cancelButtonText: "取消",
  679. type: "warning"
  680. }).then(() => {
  681. deleteDrugWarehouseOut(params).then(response => {
  682. if (response.data.state == 0) {
  683. this.$message.error(response.data.msg);
  684. return false;
  685. } else {
  686. this.$notify({
  687. title: "成功",
  688. message: "删除成功",
  689. type: "success",
  690. duration: 2000
  691. });
  692. for (let i = 0; i < ids.length; i++) {
  693. for (let y = 0; y < this.warehouseOutDate.length; y++) {
  694. if (ids[i] == this.warehouseOutDate[y].id) {
  695. this.warehouseOutDate.splice(y, 1);
  696. }
  697. }
  698. }
  699. }
  700. });
  701. })
  702. .catch(() => {});
  703. },
  704. jump(id){
  705. this.GetOrderDetailTwo(id)
  706. this.userList=[]
  707. this.dialogVisibleTwo = true
  708. },
  709. GetOrderDetailTwo(order_id) {
  710. const params = {
  711. 'id': order_id
  712. }
  713. getDrugWarehouseOutUser(params).then(response => {
  714. if (response.data.state == 0) {
  715. this.$message.error(response.data.msg)
  716. return false
  717. } else {
  718. this.userList=[]
  719. var total = 0
  720. for (let i = 0; i < response.data.data.list.length; i++) {
  721. var obj = response.data.data.list[i]
  722. obj['is_total'] = 0
  723. this.userList.push(obj)
  724. total = total + response.data.data.list[i].count
  725. }
  726. this.userList.push({
  727. is_total: 1,
  728. total: total,
  729. })
  730. }
  731. })
  732. },
  733. merge({ row, column, rowIndex, columnIndex }) {
  734. if (columnIndex === 0) {
  735. const _row = this.tempArr[rowIndex]
  736. const _col = _row > 0 ? 1 : 0
  737. return {
  738. rowspan: _row,
  739. colspan: _col
  740. }
  741. }
  742. },
  743. handleSpanTempArr(){
  744. this.tempArr = []
  745. for (let i = 0; i < this.warehousingOutInfo.warehousingOutData.length; i++) {
  746. if (i === 0) {
  747. this.tempArr.push(1)
  748. this.pos = 0
  749. } else {
  750. // 判断当前元素与上一个元素是否相同
  751. if (this.warehousingOutInfo.warehousingOutData[i].drug_id === this.warehousingOutInfo.warehousingOutData[i - 1].drug_id) {
  752. this.tempArr[this.pos] += 1
  753. this.tempArr.push(0)
  754. } else {
  755. this.tempArr.push(1)
  756. this.pos = i
  757. }
  758. }
  759. }
  760. let sameRowArr = [], sIdx = 0
  761. this.warehousingOutInfo.warehousingOutData.forEach((item, index) => {
  762. item.index = index
  763. if (index === 0) {
  764. sameRowArr.push([index])
  765. } else {
  766. if (item.drug_id === this.warehousingOutInfo.warehousingOutData[index - 1].drug_id) {
  767. sameRowArr[sIdx].push(index)
  768. } else {
  769. sIdx = sIdx + 1
  770. sameRowArr.push([index])
  771. }
  772. }
  773. })
  774. this.sameRowArr = sameRowArr
  775. },
  776. getDrugAutoMaticList(id,recordTime,warehouse_out_order_number){
  777. var params = {
  778. warehous_out_id:id,
  779. record_time:recordTime,
  780. warehouse_out_order_number:warehouse_out_order_number,
  781. }
  782. getDrugAutoMaticList(params).then(response=>{
  783. if(response.data.state ==1){
  784. var list = response.data.data.list
  785. this.list = list
  786. var drugConfig = response.data.data.drugConfig
  787. this.drugConfig = drugConfig
  788. var drugList = response.data.data.drugList
  789. this.drugList = drugList
  790. var manulist = response.data.data.manufacturerList
  791. this.manufacturerList = manulist
  792. }
  793. })
  794. },
  795. getDrugCount(id){
  796. var count = 0
  797. for(let i=0;i<this.list.length;i++){
  798. if(this.list[i].drug_id == id){
  799. count = this.list[i].Total
  800. }
  801. }
  802. return count
  803. },
  804. getRetailPrice(id){
  805. var price = 0
  806. for(let i=0;i<this.drugList.length;i++){
  807. if(id == this.drugList[i].id){
  808. price = this.drugList[i].retail_price
  809. }
  810. }
  811. return price
  812. },
  813. getTime(val) {
  814. if(val < 0){
  815. return ""
  816. }
  817. if(val == ""){
  818. return ""
  819. }else {
  820. return uParseTime(val, '{y}-{m}-{d}')
  821. }
  822. },
  823. getInitializtion(){
  824. getInitializtion().then(response=>{
  825. if(response.data.state ==1){
  826. var drugTypeList = response.data.data.drugTypeList
  827. this.drugTypeList = drugTypeList
  828. }
  829. })
  830. },
  831. getDrugType(id){
  832. var name = ""
  833. for(let i=0;i<this.drugTypeList.length;i++){
  834. if(id == this.drugTypeList[i].value){
  835. name = this.drugTypeList[i].name
  836. }
  837. }
  838. return name
  839. },
  840. getManufacturerName(id){
  841. var name = ""
  842. for(let i=0;i<this.manufacturerList.length;i++){
  843. if(id == this.manufacturerList[i].id){
  844. name = this.manufacturerList[i].manufacturer_name
  845. }
  846. }
  847. return name
  848. },
  849. getDealerName(id){
  850. var name = ""
  851. for(let i=0;i<this.dealerList.length;i++){
  852. if(id == this.dealerList[i].id){
  853. name = this.dealerList[i].dealer_name
  854. }
  855. }
  856. return name
  857. },
  858. getSinleOrderDetail(id,start_time,is_sys){
  859. var params = {
  860. id:id,
  861. start_time:start_time,
  862. }
  863. console.log("is_sys22222",is_sys)
  864. getSinleOrderDetail(params).then(response=>{
  865. if(response.data.state == 1){
  866. this.tableShow = true
  867. this.tableList = []
  868. var list = response.data.data.list
  869. this.manufacturerList = response.data.data.manufacturerList
  870. this.dealerList = response.data.data.dealerList
  871. var drugFlowList = response.data.data.drugFlowList
  872. if (is_sys == 1){
  873. for(let i=0;i<drugFlowList.length;i++){
  874. if(drugFlowList[i].count_unit == drugFlowList[i].XtBaseDrug.max_unit){
  875. drugFlowList[i].count = drugFlowList[i].count * drugFlowList[i].XtBaseDrug.min_number
  876. }
  877. if(drugFlowList[i].count_unit == drugFlowList[i].XtBaseDrug.min_unit){
  878. drugFlowList[i].count = drugFlowList[i].count
  879. }
  880. }
  881. this.drugFlowList = drugFlowList
  882. }
  883. if(is_sys == 0){
  884. var flowlist = response.data.data.flowlist
  885. this.drugFlowList = []
  886. for(let i=0;i<flowlist.length;i++){
  887. if(flowlist[i].count_unit == flowlist[i].max_unit){
  888. flowlist[i].count = flowlist[i].count * list[i].min_number
  889. }
  890. if(flowlist[i].count_unit == flowlist[i].min_unit){
  891. flowlist[i].count = flowlist[i].count
  892. }
  893. }
  894. this.drugFlowList = flowlist
  895. }
  896. for(let i=0;i<list.length;i++){
  897. if(list[i].batch_number == "0" || list[i].batch_number == 0){
  898. list[i].batch_number = ""
  899. }
  900. if(list[i].number == "0" || list[i].number == 0){
  901. list[i].number = ""
  902. }
  903. }
  904. console.log("list233223323233223",list)
  905. this.tableList = list
  906. }
  907. })
  908. },
  909. toDetail(val){
  910. this.userList = []
  911. this.userListOne = []
  912. var params = {
  913. warehouse_out_id:val.warehouse_out_id,
  914. drug_id:val.drug_id,
  915. record_time:val.sys_record_time,
  916. }
  917. // console.log("使用明细",params)
  918. getAutoDrugDetail(params).then(response=>{
  919. if(response.data.state == 1){
  920. this.userList = response.data.data.list
  921. console.log("自动出库数据",this.userList)
  922. if(val.is_sys == 1){
  923. this.drugDialogVisible = true
  924. }
  925. if(val.is_sys == 0){
  926. this.drugDialogVisibleTwo = true
  927. }
  928. var userListOne = response.data.data.outList
  929. // console.log("手动出库2232332",userListOne)
  930. this.userListOne = userListOne
  931. var batchNumber = response.data.data.batchNumber
  932. // console.log("出库详情",batchNumber)
  933. this.batchNumberList = batchNumber
  934. }
  935. })
  936. },
  937. toPrint(){
  938. if(this.order_id == 0){
  939. this.$message.error("请选择出库单")
  940. }else{
  941. this.$router.push({path:"/stock/drugStockOutOrderDetailPrint?id="+this.order_id})
  942. }
  943. },
  944. getDrugCountList(){
  945. var params = {
  946. keyword: this.keywords,
  947. start_time:this.start_time,
  948. end_time:this.end_time,
  949. }
  950. getDrugCountList(params).then(response=>{
  951. if(response.data.state == 1){
  952. var countlist = response.data.data.countList
  953. // console.log("入库数据",countlist)
  954. this.countList = countlist
  955. var outcountlist = response.data.data.outCountList
  956. // console.log("出库数据",outcountlist)
  957. this.outCountList = outcountlist
  958. var aucountlist = response.data.data.auCountList
  959. // console.log("自动数据",aucountlist)
  960. this.autoCountList = aucountlist
  961. var minCount = response.data.data.minCount
  962. // console.log("minCount",minCount)
  963. this.minCount = minCount
  964. var info = response.data.data.info
  965. for(let i=0;i<info.length;i++){
  966. if(info[i].count_unit == info[i].max_unit){
  967. info[i].count = info[i].count * info[i].min_number
  968. }
  969. }
  970. // console.log("info2222222",info)
  971. this.drugOutList = info
  972. }
  973. })
  974. },
  975. getCount(drug_id,min_number,max_unit,min_unit){
  976. var count= 0
  977. var str = ""
  978. var min_str = ""
  979. for(let i=0;i<this.drugOutList.length;i++){
  980. if(drug_id == this.drugOutList[i].drug_id){
  981. count += parseInt(this.drugOutList[i].count)
  982. }
  983. }
  984. if(parseInt(count/min_number)!=0){
  985. str = parseInt(count/min_number)+ max_unit
  986. }
  987. if((count%min_number)!=0){
  988. min_str = count%min_number + min_unit
  989. }
  990. return str + min_str
  991. },
  992. getTotalCount(drug_id,min_number,max_unit,min_unit){
  993. var str = ""
  994. var min_str = ""
  995. var arr = []
  996. var total = 0
  997. for(let i=0;i<this.outList.length;i++){
  998. if(this.outList[i].drug_id == drug_id){
  999. total += this.outList[i].count
  1000. }
  1001. }
  1002. if (total >=min_number){
  1003. if(parseInt(total/min_number)!=0){
  1004. str = parseInt(total/min_number)+ max_unit
  1005. }
  1006. if((total%min_number)!=0){
  1007. min_str = total%min_number + min_unit
  1008. }
  1009. }
  1010. if (total < min_number){
  1011. str = ""
  1012. min_str = total + min_unit
  1013. }
  1014. return str + min_str
  1015. },
  1016. getTotalCountOne(id,min_number,max_unit,min_unit){
  1017. console.log("hhhahdhhff",this.drugFlowList)
  1018. var arr = []
  1019. for(let i=0;i<this.drugFlowList.length;i++){
  1020. if(id == this.drugFlowList[i].drug_id){
  1021. arr.push(this.drugFlowList[i])
  1022. }
  1023. }
  1024. var str = ""
  1025. var min_str = ""
  1026. var total = 0
  1027. if(arr.length > 0){
  1028. for(let i=0;i<arr.length;i++){
  1029. total +=arr[i].count
  1030. }
  1031. if(parseInt(total/min_number)!=0){
  1032. str = parseInt(total/min_number)+ max_unit
  1033. }
  1034. if(total%min_number !=0){
  1035. min_str = total%min_number + min_unit
  1036. }
  1037. }
  1038. return str + min_str
  1039. },
  1040. getAllPrice(drug_id,price,min_price){
  1041. var strprice = 0
  1042. var minstrprice = 0
  1043. var str = ""
  1044. var min_str = ""
  1045. var total_price = 0
  1046. for(let i=0;i<this.outList.length;i++){
  1047. if(this.outList[i].drug_id == drug_id){
  1048. if(parseInt(this.outList[i].count/this.outList[i].min_number)!=0){
  1049. str = parseInt(this.outList[i].count/this.outList[i].min_number)
  1050. }
  1051. if((this.outList[i].count%this.outList[i].min_number)!=0){
  1052. min_str = this.outList[i].count%this.outList[i].min_number
  1053. }
  1054. }
  1055. }
  1056. strprice = str * price
  1057. minstrprice = min_str * min_price
  1058. total_price = strprice + minstrprice
  1059. return total_price
  1060. },
  1061. getDrugBatchNumber(drugid,count){
  1062. console.log("drug_id2323",drugid)
  1063. console.log("count",count)
  1064. console.log("hhhhhhhhhhh",this.batchNumberList)
  1065. var arr = []
  1066. for(let i=0;i<this.batchNumberList.length;i++){
  1067. if(drugid == this.batchNumberList[i].drug_id && count == this.batchNumberList[i].count){
  1068. arr.push(this.batchNumberList[i].batch_number)
  1069. }
  1070. }
  1071. return arr.join(",")
  1072. },
  1073. getExportOutOrderDrugList(){
  1074. var params = {
  1075. order_id:this.order_id
  1076. }
  1077. getExportOutOrderDrugList(params).then(response=>{
  1078. if(response.data.state == 1){
  1079. var list = response.data.data.list
  1080. console.log("list22222",list)
  1081. this.exportList = list
  1082. this.manufacturerList = response.data.data.manufacturerList
  1083. this.dealerList = response.data.data.dealerList
  1084. }
  1085. })
  1086. },
  1087. toExport(){
  1088. if(this.order_id == ""){
  1089. this.$message.error("请勾选出库单")
  1090. return
  1091. }
  1092. console.log("hh2323232322323",this.exportList)
  1093. for(let i=0;i<this.exportList.length;i++){
  1094. if(this.exportList[i].dealer == 0){
  1095. this.exportList[i].dealer = ""
  1096. }
  1097. if(this.exportList[i].manufacturer == 0){
  1098. this.exportList[i].manufacturer = ""
  1099. }
  1100. this.exportList[i].unit = this.exportList[i].dose + this.exportList[i].dose_unit + "*" + this.exportList[i].min_number + this.exportList[i].min_unit + "/"+this.exportList[i].max_unit
  1101. this.exportList[i].total_price = (this.exportList[i].count * this.exportList[i].price).toFixed(2)
  1102. this.exportList[i].expiry_date = this.getTime(this.exportList[i].expire_date)
  1103. this.exportList[i].product_date = this.getTime(this.exportList[i].product_date)
  1104. for(let j=0;j<this.manufacturerList.length;j++){
  1105. if(this.exportList[i].manufacturer == this.manufacturerList[j].id){
  1106. this.exportList[i].manufacturer = this.manufacturerList[j].manufacturer_name
  1107. }
  1108. }
  1109. for(let z=0;z<this.dealerList.length;z++){
  1110. if(this.exportList[i].dealer == this.dealerList[z].id){
  1111. this.exportList[i].dealer = this.dealerList[z].dealer_name
  1112. }
  1113. }
  1114. }
  1115. import('@/vendor/Export2Excel').then(excel => {
  1116. for(let i=0;i<this.exportList.length;i++){
  1117. for(let j=0;j<this.drugTypeList.length;j++){
  1118. if(this.exportList[i].drug_type == this.drugTypeList[j].value){
  1119. this.exportList[i].drug_type = this.drugTypeList[j].name
  1120. }
  1121. }
  1122. }
  1123. const tHeader = ['药品名称','药品类型','规格&单位', '批号','出库数量','出货单价','拆零零售价','总价','生产厂家','生产日期','有效日期','经销商','批准文号','备注']
  1124. const filterVal = ['drug_name','drug_type','unit','batch_number', 'count','price','retail_price','total_price','manufacturer','product_date','expiry_date','dealer','number','remark']
  1125. // console.log("table",this.exportList)
  1126. const data = this.formatJson(filterVal, this.exportList)
  1127. excel.export_json_to_excel({
  1128. header: tHeader,
  1129. data,
  1130. filename: '药品出库单详情'
  1131. })
  1132. this.downloadLoading = false
  1133. })
  1134. },
  1135. formatJson(filterVal, jsonData) {
  1136. return jsonData.map(v => filterVal.map(j => v[j]));
  1137. },
  1138. getAllPriceOne(drug_id,price,min_price){
  1139. var total = 0
  1140. var all_price = 0
  1141. for(let i=0;i<this.drugFlowList.length;i++){
  1142. if(drug_id == this.drugFlowList[i].drug_id){
  1143. total += this.drugFlowList[i].count
  1144. }
  1145. }
  1146. all_price = total * price
  1147. return all_price
  1148. },
  1149. }
  1150. };
  1151. </script>
  1152. <style rel="stylesheet/scss" lang="scss">
  1153. .app-container {
  1154. // margin: 20px;
  1155. font-size: 15px;
  1156. .filter-container {
  1157. padding-bottom: 5px;
  1158. }
  1159. .search-component {
  1160. width: 500px;
  1161. .searchBox {
  1162. width: 300px;
  1163. height: 36px;
  1164. line-height: 36px;
  1165. padding-left: 15px;
  1166. border: 1px #dcdfe6 solid;
  1167. border-right: none;
  1168. outline: none;
  1169. float: left;
  1170. border-radius: 6px 0 0 6px;
  1171. font-size: 14px;
  1172. color: #333;
  1173. background: #fff;
  1174. box-shadow: 3px 3px 4px rgba(135, 135, 135, 0.05);
  1175. }
  1176. .searchBtn {
  1177. background-color: #409eff;
  1178. color: #fff;
  1179. font-size: 15px;
  1180. text-align: center;
  1181. height: 36px;
  1182. line-height: 36px;
  1183. float: left;
  1184. outline: none;
  1185. width: 70px;
  1186. border: none;
  1187. border-radius: 0 6px 6px 0;
  1188. font-family: "Microsoft Yahei";
  1189. cursor: pointer;
  1190. }
  1191. }
  1192. .amount {
  1193. font-weight: normal;
  1194. padding: 10px 0 0 0;
  1195. color: #606266;
  1196. font-size: 14px;
  1197. span {
  1198. color: #ef2525;
  1199. font-family: "Arial";
  1200. padding: 0 2px;
  1201. }
  1202. }
  1203. }
  1204. .el-table td,
  1205. .el-table th.is-leaf,
  1206. .el-table--border,
  1207. .el-table--group {
  1208. border-color: #d0d3da;
  1209. }
  1210. .el-table--border::after,
  1211. .el-table--group::after,
  1212. .el-table::before {
  1213. background-color: #d0d3da;
  1214. }
  1215. </style>