stockOutOrderAdd.vue 40KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179
  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. tempObj["dealer"] = ""
  550. tempObj["manufacturer"] = ""
  551. this.recordInfo.recordData.push(tempObj);
  552. },
  553. handleDelete: function(index, row) {
  554. if (this.recordInfo.recordData.length <= 1) {
  555. this.$message.error("只有一条记录的时候无法删除");
  556. return;
  557. } else {
  558. this.recordInfo.recordData.splice(index, 1);
  559. }
  560. },
  561. calculate: function(val) {
  562. if (isNaN(val)) {
  563. return "";
  564. }
  565. if (val == 0) {
  566. return "";
  567. }
  568. return Math.round(parseFloat(val) * 100) / 100;
  569. },
  570. getTime(val, temp) {
  571. if (val != 0) {
  572. return uParseTime(val, temp);
  573. } else {
  574. return "";
  575. }
  576. },
  577. getTimeOne(val) {
  578. if(val < 0){
  579. return ""
  580. }
  581. if(val == ""){
  582. return ""
  583. }else {
  584. return uParseTime(val, '{y}-{m}-{d}')
  585. }
  586. },
  587. showDialog(index, row) {
  588. const loading = this.$loading({
  589. lock: true,
  590. text: 'Loading',
  591. spinner: 'el-icon-loading',
  592. background: 'rgba(0, 0, 0, 0.7)'
  593. })
  594. this.currentIndex = index
  595. const params = {
  596. manufacturer_id: this.form.manufacturer,
  597. dealer_id: this.form.dealer
  598. }
  599. this.propForm.goods = []
  600. GetAllGoodInfoByID(params).then(response => {
  601. if (response.data.state == 0) {
  602. this.$message.error(response.data.msg)
  603. return false
  604. loading.close()
  605. } else {
  606. loading.close()
  607. if (response.data.data.goodInfo.length <= 0) {
  608. this.$message.error('该厂商或经销商没有物品信息')
  609. return
  610. }
  611. this.$refs.dialog.show()
  612. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  613. this.propForm.goodType.push(response.data.data.goodInfo[i].type)
  614. }
  615. const obj = {}
  616. this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
  617. obj[next.id] ? '' : obj[next.id] = true && cur.push(next)
  618. return cur
  619. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  620. }
  621. for (let i = 0; i < this.propForm.goodType.length; i++) {
  622. let goodInfo = []
  623. let goodObj = {}
  624. for (let a = 0; a < response.data.data.goodInfo.length; a++) {
  625. var respObj = response.data.data.goodInfo[a]
  626. respObj['isSelected'] = false
  627. if (respObj.type.id == this.propForm.goodType[i].id) {
  628. goodInfo.push(respObj)
  629. }
  630. }
  631. const obj = {}
  632. goodInfo = goodInfo.reduce((cur, next) => {
  633. obj[next.id] ? '' : obj[next.id] = true && cur.push(next)
  634. return cur
  635. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  636. this.$set(goodObj, this.propForm.goodType[i].id, goodInfo)
  637. this.propForm.goods.push(goodObj)
  638. }
  639. }
  640. )
  641. this.$refs.dialog.show();
  642. },
  643. back() {
  644. this.$router.go(-1);
  645. },
  646. submit() {
  647. this.loading = true
  648. this.$refs["tableForm"].validate(valid => {
  649. if (valid) {
  650. const array = this.recordInfo.recordData;
  651. let total = 0;
  652. for (let i = 0; i < array.length; i++) {
  653. if (array[i].good_type_id == 0) {
  654. this.$message.error("商品类型不能为空");
  655. this.loading = false
  656. return;
  657. }
  658. if (array[i].good_id == 0) {
  659. this.$message.error("规格名称不能为空");
  660. this.loading = false
  661. return;
  662. }
  663. total = total + array[i].price * array[i].return_count;
  664. }
  665. if (this.recordInfo.recordData.length <= 0) {
  666. this.$message.success("请添加出库商品");
  667. this.loading = false
  668. return;
  669. }
  670. for(let i=0;i<this.recordInfo.recordData.length;i++){
  671. if( this.recordInfo.recordData[i].count == 0){
  672. this.$message.error("出库数量不能为空!")
  673. this.loading = false
  674. return
  675. }
  676. if(this.recordInfo.recordData[i].dealer == ""){
  677. this.recordInfo.recordData[i].dealer = 0
  678. }
  679. if(this.recordInfo.recordData[i].expiry_date == "" || this.recordInfo.recordData[i].expiry_date == undefined){
  680. this.recordInfo.recordData[i].expiry_date = ""
  681. }
  682. if(this.recordInfo.recordData[i].product_date == "" || this.recordInfo.recordData[i].product_date == undefined){
  683. this.recordInfo.recordData[i].product_date = ""
  684. }
  685. this.recordInfo.recordData[i].price = this.recordInfo.recordData[i].price.toString()
  686. this.recordInfo.recordData[i].stock_count = this.recordInfo.recordData[i].stock_count.toString()
  687. this.recordInfo.recordData[i].buy_price = this.recordInfo.recordData[i].buy_price.toString()
  688. this.recordInfo.recordData[i].count = this.recordInfo.recordData[i].count.toString()
  689. }
  690. for(let i=0;i<this.recordInfo.recordData.length;i++){
  691. if(parseInt(this.recordInfo.recordData[i].count) > parseInt(this.recordInfo.recordData[i].stock_count) ){
  692. this.$message.error(this.recordInfo.recordData[i].good_name+"/"+this.recordInfo.recordData[i].specification_name+"库存不足!")
  693. this.loading = false
  694. return
  695. }
  696. for(let j=0;j<this.manufacturerList.length;j++){
  697. if(this.recordInfo.recordData[i].manufacturer == this.manufacturerList[j].manufacturer_name){
  698. this.recordInfo.recordData[i].manufacturer = this.manufacturerList[j].id
  699. }
  700. }
  701. for(let z=0;z<this.dealerList.length;z++){
  702. if(this.recordInfo.recordData[i].dealer == this.dealerList[z].dealer_name){
  703. this.recordInfo.recordData[i].dealer = this.dealerList[z].id
  704. }
  705. }
  706. for(let y=0;y<this.numberList.length;y++){
  707. if(this.recordInfo.recordData[i].number == this.numberList[y].id){
  708. this.recordInfo.recordData[i].number = this.numberList[y].number
  709. }
  710. }
  711. for(let s=0;s<this.doctorList.length;s++){
  712. if(this.recordInfo.recordData[i].admin_user_id == this.doctorList[s].user_name){
  713. this.recordInfo.recordData[i].admin_user_id = this.doctorList[s].admin_user_id
  714. }
  715. }
  716. }
  717. const params = {
  718. stockOut: this.recordInfo.recordData
  719. };
  720. console.log("pramsswoowowowoow",params)
  721. console.log(" this.warehouseOut_id", this.warehouseOut_id)
  722. const loading = this.$loading({
  723. lock: true,
  724. text: 'Loading',
  725. spinner: 'el-icon-loading',
  726. background: 'rgba(0, 0, 0, 0.7)'
  727. })
  728. postWarehouseOut(
  729. params,
  730. this.warehouse_out_time,
  731. this.form.dealer,
  732. this.form.manufacturer,
  733. this.type,
  734. this.storehouse_id,
  735. this.warehouseOut_id
  736. ).then(response => {
  737. if (response.data.state == 0) {
  738. this.$message.error("库存不足")
  739. loading.close()
  740. this.loading = false
  741. return false;
  742. } else {
  743. var msg = response.data.data.msg
  744. this.loading = false
  745. loading.close()
  746. var good_name = response.data.data.good_name
  747. var specification_name = response.data.data.specification_name
  748. var storehose_name = response.data.data.storehose_name
  749. var str = storehose_name + " " + good_name +"*" + specification_name +"无库存,请入库"
  750. var warehouseOut = response.data.data.warehouseOut
  751. this.warehouseOut = warehouseOut
  752. this.warehouseOut_id = warehouseOut.id
  753. if(msg == 1){
  754. this.$message.error(str)
  755. }
  756. if(msg == 2){
  757. this.$message.success("保存成功");
  758. this.recordInfo.recordData = [];
  759. var warehouseOutInfoList = response.data.data.warehouseOutInfoList
  760. var manufacturerList = response.data.data.manufacturerList
  761. var dealerList = response.data.data.dealerList
  762. var doctorList = response.data.data.doctorList
  763. for(let i=0;i<warehouseOutInfoList.length;i++){
  764. for(let j=0;j<manufacturerList.length;j++){
  765. if(warehouseOutInfoList[i].manufacturer == manufacturerList[j].id){
  766. warehouseOutInfoList[i].manufacturer = manufacturerList[j].manufacturer_name
  767. }
  768. }
  769. for(let z=0;z<dealerList.length;z++){
  770. if(warehouseOutInfoList[i].dealer == dealerList[z].id){
  771. warehouseOutInfoList[i].dealer_id = dealerList[z].dealer_name
  772. }
  773. }
  774. for(let s=0;s<doctorList.length;s++){
  775. if(warehouseOutInfoList[i].admin_user_id == doctorList[s].admin_user_id){
  776. warehouseOutInfoList[i].admin_user_id = doctorList[s].user_name
  777. }
  778. }
  779. warehouseOutInfoList[i].good_name = warehouseOutInfoList[i].GoodInfo.good_name
  780. warehouseOutInfoList[i].name = warehouseOutInfoList[i].GoodInfo.specification_name +"/"+ warehouseOutInfoList[i].GoodInfo.packing_unit
  781. warehouseOutInfoList[i].expiry_date = this.getTimeOne(warehouseOutInfoList[i].expiry_date)
  782. warehouseOutInfoList[i].product_date = this.getTimeOne(warehouseOutInfoList[i].product_date)
  783. warehouseOutInfoList[i].patient_id = warehouseOutInfoList[i].patient_id
  784. }
  785. this.recordInfo.recordData = []
  786. this.recordInfo.recordData = warehouseOutInfoList
  787. this.showCheck = true
  788. }
  789. loading.close()
  790. this.loading = false
  791. loading.close()
  792. }
  793. });
  794. } else {
  795. return false;
  796. }
  797. });
  798. },
  799. changeManufacturer(val) {
  800. this.propForm.manufacturer = val;
  801. },
  802. changeDealer(val) {
  803. this.propForm.dealer = val;
  804. },
  805. querySearchAsync(keyword, cb) {
  806. let key = '';
  807. if (keyword != undefined) {
  808. key = keyword
  809. }
  810. postSearchGoodList(key,this.storehouse_id).then(response => {
  811. if (response.data.state == 1) {
  812. var list = response.data.data.list
  813. this.goodList = list
  814. var manufacturerList = response.data.data.manufacturerList
  815. this.manufacturerList = manufacturerList
  816. var dealerList = response.data.data.dealerList
  817. this.dealerList = dealerList
  818. for(let i=0;i<this.goodList.length;i++){
  819. for(let j=0;j<this.manufacturerList.length;j++){
  820. if(this.goodList[i].manufacturer == this.manufacturerList[j].id){
  821. this.goodList[i].manufacturer = this.manufacturerList[j].manufacturer_name
  822. }
  823. }
  824. for(let z=0;z<this.dealerList.length;z++){
  825. if(this.goodList[i].dealer == this.dealerList[z].id){
  826. this.goodList[i].dealer = this.dealerList[z].dealer_name
  827. }
  828. }
  829. }
  830. cb(this.goodList)
  831. } else {
  832. cb([])
  833. }
  834. })
  835. },
  836. changeGoodName(val){
  837. this.currentIndex = val
  838. },
  839. handleSelect(val){
  840. console.log("val000000000",val)
  841. var arr = []
  842. for(let i=0;i<this.recordInfo.recordData.length;i++){
  843. arr.push(this.recordInfo.recordData[i].good_id)
  844. }
  845. var str = arr.join(",")
  846. if(str.indexOf(val.id)!=-1){
  847. this.$message.error("该耗材已存在列表中")
  848. return
  849. }
  850. //获取当前耗材的批号
  851. this.getStockBatchNumber(val.id)
  852. var total_count = 0
  853. for(let i=0;i<val.xt_warehouse_info.length;i++){
  854. total_count += val.xt_warehouse_info[i].stock_count
  855. }
  856. for(let i=0;i<this.recordInfo.recordData.length;i++){
  857. if(this.currentIndex == i){
  858. this.recordInfo.recordData[i].id = 0
  859. this.recordInfo.recordData[i].good_name = val.good_name
  860. this.recordInfo.recordData[i].good_type_id = val.good_type_id
  861. this.recordInfo.recordData[i].name = val.specification_name +"/"+val.packing_unit
  862. this.recordInfo.recordData[i].manufacturer = val.first_xt_warehouse_info.manufacturer
  863. this.recordInfo.recordData[i].remark = val.remark
  864. this.recordInfo.recordData[i].buy_price = val.buy_price
  865. this.recordInfo.recordData[i].stock_count = total_count
  866. this.recordInfo.recordData[i].license_number = val.number
  867. this.recordInfo.recordData[i].register_number = val.register_number
  868. this.recordInfo.recordData[i].patient_id = 0
  869. this.recordInfo.recordData[i].xt_warehouse_info = val.xt_warehouse_info
  870. this.recordInfo.recordData[i].packing_unit = val.packing_unit
  871. if( val.first_xt_warehouse_info!=null&&val.first_xt_warehouse_info.expiry_date >0){
  872. this.recordInfo.recordData[i].expiry_date = this.getTimeOne(val.first_xt_warehouse_info.expiry_date)
  873. }else{
  874. this.recordInfo.recordData[i].expiry_date = ""
  875. }
  876. if(val.first_xt_warehouse_info!=null&&val.first_xt_warehouse_info.product_date >0){
  877. this.recordInfo.recordData[i].product_date = this.getTimeOne(val.first_xt_warehouse_info.product_date)
  878. }else{
  879. this.recordInfo.recordData[i].product_date = ""
  880. }
  881. if(val.packing_price == 0){
  882. this.recordInfo.recordData[i].price ="0"
  883. }else{
  884. this.recordInfo.recordData[i].price = val.packing_price
  885. }
  886. if(this.org_id == 0 || this.org_id == 10633){
  887. this.recordInfo.recordData[i].price = val.first_xt_warehouse_info.packing_price
  888. }
  889. this.recordInfo.recordData[i].specification_name = val.specification_name
  890. this.recordInfo.recordData[i].good_id = val.id
  891. if(val.dealer == 0){
  892. this.recordInfo.recordData[i].dealer = ""
  893. }else{
  894. this.recordInfo.recordData[i].dealer = val.first_xt_warehouse_info.dealer
  895. }
  896. console.log("日期我我我哦我", this.recordInfo.recordData)
  897. }
  898. }
  899. },
  900. getStockBatchNumber(id){
  901. var params = {
  902. id:id,
  903. storehouse_id:this.storehouse_id,
  904. }
  905. console.log("parmas----------------------",params)
  906. getStockBatchNumber(params).then(response=>{
  907. if(response.data.state == 1){
  908. var list = response.data.data.list
  909. this.numberList = list
  910. // var lastWarehouseInfoTwo = response.data.data.lastWarehouseInfoTwo
  911. // this.tableWarehouseInfoList = lastWarehouseInfoTwo
  912. }
  913. })
  914. },
  915. getDataConfig(module, filed_name) {
  916. return getDataConfig(module, filed_name)
  917. },
  918. changeNumberList(val,index){
  919. for(let i=0;i<this.recordInfo.recordData.length;i++){
  920. if(index == i){
  921. this.recordInfo.recordData[i].warehouse_info_id = val.number
  922. }
  923. }
  924. },
  925. getSupplyCount(count,sum_count,index){
  926. if(sum_count < count){
  927. this.$message.error("出库数量不能大于剩余库存")
  928. for(let i=0;i<this.recordInfo.recordData.length;i++){
  929. if(index == i){
  930. this.recordInfo.recordData[i].count = ""
  931. }
  932. return
  933. }
  934. }else{
  935. for(let i=0;i<this.recordInfo.recordData.length;i++){
  936. if(index == i){
  937. this.recordInfo.recordData[i].count = count
  938. }
  939. return
  940. }
  941. }
  942. },
  943. toCheck(){
  944. const loading = this.$loading({
  945. lock: true,
  946. text: 'Loading',
  947. spinner: 'el-icon-loading',
  948. background: 'rgba(0, 0, 0, 0.7)'
  949. })
  950. var params = {
  951. id:this.warehouseOut.id
  952. }
  953. checkWarehouseOut(params).then(response=>{
  954. if(response.data.state == 1){
  955. var msg = response.data.data.msg
  956. var good_name = response.data.data.good_name
  957. var specification_name = response.data.data.specification_name
  958. var storehose_name = response.data.data.storehose_name
  959. var str = storehose_name + " " + good_name +"*" + specification_name +"库存不足,请入库"
  960. if(msg == 1){
  961. this.$message.error(str)
  962. loading.close()
  963. }
  964. if(msg == 2){
  965. this.$message.success("审核成功!")
  966. this.recordInfo.recordData = [];
  967. this.$router.back(-1);
  968. this.showCheck = false
  969. this.showReturnCheck = true
  970. loading.close()
  971. }
  972. }else{
  973. this.$message.error("审核失败!")
  974. loading.close()
  975. }
  976. })
  977. },
  978. toReturnCheck(){
  979. const loading = this.$loading({
  980. lock: true,
  981. text: 'Loading',
  982. spinner: 'el-icon-loading',
  983. background: 'rgba(0, 0, 0, 0.7)'
  984. })
  985. var params = {
  986. id:this.warehouseOut_id,
  987. }
  988. returnCheckWarehouseOut(params).then(response=>{
  989. if(response.data.state == 1){
  990. var list = response.dat.data.list
  991. this.$message.success("反审核成功")
  992. this.showCheck = true
  993. this.showReturnCheck = false
  994. loading.close()
  995. }else{
  996. this.$message.error("反审核失败!")
  997. loading.close()
  998. }
  999. })
  1000. }
  1001. },
  1002. created() {
  1003. this.org_id = this.$store.getters.xt_user.org.id
  1004. var nowDate = new Date();
  1005. var nowYear = nowDate.getFullYear();
  1006. var nowMonth = nowDate.getMonth() + 1;
  1007. var nowDay = nowDate.getDate();
  1008. this.warehouse_out_time =
  1009. nowYear +
  1010. "-" +
  1011. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  1012. "-" +
  1013. (nowDay < 10 ? "0" + nowDay : nowDay);
  1014. const tempObj = {};
  1015. tempObj["good_type_id"] = 0;
  1016. tempObj["good_id"] = 0;
  1017. tempObj["return_count"] = 0;
  1018. tempObj["price"] = "";
  1019. tempObj["remark"] = "";
  1020. tempObj["good_unit"] = ""
  1021. tempObj["number"] = ""
  1022. tempObj["specification_name"] = ""
  1023. tempObj["dealer"] = ""
  1024. tempObj["license_number"] = ""
  1025. tempObj["warehouse_info_id"] = 0
  1026. tempObj["admin_user_id"] = this.$store.getters.xt_user.user.user_name
  1027. tempObj["buy_price"]= ""
  1028. tempObj["stock_count"] = ""
  1029. tempObj["id"] = 0
  1030. tempObj['register_number'] = ''
  1031. tempObj['patient_id'] = 0
  1032. tempObj["class_type"] = ""
  1033. tempObj["product_date"] = ""
  1034. tempObj["expiry_date"] = ""
  1035. tempObj["count"] = ""
  1036. tempObj["dealer"] = ""
  1037. tempObj["manufacturer"] = ""
  1038. this.recordInfo.recordData.push(tempObj);
  1039. this.GetConfigInfo();
  1040. this.propForm.goodUnit = this.$store.getters.good_unit;
  1041. this.unitList = getDataConfig('hemodialysis','units')
  1042. }
  1043. };
  1044. </script>
  1045. <style rel="stylesheet/css" lang="scss" scoped>
  1046. .information {
  1047. border: 1px #dcdfe6 solid;
  1048. padding: 30px 20px 30px 20px;
  1049. .border {
  1050. border-bottom: 1px #dcdfe6 solid;
  1051. margin: 0px 0 20px 0;
  1052. }
  1053. }
  1054. .edit_separater {
  1055. border-top: 1px solid rgb(233, 233, 233);
  1056. margin-top: 15px;
  1057. margin-bottom: 15px;
  1058. }
  1059. </style>
  1060. <style lang="scss">
  1061. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  1062. font-size: 12px;
  1063. }
  1064. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  1065. background: #6fb5fa;
  1066. }
  1067. .el-autocomplete-suggestion{
  1068. // width: 400px !important;
  1069. width: auto !important;
  1070. }
  1071. ::-webkit-scrollbar{
  1072. height: 20px;
  1073. }
  1074. </style>