血透系统PC前端

cancelStockDetail.vue 14KB

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