血透系统PC前端

stockOutOrder.vue 12KB

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