stockOutOrderAdd.vue 41KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb
  5. v-if="this.$route.query.type == 1"
  6. :crumbs="crumbs"
  7. ></bread-crumb>
  8. <bread-crumb
  9. v-if="this.$route.query.type == 2"
  10. :crumbs="crumbs2"
  11. ></bread-crumb>
  12. <div style="float:right;">
  13. <el-button size="small" @click="back()" class="filter-item"
  14. >取 消</el-button
  15. >
  16. <el-button
  17. size="small"
  18. type="primary"
  19. @click="submit()"
  20. class="filter-item"
  21. v-loading="loading"
  22. >保 存</el-button
  23. >
  24. <el-button
  25. size="small"
  26. type="primary"
  27. @click="toCheck()"
  28. class="filter-item"
  29. v-show="showCheck"
  30. >审核</el-button
  31. >
  32. </div>
  33. </div>
  34. <div class="app-container">
  35. <stock-in-dialog
  36. ref="dialog" :propForm="propForm"
  37. :visibility="isVisibility"
  38. v-on:dialog-comfirm="comfirm"
  39. v-on:dialog-cancle="cancle"
  40. >
  41. </stock-in-dialog>
  42. <div class="cell clearfix">
  43. <label class="title"><span class="name"><span style="color:red">*</span>仓库</span> :</label>
  44. <el-select size="small" v-model="storehouse_id" filterable placeholder="请选择仓库" style="width:200px">
  45. <el-option
  46. v-for="(option, index) in list"
  47. :key="index"
  48. :label="option.storehouse_name"
  49. :value="option.id">
  50. </el-option>
  51. </el-select>
  52. <label class="title"><span class="name">出库时间</span> : </label>
  53. <el-date-picker
  54. size="small"
  55. v-model="warehouse_out_time"
  56. prefix-icon="el-icon-date"
  57. :editable="false"
  58. style="width: 200px;"
  59. type="date"
  60. placeholder="选择日期时间"
  61. align="right"
  62. format="yyyy-MM-dd"
  63. value-format="yyyy-MM-dd"
  64. ></el-date-picker>
  65. </div>
  66. <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
  67. <el-table
  68. :data="recordInfo.recordData"
  69. :class="signAndWeighBoxPatients"
  70. style="width: 100%"
  71. border
  72. max-height="450"
  73. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  74. >
  75. <el-table-column width="200" align="center" fixed="left">
  76. <template slot="header" slot-scope="scope">
  77. <span>耗材名称</span>
  78. </template>
  79. <template slot-scope="scope">
  80. <el-form-item style="padding-top: 20px">
  81. <el-autocomplete
  82. class="checkSearch"
  83. popper-class="my-autocomplete"
  84. v-model="scope.row.good_name"
  85. :fetch-suggestions="querySearchAsync"
  86. :trigger-on-focus="true"
  87. placeholder="请输入耗材名称"
  88. @select="handleSelect"
  89. @input="changeGoodName(scope.$index)"
  90. :popper-append-to-body="true"
  91. >
  92. <i class="el-icon-search el-input__icon" slot="suffix"></i>
  93. <template slot-scope="{ item }">
  94. <div class="name">{{item.good_name +" " +item.specification_name + " "+ item.manufacturer}}</div>
  95. </template>
  96. </el-autocomplete>
  97. </el-form-item>
  98. </template>
  99. </el-table-column>
  100. <el-table-column width="140" align="center">
  101. <template slot="header" slot-scope="scope">
  102. <span>耗材类型</span>
  103. </template>
  104. <template slot-scope="scope">
  105. <el-form-item style="padding-top: 20px">
  106. <el-input
  107. placeholder="请输入耗材类型"
  108. v-model="scope.row.good_type_id"
  109. :value="typeName(scope.row.good_type_id)"
  110. ></el-input>
  111. </el-form-item>
  112. </template>
  113. </el-table-column>
  114. <el-table-column width="140" align="center">
  115. <template slot="header" slot-scope="scope">
  116. <span>规格&单位<span style="color: red">*</span></span>
  117. </template>
  118. <template slot-scope="scope">
  119. <el-form-item style="padding-top: 20px">
  120. <el-input v-model="scope.row.name" placeholder="规格&单位"></el-input>
  121. </el-form-item>
  122. </template>
  123. </el-table-column>
  124. <el-table-column width="150" align="center">
  125. <template slot="header" slot-scope="scope">
  126. <span>剩余库存</span>
  127. </template>
  128. <template slot-scope="scope">
  129. <el-form-item
  130. :rules="tableRules.count"
  131. style="padding-top: 17px"
  132. >
  133. <el-input
  134. :disabled="true"
  135. placeholder="剩余库存"
  136. type="number"
  137. v-model="scope.row.stock_count"
  138. ></el-input>
  139. </el-form-item>
  140. </template>
  141. </el-table-column>
  142. <!-- <el-table-column width="150" align="center">
  143. <template slot="header" slot-scope="scope">
  144. <span>剩余批次详情</span>
  145. </template>
  146. <template slot-scope="scope">
  147. {{ scope.row.warehouse_info_str }}
  148. </template>
  149. </el-table-column> -->
  150. <el-table-column width="150" align="center">
  151. <template slot="header" slot-scope="scope">
  152. <span>出库数量<span style="color: red">*</span></span>
  153. </template>
  154. <template slot-scope="scope">
  155. <el-form-item
  156. :prop="'recordData.' + scope.$index + '.count'"
  157. :rules="tableRules.count"
  158. style="padding-top: 17px"
  159. >
  160. <el-input
  161. @input="getSupplyCount(scope.row.count,scope.row.stock_count,scope.$index)"
  162. oninput="value=value.replace(/\D|^0/g,'')"
  163. placeholder="请输入出库数量"
  164. type="number"
  165. v-model="scope.row.count"
  166. ></el-input>
  167. </el-form-item>
  168. </template>
  169. </el-table-column>
  170. <el-table-column label="出库对象" width="150" align="center">
  171. <template slot-scope="scope">
  172. <el-select size="small" v-model="scope.row.admin_user_id" filterable placeholder="请选择出库对象">
  173. <el-option
  174. v-for="(option, index) in doctorList"
  175. :key="index"
  176. :label="option.user_name"
  177. :value="option.admin_user_id">
  178. </el-option>
  179. </el-select>
  180. </template>
  181. </el-table-column>
  182. <el-table-column label="使用班次" width="100" align="center">
  183. <template slot-scope="scope">
  184. <el-select size="small" v-model="scope.row.class_type" filterable placeholder="请选择出库班次">
  185. <el-option
  186. v-for="(option, index) in classType"
  187. :key="index"
  188. :label="option.name"
  189. :value="option.name">
  190. </el-option>
  191. </el-select>
  192. </template>
  193. </el-table-column>
  194. <el-table-column label="使用患者" width="150" align="center">
  195. <template slot-scope="scope">
  196. <el-select size="small" v-model="scope.row.patient_id" filterable placeholder="请选择出库对象">
  197. <el-option
  198. v-for="(option, index) in patients"
  199. :key="index"
  200. :label="option.name"
  201. :value="option.id">
  202. </el-option>
  203. </el-select>
  204. </template>
  205. </el-table-column>
  206. <!--
  207. <el-table-column width="150" align="center">
  208. <template slot="header" slot-scope="scope">
  209. <span>进货价</span>
  210. </template>
  211. <template slot-scope="scope">
  212. <el-form-item
  213. :prop="'recordData.' + scope.$index + '.buy_price'"
  214. :rules="tableRules.buy_price"
  215. style="padding-top: 20px"
  216. >
  217. <el-input
  218. :disabled="true"
  219. placeholder="进货价"
  220. type="number"
  221. v-model="scope.row.buy_price"
  222. ></el-input>
  223. </el-form-item>
  224. </template>
  225. </el-table-column> -->
  226. <el-table-column width="150" align="center">
  227. <template slot="header" slot-scope="scope">
  228. <span>出货单价<span style="color: red">*</span></span>
  229. </template>
  230. <template slot-scope="scope">
  231. <el-form-item
  232. :prop="'recordData.' + scope.$index + '.price'"
  233. :rules="tableRules.price"
  234. style="padding-top: 20px"
  235. >
  236. <el-input
  237. placeholder="请输入单价"
  238. type="number"
  239. v-model="scope.row.price"
  240. ></el-input>
  241. </el-form-item>
  242. </template>
  243. </el-table-column>
  244. <el-table-column label="总价" width="80" align="center">
  245. <template slot-scope="scope">
  246. {{ calculate(scope.row.price * scope.row.count) }}
  247. </template>
  248. </el-table-column>
  249. <el-table-column label="生产厂商" width="150" align="center">
  250. <template slot-scope="scope">
  251. <el-select size="small" v-model="scope.row.manufacturer" filterable placeholder="请选择厂商">
  252. <el-option
  253. v-for="(option, index) in manufacturerList"
  254. :key="index"
  255. :label="option.manufacturer_name"
  256. :value="option.id">
  257. </el-option>
  258. </el-select>
  259. </template>
  260. </el-table-column>
  261. <el-table-column label="生产日期" width="150" align="center">
  262. <template slot-scope="scope">
  263. <el-date-picker
  264. prefix-icon="el-icon-date"
  265. style="width: 145px"
  266. v-model="scope.row.product_date"
  267. type="date"
  268. placeholder="选择日期时间"
  269. format="yyyy-MM-dd"
  270. value-format="yyyy-MM-dd"
  271. ></el-date-picker>
  272. </template>
  273. </el-table-column>
  274. <el-table-column label="有效期" width="150" align="center">
  275. <template slot-scope="scope">
  276. <el-date-picker
  277. prefix-icon="el-icon-date"
  278. style="width: 145px"
  279. v-model="scope.row.expiry_date"
  280. type="date"
  281. placeholder="选择日期时间"
  282. format="yyyy-MM-dd"
  283. value-format="yyyy-MM-dd"
  284. ></el-date-picker>
  285. </template>
  286. </el-table-column>
  287. <el-table-column width="150" align="center">
  288. <template slot="header" slot-scope="scope">
  289. <span>批准文号<span style="color: red" ></span></span>
  290. </template>
  291. <template slot-scope="scope">
  292. <el-input placeholder="请输入批准文号" v-model="scope.row.license_number" ></el-input>
  293. </template>
  294. </el-table-column>
  295. <el-table-column align="center" width="150">
  296. <template slot="header" slot-scope="scope">
  297. <span>注册编码</span>
  298. </template>
  299. <template slot-scope="scope">
  300. <el-form-item style="padding-top: 20px">
  301. <el-input placeholder="请输入注册编码" v-model="scope.row.register_number" ></el-input>
  302. </el-form-item>
  303. </template>
  304. </el-table-column>
  305. <el-table-column label="经销商" width="150" align="center">
  306. <template slot-scope="scope">
  307. <el-select size="small" v-model="scope.row.dealer" filterable placeholder="请选择厂商">
  308. <el-option
  309. v-for="(option, index) in dealerList"
  310. :key="index"
  311. :label="option.dealer_name"
  312. :value="option.id">
  313. </el-option>
  314. </el-select>
  315. </template>
  316. </el-table-column>
  317. <el-table-column label="备注" width="150" align="center">
  318. <template slot-scope="scope">
  319. <el-input v-model="scope.row.remark"></el-input>
  320. </template>
  321. </el-table-column>
  322. <el-table-column label="操作" align="center" min-width="150" fixed="right">
  323. <template slot-scope="scope">
  324. <el-tooltip
  325. class="item"
  326. effect="dark"
  327. content="新增"
  328. placement="top"
  329. >
  330. <el-button
  331. size="mini"
  332. type="primary"
  333. icon="el-icon-circle-plus-outline"
  334. @click="handleEdit(scope.$index, scope.row)"
  335. >
  336. </el-button>
  337. </el-tooltip>
  338. <el-tooltip
  339. class="item"
  340. effect="dark"
  341. content="删除"
  342. placement="top"
  343. >
  344. <el-button
  345. size="mini"
  346. type="danger"
  347. icon="el-icon-delete"
  348. @click="handleDelete(scope.$index, scope.row)"
  349. >
  350. </el-button>
  351. </el-tooltip>
  352. </template>
  353. </el-table-column>
  354. </el-table>
  355. </el-form>
  356. </div>
  357. </div>
  358. </template>
  359. <script>
  360. import { uParseTime } from "@/utils/tools";
  361. import { postWarehouseOut,GetAllConfig,GetAllGoodInfoByID,postSearchGoodList,getStockBatchNumber,checkWarehouseOut } from "@/api/stock";
  362. import BreadCrumb from "../components/bread-crumb";
  363. import StockInDialog from './Dialog/stockInDialog'
  364. import { getDataConfig } from '@/utils/data'
  365. export default {
  366. components: { StockInDialog, BreadCrumb },
  367. name: "salesReturnOrderAdd",
  368. data() {
  369. return {
  370. crumbs: [
  371. { path: false, name: "库存管理" },
  372. { path: false, name: "耗材出库单" },
  373. { path: false, name: "新增出库单" }
  374. ],
  375. crumbs2: [
  376. { path: false, name: "库存管理" },
  377. { path: false, name: "其他出库单" },
  378. { path: false, name: "新增出库单" }
  379. ],
  380. type: this.$route.query.type,
  381. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  382. warehouse_out_time: "",
  383. currentIndex: 0,
  384. recordInfo: {
  385. recordData: []
  386. },
  387. tableRules: {
  388. price: [{ required: true, message: "单价不能为空", trigger: "blur" }],
  389. count: [{ required: true, message: "数量不能为空", trigger: "blur" }],
  390. },
  391. ruleForm: {
  392. manufacturer: [
  393. { required: true, message: "请选择厂商", trigger: "change" }
  394. ]
  395. },
  396. // prop
  397. isVisibility: false,
  398. propForm: {
  399. goods: [],
  400. goodType: [],
  401. goodInfo: [],
  402. goodUnit: [],
  403. manufacturer: 0,
  404. dealer: 0
  405. },
  406. form: {
  407. manufacturer: 0,
  408. dealer: 0
  409. },
  410. warehouseInfoList: [],
  411. manufacturer: [],
  412. dealerList: [],
  413. goodType: [],
  414. goodInfo:[],
  415. goodList:[],
  416. manufacturerList:[],
  417. numberList:[],
  418. storehouse_id:"",
  419. list:[],
  420. doctorList:[],
  421. showCheck:false,
  422. showReturnCheck:false,
  423. warehouseOut:{},
  424. warehouseOut_id:0,
  425. is_check:0,
  426. loading:false,
  427. patients:[],
  428. classType:[{id:1,name:"上午"},{id:2,name:"下午"},{id:3,name:"晚上"}],
  429. tableWarehouseInfoList:[],
  430. org_id:0,
  431. };
  432. },
  433. methods: {
  434. comfirm: function(val) {
  435. this.propForm.goodType = []
  436. this.propForm.goods = []
  437. this.$refs.dialog.hide()
  438. if (val.selectedGoodInfo.length > 0) {
  439. for (let i = val.selectedGoodInfo.length - 1; i >= 0; i--) {
  440. if (i == 0) {
  441. this.recordInfo.recordData[this.currentIndex].good_type_id = val.selectedGoodInfo[i].good_type_id
  442. this.recordInfo.recordData[this.currentIndex].good_id = val.selectedGoodInfo[i].id
  443. this.recordInfo.recordData[this.currentIndex].price = val.selectedGoodInfo[i].buy_price.toString()
  444. this.recordInfo.recordData[this.currentIndex].good_unit = val.selectedGoodInfo[i].good_unit
  445. } else {
  446. const tempForm = {}
  447. tempForm['good_type_id'] =val.selectedGoodInfo[i].good_type_id
  448. tempForm['good_id'] = val.selectedGoodInfo[i].id
  449. tempForm['count'] = ''
  450. tempForm['price'] = val.selectedGoodInfo[i].buy_price.toString()
  451. tempForm['remark'] = ''
  452. tempForm['good_unit'] = val.selectedGoodInfo[i].good_unit
  453. this.recordInfo.recordData.splice(this.currentIndex + 1, 0, tempForm)
  454. }
  455. }
  456. }
  457. this.currentIndex = -1
  458. },
  459. cancle: function() {
  460. this.$refs.dialog.hide();
  461. this.propForm.goodType = [];
  462. this.propForm.goods = []
  463. },
  464. GetConfigInfo: function() {
  465. GetAllConfig().then(response => {
  466. const loading = this.$loading({
  467. lock: true,
  468. text: "Loading",
  469. spinner: "el-icon-loading",
  470. background: "rgba(0, 0, 0, 0.7)"
  471. });
  472. if (response.data.state == 0) {
  473. this.$message.error(response.data.msg);
  474. return false;
  475. } else {
  476. loading.close();
  477. this.manufacturer = response.data.data.manufacturer
  478. this.dealer = response.data.data.dealer
  479. this.goodType = response.data.data.goodType
  480. this.goodInfo = response.data.data.goodInfo
  481. this.manufacturer.splice(0, 0, { id: 0, manufacturer_name: '全部' })
  482. this.dealer.splice(0, 0, { id: 0, dealer_name: '全部' })
  483. this.manufacturer.splice(0, 0, { id: -1, manufacturer_name: '其他' })
  484. this.dealer.splice(0, 0, { id: -1, dealer_name: '其他' })
  485. this.list = response.data.data.list
  486. this.storehouse_id = response.data.data.configlist.storehouse_out_info
  487. this.doctorList = response.data.data.doctorList
  488. var obj ={id:0,name:"血透室"}
  489. // var objOne ={id:-1,name:"血透室"}
  490. this.patients =[]
  491. this.patients.push(obj)
  492. // this.patients.push(objOne)
  493. if(response.data.data.patients!=null){
  494. for(let i=0;i<response.data.data.patients.length;i++){
  495. this.patients.push(response.data.data.patients[i])
  496. }
  497. }
  498. }
  499. });
  500. },
  501. typeName: function(good_type_id) {
  502. let name = "";
  503. for (let i = 0; i < this.goodType.length; i++) {
  504. if (this.goodType[i].id == good_type_id) {
  505. name = this.goodType[i].type_name;
  506. }
  507. }
  508. return name;
  509. },
  510. typeNameOne:function(good_info_id){
  511. let name = ''
  512. for (let i = 0; i < this.goodInfo.length; i++) {
  513. if (this.goodInfo[i].id == good_info_id) {
  514. name = this.goodInfo[i].good_name
  515. }
  516. }
  517. return name
  518. },
  519. specificationName: function(good_info_id) {
  520. let name = ''
  521. for (let i = 0; i < this.goodInfo.length; i++) {
  522. if (this.goodInfo[i].id == good_info_id) {
  523. name = this.goodInfo[i].specification_name
  524. }
  525. }
  526. return name
  527. },
  528. handleEdit: function(index, row) {
  529. const tempObj = {};
  530. tempObj["good_type_id"] = 0;
  531. tempObj["good_id"] = 0;
  532. tempObj["count"] = "";
  533. tempObj["price"] = "";
  534. tempObj["remark"] = "";
  535. tempObj["good_unit"] = "";
  536. tempObj["number"] = ""
  537. tempObj["specification_name"] = ""
  538. tempObj["expiry_date"] = ""
  539. tempObj["product_date"] = ""
  540. tempObj["license_number"] = ""
  541. tempObj["warehouse_info_id"] = 0
  542. tempObj["admin_user_id"] = this.$store.getters.xt_user.user.user_name
  543. tempObj["buy_price"]= ""
  544. tempObj["stock_count"] = ""
  545. tempObj["id"] = 0
  546. tempObj['register_number'] = ''
  547. tempObj['patient_id'] =0
  548. tempObj["class_type"] = ""
  549. this.recordInfo.recordData.push(tempObj);
  550. },
  551. handleDelete: function(index, row) {
  552. if (this.recordInfo.recordData.length <= 1) {
  553. this.$message.error("只有一条记录的时候无法删除");
  554. return;
  555. } else {
  556. this.recordInfo.recordData.splice(index, 1);
  557. }
  558. },
  559. calculate: function(val) {
  560. if (isNaN(val)) {
  561. return "";
  562. }
  563. if (val == 0) {
  564. return "";
  565. }
  566. return Math.round(parseFloat(val) * 100) / 100;
  567. },
  568. getTime(val, temp) {
  569. if (val != 0) {
  570. return uParseTime(val, temp);
  571. } else {
  572. return "";
  573. }
  574. },
  575. getTimeOne(val) {
  576. if(val < 0){
  577. return ""
  578. }
  579. if(val == ""){
  580. return ""
  581. }else {
  582. return uParseTime(val, '{y}-{m}-{d}')
  583. }
  584. },
  585. showDialog(index, row) {
  586. const loading = this.$loading({
  587. lock: true,
  588. text: 'Loading',
  589. spinner: 'el-icon-loading',
  590. background: 'rgba(0, 0, 0, 0.7)'
  591. })
  592. this.currentIndex = index
  593. const params = {
  594. manufacturer_id: this.form.manufacturer,
  595. dealer_id: this.form.dealer
  596. }
  597. this.propForm.goods = []
  598. GetAllGoodInfoByID(params).then(response => {
  599. if (response.data.state == 0) {
  600. this.$message.error(response.data.msg)
  601. return false
  602. loading.close()
  603. } else {
  604. loading.close()
  605. if (response.data.data.goodInfo.length <= 0) {
  606. this.$message.error('该厂商或经销商没有物品信息')
  607. return
  608. }
  609. this.$refs.dialog.show()
  610. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  611. this.propForm.goodType.push(response.data.data.goodInfo[i].type)
  612. }
  613. const obj = {}
  614. this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
  615. obj[next.id] ? '' : obj[next.id] = true && cur.push(next)
  616. return cur
  617. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  618. }
  619. for (let i = 0; i < this.propForm.goodType.length; i++) {
  620. let goodInfo = []
  621. let goodObj = {}
  622. for (let a = 0; a < response.data.data.goodInfo.length; a++) {
  623. var respObj = response.data.data.goodInfo[a]
  624. respObj['isSelected'] = false
  625. if (respObj.type.id == this.propForm.goodType[i].id) {
  626. goodInfo.push(respObj)
  627. }
  628. }
  629. const obj = {}
  630. goodInfo = goodInfo.reduce((cur, next) => {
  631. obj[next.id] ? '' : obj[next.id] = true && cur.push(next)
  632. return cur
  633. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  634. this.$set(goodObj, this.propForm.goodType[i].id, goodInfo)
  635. this.propForm.goods.push(goodObj)
  636. }
  637. }
  638. )
  639. this.$refs.dialog.show();
  640. },
  641. back() {
  642. this.$router.go(-1);
  643. },
  644. submit() {
  645. this.loading = true
  646. this.$refs["tableForm"].validate(valid => {
  647. if (valid) {
  648. const array = this.recordInfo.recordData;
  649. let total = 0;
  650. for (let i = 0; i < array.length; i++) {
  651. if (array[i].good_type_id == 0) {
  652. this.$message.error("商品类型不能为空");
  653. this.loading = false
  654. return;
  655. }
  656. if (array[i].good_id == 0) {
  657. this.$message.error("规格名称不能为空");
  658. this.loading = false
  659. return;
  660. }
  661. total = total + array[i].price * array[i].return_count;
  662. }
  663. if (this.recordInfo.recordData.length <= 0) {
  664. this.$message.success("请添加出库商品");
  665. this.loading = false
  666. return;
  667. }
  668. for(let i=0;i<this.recordInfo.recordData.length;i++){
  669. if( this.recordInfo.recordData[i].count == 0){
  670. this.$message.error("出库数量不能为空!")
  671. this.loading = false
  672. return
  673. }
  674. if(this.recordInfo.recordData[i].dealer == ""){
  675. this.recordInfo.recordData[i].dealer = 0
  676. }
  677. if(this.recordInfo.recordData[i].expiry_date == "" || this.recordInfo.recordData[i].expiry_date == undefined){
  678. this.recordInfo.recordData[i].expiry_date = ""
  679. }
  680. if(this.recordInfo.recordData[i].product_date == "" || this.recordInfo.recordData[i].product_date == undefined){
  681. this.recordInfo.recordData[i].product_date = ""
  682. }
  683. this.recordInfo.recordData[i].price = this.recordInfo.recordData[i].price.toString()
  684. this.recordInfo.recordData[i].stock_count = this.recordInfo.recordData[i].stock_count.toString()
  685. this.recordInfo.recordData[i].buy_price = this.recordInfo.recordData[i].buy_price.toString()
  686. this.recordInfo.recordData[i].count = this.recordInfo.recordData[i].count.toString()
  687. }
  688. for(let i=0;i<this.recordInfo.recordData.length;i++){
  689. if(parseInt(this.recordInfo.recordData[i].count) > parseInt(this.recordInfo.recordData[i].stock_count) ){
  690. this.$message.error(this.recordInfo.recordData[i].good_name+"/"+this.recordInfo.recordData[i].specification_name+"库存不足!")
  691. this.loading = false
  692. return
  693. }
  694. for(let j=0;j<this.manufacturerList.length;j++){
  695. if(this.recordInfo.recordData[i].manufacturer == this.manufacturerList[j].manufacturer_name){
  696. this.recordInfo.recordData[i].manufacturer = this.manufacturerList[j].id
  697. }
  698. }
  699. for(let z=0;z<this.dealerList.length;z++){
  700. if(this.recordInfo.recordData[i].dealer == this.dealerList[z].dealer_name){
  701. this.recordInfo.recordData[i].dealer = this.dealerList[z].id
  702. }
  703. }
  704. for(let y=0;y<this.numberList.length;y++){
  705. if(this.recordInfo.recordData[i].number == this.numberList[y].id){
  706. this.recordInfo.recordData[i].number = this.numberList[y].number
  707. }
  708. }
  709. for(let s=0;s<this.doctorList.length;s++){
  710. if(this.recordInfo.recordData[i].admin_user_id == this.doctorList[s].user_name){
  711. this.recordInfo.recordData[i].admin_user_id = this.doctorList[s].admin_user_id
  712. }
  713. }
  714. }
  715. const params = {
  716. stockOut: this.recordInfo.recordData
  717. };
  718. console.log("pramsswoowowowoow",params)
  719. console.log(" this.warehouseOut_id", this.warehouseOut_id)
  720. const loading = this.$loading({
  721. lock: true,
  722. text: 'Loading',
  723. spinner: 'el-icon-loading',
  724. background: 'rgba(0, 0, 0, 0.7)'
  725. })
  726. postWarehouseOut(
  727. params,
  728. this.warehouse_out_time,
  729. this.form.dealer,
  730. this.form.manufacturer,
  731. this.type,
  732. this.storehouse_id,
  733. this.warehouseOut_id
  734. ).then(response => {
  735. if (response.data.state == 0) {
  736. this.$message.error("库存不足")
  737. loading.close()
  738. this.loading = false
  739. return false;
  740. } else {
  741. var msg = response.data.data.msg
  742. this.loading = false
  743. loading.close()
  744. var good_name = response.data.data.good_name
  745. var specification_name = response.data.data.specification_name
  746. var storehose_name = response.data.data.storehose_name
  747. var str = storehose_name + " " + good_name +"*" + specification_name +"无库存,请入库"
  748. var warehouseOut = response.data.data.warehouseOut
  749. this.warehouseOut = warehouseOut
  750. this.warehouseOut_id = warehouseOut.id
  751. if(msg == 1){
  752. this.$message.error(str)
  753. }
  754. if(msg == 2){
  755. this.$message.success("保存成功");
  756. this.recordInfo.recordData = [];
  757. var warehouseOutInfoList = response.data.data.warehouseOutInfoList
  758. var manufacturerList = response.data.data.manufacturerList
  759. var dealerList = response.data.data.dealerList
  760. var doctorList = response.data.data.doctorList
  761. for(let i=0;i<warehouseOutInfoList.length;i++){
  762. for(let j=0;j<manufacturerList.length;j++){
  763. if(warehouseOutInfoList[i].manufacturer == manufacturerList[j].id){
  764. warehouseOutInfoList[i].manufacturer = manufacturerList[j].manufacturer_name
  765. }
  766. }
  767. for(let z=0;z<dealerList.length;z++){
  768. if(warehouseOutInfoList[i].dealer == dealerList[z].id){
  769. warehouseOutInfoList[i].dealer_id = dealerList[z].dealer_name
  770. }
  771. }
  772. for(let s=0;s<doctorList.length;s++){
  773. if(warehouseOutInfoList[i].admin_user_id == doctorList[s].admin_user_id){
  774. warehouseOutInfoList[i].admin_user_id = doctorList[s].user_name
  775. }
  776. }
  777. warehouseOutInfoList[i].good_name = warehouseOutInfoList[i].GoodInfo.good_name
  778. warehouseOutInfoList[i].name = warehouseOutInfoList[i].GoodInfo.specification_name +"/"+ warehouseOutInfoList[i].GoodInfo.packing_unit
  779. warehouseOutInfoList[i].expiry_date = this.getTimeOne(warehouseOutInfoList[i].expiry_date)
  780. warehouseOutInfoList[i].product_date = this.getTimeOne(warehouseOutInfoList[i].product_date)
  781. warehouseOutInfoList[i].patient_id = warehouseOutInfoList[i].patient_id
  782. }
  783. this.recordInfo.recordData = []
  784. this.recordInfo.recordData = warehouseOutInfoList
  785. this.showCheck = true
  786. }
  787. loading.close()
  788. this.loading = false
  789. loading.close()
  790. }
  791. });
  792. } else {
  793. return false;
  794. }
  795. });
  796. },
  797. changeManufacturer(val) {
  798. this.propForm.manufacturer = val;
  799. },
  800. changeDealer(val) {
  801. this.propForm.dealer = val;
  802. },
  803. querySearchAsync(keyword, cb) {
  804. let key = '';
  805. if (keyword != undefined) {
  806. key = keyword
  807. }
  808. postSearchGoodList(key,this.storehouse_id).then(response => {
  809. if (response.data.state == 1) {
  810. var list = response.data.data.list
  811. this.goodList = list
  812. var manufacturerList = response.data.data.manufacturerList
  813. this.manufacturerList = manufacturerList
  814. var dealerList = response.data.data.dealerList
  815. this.dealerList = dealerList
  816. for(let i=0;i<this.goodList.length;i++){
  817. for(let j=0;j<this.manufacturerList.length;j++){
  818. if(this.goodList[i].manufacturer == this.manufacturerList[j].id){
  819. this.goodList[i].manufacturer = this.manufacturerList[j].manufacturer_name
  820. }
  821. }
  822. for(let z=0;z<this.dealerList.length;z++){
  823. if(this.goodList[i].dealer == this.dealerList[z].id){
  824. this.goodList[i].dealer = this.dealerList[z].dealer_name
  825. }
  826. }
  827. }
  828. cb(this.goodList)
  829. } else {
  830. cb([])
  831. }
  832. })
  833. },
  834. changeGoodName(val){
  835. this.currentIndex = val
  836. },
  837. handleSelect(val){
  838. var arr = []
  839. for(let i=0;i<this.recordInfo.recordData.length;i++){
  840. arr.push(this.recordInfo.recordData[i].good_id)
  841. }
  842. var str = arr.join(",")
  843. if(str.indexOf(val.id)!=-1){
  844. this.$message.error("该耗材已存在列表中")
  845. return
  846. }
  847. //获取当前耗材的批号
  848. this.getStockBatchNumber(val.id)
  849. var total_count = 0
  850. for(let i=0;i<val.xt_warehouse_info.length;i++){
  851. total_count += val.xt_warehouse_info[i].stock_count
  852. }
  853. for(let i=0;i<this.recordInfo.recordData.length;i++){
  854. if(this.currentIndex == i){
  855. this.recordInfo.recordData[i].id = 0
  856. this.recordInfo.recordData[i].good_name = val.good_name
  857. this.recordInfo.recordData[i].good_type_id = val.good_type_id
  858. this.recordInfo.recordData[i].name = val.specification_name +"/"+val.packing_unit
  859. this.recordInfo.recordData[i].manufacturer = val.manufacturer
  860. this.recordInfo.recordData[i].remark = val.remark
  861. this.recordInfo.recordData[i].buy_price = val.buy_price
  862. this.recordInfo.recordData[i].stock_count = total_count
  863. this.recordInfo.recordData[i].license_number = val.number
  864. this.recordInfo.recordData[i].register_number = val.register_number
  865. this.recordInfo.recordData[i].patient_id = 0
  866. this.recordInfo.recordData[i].xt_warehouse_info = val.xt_warehouse_info
  867. this.recordInfo.recordData[i].packing_unit = val.packing_unit
  868. if( val.first_xt_warehouse_info!=null&&val.first_xt_warehouse_info.expiry_date >0){
  869. this.recordInfo.recordData[i].expiry_date = this.getTimeOne(val.first_xt_warehouse_info.expiry_date)
  870. }else{
  871. this.recordInfo.recordData[i].expiry_date = ""
  872. }
  873. if(val.first_xt_warehouse_info!=null&&val.first_xt_warehouse_info.product_date >0){
  874. this.recordInfo.recordData[i].product_date = this.getTimeOne(val.first_xt_warehouse_info.product_date)
  875. }else{
  876. this.recordInfo.recordData[i].product_date = ""
  877. }
  878. if(val.packing_price == 0){
  879. this.recordInfo.recordData[i].price ="0"
  880. }else{
  881. this.recordInfo.recordData[i].price = val.packing_price
  882. }
  883. if(this.org_id == 0 || this.org_id == 10633){
  884. this.recordInfo.recordData[i].price = val.first_xt_warehouse_info.packing_price
  885. }
  886. this.recordInfo.recordData[i].specification_name = val.specification_name
  887. this.recordInfo.recordData[i].good_id = val.id
  888. if(val.dealer == 0){
  889. this.recordInfo.recordData[i].dealer = ""
  890. }else{
  891. this.recordInfo.recordData[i].dealer = val.dealer
  892. }
  893. // for(let i=0;i<this.recordInfo.recordData.length;i++){
  894. // this.recordInfo.recordData[i].warehouse_info_str = ""
  895. // for(let j=0;j<this.recordInfo.recordData[i].xt_warehouse_info.length;j++){
  896. // this.recordInfo.recordData[i].warehouse_info_str += "批次:"+this.recordInfo.recordData[i].xt_warehouse_info[j].number+" " + "剩余:"+this.recordInfo.recordData[i].xt_warehouse_info[j].stock_count+this.recordInfo.recordData[i].packing_unit +"\n"
  897. // }
  898. // }
  899. console.log("日期我我我哦我", this.recordInfo.recordData)
  900. }
  901. }
  902. },
  903. getStockBatchNumber(id){
  904. var params = {
  905. id:id,
  906. storehouse_id:this.storehouse_id,
  907. }
  908. console.log("parmas----------------------",params)
  909. getStockBatchNumber(params).then(response=>{
  910. if(response.data.state == 1){
  911. var list = response.data.data.list
  912. this.numberList = list
  913. // var lastWarehouseInfoTwo = response.data.data.lastWarehouseInfoTwo
  914. // this.tableWarehouseInfoList = lastWarehouseInfoTwo
  915. }
  916. })
  917. },
  918. getDataConfig(module, filed_name) {
  919. return getDataConfig(module, filed_name)
  920. },
  921. changeNumberList(val,index){
  922. for(let i=0;i<this.recordInfo.recordData.length;i++){
  923. if(index == i){
  924. this.recordInfo.recordData[i].warehouse_info_id = val.number
  925. }
  926. }
  927. },
  928. getSupplyCount(count,sum_count,index){
  929. if(sum_count < count){
  930. this.$message.error("出库数量不能大于剩余库存")
  931. for(let i=0;i<this.recordInfo.recordData.length;i++){
  932. if(index == i){
  933. this.recordInfo.recordData[i].count = ""
  934. }
  935. return
  936. }
  937. }else{
  938. for(let i=0;i<this.recordInfo.recordData.length;i++){
  939. if(index == i){
  940. this.recordInfo.recordData[i].count = count
  941. }
  942. return
  943. }
  944. }
  945. },
  946. toCheck(){
  947. const loading = this.$loading({
  948. lock: true,
  949. text: 'Loading',
  950. spinner: 'el-icon-loading',
  951. background: 'rgba(0, 0, 0, 0.7)'
  952. })
  953. var params = {
  954. id:this.warehouseOut.id
  955. }
  956. checkWarehouseOut(params).then(response=>{
  957. if(response.data.state == 1){
  958. var msg = response.data.data.msg
  959. var good_name = response.data.data.good_name
  960. var specification_name = response.data.data.specification_name
  961. var storehose_name = response.data.data.storehose_name
  962. var str = storehose_name + " " + good_name +"*" + specification_name +"库存不足,请入库"
  963. if(msg == 1){
  964. this.$message.error(str)
  965. loading.close()
  966. }
  967. if(msg == 2){
  968. this.$message.success("审核成功!")
  969. this.recordInfo.recordData = [];
  970. this.$router.back(-1);
  971. this.showCheck = false
  972. this.showReturnCheck = true
  973. loading.close()
  974. }
  975. }else{
  976. this.$message.error("审核失败!")
  977. loading.close()
  978. }
  979. })
  980. },
  981. toReturnCheck(){
  982. const loading = this.$loading({
  983. lock: true,
  984. text: 'Loading',
  985. spinner: 'el-icon-loading',
  986. background: 'rgba(0, 0, 0, 0.7)'
  987. })
  988. var params = {
  989. id:this.warehouseOut_id,
  990. }
  991. returnCheckWarehouseOut(params).then(response=>{
  992. if(response.data.state == 1){
  993. var list = response.dat.data.list
  994. this.$message.success("反审核成功")
  995. this.showCheck = true
  996. this.showReturnCheck = false
  997. loading.close()
  998. }else{
  999. this.$message.error("反审核失败!")
  1000. loading.close()
  1001. }
  1002. })
  1003. }
  1004. },
  1005. created() {
  1006. this.org_id = this.$store.getters.xt_user.org.id
  1007. var nowDate = new Date();
  1008. var nowYear = nowDate.getFullYear();
  1009. var nowMonth = nowDate.getMonth() + 1;
  1010. var nowDay = nowDate.getDate();
  1011. this.warehouse_out_time =
  1012. nowYear +
  1013. "-" +
  1014. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  1015. "-" +
  1016. (nowDay < 10 ? "0" + nowDay : nowDay);
  1017. const tempObj = {};
  1018. tempObj["good_type_id"] = 0;
  1019. tempObj["good_id"] = 0;
  1020. tempObj["return_count"] = 0;
  1021. tempObj["price"] = "";
  1022. tempObj["remark"] = "";
  1023. tempObj["good_unit"] = ""
  1024. tempObj["number"] = ""
  1025. tempObj["specification_name"] = ""
  1026. tempObj["dealer"] = ""
  1027. tempObj["license_number"] = ""
  1028. tempObj["warehouse_info_id"] = 0
  1029. tempObj["admin_user_id"] = this.$store.getters.xt_user.user.user_name
  1030. tempObj["buy_price"]= ""
  1031. tempObj["stock_count"] = ""
  1032. tempObj["id"] = 0
  1033. tempObj['register_number'] = ''
  1034. tempObj['patient_id'] = 0
  1035. tempObj["class_type"] = ""
  1036. tempObj["product_date"] = ""
  1037. tempObj["expiry_date"] = ""
  1038. tempObj["count"] = ""
  1039. this.recordInfo.recordData.push(tempObj);
  1040. this.GetConfigInfo();
  1041. this.propForm.goodUnit = this.$store.getters.good_unit;
  1042. this.unitList = getDataConfig('hemodialysis','units')
  1043. }
  1044. };
  1045. </script>
  1046. <style rel="stylesheet/css" lang="scss" scoped>
  1047. .information {
  1048. border: 1px #dcdfe6 solid;
  1049. padding: 30px 20px 30px 20px;
  1050. .border {
  1051. border-bottom: 1px #dcdfe6 solid;
  1052. margin: 0px 0 20px 0;
  1053. }
  1054. }
  1055. .edit_separater {
  1056. border-top: 1px solid rgb(233, 233, 233);
  1057. margin-top: 15px;
  1058. margin-bottom: 15px;
  1059. }
  1060. </style>
  1061. <style lang="scss">
  1062. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  1063. font-size: 12px;
  1064. }
  1065. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  1066. background: #6fb5fa;
  1067. }
  1068. .el-autocomplete-suggestion{
  1069. // width: 400px !important;
  1070. width: auto !important;
  1071. }
  1072. ::-webkit-scrollbar{
  1073. height: 20px;
  1074. }
  1075. </style>