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

drugStockOutOrder.vue 36KB

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