血透系统PC前端

stockInOrder.vue 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  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="">-</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: '/stock/in', name: '入库单' }
  148. ],
  149. type: 1,
  150. page: 1,
  151. limit: 7,
  152. checked: false,
  153. total: 0,
  154. pageTotal: 0,
  155. pageSelect: 0,
  156. adminUserOptions: [],
  157. multipleSelection: [],
  158. signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
  159. start_time: '',
  160. end_time: '',
  161. goodType: [],
  162. goodInfo: [],
  163. manufacturer: [],
  164. selectedTableData: [],
  165. dealer: [],
  166. Warehouse: {
  167. loading: false,
  168. warehouseDate: [],
  169. tableCurrentIndex: ''
  170. },
  171. WarehouseInfo: {
  172. loading: false,
  173. warehouseInfoDate: []
  174. }
  175. }
  176. },
  177. methods: {
  178. GetWarehouse: function() {
  179. const Params = {
  180. page: this.page,
  181. limit: this.limit,
  182. start_time: this.start_time,
  183. end_time: this.end_time,
  184. type: this.type
  185. }
  186. this.Warehouse.warehouseDate = []
  187. getWarehouseList(Params).then(response => {
  188. if (response.data.state == 0) {
  189. this.Warehouse.loading = false
  190. this.$message.error(response.data.msg)
  191. return false
  192. } else {
  193. this.Warehouse.loading = false
  194. this.total = response.data.data.total
  195. for (let i = 0; i < response.data.data.list.length; i++) {
  196. this.Warehouse.warehouseDate.push(response.data.data.list[i])
  197. }
  198. }
  199. })
  200. }, tableRowClassName({ row, rowIndex }) {
  201. // 把每一行的索引放进row
  202. row.index = rowIndex
  203. },
  204. onRowClick(row, event, column) {
  205. this.WarehouseInfo.warehouseInfoDate = []
  206. this.Warehouse.tableCurrentIndex = row.index
  207. const params = {
  208. 'id': row.id
  209. }
  210. this.WarehouseInfo.loading = true
  211. getWarehouseInfoList(params).then(response => {
  212. if (response.data.state == 0) {
  213. this.WarehouseInfo.loading = false
  214. this.$message.error(response.data.msg)
  215. return false
  216. } else {
  217. this.WarehouseInfo.loading = false
  218. for (let i = 0; i < response.data.data.info.length; i++) {
  219. this.WarehouseInfo.warehouseInfoDate.push(response.data.data.info[i])
  220. }
  221. }
  222. })
  223. }, getXuserName(id) {
  224. if (id <= 0) {
  225. return ''
  226. }
  227. var name = ''
  228. if (this.adminUserOptions == null || typeof (this.adminUserOptions.length) === 'undefined') {
  229. return name
  230. }
  231. var leng = this.adminUserOptions.length
  232. if (leng == 0) {
  233. return name
  234. }
  235. for (let index = 0; index < leng; index++) {
  236. if (this.adminUserOptions[index].id == id) {
  237. name = this.adminUserOptions[index].name
  238. break
  239. }
  240. }
  241. return name
  242. }, fetchAllDoctorAndNurse() {
  243. fetchAllDoctorAndNurse().then(response => {
  244. if (response.data.state == 1) {
  245. this.doctorOptions = response.data.data.doctors
  246. }
  247. })
  248. },
  249. fetchAllAdminUsers() {
  250. fetchAllAdminUsers().then(response => {
  251. console.log(response)
  252. if (response.data.state == 1) {
  253. this.adminUserOptions = response.data.data.users
  254. var alen = this.adminUserOptions.length
  255. for (let index = 0; index < alen; index++) {
  256. if (this.adminUserOptions[index].user_type == 2) {
  257. // this.doctorOptions.push(this.adminUserOptions[index]);
  258. }
  259. }
  260. }
  261. })
  262. }, getSpecificationName: function(id) {
  263. let name = ''
  264. for (let i = 0; i < this.goodInfo.length; i++) {
  265. if (this.goodInfo[i].id == id) {
  266. name = this.goodInfo[i].specification_name
  267. }
  268. }
  269. return name
  270. }, getTypeName: function(id) {
  271. let name = ''
  272. for (let i = 0; i < this.goodType.length; i++) {
  273. if (this.goodType[i].id == id) {
  274. name = this.goodType[i].type_name
  275. }
  276. }
  277. return name
  278. }, GetAllGoodType: function() {
  279. GetAllGoodType().then(response => {
  280. if (response.data.state == 0) {
  281. this.$message.error(response.data.msg)
  282. return false
  283. } else {
  284. for (let i = 0; i < response.data.data.goodType.length; i++) {
  285. this.goodType.push(response.data.data.goodType[i])
  286. }
  287. }
  288. })
  289. }, GetAllGoodInfo: function() {
  290. GetAllGoodInfo().then(response => {
  291. if (response.data.state == 0) {
  292. this.$message.error(response.data.msg)
  293. return false
  294. } else {
  295. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  296. this.goodInfo.push(response.data.data.goodInfo[i])
  297. }
  298. }
  299. })
  300. }, clicks: function() {
  301. console.log(this.WarehouseInfo.warehouseInfoDate)
  302. }, handleWarehouse: function() {
  303. this.$router.push({ path: '/stock/in/add', query: { type: this.type }})
  304. }, handleReturnSales: function() {
  305. // this.$router.push({path:'/patients/create'}
  306. if (this.multipleSelection.length <= 0) {
  307. this.$message.error('请选择退货物品')
  308. return
  309. }
  310. const ids = []
  311. for (let i = 0; i < this.multipleSelection.length; i++) {
  312. ids.push(this.multipleSelection[i].id)
  313. }
  314. this.$router.push({ name: 'salesReturn', query: { id: ids.join('&') }})
  315. }, handleReturnSalesRecord: function() {
  316. this.$router.push({ name: 'salesReutrnRecord' })
  317. }, handleWarehouseRecord: function() {
  318. this.$router.push({ name: 'warehouseRecord' })
  319. }, handleSelectionChange: function(val) {
  320. this.multipleSelection = val
  321. }, handleSizeChange(val) {
  322. this.limit = val
  323. this.GetWarehouse()
  324. }, handleCurrentChange(val) {
  325. this.page = val
  326. this.GetWarehouse()
  327. }, startTimeChange(val) {
  328. this.GetWarehouse()
  329. }, endTimeChange(val) {
  330. this.GetWarehouse()
  331. }, calculate: function(val) {
  332. return Math.round(parseFloat(val) * 100) / 100
  333. }, GetConfigInfo: function() {
  334. GetAllConfig().then(response => {
  335. if (response.data.state == 0) {
  336. this.$message.error(response.data.msg)
  337. return false
  338. } else {
  339. this.manufacturer = response.data.data.manufacturer
  340. this.dealer = response.data.data.dealer
  341. }
  342. })
  343. }, getManufactuerName: function(manufacturer_id) {
  344. for (let i = 0; i < this.manufacturer.length; i++) {
  345. if (this.manufacturer[i].id == manufacturer_id) {
  346. return this.manufacturer[i].manufacturer_name
  347. }
  348. }
  349. }, getDealerName: function(dealer_id) {
  350. for (let i = 0; i < this.dealer.length; i++) {
  351. if (this.dealer[i].id == dealer_id) {
  352. return this.dealer[i].dealer_name
  353. }
  354. }
  355. }, handleEdit: function(index, row) {
  356. this.$router.push({ name: 'stockInDetail', query: { id: row.id, type: this.type }})
  357. }, handleDelete: function(index, row) {
  358. const ids = []
  359. ids.push(row.id)
  360. const idStr = ids.join(',')
  361. const params = {
  362. ids: idStr
  363. }
  364. this.$confirm('确认删除入库单记录?', '删除入库单记录', {
  365. confirmButtonText: '确定',
  366. cancelButtonText: '取消',
  367. type: 'warning'
  368. }).then(() => {
  369. deleteWarehouseInfo(params).then(response => {
  370. if (response.data.state == 0) {
  371. this.$message.error(response.data.msg)
  372. return false
  373. } else {
  374. this.$notify({
  375. title: '成功',
  376. message: '删除成功',
  377. type: 'success',
  378. duration: 2000
  379. })
  380. for (let i = 0; i < ids.length; i++) {
  381. for (let y = 0; y < this.Warehouse.warehouseDate.length; y++) {
  382. if (ids[i] == this.Warehouse.warehouseDate[y].id) {
  383. this.Warehouse.warehouseDate.splice(y, 1)
  384. }
  385. }
  386. }
  387. }
  388. })
  389. }).catch(() => {
  390. })
  391. }, changeAllSelected: function(val) {
  392. if (val) {
  393. this.$refs.multipleTable.toggleAllSelection()
  394. } else {
  395. this.$refs.multipleTable.clearSelection()
  396. }
  397. }, select(selection) {
  398. this.selectedTableData = selection
  399. }, batchDelete() {
  400. if (this.selectedTableData.length <= 0) {
  401. this.$message.error('请选择要删除的记录')
  402. return
  403. }
  404. const ids = []
  405. for (let i = 0; i < this.selectedTableData.length; i++) {
  406. ids.push(this.selectedTableData[i].id)
  407. }
  408. const idStr = ids.join(',')
  409. const params = {
  410. ids: idStr
  411. }
  412. this.$confirm('确认删除入库单记录?', '删除入库单记录', {
  413. confirmButtonText: '确定',
  414. cancelButtonText: '取消',
  415. type: 'warning'
  416. }).then(() => {
  417. deleteWarehouseInfo(params).then(response => {
  418. if (response.data.state == 0) {
  419. this.$message.error(response.data.msg)
  420. return false
  421. } else {
  422. this.$notify({
  423. title: '成功',
  424. message: '删除成功',
  425. type: 'success',
  426. duration: 2000
  427. })
  428. for (let i = 0; i < ids.length; i++) {
  429. for (let y = 0; y < this.Warehouse.warehouseDate.length; y++) {
  430. if (ids[i] == this.Warehouse.warehouseDate[y].id) {
  431. this.Warehouse.warehouseDate.splice(y, 1)
  432. }
  433. }
  434. }
  435. }
  436. })
  437. }).catch(() => {
  438. })
  439. }
  440. }
  441. }
  442. </script>
  443. <style rel="stylesheet/css" lang="scss" scoped>
  444. .information {
  445. border: 1px #dcdfe6 solid;
  446. padding: 30px 20px 30px 20px;
  447. .border {
  448. border-bottom: 1px #dcdfe6 solid;
  449. margin: 0px 0 20px 0;
  450. }
  451. }
  452. .edit_separater {
  453. border-top: 1px solid rgb(233, 233, 233);
  454. margin-top: 15px;
  455. margin-bottom: 15px;
  456. }
  457. </style>
  458. <style>
  459. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  460. font-size: 12px;
  461. }
  462. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  463. background: #6fb5fa;
  464. }
  465. .count {
  466. color: #bd2c00;
  467. }
  468. </style>