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

drugStockOutOrderAdd.vue 34KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026
  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"
  14. >取 消</el-button
  15. >
  16. <el-button
  17. size="small"
  18. type="primary"
  19. @click="submit()"
  20. class="filter-item"
  21. >保 存</el-button
  22. >
  23. </div>
  24. </div>
  25. <div class="app-container">
  26. <div class="cell clearfix">
  27. <label class="title"><span class="name"><span style="color:red">*</span>仓库</span> :</label>
  28. <el-select size="small" v-model="storehouse_id" filterable placeholder="请选择仓库" style="width:200px">
  29. <el-option
  30. v-for="(option, index) in list"
  31. :key="index"
  32. :label="option.storehouse_name"
  33. :value="option.id">
  34. </el-option>
  35. </el-select>
  36. <label class="title"><span class="name">出库时间</span> : </label>
  37. <el-date-picker
  38. size="small"
  39. v-model="warehouse_out_time"
  40. prefix-icon="el-icon-date"
  41. :editable="false"
  42. style="width: 200px;"
  43. type="date"
  44. placeholder="选择日期时间"
  45. align="right"
  46. format="yyyy-MM-dd"
  47. value-format="yyyy-MM-dd"
  48. ></el-date-picker>
  49. </div>
  50. <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
  51. <el-table
  52. v-loading="listLoading"
  53. :data="recordInfo.recordData"
  54. :class="signAndWeighBoxPatients"
  55. style="width: 100%"
  56. border
  57. max-height="450"
  58. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  59. >
  60. <el-table-column align="center" width="200" fixed="left">
  61. <template slot="header" slot-scope="scope">
  62. <span>药品名称<span style="color: red">*</span></span>
  63. </template>
  64. <template slot-scope="scope">
  65. <el-form-item style="padding-top: 20px">
  66. <el-autocomplete
  67. class="checkSearch"
  68. popper-class="my-autocomplete"
  69. v-model="scope.row.drug_name"
  70. :fetch-suggestions="querySearchAsync"
  71. :trigger-on-focus="true"
  72. placeholder="请输入药品名称"
  73. @select="handleSelect"
  74. @input="changeGoodName(scope.$index)"
  75. style="width:160px;"
  76. >
  77. <i class="el-icon-search el-input__icon" slot="suffix"></i>
  78. <template slot-scope="{ item }">
  79. <div class="name">{{ item.drug_name + item.dose + item.dose_unit + "*" +item.min_number + item.min_unit +"/" + item.max_unit + " " + item.manufacturer}}</div>
  80. </template>
  81. </el-autocomplete>
  82. </el-form-item>
  83. </template>
  84. </el-table-column>
  85. <el-table-column align="center" width="140">
  86. <template slot="header" slot-scope="scope">
  87. <span>药品类型</span>
  88. </template>
  89. <template slot-scope="scope">
  90. <el-select v-model="scope.row.drug_type" filterable placeholder="请选择厂商">
  91. <el-option
  92. v-for="(option, index) in drugTypeList"
  93. :key="index"
  94. :label="option.name"
  95. :value="option.id">
  96. </el-option>
  97. </el-select>
  98. </template>
  99. </el-table-column>
  100. <el-table-column align="center" width="140">
  101. <template slot="header" slot-scope="scope">
  102. <span>规格&单位<span style="color: red">*</span></span>
  103. </template>
  104. <template slot-scope="scope">
  105. <el-form-item style="padding-top: 20px">
  106. <el-input
  107. :disabled="true"
  108. placeholder="请输入规格&单位"
  109. v-model="scope.row.name"
  110. ></el-input>
  111. </el-form-item>
  112. </template>
  113. </el-table-column>
  114. <el-table-column width="150" align="center">
  115. <template slot="header" slot-scope="scope">
  116. <span>剩余库存</span>
  117. </template>
  118. <template slot-scope="scope">
  119. <el-form-item
  120. :rules="tableRules.stock_count"
  121. style="padding-top: 20px"
  122. >
  123. <div>
  124. <el-input
  125. :disabled="true"
  126. style="width:120px"
  127. placeholder="剩余库存"
  128. v-model="scope.row.stock_count"
  129. ></el-input>
  130. </div>
  131. </el-form-item>
  132. </template>
  133. </el-table-column>
  134. <el-table-column width="200" align="center">
  135. <template slot="header" slot-scope="scope">
  136. <span>出库数量<span style="color: red">*</span></span>
  137. </template>
  138. <template slot-scope="scope">
  139. <el-form-item
  140. :prop="'recordData.' + scope.$index + '.count'"
  141. :rules="tableRules.count"
  142. style="padding-top: 20px"
  143. >
  144. <div style="display:flex;">
  145. <el-input
  146. @input="getSupplyCount(scope.row.count,scope.row.max_unit,scope.row.min_number,scope.$index,scope.row.total_count,scope.row.max_unit_fisrt,scope.row.min_unit_fisrt)"
  147. oninput="value=value.replace(/\D|^0/g,'')"
  148. style="width:80px"
  149. placeholder="请输入出库数量"
  150. type="number"
  151. v-model="scope.row.count"
  152. ></el-input>
  153. <el-select v-model="scope.row.max_unit" filterable placeholder="请选择单位" style="width:80px" @change="changeUnit(scope.row,scope.$index)">
  154. <el-option
  155. v-for="(option, index) in unitList"
  156. :key="index"
  157. :label="option.name"
  158. :value="option.name">
  159. </el-option>
  160. </el-select>
  161. </div>
  162. </el-form-item>
  163. </template>
  164. </el-table-column>
  165. <el-table-column label="出库对象" width="140" align="center">
  166. <template slot-scope="scope">
  167. <el-select v-model="scope.row.admin_user_id" filterable placeholder="请选择厂商">
  168. <el-option
  169. v-for="(option, index) in doctorList"
  170. :key="index"
  171. :label="option.user_name"
  172. :value="option.admin_user_id">
  173. </el-option>
  174. </el-select>
  175. </template>
  176. </el-table-column>
  177. <!-- <el-table-column width="120" align="center">
  178. <template slot="header" slot-scope="scope">
  179. <span>进货价</span>
  180. </template>
  181. <template slot-scope="scope">
  182. <el-form-item
  183. :rules="tableRules.last_price"
  184. style="padding-top: 20px"
  185. >
  186. <el-input
  187. :disabled="true"
  188. placeholder="进货价"
  189. type="number"
  190. v-model="scope.row.last_price"
  191. ></el-input>
  192. </el-form-item>
  193. </template>
  194. </el-table-column> -->
  195. <el-table-column width="120" align="center">
  196. <template slot="header" slot-scope="scope">
  197. <span>出货价<span style="color: red">*</span></span>
  198. </template>
  199. <template slot-scope="scope">
  200. <el-form-item
  201. :prop="'recordData.' + scope.$index + '.price'"
  202. :rules="tableRules.price"
  203. style="padding-top: 20px"
  204. >
  205. <el-input
  206. placeholder="请输入出货价"
  207. type="number"
  208. v-model="scope.row.price"
  209. ></el-input>
  210. </el-form-item>
  211. </template>
  212. </el-table-column>
  213. <el-table-column label="总价" width="80" align="center">
  214. <template slot-scope="scope">
  215. {{ calculate(scope.row.price * scope.row.count) }}
  216. </template>
  217. </el-table-column>
  218. <el-table-column label="生产厂家" width="140" align="center">
  219. <template slot-scope="scope">
  220. <el-select v-model="scope.row.manufacturer" filterable placeholder="请选择厂商">
  221. <el-option
  222. v-for="(option, index) in manufacturerList"
  223. :key="index"
  224. :label="option.manufacturer_name"
  225. :value="option.id">
  226. </el-option>
  227. </el-select>
  228. </template>
  229. </el-table-column>
  230. <el-table-column label="生产日期" width="180" align="center">
  231. <template slot-scope="scope">
  232. <el-date-picker
  233. prefix-icon="el-icon-date"
  234. style="width: 145px"
  235. v-model="scope.row.product_date"
  236. type="date"
  237. placeholder="选择日期时间"
  238. format="yyyy-MM-dd"
  239. value-format="yyyy-MM-dd"
  240. ></el-date-picker>
  241. </template>
  242. </el-table-column>
  243. <el-table-column label="有效日期" width="180" align="center">
  244. <template slot-scope="scope">
  245. <el-date-picker
  246. prefix-icon="el-icon-date"
  247. style="width: 145px"
  248. v-model="scope.row.expiry_date"
  249. type="date"
  250. placeholder="选择日期时间"
  251. format="yyyy-MM-dd"
  252. value-format="yyyy-MM-dd"
  253. ></el-date-picker>
  254. </template>
  255. </el-table-column>
  256. <el-table-column align="center" width="150" label="批准文号">
  257. <template slot-scope="scope">
  258. <el-form-item style="padding-top: 20px" :disabled="true">
  259. <el-input
  260. placeholder="请输入批准文号"
  261. v-model="scope.row.number"
  262. ></el-input>
  263. </el-form-item>
  264. </template>
  265. </el-table-column>
  266. <el-table-column label="经销商" width="140" align="center">
  267. <template slot-scope="scope">
  268. <el-select v-model="scope.row.dealer" filterable placeholder="请选择厂商">
  269. <el-option
  270. v-for="(option, index) in dealerList"
  271. :key="index"
  272. :label="option.dealer_name"
  273. :value="option.id">
  274. </el-option>
  275. </el-select>
  276. </template>
  277. </el-table-column>
  278. <el-table-column label="备注" width="120" align="center">
  279. <template slot-scope="scope">
  280. <el-input v-model="scope.row.remark"></el-input>
  281. </template>
  282. </el-table-column>
  283. <el-table-column label="操作" align="center" width="150" fixed="right">
  284. <template slot-scope="scope">
  285. <el-tooltip
  286. class="item"
  287. effect="dark"
  288. content="新增"
  289. placement="top"
  290. >
  291. <el-button
  292. size="mini"
  293. type="primary"
  294. icon="el-icon-circle-plus-outline"
  295. @click="handleEdit(scope.$index, scope.row)"
  296. >
  297. </el-button>
  298. </el-tooltip>
  299. <el-tooltip
  300. class="item"
  301. effect="dark"
  302. content="删除"
  303. placement="top"
  304. >
  305. <el-button
  306. size="mini"
  307. type="danger"
  308. icon="el-icon-delete"
  309. @click="handleDelete(scope.$index, scope.row)"
  310. >
  311. </el-button>
  312. </el-tooltip>
  313. </template>
  314. </el-table-column>
  315. </el-table>
  316. </el-form>
  317. </div>
  318. </div>
  319. </template>
  320. <script>
  321. import { uParseTime } from "@/utils/tools";
  322. import { postDrugWarehouseOut,GetAllConfig,GetAllDrugInfoByID,getDrugBatchNumber } from "@/api/drug/drug_stock";
  323. import BreadCrumb from "../../components/bread-crumb";
  324. import DrugsStockDialog from './drugsStockDialog/index'
  325. import { getDataConfig,getDictionaryDataConfig } from "@/utils/data";
  326. import {postSearchDrugList} from "@/api/data"
  327. export default {
  328. components: { DrugsStockDialog, BreadCrumb },
  329. name: "salesReturnOrderAdd",
  330. data() {
  331. return {
  332. crumbs: [
  333. { path: false, name: "库存管理" },
  334. { path: false, name: "药品出库单" },
  335. { path: false, name: "新增出库单" }
  336. ],
  337. crumbs2: [
  338. { path: false, name: "库存管理" },
  339. { path: false, name: "其他出库单" },
  340. { path: false, name: "新增出库单" }
  341. ],
  342. type: this.$route.query.type,
  343. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  344. warehouse_out_time: "",
  345. currentIndex: 0,
  346. recordInfo: {
  347. recordData: []
  348. },
  349. tableRules: {
  350. price: [{ required: true, message: "单价不能为空", trigger: "blur" }],
  351. count: [{ required: true, message: "数量不能为空", trigger: "blur" }],
  352. min_unit:[{required:true,message:"单位不能为空",trigger:"blur"}]
  353. },
  354. ruleForm: {
  355. manufacturer: [
  356. { required: true, message: "请选择厂商", trigger: "change" }
  357. ]
  358. },
  359. // prop
  360. isVisibility: false,
  361. propForm: {
  362. goods: [],
  363. goodType: [],
  364. goodInfo: [],
  365. goodUnit: [],
  366. manufacturer: 0,
  367. dealer: 0
  368. },
  369. form: {
  370. manufacturer: 0,
  371. dealer: 0
  372. },
  373. warehouseInfoList: [],
  374. manufacturer: [],
  375. dealer: [],
  376. goodType: [],
  377. goodInfo:[],
  378. drugList:[],
  379. manufacturerList:[],
  380. dealerList:[],
  381. showOne:true,
  382. showTwo:false,
  383. drugTypeList:[],
  384. totalPrice:0,
  385. unitList:[],
  386. numberList:[],
  387. listLoading: false,
  388. storehouse_id:"",
  389. list:[],
  390. doctorList:[],
  391. };
  392. },
  393. methods: {
  394. cancle: function() {
  395. this.$refs.dialog.hide();
  396. },
  397. GetConfigInfo: function() {
  398. GetAllConfig().then(response => {
  399. const loading = this.$loading({
  400. lock: true,
  401. text: "Loading",
  402. spinner: "el-icon-loading",
  403. background: "rgba(0, 0, 0, 0.7)"
  404. });
  405. if (response.data.state == 0) {
  406. this.$message.error(response.data.msg);
  407. return false;
  408. } else {
  409. this.manufacturer = response.data.data.manufacturer;
  410. this.dealer = response.data.data.dealer;
  411. for(let i = 0; i< response.data.data.drugs.length;i++){
  412. this.goodType.push(response.data.data.drugs[i])
  413. if(response.data.data.drugs[i].drug_specs != null) {
  414. for (let b = 0; b < response.data.data.drugs[i].drug_specs.length; b++) {
  415. this.goodInfo.push(response.data.data.drugs[i].drug_specs[b])
  416. }
  417. }
  418. }
  419. this.manufacturer.splice(0, 0, { id: 0, manufacturer_name: "全部" });
  420. this.dealer.splice(0, 0, { id: 0, dealer_name: "全部" });
  421. this.form.manufacturer = 0
  422. this.form.dealer = 0
  423. this.storehouse_id = response.data.data.configlist.drug_storehouse_out
  424. this.list = response.data.data.list
  425. this.doctorList = response.data.data.doctorList
  426. }
  427. loading.close()
  428. });
  429. },
  430. typeName: function(drug_id) {
  431. let name = "";
  432. for (let i = 0; i < this.goodInfo.length; i++) {
  433. if (this.goodInfo[i].id == drug_id) {
  434. name = this.goodInfo[i].drug_name;
  435. }
  436. }
  437. return name;
  438. },
  439. specificationName: function(drug_id) {
  440. let name = "";
  441. for (let i = 0; i < this.goodInfo.length; i++) {
  442. if (this.goodInfo[i].id == drug_id) {
  443. name = this.goodInfo[i].drug_spec;
  444. }
  445. }
  446. return name;
  447. },
  448. handleEdit: function(index, row) {
  449. const tempObj = {};
  450. tempObj["drug_id"] = 0;
  451. tempObj["count"] = "";
  452. tempObj["price"] = "";
  453. tempObj["retail_price"] = "";
  454. tempObj["remark"] = "";
  455. tempObj["min_unit"] = "";
  456. tempObj['dose'] = ""
  457. tempObj['dose_unit'] = ""
  458. tempObj["min_number"] = ""
  459. tempObj["number"] = ""
  460. tempObj["batch_number"] = ""
  461. tempObj["max_unit"] = ""
  462. tempObj["warehouse_info_id"] = 0
  463. tempObj["dealer"] = ""
  464. tempObj['manufacturer'] = ''
  465. tempObj["admin_user_id"] = this.$store.getters.xt_user.user.user_name
  466. tempObj["last_price"] = ""
  467. tempObj["stock_count"] = ""
  468. tempObj["total_count"] = 0
  469. tempObj["max_unit_fisrt"] = 0
  470. tempObj["min_unit_fisrt"] = 0
  471. this.recordInfo.recordData.push(tempObj);
  472. },
  473. handleDelete: function(index, row) {
  474. if (this.recordInfo.recordData.length <= 1) {
  475. this.$message.error("只有一条记录的时候无法删除");
  476. return;
  477. } else {
  478. this.recordInfo.recordData.splice(index, 1);
  479. }
  480. },
  481. calculate: function(val) {
  482. if (isNaN(val)) {
  483. return "";
  484. }
  485. if (val == 0) {
  486. return "";
  487. }
  488. return Math.round(parseFloat(val) * 100) / 100;
  489. },
  490. getTime(val, temp) {
  491. if (val != 0) {
  492. return uParseTime(val, temp);
  493. } else {
  494. return "";
  495. }
  496. },
  497. showDialog(index, row) {
  498. const loading = this.$loading({
  499. lock: true,
  500. text: 'Loading',
  501. spinner: 'el-icon-loading',
  502. background: 'rgba(0, 0, 0, 0.7)'
  503. })
  504. this.currentIndex = index
  505. const params = {
  506. manufacturer_id: this.form.manufacturer,
  507. dealer_id: this.form.dealer
  508. }
  509. GetAllDrugInfoByID(params).then(response => {
  510. if (response.data.state == 0) {
  511. this.$message.error(response.data.msg)
  512. return false
  513. loading.close()
  514. } else {
  515. loading.close()
  516. if (response.data.data.drugs.length <= 0) {
  517. this.$message.error('该厂商或经销商没有物品信息')
  518. return
  519. }
  520. this.$refs.dialog.show()
  521. for (let i = 0; i < response.data.data.drugs.length; i++) {
  522. this.propForm.goods.push(
  523. response.data.data.drugs[i]
  524. );
  525. }
  526. const obj = {};
  527. this.propForm.goods = this.propForm.goods.reduce(
  528. (cur, next) => {
  529. obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
  530. return cur;
  531. },
  532. []
  533. ); // 设置cur默认类型为数组,并且初始值为空的数组
  534. }
  535. for (let i = 0; i < this.propForm.goods.length; i++) {
  536. for (let a = 0; a < this.propForm.goods[i].drug_specs.length; a++) {
  537. var respObj = this.propForm.goods[i].drug_specs[a];
  538. respObj["isSelected"] = false;
  539. }
  540. }
  541. }
  542. )
  543. },
  544. back() {
  545. this.$router.go(-1);
  546. },
  547. submit() {
  548. this.$refs["tableForm"].validate(valid => {
  549. if (valid) {
  550. const array = this.recordInfo.recordData;
  551. let total = 0;
  552. for (let i = 0; i < array.length; i++) {
  553. if (array[i].drug_id == 0) {
  554. this.$message.error("药品名称或者药品规格名称不能为空");
  555. return;
  556. }
  557. total = total + array[i].price * array[i].return_count;
  558. }
  559. if(this.storehouse_id == 0){
  560. this.$message.error("仓库不能为空!")
  561. return false
  562. }
  563. if (this.recordInfo.recordData.length <= 0) {
  564. this.$message.success("请添加出库商品");
  565. return;
  566. }
  567. for(let i=0;i<this.recordInfo.recordData.length;i++){
  568. this.recordInfo.recordData[i].price = this.recordInfo.recordData[i].price.toString()
  569. for(let j=0;j<this.manufacturerList.length;j++){
  570. if(this.recordInfo.recordData[i].manufacturer == this.manufacturerList[j].manufacturer_name){
  571. this.recordInfo.recordData[i].manufacturer = this.manufacturerList[j].id
  572. }
  573. }
  574. if(this.recordInfo.recordData[i].dealer == ""){
  575. this.recordInfo.recordData[i].dealer = 0
  576. }
  577. for(let z=0;z<this.dealerList.length;z++){
  578. if(this.recordInfo.recordData[i].dealer == this.dealerList[z].dealer_name){
  579. this.recordInfo.recordData[i].dealer = this.dealerList[z].id
  580. }
  581. }
  582. for(let y=0;y<this.numberList.length;y++){
  583. if(this.recordInfo.recordData[i].batch_number == this.numberList[y].id){
  584. this.recordInfo.recordData[i].batch_number = this.numberList[y].batch_number
  585. this.recordInfo.recordData[i].warehouse_info_id = this.numberList[y].id
  586. }
  587. }
  588. for(let s=0;s<this.doctorList.length;s++){
  589. if(this.recordInfo.recordData[i].admin_user_id == this.doctorList[s].user_name){
  590. this.recordInfo.recordData[i].admin_user_id = this.doctorList[s].admin_user_id
  591. }
  592. }
  593. this.recordInfo.recordData[i].last_price = this.recordInfo.recordData[i].last_price.toString()
  594. this.recordInfo.recordData[i].stock_count = this.recordInfo.recordData[i].stock_count.toString()
  595. }
  596. const params = {
  597. stockOut: this.recordInfo.recordData
  598. };
  599. const loading = this.$loading({
  600. lock: true,
  601. text: 'Loading',
  602. spinner: 'el-icon-loading',
  603. background: 'rgba(0, 0, 0, 0.7)'
  604. })
  605. postDrugWarehouseOut(
  606. params,
  607. this.warehouse_out_time,
  608. this.form.dealer,
  609. this.form.manufacturer,
  610. this.type,
  611. this.storehouse_id
  612. ).then(response => {
  613. if (response.data.state == 0) {
  614. this.$message.error("库存不足");
  615. loading.close()
  616. return false;
  617. } else {
  618. this.loading = false
  619. loading.close()
  620. var msg = response.data.data.msg
  621. var drug_name = response.data.data.drug_name
  622. var dose = response.data.data.dose
  623. var dose_unit = response.data.data.dose_unit
  624. var min_number = response.data.data.min_number
  625. var min_unit = response.data.data.min_unit
  626. var max_unit = response.data.data.max_unit
  627. var str = drug_name + " " + dose + dose_unit + "*" + min_number + min_unit+"/"+max_unit
  628. if(msg == 1){
  629. this.$message.error(str + "库存不足")
  630. }else{
  631. loading.close()
  632. this.$message.success("出库成功");
  633. this.recordInfo.recordData = [];
  634. this.$router.back(-1);
  635. }
  636. }
  637. });
  638. } else {
  639. return false;
  640. }
  641. });
  642. },
  643. changeManufacturer(val) {
  644. this.propForm.manufacturer = val;
  645. },
  646. changeDealer(val) {
  647. this.propForm.goods = []
  648. this.propForm.dealer = val;
  649. this.form.dealer = val
  650. },
  651. getDataConfig(module, filed_name){
  652. return getDataConfig(module, filed_name)
  653. },
  654. querySearchAsync(keyword, cb) {
  655. let key = '';
  656. if (keyword != undefined) {
  657. key = keyword
  658. }
  659. let searchArray = [];
  660. postSearchDrugList(key,this.storehouse_id).then(response => {
  661. if (response.data.state == 1) {
  662. searchArray = response.data.data.list;
  663. var list = response.data.data.list
  664. this.drugList = list
  665. var manufacturerList = response.data.data.manufacturerList
  666. this.manufacturerList = manufacturerList
  667. var dealerList = response.data.data.dealerList
  668. this.dealerList = dealerList
  669. for(let i=0;i<this.drugList.length;i++){
  670. for(let j=0;j<this.manufacturerList.length;j++){
  671. if(this.drugList[i].manufacturer == this.manufacturerList[j].id){
  672. this.drugList[i].manufacturer = this.manufacturerList[j].manufacturer_name
  673. }
  674. }
  675. for(let z=0;z<dealerList.length;z++){
  676. if(this.drugList[i].dealer == this.dealerList[z].id){
  677. this.drugList[i].dealer = this.dealerList[z].dealer_name
  678. }
  679. }
  680. }
  681. cb(this.drugList)
  682. } else {
  683. cb([])
  684. }
  685. })
  686. },
  687. changeGoodName(val){
  688. this.currentIndex = val
  689. },
  690. handleSelect(val){
  691. var arr = []
  692. for(let i=0;i<this.recordInfo.recordData.length;i++){
  693. arr.push(this.recordInfo.recordData[i].drug_id)
  694. }
  695. var str = arr.join(",")
  696. if(str.indexOf(val.id)!=-1){
  697. this.$message.error("该药品已存在列表中")
  698. return
  699. }
  700. this.getDrugBatchNumber(val.id)
  701. var str_count = ""
  702. var total_count = 0
  703. for(let i=0;i<val.drug_warehouse_info.length;i++){
  704. if(val.max_unit == val.drug_warehouse_info[i].max_unit){
  705. val.drug_warehouse_info[i].stock_max_number = val.drug_warehouse_info[i].stock_max_number * val.min_number
  706. }
  707. }
  708. str_count = this.getWarehoseInfo(val.drug_warehouse_info,val.max_unit,val.min_unit,val.min_number)
  709. total_count = this.getWarehoseInfoTwo(val.drug_warehouse_info)
  710. for(let i=0;i<this.recordInfo.recordData.length;i++){
  711. if(this.currentIndex == i){
  712. this.recordInfo.recordData[i].drug_id = val.id
  713. this.recordInfo.recordData[i].drug_name = val.drug_name
  714. this.recordInfo.recordData[i].drug_type = val.drug_type
  715. this.recordInfo.recordData[i].dose = val.dose
  716. this.recordInfo.recordData[i].dose_unit = val.dose_unit
  717. this.recordInfo.recordData[i].max_unit = val.max_unit
  718. this.recordInfo.recordData[i].min_number = val.min_number
  719. this.recordInfo.recordData[i].min_unit = val.min_unit
  720. this.recordInfo.recordData[i].min_price = val.min_price
  721. this.recordInfo.recordData[i].number = val.number
  722. this.recordInfo.recordData[i].unit = val.max_unit
  723. this.recordInfo.recordData[i].retail_price = val.retail_price
  724. this.recordInfo.recordData[i].last_price = val.last_price
  725. this.recordInfo.recordData[i].stock_count = str_count
  726. this.recordInfo.recordData[i].total_count = total_count
  727. this.recordInfo.recordData[i].max_unit_fisrt = val.max_unit
  728. this.recordInfo.recordData[i].min_unit_fisrt = val.min_unit
  729. if(val.retail_price == 0){
  730. this.recordInfo.recordData[i].price = ""
  731. }else{
  732. this.recordInfo.recordData[i].price = val.retail_price
  733. }
  734. this.recordInfo.recordData[i].manufacturer = val.manufacturer
  735. this.recordInfo.recordData[i].name = this.recordInfo.recordData[i].dose + this.recordInfo.recordData[i].dose_unit + "*" + this.recordInfo.recordData[i].min_number + this.recordInfo.recordData[i].min_unit + "/"+this.recordInfo.recordData[i].max_unit
  736. if(val.dealer == 0){
  737. this.recordInfo.recordData[i].dealer = ""
  738. }else{
  739. this.recordInfo.recordData[i].dealer = val.dealer
  740. }
  741. }
  742. }
  743. },
  744. getDictionaryDataConfig(module, filed_name) {
  745. return getDictionaryDataConfig(module, filed_name)
  746. },
  747. getDrugBatchNumber(id){
  748. var params = {
  749. id:id
  750. }
  751. getDrugBatchNumber(params).then(response=>{
  752. if(response.data.state == 1){
  753. var list = response.data.data.list
  754. this.numberList = []
  755. this.numberList = list
  756. }
  757. })
  758. },
  759. changeUnit(val,index){
  760. console.log("vla33232233232323232",val)
  761. this.getDrugBatchNumber(val.drug_id)
  762. for(let i=0;i<this.recordInfo.recordData.length;i++){
  763. if(this.recordInfo.recordData[i].drug_id == val.drug_id){
  764. if(this.recordInfo.recordData[i].max_unit == val.max_unit){
  765. this.recordInfo.recordData[i].price = 0
  766. this.recordInfo.recordData[i].price = val.retail_price
  767. }
  768. if(this.recordInfo.recordData[i].max_unit == val.min_unit){
  769. this.recordInfo.recordData[i].price = this.recordInfo.recordData[i].min_price
  770. }
  771. }
  772. for(let j=0;j<this.numberList.length;j++){
  773. if(this.recordInfo.recordData[i].batch_number == this.numberList[j].id){
  774. this.recordInfo.recordData[i].batch_number = this.numberList[j].batch_number
  775. }
  776. }
  777. }
  778. // var count_total = 0
  779. // if(val.max_unit == val.max_unit_fisrt){
  780. // count_total = val.count * val.min_number
  781. // }
  782. // if(val.max_unit == val.min_unit_fisrt){
  783. // count_total = val.count
  784. // }
  785. // if(count_total > val.total_count){
  786. // this.$message.error("出库数量不能大于剩余库存")
  787. // for(let i=0;i<this.recordInfo.recordData.length;i++){
  788. // if(index == i){
  789. // this.recordInfo.recordData[i].count = ""
  790. // }
  791. // }
  792. // }else{
  793. // for(let i=0;i<this.recordInfo.recordData.length;i++){
  794. // if(index == i){
  795. // this.recordInfo.recordData[i].count = val.count
  796. // }
  797. // }
  798. // }
  799. },
  800. changeBatchNumber(val){
  801. this.getDrugBatchNumber(val.drug_id)
  802. for(let i=0;i<this.recordInfo.recordData.length;i++){
  803. if(this.currentIndex == i){
  804. for(let j=0;j<this.numberList.length;j++){
  805. if(this.recordInfo.recordData[i].batch_number == this.numberList[j].id){
  806. this.recordInfo.recordData[i].batch_number = this.numberList[j].batch_number
  807. this.recordInfo.recordData[i].warehouse_info_id = this.numberList[j].id
  808. }
  809. }
  810. }
  811. }
  812. },
  813. getWarehoseInfo(arr, max_unit, min_unit, min_number) {
  814. var total = 0;
  815. var max_str = "";
  816. var min_str = "";
  817. if (arr.length > 0) {
  818. for (let i = 0; i < arr.length; i++) {
  819. total += parseInt(arr[i].stock_max_number+ arr[i].stock_min_number);
  820. }
  821. }
  822. if (total < min_number) {
  823. min_str = total + min_unit;
  824. }
  825. if (total == 0) {
  826. min_str = "";
  827. max_str = "";
  828. }
  829. if (total >= min_number) {
  830. if (parseInt(total / min_number) != 0) {
  831. max_str = parseInt(total / min_number) + max_unit;
  832. }
  833. if (total % min_number != 0) {
  834. min_str = (total % min_number) + min_unit;
  835. }
  836. }
  837. return max_str + min_str;
  838. },
  839. getWarehoseInfoTwo(arr){
  840. var total = 0;
  841. if (arr.length > 0) {
  842. for (let i = 0; i < arr.length; i++) {
  843. total += parseInt(arr[i].stock_max_number+ arr[i].stock_min_number);
  844. }
  845. }
  846. return total
  847. },
  848. getSupplyCount(count,max_unit,min_number,index,total_count,max_unit_fisrt,min_unit_fisrt){
  849. var count_total = 0
  850. if(max_unit == max_unit_fisrt){
  851. count_total = count * min_number
  852. }
  853. if(max_unit == min_unit_fisrt){
  854. count_total = count
  855. }
  856. if(count_total > total_count){
  857. this.$message.error("出库数量不能大于剩余库存")
  858. for(let i=0;i<this.recordInfo.recordData.length;i++){
  859. if(index == i){
  860. this.recordInfo.recordData[i].count = ""
  861. }
  862. }
  863. }else{
  864. for(let i=0;i<this.recordInfo.recordData.length;i++){
  865. if(index == i){
  866. this.recordInfo.recordData[i].count = count
  867. }
  868. }
  869. }
  870. console.log("count_toal23233232",count_total)
  871. }
  872. },
  873. created() {
  874. this.drugTypeList = getDictionaryDataConfig('system','drug_type')
  875. var nowDate = new Date();
  876. var nowYear = nowDate.getFullYear();
  877. var nowMonth = nowDate.getMonth() + 1;
  878. var nowDay = nowDate.getDate();
  879. this.warehouse_out_time =
  880. nowYear +
  881. "-" +
  882. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  883. "-" +
  884. (nowDay < 10 ? "0" + nowDay : nowDay);
  885. const tempObj = {};
  886. tempObj["drug_id"] = 0;
  887. tempObj['max_unit'] = ''
  888. tempObj['min_unit'] = '',
  889. tempObj["return_count"] = 0;
  890. tempObj["price"] = "";
  891. tempObj["remark"] = "";
  892. tempObj['manufacturer'] = ''
  893. tempObj['batch_number'] = ''
  894. tempObj['drug_type'] = ''
  895. tempObj['dose'] = ""
  896. tempObj['dose_unit'] = ""
  897. tempObj["min_number"] = ""
  898. tempObj["dealer"] = ""
  899. tempObj["number"] = ""
  900. tempObj["warehouse_info_id"] = 0
  901. tempObj["count"] = ""
  902. tempObj["admin_user_id"] = this.$store.getters.xt_user.user.user_name
  903. tempObj["retail_price"] = 0;
  904. tempObj["last_price"] = ""
  905. tempObj["stock_count"] = ""
  906. tempObj["total_count"] = 0
  907. tempObj["max_unit_fisrt"] = 0
  908. tempObj["min_unit_fisrt"] = 0
  909. this.recordInfo.recordData.push(tempObj);
  910. this.GetConfigInfo();
  911. this.propForm.goodUnit = this.$store.getters.good_unit;
  912. this.unitList = getDataConfig('hemodialysis','units')
  913. }
  914. };
  915. </script>
  916. <style rel="stylesheet/css" lang="scss" scoped>
  917. .information {
  918. border: 1px #dcdfe6 solid;
  919. padding: 30px 20px 30px 20px;
  920. .border {
  921. border-bottom: 1px #dcdfe6 solid;
  922. margin: 0px 0 20px 0;
  923. }
  924. }
  925. .edit_separater {
  926. border-top: 1px solid rgb(233, 233, 233);
  927. margin-top: 15px;
  928. margin-bottom: 15px;
  929. }
  930. </style>
  931. <style>
  932. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  933. font-size: 12px;
  934. }
  935. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  936. background: #6fb5fa;
  937. }
  938. .el-autocomplete-suggestion{
  939. width: 400px !important;
  940. }
  941. </style>