index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <div class="container">
  3. <div class="mod-role" style="height:100%;overflow:auto;">
  4. <el-form :inline="true" @submit.native.prevent @keyup.enter.native="doSearch(1)" style="margin:20px 0px 0px 10px">
  5. <el-form-item>
  6. <el-input v-model="form.searchKey" placeholder="模型名称" clearable></el-input>
  7. </el-form-item>
  8. <el-form-item>
  9. <el-button icon="el-icon-search" type="primary" @click="doSearch(1)">查询</el-button>
  10. <el-button icon="el-icon-plus" type="primary" @click="doNew()">新增</el-button>
  11. <el-button icon="el-icon-upload2" type="primary" @click="doImport()">导入</el-button>
  12. <!-- <el-button icon="el-icon-upload2" type="primary" @click="doImport()">导入</el-button>
  13. <el-button icon="el-icon-download" type="primary" @click="download()">导出</el-button> -->
  14. <!-- 暂时禁用批量删除
  15. <el-button icon="el-icon-delete" type="danger" @click="doBatchDelete()" :disabled="selectedRows.length <= 0">批量删除</el-button>
  16. -->
  17. <!-- <el-button icon="el-icon-download" @click="doExportExcel()">导出</el-button> -->
  18. </el-form-item>
  19. </el-form>
  20. <el-table @selection-change="handleSelectionChange" :data="list" border ref="searchReulstList" style="width: 100%">
  21. <el-table-column align="center" type="selection" width="55"> </el-table-column>
  22. <el-table-column align="center" type="index" :index="index" label="行数" width="50"></el-table-column>
  23. <!-- <el-table-column align="center" prop="key" label="模型标志" width="180"></el-table-column> -->
  24. <el-table-column align="center" prop="name" label="模型名称"></el-table-column>
  25. <el-table-column align="center" prop="metaInfo" label="描述">
  26. <template slot-scope="scope">
  27. {{ scope.row.metaInfo ?JSON.parse(scope.row.metaInfo).description : '' }}
  28. </template>
  29. </el-table-column>
  30. <!-- <el-table-column align="center" prop="category" label="分类" ></el-table-column> -->
  31. <el-table-column align="center" prop="createTime" :formatter="$util.YYMM" label="时间"></el-table-column>
  32. <el-table-column align="center" prop="lastUpdateTime" :formatter="$util.YYMM" label="最后更新时间"></el-table-column>
  33. <el-table-column align="center" label="操作" fixed="right" width="250">
  34. <template slot-scope="scope">
  35. <!-- <el-button @click="doEdit(scope)" type="text" size="small">查看</el-button> -->
  36. <el-button @click="doCopy(scope)" type="text" size="small">复制</el-button>
  37. <el-button @click="doDesign(scope)" type="text" size="small">设计</el-button>
  38. <el-button @click="doDeploy(scope)" type="text" size="small">部署</el-button>
  39. <el-button @click="doDelete(scope)" type="text" size="small">删除</el-button>
  40. <!-- <el-button @click="dd" type="text" size="small">下载</el-button>
  41. <el-button @click="dd" type="text" size="small">上传</el-button> -->
  42. </template>
  43. </el-table-column>
  44. </el-table>
  45. <el-pagination style="margin:10px 10px 0px 10px;float:right" @current-change="doSearch" :page-size="form.rows" layout="total, prev, pager, next, jumper" :total="total"> </el-pagination>
  46. <!-- <t-grid ref="searchReulstList" :options="gridOptions" @selection-change="handleSelectionChange">
  47. </t-grid> -->
  48. <!-- 弹窗, 新增 / 修改 -->
  49. <edit-form v-if="editFormVisible" ref="editForm" @change="doSearch(1)"></edit-form>
  50. <import-form v-if="importFormVisible" ref="importForm" @change="doSearch(1)"></import-form>
  51. <design-form v-if="designFormVisible" ref="designForm"></design-form>
  52. <code-view-form v-if="codeViewFormVisible" ref="codeViewForm"></code-view-form>
  53. </div>
  54. </div>
  55. </template>
  56. <script>
  57. import EditForm from './edit'
  58. import DesignForm from './design'
  59. import CodeViewForm from './codeView'
  60. import ImportForm from './Import'
  61. import AproveStep from '../comWin/aproveStep'
  62. // 重发代办
  63. export default {
  64. data() {
  65. return {
  66. editFormVisible: false,
  67. designFormVisible: false,
  68. codeViewFormVisible: false,
  69. uploadFormVisible: false,
  70. importFormVisible: false,
  71. selectedRows: [],
  72. index(i) {
  73. return ++i
  74. },
  75. total: 0,
  76. list: [],
  77. form: {
  78. page: 1,
  79. rows: 10,
  80. searchKey: ''
  81. }
  82. }
  83. },
  84. components: {
  85. EditForm,
  86. AproveStep,
  87. DesignForm,
  88. CodeViewForm,
  89. ImportForm
  90. },
  91. created() {
  92. this.doSearch(1)
  93. },
  94. methods: {
  95. YYMM(row, column, cellValue) {
  96. return this.$util.datetimeFormat(cellValue)
  97. },
  98. doSearch(value) {
  99. this.importFormVisible = false
  100. this.form.page = value
  101. let self = this
  102. var obj = {
  103. url: this.$url.workflowdef.getList,
  104. data: this.form,
  105. type: 'post'
  106. }
  107. this.common.httpPost(obj, success)
  108. function success(data) {
  109. console.log(data);
  110. self.list = data.rows
  111. self.total = data.total
  112. }
  113. },
  114. doImport() {
  115. this.importFormVisible = true
  116. this.$nextTick(() => {
  117. console.log(this)
  118. this.$refs.importForm.init(null)
  119. })
  120. },
  121. doNew() {
  122. this.editFormVisible = true
  123. this.$nextTick(() => {
  124. this.$refs.editForm.init(null)
  125. })
  126. },
  127. // doImport() {
  128. // this.importFormVisible = true
  129. // this.$nextTick(() => {
  130. // console.log(this)
  131. // this.$refs.importForm.init(null)
  132. // })
  133. // },
  134. doEdit(row) {
  135. this.editFormVisible = true
  136. this.$nextTick(() => {
  137. this.$refs.editForm.init(row.row.id)
  138. })
  139. },
  140. doCopy(row) {
  141. row = row.row
  142. let self = this
  143. var obj = {
  144. url: this.$url.workflowdef.copyById,
  145. data: {
  146. id: row.id
  147. }
  148. }
  149. this.common.httpPost(obj, success)
  150. function success(data) {
  151. self.$notify.success({
  152. title: '操作成功',
  153. message: '模型已复制成功!'
  154. })
  155. self.doSearch(1)
  156. }
  157. // tapp.services.wf_Model.copy(row.id).then(function(result) {
  158. // self.$notify.success({
  159. // title: '操作成功',
  160. // message: '模型已复制成功!'
  161. // });
  162. // self.$refs.searchReulstList.refresh();
  163. // })
  164. },
  165. doDesign(row) {
  166. row = row.row
  167. this.designFormVisible = true
  168. this.$nextTick(() => {
  169. this.$refs.designForm.init(row.id)
  170. })
  171. },
  172. doViewCode(row) {
  173. this.codeViewFormVisible = true
  174. console.log(row)
  175. this.$nextTick(() => {
  176. this.$refs.codeViewForm.init(row.key)
  177. })
  178. },
  179. download() {
  180. console.log(this.$url)
  181. window.location.href = this.$url.workflowdef.getExportFile
  182. },
  183. doDeploy(row) {
  184. row = row.row
  185. let self = this
  186. var obj = {
  187. url: this.$url.workflowdef.deploy,
  188. data: {
  189. modelId: row.id
  190. }
  191. }
  192. this.common.httpPost(obj, success)
  193. function success(data) {
  194. self.$notify.success({
  195. title: '操作成功',
  196. message: '模型已部署成功!'
  197. })
  198. self.doSearch(1)
  199. }
  200. },
  201. doDelete(row) {
  202. row = row.row
  203. let self = this
  204. var obj = {
  205. url: this.$url.workflowdef.deleteModelById,
  206. data: {
  207. id: row.id
  208. }
  209. }
  210. this.common.httpPost(obj, success)
  211. function success(data) {
  212. self.$notify.success({
  213. title: '操作成功',
  214. message: '模型已删除!'
  215. })
  216. self.doSearch(1)
  217. }
  218. },
  219. handleSelectionChange(val) {
  220. this.selectedRows = val
  221. },
  222. doBatchDelete() {
  223. let self = this
  224. if (!self.selectedRows || self.selectedRows.length == 0) {
  225. self.$notify.info({
  226. title: '系统提示',
  227. message: '您没选择任何行,无法操作!'
  228. })
  229. return
  230. }
  231. let ids = new Array()
  232. // ids[0] = '5';
  233. // for(let i=0;i<self.selectedRows.length;i++){
  234. // ids.push(self.selectedRows[i].id)
  235. // }
  236. self.selectedRows.map(function(row) {
  237. ids.push(row.id)
  238. })
  239. ids = ids.join(',')
  240. console.log(ids)
  241. self.$confirm('此操作将永久删除' + ids.length + '个模型, 是否继续?', '提示', {
  242. confirmButtonText: '确定',
  243. cancelButtonText: '取消',
  244. type: 'warning'
  245. }).then(() => {
  246. var obj = {
  247. url: this.$url.workflowdef.del,
  248. data: {
  249. ids: ids
  250. }
  251. }
  252. this.common.httpPost(obj, success)
  253. function success(data) {
  254. self.$notify.success({
  255. title: '操作成功',
  256. message: '模型已删除成功!'
  257. })
  258. self.doSearch(1)
  259. }
  260. })
  261. },
  262. doExportExcel() {
  263. this.$refs.searchReulstList.exportCSV('模型列表')
  264. }
  265. // ,
  266. // doSearch(value) {
  267. // this.form.page = value;
  268. // let self = this;
  269. // var obj ={
  270. // url:this.$url.workflowdef.getList,
  271. // data:this.form
  272. // }
  273. // this.common.httpPost(obj,success);
  274. // function success(data){
  275. // self.list = data.data.rows
  276. // self.total = data.data.total
  277. // }
  278. // }
  279. }
  280. }
  281. </script>
  282. <style lang="scss" scoped>
  283. ::v-deep .el-table td, .el-table th{
  284. padding: 3px 0px;
  285. }
  286. </style>