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

stockInOrderAdd.vue 36KB

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