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

stockOutOrderAdd.vue 28KB

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