123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- <template>
- <div class="flow-manage">
- <div class="part-box part-box-filter part-box-flex">
- <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
- <template v-if="checkPrivilege('condition', 'condition')">
- <el-form-item label="名称:">
- <el-input
- style="width: 200px;"
- v-model.trim="filter.name"
- placeholder="请输入内容"
- clearable
- ></el-input>
- </el-form-item>
- </template>
- <el-form-item>
- <el-button
- v-if="checkPrivilege('button', 'select')"
- type="primary"
- @click="toPage(1)"
- >查询</el-button
- >
- </el-form-item>
- </el-form>
- <div class="part-box-action">
- <el-button
- v-if="!checkPrivilege('button', 'add')"
- type="primary"
- icon="el-icon-circle-plus-outline"
- @click="toAdd"
- >添加流程</el-button
- >
- </div>
- </div>
- <div class="part-box part-box-pad">
- <el-table ref="TableList" :data="dataList">
- <el-table-column
- type="index"
- label="序号"
- width="70"
- :index="indexMethod"
- ></el-table-column>
- <el-table-column prop="name" label="流程名称"></el-table-column>
- <el-table-column class-name="action-column" label="操作" width="120px">
- <template slot-scope="scope">
- <el-button
- v-if="checkPrivilege('link', 'delete')"
- class="btn-danger"
- type="text"
- @click="toDelete(scope.row)"
- >删除</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- <div class="part-page">
- <el-pagination
- background
- layout="total,prev, pager, next"
- :current-page="current"
- :total="total"
- :page-size="size"
- @current-change="toPage"
- >
- </el-pagination>
- </div>
- </div>
- <!-- RegistFlowDialog -->
- <regist-flow-dialog
- ref="RegistFlowDialog"
- @modified="getList"
- ></regist-flow-dialog>
- </div>
- </template>
- <script>
- import { flowListPage, flowPublish, flowDelete } from "../api";
- import RegistFlowDialog from "../components/RegistFlowDialog";
- export default {
- name: "flow-manage",
- components: {
- RegistFlowDialog
- },
- data() {
- return {
- filter: {
- name: ""
- },
- current: 1,
- size: this.GLOBAL.pageSize,
- total: 0,
- dataList: [],
- curFlow: {}
- };
- },
- mounted() {
- this.toPage(1);
- },
- methods: {
- async getList() {
- if (!this.checkPrivilege("list", "list")) return;
- const datas = {
- ...this.filter,
- pageNumber: this.current,
- pageSize: this.size
- };
- const data = await flowListPage(datas);
- this.dataList = data.records;
- this.total = data.total;
- },
- toPage(page) {
- this.current = page;
- this.getList();
- },
- toAdd() {
- this.curFlow = {};
- this.$refs.RegistFlowDialog.open();
- },
- toPublish(row) {
- if (row.publish) return;
- this.$confirm(`确定要发布流程【${row.name}】吗?`, "提示", {
- type: "warning"
- })
- .then(async () => {
- await flowPublish(row.id);
- this.$message.success("操作成功!");
- row.publish = !row.publish;
- })
- .catch(() => {});
- },
- toDelete(row) {
- this.$confirm(`确定要删除流程【${row.name}】吗?`, "提示", {
- type: "warning"
- })
- .then(async () => {
- await flowDelete({ flowId: row.id, enable: false });
- this.$message.success("操作成功!");
- this.getList();
- })
- .catch(() => {});
- }
- }
- };
- </script>
|