drugStockOutOrderAdd.vue 28KB

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