drugStockInOrderEdit.vue 29KB

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