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

stockOutOrderAdd.vue 31KB

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