details.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <view class="query-wrap">
  3. <uni-easyinput prefixIcon="search" :value="value" placeholder="请输入采购单号" @iconClick="iconClick" @input="input">
  4. </uni-easyinput>
  5. <view class="empty-cont" v-if="oubondDelData.length=='0'">
  6. 暂无明细数据
  7. </view>
  8. <view class="inner-item" v-for="(item,idex) in oubondDelData" :key="idex" @click.stop="itemDetails(item,idex)">
  9. <view class="text-title" v-if="idex=='0'">
  10. <view class="title-circ">
  11. </view>
  12. <span>药品清单</span>
  13. </view>
  14. <view class="check-title" @tap.stop.prevent>
  15. <checkbox-group @change="checkChange" :data-id="item.id">
  16. <label>
  17. <checkbox :value="idex" />
  18. </label>
  19. </checkbox-group>
  20. </view>
  21. <view class="inventory-item">
  22. <view class="shuo-item-name">
  23. <view class="shuo-label-podnme">
  24. 采购单号:
  25. </view>
  26. <view class="shuo-unit">
  27. {{item.purcOrdId}}
  28. </view>
  29. </view>
  30. </view>
  31. <view class="inventory-item">
  32. <view class="shuo-item">
  33. <view class="shuo-label">
  34. 药品编码:
  35. </view>
  36. <view class="shuo-unit">
  37. {{item.drugListId}}
  38. </view>
  39. </view>
  40. </view>
  41. <view class="inventory-item" style="margin-top: 40rpx;">
  42. <view class="shuo-item-name">
  43. <view class="shuo-label-podnme">
  44. 药品名称:
  45. </view>
  46. <view class="shuo-unit">
  47. <span>{{ item.drugName }}</span>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="inventory-item">
  52. <view class="shuo-item">
  53. <view class="shuo-label">
  54. 采购数量:
  55. </view>
  56. <view class="shuo-cont">
  57. {{ item.purcCnt||"" }}
  58. </view>
  59. </view>
  60. <view class="shuo-item">
  61. <view class="shuo-label">
  62. 采购金额:
  63. </view>
  64. <view class="shuo-cont">
  65. {{ item.purcAmt||"" }}
  66. </view>
  67. </view>
  68. </view>
  69. <view class="inventory-item">
  70. <view class="shuo-item-name">
  71. <view class="shuo-label">
  72. 药品规格:
  73. </view>
  74. <view class="shuo-cont">
  75. {{
  76. "" +
  77. item.specName +
  78. "*" +
  79. item.convrat +
  80. item.pac +
  81. "/" +
  82. item.pacUnt +
  83. "】"
  84. }}
  85. </view>
  86. </view>
  87. </view>
  88. <view class="inventory-item">
  89. <view class="shuo-item">
  90. <view class="shuo-label">
  91. 药品剂型:
  92. </view>
  93. <view class="shuo-cont">
  94. {{item.dosformName}}
  95. </view>
  96. </view>
  97. <view class="shuo-item">
  98. <view class="shuo-label">
  99. 待出库数量:
  100. </view>
  101. <view class="shuo-cont">
  102. {{item.toDelvCnt}}
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. <uni-popup ref="popup">
  108. <uni-popup-dialog type="warn" :before-close="true" cancelText="取消" confirmText="确定" content="你确定当前操作吗?"
  109. @confirm="dialogConfirm" @close="dialogClose"></uni-popup-dialog>
  110. </uni-popup>
  111. <view class="botm-btn">
  112. <button type="default" plain="true" style="width:240rpx;line-height: 70rpx;background: #01A992;color:#fff"
  113. @click.stop="accessData()">确认</button>
  114. </view>
  115. </view>
  116. </template>
  117. <script>
  118. import {
  119. mapState,
  120. mapMutations,
  121. mapActions
  122. } from 'vuex';
  123. import moment from "moment";
  124. import {
  125. debounce
  126. } from 'lodash';
  127. export default {
  128. data() {
  129. return {
  130. listData: [],
  131. value: "",
  132. acceptDetaData: {},
  133. subMitData: {},
  134. selcectData: {} //详情选中的数据
  135. }
  136. },
  137. computed: {
  138. ...mapState(['oubondDelData', 'instData', 'batchData', 'userData'])
  139. },
  140. onShow() {},
  141. mounted() {},
  142. methods: {
  143. ...mapActions(['getoutBondDelData']),
  144. ...mapMutations(['setBatchData', 'setOubondDelData']),
  145. input: debounce(function(e) {
  146. this.getoutBondDelData({
  147. orgId: this.instData.orgId,
  148. purcOrdId: e
  149. })
  150. }, 500),
  151. forMatTime(row) {
  152. return moment(row).format("YYYY-MM-DD HH:mm");
  153. },
  154. checkChange(e) {
  155. let newSelect = {
  156. ...this.selcectData
  157. };
  158. let chekData = e.detail.value;
  159. if (chekData.length > 0) {
  160. this.selcectData = {
  161. ...this.selcectData,
  162. [e.target.dataset.id]: this.oubondDelData[chekData[0]]
  163. }
  164. } else {
  165. delete newSelect[e.target.dataset.id]
  166. this.selcectData = newSelect;
  167. }
  168. },
  169. //耗材添加批次跳转
  170. itemDetails(item, index) {
  171. if (!this.selcectData[item.id]) {
  172. uni.showToast({
  173. title: '请选中再添加批次',
  174. icon: 'none',
  175. duration: 1000,
  176. });
  177. return;
  178. }
  179. uni.setStorage({
  180. key: 'batchDelsData',
  181. data: item
  182. });
  183. uni.navigateTo({
  184. url: '/subpkg/pages/outbond-detal/durg-batch',
  185. success: function(res) {
  186. console.log(res, "res")
  187. }
  188. });
  189. },
  190. //确认/退回
  191. accessData() {
  192. if (JSON.stringify(this.selcectData) === "{}") {
  193. uni.showToast({
  194. title: '请选择出库药品',
  195. icon: 'none',
  196. duration: 1000,
  197. });
  198. return;
  199. };;
  200. let selectKey = Object.keys(this.selcectData);
  201. let filterEmpty = selectKey.filter((item) => {
  202. return this.batchData[item] == null || this.batchData[item].length == 0
  203. })
  204. if (filterEmpty.length > 0) {
  205. uni.showToast({
  206. title: '请为选中的药品添加批次',
  207. icon: 'none',
  208. duration: 1000,
  209. });
  210. return;
  211. };
  212. let newSubData = [];
  213. selectKey.forEach((item) => {
  214. newSubData.push(this.batchData[item])
  215. })
  216. const merged = newSubData.reduce((acc, current) => [...acc, ...current], []);
  217. this.$http('outbondDetal.submitData', {
  218. spdId: this.instData.spdId,
  219. confirm: "1",
  220. detlList: merged
  221. }, '加载中').then(res => {
  222. if (res.success == true) {
  223. this.setBatchData({});
  224. this.setOubondDelData([]);
  225. this.value = "";
  226. }
  227. }).catch(e => {
  228. })
  229. },
  230. //属性值进行比较
  231. //日期格式化
  232. forMatTime(time) {
  233. return moment(time).format("YYYY-MM-DD");
  234. },
  235. //加时分秒
  236. forMatTimehs(time) {
  237. return moment(time).format("YYYY-MM-DD HH:mm");
  238. },
  239. },
  240. watch: {
  241. }
  242. }
  243. </script>
  244. <style lang="scss" scoped>
  245. .query-wrap {
  246. width: 100%;
  247. height: 100%;
  248. padding: 20rpx;
  249. box-sizing: border-box;
  250. background-color: #F1F1F1;
  251. overflow-y: scroll;
  252. overflow-x: hidden;
  253. position: relative;
  254. padding-bottom: 200rpx;
  255. .botm-btn {
  256. width: 100%;
  257. height: 120rpx;
  258. background-color: #fff;
  259. position: fixed;
  260. left: 0;
  261. bottom: 0;
  262. padding-top: 40rpx;
  263. display: flex;
  264. align-items: center;
  265. justify-content: space-around;
  266. }
  267. .time-view {
  268. height: 350rpx;
  269. background-color: #fff;
  270. padding: 50rpx 50rpx 0 50rpx;
  271. box-sizing: border-box;
  272. .btn-view {
  273. width: 100%;
  274. height: 100rpx;
  275. margin-top: 100rpx;
  276. display: flex;
  277. justify-content: space-around;
  278. }
  279. }
  280. }
  281. uni-page-body {
  282. width: 100%;
  283. height: 100%;
  284. }
  285. </style>