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

newInventory.vue 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. <template>
  2. <div>
  3. <div>
  4. <label class="title"><span class="name">仓库</span> :</label>
  5. <el-select size="small" v-model="storehouse_id" filterable placeholder="请选择仓库" style="width:200px" @change="changeHouseList">
  6. <el-option
  7. v-for="(option, index) in houseList"
  8. :key="index"
  9. :label="option.storehouse_name"
  10. :value="option.id">
  11. </el-option>
  12. </el-select>
  13. </div>
  14. <div>
  15. <div style="margin-top:20px">日期:{{nowTime}} 盘点人:{{user_name}}</div>
  16. <div style="float:right;margin-bottom:10px"><el-button type="primary" @click="saveInentoryList">保存</el-button></div>
  17. <el-table :data="tableData" border :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }" style="width:100%">
  18. <el-table-column prop="date" label="耗材名称" width="150" align="center">
  19. <template slot-scope="scope">
  20. {{scope.row.good_name}}
  21. </template>
  22. </el-table-column>
  23. <el-table-column prop="name" label="规格" width="100" align="center">
  24. <template slot-scope="scope">
  25. {{scope.row.specification_name}}
  26. </template>
  27. </el-table-column>
  28. <el-table-column prop="name" label="入库单号" width="100" align="center">
  29. <template slot-scope="scope">
  30. {{scope.row.warehousing_order}}
  31. </template>
  32. </el-table-column>
  33. <el-table-column prop="name" label="有效期" width="100" align="center">
  34. <template slot-scope="scope">
  35. {{getTime(scope.row.expiry_date)}}
  36. </template>
  37. </el-table-column>
  38. <el-table-column prop="name" label="批号" width="100" align="center">
  39. <template slot-scope="scope">
  40. {{scope.row.number}}
  41. </template>
  42. </el-table-column>
  43. <el-table-column prop="name" label="进货价" width="100" align="center">
  44. <template slot-scope="scope">
  45. {{scope.row.price}}
  46. </template>
  47. </el-table-column>
  48. <el-table-column prop="name" label="生产厂商" width="100" align="center">
  49. <template slot-scope="scope">
  50. {{scope.row.manufacturer_name}}
  51. </template>
  52. </el-table-column>
  53. <el-table-column prop="name" label="仓库名称" width="100" align="center">
  54. <template slot-scope="scope">
  55. {{getStorehouseName(scope.row.storehouse_id)}}
  56. </template>
  57. </el-table-column>
  58. <el-table-column prop="name" label="盘点前数量" width="120" align="center">
  59. <template slot-scope="scope">
  60. <span><el-input style="width:80px" v-model="scope.row.stock_count" :disabled="true"></el-input>{{scope.row.max_unit}}</span>
  61. </template>
  62. </el-table-column>
  63. <el-table-column prop="name" label="盘点后数量" width="120" align="center">
  64. <template slot-scope="scope">
  65. <el-input style="width:80px" v-model="scope.row.last_stock_count"></el-input>
  66. </template>
  67. </el-table-column>
  68. <el-table-column prop="name" label="盘点原因" width="180" align="center">
  69. <template slot-scope="scope">
  70. <el-select v-model="scope.row.type" placeholder="请选择">
  71. <el-option
  72. v-for="item in reasonList"
  73. :key="item.id"
  74. :label="item.name"
  75. :value="item.id">
  76. </el-option>
  77. </el-select>
  78. </template>
  79. </el-table-column>
  80. <el-table-column prop="name" width="200" align="center">
  81. <template slot-scope="scope">
  82. <span><el-button type="danger" @click="toDelete(scope.$index,scope.row.good_id)">不盘点此批次</el-button></span>
  83. </template>
  84. </el-table-column>
  85. </el-table>
  86. </div>
  87. </div>
  88. </template>
  89. <script>
  90. const moment = require("moment");
  91. import { uParseTime } from '@/utils/tools'
  92. import {getInventoryList,SaveCheckedInventory,getInventoryDetail,deleteInventory,getWarehouseTotal,saveStockInentoryList,getwarehouseinfolist } from "@/api/stock"
  93. export default {
  94. name: "inventory",
  95. data() {
  96. return{
  97. user_name:this.$store.getters.xt_user.user.user_name,
  98. nowTime: moment(new Date()).format("YYYY-MM-DD HH:MM:SS"),
  99. searchKey:'',
  100. value1:'',
  101. value2:'',
  102. tableData: [],
  103. dialogVisible:false,
  104. total: 0,
  105. inventoryList:[
  106. {id:0,name:"全部"},
  107. {id:1,name:"盘点完成"},
  108. {id:2,name:"正在盘点"},
  109. ],
  110. start_time:"",
  111. end_time:"",
  112. form: {
  113. id:"",
  114. good_name: '',
  115. packing_price:'',
  116. new_price:"",
  117. count:"",
  118. remark:"",
  119. warehousing_order:"",
  120. manufacturer:"",
  121. dealer:"",
  122. license_number:"",
  123. warehousing_unit:"",
  124. specification_name:"",
  125. buy_price:"",
  126. good_id:"",
  127. packing_unit:"",
  128. good_origin_place:"",
  129. report_count:"",
  130. total:"",
  131. expiry_date:"",
  132. product_date:"",
  133. number:"",
  134. proof_count:"",
  135. storehouse_id:"",
  136. },
  137. manufacturerList:[],
  138. dealerList:[],
  139. goodList:[],
  140. currentIndex: 0,
  141. inventory_status:0,
  142. limit:10,
  143. page:1,
  144. doctorList:[],
  145. total:0,
  146. tableList:[],
  147. ids:"",
  148. checker:this.$store.getters.xt_user.user.id,
  149. check_time:new Date(),
  150. checkDialogVisible:false,
  151. editPriceDialogVisible:false,
  152. modefiyePriceDialogVisible:false,
  153. proofPriceDialogVisible:false,
  154. id:0,
  155. numberList:[],
  156. reasonList:[
  157. {id:6,name:"默认"},
  158. {id:1,name:"到期退货"},
  159. {id:2,name:"异常退货"},
  160. {id:3,name:"退货"},
  161. {id:4,name:"损坏"},
  162. {id:5,name:"不计入报损分析"},
  163. {id:7,name:"有效期到期"},
  164. ],
  165. activeNames: [0,1,2,3,4,5,6,7,8,9,10],
  166. showTable:false,
  167. showSearch:true,
  168. inventory_total:0,
  169. WarehouseList:[],
  170. showTableOne:false,
  171. houseList:[],
  172. storehouse_id:"",
  173. }
  174. },
  175. methods:{
  176. open(){
  177. this.getlist()
  178. },
  179. changeGoodName(val){
  180. this.currentIndex = val
  181. },
  182. search(){
  183. this.getlist()
  184. },
  185. print(){
  186. if(this.ids == ""){
  187. this.$message.error("请勾选打印数据")
  188. return
  189. }else{
  190. this.$router.push({path:'/stock/inventoryPrint?ids='+this.ids})
  191. }
  192. },
  193. getTime(val) {
  194. if(val < 0){
  195. return ""
  196. }
  197. if(val == ""){
  198. return ""
  199. }else {
  200. return uParseTime(val, '{y}-{m}-{d}')
  201. }
  202. },
  203. handleSizeChange(val){
  204. this.limit = val
  205. this.getlist()
  206. },
  207. handleCurrentChange(val){
  208. this.page = val
  209. this.getlist()
  210. },
  211. changeHouseList(){
  212. this.getwarehouseinfolist()
  213. },
  214. getlist(){
  215. var params = {
  216. keyword:this.searchKey,
  217. start_time:this.start_time,
  218. end_time:this.end_time,
  219. inventory_status:this.inventory_status,
  220. page:this.page,
  221. limit:this.limit,
  222. }
  223. getInventoryList(params).then(response=>{
  224. if(response.data.state ==1 ){
  225. var list = response.data.data.list
  226. this.tableList = list
  227. var total = response.data.data.total
  228. this.total = total
  229. this.doctorList = []
  230. this.doctorList = response.data.data.doctorlist
  231. this.houseList = []
  232. this.houseList = response.data.data.houseList
  233. var houseConfig = response.data.data.houseConfig
  234. this.storehouse_id = houseConfig.storehouse_out_info
  235. this.getwarehouseinfolist()
  236. }
  237. })
  238. },
  239. getChecker(id){
  240. var name = ""
  241. for(let i=0;i<this.doctorList.length;i++){
  242. if(id == this.doctorList[i].admin_user_id){
  243. name = this.doctorList[i].user_name
  244. }
  245. }
  246. return name
  247. },
  248. toCheck(){
  249. if(this.ids.length <=0){
  250. this.$message.error("请勾选核对数据")
  251. return
  252. }else{
  253. this.checkDialogVisible = true
  254. }
  255. },
  256. changePrice(val){
  257. var arr = []
  258. for(let i=0;i<val.length;i++){
  259. arr.push(val[i].id)
  260. }
  261. var str = arr.join(",")
  262. this.ids = str
  263. },
  264. SaveCheckedInventory(){
  265. var params = {
  266. ids:this.ids,
  267. check_time:this.getTime(this.check_time),
  268. checker:this.checker,
  269. }
  270. SaveCheckedInventory(params).then(response=>{
  271. if(response.data.state == 1){
  272. this.$message.success("保存成功")
  273. var inventory = response.data.data.inventory
  274. this.checkDialogVisible = false
  275. this.getlist()
  276. }
  277. })
  278. },
  279. getInventory(id){
  280. getInventoryDetail(id).then(response=>{
  281. if(response.data.state == 1){
  282. var detail = response.data.data.detail
  283. this.form.good_name = detail.good_name
  284. this.form.specification_name = detail.specification_name
  285. this.form.count = detail.count
  286. this.form.remark = detail.remark
  287. this.form.total = detail.total
  288. this.form.warehousing_info_id = detail.warehousing_info_id
  289. this.form.good_id = detail.good_id
  290. this.id = detail.id
  291. this.proofPriceDialogVisible = true
  292. }
  293. })
  294. },
  295. deleteInventory(id,check_status,index){
  296. if(check_status == 1){
  297. this.$message.error("已核对的不能编辑")
  298. return
  299. }
  300. this.$confirm('是否删除所选内容?', '提示', {
  301. confirmButtonText: '确定',
  302. cancelButtonText: '取消',
  303. type: 'warning'
  304. }).then(() => {
  305. deleteInventory(id).then(response => {
  306. if (response.data.state == 1) {
  307. var msg = response.data.data.msg
  308. this.$message.success("保存成功")
  309. this.tableList.splice(index,1)
  310. }
  311. })
  312. }).catch(() => {
  313. this.loading = false
  314. });
  315. },
  316. changeInventory(){
  317. this.getlist()
  318. },
  319. changeStartTime(val){
  320. this.start_time = this.getTime(val)
  321. this.getlist()
  322. },
  323. changeEndTime(val){
  324. this.end_time = this.getTime(val)
  325. this.getlist()
  326. },
  327. changeNumber(val){
  328. this.getWarehouseTotal(val)
  329. this.form.warehousing_info_id = val
  330. },
  331. getWarehouseTotal(id){
  332. var params = {
  333. id:id,
  334. }
  335. getWarehouseTotal(params).then(response=>{
  336. if(response.data.state == 1){
  337. var list = response.data.data.list
  338. this.form.total = list.stock_count
  339. }
  340. })
  341. },
  342. toMove(item,index){
  343. this.$confirm('此操作将移除耗材整个批次, 是否继续?', '提示', {
  344. confirmButtonText: '确定',
  345. cancelButtonText: '取消',
  346. type: 'warning'
  347. }).then(() => {
  348. this.tableData.splice(index,1)
  349. this.WarehouseList = []
  350. this.activeNames = [0,1,2,3,4,5,6,7,8,9,10]
  351. }).catch(() => {
  352. this.loading = false
  353. });
  354. },
  355. toDelete(index,good_id){
  356. console.log("data232323223",this.tableData,good_id,index)
  357. for(let i=0;i<this.tableData.length;i++){
  358. if(good_id == this.tableData[i].good_id){
  359. this.tableData.splice(index,1)
  360. }
  361. }
  362. },
  363. saveInentoryList(){
  364. const loading = this.$loading({
  365. lock: true,
  366. text: 'Loading',
  367. spinner: 'el-icon-loading',
  368. background: 'rgba(0, 0, 0, 0.7)'
  369. })
  370. for(let i=0;i<this.tableData.length;i++){
  371. if(this.tableData[i].last_stock_count == undefined){
  372. this.tableData[i].last_stock_count = 0
  373. }else{
  374. this.tableData[i].last_stock_count = parseInt(this.tableData[i].last_stock_count)
  375. }
  376. this.tableData[i].storehouse_id = this.storehouse_id
  377. }
  378. var arr = []
  379. for(let i=0;i<this.tableData.length;i++){
  380. if(this.tableData[i].stock_count!=this.tableData[i].last_stock_count){
  381. arr.push(this.tableData[i])
  382. }
  383. }
  384. if(arr.length == 0){
  385. this.$message.error("请修改数据后保存!")
  386. loading.close()
  387. return false
  388. }
  389. var params = {
  390. tableData:arr,
  391. storehouse_id:this.storehouse_id,
  392. }
  393. console.log("param23323232323232323",params)
  394. saveStockInentoryList(params).then(response=>{
  395. if(response.data.state == 1){
  396. loading.close()
  397. var inventory = response.data.data.inventory
  398. this.$message.success("保存成功")
  399. this.WarehouseList = []
  400. this.tableData = []
  401. this.getlist()
  402. }
  403. })
  404. },
  405. getStorehouseName(id){
  406. var storehouse_name = ""
  407. for(let i=0;i<this.houseList.length;i++){
  408. if(id == this.houseList[i].id){
  409. storehouse_name = this.houseList[i].storehouse_name
  410. }
  411. }
  412. return storehouse_name
  413. },
  414. getwarehouseinfolist(){
  415. const loading = this.$loading({
  416. lock: true,
  417. text: 'Loading',
  418. spinner: 'el-icon-loading',
  419. background: 'rgba(0, 0, 0, 0.7)'
  420. })
  421. var params = {
  422. storehouse_id:this.storehouse_id,
  423. }
  424. getwarehouseinfolist(params).then(response=>{
  425. if(response.data.state == 1){
  426. var list = response.data.data.list
  427. this.manufacturerList = response.data.data.manufacturerList
  428. loading.close()
  429. for(let i=0;i<list.length;i++){
  430. list[i].type = 6
  431. list[i].good_name = list[i].GoodInfo.good_name
  432. list[i].specification_name = list[i].GoodInfo.specification_name
  433. list[i].manufacturer_name = ""
  434. for(let j=0;j<this.manufacturerList.length;j++){
  435. if(list[i].manufacturer == this.manufacturerList[j].id){
  436. list[i].manufacturer_name = this.manufacturerList[j].manufacturer_name
  437. }
  438. }
  439. list[i].last_stock_count = list[i].stock_count
  440. }
  441. this.tableData = []
  442. console.log("list2332322323232332322323wo",list)
  443. this.tableData = list
  444. }
  445. })
  446. },
  447. },
  448. created(){
  449. this.getlist()
  450. },
  451. mounted() {
  452. },
  453. };
  454. </script>