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

stockInOrderAdd.vue 30KB

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