index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <div>
  3. <basicDetails
  4. ref="details"
  5. :titleText="'年度目标' + mainData.year + '年'"
  6. :editData="mainData"
  7. :mainAreaData="mainAreaData"
  8. :turnPageId="20220901132502"
  9. idname="sa_salestargetbillid"
  10. ownertable="sa_salestargetbill"
  11. delApiId="20221118103402"
  12. tags=""
  13. :tabs="['人员目标详情','详细信息']"
  14. :statusCheck="[{key:'status',value:'已下达'}]"
  15. @pageChange="pageChange"
  16. @onEditSuccess="queryMainData($route.query.id)"
  17. @onTabClick="onTabClick">
  18. <div slot="customOperation">
  19. <!-- 此区域提供了自定义操作按钮 -->
  20. <issue :data="mainData" @onSuccess="onSuccess"></issue>
  21. <adjustment :data="mainData" @onSuccess="onSuccess" ></adjustment>
  22. <close v-if="mainData.status === '已下达'" :data="mainData" @onClose="onSuccess"></close>
  23. <importFile class="inline-16" accept=".xlsx" :folderid="folderid" :bindData="{ownertable:'sa_salestargetbill',ownerid:'',usetype:'default'}" @onImportSuccess="onImportSuccess">
  24. <a class="error-link" v-if="errorurl" :href="errorurl" slot="errorFile">下载错误数据</a>
  25. </importFile>
  26. </div>
  27. <div slot="slot0">
  28. <targetTable ref="list" class="container normal-panel">
  29. <template v-slot:editTarget="scope">
  30. <editTarget v-if="tool.checkAuth($route.name,'update')" style="display:inline" :year="mainInfo.year" :data="scope.data" @onSuccess="onSuccess"></editTarget>
  31. </template>
  32. <!-- <template v-slot:del="scope">
  33. <ondel v-if="tool.checkAuth($route.name,'delete')" :data="scope.data" @onSuccess="onSuccess"></ondel>
  34. </template>-->
  35. </targetTable>
  36. </div>
  37. <div slot="slot1">
  38. <detail_information ref="detailed"></detail_information>
  39. </div>
  40. </basicDetails>
  41. </div>
  42. </template>
  43. <script>
  44. import add from './components/add.vue'
  45. import ondel from './components/del.vue'
  46. import editTarget from './components/editTarget.vue'
  47. import importFile from './components/importFile.vue'
  48. import targetTable from './components/table.vue'
  49. import detail_information from './modules/detailedInformation/index'
  50. import issue from '../issue'
  51. import adjustment from '../adjustment'
  52. import close from '../close'
  53. export default {
  54. components:{
  55. targetTable,
  56. add,
  57. ondel,
  58. editTarget,
  59. importFile,
  60. detail_information,
  61. issue,
  62. adjustment,
  63. close
  64. },
  65. data () {
  66. return {
  67. mainData:{},
  68. mainAreaData:[],
  69. mainInfo:{},
  70. folderid:JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
  71. errorurl:null
  72. }
  73. },
  74. methods:{
  75. onTabClick () {
  76. // setTimeout(e=>{
  77. // this.$refs.list.queryData(this.mainData.year)
  78. // },2000)
  79. // console.log(this.$refs.list)
  80. this.$nextTick(e=>{
  81. this.$refs.list? this.$refs.list.queryData(this.mainData.year):''
  82. this.$refs.detailed? this.$refs.detailed.detailedList(this.mainData):''
  83. })
  84. },
  85. async queryMainData(id) {
  86. const res = await this.$api.requested({
  87. "id": 20220901140402,
  88. "content": {
  89. "sa_salestargetbillid": id
  90. }
  91. })
  92. this.mainData = res.data
  93. console.log(this.mainData)
  94. this.$refs.list.queryData(this.mainData.year)
  95. /*this.$refs.detailed.detailedList(this.mainData)*/
  96. this.changeDataStructure()
  97. },
  98. // 监听切换数据,上一页,下一页
  99. pageChange (id,rowindex) {
  100. this.flag = false
  101. this.$router.replace({path:'/personalTarget_edit',query:{id:id,rowindex:rowindex}})
  102. this.queryMainData(id)
  103. },
  104. changeDataStructure(){
  105. let that = this
  106. this.mainAreaData = [
  107. {
  108. label:'年度',
  109. value:this.mainData.year
  110. },
  111. {
  112. label:'编制方式',
  113. value:this.mainData.targettype
  114. },
  115. {
  116. label:'人员数',
  117. value:this.mainData.peoplecount
  118. },
  119. {
  120. label:'状态',
  121. value:this.mainData.status,
  122. style:function () {
  123. let style = {}
  124. switch (that.mainData.status) {
  125. case '新建':
  126. style = {color:'#3874f6'}
  127. break;
  128. case '已下达':
  129. style = {color:'#52c41a'}
  130. break;
  131. case '关闭':
  132. style = {color:'#333333'}
  133. break;
  134. default:
  135. break;
  136. }
  137. return style
  138. }
  139. }
  140. ]
  141. },
  142. onSuccess () {
  143. console.log("执行")
  144. this.queryMainData(this.$route.query.id)
  145. },
  146. async onImportSuccess (res) {
  147. let attachmentid = res.data.attachmentids[0]
  148. const res1 = await this.$api.requested({
  149. "id": 20220913092702,
  150. "content": {
  151. "attachmentid":attachmentid,
  152. "sa_salestargetbillid":this.$route.query.id,
  153. "year":this.mainData.year
  154. },
  155. })
  156. if (res1.msg !== '成功') {
  157. this.errorurl = res1.msg
  158. } else {
  159. this.errorurl = null
  160. }
  161. this.tool.showMessage(res1,()=>{
  162. this.mainData()
  163. })
  164. }
  165. },
  166. mounted () {
  167. this.queryMainData(this.$route.query.id)
  168. console.log("人员目标id"+this.$route.query.id)
  169. },
  170. created () {
  171. /*this.onlyread = this.$route.query.type === 'onlyread'?true:false*/
  172. }
  173. }
  174. </script>
  175. <style>
  176. </style>