drugStockOutOrderEdit.vue 31KB

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