血透系统PC前端

stockDetail.vue 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs='crumbs'></bread-crumb>
  5. <el-button size="small" @click="AddNewOrder" class="filter-item" style="float:right;" type="primary"
  6. icon="el-icon-circle-plus-outline">新增
  7. </el-button>
  8. </div>
  9. <div class="app-container">
  10. <div class="cell clearfix" >
  11. <el-input style="width: 300px;" class="filter-item" v-model="searchKey" placeholder="单据编码/制单人/厂商"/>
  12. <el-button class="filter-item" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
  13. </div>
  14. <div class="cell clearfix">
  15. <label class="title"><span class="name">日期查询</span> : </label>
  16. <el-date-picker v-model="start_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
  17. type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
  18. value-format="yyyy-MM-dd" @change="startTimeChange"></el-date-picker>
  19. <span class="">-</span>
  20. <el-date-picker v-model="end_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
  21. type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
  22. value-format="yyyy-MM-dd" @change="endTimeChange"></el-date-picker>
  23. </div>
  24. <div class="filter-container" style="margin-top: 10px">
  25. <el-checkbox style="width: 30px" v-model="checked" @change="changeAllSelected">全选</el-checkbox>
  26. <el-button size="small" icon="el-icon-delete" @click="batchDelete">删除</el-button>
  27. </div>
  28. <el-row :gutter="12" style="margin-top: 10px">
  29. <el-table
  30. :data="cancelStockDate"
  31. :class="signAndWeighBoxPatients"
  32. border
  33. highlight-current-row
  34. ref="multipleTable"
  35. @selection-change="select"
  36. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  37. >
  38. <el-table-column label="单据编号" align="center">
  39. <template slot-scope="scope">
  40. {{scope.row.warehousing_order}}
  41. </template>
  42. </el-table-column>
  43. <el-table-column label="商品类型" align="center">
  44. <template slot-scope="scope">
  45. {{specificationName(scope.row.good_id)}}
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="单据类型" align="center">
  49. <template slot-scope="scope">
  50. {{getTypeName(scope.row)}}
  51. </template>
  52. </el-table-column>
  53. <el-table-column label="操作时间" align="center">
  54. <template slot-scope="scope">
  55. {{ scope.row.warehousing_time | parseTime('{y}-{m}-{d}')}}
  56. </template>
  57. </el-table-column>
  58. <el-table-column label="制单人" align="center">
  59. <template slot-scope="scope">
  60. {{getXuserName(scope.row.creater)}}
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="单价" align="center">
  64. <template slot-scope="scope">
  65. {{scope.row.price}}
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="数量" align="center">
  69. <template slot-scope="scope">
  70. {{scope.row.warehousing_count}}
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="总价" align="center">
  74. <template slot-scope="scope">
  75. {{scope.row.price * scope.row.warehousing_count}}
  76. </template>
  77. </el-table-column>
  78. </el-table>
  79. <el-pagination
  80. @size-change="handleSizeChange"
  81. @current-change="handleCurrentChange"
  82. :page-sizes="[7]"
  83. :page-size="7"
  84. background
  85. style="margin-top:20px;float: right"
  86. layout="total, sizes, prev, pager, next, jumper"
  87. :total="total">
  88. </el-pagination>
  89. </el-row>
  90. </div>
  91. </div>
  92. </template>
  93. <script>
  94. import { uParseTime } from '@/utils/tools'
  95. import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from '@/api/doctor'
  96. import { deleteCancelStock, GetAllConfig, getStockDetail } from '@/api/stock'
  97. import BreadCrumb from '../components/bread-crumb'
  98. export default {
  99. name: 'salesReturnOrder',
  100. components: { BreadCrumb },
  101. created() {
  102. var year = new Date().getFullYear()
  103. var month = new Date().getMonth() + 1
  104. var day = new Date().getDate()
  105. if (parseInt(month) < 10) {
  106. month = '0' + month
  107. }
  108. if (parseInt(day) < 10) {
  109. day = '0' + day
  110. }
  111. const endTime = year + '-' + month + '-' + day
  112. this.end_time = endTime
  113. var year = new Date().getFullYear()
  114. var month = new Date().getMonth()
  115. var day = new Date().getDate()
  116. if (parseInt(month) < 10) {
  117. month = '0' + month
  118. }
  119. if (parseInt(day) < 10) {
  120. day = '0' + day
  121. }
  122. const startTime = year + '-' + month + '-' + day
  123. this.start_time = startTime
  124. this.GetCancelStock()
  125. this.GetConfigInfo()
  126. this.fetchAllAdminUsers()
  127. },
  128. data() {
  129. return {
  130. crumbs: [
  131. { path: false, name: '库存管理' },
  132. { path: '/stock/detail', name: '出入库明细查询' }
  133. ],
  134. searchKey:'',
  135. type: 1,
  136. page: 1,
  137. limit: 7,
  138. checked: false,
  139. total: 0,
  140. pageTotal: 0,
  141. pageSelect: 0,
  142. adminUserOptions: [],
  143. multipleSelection: [],
  144. signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
  145. start_time: '',
  146. cancelStockDate: [],
  147. end_time: '',
  148. goodType: [],
  149. goodInfo: [],
  150. manufacturer: [],
  151. selectedTableData: [],
  152. dealer: []
  153. }
  154. },
  155. methods: {
  156. getTypeName:function(row){
  157. let name = ""
  158. let name2 = ""
  159. if (row.type == 1){
  160. name = "耗材"
  161. }else if(row.type == 2){
  162. name = "其他"
  163. }
  164. if (row.types == 1){
  165. name2 = "入库单"
  166. }else if(row.types == 2){
  167. name2 = "出库单"
  168. }else if(row.types == 3){
  169. name2 = "退货单"
  170. }else if(row.types == 4){
  171. name2 = "退库单"
  172. }
  173. return name + name2
  174. },
  175. specificationName: function(good_info_id) {
  176. let name = ''
  177. for (let i = 0; i < this.goodInfo.length; i++) {
  178. if (this.goodInfo[i].id == good_info_id) {
  179. name = this.goodInfo[i].specification_name
  180. }
  181. }
  182. return name
  183. },
  184. search:function(){
  185. const Params = {
  186. page: this.page,
  187. limit: this.limit,
  188. start_time: this.start_time,
  189. end_time: this.end_time,
  190. type: this.type,
  191. keywords:this.searchKey,
  192. }
  193. this.cancelStockDate = []
  194. getStockDetail(Params).then(response => {
  195. if (response.data.state == 0) {
  196. this.$message.error(response.data.msg)
  197. return false
  198. } else {
  199. this.total = response.data.data.total
  200. for (let i = 0; i < response.data.data.list.length; i++) {
  201. this.cancelStockDate.push(response.data.data.list[i])
  202. }
  203. }
  204. })
  205. },
  206. AddNewOrder: function() {
  207. this.$router.push({ name: 'cancelStockOrderAdd', query: { type: this.type }})
  208. },
  209. GetCancelStock: function() {
  210. const Params = {
  211. page: this.page,
  212. limit: this.limit,
  213. start_time: this.start_time,
  214. end_time: this.end_time,
  215. type: this.type
  216. }
  217. this.cancelStockDate = []
  218. getStockDetail(Params).then(response => {
  219. if (response.data.state == 0) {
  220. this.$message.error(response.data.msg)
  221. return false
  222. } else {
  223. this.total = response.data.data.total
  224. for (let i = 0; i < response.data.data.list.length; i++) {
  225. this.cancelStockDate.push(response.data.data.list[i])
  226. }
  227. }
  228. })
  229. }, getXuserName(id) {
  230. if (id <= 0) {
  231. return ''
  232. }
  233. var name = ''
  234. if (this.adminUserOptions == null || typeof (this.adminUserOptions.length) === 'undefined') {
  235. return name
  236. }
  237. var leng = this.adminUserOptions.length
  238. if (leng == 0) {
  239. return name
  240. }
  241. for (let index = 0; index < leng; index++) {
  242. if (this.adminUserOptions[index].id == id) {
  243. name = this.adminUserOptions[index].name
  244. break
  245. }
  246. }
  247. return name
  248. }, fetchAllAdminUsers() {
  249. fetchAllAdminUsers().then(response => {
  250. console.log(response)
  251. if (response.data.state == 1) {
  252. this.adminUserOptions = response.data.data.users
  253. var alen = this.adminUserOptions.length
  254. for (let index = 0; index < alen; index++) {
  255. if (this.adminUserOptions[index].user_type == 2) {
  256. // this.doctorOptions.push(this.adminUserOptions[index]);
  257. }
  258. }
  259. }
  260. })
  261. }, handleSelectionChange: function(val) {
  262. this.multipleSelection = val
  263. }, handleSizeChange(val) {
  264. this.limit = val
  265. this.GetWarehouse()
  266. }, handleCurrentChange(val) {
  267. this.page = val
  268. this.GetWarehouse()
  269. }, startTimeChange(val) {
  270. this.GetWarehouse()
  271. }, endTimeChange(val) {
  272. this.GetWarehouse()
  273. }, calculate: function(val) {
  274. return Math.round(parseFloat(val) * 100) / 100
  275. }, GetConfigInfo: function() {
  276. GetAllConfig().then(response => {
  277. if (response.data.state == 0) {
  278. this.$message.error(response.data.msg)
  279. return false
  280. } else {
  281. this.manufacturer = response.data.data.manufacturer
  282. this.dealer = response.data.data.dealer
  283. this.goodInfo = response.data.data.goodInfo
  284. }
  285. })
  286. }, getManufactuerName: function(manufacturer_id) {
  287. for (let i = 0; i < this.manufacturer.length; i++) {
  288. if (this.manufacturer[i].id == manufacturer_id) {
  289. return this.manufacturer[i].manufacturer_name
  290. }
  291. }
  292. }, getDealerName: function(dealer_id) {
  293. for (let i = 0; i < this.dealer.length; i++) {
  294. if (this.dealer[i].id == dealer_id) {
  295. return this.dealer[i].dealer_name
  296. }
  297. }
  298. }, handleEdit: function(index, row) {
  299. this.$router.push({ name: 'cancelStockDetail', query: { id: row.id,type: this.type }})
  300. }, handleDelete: function(index, row) {
  301. const ids = []
  302. ids.push(row.id)
  303. const idStr = ids.join(',')
  304. const params = {
  305. ids: idStr
  306. }
  307. this.$confirm('确认删除出库退库单记录?', '删除出库退库单记录', {
  308. confirmButtonText: '确定',
  309. cancelButtonText: '取消',
  310. type: 'warning'
  311. }).then(() => {
  312. deleteCancelStock(params).then(response => {
  313. if (response.data.state == 0) {
  314. this.$message.error(response.data.msg)
  315. return false
  316. } else {
  317. this.$notify({
  318. title: '成功',
  319. message: '删除成功',
  320. type: 'success',
  321. duration: 2000
  322. })
  323. for (let i = 0; i < ids.length; i++) {
  324. for (let y = 0; y < this.cancelStockDate.length; y++) {
  325. if (ids[i] == this.cancelStockDate[y].id) {
  326. this.cancelStockDate.splice(y, 1)
  327. }
  328. }
  329. }
  330. }
  331. })
  332. }).catch(() => {
  333. })
  334. }, changeAllSelected: function(val) {
  335. if (val) {
  336. this.$refs.multipleTable.toggleAllSelection()
  337. } else {
  338. this.$refs.multipleTable.clearSelection()
  339. }
  340. }, select(selection) {
  341. this.selectedTableData = selection
  342. }, batchDelete() {
  343. if (this.selectedTableData.length <= 0) {
  344. this.$message.error('请选择要删除的记录')
  345. return
  346. }
  347. const ids = []
  348. for (let i = 0; i < this.selectedTableData.length; i++) {
  349. ids.push(this.selectedTableData[i].id)
  350. }
  351. const idStr = ids.join(',')
  352. const params = {
  353. ids: idStr
  354. }
  355. this.$confirm('确认删除出库退库单记录?', '删除出库退库单记录', {
  356. confirmButtonText: '确定',
  357. cancelButtonText: '取消',
  358. type: 'warning'
  359. }).then(() => {
  360. deleteCancelStock(params).then(response => {
  361. if (response.data.state == 0) {
  362. this.$message.error(response.data.msg)
  363. return false
  364. } else {
  365. this.$notify({
  366. title: '成功',
  367. message: '删除成功',
  368. type: 'success',
  369. duration: 2000
  370. })
  371. for (let i = 0; i < ids.length; i++) {
  372. for (let y = 0; y < this.cancelStockDate.length; y++) {
  373. if (ids[i] == this.cancelStockDate[y].id) {
  374. this.cancelStockDate.splice(y, 1)
  375. }
  376. }
  377. }
  378. }
  379. })
  380. }).catch(() => {
  381. })
  382. }
  383. }
  384. }
  385. </script>
  386. <style rel="stylesheet/css" lang="scss" scoped>
  387. .information {
  388. border: 1px #dcdfe6 solid;
  389. padding: 30px 20px 30px 20px;
  390. .border {
  391. border-bottom: 1px #dcdfe6 solid;
  392. margin: 0px 0 20px 0;
  393. }
  394. }
  395. .edit_separater {
  396. border-top: 1px solid rgb(233, 233, 233);
  397. margin-top: 15px;
  398. margin-bottom: 15px;
  399. }
  400. </style>
  401. <style>
  402. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  403. font-size: 12px;
  404. }
  405. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  406. background: #6fb5fa;
  407. }
  408. .count {
  409. color: #bd2c00;
  410. }
  411. </style>