versionDefinition.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <div>
  3. <el-button size="small" type="primary" @click="onShow">版本定义</el-button>
  4. <el-drawer
  5. style="color: #333!important"
  6. title="版本定义"
  7. :visible.sync="dialogVisible"
  8. size="90%"
  9. direction="rtl"
  10. :show-close="false"
  11. append-to-body
  12. >
  13. <div class="drawer__panel">
  14. <el-row :gutter="20">
  15. <el-col :span="8">
  16. <div style="width: 100%;">
  17. <el-button size="mini" icon="el-icon-plus" type="primary" @click="addVersion" :disabled="isSave">新 增</el-button>
  18. <el-table
  19. class="table-style"
  20. ref="singleTable"
  21. :data="versionData"
  22. style="width: 100%" border
  23. :height="height ? height : versionData.length <= 4?'260px':versionData.length <= 20?'calc(100vh - 420px)':'calc(100vh - 220px)'"
  24. :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}"
  25. :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
  26. @row-click="rowClick"
  27. highlight-current-row
  28. @current-change="onHandleCurrentChange">
  29. <el-table-column
  30. prop="partitionname"
  31. label="版本名称"
  32. >
  33. <template slot-scope="scope">
  34. <el-input size="small" placeholder="输入版本名称" v-model="scope.row.partitionname" v-if="isSave && scope.row.rowindex === index"></el-input>
  35. <span v-else>{{scope.row.partitionname}}</span>
  36. </template>
  37. </el-table-column>
  38. <el-table-column
  39. label="操作"
  40. width="120">
  41. <template slot-scope="scope">
  42. <el-button size="mini" type="text" class="inline-16" v-if="scope.row.rowindex !== index" @click="onEdit(scope.row)">编 辑</el-button>
  43. <el-button size="mini" type="text" v-if="scope.row.rowindex !== index" @click="onDel(scope.row.sys_site_systempartitionid)">删 除</el-button>
  44. <el-button size="mini" type="text" v-if="isSave && scope.row.rowindex === index" @click="onSave(scope.row)">保 存</el-button>
  45. </template>
  46. </el-table-column>
  47. </el-table>
  48. </div>
  49. </el-col>
  50. <el-col :span="16">
  51. <div >
  52. <addVersionModules :rowData="rowData" @addSuccess="addSuccess"></addVersionModules>
  53. <el-table
  54. class="table-style"
  55. :data="systemModule"
  56. style="width: 100%" border
  57. :height="height ? height : systemModule.length <= 4?'260px':systemModule.length <= 20?'calc(100vh - 420px)':'calc(100vh - 220px)'"
  58. :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}"
  59. :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}">
  60. <el-table-column
  61. prop="systemclient"
  62. label="端口"
  63. >
  64. </el-table-column>
  65. <el-table-column
  66. prop="systemname"
  67. label="系统名称"
  68. >
  69. </el-table-column>
  70. <el-table-column
  71. prop="systemmodulename"
  72. label="模块名称"
  73. >
  74. </el-table-column>
  75. <el-table-column
  76. prop="systemappname"
  77. label="应用名称"
  78. >
  79. </el-table-column>
  80. <el-table-column
  81. prop="name"
  82. label="操作"
  83. width="100">
  84. <template slot-scope="scope">
  85. <el-popconfirm
  86. title="确定删除这个模块功能吗?"
  87. @confirm="onModulesDel(scope.row)"
  88. >
  89. <el-button size="mini" type="text" slot="reference">删 除</el-button>
  90. </el-popconfirm>
  91. </template>
  92. </el-table-column>
  93. </el-table>
  94. </div>
  95. </el-col>
  96. </el-row>
  97. </div>
  98. </el-drawer>
  99. </div>
  100. </template>
  101. <script>
  102. import addVersionModules from './addVersionModules'
  103. export default {
  104. name: "versionDefinition",
  105. components:{addVersionModules},
  106. data(){
  107. return {
  108. dialogVisible:false,
  109. rowData:'',
  110. versionData:[],
  111. systemModule:[],
  112. versionParam:{
  113. "classname": "webmanage.site.systempartition",
  114. "method": "list",
  115. "content": {
  116. "pageNumber": 1,
  117. "pageSize": 99,
  118. "where": {
  119. "condition": ""
  120. }
  121. },
  122. },
  123. param:{
  124. "classname": "webmanage.site.systempartition",
  125. "method": "detail",
  126. "content": {
  127. "pageNumber": 1,
  128. "pageSize": 99,
  129. "sys_site_systempartitionid": '',
  130. "where": {
  131. "condition": ""
  132. }
  133. }
  134. },
  135. currentPage:0,
  136. total:0,
  137. currentPageVersion:0,
  138. totalVersion:0,
  139. height:'',
  140. isSave:false,
  141. index:'',
  142. currentRow: null,
  143. rowId:''
  144. }
  145. },
  146. methods:{
  147. /*查询版本详细信息*/
  148. async queryData(id){
  149. this.param.content.sys_site_systempartitionid = id
  150. const res = await this.$api.requested(this.param)
  151. this.systemModule = res.data.systemapp
  152. this.currentPage = res.pageNumber
  153. this.total = res.total
  154. },
  155. onShow(){
  156. this.dialogVisible = true
  157. this.rowId = 0
  158. this.listData()
  159. },
  160. /*查询版本信息*/
  161. async listData(){
  162. const res = await this.$api.requested(this.versionParam)
  163. this.versionData = res.data
  164. this.currentPageVersion = res.pageNumber
  165. this.totalVersion = res.total
  166. this.$refs.singleTable.setCurrentRow(this.versionData[this.rowId])
  167. this.queryData(this.versionData[this.rowId].sys_site_systempartitionid)
  168. this.rowData = this.versionData[this.rowId]
  169. },
  170. /*新增版本*/
  171. addVersion(){
  172. this.versionData.push({
  173. "partitionname": "",
  174. "sys_site_systempartitionid": 0,
  175. "rowindex": this.versionData.length + 1,
  176. "systemappids": [
  177. ]
  178. })
  179. this.isSave = true
  180. this.index = this.versionData[this.versionData.length -1].rowindex
  181. },
  182. onEdit(val){
  183. if (this.versionData[this.versionData.length-1].partitionname === ''){
  184. this.$message.error('版本名称不能为空');
  185. }else {
  186. this.isSave = true
  187. this.index = val.rowindex
  188. }
  189. },
  190. async onSave(val){
  191. if (val.partitionname === ''){
  192. this.$message.error('版本名称不能为空');
  193. }else {
  194. const res = await this.$api.requested({
  195. "classname": "webmanage.site.systempartition",
  196. "method": "insertOrUpdate",
  197. "content": val
  198. })
  199. this.tool.showMessage(res,()=>{
  200. this.isSave = false
  201. this.index = ''
  202. this.listData()
  203. })
  204. }
  205. },
  206. /*删除版本*/
  207. onDel(id){
  208. this.$confirm('此操作将永久删除该版本, 是否继续?', '提示', {
  209. confirmButtonText: '确定',
  210. cancelButtonText: '取消',
  211. type: 'warning'
  212. }).then(async() => {
  213. const res = await this.$api.requested({
  214. "classname": "webmanage.site.systempartition",
  215. "method": "delete",
  216. "content": {
  217. "sys_site_systempartitionid": id
  218. },
  219. })
  220. this.tool.showMessage(res,()=>{
  221. this.listData()
  222. })
  223. }).catch(() => {
  224. this.$message({
  225. type: 'info',
  226. message: '已取消删除'
  227. });
  228. });
  229. },
  230. /*删除版本明细模块*/
  231. async onModulesDel(val){
  232. const res = await this.$api.requested({
  233. "classname": "webmanage.site.systempartition",
  234. "method": "deleteMX",
  235. "content": {
  236. "sys_site_systempartitionid": this.rowData.sys_site_systempartitionid,
  237. "systemappids": [val.systemappid]
  238. },
  239. })
  240. this.tool.showMessage(res,()=>{
  241. this.listData()
  242. })
  243. },
  244. rowClick(val){
  245. this.queryData(val.sys_site_systempartitionid)
  246. this.rowData = val
  247. this.rowId = val.rowindex -1
  248. },
  249. onHandleCurrentChange(val){
  250. this.currentRow = val
  251. },
  252. addSuccess(){
  253. this.listData()
  254. }
  255. }
  256. }
  257. </script>
  258. <style scoped>
  259. /deep/ .el-drawer__header {
  260. align-items: center;
  261. color: #333;
  262. display: flex;
  263. font-weight: 700!important;
  264. margin-bottom: 12px;
  265. margin-top: -12px;
  266. }
  267. .table-style{
  268. margin-top: 20px;
  269. }
  270. </style>