血透系统PC前端

stockOutDetail.vue 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. <template>
  2. <div>
  3. <div class="cell clearfix" >
  4. <el-input size="small" style="width: 400px;" class="filter-item" v-model="searchKey" placeholder="单据编码/制单人/规格名称"/>
  5. <el-button size="small" class="filter-item" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
  6. </div>
  7. <div class="cell clearfix">
  8. <label class="title"><span class="name">日期查询</span> : </label>
  9. <el-date-picker size="small" v-model="start_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
  10. type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
  11. value-format="yyyy-MM-dd" @change="startTimeChange"></el-date-picker>
  12. <span class="cellLine"> - </span>
  13. <el-date-picker size="small" v-model="end_time" prefix-icon="el-icon-date" :editable="false" style="width: 196px;"
  14. type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
  15. value-format="yyyy-MM-dd" @change="endTimeChange"></el-date-picker>
  16. </div>
  17. <div class="cell clearfix">
  18. <label class="title"><span class="name">单据类型</span> : </label>
  19. <el-select size="small" v-model="order_type" clearable placeholder="单据类型" @change="changeType">
  20. <el-option
  21. v-for="item in orderTypeArr"
  22. :key="item.value"
  23. :label="item.label"
  24. :value="item.value">
  25. </el-option>
  26. </el-select>
  27. </div>
  28. <div class="cell clearfix">
  29. <label class="title"><span class="name">其它</span> : </label>
  30. <el-select size="small" v-model="manufacturer_id" clearable placeholder="厂商" @change="changeManufacturer">
  31. <el-option
  32. v-for="item in manufacturer"
  33. :key="item.id"
  34. :label="item.manufacturer_name"
  35. :value="item.id">
  36. </el-option>
  37. </el-select>
  38. </div>
  39. <el-row :gutter="12" style="margin-top: 10px">
  40. <el-table
  41. :data="cancelStockDate"
  42. :class="signAndWeighBoxPatients"
  43. border
  44. highlight-current-row
  45. ref="multipleTable"
  46. @selection-change="select"
  47. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  48. >
  49. <el-table-column label="单据编号" align="center" width="200">
  50. <template slot-scope="scope">
  51. {{scope.row.warehouse_out_order_number}}
  52. </template>
  53. </el-table-column>
  54. <el-table-column label="商品类型" align="center">
  55. <template slot-scope="scope">
  56. {{typeName(scope.row.good_type_id)}}
  57. </template>
  58. </el-table-column>
  59. <el-table-column label="规格名称" align="center">
  60. <template slot-scope="scope">
  61. {{specificationName(scope.row.good_id)}}
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="单据类型" align="center">
  65. <template slot-scope="scope">
  66. {{getTypeName(scope.row)}}
  67. </template>
  68. </el-table-column>
  69. <el-table-column label="操作时间" align="center">
  70. <template slot-scope="scope">
  71. {{ scope.row.WarehouseOut.warehouse_out_time | parseTime('{y}-{m}-{d}')}}
  72. </template>
  73. </el-table-column>
  74. <el-table-column label="制单人" align="center">
  75. <template slot-scope="scope">
  76. {{getXuserName(scope.row.WarehouseOut.creater)}}
  77. </template>
  78. </el-table-column>
  79. <el-table-column label="单价" align="center">
  80. <template slot-scope="scope">
  81. {{scope.row.price}}
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="数量" align="center">
  85. <template slot-scope="scope">
  86. {{scope.row.count}}
  87. </template>
  88. </el-table-column>
  89. <el-table-column label="总价" align="center">
  90. <template slot-scope="scope">
  91. {{getTotal(scope.row.price,scope.row.count)}}
  92. </template>
  93. </el-table-column>
  94. </el-table>
  95. <el-pagination
  96. @size-change="handleSizeChange"
  97. @current-change="handleCurrentChange"
  98. :page-sizes="[7]"
  99. :page-size="7"
  100. background
  101. style="margin-top:20px;float: right"
  102. layout="total, sizes, prev, pager, next, jumper"
  103. :total="total">
  104. </el-pagination>
  105. </el-row>
  106. </div>
  107. </template>
  108. <script>
  109. import { uParseTime } from '@/utils/tools'
  110. import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from '@/api/doctor'
  111. import { deleteCancelStock, GetAllConfig, getStockDetail } from '@/api/stock'
  112. export default {
  113. name: 'stockOutDetail',
  114. created() {
  115. var nowDate = new Date()
  116. var nowYear = nowDate.getFullYear()
  117. var nowMonth = nowDate.getMonth() + 1
  118. var nowDay = nowDate.getDate()
  119. this.end_time =
  120. nowYear +
  121. '-' +
  122. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  123. '-' +
  124. (nowDay < 10 ? '0' + nowDay : nowDay)
  125. nowDate.setMonth(nowDate.getMonth() - 1)
  126. nowYear = nowDate.getFullYear()
  127. nowMonth = nowDate.getMonth() + 1
  128. nowDay = nowDate.getDate()
  129. this.start_time =
  130. nowYear +
  131. '-' +
  132. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  133. '-' +
  134. (nowDay < 10 ? '0' + nowDay : nowDay)
  135. this.GetCancelStock()
  136. this.GetConfigInfo()
  137. this.fetchAllAdminUsers()
  138. },
  139. data() {
  140. return {
  141. orderTypeArr: [
  142. { value: 1, label: '耗材入库单' },
  143. { value: 2, label: '其他入库单' }
  144. ],
  145. manufacturer_id: '',
  146. dealer_id: '',
  147. order_type: '',
  148. searchKey: '',
  149. type: 2,
  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. cancelStockDate: [],
  161. end_time: '',
  162. goodType: [],
  163. goodInfo: [],
  164. manufacturer: [],
  165. selectedTableData: [],
  166. dealer: []
  167. }
  168. },
  169. methods: {
  170. changeType: function(val) {
  171. this.order_type = val
  172. this.GetCancelStock()
  173. }, changeManufacturer: function(val) {
  174. this.manufacturer_id = val
  175. this.GetCancelStock()
  176. },
  177. getTypeName: function(row) {
  178. let name = ''
  179. const name2 = ''
  180. if (row.type == 1) {
  181. name = '耗材出库单'
  182. } else if (row.type == 2) {
  183. name = '其他出库单'
  184. }
  185. return name
  186. },
  187. specificationName: function(good_info_id) {
  188. let name = ''
  189. for (let i = 0; i < this.goodInfo.length; i++) {
  190. if (this.goodInfo[i].id == good_info_id) {
  191. name = this.goodInfo[i].specification_name
  192. }
  193. }
  194. return name
  195. },
  196. typeName: function(good_type_id) {
  197. let name = ''
  198. for (let i = 0; i < this.goodType.length; i++) {
  199. if (this.goodType[i].id == good_type_id) {
  200. name = this.goodType[i].type_name
  201. }
  202. }
  203. return name
  204. },
  205. search: function() {
  206. const Params = {
  207. page: this.page,
  208. limit: this.limit,
  209. start_time: this.start_time,
  210. end_time: this.end_time,
  211. type: this.type,
  212. keywords: this.searchKey
  213. }
  214. this.cancelStockDate = []
  215. getStockDetail(Params).then(response => {
  216. if (response.data.state == 0) {
  217. this.$message.error(response.data.msg)
  218. return false
  219. } else {
  220. this.total = response.data.data.total
  221. for (let i = 0; i < response.data.data.list.length; i++) {
  222. this.cancelStockDate.push(response.data.data.list[i])
  223. }
  224. }
  225. })
  226. },
  227. AddNewOrder: function() {
  228. this.$router.push({ name: 'cancelStockOrderAdd', query: { type: this.type }})
  229. },
  230. GetCancelStock: function() {
  231. const Params = {
  232. page: this.page,
  233. limit: this.limit,
  234. start_time: this.start_time,
  235. end_time: this.end_time,
  236. type: this.type,
  237. manufacturer: this.manufacturer_id,
  238. order_type: this.order_type,
  239. dealer: this.dealer_id
  240. }
  241. this.cancelStockDate = []
  242. getStockDetail(Params).then(response => {
  243. if (response.data.state == 0) {
  244. this.$message.error(response.data.msg)
  245. return false
  246. } else {
  247. this.total = response.data.data.total
  248. for (let i = 0; i < response.data.data.list.length; i++) {
  249. this.cancelStockDate.push(response.data.data.list[i])
  250. }
  251. }
  252. })
  253. }, getXuserName(id) {
  254. if (id <= 0) {
  255. return ''
  256. }
  257. var name = ''
  258. if (this.adminUserOptions == null || typeof (this.adminUserOptions.length) === 'undefined') {
  259. return name
  260. }
  261. var leng = this.adminUserOptions.length
  262. if (leng == 0) {
  263. return name
  264. }
  265. for (let index = 0; index < leng; index++) {
  266. if (this.adminUserOptions[index].id == id) {
  267. name = this.adminUserOptions[index].name
  268. break
  269. }
  270. }
  271. return name
  272. }, fetchAllAdminUsers() {
  273. fetchAllAdminUsers().then(response => {
  274. console.log(response)
  275. if (response.data.state == 1) {
  276. this.adminUserOptions = response.data.data.users
  277. var alen = this.adminUserOptions.length
  278. for (let index = 0; index < alen; index++) {
  279. if (this.adminUserOptions[index].user_type == 2) {
  280. // this.doctorOptions.push(this.adminUserOptions[index]);
  281. }
  282. }
  283. }
  284. })
  285. }, handleSelectionChange: function(val) {
  286. this.multipleSelection = val
  287. }, handleSizeChange(val) {
  288. this.limit = val
  289. this.GetCancelStock()
  290. }, handleCurrentChange(val) {
  291. this.page = val
  292. this.GetCancelStock()
  293. }, startTimeChange(val) {
  294. this.GetCancelStock()
  295. }, endTimeChange(val) {
  296. this.GetCancelStock()
  297. }, calculate: function(val) {
  298. return Math.round(parseFloat(val) * 100) / 100
  299. }, GetConfigInfo: function() {
  300. GetAllConfig().then(response => {
  301. if (response.data.state == 0) {
  302. this.$message.error(response.data.msg)
  303. return false
  304. } else {
  305. this.manufacturer = response.data.data.manufacturer
  306. this.dealer = response.data.data.dealer
  307. this.goodInfo = response.data.data.goodInfo
  308. this.goodType = response.data.data.goodType
  309. }
  310. })
  311. }, getManufactuerName: function(manufacturer_id) {
  312. for (let i = 0; i < this.manufacturer.length; i++) {
  313. if (this.manufacturer[i].id == manufacturer_id) {
  314. return this.manufacturer[i].manufacturer_name
  315. }
  316. }
  317. }, getDealerName: function(dealer_id) {
  318. for (let i = 0; i < this.dealer.length; i++) {
  319. if (this.dealer[i].id == dealer_id) {
  320. return this.dealer[i].dealer_name
  321. }
  322. }
  323. }, handleEdit: function(index, row) {
  324. this.$router.push({ name: 'cancelStockDetail', query: { id: row.id, type: this.type }})
  325. }, handleDelete: function(index, row) {
  326. const ids = []
  327. ids.push(row.id)
  328. const idStr = ids.join(',')
  329. const params = {
  330. ids: idStr
  331. }
  332. this.$confirm('确认删除出库退库单记录?', '删除出库退库单记录', {
  333. confirmButtonText: '确定',
  334. cancelButtonText: '取消',
  335. type: 'warning'
  336. }).then(() => {
  337. deleteCancelStock(params).then(response => {
  338. if (response.data.state == 0) {
  339. this.$message.error(response.data.msg)
  340. return false
  341. } else {
  342. this.$notify({
  343. title: '成功',
  344. message: '删除成功',
  345. type: 'success',
  346. duration: 2000
  347. })
  348. for (let i = 0; i < ids.length; i++) {
  349. for (let y = 0; y < this.cancelStockDate.length; y++) {
  350. if (ids[i] == this.cancelStockDate[y].id) {
  351. this.cancelStockDate.splice(y, 1)
  352. }
  353. }
  354. }
  355. }
  356. })
  357. }).catch(() => {
  358. })
  359. }, changeAllSelected: function(val) {
  360. if (val) {
  361. this.$refs.multipleTable.toggleAllSelection()
  362. } else {
  363. this.$refs.multipleTable.clearSelection()
  364. }
  365. }, select(selection) {
  366. this.selectedTableData = selection
  367. }, batchDelete() {
  368. if (this.selectedTableData.length <= 0) {
  369. this.$message.error('请选择要删除的记录')
  370. return
  371. }
  372. const ids = []
  373. for (let i = 0; i < this.selectedTableData.length; i++) {
  374. ids.push(this.selectedTableData[i].id)
  375. }
  376. const idStr = ids.join(',')
  377. const params = {
  378. ids: idStr
  379. }
  380. this.$confirm('确认删除出库退库单记录?', '删除出库退库单记录', {
  381. confirmButtonText: '确定',
  382. cancelButtonText: '取消',
  383. type: 'warning'
  384. }).then(() => {
  385. deleteCancelStock(params).then(response => {
  386. if (response.data.state == 0) {
  387. this.$message.error(response.data.msg)
  388. return false
  389. } else {
  390. this.$notify({
  391. title: '成功',
  392. message: '删除成功',
  393. type: 'success',
  394. duration: 2000
  395. })
  396. for (let i = 0; i < ids.length; i++) {
  397. for (let y = 0; y < this.cancelStockDate.length; y++) {
  398. if (ids[i] == this.cancelStockDate[y].id) {
  399. this.cancelStockDate.splice(y, 1)
  400. }
  401. }
  402. }
  403. }
  404. })
  405. }).catch(() => {
  406. })
  407. },
  408. getTotal:function(price, total) {
  409. var m = 0,r1,r2;
  410. var s1 = price.toString();
  411. var s2 = total.toString();
  412. try{
  413. m += s1.split('.')[1].length
  414. }catch(e){
  415. }
  416. try{}catch(e){
  417. m += s2.split('.')[1].length
  418. }
  419. r1 = Number(price.toString().replace(".",""));
  420. r2 = Number(total.toString().replace(".",""));
  421. return r1 * r2 / Math.pow(10,m);
  422. }
  423. }
  424. }
  425. </script>
  426. <style rel="stylesheet/css" lang="scss" scoped>
  427. .information {
  428. border: 1px #dcdfe6 solid;
  429. padding: 30px 20px 30px 20px;
  430. .border {
  431. border-bottom: 1px #dcdfe6 solid;
  432. margin: 0px 0 20px 0;
  433. }
  434. }
  435. .edit_separater {
  436. border-top: 1px solid rgb(233, 233, 233);
  437. margin-top: 15px;
  438. margin-bottom: 15px;
  439. }
  440. </style>
  441. <style>
  442. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  443. font-size: 12px;
  444. }
  445. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  446. background: #6fb5fa;
  447. }
  448. .count {
  449. color: #bd2c00;
  450. }
  451. </style>