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

drugStockOutOrderEdit.vue 45KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363
  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 (parseInt(this.$route.query.is_sys) == 5) {
  610. this.$message.error("结算出库数据不能新增!");
  611. return;
  612. }
  613. if (row.supply_cancel_out_id > 0) {
  614. this.$message.error("采购出库数据不能新增!");
  615. return;
  616. }
  617. if(this.is_check == 1){
  618. this.$message.error("已审核的单据不能新增!");
  619. return;
  620. }
  621. this.unitShow = false;
  622. if (this.drug_show == true) {
  623. this.$message.error("自动出库数据不能编辑");
  624. return;
  625. }
  626. const tempObj = {};
  627. tempObj["id"] = 0;
  628. tempObj["drug_id"] = 0;
  629. tempObj["retail_price"] = "";
  630. tempObj["count"] = "";
  631. tempObj["max_unit"] = "";
  632. tempObj["min_unit"] = "";
  633. tempObj["price"] = 0;
  634. tempObj["remark"] = "";
  635. tempObj["batch_number"] = "";
  636. tempObj["number"] = "";
  637. tempObj["count_unit"] = "";
  638. tempObj["dealer"] = "";
  639. tempObj["manufacturer"] = "";
  640. tempObj["warehouse_info_id"] = 0;
  641. tempObj["admin_user_id"] = this.$store.getters.xt_user.user.user_name;
  642. tempObj["last_price"] = 0;
  643. tempObj["stock_count"] = "";
  644. tempObj["total_count"] = 0;
  645. tempObj["max_unit_fisrt"] = 0;
  646. tempObj["min_unit_fisrt"] = 0;
  647. this.recordInfo.recordData.push(tempObj);
  648. },
  649. handleDelete: function (index, row) {
  650. if (parseInt(this.$route.query.is_sys) == 12) {
  651. this.$message.error("调拨出库数据不能删除!");
  652. return;
  653. }
  654. if (parseInt(this.$route.query.is_sys) == 5) {
  655. this.$message.error("结算出库数据不能删除!");
  656. return;
  657. }
  658. if(parseInt(this.$route.query.is_check) == 1){
  659. this.$message.error("已审核的单据不能删除!")
  660. return false
  661. }
  662. if (row.supply_cancel_out_id > 0) {
  663. this.$message.error("采购出库数据不能删除!");
  664. return;
  665. }
  666. if (this.drug_show == true) {
  667. this.$message.error("采购出库数据不能编辑");
  668. return;
  669. }
  670. if (this.is_checks == 2) {
  671. this.$message.error("已审核的单据不能删除!");
  672. return;
  673. }
  674. if (row.id == 0) {
  675. this.recordInfo.recordData.splice(index, 1);
  676. } else {
  677. const params = {
  678. id: row.id,
  679. };
  680. this.$confirm("确认删除该出库商品信息记录?", "删除出库商品信息记录", {
  681. confirmButtonText: "确定",
  682. cancelButtonText: "取消",
  683. type: "warning",
  684. })
  685. .then(() => {
  686. deleteDrugWarehouseOutInfo(params).then((response) => {
  687. if (response.data.state == 0) {
  688. this.$message.error(response.data.msg);
  689. return false;
  690. } else {
  691. this.$message.success("删除成功");
  692. this.recordInfo.recordData.splice(index, 1);
  693. }
  694. });
  695. })
  696. .catch(() => {});
  697. }
  698. },
  699. // getTime(val, temp) {
  700. // if (val != 0) {
  701. // return uParseTime(val, temp)
  702. // } else {
  703. // return ''
  704. // }
  705. // },
  706. getTime(val) {
  707. if (val < 0) {
  708. return "";
  709. }
  710. if (val == "") {
  711. return "";
  712. } else {
  713. return uParseTime(val, "{y}-{m}-{d}");
  714. }
  715. },
  716. showDialog(index, row) {
  717. this.currentIndex = index;
  718. const loading = this.$loading({
  719. lock: true,
  720. text: "Loading",
  721. spinner: "el-icon-loading",
  722. background: "rgba(0, 0, 0, 0.7)",
  723. });
  724. const params = {
  725. manufacturer_id: this.form.manufacturer,
  726. dealer_id: this.form.dealer,
  727. };
  728. GetAllDrugInfoByID(params).then((response) => {
  729. if (response.data.state == 0) {
  730. this.$message.error(response.data.msg);
  731. return false;
  732. } else {
  733. if (response.data.data.drugs.length <= 0) {
  734. this.$message.error("该厂商或经销商没有药品信息");
  735. return;
  736. }
  737. this.$refs.dialog.show();
  738. for (let i = 0; i < response.data.data.drugs.length; i++) {
  739. this.propForm.goods.push(response.data.data.drugs[i]);
  740. }
  741. const obj = {};
  742. this.propForm.goods = this.propForm.goods.reduce((cur, next) => {
  743. obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
  744. return cur;
  745. }, []); // 设置cur默认类型为数组,并且初始值为空的数组
  746. }
  747. for (let i = 0; i < this.propForm.goods.length; i++) {
  748. for (let a = 0; a < this.propForm.goods[i].drug_specs.length; a++) {
  749. var respObj = this.propForm.goods[i].drug_specs[a];
  750. respObj["isSelected"] = false;
  751. }
  752. }
  753. loading.close();
  754. });
  755. },
  756. back() {
  757. this.$router.go(-1);
  758. },
  759. submit() {
  760. this.$refs["tableForm"].validate((valid) => {
  761. if (valid) {
  762. const array = this.recordInfo.recordData;
  763. for (let i = 0; i < array.length; i++) {
  764. if (array[i].drug_id == 0) {
  765. this.$message.error("药品名称或者药品规格名称不能为空");
  766. return;
  767. }
  768. }
  769. for (let i = 0; i < this.recordInfo.recordData.length; i++) {
  770. this.recordInfo.recordData[i].price =
  771. this.recordInfo.recordData[i].price.toString();
  772. if (this.recordInfo.recordData[i].dealer == "") {
  773. this.recordInfo.recordData[i].dealer = 0;
  774. }
  775. for (let j = 0; j < this.manufacturerList.length; j++) {
  776. if (
  777. this.recordInfo.recordData[i].manufacturer ==
  778. this.manufacturerList[j].manufacturer_name
  779. ) {
  780. this.recordInfo.recordData[i].manufacturer =
  781. this.manufacturerList[j].id;
  782. }
  783. }
  784. for (let z = 0; z < this.dealerList.length; z++) {
  785. if (
  786. this.recordInfo.recordData[i].dealer ==
  787. this.dealerList[z].dealer_name
  788. ) {
  789. this.recordInfo.recordData[i].dealer = this.dealerList[z].id;
  790. }
  791. }
  792. for (let y = 0; y < this.numberList.length; y++) {
  793. if (
  794. this.recordInfo.recordData[i].batch_number ==
  795. this.numberList[y].id
  796. ) {
  797. this.recordInfo.recordData[i].batch_number =
  798. this.numberList[y].batch_number;
  799. this.recordInfo.recordData[i].warehouse_info_id =
  800. this.numberList[y].id;
  801. }
  802. if (
  803. this.recordInfo.recordData[i].batch_number ==
  804. this.numberList[y].batch_number
  805. ) {
  806. this.recordInfo.recordData[i].warehouse_info_id =
  807. this.numberList[y].id;
  808. }
  809. }
  810. for (let s = 0; s < this.doctorList.length; s++) {
  811. if (
  812. this.recordInfo.recordData[i].admin_user_id ==
  813. this.doctorList[s].user_name
  814. ) {
  815. this.recordInfo.recordData[i].admin_user_id =
  816. this.doctorList[s].admin_user_id;
  817. }
  818. }
  819. this.recordInfo.recordData[i].last_price =
  820. this.recordInfo.recordData[i].last_price.toString();
  821. this.recordInfo.recordData[i].stock_count =
  822. this.recordInfo.recordData[i].stock_count.toString();
  823. }
  824. const loading = this.$loading({
  825. lock: true,
  826. text: "Loading",
  827. spinner: "el-icon-loading",
  828. background: "rgba(0, 0, 0, 0.7)",
  829. });
  830. const params = {
  831. stockOut: this.recordInfo.recordData,
  832. };
  833. editDrugWarehouseoutInfo(
  834. params,
  835. this.warehouse_out_time,
  836. this.$route.query.id,
  837. this.$route.query.type,
  838. this.form.manufacturer,
  839. this.form.dealer,
  840. this.storehouse_id
  841. ).then((response) => {
  842. if (response.data.state == 0) {
  843. this.$message.error(response.data.msg);
  844. loading.close();
  845. return false;
  846. } else {
  847. var msg = response.data.data.msg;
  848. var drug_name = response.data.data.drug_name;
  849. var dose = response.data.data.dose;
  850. var dose_unit = response.data.data.dose_unit;
  851. var min_number = response.data.data.min_number;
  852. var min_unit = response.data.data.min_unit;
  853. var max_unit = response.data.data.max_unit;
  854. var str =
  855. drug_name +
  856. " " +
  857. dose +
  858. dose_unit +
  859. "*" +
  860. min_number +
  861. min_unit +
  862. "/" +
  863. max_unit;
  864. loading.close();
  865. if (msg == 1) {
  866. this.$message.error(str + "库存不足,请入库");
  867. loading.close();
  868. } else {
  869. this.$message.success("保存成功");
  870. this.recordInfo.recordData = [];
  871. loading.close();
  872. this.GetOrderDetail(this.order_id)
  873. }
  874. }
  875. });
  876. } else {
  877. return false;
  878. }
  879. });
  880. },
  881. GetOrderDetail: function (order_id) {
  882. const params = {
  883. id: order_id,
  884. };
  885. getDrugWarehouseOutInfo(params).then((response) => {
  886. if (response.data.state == 0) {
  887. this.$message.error(response.data.msg);
  888. return false;
  889. } else {
  890. this.recordInfo.recordData = []
  891. var manulist = response.data.data.manulist;
  892. this.manufacturerList = manulist;
  893. this.dealerList = response.data.data.dealerList;
  894. for (let i = 0; i < response.data.data.list.length; i++) {
  895. (response.data.data.list[i].drug_name =
  896. response.data.data.list[i].drug.drug_name),
  897. (response.data.data.list[i].drug_type =
  898. response.data.data.list[i].drug.drug_type);
  899. response.data.data.list[i].name =
  900. response.data.data.list[i].drug.dose +
  901. response.data.data.list[i].drug.dose_unit +
  902. "*" +
  903. response.data.data.list[i].drug.min_number +
  904. response.data.data.list[i].drug.min_unit +
  905. "/" +
  906. response.data.data.list[i].drug.max_unit;
  907. // if(response.data.data.list[i].count%response.data.data.list[i].drug.min_number == 0){
  908. // response.data.data.list[i].count = response.data.data.list[i].count/response.data.data.list[i].drug.min_number
  909. // response.data.data.list[i].count_unit = response.data.data.list[i].drug.max_unit
  910. // }
  911. if (
  912. response.data.data.list[i].number == "0" ||
  913. response.data.data.list[i].number == 0
  914. ) {
  915. response.data.data.list[i].number = "";
  916. } else {
  917. response.data.data.list[i].number =
  918. response.data.data.list[i].number;
  919. }
  920. if (
  921. response.data.data.list[i].manufacturer == "0" ||
  922. response.data.data.list[i].manufacturer == 0
  923. ) {
  924. response.data.data.list[i].manufacturer = "";
  925. } else {
  926. response.data.data.list[i].manufacturer =
  927. response.data.data.list[i].drug.manufacturer;
  928. }
  929. response.data.data.list[i].price =
  930. response.data.data.list[i].price.toString();
  931. response.data.data.list[i].retail_price =
  932. response.data.data.list[i].price.toString();
  933. response.data.data.list[i].count =
  934. response.data.data.list[i].count.toString();
  935. if (
  936. response.data.data.list[i].dealer == "0" ||
  937. response.data.data.list[i].dealer == 0
  938. ) {
  939. response.data.data.list[i].dealer = "";
  940. } else {
  941. response.data.data.list[i].dealer =
  942. response.data.data.list[i].dealer;
  943. }
  944. response.data.data.list[i].product_date = this.getTime(
  945. response.data.data.list[i].product_date,
  946. "{y}-{h}-{d}"
  947. );
  948. response.data.data.list[i].expiry_date = this.getTime(
  949. response.data.data.list[i].expiry_date,
  950. "{y}-{h}-{d}"
  951. );
  952. response.data.data.list[i].stock_count =
  953. response.data.data.list[i].stock_count;
  954. response.data.data.list[i].last_price =
  955. response.data.data.list[i].last_price;
  956. this.recordInfo.recordData.push(response.data.data.list[i]);
  957. }
  958. for (let j = 0; j < this.recordInfo.recordData.length; j++) {
  959. for (let i = 0; i < manulist.length; i++) {
  960. if (
  961. this.recordInfo.recordData[j].manufacturer == manulist[i].id
  962. ) {
  963. this.recordInfo.recordData[j].manufacturer =
  964. manulist[i].manufacturer_name;
  965. }
  966. }
  967. for (let z = 0; z < this.dealerList.length; z++) {
  968. if (
  969. this.recordInfo.recordData[j].dealer == this.dealerList[z].id
  970. ) {
  971. this.recordInfo.recordData[j].dealer =
  972. this.dealerList[z].dealer_name;
  973. }
  974. }
  975. }
  976. console.log("wode 23232323232322323", this.recordInfo.recordData);
  977. this.warehouseOut = response.data.data.info;
  978. this.storehouse_id = response.data.data.info.storehouse_id;
  979. this.warehouse_out_time = this.getTime(
  980. this.warehouseOut.warehouse_out_time,
  981. "{y}-{m}-{d}"
  982. );
  983. this.houstList = response.data.data.houstList;
  984. this.doctorList = response.data.data.doctorList;
  985. }
  986. if (this.recordInfo.recordData.length == 0) {
  987. const tempObj = {};
  988. tempObj["id"] = 0;
  989. tempObj["drug_id"] = 0;
  990. tempObj["retail_price"] = "";
  991. tempObj["count"] = "";
  992. tempObj["price"] = "";
  993. tempObj["remark"] = "";
  994. this.recordInfo.recordData.push(tempObj);
  995. }
  996. });
  997. },
  998. calculate: function (val) {
  999. if (val == 0) {
  1000. return "";
  1001. }
  1002. return Math.round(parseFloat(val) * 100) / 100;
  1003. },
  1004. changeManufacturer(val) {
  1005. this.propForm.manufacturer = val;
  1006. },
  1007. changeDealer(val) {
  1008. this.propForm.dealer = val;
  1009. },
  1010. querySearchAsync(keyword, cb) {
  1011. let key = "";
  1012. if (keyword != undefined) {
  1013. key = keyword;
  1014. }
  1015. let searchArray = [];
  1016. postSearchDrugList(key, this.storehouse_id).then((response) => {
  1017. if (response.data.state == 1) {
  1018. searchArray = response.data.data.list;
  1019. var list = response.data.data.list;
  1020. this.drugList = list;
  1021. var manufacturerList = response.data.data.manufacturerList;
  1022. this.manufacturerList = manufacturerList;
  1023. for (let i = 0; i < this.drugList.length; i++) {
  1024. for (let j = 0; j < this.manufacturerList.length; j++) {
  1025. if (
  1026. this.drugList[i].manufacturer == this.manufacturerList[j].id
  1027. ) {
  1028. this.drugList[i].manufacturer =
  1029. this.manufacturerList[j].manufacturer_name;
  1030. }
  1031. }
  1032. }
  1033. cb(this.drugList);
  1034. } else {
  1035. cb([]);
  1036. }
  1037. });
  1038. },
  1039. changeDrugName(val) {
  1040. this.currentIndex = val;
  1041. },
  1042. handleSelect(val) {
  1043. var arr = [];
  1044. for (let i = 0; i < this.recordInfo.recordData.length; i++) {
  1045. arr.push(this.recordInfo.recordData[i].drug_id);
  1046. }
  1047. var str = arr.join(",");
  1048. if (str.indexOf(val.id) != -1) {
  1049. this.$message.error("该药品已存在列表中");
  1050. return;
  1051. }
  1052. this.getDrugBatchNumber(val.id);
  1053. var str_count = "";
  1054. var total_count = 0;
  1055. for (let i = 0; i < val.drug_warehouse_info.length; i++) {
  1056. if (val.max_unit == val.drug_warehouse_info[i].max_unit) {
  1057. val.drug_warehouse_info[i].stock_max_number =
  1058. val.drug_warehouse_info[i].stock_max_number * val.min_number;
  1059. }
  1060. }
  1061. str_count = this.getWarehoseInfo(
  1062. val.drug_warehouse_info,
  1063. val.max_unit,
  1064. val.min_unit,
  1065. val.min_number
  1066. );
  1067. total_count = this.getWarehoseInfoTwo(val.drug_warehouse_info);
  1068. for (let i = 0; i < this.recordInfo.recordData.length; i++) {
  1069. if (i == this.currentIndex) {
  1070. this.recordInfo.recordData[i].drug_id = val.id;
  1071. this.recordInfo.recordData[i].drug_name = val.drug_name;
  1072. this.recordInfo.recordData[i].drug_type = val.drug_type;
  1073. this.recordInfo.recordData[i].name =
  1074. val.dose +
  1075. val.dose_unit +
  1076. "*" +
  1077. val.min_number +
  1078. val.min_unit +
  1079. "/" +
  1080. val.max_unit;
  1081. this.recordInfo.recordData[i].price = val.retail_price;
  1082. this.recordInfo.recordData[i].manufacturer = val.manufacturer;
  1083. this.recordInfo.recordData[i].number = val.number;
  1084. this.recordInfo.recordData[i].max_unit = val.max_unit;
  1085. this.recordInfo.recordData[i].min_unit = val.min_unit;
  1086. this.recordInfo.recordData[i].last_price = val.last_price;
  1087. this.recordInfo.recordData[i].stock_count = str_count;
  1088. this.recordInfo.recordData[i].total_count = total_count;
  1089. this.recordInfo.recordData[i].max_unit_fisrt = val.max_unit;
  1090. this.recordInfo.recordData[i].min_unit_fisrt = val.min_unit;
  1091. this.recordInfo.recordData[i].count_unit = val.max_unit;
  1092. if(val.first_drug_warehouse_info!=null&&val.first_drug_warehouse_info.expiry_date >0){
  1093. this.recordInfo.recordData[i].expiry_date = this.getTime(val.first_drug_warehouse_info.expiry_date)
  1094. }else{
  1095. this.recordInfo.recordData[i].expiry_date = ""
  1096. }
  1097. if(val.first_drug_warehouse_info!=null&&val.first_drug_warehouse_info.product_date >0){
  1098. this.recordInfo.recordData[i].product_date = this.getTime(val.first_drug_warehouse_info.product_date)
  1099. }else{
  1100. this.recordInfo.recordData[i].product_date=""
  1101. }
  1102. if (val.dealer == 0) {
  1103. this.recordInfo.recordData[i].dealer = "";
  1104. } else {
  1105. this.recordInfo.recordData[i].dealer = val.dealer;
  1106. }
  1107. }
  1108. }
  1109. },
  1110. getDictionaryDataConfig(module, filed_name) {
  1111. return getDictionaryDataConfig(module, filed_name);
  1112. },
  1113. getDataConfig(module, filed_name) {
  1114. return getDataConfig(module, filed_name);
  1115. },
  1116. getDrugBatchNumber(id) {
  1117. var params = {
  1118. id: id,
  1119. };
  1120. getDrugBatchNumber(params).then((response) => {
  1121. if (response.data.state == 1) {
  1122. var list = response.data.data.list;
  1123. this.numberList = list;
  1124. }
  1125. });
  1126. },
  1127. getWarehoseInfo(arr, max_unit, min_unit, min_number) {
  1128. var total = 0;
  1129. var max_str = "";
  1130. var min_str = "";
  1131. if (arr.length > 0) {
  1132. for (let i = 0; i < arr.length; i++) {
  1133. total += parseInt(arr[i].stock_max_number + arr[i].stock_min_number);
  1134. }
  1135. }
  1136. if (total < min_number) {
  1137. min_str = total + min_unit;
  1138. }
  1139. if (total == 0) {
  1140. min_str = "";
  1141. max_str = "";
  1142. }
  1143. if (total >= min_number) {
  1144. if (parseInt(total / min_number) != 0) {
  1145. max_str = parseInt(total / min_number) + max_unit;
  1146. }
  1147. if (total % min_number != 0) {
  1148. min_str = (total % min_number) + min_unit;
  1149. }
  1150. }
  1151. return max_str + min_str;
  1152. },
  1153. getWarehoseInfoTwo(arr) {
  1154. var total = 0;
  1155. if (arr.length > 0) {
  1156. for (let i = 0; i < arr.length; i++) {
  1157. total += parseInt(arr[i].stock_max_number + arr[i].stock_min_number);
  1158. }
  1159. }
  1160. return total;
  1161. },
  1162. getSupplyCount(
  1163. count,
  1164. max_unit,
  1165. min_number,
  1166. index,
  1167. total_count,
  1168. max_unit_fisrt,
  1169. min_unit_fisrt
  1170. ) {
  1171. var count_total = 0;
  1172. if (max_unit == max_unit_fisrt) {
  1173. count_total = count * min_number;
  1174. }
  1175. if (max_unit == min_unit_fisrt) {
  1176. count_total = count;
  1177. }
  1178. if (count_total > total_count) {
  1179. this.$message.error("出库数量不能大于剩余库存");
  1180. for (let i = 0; i < this.recordInfo.recordData.length; i++) {
  1181. if (index == i) {
  1182. this.recordInfo.recordData[i].count = "";
  1183. }
  1184. }
  1185. } else {
  1186. for (let i = 0; i < this.recordInfo.recordData.length; i++) {
  1187. if (index == i) {
  1188. this.recordInfo.recordData[i].count = count;
  1189. }
  1190. }
  1191. }
  1192. console.log("count_toal23233232", count_total);
  1193. },
  1194. toCheck(){
  1195. const loading = this.$loading({
  1196. lock: true,
  1197. text: "Loading",
  1198. spinner: "el-icon-loading",
  1199. background: "rgba(0, 0, 0, 0.7)",
  1200. });
  1201. var params = {
  1202. warehouse_out_id:parseInt(this.$route.query.id)
  1203. }
  1204. toCheckDrugOut(params).then(response=>{
  1205. if(response.data.state == 1){
  1206. var warehousingOutInfoList = response.data.data.warehousingOutInfoList
  1207. var msg =response.data.data.msg
  1208. if(msg == 1){
  1209. this.$message.success("审核成功!")
  1210. this.showCheck = false
  1211. this.showReturnCheck = true
  1212. this.$router.back(-1)
  1213. }
  1214. if(msg == 2){
  1215. var drug_name = response.data.data.drug_name
  1216. var dose = response.data.data.dose
  1217. var dose_unit = response.data.data.dose_unit
  1218. var min_number = response.data.data.min_number
  1219. var min_unit = response.data.data.min_unit
  1220. var max_unit = response.data.data.max_unit
  1221. var str = drug_name +" " +dose +dose_unit +"*" + min_number + min_unit +"/" + max_unit;
  1222. this.$message.error(str+"库存不足,审核失败!")
  1223. }
  1224. loading.close()
  1225. }
  1226. })
  1227. },
  1228. toReturnCheck(){
  1229. const loading = this.$loading({
  1230. lock: true,
  1231. text: "Loading",
  1232. spinner: "el-icon-loading",
  1233. background: "rgba(0, 0, 0, 0.7)",
  1234. });
  1235. var params = {
  1236. warehouse_out_id:parseInt(this.$route.query.id)
  1237. }
  1238. toReturnCheck(params).then(response=>{
  1239. if(response.data.state == 1){
  1240. var out = response.data.data.out
  1241. this.$message.success("反审核成功!")
  1242. this.showCheck = true
  1243. this.showReturnCheck = false
  1244. loading.close()
  1245. this.$router.back(-1)
  1246. }else{
  1247. this.$message.error("审核失败!")
  1248. loading.close()
  1249. this.$router.back(-1)
  1250. }
  1251. })
  1252. }
  1253. },
  1254. created() {
  1255. this.drugTypeList = getDictionaryDataConfig("system", "drug_type");
  1256. this.propForm.goodUnit = this.$store.getters.good_unit;
  1257. const order_id = this.$route.query.id;
  1258. this.order_id = order_id
  1259. this.GetOrderDetail(order_id);
  1260. var sys = this.$route.query.is_sys;
  1261. if (sys == 0) {
  1262. this.drug_show = false;
  1263. }
  1264. if (sys == 1) {
  1265. this.drug_show = true;
  1266. }
  1267. if (sys == 12 || sys==5) {
  1268. this.drug_show = true;
  1269. }
  1270. if (parseInt(this.$route.query.supply_cancel_out_id) > 0 || parseInt(this.$route.query.is_check) == 1) {
  1271. this.drug_show = true;
  1272. }
  1273. this.is_check = parseInt(this.$route.query.is_check)
  1274. this.unitList = getDataConfig("hemodialysis", "units");
  1275. },
  1276. };
  1277. </script>
  1278. <style rel="stylesheet/css" lang="scss" scoped>
  1279. .information {
  1280. border: 1px #dcdfe6 solid;
  1281. padding: 30px 20px 30px 20px;
  1282. .border {
  1283. border-bottom: 1px #dcdfe6 solid;
  1284. margin: 0px 0 20px 0;
  1285. }
  1286. }
  1287. .edit_separater {
  1288. border-top: 1px solid rgb(233, 233, 233);
  1289. margin-top: 15px;
  1290. margin-bottom: 15px;
  1291. }
  1292. </style>
  1293. <style>
  1294. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  1295. font-size: 12px;
  1296. }
  1297. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  1298. background: #6fb5fa;
  1299. }
  1300. .el-autocomplete-suggestion{
  1301. width: 400px !important;
  1302. }
  1303. </style>