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

stockInOrderAdd.vue 29KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849
  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" fixed="left">
  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(/\D|^0/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. number:[
  247. { required: true, message: '批号不能为空', trigge: 'blur' }
  248. ]
  249. },
  250. type: this.$route.query.type,
  251. total: '',
  252. product_date: '',
  253. expiry_date: '',
  254. numbers: '',
  255. // prop
  256. isVisibility: false,
  257. propForm: {
  258. goods: [],
  259. goodType: [],
  260. goodInfo: [],
  261. goodUnit: [],
  262. title: '入库',
  263. formValue: {
  264. good_type_id: '',
  265. good_id: '',
  266. number: '',
  267. product_date: '',
  268. expiry_date: '',
  269. warehousing_count: '',
  270. price: '',
  271. remark: '',
  272. dealer: '',
  273. manufacturer: ''
  274. },
  275. isCreated: 1
  276. },
  277. goodInfo: {
  278. loading: false,
  279. goodTypeData: [],
  280. type_code: ''
  281. },
  282. form: {
  283. manufacturer: '',
  284. dealer: ''
  285. },
  286. formValue: {
  287. good_type_id: '',
  288. good_id: '',
  289. number: '',
  290. product_date: '',
  291. expiry_date: '',
  292. warehousing_count: '',
  293. price: '',
  294. remark: '',
  295. dealer: '',
  296. manufacturer: ''
  297. },
  298. manufacturer: [],
  299. dealerList: [],
  300. goodType: [],
  301. manufacturerList:[],
  302. goodList:[],
  303. }
  304. },
  305. methods: {
  306. handleSave: function() {
  307. if (this.recordInfo.recordData.length <= 0) {
  308. this.$message.error('请添加入库信息')
  309. return
  310. }
  311. sessionStorage.removeItem('warehousing_orders')
  312. this.$router.back(-1)
  313. }, handleCancle: function() {
  314. this.$confirm('是否放弃编辑返回上一页?', '放弃编辑', {
  315. confirmButtonText: '确定',
  316. cancelButtonText: '取消',
  317. type: 'warning'
  318. }).then(() => {
  319. sessionStorage.removeItem('warehousing_orders')
  320. this.$router.back(-1)
  321. }).catch(() => {
  322. })
  323. }, handleCreate: function() {
  324. this.propForm.formValue = {}
  325. this.propForm.isCreated = 1
  326. this.isVisibility = true
  327. },
  328. comfirm: function(val) {
  329. console.log("val99999999999999",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. this.recordInfo.recordData[this.currentIndex].good_name = val.selectedGoodInfo[i].good_name
  342. } else {
  343. const tempForm = {}
  344. tempForm['good_type_id'] =val.selectedGoodInfo[i].good_type_id
  345. tempForm['good_id'] = val.selectedGoodInfo[i].id
  346. tempForm['number'] = ''
  347. tempForm['product_date'] = ''
  348. tempForm['expiry_date'] = ''
  349. tempForm['warehousing_count'] = ''
  350. tempForm['price'] = val.selectedGoodInfo[i].buy_price.toString()
  351. tempForm['remark'] = ''
  352. tempForm['dealer'] = ''
  353. tempForm['manufacturer'] = ''
  354. tempForm['good_unit'] = val.selectedGoodInfo[i].good_unit
  355. tempForm['good_name'] = val.selectedGoodInfo[i].good_name
  356. this.recordInfo.recordData.splice(this.currentIndex + 1, 0, tempForm)
  357. }
  358. }
  359. }
  360. this.currentIndex = -1
  361. }, cancle: function() {
  362. this.propForm.goodType = []
  363. this.propForm.goods = []
  364. this.$refs.dialog.hide()
  365. },
  366. GetAllGoodType: function() {
  367. GetAllGoodType().then(response => {
  368. if (response.data.state == 0) {
  369. this.$message.error(response.data.msg)
  370. return false
  371. } else {
  372. for (let i = 0; i < response.data.data.goodType.length; i++) {
  373. this.propForm.goodType.push(response.data.data.goodType[i])
  374. }
  375. }
  376. })
  377. },
  378. GetAllGoodInfo: function() {
  379. GetAllGoodInfo().then(response => {
  380. if (response.data.state == 0) {
  381. this.$message.error(response.data.msg)
  382. return false
  383. } else {
  384. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  385. this.propForm.goodInfo.push(response.data.data.goodInfo[i])
  386. }
  387. }
  388. })
  389. }, GetConfigInfo: function() {
  390. const loading = this.$loading({
  391. lock: true,
  392. text: 'Loading',
  393. spinner: 'el-icon-loading',
  394. background: 'rgba(0, 0, 0, 0.7)'
  395. })
  396. GetAllConfig().then(response => {
  397. if (response.data.state == 0) {
  398. this.$message.error(response.data.msg)
  399. return false
  400. } else {
  401. this.manufacturer = response.data.data.manufacturer
  402. this.dealer = response.data.data.dealer
  403. this.goodType = response.data.data.goodType
  404. this.goodInfo = response.data.data.goodInfo
  405. this.manufacturer.splice(0, 0, { id: 0, manufacturer_name: '全部' })
  406. this.dealer.splice(0, 0, { id: 0, dealer_name: '全部' })
  407. this.manufacturer.splice(0, 0, { id: -1, manufacturer_name: '其他' })
  408. this.dealer.splice(0, 0, { id: -1, dealer_name: '其他' })
  409. this.form.manufacturer = 0
  410. this.form.dealer = 0
  411. }
  412. loading.close()
  413. })
  414. }, typeName: function(good_type_id) {
  415. let name = ''
  416. for (let i = 0; i < this.goodType.length; i++) {
  417. if (this.goodType[i].id == good_type_id) {
  418. name = this.goodType[i].type_name
  419. }
  420. }
  421. return name
  422. }, specificationName: function(good_info_id) {
  423. let name = ''
  424. for (let i = 0; i < this.goodInfo.length; i++) {
  425. if (this.goodInfo[i].id == good_info_id) {
  426. name = this.goodInfo[i].specification_name
  427. }
  428. }
  429. return name
  430. }, handleEdit: function(index, row) {
  431. const tempObj = {}
  432. tempObj['good_type_id'] = 0
  433. tempObj['good_id'] = 0
  434. tempObj['number'] = ''
  435. tempObj['product_date'] = ''
  436. tempObj['expiry_date'] = ''
  437. tempObj['warehousing_count'] = ''
  438. tempObj['price'] = ''
  439. tempObj['remark'] = ''
  440. tempObj['dealer'] = ''
  441. tempObj['manufacturer'] = ''
  442. tempObj['good_unit'] = ''
  443. tempObj['specification_name'] = ''
  444. tempObj['name'] = ''
  445. tempObj['license_number'] = ""
  446. this.recordInfo.recordData.push(tempObj)
  447. }, handleDelete: function(index, row) {
  448. if (this.recordInfo.recordData.length <= 1) {
  449. this.$message.error('只有一条记录的时候无法删除')
  450. return
  451. } else {
  452. this.recordInfo.recordData.splice(index, 1)
  453. }
  454. }, calculate: function(val) {
  455. if (val == 0) {
  456. return ''
  457. }
  458. return Math.round(parseFloat(val) * 100) / 100
  459. },
  460. GetWarehouseInfoByOrdeNumber: function() {
  461. const params = {
  462. 'warehousing_order': sessionStorage.getItem('warehousing_orders')
  463. }
  464. this.recordInfo.recordData = []
  465. getWarehouseInfoByOrdeNumber(params).then(response => {
  466. if (response.data.state != 0) {
  467. for (let i = 0; i < response.data.data.info.length; i++) {
  468. this.recordInfo.recordData.push(response.data.data.info[i])
  469. }
  470. console.log("333333333",this.recordInfo.recordData)
  471. }
  472. })
  473. }, getTime(val, temp) {
  474. if (val != 0) {
  475. return uParseTime(val, temp)
  476. } else {
  477. return ''
  478. }
  479. },
  480. showDialog(index, row) {
  481. const loading = this.$loading({
  482. lock: true,
  483. text: 'Loading',
  484. spinner: 'el-icon-loading',
  485. background: 'rgba(0, 0, 0, 0.7)'
  486. })
  487. this.currentIndex = index
  488. this.isVisibility = true
  489. const params = {
  490. manufacturer_id: this.form.manufacturer,
  491. dealer_id: this.form.dealer
  492. }
  493. this.propForm.goods = []
  494. GetAllGoodInfoByID(params).then(response => {
  495. if (response.data.state == 0) {
  496. this.$message.error(response.data.msg)
  497. return false
  498. loading.close()
  499. } else {
  500. loading.close()
  501. if (response.data.data.goodInfo.length <= 0) {
  502. this.$message.error('该厂商或经销商没有物品信息')
  503. return
  504. }
  505. this.$refs.dialog.show()
  506. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  507. this.propForm.goodType.push(response.data.data.goodInfo[i].type)
  508. }
  509. const obj = {}
  510. this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
  511. obj[next.id] ? '' : obj[next.id] = true && cur.push(next)
  512. return cur
  513. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  514. }
  515. for (let i = 0; i < this.propForm.goodType.length; i++) {
  516. let goodInfo = []
  517. let goodObj = {}
  518. for (let a = 0; a < response.data.data.goodInfo.length; a++) {
  519. var respObj = response.data.data.goodInfo[a]
  520. respObj['isSelected'] = false
  521. if (respObj.type.id == this.propForm.goodType[i].id) {
  522. goodInfo.push(respObj)
  523. }
  524. }
  525. const obj = {}
  526. goodInfo = goodInfo.reduce((cur, next) => {
  527. obj[next.id] ? '' : obj[next.id] = true && cur.push(next)
  528. return cur
  529. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  530. this.$set(goodObj, this.propForm.goodType[i].id, goodInfo)
  531. this.propForm.goods.push(goodObj)
  532. }
  533. console.log( this.propForm.goods)
  534. }
  535. )
  536. },
  537. getSummaries(param) {
  538. const { columns, data } = param
  539. const sums = []
  540. columns.forEach((column, index) => {
  541. if (index === 0) {
  542. sums[index] = '总价'
  543. return
  544. }
  545. const values = data.map(item => Number(item[column.property]))
  546. if (!values.every(value => isNaN(value))) {
  547. sums[index] = values.reduce((prev, curr) => {
  548. const value = Number(curr)
  549. if (!isNaN(value)) {
  550. return prev + curr
  551. } else {
  552. return prev
  553. }
  554. }, 0)
  555. sums[index] += ' 元'
  556. } else {
  557. sums[index] = 'N/A'
  558. }
  559. })
  560. return sums
  561. }
  562. ,
  563. back() {
  564. this.$router.go(-1)
  565. }
  566. ,
  567. submit() {
  568. this.$refs['tableForm'].validate((valid) => {
  569. if (valid) {
  570. const array = this.recordInfo.recordData
  571. console.log("array9999999",array)
  572. for (let i = 0; i < array.length; i++) {
  573. if (array[i].good_type_id == 0) {
  574. this.$message.error('商品类型不能为空')
  575. return
  576. }
  577. array[i].price = array[i].price.toString()
  578. }
  579. if(this.recordInfo.recordData.length <= 0){
  580. this.$message.success('请添加入库商品')
  581. return
  582. }
  583. for(let i=0;i<this.recordInfo.recordData.length;i++){
  584. if(this.recordInfo.recordData[i].dealer == ""){
  585. this.recordInfo.recordData[i].dealer = 0
  586. }
  587. for(let j=0;j<this.manufacturerList.length;j++){
  588. if(this.recordInfo.recordData[i].manufacturer == this.manufacturerList[j].manufacturer_name){
  589. this.recordInfo.recordData[i].manufacturer = this.manufacturerList[j].id
  590. }
  591. }
  592. }
  593. for(let i=0;i<this.recordInfo.recordData.length;i++){
  594. for(let j=0;j<this.dealerList.length;j++){
  595. if(this.recordInfo.recordData[i].dealer == this.dealerList[j].dealer_name){
  596. this.recordInfo.recordData[i].dealer = this.dealerList[j].id
  597. }
  598. }
  599. }
  600. const params = {
  601. 'stockIn': this.recordInfo.recordData
  602. }
  603. console.log("stockIn",this.recordInfo.recordData)
  604. postWarehouse(params, this.warehousing_time, this.form.manufacturer, this.form.dealer, this.type).then(response => {
  605. if (response.data.state == 0) {
  606. this.$message.error(response.data.msg)
  607. return false
  608. } else {
  609. this.$message.success('入库成功')
  610. this.$router.back(-1)
  611. }
  612. })
  613. } else {
  614. return false
  615. }
  616. })
  617. }
  618. ,
  619. changeManufacturer(val) {
  620. },
  621. changeDealer(val) {
  622. },
  623. getDataConfig(module, filed_name){
  624. return getDataConfig(module, filed_name)
  625. },
  626. querySearchAsync(keyword, cb) {
  627. let key = '';
  628. if (keyword != undefined) {
  629. key = keyword
  630. }
  631. postSearchGoodList(key).then(response => {
  632. if (response.data.state == 1) {
  633. var list = response.data.data.list
  634. this.goodList = list
  635. var manufacturerList = response.data.data.manufacturerList
  636. this.manufacturerList = manufacturerList
  637. var dealer = response.data.data.dealerList
  638. this.dealerList = dealer
  639. for(let i=0;i<this.goodList.length;i++){
  640. for(let j=0;j<this.manufacturerList.length;j++){
  641. if(this.goodList[i].manufacturer == this.manufacturerList[j].id){
  642. this.goodList[i].manufacturer = this.manufacturerList[j].manufacturer_name
  643. }
  644. }
  645. }
  646. for(let i=0;i<this.goodList.length;i++){
  647. for(let j=0;j<this.dealerList.length;j++){
  648. if(this.goodList[i].dealer == this.dealerList[j].id){
  649. this.goodList[i].dealer = this.dealerList[j].dealer_name
  650. }
  651. }
  652. }
  653. cb(this.goodList)
  654. } else {
  655. cb([])
  656. }
  657. })
  658. },
  659. changeGoodName(val){
  660. console.log("val",val)
  661. this.currentIndex = val
  662. },
  663. handleSelect(val){
  664. for(let i=0;i<this.recordInfo.recordData.length;i++){
  665. if(this.currentIndex == i){
  666. this.recordInfo.recordData[i].good_type_id = val.id
  667. this.recordInfo.recordData[i].good_name = val.good_name
  668. this.recordInfo.recordData[i].good_type_id = val.good_type_id
  669. this.recordInfo.recordData[i].name = val.specification_name +"/"+val.packing_unit
  670. this.recordInfo.recordData[i].number = val.number
  671. this.recordInfo.recordData[i].manufacturer = val.manufacturer
  672. this.recordInfo.recordData[i].remark = val.remark
  673. if(val.buy_price == 0){
  674. this.recordInfo.recordData[i].price = ""
  675. }else{
  676. this.recordInfo.recordData[i].price = val.buy_price
  677. }
  678. this.recordInfo.recordData[i].specification_name = val.specification_name
  679. this.recordInfo.recordData[i].good_id = val.id
  680. this.recordInfo.recordData[i].packing_unit = val.packing_unit
  681. if(val.dealer == 0){
  682. this.recordInfo.recordData[i].dealer = ""
  683. }else{
  684. this.recordInfo.recordData[i].dealer = val.dealer
  685. }
  686. }
  687. }
  688. }
  689. }
  690. ,
  691. created() {
  692. var nowDate = new Date()
  693. var nowYear = nowDate.getFullYear()
  694. var nowMonth = nowDate.getMonth() + 1
  695. var nowDay = nowDate.getDate()
  696. this.warehousing_time =
  697. nowYear +
  698. '-' +
  699. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  700. '-' +
  701. (nowDay < 10 ? '0' + nowDay : nowDay)
  702. const tempObj = {}
  703. tempObj['good_type_id'] = 0
  704. tempObj['good_id'] = 0
  705. tempObj['number'] = ''
  706. tempObj['product_date'] = ''
  707. tempObj['expiry_date'] = ''
  708. tempObj['warehousing_count'] = ''
  709. tempObj['price'] = ''
  710. tempObj['remark'] = ''
  711. tempObj['dealer'] = ''
  712. tempObj['manufacturer'] = ''
  713. tempObj['good_unit'] = ''
  714. tempObj['good_name'] = ''
  715. tempObj['specification_name'] = ''
  716. tempObj['name'] = ''
  717. tempObj['license_number'] = ''
  718. this.recordInfo.recordData.push(tempObj)
  719. this.GetConfigInfo()
  720. this.propForm.goodUnit = this.$store.getters.good_unit
  721. console.log("单位",this.getDataConfig('hemodialysis','units'))
  722. }
  723. }
  724. </script>
  725. <style>
  726. #oictable ::-webkit-scrollbar {
  727. height: 15px;
  728. }
  729. </style>
  730. <style rel="stylesheet/css" lang="scss" scoped>
  731. .information {
  732. border: 1px #dcdfe6 solid;
  733. padding: 30px 20px 30px 20px;
  734. .border {
  735. border-bottom: 1px #dcdfe6 solid;
  736. margin: 0px 0 20px 0;
  737. }
  738. }
  739. .edit_separater {
  740. border-top: 1px solid rgb(233, 233, 233);
  741. margin-top: 15px;
  742. margin-bottom: 15px;
  743. }
  744. </style>
  745. <style>
  746. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  747. font-size: 12px;
  748. }
  749. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  750. background: #6fb5fa;
  751. }
  752. .el-autocomplete-suggestion{
  753. width: 400px !important;
  754. }
  755. </style>