人民医院前端

button.vue 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <view>
  3. <button class="mini-btn" type="default" size="mini" v-for="item in orderButtonData"
  4. @click="callBtnMethods(item.eventName)" :key="item.id">
  5. {{ item.text }}
  6. </button>
  7. <!-- 弹框 -->
  8. <view>
  9. <uni-popup ref="inputDialog" type="dialog">
  10. <uni-popup-dialog ref="inputClose" mode="input" :title="title" @confirm="dialogInputConfirm">
  11. <view style="width:100%;">
  12. <uni-data-select v-model="Maintenancer" :localdata="maintenancerDate" @change="maintenancerChange" v-show="auditPlaceholder === 'show'"/>
  13. <uni-easyinput type="textarea" autoHeight maxlength="100" v-model="cbreason" :placeholder="auditPlaceholder" v-show="auditPlaceholder !== 'show'"/>
  14. </view>
  15. </uni-popup-dialog>
  16. </uni-popup>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import pageData from "@/pages/myTask/repairList/addRepair/pageData.js"
  22. export default {
  23. props: {
  24. orderButtonData: {
  25. type: Array,
  26. default () {
  27. return []
  28. }
  29. },
  30. wid: {
  31. type: String,
  32. default: ''
  33. },
  34. orderType: {
  35. type: String,
  36. default: ''
  37. },
  38. departid: {
  39. type: String,
  40. default: ''
  41. },
  42. maintenancer: {
  43. type: String,
  44. default: ''
  45. }
  46. },
  47. data() {
  48. return {
  49. title:'请输入内容',
  50. Maintenancer: '', //维修人
  51. maintenancerDate: [], // 人员信息
  52. workOrderButton: [], // 工单按钮权限
  53. cbreason: '', //审核原因
  54. auditPlaceholder: '请输入不通过审核原因'
  55. }
  56. },
  57. onLoad(option) {
  58. console.log(2)
  59. },
  60. methods: {
  61. callBtnMethods(methodName) {
  62. this[methodName]();
  63. },
  64. // 1查收
  65. checkBtn() {
  66. this.confirmationAPI("FaultRepair/checkWorkOrder", "信息", "是否要查收", "取消了查收")
  67. },
  68. // 2退回
  69. sendBackBtn() {
  70. this.cbreason = ''
  71. this.auditPlaceholder = '请输入退回原因'
  72. this.$refs.inputDialog.open()
  73. },
  74. // 4 协作
  75. cooperationBtn() {
  76. uni.navigateTo({
  77. url: "/pages/myTask/repairList/repairDetail/cooperationDetail/cooperationDetail?wid=" + this.wid
  78. + '&orderType=' + this.orderType + '&departid='+this.departid + '&maintenancer=' + this.maintenancer,
  79. })
  80. },
  81. // 转派
  82. assignBtn() {
  83. pageData.getApplicant(this.departid, (res) => {
  84. res.forEach(v => {
  85. if(v.text == this.maintenancer ) {
  86. v.disable = true
  87. }
  88. })
  89. this.maintenancerDate = res
  90. })
  91. this.title = '转派工单'
  92. this.cbreason = '1'
  93. this.auditPlaceholder = 'show'
  94. this.$refs.inputDialog.open()
  95. },
  96. maintenancerChange(e) {
  97. this.Maintenancer = e
  98. },
  99. // 指派
  100. transferBtn() {
  101. uni.navigateTo({
  102. url: "/pages/myTask/repairList/repairDetail/tranferDetail/tranferDetail?wid=" + this.wid
  103. })
  104. },
  105. // 完成
  106. finishBtn() {
  107. uni.navigateTo({
  108. url: "/pages/myTask/repairList/repairDetail/finishDetail/finishDetail?wid=" + this.wid
  109. })
  110. },
  111. // 评价
  112. evaluateBtn() {
  113. uni.navigateTo({
  114. url: "/pages/myTask/repairList/addRepair/addRepair?wid=" + this.wid
  115. })
  116. },
  117. // 自行解决
  118. selfSolveBtn() {
  119. this.title = '异常结束'
  120. this.cbreason = ''
  121. this.auditPlaceholder = '请输入异常结束原因'
  122. this.$refs.inputDialog.open()
  123. },
  124. //返修
  125. backOrderBtn() {
  126. this.title = '返工'
  127. this.cbreason = ''
  128. this.auditPlaceholder = '请输入返工原因'
  129. this.$refs.inputDialog.open()
  130. },
  131. // 编辑
  132. editBtn() {
  133. uni.navigateTo({
  134. url: "/pages/myTask/repairList/addRepair/addRepair?wid=" + this.wid + '&editState='+1
  135. })
  136. },
  137. // 删除
  138. deleteBtn() {
  139. this.confirmationAPI("FaultRepair/DeleteWorkOrder", "删除", "是否要删除", "取消了删除")
  140. },
  141. // 审核通过确认框
  142. dialogInputConfirm() {
  143. uni.showLoading({
  144. title: '加载中'
  145. })
  146. // 关闭窗口后,恢复默认内容
  147. if (!this.cbreason) {
  148. this.$mHelper.toast(this.auditPlaceholder)
  149. return
  150. }
  151. if (this.auditPlaceholder === '请输入退回原因') {
  152. const addParams = {BackReason: this.cbreason,WorkOrderCode: this.wid}
  153. this.workOrderContent("FaultRepair/BackWorkOrder",addParams)
  154. }else if(this.auditPlaceholder === 'show') {
  155. if(!this.Maintenancer) {
  156. this.$mHelper.toast('请选择指派人');
  157. return
  158. }
  159. const addParams = {ToUserCode: this.Maintenancer,WorkOrderCode: this.wid}
  160. this.workOrderContent("FaultRepair/Transfer",addParams)
  161. }else if(this.auditPlaceholder === '请输入异常结束原因') {
  162. const addParams = {result: this.cbreason,WorkOrderCode: this.wid,type:1}
  163. this.workOrderContent("FaultRepair/DealWorkOrder ",addParams)
  164. }else if(this.auditPlaceholder === '请输入返工原因') {
  165. const addParams = {ReturnReason: this.cbreason,WorkOrderCode: this.wid}
  166. this.workOrderContent("FaultRepair/ReturnWorkOrder ",addParams)
  167. }
  168. this.$refs.inputDialog.close()
  169. },
  170. // 确认框方法,带输入框
  171. workOrderContent(url,addParams) {
  172. this.$mHelper.httpPost(url,addParams,1)
  173. },
  174. //确认框方法
  175. confirmationAPI(url, title, content, canceContent) {
  176. uni.showModal({
  177. title: title,
  178. content: content,
  179. success: (res) => {
  180. if (res.confirm) {
  181. const params = {
  182. WorkOrderCode: this.wid
  183. }
  184. this.$mHelper.httpPost(url,params,1)
  185. } else if (res.cancel) {
  186. this.$mHelper.toast(canceContent);
  187. }
  188. }
  189. })
  190. },
  191. }
  192. }
  193. </script>
  194. <style lang="scss">
  195. .mini-btn {
  196. margin-right: 3px;
  197. color: #fff;
  198. background: #1e90ff;
  199. }
  200. </style>