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

stockOutOrderAdd.vue 35KB

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