wanghong
2024-01-05 60c97371be338da5a707b4c6516e7a2dbe8ea2c9
Source/UBCS-WEB/src/views/wel/index.vue
@@ -15,41 +15,44 @@
    <el-row>
      <el-col :span="24">
        <basic-container title="待办流程任务">
          <avue-crud ref="crud" :table-loading="loading" :data="todoData" :option="todoOption"
          <avue-crud ref="crud" :data="todoData" :option="todoOption" :page.sync="page"
                     :table-loading="loading"
                     @on-load="onLoad"
                     @cell-click="cellHandle"
                     :page.sync="page">
                     @cell-click="cellHandle">
            <template #menu="{size,row,index}">
              <el-button @click="gotodo(row,index)"
              <el-button :size="size"
                         icon="el-icon-check"
                         type="text"
                         :size="size">执行</el-button>
                         @click="gotodo(row,index)">执行
              </el-button>
            </template>
          </avue-crud>
        </basic-container>
      </el-col>
<!--      <el-col :span="8">-->
<!--        <el-row>-->
<!--          <basic-container title="消息列表">-->
<!--            <el-collapse v-model="logActiveNames" @change="handleChange">-->
<!--              <el-collapse-item v-for="item in noticeData" :title="item.title" :name="item.id">-->
<!--                <div>{{item.subtitle}}</div>-->
<!--              </el-collapse-item>-->
<!--            </el-collapse>-->
<!--          </basic-container>-->
<!--        </el-row>-->
      <!--      <el-col :span="8">-->
      <!--        <el-row>-->
      <!--          <basic-container title="消息列表">-->
      <!--            <el-collapse v-model="logActiveNames" @change="handleChange">-->
      <!--              <el-collapse-item v-for="item in noticeData" :title="item.title" :name="item.id">-->
      <!--                <div>{{item.subtitle}}</div>-->
      <!--              </el-collapse-item>-->
      <!--            </el-collapse>-->
      <!--          </basic-container>-->
      <!--        </el-row>-->
<!--      </el-col>-->
      <!--      </el-col>-->
    </el-row>
    <el-dialog title="修改密码" :visible.sync="dialogFormVisible" append-to-body  :close-on-press-escape="false" :before-close="Xdelhandle">
      <el-form :model="form"  :rules="rules" ref="form">
        <el-form-item label="原密码" :label-width="formLabelWidth" prop="oldPassword">
    <el-dialog :before-close="Xdelhandle" :close-on-press-escape="false" :visible.sync="dialogFormVisible"
               append-to-body
               title="修改密码">
      <el-form ref="form" :model="form" :rules="rules">
        <el-form-item :label-width="formLabelWidth" label="原密码" prop="oldPassword">
          <el-input v-model="form.oldPassword" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="新密码" :label-width="formLabelWidth" prop="newPassword">
        <el-form-item :label-width="formLabelWidth" label="新密码" prop="newPassword">
          <el-input v-model="form.newPassword" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="确认密码" :label-width="formLabelWidth" prop="newPassword1">
        <el-form-item :label-width="formLabelWidth" label="确认密码" prop="newPassword1">
          <el-input v-model="form.newPassword1" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
@@ -62,229 +65,229 @@
</template>
<script>
  import {mapGetters} from "vuex";
  import  {check,updatePassword} from "@/api/system/user"
  import md5 from "js-md5";
  import {removeToken} from "@/util/auth";
  import Statistic from './Statistic.vue';
  import {validatenull} from "@/util/validate";
  import {flowCategory,flowRoute} from "@/util/flow";
  import {todoList} from "@/api/work/work";
