人民医院前端

button.vue 9.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  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. fid:{
  49. type:String,
  50. default:''
  51. }
  52. },
  53. data() {
  54. return {
  55. disabledButton:false,
  56. assignType: 0,
  57. assignTypeVisit: [{
  58. text: '转同事',
  59. value: 0
  60. },{
  61. text: '转组长',
  62. value: 1
  63. }],
  64. title:'请输入内容',
  65. Maintenancer: '', //维修人
  66. maintenancerDate: [], // 人员信息
  67. workOrderButton: [], // 工单按钮权限
  68. cbreason: '', //审核原因
  69. auditPlaceholder: '请输入不通过审核原因'
  70. }
  71. },
  72. onLoad(option) {
  73. console.log(this.fid)
  74. },
  75. methods: {
  76. callBtnMethods(methodName) {
  77. this[methodName]();
  78. },
  79. /**
  80. * 工单列表(按钮)
  81. */
  82. // 工单指派
  83. transferBtn() {
  84. uni.navigateTo({
  85. url: "/pages/myTask/repairList/repairDetail/tranferDetail/tranferDetail?wid=" + this.wid
  86. })
  87. },
  88. // 工单撤回
  89. orderReuturnBtn() {
  90. this.confirmationAPI("FaultRepair/Retract", "信息", "是否要撤回工单", "取消了撤回")
  91. },
  92. // 工单退回
  93. orderBackBtn() {
  94. this.confirmationAPI("FaultRepair/ReBack", "信息", "是否要退回工单", "取消了退回")
  95. },
  96. // 工单编辑
  97. editBtn() {
  98. uni.navigateTo({
  99. url: "/pages/myTask/repairList/addRepair/addRepair?wid=" + this.wid + '&editState='+1
  100. })
  101. },
  102. // 工单删除
  103. deleteBtn() {
  104. this.confirmationAPI("FaultRepair/DeleteWorkOrder", "删除", "是否要删除", "取消了删除")
  105. },
  106. debtn() {
  107. this.confirmationAPI("FaultRepair/DeleteWorkOrder", "删除", "是否要删除", "取消了删除")
  108. },
  109. /**
  110. * 我的提交(工单)(按钮)
  111. */
  112. // 自行解决
  113. selfSolveBtn() {
  114. this.title = '异常结束'
  115. this.cbreason = ''
  116. this.auditPlaceholder = '请输入异常结束原因'
  117. this.$refs.inputDialog.open()
  118. },
  119. // 评价
  120. evaluateBtn() {
  121. uni.navigateTo({
  122. url: "/pages/myTask/repairList/repairDetail/evaluateDetail/evaluateDetail?wid=" + this.wid
  123. })
  124. },
  125. //返修
  126. backOrderBtn() {
  127. this.title = '返工'
  128. this.cbreason = ''
  129. this.auditPlaceholder = '请输入返工原因'
  130. this.$refs.inputDialog.open()
  131. },
  132. // 撤回
  133. returnBtn() {
  134. this.confirmationAPI("FaultRepair/MyRetract", "信息", "是否要撤回", "取消了撤回")
  135. },
  136. // 编辑撤回
  137. returnEditBtn() {
  138. uni.navigateTo({
  139. url: "/pages/myTask/repairList/repairDetail/returnEditDetail/returnEditDetail?wid=" + this.wid + '&editState='+1
  140. })
  141. },
  142. // 咨询工单接单
  143. receivingBtn() {
  144. this.confirmationAPI("Con_WorkOrder/SureWorkOrder", "信息", "是否要接单", "取消了接单")
  145. },
  146. // 咨询退回
  147. zxBackBtn() {
  148. this.confirmationAPI("Con_WorkOrder/BackWorkOrder", "信息", "是否要退回", "取消了退回")
  149. },
  150. //咨询处理
  151. zxDealBtn() {
  152. uni.navigateTo({
  153. url: "/pages/myTask/consultList/consultDetail/appointmentDeal/appointmentDeal?wid=" + this.wid
  154. })
  155. },
  156. //咨询编辑
  157. zxEditBtn() {
  158. uni.navigateTo({
  159. url: "/pages/myTask/consultList/consultDetail/editDetail/editDetail?wid=" + this.wid
  160. })
  161. },
  162. /**
  163. * 报修列表(按钮)
  164. */
  165. // 1查收
  166. checkBtn() {
  167. this.confirmationAPI("FaultRepair/checkWorkOrder", "信息", "是否要查收", "取消了查收")
  168. },
  169. // 2退回
  170. sendBackBtn() {
  171. this.cbreason = ''
  172. this.auditPlaceholder = '请输入退回原因'
  173. this.$refs.inputDialog.open()
  174. },
  175. // 4 协作
  176. cooperationBtn() {
  177. uni.navigateTo({
  178. url: "/pages/myTask/repairList/repairDetail/cooperationDetail/cooperationDetail?wid=" + this.wid
  179. + '&orderType=' + this.orderType + '&departid='+this.departid + '&maintenancer=' + this.maintenancer,
  180. })
  181. },
  182. // 转派
  183. assignBtn() {
  184. pageData.getApplicant(this.departid, (res) => {
  185. res.forEach(v => {
  186. if(v.text == this.maintenancer ) {
  187. v.disable = true
  188. }
  189. })
  190. this.maintenancerDate = res
  191. })
  192. this.title = '转派工单'
  193. this.cbreason = '1'
  194. this.auditPlaceholder = 'show'
  195. this.$refs.inputDialog.open()
  196. },
  197. maintenancerChange(e) {
  198. this.Maintenancer = e
  199. },
  200. // 完成
  201. finishBtn() {
  202. uni.navigateTo({
  203. url: "/pages/myTask/repairList/repairDetail/finishDetail/finishDetail?wid=" + this.wid
  204. })
  205. },
  206. // 挂起
  207. hangBtn() {
  208. this.confirmationAPI("FaultRepair/HangUp", "信息", "是否要挂起", "取消了挂起")
  209. },
  210. // 到达
  211. arriveBtn() {
  212. this.confirmationAPI("FaultRepair/Arrive", "信息", "是否要到达", "取消了到达")
  213. },
  214. // 车辆调度 ( 按钮开始 )
  215. // 编辑
  216. editVehBtn() {
  217. uni.navigateTo({
  218. url: "/pages/myTask/vehicleSchedulList/applicantsList/addVehicle/addVehicle?wid=" + this.wid + '&editState='+1
  219. })
  220. },
  221. // 撤回
  222. revocationBtn(){
  223. this.confirmationAPI("T_Car_WorkOrder/WithdrawWorkOrder", "信息", "是否撤回", "取消了撤回")
  224. },
  225. // 评价
  226. evaluateBtn(){
  227. uni.navigateTo({
  228. url: "/pages/myTask/vehicleSchedulList/components/vehiccleDetail/evaluateDetail/evaluateDetail?wid=" + this.wid
  229. })
  230. },
  231. // 接单
  232. takeOrderVeh(){
  233. console.log(this.fid)
  234. this.confirmationAPI("T_Car_WorkOrder/SureWorkOrder", "信息", "是否接单", "取消了接单")
  235. },
  236. // 退回
  237. sendBackVeh(){
  238. this.confirmationAPI("T_Car_WorkOrder/BackWorkOrder", "信息", "是否退回", "取消了退回")
  239. },
  240. // 抵达发车点
  241. departBtn(){
  242. this.confirmationAPI("T_Car_WorkOrder/StartCar", "信息", "是否抵达发车点", "取消了")
  243. },
  244. // 抵达目的地
  245. destinationBtn(){
  246. this.confirmationAPI("T_Car_WorkOrder/EndCar", "信息", "是否抵达目的地", "取消了")
  247. },
  248. // 车辆调度 ( 按钮结束 )
  249. // 审核通过确认框
  250. dialogInputConfirm() {
  251. uni.showLoading({
  252. title: '加载中'
  253. })
  254. // 关闭窗口后,恢复默认内容
  255. if (!this.cbreason) {
  256. this.$mHelper.toast(this.auditPlaceholder)
  257. return
  258. }
  259. if (this.auditPlaceholder === '请输入退回原因') {
  260. const addParams = {BackReason: this.cbreason,WorkOrderCode: this.wid}
  261. this.workOrderContent("FaultRepair/BackWorkOrder",addParams)
  262. }else if(this.auditPlaceholder === 'show') {
  263. if(!this.Maintenancer) {
  264. this.$mHelper.toast('请选择指派人');
  265. return
  266. }
  267. const addParams = {ToUserCode: this.Maintenancer,WorkOrderCode: this.wid,type: this.assignType}
  268. this.workOrderContent("FaultRepair/Transfer",addParams)
  269. }else if(this.auditPlaceholder === '请输入异常结束原因') {
  270. const addParams = {result: this.cbreason,WorkOrderCode: this.wid,type:1}
  271. this.workOrderContent("FaultRepair/DealWorkOrder ",addParams)
  272. }else if(this.auditPlaceholder === '请输入返工原因') {
  273. const addParams = {ReturnReason: this.cbreason,WorkOrderCode: this.wid}
  274. this.workOrderContent("FaultRepair/ReturnWorkOrder ",addParams)
  275. }
  276. this.$refs.inputDialog.close()
  277. },
  278. // 确认框方法,带输入框
  279. workOrderContent(url,addParams) {
  280. this.disabledButton = true
  281. this.$mHelper.httpPost(url,addParams,1 ,res=>this.disabledButton=res)
  282. uni.hideLoading()
  283. },
  284. //确认框方法
  285. confirmationAPI(url, title, content, canceContent) {
  286. this.disabledButton = true
  287. uni.showModal({
  288. title: title,
  289. content: content,
  290. success: (res) => {
  291. if (res.confirm) {
  292. const params = {}
  293. if(content == '是否要查收' || content == '是否要接单' || content == '是否要退回') {
  294. params.WorkOrderCode = this.wid
  295. }else if (content === '是否撤回' || content === '是否接单' || content === '是否退回' ){
  296. params.orderid = this.fid
  297. }else if(content === '是否抵达发车点' || content === '是否抵达目的地'){
  298. params.orderid = this.fid
  299. params.WorkOrderCode = this.wid
  300. } else{
  301. params.workordercode = this.wid
  302. }
  303. this.$mHelper.httpPost(url,params,1,res=>this.disabledButton=res)
  304. } else if (res.cancel) {
  305. this.disabledButton = false
  306. this.$mHelper.toast(canceContent);
  307. }
  308. }
  309. })
  310. },
  311. }
  312. }
  313. </script>
  314. <style lang="scss">
  315. .mini-btn {
  316. margin-right: 3px;
  317. color: #fff;
  318. background: #1e90ff;
  319. }
  320. </style>