血透系统PC前端

stockOutDetail.vue 14KB

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