人民医院前端

button.vue 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <view>
  3. <button class="mini-btn" type="default" size="mini" v-for="item in orderButtonData" :disabled="disabledButton"
  4. @click="callBtnMethods(item.eventName)" :key="item.id">
  5. {{ item.text }}
  6. </button>
  7. <!-- <button class="mini-btn" type="default" size="mini" @click="debtn">删除</button> -->
  8. <!-- 弹框 -->
  9. <view>
  10. <uni-popup ref="inputDialog" type="dialog">
  11. <uni-popup-dialog ref="inputClose" mode="input" :title="title" @confirm="dialogInputConfirm">
  12. <view style="width:100%;">
  13. <uni-data-checkbox v-model="assignType" :localdata="assignTypeVisit" style="margin-bottom: 20px;" v-show="auditPlaceholder === 'show'"/>
  14. <uni-data-select v-model="Maintenancer" :localdata="maintenancerDate" @change="maintenancerChange" v-show="auditPlaceholder === 'show' && assignType === 0"/>
  15. <uni-easyinput type="textarea" autoHeight maxlength="100" v-model="cbreason" :placeholder="auditPlaceholder" v-show="auditPlaceholder !== 'show'"/>
  16. </view>
  17. </uni-popup-dialog>
  18. </uni-popup>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import pageData from "@/pages/myTask/repairList/addRepair/pageData.js"
  24. export default {
  25. props: {
  26. orderButtonData: {
  27. type: Array,
  28. default () {
  29. return []
  30. }
  31. },
  32. wid: {
  33. type: String,
  34. default: ''
  35. },
  36. orderType: {
  37. type: String,
  38. default: ''
  39. },
  40. departid: {
  41. type: String,
  42. default: ''
  43. },
  44. maintenancer: {
  45. type: String,
  46. default: ''
  47. }
  48. },
  49. data() {
  50. return {
  51. disabledButton:false,
  52. assignType: 0,
  53. assignTypeVisit: [{
  54. text: '转同事',
  55. value: 0
  56. },{
  57. text: '转组长',
  58. value: 1
  59. }],
  60. title:'请输入内容',
  61. Maintenancer: '', //维修人
  62. maintenancerDate: [], // 人员信息
  63. workOrderButton: [], // 工单按钮权限
  64. cbreason: '', //审核原因
  65. auditPlaceholder: '请输入不通过审核原因'
  66. }
  67. },
  68. onLoad(option) {
  69. console.log(2)
  70. },
  71. methods: {
  72. callBtnMethods(methodName) {
  73. this[methodName]();
  74. },
  75. /**
  76. * 工单列表(按钮)
  77. */
  78. // 工单指派
  79. transferBtn() {
  80. uni.navigateTo({
  81. url: "/pages/myTask/repairList/repairDetail/tranferDetail/tranferDetail?wid=" + this.wid
  82. })
  83. },
  84. // 工单撤回
  85. orderReuturnBtn() {
  86. this.confirmationAPI("FaultRepair/Retract", "信息", "是否要撤回工单", "取消了撤回")
  87. },
  88. // 工单退回
  89. orderBackBtn() {
  90. this.confirmationAPI("FaultRepair/ReBack", "信息", "是否要退回工单", "取消了退回")
  91. },
  92. // 工单编辑
  93. editBtn() {
  94. uni.navigateTo({
  95. url: "/pages/myTask/repairList/addRepair/addRepair?wid=" + this.wid + '&editState='+1
  96. })
  97. },
  98. // 工单删除
  99. deleteBtn() {
  100. this.confirmationAPI("FaultRepair/DeleteWorkOrder", "删除", "是否要删除", "取消了删除")
  101. },
  102. debtn() {
  103. this.confirmationAPI("FaultRepair/DeleteWorkOrder", "删除", "是否要删除", "取消了删除")
  104. },
  105. /**
  106. * 我的提交(工单)(按钮)
  107. */
  108. // 自行解决
  109. selfSolveBtn() {
  110. this.title = '异常结束'
  111. this.cbreason = ''
  112. this.auditPlaceholder = '请输入异常结束原因'
  113. this.$refs.inputDialog.open()
  114. },
  115. // 评价
  116. evaluateBtn() {
  117. uni.navigateTo({
  118. url: "/pages/myTask/repairList/repairDetail/evaluateDetail/evaluateDetail?wid=" + this.wid
  119. })
  120. },
  121. //返修
  122. backOrderBtn() {
  123. this.title = '返工'
  124. this.cbreason = ''
  125. this.auditPlaceholder = '请输入返工原因'
  126. this.$refs.inputDialog.open()
  127. },
  128. // 撤回
  129. returnBtn() {
  130. this.confirmationAPI("FaultRepair/MyRetract", "信息", "是否要撤回", "取消了撤回")
  131. },
  132. // 编辑撤回
  133. returnEditBtn() {
  134. uni.navigateTo({
  135. url: "/pages/myTask/repairList/repairDetail/returnEditDetail/returnEditDetail?wid=" + this.wid + '&editState='+1
  136. })
  137. },
  138. // 咨询工单接单
  139. receivingBtn() {
  140. this.confirmationAPI("Con_WorkOrder/SureWorkOrder", "信息", "是否要接单", "取消了接单")
  141. },
  142. // 咨询退回
  143. zxBackBtn() {
  144. this.confirmationAPI("Con_WorkOrder/BackWorkOrder", "信息", "是否要退回", "取消了退回")
  145. },
  146. //咨询处理
  147. zxDealBtn() {
  148. uni.navigateTo({
  149. url: "/pages/myTask/consultList/consultDetail/appointmentDeal/appointmentDeal?wid=" + this.wid
  150. })
  151. },
  152. //咨询编辑
  153. zxEditBtn() {
  154. uni.navigateTo({
  155. url: "/pages/myTask/consultList/consultDetail/editDetail/editDetail?wid=" + this.wid
  156. })
  157. },
  158. /**
  159. * 报修列表(按钮)
  160. */
  161. // 1查收
  162. checkBtn() {
  163. this.confirmationAPI("FaultRepair/checkWorkOrder", "信息", "是否要查收", "取消了查收")
  164. },
  165. // 2退回
  166. sendBackBtn() {
  167. this.cbreason = ''
  168. this.auditPlaceholder = '请输入退回原因'
  169. this.$refs.inputDialog.open()
  170. },
  171. // 4 协作
  172. cooperationBtn() {
  173. uni.navigateTo({
  174. url: "/pages/myTask/repairList/repairDetail/cooperationDetail/cooperationDetail?wid=" + this.wid
  175. + '&orderType=' + this.orderType + '&departid='+this.departid + '&maintenancer=' + this.maintenancer,
  176. })
  177. },
  178. // 转派
  179. assignBtn() {
  180. pageData.getApplicant(this.departid, (res) => {
  181. res.forEach(v => {
  182. if(v.text == this.maintenancer ) {
  183. v.disable = true
  184. }
  185. })
  186. this.maintenancerDate = res
  187. })
  188. this.title = '转派工单'
  189. this.cbreason = '1'
  190. this.auditPlaceholder = 'show'
  191. this.$refs.inputDialog.open()
  192. },
  193. maintenancerChange(e) {
  194. this.Maintenancer = e
  195. },
  196. // 完成
  197. finishBtn() {
  198. uni.navigateTo({
  199. url: "/pages/myTask/repairList/repairDetail/finishDetail/finishDetail?wid=" + this.wid
  200. })
  201. },
  202. // 挂起
  203. hangBtn() {
  204. this.confirmationAPI("FaultRepair/HangUp", "信息", "是否要挂起", "取消了挂起")
  205. },
  206. // 到达
  207. arriveBtn() {
  208. this.confirmationAPI("FaultRepair/Arrive", "信息", "是否要到达", "取消了到达")
  209. },
  210. // 审核通过确认框
  211. dialogInputConfirm() {
  212. uni.showLoading({
  213. title: '加载中'
  214. })
  215. // 关闭窗口后,恢复默认内容
  216. if (!this.cbreason) {
  217. this.$mHelper.toast(this.auditPlaceholder)
  218. return
  219. }
  220. if (this.auditPlaceholder === '请输入退回原因') {
  221. const addParams = {BackReason: this.cbreason,WorkOrderCode: this.wid}
  222. this.workOrderContent("FaultRepair/BackWorkOrder",addParams)
  223. }else if(this.auditPlaceholder === 'show') {
  224. if(!this.Maintenancer) {
  225. this.$mHelper.toast('请选择指派人');
  226. return
  227. }
  228. const addParams = {ToUserCode: this.Maintenancer,WorkOrderCode: this.wid,type: this.assignType}
  229. this.workOrderContent("FaultRepair/Transfer",addParams)
  230. }else if(this.auditPlaceholder === '请输入异常结束原因') {
  231. const addParams = {result: this.cbreason,WorkOrderCode: this.wid,type:1}
  232. this.workOrderContent("FaultRepair/DealWorkOrder ",addParams)
  233. }else if(this.auditPlaceholder === '请输入返工原因') {
  234. const addParams = {ReturnReason: this.cbreason,WorkOrderCode: this.wid}
  235. this.workOrderContent("FaultRepair/ReturnWorkOrder ",addParams)
  236. }
  237. this.$refs.inputDialog.close()
  238. },
  239. // 确认框方法,带输入框
  240. workOrderContent(url,addParams) {
  241. this.disabledButton = true
  242. this.$mHelper.httpPost(url,addParams,1 ,res=>this.disabledButton=res)
  243. uni.hideLoading()
  244. },
  245. //确认框方法
  246. confirmationAPI(url, title, content, canceContent) {
  247. this.disabledButton = true
  248. uni.showModal({
  249. title: title,
  250. content: content,
  251. success: (res) => {
  252. if (res.confirm) {
  253. const params = {}
  254. if(content == '是否要查收' || content == '是否要接单' || content == '是否要退回') {
  255. params.WorkOrderCode = this.wid
  256. }else{
  257. params.workordercode = this.wid
  258. }
  259. this.$mHelper.httpPost(url,params,1,res=>this.disabledButton=res)
  260. } else if (res.cancel) {
  261. this.disabledButton = false
  262. this.$mHelper.toast(canceContent);
  263. }
  264. }
  265. })
  266. },
  267. }
  268. }
  269. </script>
  270. <style lang="scss">
  271. .mini-btn {
  272. margin-right: 3px;
  273. color: #fff;
  274. background: #1e90ff;
  275. }
  276. </style>