血透系统PC前端

stockInOrder.vue 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <!--<bread-crumb :crumbs='crumbs'></bread-crumb>-->
  5. <bread-crumb :crumbs='crumbs'></bread-crumb>
  6. <el-button size="small" @click="handleWarehouse" class="filter-item" style="float:right;" type="primary" icon="el-icon-circle-plus-outline" >新增</el-button>
  7. </div>
  8. <div class="app-container">
  9. <div class="cell clearfix">
  10. <el-input style="width: 400px;" v-model="searchKey" class="filter-item" placeholder="单据编码/制单人/厂商" />
  11. <el-button class="filter-item" type="primary" icon="el-icon-search" @click="search" >搜索</el-button>
  12. </div>
  13. <div class="cell clearfix">
  14. <label class="title"><span class="name">入库时间</span> : </label>
  15. <el-date-picker v-model="start_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
  16. type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
  17. value-format="yyyy-MM-dd" @change="startTimeChange"></el-date-picker>
  18. <span class="cellLine"> - </span>
  19. <el-date-picker v-model="end_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
  20. type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
  21. value-format="yyyy-MM-dd" @change="endTimeChange"></el-date-picker>
  22. </div>
  23. <div class="cell clearfix">
  24. <el-checkbox style="width: 30px" v-model="checked" @change="changeAllSelected">全选</el-checkbox>
  25. <el-button size="small" icon="el-icon-delete" @click="batchDelete">删除</el-button>
  26. </div>
  27. <el-table
  28. :data="Warehouse.warehouseDate"
  29. :class="signAndWeighBoxPatients"
  30. style="width: 100%" border
  31. highlight-current-row
  32. v-loading="Warehouse.loading"
  33. ref="multipleTable"
  34. @selection-change="select"
  35. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  36. >
  37. <el-table-column
  38. align="center"
  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.warehousing_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.warehousing_order}}
  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="small"
  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="small"
  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. </div>
  99. </div>
  100. </template>
  101. <script>
  102. import { uParseTime } from '@/utils/tools'
  103. import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from '@/api/doctor'
  104. import {
  105. deleteWarehouseInfo,
  106. GetAllConfig,
  107. GetAllGoodInfo,
  108. GetAllGoodType,
  109. getWarehouseInfoList,
  110. getWarehouseList
  111. } from '@/api/stock'
  112. import BreadCrumb from '../components/bread-crumb'
  113. export default {
  114. name: 'stockIn',
  115. components: { BreadCrumb },
  116. created() {
  117. var year = new Date().getFullYear()
  118. var month = new Date().getMonth() + 1
  119. var day = new Date().getDate()
  120. if (parseInt(month) < 10) {
  121. month = '0' + month
  122. }
  123. if (parseInt(day) < 10) {
  124. day = '0' + day
  125. }
  126. const endTime = year + '-' + month + '-' + day
  127. this.end_time = endTime
  128. var year = new Date().getFullYear()
  129. var month = new Date().getMonth()
  130. var day = new Date().getDate()
  131. if (parseInt(month) < 10) {
  132. month = '0' + month
  133. }
  134. if (parseInt(day) < 10) {
  135. day = '0' + day
  136. }
  137. const startTime = year + '-' + month + '-' + day
  138. this.start_time = startTime
  139. this.GetWarehouse()
  140. this.GetConfigInfo()
  141. this.fetchAllAdminUsers()
  142. },
  143. data() {
  144. return {
  145. crumbs: [
  146. { path: false, name: '库存管理' },
  147. { path: false, name: '入库单' }
  148. ],
  149. searchKey:'',
  150. type: 1,
  151. page: 1,
  152. limit: 7,
  153. checked: false,
  154. total: 0,
  155. pageTotal: 0,
  156. pageSelect: 0,
  157. adminUserOptions: [],
  158. multipleSelection: [],
  159. signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
  160. start_time: '',
  161. end_time: '',
  162. goodType: [],
  163. goodInfo: [],
  164. manufacturer: [],
  165. selectedTableData: [],
  166. dealer: [],
  167. Warehouse: {
  168. loading: false,
  169. warehouseDate: [],
  170. tableCurrentIndex: ''
  171. },
  172. WarehouseInfo: {
  173. loading: false,
  174. warehouseInfoDate: []
  175. }
  176. }
  177. },
  178. methods: {
  179. search:function(){
  180. const Params = {
  181. page: this.page,
  182. limit: this.limit,
  183. start_time: this.start_time,
  184. end_time: this.end_time,
  185. type: this.type,
  186. keywords:this.searchKey,
  187. }
  188. this.Warehouse.warehouseDate = []
  189. getWarehouseList(Params).then(response => {
  190. if (response.data.state == 0) {
  191. this.Warehouse.loading = false
  192. this.$message.error(response.data.msg)
  193. return false
  194. } else {
  195. this.Warehouse.loading = false
  196. this.total = response.data.data.total
  197. for (let i = 0; i < response.data.data.list.length; i++) {
  198. this.Warehouse.warehouseDate.push(response.data.data.list[i])
  199. }
  200. }
  201. })
  202. },
  203. GetWarehouse: function() {
  204. const Params = {
  205. page: this.page,
  206. limit: this.limit,
  207. start_time: this.start_time,
  208. end_time: this.end_time,
  209. type: this.type
  210. }
  211. this.Warehouse.warehouseDate = []
  212. getWarehouseList(Params).then(response => {
  213. if (response.data.state == 0) {
  214. this.Warehouse.loading = false
  215. this.$message.error(response.data.msg)
  216. return false
  217. } else {
  218. this.Warehouse.loading = false
  219. this.total = response.data.data.total
  220. for (let i = 0; i < response.data.data.list.length; i++) {
  221. this.Warehouse.warehouseDate.push(response.data.data.list[i])
  222. }
  223. }
  224. })
  225. }, tableRowClassName({ row, rowIndex }) {
  226. // 把每一行的索引放进row
  227. row.index = rowIndex
  228. },
  229. onRowClick(row, event, column) {
  230. this.WarehouseInfo.warehouseInfoDate = []
  231. this.Warehouse.tableCurrentIndex = row.index
  232. const params = {
  233. 'id': row.id
  234. }
  235. this.WarehouseInfo.loading = true
  236. getWarehouseInfoList(params).then(response => {
  237. if (response.data.state == 0) {
  238. this.WarehouseInfo.loading = false
  239. this.$message.error(response.data.msg)
  240. return false
  241. } else {
  242. this.WarehouseInfo.loading = false
  243. for (let i = 0; i < response.data.data.info.length; i++) {
  244. this.WarehouseInfo.warehouseInfoDate.push(response.data.data.info[i])
  245. }
  246. }
  247. })
  248. }, getXuserName(id) {
  249. if (id <= 0) {
  250. return ''
  251. }
  252. var name = ''
  253. if (this.adminUserOptions == null || typeof (this.adminUserOptions.length) === 'undefined') {
  254. return name
  255. }
  256. var leng = this.adminUserOptions.length
  257. if (leng == 0) {
  258. return name
  259. }
  260. for (let index = 0; index < leng; index++) {
  261. if (this.adminUserOptions[index].id == id) {
  262. name = this.adminUserOptions[index].name
  263. break
  264. }
  265. }
  266. return name
  267. }, fetchAllDoctorAndNurse() {
  268. fetchAllDoctorAndNurse().then(response => {
  269. if (response.data.state == 1) {
  270. this.doctorOptions = response.data.data.doctors
  271. }
  272. })
  273. },
  274. fetchAllAdminUsers() {
  275. fetchAllAdminUsers().then(response => {
  276. console.log(response)
  277. if (response.data.state == 1) {
  278. this.adminUserOptions = response.data.data.users
  279. var alen = this.adminUserOptions.length
  280. for (let index = 0; index < alen; index++) {
  281. if (this.adminUserOptions[index].user_type == 2) {
  282. // this.doctorOptions.push(this.adminUserOptions[index]);
  283. }
  284. }
  285. }
  286. })
  287. }, getSpecificationName: function(id) {
  288. let name = ''
  289. for (let i = 0; i < this.goodInfo.length; i++) {
  290. if (this.goodInfo[i].id == id) {
  291. name = this.goodInfo[i].specification_name
  292. }
  293. }
  294. return name
  295. }, getTypeName: function(id) {
  296. let name = ''
  297. for (let i = 0; i < this.goodType.length; i++) {
  298. if (this.goodType[i].id == id) {
  299. name = this.goodType[i].type_name
  300. }
  301. }
  302. return name
  303. }, GetAllGoodType: function() {
  304. GetAllGoodType().then(response => {
  305. if (response.data.state == 0) {
  306. this.$message.error(response.data.msg)
  307. return false
  308. } else {
  309. for (let i = 0; i < response.data.data.goodType.length; i++) {
  310. this.goodType.push(response.data.data.goodType[i])
  311. }
  312. }
  313. })
  314. }, GetAllGoodInfo: function() {
  315. GetAllGoodInfo().then(response => {
  316. if (response.data.state == 0) {
  317. this.$message.error(response.data.msg)
  318. return false
  319. } else {
  320. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  321. this.goodInfo.push(response.data.data.goodInfo[i])
  322. }
  323. }
  324. })
  325. }, clicks: function() {
  326. console.log(this.WarehouseInfo.warehouseInfoDate)
  327. }, handleWarehouse: function() {
  328. this.$router.push({ path: '/stock/in/add', query: { type: this.type }})
  329. }, handleReturnSales: function() {
  330. // this.$router.push({path:'/patients/create'}
  331. if (this.multipleSelection.length <= 0) {
  332. this.$message.error('请选择退货商品')
  333. return
  334. }
  335. const ids = []
  336. for (let i = 0; i < this.multipleSelection.length; i++) {
  337. ids.push(this.multipleSelection[i].id)
  338. }
  339. this.$router.push({ name: 'salesReturn', query: { id: ids.join('&') }})
  340. }, handleReturnSalesRecord: function() {
  341. this.$router.push({ name: 'salesReutrnRecord' })
  342. }, handleWarehouseRecord: function() {
  343. this.$router.push({ name: 'warehouseRecord' })
  344. }, handleSelectionChange: function(val) {
  345. this.multipleSelection = val
  346. }, handleSizeChange(val) {
  347. this.limit = val
  348. this.GetWarehouse()
  349. }, handleCurrentChange(val) {
  350. this.page = val
  351. this.GetWarehouse()
  352. }, startTimeChange(val) {
  353. this.GetWarehouse()
  354. }, endTimeChange(val) {
  355. this.GetWarehouse()
  356. }, calculate: function(val) {
  357. return Math.round(parseFloat(val) * 100) / 100
  358. }, GetConfigInfo: function() {
  359. GetAllConfig().then(response => {
  360. if (response.data.state == 0) {
  361. this.$message.error(response.data.msg)
  362. return false
  363. } else {
  364. this.manufacturer = response.data.data.manufacturer
  365. this.dealer = response.data.data.dealer
  366. }
  367. })
  368. }, getManufactuerName: function(manufacturer_id) {
  369. for (let i = 0; i < this.manufacturer.length; i++) {
  370. if (this.manufacturer[i].id == manufacturer_id) {
  371. return this.manufacturer[i].manufacturer_name
  372. }
  373. }
  374. }, getDealerName: function(dealer_id) {
  375. for (let i = 0; i < this.dealer.length; i++) {
  376. if (this.dealer[i].id == dealer_id) {
  377. return this.dealer[i].dealer_name
  378. }
  379. }
  380. }, handleEdit: function(index, row) {
  381. this.$router.push({ name: 'stockInDetail', query: { id: row.id, type: this.type }})
  382. }, handleDelete: function(index, row) {
  383. const ids = []
  384. ids.push(row.id)
  385. const idStr = ids.join(',')
  386. const params = {
  387. ids: idStr
  388. }
  389. this.$confirm('确认删除入库单记录?', '删除入库单记录', {
  390. confirmButtonText: '确定',
  391. cancelButtonText: '取消',
  392. type: 'warning'
  393. }).then(() => {
  394. deleteWarehouseInfo(params).then(response => {
  395. if (response.data.state == 0) {
  396. this.$message.error(response.data.msg)
  397. return false
  398. } else {
  399. this.$notify({
  400. title: '成功',
  401. message: '删除成功',
  402. type: 'success',
  403. duration: 2000
  404. })
  405. for (let i = 0; i < ids.length; i++) {
  406. for (let y = 0; y < this.Warehouse.warehouseDate.length; y++) {
  407. if (ids[i] == this.Warehouse.warehouseDate[y].id) {
  408. this.Warehouse.warehouseDate.splice(y, 1)
  409. }
  410. }
  411. }
  412. }
  413. })
  414. }).catch(() => {
  415. })
  416. }, changeAllSelected: function(val) {
  417. if (val) {
  418. this.$refs.multipleTable.toggleAllSelection()
  419. } else {
  420. this.$refs.multipleTable.clearSelection()
  421. }
  422. }, select(selection) {
  423. this.selectedTableData = selection
  424. }, batchDelete() {
  425. if (this.selectedTableData.length <= 0) {
  426. this.$message.error('请选择要删除的记录')
  427. return
  428. }
  429. const ids = []
  430. for (let i = 0; i < this.selectedTableData.length; i++) {
  431. ids.push(this.selectedTableData[i].id)
  432. }
  433. const idStr = ids.join(',')
  434. const params = {
  435. ids: idStr
  436. }
  437. this.$confirm('确认删除入库单记录?', '删除入库单记录', {
  438. confirmButtonText: '确定',
  439. cancelButtonText: '取消',
  440. type: 'warning'
  441. }).then(() => {
  442. deleteWarehouseInfo(params).then(response => {
  443. if (response.data.state == 0) {
  444. this.$message.error(response.data.msg)
  445. return false
  446. } else {
  447. this.$notify({
  448. title: '成功',
  449. message: '删除成功',
  450. type: 'success',
  451. duration: 2000
  452. })
  453. for (let i = 0; i < ids.length; i++) {
  454. for (let y = 0; y < this.Warehouse.warehouseDate.length; y++) {
  455. if (ids[i] == this.Warehouse.warehouseDate[y].id) {
  456. this.Warehouse.warehouseDate.splice(y, 1)
  457. }
  458. }
  459. }
  460. }
  461. })
  462. }).catch(() => {
  463. })
  464. }
  465. }
  466. }
  467. </script>
  468. <style rel="stylesheet/css" lang="scss" scoped>
  469. .information {
  470. border: 1px #dcdfe6 solid;
  471. padding: 30px 20px 30px 20px;
  472. .border {
  473. border-bottom: 1px #dcdfe6 solid;
  474. margin: 0px 0 20px 0;
  475. }
  476. }
  477. .edit_separater {
  478. border-top: 1px solid rgb(233, 233, 233);
  479. margin-top: 15px;
  480. margin-bottom: 15px;
  481. }
  482. </style>
  483. <style>
  484. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  485. font-size: 12px;
  486. }
  487. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  488. background: #6fb5fa;
  489. }
  490. .count {
  491. color: #bd2c00;
  492. }
  493. </style>