From d437a2e4733066e9815b8091e4d2444c291d22db Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期三, 20 十二月 2023 19:22:53 +0800
Subject: [PATCH] 统计分析数据列表渲染
---
Source/UBCS-WEB/src/components/template/FlowPath.vue | 439 ++++++++++++++++++++++++++++++------------------------
1 files changed, 241 insertions(+), 198 deletions(-)
diff --git a/Source/UBCS-WEB/src/components/template/FlowPath.vue b/Source/UBCS-WEB/src/components/template/FlowPath.vue
index 24ccf03..f5cfaee 100644
--- a/Source/UBCS-WEB/src/components/template/FlowPath.vue
+++ b/Source/UBCS-WEB/src/components/template/FlowPath.vue
@@ -1,209 +1,252 @@
<template>
- <avue-crud ref="crud" :table-loading="loading" :data="data" v-model="form" :option="option" :page.sync="page"
- :search.sync="search" @on-load="getDataList" @row-save="handleSave" @row-del="handleDelete"
- @row-update="handleEdit" @refresh-change="handleRefresh" @size-change="handleSizePage"
- @current-change="handleCurrentPage">
- </avue-crud>
+ <div style="height: calc(100vh - 553px)">
+ <avue-crud v-if="Formlist.length>0" ref="crud" v-model="form" :data="data" :option="option" :page.sync="page"
+ :search.sync="search" :table-loading="loading" @on-load="getDataList" @row-save="handleSave"
+ @row-del="handleDelete" @row-update="handleEdit" @refresh-change="handleRefresh"
+ @size-change="handleSizePage" @current-change="handleCurrentPage">
+ </avue-crud>
+ </div>
+
</template>
<script>
-import { getFlowpathList, getStartList, flowpathSave, flowpathDelete } from '@/api/template/flowpath.js'
+import {getFlowpathList, getStartList, flowpathSave, flowpathDelete} from '@/api/template/flowpath.js'
+
export default {
- name: 'FlowPath',
- props: {
- code: {
- typeof: String,
- required: true,
- default: ""
- }
+ name: 'FlowPath',
+ props: {
+ checkStatus: {
+ type: Boolean,
+ default: false
},
- data() {
- return {
- loading: false,
- page: {
- currentPage: 1,
- pageSize: 10,
- total: 0
- },
- search: {},
- delIds: [],
- data: [],
- startData: [],
- form: {},
- option: {
- height: "auto",
- border: true,
- align: 'center',
- menuAlign: 'center',
- index: true,
- searchMenuSpan: 8,
- searchBtn: false,
- emptyBtn: false,
- columnBtn: false,
- defaultSort: {
- prop: 'id,name,description,version',
- order: 'descending'
- },
- column: [
- {
- label: '妯℃澘key',
- prop: 'modelKey',
- width:120,
- sortable: true,
- type: 'tree',
- dicData: [],
- props: {
- label: "key",
- value: "key"
- },
- rules: [{
- required: true,
- message: '妯℃澘key涓嶈兘涓虹┖',
- trigger: 'blur'
- }],
- nodeClick: (data) => {
- console.log(data)
- // 鑺傜偣鐐瑰嚮鐨勬椂鍊欎細鑾峰彇鍒版暟鎹�
- this.form.modelName = data.name
- }
- }, {
- label: '妯℃澘鍚嶇О',
- prop: 'modelName',
- sortable: true,
- width:220,
- addDisabled: true,
- editDisabled: true,
- },
- {
- label: '妯℃澘鐢ㄩ��',
- prop: 'buttonTypeKey',
- type: 'tree',
- width:120,
- dicUrl: '/api/ubcs-flow/processTS/tt',
- dicMethod: 'post',
- props: {
- value: "codee",
- label: "namee",
- },
- },
- {
- label: '妯℃澘鎻忚堪',
- prop: 'description',
- type:'textarea'
- },
- ]
- },
- }
+ crudLCStatus: {
+ type: String,
+ default: 'Editing'
},
- created() {
- this.getStart()
+ code: {
+ typeof: String,
+ required: true,
+ default: ""
},
- methods: {
- async getStart() {
- const response = await getStartList()
- if (response.status === 200) {
- console.log(response.data.data.records)
- const data = response.data.data.records
- let newData = data.map(item => {
- const { key, name, version } = item
- return { key, name, version }
- })
- this.option.column[0].dicData = newData
-
- }
- },
- // 鑾峰彇鍒楄〃
- async getDataList() {
- this.loading = false
- console.log(this.search)
- const { pageSize, currentPage } = this.page
- let param = { size: pageSize, current: currentPage }
- const response = await getFlowpathList({ ...param, ...{ templateId: this.code } })
- if (response.status === 200) {
- console.log(response)
- this.loading = false
- const data = response.data.data
- this.data = data.records
- this.page.total = data.total
- } else this.loading = false
- },
- // 鏂板
- async handleSave(row, done, loading) {
- console.log(row)
- const response = await flowpathSave({ ...row, ...{ templateId: this.code } })
- if (response.status === 200) {
- loading()
- console.log(response)
- this.$message({
- type: 'success',
- message: '鏂板鏁版嵁鎴愬姛锛�'
- })
- done()
- this.getDataList()
- }
-
- },
- // 缂栬緫
- async handleEdit(row, index, done, loading) {
- console.log(row)
- const { modelName, modelKey, buttonTypeKey, id ,description} = row
- let param = { modelName, modelKey, buttonTypeKey, id,description }
- const response = await flowpathSave({ ...param, ...{ templateId: this.code } })
- if (response.status === 200) {
- loading()
- this.$message({
- type: 'success',
- message: '淇敼鏁版嵁鎴愬姛锛�'
- })
- done()
- this.getDataList()
- }
-
- },
- // 鍒犻櫎鍗曟潯
- handleDelete(row) {
- console.log(row)
- const { id } = row
- this.deleteSysInfo({ id: id })
- },
- // 鍒犻櫎鎺ュ彛
- deleteSysInfo(param) {
- this.$confirm('鏄惁纭畾鍒犻櫎閫夋嫨鐨勬ā鏉挎祦绋�?', '鎻愮ず', {
- confirmButtonText: '纭畾',
- cancelButtonText: '鍙栨秷',
- type: 'warning'
- }).then(async () => {
- // 鎺ュ彛
- const response = await flowpathDelete(param)
- if (response.status === 200) {
- console.log(response)
- this.$message({
- type: 'success',
- message: '鍒犻櫎鎴愬姛!'
- });
- this.getDataList()
- }
- })
- },
- // enter鎼滅储
- handleEnter() {
- if (this.search[this.selectValue] === '') return
- else this.getDataList()
- },
- // 杈撳叆妗嗘竻绌�
- handleClear() {
-
- },
- // 鍒锋柊鎸夐挳
- handleRefresh() {
- this.getDataList()
- },
- handleSizePage(event) {
- this.page.pageSize = event
- },
- handleCurrentPage(event) {
- this.page.currentPage = event
- },
+ Formlist: {
+ type: Array,
+ default: []
}
+ },
+ data() {
+ return {
+ loading: false,
+ page: {
+ currentPage: 1,
+ pageSize: 10,
+ total: 0
+ },
+ search: {},
+ delIds: [],
+ data: [],
+ startData: [],
+ form: {},
+ option: {
+ height: 'auto',
+ border: true,
+ align: 'center',
+ menu: !this.checkStatus || this.crudLCStatus == 'Editing',
+ menuAlign: 'center',
+ index: true,
+ searchMenuSpan: 8,
+ searchBtn: false,
+ refreshBtn: false,
+ emptyBtn: false,
+ columnBtn: false,
+ editBtn: !this.checkStatus || this.crudLCStatus == 'Editing',
+ delBtn: !this.checkStatus || this.crudLCStatus == 'Editing',
+ addBtn: !this.checkStatus || this.crudLCStatus == 'Editing',
+ defaultSort: {
+ prop: 'id,name,description,version',
+ order: 'descending'
+ },
+ column: [
+ {
+ label: '妯℃澘key',
+ prop: 'modelKey',
+ width: 120,
+ sortable: true,
+ type: 'tree',
+ dicData: [],
+ props: {
+ label: "key",
+ value: "key"
+ },
+ rules: [{
+ required: true,
+ message: '妯℃澘key涓嶈兘涓虹┖',
+ trigger: 'blur'
+ }],
+ nodeClick: (data) => {
+ // 鑺傜偣鐐瑰嚮鐨勬椂鍊欎細鑾峰彇鍒版暟鎹�
+ this.form.modelName = data.name
+ }
+ }, {
+ label: '妯℃澘鍚嶇О',
+ prop: 'modelName',
+ sortable: true,
+ width: 220,
+ addDisabled: true,
+ editDisabled: true,
+ },
+ {
+ label: '妯℃澘鐢ㄩ��',
+ prop: 'buttonTypeKey',
+ type: 'tree',
+ width: 120,
+ dicUrl: '/api/ubcs-flow/processTS/tt',
+ dicMethod: 'post',
+ props: {
+ value: "codee",
+ label: "namee",
+ },
+ },
+ {
+ label: '妯℃澘鎻忚堪',
+ prop: 'description',
+ type: 'textarea'
+ },
+ ]
+ }
+ }
+ },
+ created() {
+ this.getStart()
+ },
+ watch: {
+ code: {
+ handler(newval, oldval) {
+ this.getDataList()
+ }
+ },
+ checkStatus: {
+ handler(newval, oldval) {
+ this.option.delBtn = !this.checkStatus || this.crudLCStatus == 'Editing';
+ this.option.editBtn = !this.checkStatus || this.crudLCStatus == 'Editing';
+ this.option.addBtn = !this.checkStatus || this.crudLCStatus == 'Editing';
+ }
+ },
+ crudLCStatus: {
+ handler(newval, oldval) {
+ this.option.delBtn = !this.checkStatus || this.crudLCStatus == 'Editing';
+ this.option.editBtn = !this.checkStatus || this.crudLCStatus == 'Editing';
+ this.option.addBtn = !this.checkStatus || this.crudLCStatus == 'Editing';
+ }
+ }
+ },
+ methods: {
+ async getStart() {
+ const response = await getStartList()
+ if (response.status === 200) {
+ const data = response.data.data.records
+ let newData = data.map(item => {
+ const {key, name, version} = item
+ return {key, name, version}
+ })
+ this.option.column[0].dicData = newData
+
+ }
+ },
+ // 鑾峰彇鍒楄〃
+ async getDataList() {
+ this.loading = false
+ if (this.code) {
+ const {pageSize, currentPage} = this.page
+ let param = {size: pageSize, current: currentPage}
+ const response = await getFlowpathList({...param, ...{templateId: this.code}})
+ if (response.status === 200) {
+ this.loading = false
+ const data = response.data.data
+ this.data = data.records
+ this.page.total = data.total
+ } else this.loading = false
+ } else {
+ this.data = []
+ }
+
+ },
+ // 鏂板
+ async handleSave(row, done, loading) {
+ await flowpathSave({...row, ...{templateId: this.code}}).then(response => {
+ if (response.status === 200) {
+ this.$message({
+ type: 'success',
+ message: '鏂板鏁版嵁鎴愬姛锛�'
+ })
+ done()
+ this.getDataList()
+ }
+ }).catch(res => {
+ loading()
+ })
+
+ },
+ // 缂栬緫
+ async handleEdit(row, index, done, loading) {
+ const {modelName, modelKey, buttonTypeKey, id, description} = row
+ let param = {modelName, modelKey, buttonTypeKey, id, description}
+ await flowpathSave({...param, ...{templateId: this.code}}).then(response => {
+ if (response.status === 200) {
+ this.$message({
+ type: 'success',
+ message: '淇敼鏁版嵁鎴愬姛锛�'
+ })
+ done()
+ this.getDataList()
+ }
+ }).catch(() => {
+ //loading鎺у埗绂佺敤 榛樿鏄紑鍚�
+ loading()
+ })
+
+ },
+ // 鍒犻櫎鍗曟潯
+ handleDelete(row) {
+ const {id} = row
+ this.deleteSysInfo({id: id})
+ },
+ // 鍒犻櫎鎺ュ彛
+ deleteSysInfo(param) {
+ this.$confirm('鏄惁纭畾鍒犻櫎閫夋嫨鐨勬ā鏉挎祦绋�?', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(async () => {
+ // 鎺ュ彛
+ const response = await flowpathDelete(param)
+ if (response.status === 200) {
+ this.$message({
+ type: 'success',
+ message: '鍒犻櫎鎴愬姛!'
+ });
+ this.getDataList()
+ }
+ })
+ },
+ // enter鎼滅储
+ handleEnter() {
+ if (this.search[this.selectValue] === '') return
+ else this.getDataList()
+ },
+ // 杈撳叆妗嗘竻绌�
+ handleClear() {
+
+ },
+ // 鍒锋柊鎸夐挳
+ handleRefresh() {
+ this.getDataList()
+ },
+ handleSizePage(event) {
+ this.page.pageSize = event
+ },
+ handleCurrentPage(event) {
+ this.page.currentPage = event
+ },
+ }
}
</script>
--
Gitblit v1.9.3