index.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <div v-if="refreshPage" style="min-width:1200px">
  3. <div style="margin:10px 10px 0 10px;border-radius:5px" class="container normal-panel sticky" @click="closeTags">
  4. <div class="flex-align-start flex-between normal-margin" style="flex-wrap:nowrap">
  5. <div>
  6. <p class="main_title mt-10">{{titleText?titleText:'##'}}</p>
  7. <tagTemp v-if="activeApp.isdatatag" ref="tag" :ownertable="ownertable?ownertable:idname.slice(0, this.idname.length - 2)" @onSuccess="onSuccess"></tagTemp>
  8. </div>
  9. <div class="flex-align-center" style="flex: 1 0 auto; justify-content: flex-end;">
  10. <cpEdit v-if="tool.checkAuth($route.name,'update')" :formPath="formPath" :oldFormPath="oldFormPath" :data="editData" btnType="default" @onAddSuccess="onSuccess"></cpEdit>
  11. <!-- 打印 -->
  12. <reportCenter position="detail" class="inline-16" :data="reportCenterLsit" v-if="reportCenterLsit.length > 0 && systemappid != 163">
  13. <template v-slot:print="scope2">
  14. <el-button @click="printBtn($route.query.id,scope2.data)" type="text" size="mini">打 印</el-button>
  15. </template>
  16. </reportCenter>
  17. <div>
  18. <slot name="customOperation"></slot>
  19. </div>
  20. <el-button v-if="tool.checkAuth($route.name,'delete') && delApiId" :type="checkDisabled()?'':'primary'" class="inline-16" size="mini" :disabled="checkDisabled()" @click="deleteData">删 除</el-button>
  21. <div v-if="!pageChange">
  22. <el-button :disabled="rowindex === 1" size="mini" icon="el-icon-arrow-left" @click="previous()"></el-button>
  23. <el-button :disabled="rowindex === total" size="mini" @click="next()"><i class="el-icon-arrow-right"></i></el-button>
  24. </div>
  25. </div>
  26. </div>
  27. <div>
  28. <slot name="d_head"></slot>
  29. </div>
  30. <div>
  31. <el-descriptions :column="5" size="mini">
  32. <el-descriptions-item label-class-name="my-label-layout" content-class-name="my-content" v-for="item in mainAreaData" :key="item.index" :label="item.label"><span :style="item.style?item.style():''">{{item.value !== ''?item.value:'--'}}</span></el-descriptions-item>
  33. </el-descriptions>
  34. </div>
  35. </div>
  36. <div style="box-sizing: border-box;padding:10px">
  37. <el-row class="flex-align-stretch no-wrap" :gutter="activeApp.isdatateam?10:activeApp.isdatafollowup?10:0">
  38. <el-col style="flex:1 0 auto;" :span="activeApp.isdatateam?18:activeApp.isdatafollowup?18:24">
  39. <slot name="customBefore"></slot>
  40. <tabTemp :tabs="tabs" :editData="editData" :idname="idname" :ownertable="ownertable?ownertable:idname.slice(0, this.idname.length - 2)" @onTabClick="onTabClick">
  41. <div :slot="'slot' + index" v-for="(tab,index) in tabs" :key="tab.index">
  42. <slot :name="'slot' + index"></slot>
  43. </div>
  44. </tabTemp>
  45. <slot name="custom"></slot>
  46. </el-col>
  47. <el-col v-if="collapse" style="width:400px;" :span="6">
  48. <taskTemp v-if="activeApp.isdatateam" :ownertable="ownertable?ownertable:idname.slice(0, this.idname.length - 2)">
  49. <el-button slot="collapse" type="text" icon="el-icon-s-unfold" class="inline-16" @click="onCollapse"></el-button>
  50. </taskTemp>
  51. <group v-if="activeApp.isdatateam" ref="group" style="margin-bottom:10px" :ownertable="ownertable?ownertable:idname.slice(0, this.idname.length - 2)" @onSuccess="onSuccess">
  52. <el-button slot="collapse" type="text" icon="el-icon-s-unfold" class="inline-16" @click="onCollapse"></el-button>
  53. </group>
  54. <follow-up v-if="activeApp.isdatafollowup" ref="follow" :ownertable="ownertable?ownertable:idname.slice(0, this.idname.length - 2)">
  55. <el-button slot="collapse" type="text" icon="el-icon-s-unfold" class="inline-16" @click="onCollapse"></el-button>
  56. </follow-up>
  57. </el-col>
  58. <div v-else style="text-align-center" class="container normal-panel">
  59. <el-button slot="collapse" type="text" icon="el-icon-s-fold" @click="onCollapse"></el-button>
  60. </div>
  61. </el-row>
  62. </div>
  63. </div>
  64. </template>
  65. <script>
  66. import cpEdit from '../modules/cpEdit.vue'
  67. import followUp from './modules/followUp/followUp.vue'
  68. import tagTemp from './modules/tags/tag.vue'
  69. import tabTemp from './modules/tabs/tab.vue'
  70. import group from './modules/group/group.vue'
  71. import taskTemp from './modules/task/index.vue'
  72. import reportCenter from '../reportCenter/index'
  73. import {mapGetters} from 'vuex'
  74. export default {
  75. props:['titleText','mainAreaData','turnPageId','delApiId','idname','ownertable','formPath','oldFormPath','editData','tags','tabs','statusCheck','pageChange'],
  76. data () {
  77. return {
  78. routerName:'',
  79. rowindex:0,
  80. total:0,
  81. param:{
  82. "id": '',
  83. "content": {
  84. "isExport":false,
  85. "pageNumber": 1,
  86. "pageSize": 1,
  87. "nocache": true,
  88. "where": {
  89. "condition": ""
  90. }
  91. }
  92. },
  93. collapse:true,
  94. refreshPage:true,
  95. reportCenterLsit:[],
  96. systemappid:JSON.parse(sessionStorage.getItem('activeApp')).systemappid,
  97. }
  98. },
  99. computed:{
  100. ...mapGetters({
  101. activeApp:"activeApp"
  102. })
  103. },
  104. components:{
  105. cpEdit,
  106. followUp,
  107. group,
  108. tagTemp,
  109. tabTemp,
  110. taskTemp,
  111. reportCenter
  112. },
  113. methods:{
  114. async queryData (pageNumber) {
  115. /* 暴露请求配置 进行修改 */
  116. this.$emit('updateParam',this.param)
  117. this.param.id = this.turnPageId
  118. this.param.content.pageNumber = pageNumber
  119. const res = await this.$api.requested(this.param)
  120. this.total = res.total
  121. this.$emit('pageChange',res.data[0][this.idname],res.data[0].rowindex)
  122. this.$refs['tag']?this.$refs['tag'].queryTag():''
  123. this.refresh()
  124. },
  125. /* 获取是否有报表数据 */
  126. async getSystemAppid () {
  127. let res = await this.$api.requested({
  128. "id":20221213094401,
  129. "content": {
  130. "systemappid":this.systemappid,
  131. }
  132. })
  133. this.reportCenterLsit = res.data
  134. console.log(res,'报表数据');
  135. },
  136. async printBtn (data,data2) {
  137. let res = await this.$api.requested({
  138. "id":20221213094501,
  139. "content": {
  140. sys_reportid:data2.sys_reportid,
  141. dataid:data[this.idName]
  142. }
  143. })
  144. this.tool.showMessage(res,() => {
  145. window.open(this.$baseUrl + res.data)
  146. })
  147. },
  148. next () {
  149. this.rowindex += 1
  150. this.queryData(this.rowindex)
  151. },
  152. previous () {
  153. this.rowindex -= 1
  154. this.queryData(this.rowindex)
  155. },
  156. onSuccess () {
  157. this.$emit('onEditSuccess')
  158. },
  159. deleteData () {
  160. this.$confirm('确定删除当前数据吗?', '提示', {
  161. confirmButtonText: '确定',
  162. cancelButtonText: '取消',
  163. type: 'warning'
  164. }).then(async () => {
  165. let param = {
  166. "id": this.delApiId,
  167. "content":{}
  168. }
  169. if (this.idname instanceof Array) { //判断传入的类型是多个还是单个idname
  170. let obj = {}
  171. this.idname.forEach(e=>{
  172. obj[e] = ''
  173. })
  174. param.content[`${this.idname[0]}s`] = [Object.keys(obj).map((key,item)=>{
  175. obj[key] = this.editData[key]
  176. })]
  177. } else {
  178. param.content[`${this.idname}s`] = [this.editData[this.idname]]
  179. }
  180. const res = await this.$api.requested(param)
  181. this.tool.showMessage(res,()=>{
  182. this.$store.dispatch('changeDetailDrawer',false)
  183. })
  184. }).catch((err) => {
  185. console.log(err)
  186. this.$message({
  187. type: 'info',
  188. message: '已取消删除'
  189. });
  190. });
  191. },
  192. checkDisabled () {
  193. if (this.statusCheck) {
  194. let _isSame = this.statusCheck.some(item=>item.value === this.editData[item.key])
  195. return _isSame
  196. } else {
  197. return false
  198. }
  199. },
  200. onTabClick () {
  201. this.$emit('onTabClick')
  202. },
  203. onCollapse () {
  204. this.collapse?this.collapse = false:this.collapse = true
  205. },
  206. refresh () {
  207. this.refreshPage = false
  208. setTimeout(() => {
  209. this.refreshPage = true
  210. }, 10);
  211. },
  212. refreshTag () {
  213. this.$refs.tag.queryTag()
  214. },
  215. closeTags() {
  216. this.$refs.tag?this.$refs.tag.closeTag():''
  217. }
  218. },
  219. mounted () {
  220. },
  221. created () {
  222. this.$emit('detailCreate',this.param)
  223. this.routerName = this.$route.meta.title
  224. this.rowindex = Number(this.$route.query.rowindex)
  225. this.getSystemAppid()
  226. },
  227. watch:{
  228. mainAreaData () {
  229. }
  230. }
  231. }
  232. </script>
  233. <style>
  234. .detail__head__label{
  235. display: inline-block;
  236. width: 70px;
  237. }
  238. .my-label-layout{
  239. font-size: 14px;
  240. color: #999;
  241. }
  242. </style>
  243. <style scoped>
  244. .appname{
  245. display: inline;
  246. background: #FA8C19;
  247. color:#fff;
  248. border-radius: 4px;
  249. padding: 2px 10px;
  250. font-size: 12px;
  251. }
  252. .my-tabs{
  253. background:#eeeeee
  254. }
  255. .sticky{
  256. position: sticky;
  257. top:0;
  258. }
  259. .no-wrap{
  260. flex-wrap:nowrap !important;
  261. }
  262. .main_title{
  263. font-size:30px;
  264. font-weight:300;
  265. margin-right:16px;
  266. line-height: 2rem;
  267. }
  268. </style>