血透系统PC前端

cancelStockOrder.vue 13KB

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