drugStockInOrderEdit.vue 30KB

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