| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- <template>
- <view>
- <button class="mini-btn" type="default" size="mini" v-for="item in orderButtonData"
- @click="callBtnMethods(item.eventName)" :key="item.id">
- {{ item.text }}
- </button>
- <!-- 弹框 -->
- <view>
- <uni-popup ref="inputDialog" type="dialog">
- <uni-popup-dialog ref="inputClose" mode="input" :title="title" @confirm="dialogInputConfirm">
- <view style="width:100%;">
- <uni-data-select v-model="Maintenancer" :localdata="maintenancerDate" @change="maintenancerChange" v-show="auditPlaceholder === 'show'"/>
- <uni-easyinput type="textarea" autoHeight maxlength="100" v-model="cbreason" :placeholder="auditPlaceholder" v-show="auditPlaceholder !== 'show'"/>
- </view>
- </uni-popup-dialog>
- </uni-popup>
- </view>
- </view>
- </template>
- <script>
- import pageData from "@/pages/myTask/repairList/addRepair/pageData.js"
- export default {
- props: {
- orderButtonData: {
- type: Array,
- default () {
- return []
- }
- },
- wid: {
- type: String,
- default: ''
- },
- orderType: {
- type: String,
- default: ''
- },
- departid: {
- type: String,
- default: ''
- },
- maintenancer: {
- type: String,
- default: ''
- }
- },
- data() {
- return {
- title:'请输入内容',
- Maintenancer: '', //维修人
- maintenancerDate: [], // 人员信息
- workOrderButton: [], // 工单按钮权限
- cbreason: '', //审核原因
- auditPlaceholder: '请输入不通过审核原因'
- }
- },
- onLoad(option) {
- console.log(2)
- },
- methods: {
- callBtnMethods(methodName) {
- this[methodName]();
- },
- // 1查收
- checkBtn() {
- this.confirmationAPI("FaultRepair/checkWorkOrder", "信息", "是否要查收", "取消了查收")
- },
- // 2退回
- sendBackBtn() {
- this.cbreason = ''
- this.auditPlaceholder = '请输入退回原因'
- this.$refs.inputDialog.open()
- },
- // 4 协作
- cooperationBtn() {
- uni.navigateTo({
- url: "/pages/myTask/repairList/repairDetail/cooperationDetail/cooperationDetail?wid=" + this.wid
- + '&orderType=' + this.orderType + '&departid='+this.departid + '&maintenancer=' + this.maintenancer,
- })
- },
- // 转派
- assignBtn() {
- pageData.getApplicant(this.departid, (res) => {
- res.forEach(v => {
- if(v.text == this.maintenancer ) {
- v.disable = true
- }
- })
- this.maintenancerDate = res
- })
- this.title = '转派工单'
- this.cbreason = '1'
- this.auditPlaceholder = 'show'
- this.$refs.inputDialog.open()
- },
- maintenancerChange(e) {
- this.Maintenancer = e
- },
- // 指派
- transferBtn() {
- uni.navigateTo({
- url: "/pages/myTask/repairList/repairDetail/tranferDetail/tranferDetail?wid=" + this.wid
- })
- },
- // 完成
- finishBtn() {
- uni.navigateTo({
- url: "/pages/myTask/repairList/repairDetail/finishDetail/finishDetail?wid=" + this.wid
- })
- },
- // 评价
- evaluateBtn() {
- uni.navigateTo({
- url: "/pages/myTask/repairList/addRepair/addRepair?wid=" + this.wid
- })
- },
- // 自行解决
- selfSolveBtn() {
- this.title = '异常结束'
- this.cbreason = ''
- this.auditPlaceholder = '请输入异常结束原因'
- this.$refs.inputDialog.open()
- },
- //返修
- backOrderBtn() {
- this.title = '返工'
- this.cbreason = ''
- this.auditPlaceholder = '请输入返工原因'
- this.$refs.inputDialog.open()
- },
- // 编辑
- editBtn() {
- uni.navigateTo({
- url: "/pages/myTask/repairList/addRepair/addRepair?wid=" + this.wid + '&editState='+1
- })
- },
- // 删除
- deleteBtn() {
- this.confirmationAPI("FaultRepair/DeleteWorkOrder", "删除", "是否要删除", "取消了删除")
- },
- // 审核通过确认框
- dialogInputConfirm() {
- uni.showLoading({
- title: '加载中'
- })
- // 关闭窗口后,恢复默认内容
- if (!this.cbreason) {
- this.$mHelper.toast(this.auditPlaceholder)
- return
- }
- if (this.auditPlaceholder === '请输入退回原因') {
- const addParams = {BackReason: this.cbreason,WorkOrderCode: this.wid}
- this.workOrderContent("FaultRepair/BackWorkOrder",addParams)
- }else if(this.auditPlaceholder === 'show') {
- if(!this.Maintenancer) {
- this.$mHelper.toast('请选择指派人');
- return
- }
- const addParams = {ToUserCode: this.Maintenancer,WorkOrderCode: this.wid}
- this.workOrderContent("FaultRepair/Transfer",addParams)
- }else if(this.auditPlaceholder === '请输入异常结束原因') {
- const addParams = {result: this.cbreason,WorkOrderCode: this.wid,type:1}
- this.workOrderContent("FaultRepair/DealWorkOrder ",addParams)
- }else if(this.auditPlaceholder === '请输入返工原因') {
- const addParams = {ReturnReason: this.cbreason,WorkOrderCode: this.wid}
- this.workOrderContent("FaultRepair/ReturnWorkOrder ",addParams)
- }
- this.$refs.inputDialog.close()
- },
- // 确认框方法,带输入框
- workOrderContent(url,addParams) {
- this.$mHelper.httpPost(url,addParams,1)
-
- },
- //确认框方法
- confirmationAPI(url, title, content, canceContent) {
- uni.showModal({
- title: title,
- content: content,
- success: (res) => {
- if (res.confirm) {
- const params = {
- WorkOrderCode: this.wid
- }
- this.$mHelper.httpPost(url,params,1)
- } else if (res.cancel) {
- this.$mHelper.toast(canceContent);
- }
- }
- })
- },
-
- }
- }
- </script>
- <style lang="scss">
- .mini-btn {
- margin-right: 3px;
- color: #fff;
- background: #1e90ff;
- }
- </style>
|