血透系统PC前端

otherStockInOrder.vue 15KB

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