drugStockOutOrderEdit.vue 44KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb
  5. v-if="this.$route.query.type == 1"
  6. :crumbs="crumbs"
  7. ></bread-crumb>
  8. <bread-crumb
  9. v-if="this.$route.query.type == 2"
  10. :crumbs="crumbs2"
  11. ></bread-crumb>
  12. <div style="float: right">
  13. <el-button size="small" @click="back()" class="filter-item">取 消</el-button>
  14. <el-button
  15. size="small"
  16. type="primary"
  17. @click="submit()"
  18. v-if="is_check == 2 && parseInt(this.$route.query.is_sys) == 0"
  19. class="filter-item"
  20. >保 存</el-button
  21. >
  22. <el-button
  23. size="small"
  24. type="primary"
  25. v-if="is_check == 2 && parseInt(this.$route.query.is_sys) == 0"
  26. class="filter-item"
  27. @click="toCheck"
  28. >审 核</el-button
  29. >
  30. <el-button
  31. size="small"
  32. type="primary"
  33. v-if="is_check == 1 && parseInt(this.$route.query.is_sys) == 0"
  34. @click="toReturnCheck"
  35. class="filter-item"
  36. >反 审 核</el-button
  37. >
  38. </div>
  39. </div>
  40. <div class="app-container">
  41. <drugs-stock-dialog
  42. ref="dialog"
  43. :propForm="propForm"
  44. :visibility="isVisibility"
  45. v-on:dialog-comfirm="comfirm"
  46. v-on:dialog-cancle="cancle"
  47. >
  48. </drugs-stock-dialog>
  49. <div class="cell clearfix">
  50. <label class="title"
  51. ><span class="name"><span style="color: red">*</span>仓库</span>
  52. :</label
  53. >
  54. <el-select
  55. size="small"
  56. v-model="storehouse_id"
  57. filterable
  58. placeholder="请选择仓库"
  59. style="width: 200px"
  60. :disabled="true"
  61. >
  62. <el-option
  63. v-for="(option, index) in houstList"
  64. :key="index"
  65. :label="option.storehouse_name"
  66. :value="option.id"
  67. >
  68. </el-option>
  69. </el-select>
  70. <label class="title"><span class="name">出库时间</span> : </label>
  71. <el-date-picker
  72. :disabled="drug_show"
  73. size="small"
  74. v-model="warehouse_out_time"
  75. prefix-icon="el-icon-date"
  76. :editable="false"
  77. style="width: 200px"
  78. type="date"
  79. placeholder="选择日期时间"
  80. align="right"
  81. format="yyyy-MM-dd"
  82. value-format="yyyy-MM-dd"
  83. ></el-date-picker>
  84. </div>
  85. <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
  86. <el-table
  87. :data="recordInfo.recordData"
  88. :class="signAndWeighBoxPatients"
  89. style="width: 100%"
  90. border
  91. max-height="450"
  92. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  93. >
  94. <el-table-column align="center" width="230">
  95. <template slot="header" slot-scope="scope">
  96. <span>药品名称<span style="color: red">*</span></span>
  97. </template>
  98. <template slot-scope="scope">
  99. <el-form-item style="padding-top: 15px">
  100. <el-autocomplete
  101. class="checkSearch"
  102. popper-class="my-autocomplete"
  103. v-model="scope.row.drug_name"
  104. :fetch-suggestions="querySearchAsync"
  105. :trigger-on-focus="true"
  106. placeholder="请输入药品名称"
  107. @select="handleSelect"
  108. @input="changeDrugName(scope.$index)"
  109. style="width: 210px !important"
  110. :disabled="drug_show"
  111. >
  112. <i class="el-icon-search el-input__icon" slot="suffix"></i>
  113. <template slot-scope="{ item }">
  114. <div class="name">
  115. {{
  116. item.drug_name +
  117. item.dose +
  118. item.dose_unit +
  119. "*" +
  120. item.min_number +
  121. item.min_unit +
  122. "/" +
  123. item.max_unit +
  124. " " +
  125. item.manufacturer
  126. }}
  127. </div>
  128. </template>
  129. </el-autocomplete>
  130. </el-form-item>
  131. </template>
  132. </el-table-column>
  133. <el-table-column align="center" width="140">
  134. <template slot="header" slot-scope="scope">
  135. <span>药品类型</span>
  136. </template>
  137. <template slot-scope="scope">
  138. <el-select
  139. v-model="scope.row.drug_type"
  140. filterable
  141. placeholder="请选择厂商"
  142. :disabled="drug_show"
  143. >
  144. <el-option
  145. v-for="(option, index) in drugTypeList"
  146. :key="index"
  147. :label="option.name"
  148. :value="option.id"
  149. >
  150. </el-option>
  151. </el-select>
  152. </template>
  153. </el-table-column>
  154. <el-table-column align="center" width="140">
  155. <template slot="header" slot-scope="scope">
  156. <span>规格&单位</span>
  157. </template>
  158. <template slot-scope="scope">
  159. <el-form-item style="padding-top: 20px">
  160. <el-input
  161. :disabled="true"
  162. placeholder="请输入规格&单位"
  163. v-model="scope.row.name"
  164. ></el-input>
  165. </el-form-item>
  166. </template>
  167. </el-table-column>
  168. <!-- <el-table-column align="center" width="150">
  169. <template slot="header" slot-scope="scope" >
  170. <span>批号</span>
  171. </template>
  172. <template slot-scope="scope">
  173. <el-form-item style="padding-top: 20px">
  174. <el-select v-model="scope.row.batch_number" filterable placeholder="请选择">
  175. <el-option
  176. v-for="(item,index) in numberList"
  177. :key="index"
  178. :label="item.batch_number"
  179. :value="item.id">
  180. </el-option>
  181. </el-select>
  182. </el-form-item>
  183. </template>
  184. </el-table-column> -->
  185. <el-table-column width="150" align="center">
  186. <template slot="header" slot-scope="scope">
  187. <span>剩余库存</span>
  188. </template>
  189. <template slot-scope="scope">
  190. <el-form-item
  191. :rules="tableRules.stock_count"
  192. style="padding-top: 20px"
  193. >
  194. <div>
  195. <el-input
  196. :disabled="true"
  197. style="width: 120px"
  198. placeholder="剩余库存"
  199. v-model="scope.row.stock_count"
  200. ></el-input>
  201. </div>
  202. </el-form-item>
  203. </template>
  204. </el-table-column>
  205. <el-table-column width="200" align="center">
  206. <template slot="header" slot-scope="scope">
  207. <span>出库数量<span style="color: red">*</span></span>
  208. </template>
  209. <template slot-scope="scope">
  210. <el-form-item
  211. :prop="'recordData.' + scope.$index + '.count'"
  212. :rules="tableRules.count"
  213. style="padding-top: 20px"
  214. >
  215. <div style="display: flex">
  216. <el-input
  217. oninput="value=value.replace(/\D|^0/g,'')"
  218. style="width: 100px"
  219. :disabled="drug_show"
  220. placeholder="请输入出库数量"
  221. type="number"
  222. v-model="scope.row.count"
  223. @input="
  224. getSupplyCount(
  225. scope.row.count,
  226. scope.row.max_unit,
  227. scope.row.min_number,
  228. scope.$index,
  229. scope.row.total_count,
  230. scope.row.max_unit_fisrt,
  231. scope.row.min_unit_fisrt
  232. )
  233. "
  234. ></el-input>
  235. <el-select
  236. v-model="scope.row.count_unit"
  237. filterable
  238. placeholder="请选择单位"
  239. style="width: 80px"
  240. :disabled="unitShow"
  241. >
  242. <el-option
  243. v-for="(option, index) in unitList"
  244. :key="index"
  245. :label="option.name"
  246. :value="option.name"
  247. >
  248. </el-option>
  249. </el-select>
  250. </div>
  251. </el-form-item>
  252. </template>
  253. </el-table-column>
  254. <el-table-column label="出库对象" width="140" align="center">
  255. <template slot-scope="scope">
  256. <el-select
  257. v-model="scope.row.admin_user_id"
  258. filterable
  259. placeholder="请选择厂商"
  260. :disabled="drug_show"
  261. >
  262. <el-option
  263. v-for="(option, index) in doctorList"
  264. :key="index"
  265. :label="option.user_name"
  266. :value="option.admin_user_id"
  267. >
  268. </el-option>
  269. </el-select>
  270. </template>
  271. </el-table-column>
  272. <!-- <el-table-column width="120" align="center">
  273. <template slot="header" slot-scope="scope">
  274. <span>进货价</span>
  275. </template>
  276. <template slot-scope="scope">
  277. <el-form-item
  278. :rules="tableRules.last_price"
  279. style="padding-top: 20px"
  280. >
  281. <el-input
  282. :disabled="true"
  283. placeholder="进货价"
  284. type="number"
  285. v-model="scope.row.last_price"
  286. ></el-input>
  287. </el-form-item>
  288. </template>
  289. </el-table-column> -->
  290. <el-table-column width="120" align="center">
  291. <template slot="header" slot-scope="scope">
  292. <span>出货价<span style="color: red">*</span></span>
  293. </template>
  294. <template slot-scope="scope">
  295. <el-form-item
  296. :prop="'recordData.' + scope.$index + '.price'"
  297. :rules="tableRules.price"
  298. style="padding-top: 20px"
  299. >
  300. <el-input
  301. :disabled="drug_show"
  302. placeholder="请输入出货价"
  303. type="number"
  304. v-model="scope.row.price"
  305. ></el-input>
  306. </el-form-item>
  307. </template>
  308. </el-table-column>
  309. <el-table-column label="总价" width="80" align="center">
  310. <template slot-scope="scope">
  311. {{ calculate(scope.row.price * scope.row.count) }}
  312. </template>
  313. </el-table-column>
  314. <el-table-column label="生产厂家" width="140" align="center">
  315. <template slot-scope="scope">
  316. <el-select
  317. v-model="scope.row.manufacturer"
  318. filterable
  319. placeholder="请选择厂商"
  320. :disabled="drug_show"
  321. >
  322. <el-option
  323. v-for="(option, index) in manufacturerList"
  324. :key="index"
  325. :label="option.manufacturer_name"
  326. :value="option.id"
  327. >
  328. </el-option>
  329. </el-select>
  330. </template>
  331. </el-table-column>
  332. <el-table-column label="生产日期" width="180" align="center">
  333. <template slot-scope="scope">
  334. <el-date-picker
  335. :disabled="drug_show"
  336. prefix-icon="el-icon-date"
  337. style="width: 145px"
  338. v-model="scope.row.product_date"
  339. type="date"
  340. placeholder="选择日期时间"
  341. format="yyyy-MM-dd"
  342. value-format="yyyy-MM-dd"
  343. ></el-date-picker>
  344. </template>
  345. </el-table-column>
  346. <el-table-column label="有效日期" width="180" align="center">
  347. <template slot-scope="scope">
  348. <el-date-picker
  349. :disabled="drug_show"
  350. prefix-icon="el-icon-date"
  351. style="width: 145px"
  352. v-model="scope.row.expiry_date"
  353. type="date"
  354. placeholder="选择日期时间"
  355. format="yyyy-MM-dd"
  356. value-format="yyyy-MM-dd"
  357. ></el-date-picker>
  358. </template>
  359. </el-table-column>
  360. <el-table-column label="经销商" width="140" align="center">
  361. <template slot-scope="scope">
  362. <el-select
  363. v-model="scope.row.dealer"
  364. filterable
  365. placeholder="请选择厂商"
  366. :disabled="drug_show"
  367. >
  368. <el-option
  369. v-for="(option, index) in dealerList"
  370. :key="index"
  371. :label="option.dealer_name"
  372. :value="option.id"
  373. >
  374. </el-option>
  375. </el-select>
  376. </template>
  377. </el-table-column>
  378. <el-table-column align="center" width="150" label="批准文号">
  379. <template slot-scope="scope">
  380. <el-form-item style="padding-top: 20px" :disabled="true">
  381. <el-input
  382. placeholder="请输入批准文号"
  383. v-model="scope.row.number"
  384. ></el-input>
  385. </el-form-item>
  386. </template>
  387. </el-table-column>
  388. <el-table-column label="备注" width="120" align="center">
  389. <template slot-scope="scope">
  390. <el-input
  391. v-model="scope.row.remark"
  392. :disabled="drug_show"
  393. ></el-input>
  394. </template>
  395. </el-table-column>
  396. <el-table-column
  397. label="操作"
  398. align="center"
  399. width="150"
  400. fixed="right"
  401. >
  402. <template slot-scope="scope">
  403. <el-tooltip
  404. class="item"
  405. effect="dark"
  406. content="新增"
  407. placement="top"
  408. >
  409. <el-button
  410. size="mini"
  411. type="primary"
  412. icon="el-icon-circle-plus-outline"
  413. @click="handleEdit(scope.$index, scope.row)"
  414. >
  415. </el-button>
  416. </el-tooltip>
  417. <el-tooltip
  418. class="item"
  419. effect="dark"
  420. content="删除"
  421. placement="top"
  422. >
  423. <el-button
  424. size="mini"
  425. type="danger"
  426. icon="el-icon-delete"
  427. @click="handleDelete(scope.$index, scope.row)"
  428. >
  429. </el-button>
  430. </el-tooltip>
  431. </template>
  432. </el-table-column>
  433. </el-table>
  434. </el-form>
  435. </div>
  436. </div>
  437. </template>
  438. <script>
  439. import { uParseTime } from "@/utils/tools";
  440. import {
  441. deleteDrugWarehouseOutInfo,
  442. editDrugWarehouseoutInfo,
  443. getDrugWarehouseOutInfo,
  444. GetAllConfigOne,
  445. GetAllDrugInfoByID,
  446. getDrugBatchNumber,
  447. toCheckDrugOut,
  448. toReturnCheck,
  449. } from "@/api/drug/drug_stock";
  450. import BreadCrumb from "../../components/bread-crumb";
  451. import DrugsStockDialog from "./drugsStockDialog/index";
  452. import { postSearchDrugList } from "@/api/data";
  453. import { getDictionaryDataConfig, getDataConfig } from "@/utils/data";
  454. export default {
  455. components: { DrugsStockDialog, BreadCrumb },
  456. name: "salesReturnEdit",
  457. data() {
  458. return {
  459. crumbs: [
  460. { path: false, name: "库存管理" },
  461. { path: false, name: "药品出库单" },
  462. { path: false, name: "编辑出库单" },
  463. ],
  464. crumbs2: [
  465. { path: false, name: "库存管理" },
  466. { path: false, name: "其他出库单" },
  467. { path: false, name: "编辑出库单" },
  468. ],
  469. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  470. adminUserOptions: null,
  471. currentIndex: 0,
  472. warehouse_out_time: "",
  473. recordInfo: {
  474. recordData: [],
  475. stock_in_code: "",
  476. current_index: "",
  477. },
  478. tableRules: {
  479. count: [{ required: true, message: "数量不能为空", trigger: "blur" }],
  480. price: [{ required: true, message: "单价不能为空", trigger: "blur" }],
  481. },
  482. ruleForm: {
  483. manufacturer: [
  484. { required: true, message: "请选择厂商", trigger: "change" },
  485. ],
  486. },
  487. // prop
  488. isVisibility: false,
  489. propForm: {
  490. goods: [],
  491. goodType: [],
  492. goodInfo: [],
  493. goodUnit: [],
  494. title: "入库",
  495. manufacturer: 0,
  496. dealer: 0,
  497. },
  498. form: {
  499. manufacturer: 0,
  500. dealer: 0,
  501. },
  502. warehouseInfoList: [],
  503. warehouseOut: {},
  504. manufacturer: [],
  505. dealer: [],
  506. goodType: [],
  507. goodInfo: [],
  508. drugTypeList: [],
  509. manufacturerList: [],
  510. drug_show: false,
  511. unitList: [],
  512. unitShow: true,
  513. numberList: [],
  514. houstList: [],
  515. storehouse_id: "",
  516. is_check:0,
  517. order_id:0,
  518. };
  519. },
  520. methods: {
  521. comfirm: function (val) {
  522. this.$refs.dialog.hide();
  523. this.propForm.goodType = [];
  524. this.propForm.goods = [];
  525. if (val.selectedGoodInfo.length > 0) {
  526. for (let i = val.selectedGoodInfo.length - 1; i >= 0; i--) {
  527. if (i == 0) {
  528. this.recordInfo.recordData[this.currentIndex].drug_id =
  529. val.selectedGoodInfo[i].id;
  530. this.recordInfo.recordData[this.currentIndex].price =
  531. val.selectedGoodInfo[i].last_price.toString();
  532. this.recordInfo.recordData[this.currentIndex].retail_price =
  533. val.selectedGoodInfo[i].retail_price.toString();
  534. } else {
  535. const tempForm = {};
  536. tempForm["id"] = 0;
  537. tempForm["drug_id"] = val.selectedGoodInfo[i].id;
  538. tempForm["retail_price"] =
  539. val.selectedGoodInfo[i].retail_price.toString();
  540. tempForm["count"] = "";
  541. tempForm["price"] = val.selectedGoodInfo[i].last_price.toString();
  542. tempForm["remark"] = "";
  543. this.recordInfo.recordData.splice(
  544. this.currentIndex + 1,
  545. 0,
  546. tempForm
  547. );
  548. }
  549. }
  550. }
  551. this.currentIndex = -1;
  552. },
  553. cancle: function () {
  554. this.$refs.dialog.hide();
  555. this.propForm.goods = [];
  556. this.propForm.goodType = [];
  557. },
  558. GetConfigInfo: function () {
  559. const loading = this.$loading({
  560. lock: true,
  561. text: "Loading",
  562. spinner: "el-icon-loading",
  563. background: "rgba(0, 0, 0, 0.7)",
  564. });
  565. GetAllConfigOne().then((response) => {
  566. if (response.data.state == 0) {
  567. this.$message.error(response.data.msg);
  568. return false;
  569. } else {
  570. this.manufacturer = response.data.data.manufacturer;
  571. this.dealer = response.data.data.dealer;
  572. // for(let i = 0; i< response.data.data.drugs.length;i++){
  573. // this.goodType.push(response.data.data.drugs[i])
  574. // if(response.data.data.drugs[i].drug_specs != null) {
  575. // for (let b = 0; b < response.data.data.drugs[i].drug_specs.length; b++) {
  576. // this.goodInfo.push(response.data.data.drugs[i].drug_specs[b])
  577. // }
  578. // }
  579. // }
  580. this.manufacturer.splice(0, 0, { id: 0, manufacturer_name: "全部" });
  581. this.dealer.splice(0, 0, { id: 0, dealer_name: "全部" });
  582. }
  583. loading.close();
  584. });
  585. },
  586. typeName: function (drug_id) {
  587. let name = "";
  588. for (let i = 0; i < this.goodInfo.length; i++) {
  589. if (this.goodInfo[i].id == drug_id) {
  590. name = this.goodInfo[i].drug_name;
  591. }
  592. }
  593. return name;
  594. },
  595. specificationName: function (drug_id) {
  596. let name = "";
  597. for (let i = 0; i < this.goodInfo.length; i++) {
  598. if (this.goodInfo[i].id == drug_id) {
  599. name = this.goodInfo[i].drug_spec;
  600. }
  601. }
  602. return name;
  603. },
  604. handleEdit: function (index, row) {
  605. if (parseInt(this.$route.query.is_sys) == 12) {
  606. this.$message.error("调拨出库数据不能新增!");
  607. return;
  608. }
  609. if (row.supply_cancel_out_id > 0) {
  610. this.$message.error("采购出库数据不能新增!");
  611. return;
  612. }
  613. if(this.is_check == 1){
  614. this.$message.error("已审核的单据不能新增!");
  615. return;
  616. }
  617. this.unitShow = false;
  618. if (this.drug_show == true) {
  619. this.$message.error("自动出库数据不能编辑");
  620. return;
  621. }
  622. const tempObj = {};
  623. tempObj["id"] = 0;
  624. tempObj["drug_id"] = 0;
  625. tempObj["retail_price"] = "";
  626. tempObj["count"] = "";
  627. tempObj["max_unit"] = "";
  628. tempObj["min_unit"] = "";
  629. tempObj["price"] = 0;
  630. tempObj["remark"] = "";
  631. tempObj["batch_number"] = "";
  632. tempObj["number"] = "";
  633. tempObj["count_unit"] = "";
  634. tempObj["dealer"] = "";
  635. tempObj["manufacturer"] = "";
  636. tempObj["warehouse_info_id"] = 0;
  637. tempObj["admin_user_id"] = this.$store.getters.xt_user.user.user_name;
  638. tempObj["last_price"] = 0;
  639. tempObj["stock_count"] = "";
  640. tempObj["total_count"] = 0;
  641. tempObj["max_unit_fisrt"] = 0;
  642. tempObj["min_unit_fisrt"] = 0;
  643. this.recordInfo.recordData.push(tempObj);
  644. },
  645. handleDelete: function (index, row) {
  646. if (parseInt(this.$route.query.is_sys) == 12) {
  647. this.$message.error("调拨出库数据不能删除!");
  648. return;
  649. }
  650. if(parseInt(this.$route.query.is_check) == 1){
  651. this.$message.error("已审核的单据不能删除!")
  652. return false
  653. }
  654. if (row.supply_cancel_out_id > 0) {
  655. this.$message.error("采购出库数据不能删除!");
  656. return;
  657. }
  658. if (this.drug_show == true) {
  659. this.$message.error("采购出库数据不能编辑");
  660. return;
  661. }
  662. if (this.is_checks == 2) {
  663. this.$message.error("已审核的单据不能删除!");
  664. return;
  665. }
  666. if (row.id == 0) {
  667. this.recordInfo.recordData.splice(index, 1);
  668. } else {
  669. const params = {
  670. id: row.id,
  671. };
  672. this.$confirm("确认删除该出库商品信息记录?", "删除出库商品信息记录", {
  673. confirmButtonText: "确定",
  674. cancelButtonText: "取消",
  675. type: "warning",
  676. })
  677. .then(() => {
  678. deleteDrugWarehouseOutInfo(params).then((response) => {
  679. if (response.data.state == 0) {
  680. this.$message.error(response.data.msg);
  681. return false;
  682. } else {
  683. this.$message.success("删除成功");
  684. this.recordInfo.recordData.splice(index, 1);
  685. }
  686. });
  687. })
  688. .catch(() => {});
  689. }
  690. },
  691. // getTime(val, temp) {
  692. // if (val != 0) {
  693. // return uParseTime(val, temp)
  694. // } else {
  695. // return ''
  696. // }
  697. // },
  698. getTime(val) {
  699. if (val < 0) {
  700. return "";
  701. }
  702. if (val == "") {
  703. return "";
  704. } else {
  705. return uParseTime(val, "{y}-{m}-{d}");
  706. }
  707. },
  708. showDialog(index, row) {
  709. this.currentIndex = index;
  710. const loading = this.$loading({
  711. lock: true,
  712. text: "Loading",
  713. spinner: "el-icon-loading",
  714. background: "rgba(0, 0, 0, 0.7)",
  715. });
  716. const params = {
  717. manufacturer_id: this.form.manufacturer,
  718. dealer_id: this.form.dealer,
  719. };
  720. GetAllDrugInfoByID(params).then((response) => {
  721. if (response.data.state == 0) {
  722. this.$message.error(response.data.msg);
  723. return false;
  724. } else {
  725. if (response.data.data.drugs.length <= 0) {
  726. this.$message.error("该厂商或经销商没有药品信息");
  727. return;
  728. }
  729. this.$refs.dialog.show();
  730. for (let i = 0; i < response.data.data.drugs.length; i++) {
  731. this.propForm.goods.push(response.data.data.drugs[i]);
  732. }
  733. const obj = {};
  734. this.propForm.goods = this.propForm.goods.reduce((cur, next) => {
  735. obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
  736. return cur;
  737. }, []); // 设置cur默认类型为数组,并且初始值为空的数组
  738. }
  739. for (let i = 0; i < this.propForm.goods.length; i++) {
  740. for (let a = 0; a < this.propForm.goods[i].drug_specs.length; a++) {
  741. var respObj = this.propForm.goods[i].drug_specs[a];
  742. respObj["isSelected"] = false;
  743. }
  744. }
  745. loading.close();
  746. });
  747. },
  748. back() {
  749. this.$router.go(-1);
  750. },
  751. submit() {
  752. this.$refs["tableForm"].validate((valid) => {
  753. if (valid) {
  754. const array = this.recordInfo.recordData;
  755. for (let i = 0; i < array.length; i++) {
  756. if (array[i].drug_id == 0) {
  757. this.$message.error("药品名称或者药品规格名称不能为空");
  758. return;
  759. }
  760. }
  761. for (let i = 0; i < this.recordInfo.recordData.length; i++) {
  762. this.recordInfo.recordData[i].price =
  763. this.recordInfo.recordData[i].price.toString();
  764. if (this.recordInfo.recordData[i].dealer == "") {
  765. this.recordInfo.recordData[i].dealer = 0;
  766. }
  767. for (let j = 0; j < this.manufacturerList.length; j++) {
  768. if (
  769. this.recordInfo.recordData[i].manufacturer ==
  770. this.manufacturerList[j].manufacturer_name
  771. ) {
  772. this.recordInfo.recordData[i].manufacturer =
  773. this.manufacturerList[j].id;
  774. }
  775. }
  776. for (let z = 0; z < this.dealerList.length; z++) {
  777. if (
  778. this.recordInfo.recordData[i].dealer ==
  779. this.dealerList[z].dealer_name
  780. ) {
  781. this.recordInfo.recordData[i].dealer = this.dealerList[z].id;
  782. }
  783. }
  784. for (let y = 0; y < this.numberList.length; y++) {
  785. if (
  786. this.recordInfo.recordData[i].batch_number ==
  787. this.numberList[y].id
  788. ) {
  789. this.recordInfo.recordData[i].batch_number =
  790. this.numberList[y].batch_number;
  791. this.recordInfo.recordData[i].warehouse_info_id =
  792. this.numberList[y].id;
  793. }
  794. if (
  795. this.recordInfo.recordData[i].batch_number ==
  796. this.numberList[y].batch_number
  797. ) {
  798. this.recordInfo.recordData[i].warehouse_info_id =
  799. this.numberList[y].id;
  800. }
  801. }
  802. for (let s = 0; s < this.doctorList.length; s++) {
  803. if (
  804. this.recordInfo.recordData[i].admin_user_id ==
  805. this.doctorList[s].user_name
  806. ) {
  807. this.recordInfo.recordData[i].admin_user_id =
  808. this.doctorList[s].admin_user_id;
  809. }
  810. }
  811. this.recordInfo.recordData[i].last_price =
  812. this.recordInfo.recordData[i].last_price.toString();
  813. this.recordInfo.recordData[i].stock_count =
  814. this.recordInfo.recordData[i].stock_count.toString();
  815. }
  816. const loading = this.$loading({
  817. lock: true,
  818. text: "Loading",
  819. spinner: "el-icon-loading",
  820. background: "rgba(0, 0, 0, 0.7)",
  821. });
  822. const params = {
  823. stockOut: this.recordInfo.recordData,
  824. };
  825. editDrugWarehouseoutInfo(
  826. params,
  827. this.warehouse_out_time,
  828. this.$route.query.id,
  829. this.$route.query.type,
  830. this.form.manufacturer,
  831. this.form.dealer,
  832. this.storehouse_id
  833. ).then((response) => {
  834. if (response.data.state == 0) {
  835. this.$message.error(response.data.msg);
  836. loading.close();
  837. return false;
  838. } else {
  839. var msg = response.data.data.msg;
  840. var drug_name = response.data.data.drug_name;
  841. var dose = response.data.data.dose;
  842. var dose_unit = response.data.data.dose_unit;
  843. var min_number = response.data.data.min_number;
  844. var min_unit = response.data.data.min_unit;
  845. var max_unit = response.data.data.max_unit;
  846. var str =
  847. drug_name +
  848. " " +
  849. dose +
  850. dose_unit +
  851. "*" +
  852. min_number +
  853. min_unit +
  854. "/" +
  855. max_unit;
  856. loading.close();
  857. if (msg == 1) {
  858. this.$message.error(str + "库存不足,请入库");
  859. loading.close();
  860. } else {
  861. this.$message.success("保存成功");
  862. this.recordInfo.recordData = [];
  863. loading.close();
  864. this.GetOrderDetail(this.order_id)
  865. }
  866. }
  867. });
  868. } else {
  869. return false;
  870. }
  871. });
  872. },
  873. GetOrderDetail: function (order_id) {
  874. const params = {
  875. id: order_id,
  876. };
  877. getDrugWarehouseOutInfo(params).then((response) => {
  878. if (response.data.state == 0) {
  879. this.$message.error(response.data.msg);
  880. return false;
  881. } else {
  882. var manulist = response.data.data.manulist;
  883. this.manufacturerList = manulist;
  884. this.dealerList = response.data.data.dealerList;
  885. for (let i = 0; i < response.data.data.list.length; i++) {
  886. (response.data.data.list[i].drug_name =
  887. response.data.data.list[i].drug.drug_name),
  888. (response.data.data.list[i].drug_type =
  889. response.data.data.list[i].drug.drug_type);
  890. response.data.data.list[i].name =
  891. response.data.data.list[i].drug.dose +
  892. response.data.data.list[i].drug.dose_unit +
  893. "*" +
  894. response.data.data.list[i].drug.min_number +
  895. response.data.data.list[i].drug.min_unit +
  896. "/" +
  897. response.data.data.list[i].drug.max_unit;
  898. // if(response.data.data.list[i].count%response.data.data.list[i].drug.min_number == 0){
  899. // response.data.data.list[i].count = response.data.data.list[i].count/response.data.data.list[i].drug.min_number
  900. // response.data.data.list[i].count_unit = response.data.data.list[i].drug.max_unit
  901. // }
  902. if (
  903. response.data.data.list[i].number == "0" ||
  904. response.data.data.list[i].number == 0
  905. ) {
  906. response.data.data.list[i].number = "";
  907. } else {
  908. response.data.data.list[i].number =
  909. response.data.data.list[i].number;
  910. }
  911. if (
  912. response.data.data.list[i].manufacturer == "0" ||
  913. response.data.data.list[i].manufacturer == 0
  914. ) {
  915. response.data.data.list[i].manufacturer = "";
  916. } else {
  917. response.data.data.list[i].manufacturer =
  918. response.data.data.list[i].drug.manufacturer;
  919. }
  920. response.data.data.list[i].price =
  921. response.data.data.list[i].price.toString();
  922. response.data.data.list[i].retail_price =
  923. response.data.data.list[i].price.toString();
  924. response.data.data.list[i].count =
  925. response.data.data.list[i].count.toString();
  926. if (
  927. response.data.data.list[i].dealer == "0" ||
  928. response.data.data.list[i].dealer == 0
  929. ) {
  930. response.data.data.list[i].dealer = "";
  931. } else {
  932. response.data.data.list[i].dealer =
  933. response.data.data.list[i].dealer;
  934. }
  935. response.data.data.list[i].product_date = this.getTime(
  936. response.data.data.list[i].product_date,
  937. "{y}-{h}-{d}"
  938. );
  939. response.data.data.list[i].expiry_date = this.getTime(
  940. response.data.data.list[i].expiry_date,
  941. "{y}-{h}-{d}"
  942. );
  943. response.data.data.list[i].stock_count =
  944. response.data.data.list[i].stock_count;
  945. response.data.data.list[i].last_price =
  946. response.data.data.list[i].last_price;
  947. this.recordInfo.recordData.push(response.data.data.list[i]);
  948. }
  949. for (let j = 0; j < this.recordInfo.recordData.length; j++) {
  950. for (let i = 0; i < manulist.length; i++) {
  951. if (
  952. this.recordInfo.recordData[j].manufacturer == manulist[i].id
  953. ) {
  954. this.recordInfo.recordData[j].manufacturer =
  955. manulist[i].manufacturer_name;
  956. }
  957. }
  958. for (let z = 0; z < this.dealerList.length; z++) {
  959. if (
  960. this.recordInfo.recordData[j].dealer == this.dealerList[z].id
  961. ) {
  962. this.recordInfo.recordData[j].dealer =
  963. this.dealerList[z].dealer_name;
  964. }
  965. }
  966. }
  967. console.log("wode 23232323232322323", this.recordInfo.recordData);
  968. this.warehouseOut = response.data.data.info;
  969. this.storehouse_id = response.data.data.info.storehouse_id;
  970. this.warehouse_out_time = this.getTime(
  971. this.warehouseOut.warehouse_out_time,
  972. "{y}-{m}-{d}"
  973. );
  974. this.houstList = response.data.data.houstList;
  975. this.doctorList = response.data.data.doctorList;
  976. }
  977. if (this.recordInfo.recordData.length == 0) {
  978. const tempObj = {};
  979. tempObj["id"] = 0;
  980. tempObj["drug_id"] = 0;
  981. tempObj["retail_price"] = "";
  982. tempObj["count"] = "";
  983. tempObj["price"] = "";
  984. tempObj["remark"] = "";
  985. this.recordInfo.recordData.push(tempObj);
  986. }
  987. });
  988. },
  989. calculate: function (val) {
  990. if (val == 0) {
  991. return "";
  992. }
  993. return Math.round(parseFloat(val) * 100) / 100;
  994. },
  995. changeManufacturer(val) {
  996. this.propForm.manufacturer = val;
  997. },
  998. changeDealer(val) {
  999. this.propForm.dealer = val;
  1000. },
  1001. querySearchAsync(keyword, cb) {
  1002. let key = "";
  1003. if (keyword != undefined) {
  1004. key = keyword;
  1005. }
  1006. let searchArray = [];
  1007. postSearchDrugList(key, this.storehouse_id).then((response) => {
  1008. if (response.data.state == 1) {
  1009. searchArray = response.data.data.list;
  1010. var list = response.data.data.list;
  1011. this.drugList = list;
  1012. var manufacturerList = response.data.data.manufacturerList;
  1013. this.manufacturerList = manufacturerList;
  1014. for (let i = 0; i < this.drugList.length; i++) {
  1015. for (let j = 0; j < this.manufacturerList.length; j++) {
  1016. if (
  1017. this.drugList[i].manufacturer == this.manufacturerList[j].id
  1018. ) {
  1019. this.drugList[i].manufacturer =
  1020. this.manufacturerList[j].manufacturer_name;
  1021. }
  1022. }
  1023. }
  1024. cb(this.drugList);
  1025. } else {
  1026. cb([]);
  1027. }
  1028. });
  1029. },
  1030. changeDrugName(val) {
  1031. this.currentIndex = val;
  1032. },
  1033. handleSelect(val) {
  1034. var arr = [];
  1035. for (let i = 0; i < this.recordInfo.recordData.length; i++) {
  1036. arr.push(this.recordInfo.recordData[i].drug_id);
  1037. }
  1038. var str = arr.join(",");
  1039. if (str.indexOf(val.id) != -1) {
  1040. this.$message.error("该药品已存在列表中");
  1041. return;
  1042. }
  1043. this.getDrugBatchNumber(val.id);
  1044. var str_count = "";
  1045. var total_count = 0;
  1046. for (let i = 0; i < val.drug_warehouse_info.length; i++) {
  1047. if (val.max_unit == val.drug_warehouse_info[i].max_unit) {
  1048. val.drug_warehouse_info[i].stock_max_number =
  1049. val.drug_warehouse_info[i].stock_max_number * val.min_number;
  1050. }
  1051. }
  1052. str_count = this.getWarehoseInfo(
  1053. val.drug_warehouse_info,
  1054. val.max_unit,
  1055. val.min_unit,
  1056. val.min_number
  1057. );
  1058. total_count = this.getWarehoseInfoTwo(val.drug_warehouse_info);
  1059. for (let i = 0; i < this.recordInfo.recordData.length; i++) {
  1060. if (i == this.currentIndex) {
  1061. this.recordInfo.recordData[i].drug_id = val.id;
  1062. this.recordInfo.recordData[i].drug_name = val.drug_name;
  1063. this.recordInfo.recordData[i].drug_type = val.drug_type;
  1064. this.recordInfo.recordData[i].name =
  1065. val.dose +
  1066. val.dose_unit +
  1067. "*" +
  1068. val.min_number +
  1069. val.min_unit +
  1070. "/" +
  1071. val.max_unit;
  1072. this.recordInfo.recordData[i].price = val.retail_price;
  1073. this.recordInfo.recordData[i].manufacturer = val.manufacturer;
  1074. this.recordInfo.recordData[i].number = val.number;
  1075. this.recordInfo.recordData[i].max_unit = val.max_unit;
  1076. this.recordInfo.recordData[i].min_unit = val.min_unit;
  1077. this.recordInfo.recordData[i].last_price = val.last_price;
  1078. this.recordInfo.recordData[i].stock_count = str_count;
  1079. this.recordInfo.recordData[i].total_count = total_count;
  1080. this.recordInfo.recordData[i].max_unit_fisrt = val.max_unit;
  1081. this.recordInfo.recordData[i].min_unit_fisrt = val.min_unit;
  1082. this.recordInfo.recordData[i].count_unit = val.max_unit;
  1083. if (val.dealer == 0) {
  1084. this.recordInfo.recordData[i].dealer = "";
  1085. } else {
  1086. this.recordInfo.recordData[i].dealer = val.dealer;
  1087. }
  1088. }
  1089. }
  1090. },
  1091. getDictionaryDataConfig(module, filed_name) {
  1092. return getDictionaryDataConfig(module, filed_name);
  1093. },
  1094. getDataConfig(module, filed_name) {
  1095. return getDataConfig(module, filed_name);
  1096. },
  1097. getDrugBatchNumber(id) {
  1098. var params = {
  1099. id: id,
  1100. };
  1101. getDrugBatchNumber(params).then((response) => {
  1102. if (response.data.state == 1) {
  1103. var list = response.data.data.list;
  1104. this.numberList = list;
  1105. }
  1106. });
  1107. },
  1108. getWarehoseInfo(arr, max_unit, min_unit, min_number) {
  1109. var total = 0;
  1110. var max_str = "";
  1111. var min_str = "";
  1112. if (arr.length > 0) {
  1113. for (let i = 0; i < arr.length; i++) {
  1114. total += parseInt(arr[i].stock_max_number + arr[i].stock_min_number);
  1115. }
  1116. }
  1117. if (total < min_number) {
  1118. min_str = total + min_unit;
  1119. }
  1120. if (total == 0) {
  1121. min_str = "";
  1122. max_str = "";
  1123. }
  1124. if (total >= min_number) {
  1125. if (parseInt(total / min_number) != 0) {
  1126. max_str = parseInt(total / min_number) + max_unit;
  1127. }
  1128. if (total % min_number != 0) {
  1129. min_str = (total % min_number) + min_unit;
  1130. }
  1131. }
  1132. return max_str + min_str;
  1133. },
  1134. getWarehoseInfoTwo(arr) {
  1135. var total = 0;
  1136. if (arr.length > 0) {
  1137. for (let i = 0; i < arr.length; i++) {
  1138. total += parseInt(arr[i].stock_max_number + arr[i].stock_min_number);
  1139. }
  1140. }
  1141. return total;
  1142. },
  1143. getSupplyCount(
  1144. count,
  1145. max_unit,
  1146. min_number,
  1147. index,
  1148. total_count,
  1149. max_unit_fisrt,
  1150. min_unit_fisrt
  1151. ) {
  1152. var count_total = 0;
  1153. if (max_unit == max_unit_fisrt) {
  1154. count_total = count * min_number;
  1155. }
  1156. if (max_unit == min_unit_fisrt) {
  1157. count_total = count;
  1158. }
  1159. if (count_total > total_count) {
  1160. this.$message.error("出库数量不能大于剩余库存");
  1161. for (let i = 0; i < this.recordInfo.recordData.length; i++) {
  1162. if (index == i) {
  1163. this.recordInfo.recordData[i].count = "";
  1164. }
  1165. }
  1166. } else {
  1167. for (let i = 0; i < this.recordInfo.recordData.length; i++) {
  1168. if (index == i) {
  1169. this.recordInfo.recordData[i].count = count;
  1170. }
  1171. }
  1172. }
  1173. console.log("count_toal23233232", count_total);
  1174. },
  1175. toCheck(){
  1176. const loading = this.$loading({
  1177. lock: true,
  1178. text: "Loading",
  1179. spinner: "el-icon-loading",
  1180. background: "rgba(0, 0, 0, 0.7)",
  1181. });
  1182. var params = {
  1183. warehouse_out_id:parseInt(this.$route.query.id)
  1184. }
  1185. toCheckDrugOut(params).then(response=>{
  1186. if(response.data.state == 1){
  1187. var warehousingOutInfoList = response.data.data.warehousingOutInfoList
  1188. var msg =response.data.data.msg
  1189. if(msg == 1){
  1190. this.$message.success("审核成功!")
  1191. this.showCheck = false
  1192. this.showReturnCheck = true
  1193. this.$router.back(-1)
  1194. }
  1195. if(msg == 2){
  1196. var drug_name = response.data.data.drug_name
  1197. var dose = response.data.data.dose
  1198. var dose_unit = response.data.data.dose_unit
  1199. var min_number = response.data.data.min_number
  1200. var min_unit = response.data.data.min_unit
  1201. var max_unit = response.data.data.max_unit
  1202. var str = drug_name +" " +dose +dose_unit +"*" + min_number + min_unit +"/" + max_unit;
  1203. this.$message.error(str+"库存不足,审核失败!")
  1204. }
  1205. loading.close()
  1206. }
  1207. })
  1208. },
  1209. toReturnCheck(){
  1210. const loading = this.$loading({
  1211. lock: true,
  1212. text: "Loading",
  1213. spinner: "el-icon-loading",
  1214. background: "rgba(0, 0, 0, 0.7)",
  1215. });
  1216. var params = {
  1217. warehouse_out_id:parseInt(this.$route.query.id)
  1218. }
  1219. toReturnCheck(params).then(response=>{
  1220. if(response.data.state == 1){
  1221. var out = response.data.data.out
  1222. this.$message.success("反审核成功!")
  1223. this.showCheck = true
  1224. this.showReturnCheck = false
  1225. loading.close()
  1226. this.$router.back(-1)
  1227. }else{
  1228. this.$message.error("审核失败!")
  1229. loading.close()
  1230. this.$router.back(-1)
  1231. }
  1232. })
  1233. }
  1234. },
  1235. created() {
  1236. this.drugTypeList = getDictionaryDataConfig("system", "drug_type");
  1237. this.propForm.goodUnit = this.$store.getters.good_unit;
  1238. const order_id = this.$route.query.id;
  1239. this.order_id = order_id
  1240. this.GetOrderDetail(order_id);
  1241. var sys = this.$route.query.is_sys;
  1242. if (sys == 0) {
  1243. this.drug_show = false;
  1244. }
  1245. if (sys == 1) {
  1246. this.drug_show = true;
  1247. }
  1248. if (sys == 12) {
  1249. this.drug_show = true;
  1250. }
  1251. if (parseInt(this.$route.query.supply_cancel_out_id) > 0 || parseInt(this.$route.query.is_check) == 1) {
  1252. this.drug_show = true;
  1253. }
  1254. this.is_check = parseInt(this.$route.query.is_check)
  1255. this.unitList = getDataConfig("hemodialysis", "units");
  1256. },
  1257. };
  1258. </script>
  1259. <style rel="stylesheet/css" lang="scss" scoped>
  1260. .information {
  1261. border: 1px #dcdfe6 solid;
  1262. padding: 30px 20px 30px 20px;
  1263. .border {
  1264. border-bottom: 1px #dcdfe6 solid;
  1265. margin: 0px 0 20px 0;
  1266. }
  1267. }
  1268. .edit_separater {
  1269. border-top: 1px solid rgb(233, 233, 233);
  1270. margin-top: 15px;
  1271. margin-bottom: 15px;
  1272. }
  1273. </style>
  1274. <style>
  1275. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  1276. font-size: 12px;
  1277. }
  1278. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  1279. background: #6fb5fa;
  1280. }
  1281. </style>