stockInOrderAdd.vue 29KB

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