import {mapGetters} from "vuex";
import {check, updatePassword} from "@/api/system/user"
import md5 from "js-md5";
import {removeToken} from "@/util/auth";
import Statistic from './Statistic.vue';
import {validatenull} from "@/util/validate";
import {flowCategory, flowRoute} from "@/util/flow";
import {todoList} from "@/api/work/work";
  export default {
    name: "wel",
    components: {Statistic},
    data() {
      return {
        loading: false,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
export default {
  name: "wel",
  components: {Statistic},
  data() {
    return {
      loading: false,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0
      },
      // 代办流程任务data
      todoData: [],
      // 代办流程任务option
      todoOption: {
        height: 500,
        addBtn: false,
        header: false,
        align: 'center',
        index: true,
        menuWidth: 80,
        editBtn: false,
        delBtn: false,
        border: true,
        column: [{
          label: '任务名称',
          prop: 'taskName',
          sortable: true,
          headerAlign: 'center',
          align: 'left',
          html: true,
          width: 300,
          overHidden: true,
          formatter: (val) => {
            return '<a name="processname" href="javascript:;" style="color: #66b1ff;">' + val.variables.processName + '-' + val.taskName + '</a>'
          }
        },
        // 代办流程任务data
        todoData: [],
        // 代办流程任务option
        todoOption: {
          height:500,
          addBtn: false,
          header: false,
          align: 'center',
          index: true,
          menuWidth: 80,
          editBtn: false,
          delBtn: false,
          border:true,
          column: [{
            label: '任务名称',
            prop: 'taskName',
            sortable:true,
            headerAlign:'center',
            align:'left',
            html: true,
            width:300,
            overHidden:true,
          {
            label: '上一步处理时间',
            sortable: true,
            width: 150,
            prop: 'createTime'
          },
          {
            label: '上一步操作人',
            sortable: true,
            width: 120,
            prop: 'historyActivityAssigneName'
          },
          {
            label: '流程描述',
            prop: 'processDesc',
            overHidden: true,
            formatter: (val) => {
              return '<a name="processname" href="javascript:;" style="color: #66b1ff;">' + val.variables.processName+'-'+val.taskName + '</a>'
              return val.variables.processDesc
            }
          },
            {
              label: '上一步处理时间',
              sortable:true,
              width:150,
              prop: 'createTime'
            },
            {
              label: '上一步操作人',
              sortable:true,
              width:120,
              prop: 'historyActivityAssigneName'
            },
            {
              label: '流程描述',
              prop: 'processDesc',
              overHidden:true,
              formatter: (val) => {
                return  val.variables.processDesc
              }
            },
            {
              label: '所属流程模板',
              sortable:true,
              overHidden:true,
              prop: 'categoryName'
            }
          ]
        },
        noticeData: [{
          img: '/img/bg/vip1.png',
          title: '史蒂夫·乔布斯 关注了你',
          subtitle: '05-08 15:08',
          tag: '已经开始',
          status: 0
        }, {
          img: '/img/bg/vip2.png',
          title: '斯蒂夫·沃兹尼亚克 关注了你',
          subtitle: '05-08 15:08',
          tag: '未开始',
          status: 1
        }, {
          img: '/img/bg/vip3.png',
          title: '蒂姆·库克 关注了你',
          subtitle: '05-08 15:08',
          status: 3,
          tag: '有错误'
        }, {
          img: '/img/bg/vip4.png',
          title: '比尔·费尔南德斯 关注了你',
          subtitle: '05-08 15:08',
          status: 4,
          tag: '已完成'
        }],
        logActiveNames: ['28'],
        userarr: [],
        userid: '',
        updataArr: [],
        dialogFormVisible: false,
        form: {
          oldPassword: '',
          newPassword: '',
          newPassword1: '',
        },
        rules: {
          oldPassword: [
            {required: true, message: '请输入原密码', trigger: 'blur'}
          ],
          newPassword: [
            {required: true, message: '请输入新密码', trigger: 'blur'}
          ],
          newPassword1: [
            {required: true, message: '请输确认密码', trigger: 'blur'}
          ]
        },
      };
          {
            label: '所属流程模板',
            sortable: true,
            overHidden: true,
            prop: 'categoryName'
          }
        ]
      },
      noticeData: [{
        img: '/img/bg/vip1.png',
        title: '史蒂夫·乔布斯 关注了你',
        subtitle: '05-08 15:08',
        tag: '已经开始',
        status: 0
      }, {
        img: '/img/bg/vip2.png',
        title: '斯蒂夫·沃兹尼亚克 关注了你',
        subtitle: '05-08 15:08',
        tag: '未开始',
        status: 1
      }, {
        img: '/img/bg/vip3.png',
        title: '蒂姆·库克 关注了你',
        subtitle: '05-08 15:08',
        status: 3,
        tag: '有错误'
      }, {
        img: '/img/bg/vip4.png',
        title: '比尔·费尔南德斯 关注了你',
        subtitle: '05-08 15:08',
        status: 4,
        tag: '已完成'
      }],
      logActiveNames: ['28'],
      userarr: [],
      userid: '',
      updataArr: [],
      dialogFormVisible: false,
      form: {
        oldPassword: '',
        newPassword: '',
        newPassword1: '',
      },
      rules: {
        oldPassword: [
          {required: true, message: '请输入原密码', trigger: 'blur'}
        ],
        newPassword: [
          {required: true, message: '请输入新密码', trigger: 'blur'}
        ],
        newPassword1: [
          {required: true, message: '请输确认密码', trigger: 'blur'}
        ]
      },
    };
  },
  // 拿到userid请求接口
  created() {
    this.updataArr = JSON.parse(localStorage.getItem("updataid"))
    this.userid = this.$store.state.user.upadatastatus.user_id
    const pageFlag = localStorage.getItem("pageFlag")
    if (pageFlag === null) {
      this.checkhandle()
      localStorage.setItem("pageFlag", true)
    }
  },
  computed: {
    ...mapGetters(["userInfo", "flowRoutes"]),
  },
  methods: {
    handleChange(val) {
      window.console.log(val);
    },
    // 拿到userid请求接口
    created() {
      this.updataArr = JSON.parse(localStorage.getItem("updataid"))
      this.userid = this.$store.state.user.upadatastatus.user_id
      const pageFlag = localStorage.getItem("pageFlag")
      if (pageFlag === null) {
    Xdelhandle() {
      removeToken()
      this.dialogFormVisible = false
    },
    // 关闭弹窗后清除token返回到登录页面
    delhandle() {
      removeToken()
      this.dialogFormVisible = false
    },
    // 修改密码方法
    addok() {
      this.dialogFormVisible = false
      updatePassword(md5(this.form.oldPassword), this.form.newPassword, this.form.newPassword1).then(res => {
        if (res.data.code == 200) {
          this.$message({
            type: "success",
            message: "修改成功!"
          })
        }
      }).catch(res => {
        console.log(res)
        this.checkhandle()
        localStorage.setItem("pageFlag", true)
      }
      })
    },
    computed: {
      ...mapGetters(["userInfo", "flowRoutes"]),
    },
    methods: {
      handleChange(val) {
        window.console.log(val);
      },
      Xdelhandle() {
        removeToken()
        this.dialogFormVisible = false
      },
      // 关闭弹窗后清除token返回到登录页面
      delhandle() {
        removeToken()
        this.dialogFormVisible = false
      },
      // 修改密码方法
      addok() {
        this.dialogFormVisible = false
        updatePassword(md5(this.form.oldPassword), this.form.newPassword, this.form.newPassword1).then(res => {
          if (res.data.code == 200) {
    // 提醒时间请求,也需要判断是否为超管身份,超管身份不判断
    checkhandle() {
      if (this.updataArr.user_id != '0' && this.updataArr.tenant_id !== '000000') {
        check(this.userid).then(res => {
          if (res.data.data > 0) {
            this.$message({
              type: "success",
              message: "修改成功!"
              type: 'warning',
              message: `你还有${res.data.data}天就要修改密码了`
            })
          } else if (res.data.data == -1) {
            this.$message({
              type: "warning",
              message: "密码策略已被修改,请重新修改密码!"
            })
            setTimeout(() => {
              this.dialogFormVisible = true
            }, 1500)
          } else if (res.data.data == 0) {
            // this.$message({
            //   type: 'success',
            //   message: "操作成功"
            // })
          }
        }).catch(res => {
          console.log(res)
          this.checkhandle()
        })
      },
      // 提醒时间请求,也需要判断是否为超管身份,超管身份不判断
      checkhandle() {
        if (this.updataArr.user_id != '0' && this.updataArr.tenant_id !== '000000') {
          check(this.userid).then(res => {
            if (res.data.data > 0) {
              this.$message({
                type: 'warning',
                message: `你还有${res.data.data}天就要修改密码了`
              })
            } else if (res.data.data == -1) {
              this.$message({
                type: "warning",
                message: "密码策略已被修改,请重新修改密码!"
              })
              setTimeout(() => {
                this.dialogFormVisible = true
              }, 1500)
            } else if (res.data.data == 0) {
              // this.$message({
              //   type: 'success',
              //   message: "操作成功"
              // })
            }
          }).catch(res => {
            console.log(res)
          })
        }
      },
      onLoad(page, params = {}) {
        this.loading = true;
        const query = {
          ...this.query,
          category: (params.category) ? flowCategory(params.category) : null
        };
        todoList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.todoData = data.records;
          this.loading = false;
        }).catch(error => {
          this.$message.error(error);
          this.loading = false;
        })
      },
      cellHandle(row, column, cell, event) {
        if (column.property == 'taskName') {
          this.gotodo(row)
        }
      },
      gotodo(row, index) {
        this.$router.push({ path: `/work/process/${flowRoute(this.flowRoutes, row.category)}/handle/${row.taskId}/${row.processInstanceId}/${row.businessId}` });
      }
    },
    onLoad(page, params = {}) {
      this.loading = true;
      const query = {
        ...this.query,
        category: (params.category) ? flowCategory(params.category) : null
      };
      todoList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => {
        const data = res.data.data;
        this.page.total = data.total;
        this.todoData = data.records;
        this.loading = false;
      }).catch(error => {
        this.$message.error(error);
        this.loading = false;
      })
    },
    cellHandle(row, column, cell, event) {
      if (column.property == 'taskName') {
        this.gotodo(row)
      }
    },
    gotodo(row, index) {
      this.$router.push({path: `/work/process/${flowRoute(this.flowRoutes, row.category)}/handle/${row.taskId}/${row.processInstanceId}/${row.businessId}`});
    }
  };
  }
};
</script>
<style>
  .el-font-size {
    font-size: 14px;
  }
.el-font-size {
  font-size: 14px;
}
</style>