quickCreateOrder.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <template>
  2. <view class="quickCreateOrder">
  3. <view class="qco_msg" v-html="dataObj.msg"></view>
  4. <!-- 起点科室,终点科室 -->
  5. <block v-if="qucikCreateOrderType === 'other' && (dataObj.start || dataObj.end)">
  6. <!-- 返回值的departmentStrategy是201 则是默认发起科室 -->
  7. <!-- 返回值的departmentStrategy是202 则是固定科室范围 -->
  8. <!-- 返回值的departmentStrategy是203 则是固定科室 -->
  9. <!-- 返回值的departmentStrategy是204 则是自主填写 -->
  10. <!-- 返回值的departmentStrategy是205 则是固定科室类型 -->
  11. <!-- 100013 (护士端一键建单展示策略)取起点科室,和msg值展示 -->
  12. <!-- <block v-if="dataObj.status == 100013"> -->
  13. <view class="select_block">
  14. <text class="select_label"
  15. :class="{disableColor:(dataObj.start.start.departmentStrategy == 201 ||dataObj.start.start.departmentStrategy == 203)}">起点科室</text>
  16. <view class="select_placeholder"
  17. v-if="dataObj.start.start.departmentStrategy == 201||dataObj.start.start.departmentStrategy == 203">
  18. {{deptDisplay == 1?dataObj.start.start.list[0].dept:dataObj.start.start.list[0].deptalias}}
  19. </view>
  20. <view class="select_placeholder" v-else>请选择起点科室<text class="pda pda-xiangyou"></text></view>
  21. </view>
  22. <view class="select_block">
  23. <text class="select_label"
  24. :class="{disableColor:(dataObj.end.end.departmentStrategy == 201||dataObj.end.end.departmentStrategy == 203)}">终点科室</text>
  25. <view class="select_placeholder"
  26. v-if="(dataObj.end.end.departmentStrategy == 201||dataObj.end.end.departmentStrategy == 203)">
  27. {{deptDisplay == 1?dataObj.end.end.list[0].dept:dataObj.end.end.list[0].deptalias}}
  28. </view>
  29. <view class="select_placeholder" v-else>请选择终点科室<text class="pda pda-xiangyou"></text></view>
  30. </view>
  31. <!-- </block> -->
  32. </block>
  33. <!-- 备注 -->
  34. <view class="remarks" v-if="dataObj.remarksSwitch == 1">
  35. <textarea :focus="remarksFocus" class="remarks_textarea" auto-height :maxlength="100"
  36. placeholder-style="color:#999" :placeholder="dataObj.remarksPrompts|| '请填写工单备注,不超过100个字符'"
  37. v-model="workOrderRemark" />
  38. </view>
  39. <!-- 快捷输入,历史输入 -->
  40. <view class="quickAndHistory" v-if="dataObj.remarksSwitch == 1 && dataObj.customRemarks.length">
  41. <view class="quickAndHistory_header">
  42. 快捷输入
  43. </view>
  44. <view class="quickAndHistory_container">
  45. <view class="quickAndHistory_item" @click="addRemarks(customRemark)"
  46. v-for="(customRemark,i) in dataObj.customRemarks" :key="i">
  47. {{customRemark}}
  48. </view>
  49. </view>
  50. </view>
  51. <view class="quickAndHistory" v-if="dataObj.remarksSwitch == 1 && historyCustomRemarks.length">
  52. <view class="quickAndHistory_header">
  53. 历史输入
  54. </view>
  55. <view class="quickAndHistory_container">
  56. <view class="quickAndHistory_item" @click="addRemarks(historyCustomRemark)"
  57. v-for="(historyCustomRemark,i) in historyCustomRemarks" :key="i">
  58. {{historyCustomRemark}}
  59. </view>
  60. </view>
  61. </view>
  62. <!-- 底部 -->
  63. <seiminFooterBtn :btns="btns"></seiminFooterBtn>
  64. <seiminModel ref="seiminModel"></seiminModel>
  65. </view>
  66. </template>
  67. <script>
  68. import {
  69. mapState
  70. } from 'vuex';
  71. import {
  72. reqBuildTrip,
  73. reqRecentRemarks,
  74. reqBuildOrder
  75. } from '../../request/api.js';
  76. import {
  77. SOURCEID
  78. } from '../../utils/enum.sourceid.js';
  79. export default {
  80. data() {
  81. return {
  82. // 工单备注是否获取焦点
  83. remarksFocus: true,
  84. // 工单备注
  85. workOrderRemark: '',
  86. // 获取到的数据集合对象(历史输入除外)
  87. dataObj: {},
  88. // 历史输入
  89. historyCustomRemarks: [],
  90. //底部按钮
  91. btns: [{
  92. name: '回到首页',
  93. type: 'default',
  94. click: () => {
  95. uni.navigateTo({
  96. url: '/pages/index/index'
  97. })
  98. }
  99. },
  100. {
  101. name: '确认',
  102. type: 'primary',
  103. click: () => {
  104. this.submitData();
  105. }
  106. }
  107. ]
  108. };
  109. },
  110. computed: {
  111. ...mapState(['qucikCreateOrderType', 'qucikCreateOrderTypeId', 'deptDisplay']),
  112. ...mapState('user', ['loginInfoUserDeptId']),
  113. },
  114. methods: {
  115. // 添加备注
  116. addRemarks(customRemark) {
  117. this.remarksFocus = false;
  118. this.$nextTick(() => {
  119. this.remarksFocus = true;
  120. });
  121. this.workOrderRemark += customRemark;
  122. },
  123. //获取所有数据
  124. getData(qucikCreateOrderType, qucikCreateOrderTypeId) {
  125. uni.showLoading({
  126. title: '加载中'
  127. });
  128. let postData1 = {};
  129. let postData2 = {
  130. "taskTypeId": qucikCreateOrderTypeId,
  131. "deptId": this.loginInfoUserDeptId,
  132. };
  133. if (qucikCreateOrderType === 'specimen') {
  134. //标本快捷建单
  135. postData1 = {
  136. "taskTypeId": qucikCreateOrderTypeId,
  137. "deptId": this.loginInfoUserDeptId,
  138. };
  139. } else if (qucikCreateOrderType === 'other') {
  140. //其他临床服务快捷建单
  141. postData1 = {
  142. "taskTypeId": qucikCreateOrderTypeId,
  143. };
  144. }
  145. Promise.all([
  146. reqBuildTrip(postData1),
  147. reqRecentRemarks(postData2)
  148. ]).then(values => {
  149. uni.hideLoading();
  150. this.getBuildTrip(values[0]);
  151. this.getRecentRemarks(values[1]);
  152. })
  153. },
  154. // 获取数据(除历史输入)
  155. getBuildTrip(res) {
  156. if (res.status == 200 || res.status == 100012 || res.status == 100013 || res.status == 100014 || res.status ==
  157. 100015) {
  158. // 处理返回的数据
  159. if (res.customRemarks) {
  160. res.customRemarks = res.customRemarks.split('$');
  161. } else {
  162. res.customRemarks = []
  163. }
  164. // 处理msg
  165. if (res.msg.includes('<b>')) {
  166. res.msg = res.msg.replace(/<b>/g, '<text class="green">');
  167. res.msg = res.msg.replace(/<\/b>/g, '</text>');
  168. }
  169. this.dataObj = res;
  170. }
  171. },
  172. // 获取历史输入
  173. getRecentRemarks(res) {
  174. if (res.state == 200) {
  175. this.historyCustomRemarks = res.data || [];
  176. }
  177. },
  178. // 提交数据,建单
  179. submitData() {
  180. let postData = {};
  181. uni.showLoading({
  182. title: '加载中',
  183. mask: true
  184. })
  185. if (this.qucikCreateOrderType === 'specimen') {
  186. //标本建单
  187. postData = {
  188. urgent: 0,
  189. workOrder: {
  190. sourceId: SOURCEID['护士端'],
  191. workOrderRemark: this.workOrderRemark,
  192. taskType: {
  193. id: this.qucikCreateOrderTypeId
  194. },
  195. createDept: this.loginInfoUserDeptId,
  196. startDept: {
  197. id: this.loginInfoUserDeptId
  198. },
  199. },
  200. };
  201. } else if (this.qucikCreateOrderType === 'other') {
  202. let startDept = {}; //起点科室
  203. let endDepts = []; //终点科室
  204. // 其他服务建单
  205. // 起点科室---- start
  206. if (this.dataObj.start.start.departmentStrategy == 201) {
  207. startDept = {
  208. id: this.dataObj.start.start.list[0].id
  209. };
  210. }
  211. // 起点科室---- end
  212. // 终点科室---- start
  213. if (this.dataObj.start.start.departmentStrategy == 201) {
  214. endDepts = [{
  215. id: this.dataObj.end.end.list[0].id
  216. }];
  217. }
  218. // 终点科室---- end
  219. //请求参数
  220. postData = {
  221. workOrder: {
  222. sourceId: SOURCEID['护士端'],
  223. workOrderRemark: this.workOrderRemark,
  224. taskType: {
  225. id: this.qucikCreateOrderTypeId
  226. },
  227. createDept: this.loginInfoUserDeptId,
  228. startDept,
  229. endDepts,
  230. },
  231. };
  232. }
  233. reqBuildOrder(postData).then(res => {
  234. uni.hideLoading();
  235. if (res.status == 200) {
  236. this.$refs.seiminModel.showChangeDept({
  237. skin: "toast",
  238. content: '创建成功',
  239. btns: [{
  240. name: "知道了",
  241. textColor: "#49B856",
  242. flex: 1,
  243. click() {
  244. uni.navigateTo({
  245. url: '/pages/index/index'
  246. })
  247. }
  248. }]
  249. });
  250. } else {
  251. this.$refs.seiminModel.showChangeDept({
  252. skin: "toast",
  253. icon: 'error',
  254. content: res.msg || '操作失败'
  255. });
  256. }
  257. })
  258. }
  259. },
  260. onLoad() {
  261. console.log(this.qucikCreateOrderType, this.qucikCreateOrderTypeId);
  262. this.getData(this.qucikCreateOrderType, this.qucikCreateOrderTypeId);
  263. }
  264. }
  265. </script>
  266. <style lang="scss" scoped>
  267. .quickCreateOrder {
  268. margin-bottom: 100rpx;
  269. .qco_msg {
  270. min-height: 144rpx;
  271. padding: 32rpx 160rpx;
  272. color: #999;
  273. line-height: 40rpx;
  274. font-size: 28rpx;
  275. text-align: center;
  276. }
  277. // 起点科室,终点科室
  278. .select_block {
  279. padding: 0 30rpx;
  280. height: 88rpx;
  281. font-size: 34rpx;
  282. border-top: 1px solid #E5E5E5;
  283. background-color: #fff;
  284. @include flex(space-between, center);
  285. .select_label {
  286. color: #000;
  287. &.disableColor {
  288. color: #999;
  289. }
  290. }
  291. .select_placeholder {
  292. color: #888;
  293. @include flex(flex-start, center);
  294. .pda-xiangyou {
  295. font-size: 24rpx;
  296. margin-left: 30rpx;
  297. }
  298. }
  299. }
  300. // 备注
  301. .remarks {
  302. min-height: 150rpx;
  303. background-color: #fff;
  304. border-top: 1px solid #E5E5E5;
  305. border-bottom: 1px solid #E5E5E5;
  306. padding: 22rpx 25rpx;
  307. .remarks_textarea {
  308. width: 100%;
  309. min-height: 100rpx;
  310. }
  311. }
  312. // 快捷输入,历史输入
  313. .quickAndHistory {
  314. padding: 43rpx 25rpx 0;
  315. .quickAndHistory_header {
  316. font-weight: bold;
  317. font-size: 34rpx;
  318. padding-bottom: 24rpx;
  319. color: #333;
  320. }
  321. .quickAndHistory_container {
  322. @include flex;
  323. flex-wrap: wrap;
  324. .quickAndHistory_item {
  325. height: 66rpx;
  326. font-size: 28rpx;
  327. border-radius: 33rpx;
  328. background-color: #fff;
  329. line-height: 66rpx;
  330. padding: 0 24rpx;
  331. color: #666;
  332. margin-bottom: 11rpx;
  333. margin-right: 24rpx;
  334. @include clamp;
  335. }
  336. }
  337. }
  338. }
  339. </style>