stockOutOrderAdd.vue 27KB

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