血透系统PC前端

stockInOrder.vue 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  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="handleWarehouse" 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="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. >
  36. <el-table-column
  37. type="selection"
  38. width="55">
  39. </el-table-column>
  40. <el-table-column label="单据日期" align="center">
  41. <template slot-scope="scope">
  42. {{ scope.row.warehousing_time | parseTime('{y}-{m}-{d}')}}
  43. </template>
  44. </el-table-column>
  45. <el-table-column label="单据编号" align="center">
  46. <template slot-scope="scope">
  47. {{scope.row.warehousing_order}}
  48. </template>
  49. </el-table-column>
  50. <el-table-column label="制单人" align="center">
  51. <template slot-scope="scope">
  52. {{getXuserName(scope.row.creater)}}
  53. </template>
  54. </el-table-column>
  55. <el-table-column label="厂家" align="center">
  56. <template slot-scope="scope">
  57. {{getManufactuerName(scope.row.manufacturer)}}
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="经销商" align="center">
  61. <template slot-scope="scope">
  62. {{getDealerName(scope.row.dealer)}}
  63. </template>
  64. </el-table-column>
  65. <el-table-column label="操作" align="center">
  66. <template slot-scope="scope">
  67. <el-tooltip class="item" effect="dark" content="编辑" placement="top">
  68. <el-button
  69. size="small"
  70. type="primary"
  71. icon="el-icon-edit-outline"
  72. @click="handleEdit(scope.$index, scope.row)">
  73. </el-button>
  74. </el-tooltip>
  75. <el-tooltip class="item" effect="dark" content="删除" placement="top">
  76. <el-button
  77. size="small"
  78. type="danger"
  79. icon="el-icon-delete"
  80. @click="handleDelete(scope.$index, scope.row)">
  81. </el-button>
  82. </el-tooltip>
  83. </template>
  84. </el-table-column>
  85. </el-table>
  86. <el-pagination
  87. @size-change="handleSizeChange"
  88. @current-change="handleCurrentChange"
  89. :page-sizes="[7]"
  90. :page-size="7"
  91. background
  92. style="margin-top:20px;float: right"
  93. layout="total, sizes, prev, pager, next, jumper"
  94. :total="total">
  95. </el-pagination>
  96. </el-row>
  97. </div>
  98. </template>
  99. <script>
  100. import { uParseTime } from '@/utils/tools'
  101. import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from '@/api/doctor'
  102. import {
  103. deleteWarehouseInfo,
  104. GetAllConfig,
  105. GetAllGoodInfo,
  106. GetAllGoodType,
  107. getWarehouseInfoList,
  108. getWarehouseList
  109. } from '@/api/stock'
  110. export default {
  111. name: 'stockIn',
  112. created() {
  113. var year = new Date().getFullYear()
  114. var month = new Date().getMonth() + 1
  115. var day = new Date().getDate()
  116. if (parseInt(month) < 10) {
  117. month = '0' + month
  118. }
  119. if (parseInt(day) < 10) {
  120. day = '0' + day
  121. }
  122. const endTime = year + '-' + month + '-' + day
  123. this.end_time = endTime
  124. var year = new Date().getFullYear()
  125. var month = new Date().getMonth()
  126. var day = new Date().getDate()
  127. if (parseInt(month) < 10) {
  128. month = '0' + month
  129. }
  130. if (parseInt(day) < 10) {
  131. day = '0' + day
  132. }
  133. const startTime = year + '-' + month + '-' + day
  134. this.start_time = startTime
  135. this.GetWarehouse()
  136. this.GetConfigInfo()
  137. this.fetchAllAdminUsers()
  138. },
  139. data() {
  140. return {
  141. page: 1,
  142. limit: 7,
  143. checked: false,
  144. total: 0,
  145. pageTotal: 0,
  146. pageSelect: 0,
  147. adminUserOptions: [],
  148. multipleSelection: [],
  149. signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
  150. start_time: '',
  151. end_time: '',
  152. goodType: [],
  153. goodInfo: [],
  154. manufacturer: [],
  155. selectedTableData: [],
  156. dealer: [],
  157. Warehouse: {
  158. loading: false,
  159. warehouseDate: [],
  160. tableCurrentIndex: ''
  161. },
  162. WarehouseInfo: {
  163. loading: false,
  164. warehouseInfoDate: []
  165. }
  166. }
  167. },
  168. methods: {
  169. GetWarehouse: function() {
  170. const Params = {
  171. page: this.page,
  172. limit: this.limit,
  173. start_time: this.start_time,
  174. end_time: this.end_time,
  175. type : 1,
  176. }
  177. this.Warehouse.warehouseDate = []
  178. getWarehouseList(Params).then(response => {
  179. if (response.data.state == 0) {
  180. this.Warehouse.loading = false
  181. this.$message.error(response.data.msg)
  182. return false
  183. } else {
  184. this.Warehouse.loading = false
  185. this.total = response.data.data.total
  186. for (let i = 0; i < response.data.data.list.length; i++) {
  187. this.Warehouse.warehouseDate.push(response.data.data.list[i])
  188. }
  189. }
  190. })
  191. }, tableRowClassName({ row, rowIndex }) {
  192. // 把每一行的索引放进row
  193. row.index = rowIndex
  194. },
  195. onRowClick(row, event, column) {
  196. this.WarehouseInfo.warehouseInfoDate = []
  197. this.Warehouse.tableCurrentIndex = row.index
  198. const params = {
  199. 'id': row.id
  200. }
  201. this.WarehouseInfo.loading = true
  202. getWarehouseInfoList(params).then(response => {
  203. if (response.data.state == 0) {
  204. this.WarehouseInfo.loading = false
  205. this.$message.error(response.data.msg)
  206. return false
  207. } else {
  208. this.WarehouseInfo.loading = false
  209. for (let i = 0; i < response.data.data.info.length; i++) {
  210. this.WarehouseInfo.warehouseInfoDate.push(response.data.data.info[i])
  211. }
  212. }
  213. })
  214. }, getXuserName(id) {
  215. if (id <= 0) {
  216. return ''
  217. }
  218. var name = ''
  219. if (this.adminUserOptions == null || typeof (this.adminUserOptions.length) === 'undefined') {
  220. return name
  221. }
  222. var leng = this.adminUserOptions.length
  223. if (leng == 0) {
  224. return name
  225. }
  226. for (let index = 0; index < leng; index++) {
  227. if (this.adminUserOptions[index].id == id) {
  228. name = this.adminUserOptions[index].name
  229. break
  230. }
  231. }
  232. return name
  233. }, fetchAllDoctorAndNurse() {
  234. fetchAllDoctorAndNurse().then(response => {
  235. if (response.data.state == 1) {
  236. this.doctorOptions = response.data.data.doctors
  237. }
  238. })
  239. },
  240. fetchAllAdminUsers() {
  241. fetchAllAdminUsers().then(response => {
  242. console.log(response)
  243. if (response.data.state == 1) {
  244. this.adminUserOptions = response.data.data.users
  245. var alen = this.adminUserOptions.length
  246. for (let index = 0; index < alen; index++) {
  247. if (this.adminUserOptions[index].user_type == 2) {
  248. // this.doctorOptions.push(this.adminUserOptions[index]);
  249. }
  250. }
  251. }
  252. })
  253. }, getSpecificationName: function(id) {
  254. let name = ''
  255. for (let i = 0; i < this.goodInfo.length; i++) {
  256. if (this.goodInfo[i].id == id) {
  257. name = this.goodInfo[i].specification_name
  258. }
  259. }
  260. return name
  261. }, getTypeName: function(id) {
  262. let name = ''
  263. for (let i = 0; i < this.goodType.length; i++) {
  264. if (this.goodType[i].id == id) {
  265. name = this.goodType[i].type_name
  266. }
  267. }
  268. return name
  269. }, GetAllGoodType: function() {
  270. GetAllGoodType().then(response => {
  271. if (response.data.state == 0) {
  272. this.$message.error(response.data.msg)
  273. return false
  274. } else {
  275. for (let i = 0; i < response.data.data.goodType.length; i++) {
  276. this.goodType.push(response.data.data.goodType[i])
  277. }
  278. }
  279. })
  280. }, GetAllGoodInfo: function() {
  281. GetAllGoodInfo().then(response => {
  282. if (response.data.state == 0) {
  283. this.$message.error(response.data.msg)
  284. return false
  285. } else {
  286. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  287. this.goodInfo.push(response.data.data.goodInfo[i])
  288. }
  289. }
  290. })
  291. }, clicks: function() {
  292. console.log(this.WarehouseInfo.warehouseInfoDate)
  293. }, handleWarehouse: function() {
  294. this.$router.push({ path: '/stock/in/add' })
  295. }, handleReturnSales: function() {
  296. // this.$router.push({path:'/patients/create'}
  297. if (this.multipleSelection.length <= 0) {
  298. this.$message.error('请选择退货物品')
  299. return
  300. }
  301. const ids = []
  302. for (let i = 0; i < this.multipleSelection.length; i++) {
  303. ids.push(this.multipleSelection[i].id)
  304. }
  305. this.$router.push({ name: 'salesReturn', query: { id: ids.join('&') }})
  306. }, handleReturnSalesRecord: function() {
  307. this.$router.push({ name: 'salesReutrnRecord' })
  308. }, handleWarehouseRecord: function() {
  309. this.$router.push({ name: 'warehouseRecord' })
  310. }, handleSelectionChange: function(val) {
  311. this.multipleSelection = val
  312. }, handleSizeChange(val) {
  313. this.limit = val
  314. this.GetWarehouse()
  315. }, handleCurrentChange(val) {
  316. this.page = val
  317. this.GetWarehouse()
  318. }, startTimeChange(val) {
  319. this.GetWarehouse()
  320. }, endTimeChange(val) {
  321. this.GetWarehouse()
  322. }, calculate: function(val) {
  323. return Math.round(parseFloat(val) * 100) / 100
  324. }, GetConfigInfo: function() {
  325. GetAllConfig().then(response => {
  326. if (response.data.state == 0) {
  327. this.$message.error(response.data.msg)
  328. return false
  329. } else {
  330. this.manufacturer = response.data.data.manufacturer
  331. this.dealer = response.data.data.dealer
  332. }
  333. })
  334. }, getManufactuerName: function(manufacturer_id) {
  335. for (let i = 0; i < this.manufacturer.length; i++) {
  336. if (this.manufacturer[i].id == manufacturer_id) {
  337. return this.manufacturer[i].manufacturer_name
  338. }
  339. }
  340. }, getDealerName: function(dealer_id) {
  341. for (let i = 0; i < this.dealer.length; i++) {
  342. if (this.dealer[i].id == dealer_id) {
  343. return this.dealer[i].dealer_name
  344. }
  345. }
  346. }, handleEdit: function(index, row) {
  347. this.$router.push({ name: 'stockInDetail', query: { id: row.id }})
  348. }, handleDelete: function(index, row) {
  349. const ids = []
  350. ids.push(row.id)
  351. const idStr = ids.join(',')
  352. const params = {
  353. ids: idStr
  354. }
  355. this.$confirm('确认删除入库单记录?', '删除入库单记录', {
  356. confirmButtonText: '确定',
  357. cancelButtonText: '取消',
  358. type: 'warning'
  359. }).then(() => {
  360. deleteWarehouseInfo(params).then(response => {
  361. if (response.data.state == 0) {
  362. this.$message.error(response.data.msg)
  363. return false
  364. } else {
  365. this.$notify({
  366. title: '成功',
  367. message: '删除成功',
  368. type: 'success',
  369. duration: 2000
  370. })
  371. for (let i = 0; i < ids.length; i++) {
  372. for (let y = 0; y < this.Warehouse.warehouseDate.length; y++) {
  373. if (ids[i] == this.Warehouse.warehouseDate[y].id) {
  374. this.Warehouse.warehouseDate.splice(y, 1)
  375. }
  376. }
  377. }
  378. }
  379. })
  380. }).catch(() => {
  381. })
  382. }, changeAllSelected: function(val) {
  383. if (val) {
  384. this.$refs.multipleTable.toggleAllSelection()
  385. } else {
  386. this.$refs.multipleTable.clearSelection()
  387. }
  388. }, select(selection) {
  389. this.selectedTableData = selection
  390. }, batchDelete() {
  391. if (this.selectedTableData.length <= 0) {
  392. this.$message.error('请选择要删除的记录')
  393. return
  394. }
  395. const ids = []
  396. for (let i = 0; i < this.selectedTableData.length; i++) {
  397. ids.push(this.selectedTableData[i].id)
  398. }
  399. const idStr = ids.join(',')
  400. const params = {
  401. ids: idStr
  402. }
  403. this.$confirm('确认删除入库单记录?', '删除入库单记录', {
  404. confirmButtonText: '确定',
  405. cancelButtonText: '取消',
  406. type: 'warning'
  407. }).then(() => {
  408. deleteWarehouseInfo(params).then(response => {
  409. if (response.data.state == 0) {
  410. this.$message.error(response.data.msg)
  411. return false
  412. } else {
  413. this.$notify({
  414. title: '成功',
  415. message: '删除成功',
  416. type: 'success',
  417. duration: 2000
  418. })
  419. for (let i = 0; i < ids.length; i++) {
  420. for (let y = 0; y < this.Warehouse.warehouseDate.length; y++) {
  421. if (ids[i] == this.Warehouse.warehouseDate[y].id) {
  422. this.Warehouse.warehouseDate.splice(y, 1)
  423. }
  424. }
  425. }
  426. }
  427. })
  428. }).catch(() => {
  429. })
  430. }
  431. }
  432. }
  433. </script>
  434. <style rel="stylesheet/css" lang="scss" scoped>
  435. .information {
  436. border: 1px #dcdfe6 solid;
  437. padding: 30px 20px 30px 20px;
  438. .border {
  439. border-bottom: 1px #dcdfe6 solid;
  440. margin: 0px 0 20px 0;
  441. }
  442. }
  443. .title {
  444. background: #409eff;
  445. height: 44px;
  446. line-height: 44px;
  447. padding: 0 0 0 10px;
  448. color: #fff;
  449. margin: 0 0 10px 0;
  450. }
  451. .edit_separater {
  452. border-top: 1px solid rgb(233, 233, 233);
  453. margin-top: 15px;
  454. margin-bottom: 15px;
  455. }
  456. </style>
  457. <style>
  458. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  459. font-size: 12px;
  460. }
  461. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  462. background: #6fb5fa;
  463. }
  464. .count {
  465. color: #bd2c00;
  466. }
  467. </style>