血透系统PC前端

otherCancelStockOrder.vue 13KB

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