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

drugStockInOrderAdd.vue 30KB

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