detail.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <div>
  3. <basicDetails
  4. ref="details"
  5. :titleText="mainData.name"
  6. :oldFormPath="{edit:'HDrpManagement/workBillModule/components'}"
  7. :editData="mainData"
  8. :mainAreaData="mainAreaData"
  9. turnPageId="20221031141102"
  10. idname="sa_workorder_templateid"
  11. ownertable="sa_workorder_template"
  12. :delApiId="20230207140803"
  13. tags=""
  14. :tabs="tabs"
  15. @pageChange="pageChange"
  16. @onEditSuccess="queryMainData($route.query.id)">
  17. <div slot="tags">
  18. </div>
  19. <div slot="customOperation" >
  20. <customBtn
  21. btnName="启用"
  22. message="确定启用该服务模板吗?"
  23. idName="20230207140703"
  24. keyName="sa_workorder_templateid"
  25. :id="$route.query.id"
  26. :paramData="[{key:'isused',value:true}]"
  27. class="inline-16"
  28. @onSuccess="queryMainData()"
  29. v-if="!mainData.isused && tool.checkAuth($route.name,'used')"
  30. />
  31. <customBtn
  32. btnName="关闭"
  33. message="确定关闭该服务模板吗?"
  34. idName="20230207140703"
  35. keyName="sa_workorder_templateid"
  36. :id="$route.query.id"
  37. :paramData="[{key:'isused',value:false}]"
  38. class="inline-16"
  39. @onSuccess="queryMainData() && tool.checkAuth($route.name,'close')"
  40. v-else
  41. />
  42. </div>
  43. <div slot="slot0" >
  44. <taskDetail v-if="mainData.actiontype == '工序模板'">
  45. </taskDetail>
  46. </div>
  47. <div :slot="mainData.actiontype == '工序模板' ? 'slot1' : 'slot0'" >
  48. <detailInfo :more="true" :data="detailInfo"></detailInfo>
  49. </div>
  50. </basicDetails>
  51. </div>
  52. </template>
  53. <script>
  54. import detailInfo from '@/components/detailInfo/index'
  55. import taskDetail from './taskDetail/index'
  56. export default {
  57. name: "detail",
  58. data() {
  59. return {
  60. mainData:{},
  61. mainAreaData:{},
  62. detailInfo:'',
  63. tabs:['详细信息']
  64. }
  65. },
  66. components:{
  67. detailInfo,
  68. taskDetail
  69. },
  70. provide() {
  71. return {
  72. isEdit:() => this.mainData.isused == 1
  73. }
  74. },
  75. methods:{
  76. async queryMainData(id) {
  77. const res = await this.$api.requested({
  78. "id":20230207140503,
  79. "content": {
  80. "nocahce":true,
  81. "sa_workorder_templateid": this.$route.query.id
  82. }
  83. })
  84. this.mainData = res.data
  85. this.changeDataStructure()
  86. if (this.mainData.actiontype == '工序模板') this.tabs.unshift('工序明细')
  87. console.log(this.mainData);
  88. },
  89. changeDataStructure() {
  90. this.mainAreaData = [
  91. {
  92. label:'模板名称',
  93. value:this.mainData.name
  94. },
  95. {
  96. label:'服务类型',
  97. value:this.mainData.type
  98. },
  99. {
  100. label:'是否启用',
  101. value:this.mainData.isused ? '是' : '否'
  102. },
  103. {
  104. label:'操作类型',
  105. value:this.mainData.actiontype == '非工序模板' ? '通用模板' : this.mainData.actiontype
  106. }
  107. ]
  108. this.detailInfo = [
  109. {
  110. title:'基本信息',
  111. info: [
  112. {
  113. label:'模板名称',
  114. value:this.mainData.name
  115. },
  116. {
  117. label:'服务类型',
  118. value:this.mainData.type
  119. },
  120. {
  121. label:'是否启用',
  122. value:this.mainData.isused ? '是' : '否'
  123. },
  124. ]
  125. },
  126. {
  127. title:'系统信息',
  128. info: [
  129. {label:'创建人',value:this.mainData.createby},
  130. {label:'创建时间',value:this.mainData.createdate},
  131. {label:'编辑人',value:this.mainData.changeby},
  132. {label:'编辑时间',value:this.mainData.changedate},
  133. ]
  134. },
  135. ]
  136. },
  137. async handleStatus (status) {
  138. let res = await this.$api.requested({
  139. "id": "20230207140703",
  140. "version":1,
  141. "content": {
  142. "sa_workorder_templateid":this.$route.query.id,
  143. "isused":status == '关闭' ? false : true
  144. }
  145. })
  146. this.tool.showMessage(res,() => {
  147. this.queryMainData()
  148. })
  149. },
  150. // 监听切换数据,上一页,下一页
  151. pageChange (id,rowindex,tabIndex) {
  152. this.flag = false
  153. tabIndex = this.$route.query.tabIndex
  154. this.$router.replace({path:'/workBillModuleDetail',query:{id:id,rowindex:rowindex,tabIndex:tabIndex}})
  155. this.queryMainData(id)
  156. },
  157. onSuccess(){
  158. this.visible = false
  159. this.queryMainData(this.$route.query.id)
  160. this.$emit('onSuccess')
  161. }
  162. },
  163. mounted () {
  164. this.queryMainData(this.$route.query.id)
  165. },
  166. created() {
  167. }
  168. }
  169. </script>
  170. <style scoped>
  171. </style>