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

drugStockInOrderAdd.vue 32KB

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