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

drugStockInOrderAdd.vue 30KB

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