| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772 |
- <template>
- <basic-container>
- <avue-crud :option="option"
- :table-loading="loading"
- :data="data"
- :page.sync="page"
- :permission="permissionList"
- id="out-table"
- :header-cell-class-name="headerClassName"
- :before-open="beforeOpen"
- v-model="form"
- ref="crud"
- @row-update="rowUpdate"
- @row-save="rowSave"
- @row-del="rowDel"
- @search-change="searchChange"
- @search-reset="searchReset"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @resetColumn="resetColumnTwo('crud', 'option', 'optionBack', 288)"
- @saveColumn="saveColumnTwo('crud', 'option', 'optionBack', 288)"
- @on-load="onLoad">
- <template slot-scope="scope" slot="tsInfo">
- <span style="color: #1e9fff" @click="chakanfun(scope.row,scope.index)">{{scope.row.tsInfo}}</span>
- </template>
- <template slot-scope="scope" slot="isDateExceeded">
- <span :style="scope.row.isDateExceeded=='已超时'?'color: #de4a3b':'color: #65da78'">{{scope.row.isDateExceeded}}</span>
- </template>
- <template slot-scope="scope" slot="menuLeft">
- <el-button
- type="primary"
- @click.stop="rowAddfun(scope.row, scope.index)">添加任务
- </el-button>
- <div style="display: flex;align-items: center;margin-top: 10px">
- <div class="bottomStatistics" style="background: #ffff00" @click="searchChangefun()">全部({{page.total}})</div>
- <div class="bottomStatistics" style="background: #f8cbad" @click="searchChangefun({type:1})">待执行({{statistics.waitingQuantity}})</div>
- <div class="bottomStatistics" style="background: #00b050" @click="searchChangefun({type:2})">执行中({{statistics.carryTheQuantity}})</div>
- <div class="bottomStatistics" style="background: #ffe699" @click="searchChangefun({type:3})">已提交({{statistics.numberOfCommits}})</div>
- <div class="bottomStatistics" style="background: #a9d08e" @click="searchChangefun({type:4})">工单关闭({{statistics.theNumberOfClosures}})</div>
- </div>
- </template>
- <template slot-scope="scope" slot="menu">
- <el-button
- type="text"
- icon="el-icon-edit"
- size="small"
- v-if="responsibleUserObj.createUser == scope.row.responsibleUserId && scope.row.type == 1"
- @click.stop="Acceptancefun(scope.row)"
- >受理
- </el-button>
- <el-button
- type="text"
- icon="el-icon-edit"
- size="small"
- v-if="responsibleUserObj.createUser == scope.row.responsibleUserId && scope.row.type == 2"
- @click.stop="submitTofun(scope.row)"
- >提交
- </el-button>
- <el-button
- type="text"
- icon="el-icon-edit"
- size="small"
- v-if="responsibleUserObj.createUser == scope.row.createUser && scope.row.type == 3"
- @click.stop="determinefun(scope.row)"
- >确认
- </el-button>
- <el-button
- type="text"
- icon="el-icon-edit"
- size="small"
- v-if="responsibleUserObj.createUser == scope.row.createUser && scope.row.type == 3"
- @click.stop="returnfun(scope.row)"
- >退回
- </el-button>
- <el-button
- type="text"
- icon="el-icon-edit"
- size="small"
- v-if="responsibleUserObj.createUser == scope.row.createUser && scope.row.type == 3"
- @click.stop="evaluatefun(scope.row,scope.index)"
- >评价
- </el-button>
- <el-button
- :type="scope.type"
- :size="scope.size"
- icon="el-icon-delete"
- :disabled="scope.row.type == 4"
- @click.stop="editOpen(scope.row, scope.index)">编辑
- </el-button>
- <el-button
- :type="scope.type"
- :size="scope.size"
- icon="el-icon-delete"
- v-if="responsibleUserObj.createUser == scope.row.createUser"
- :disabled="scope.row.type == 4"
- @click.stop="rowDel(scope.row, scope.index)">删除
- </el-button>
- </template>
- </avue-crud>
- <div>
- <el-row :gutter="20">
- <el-col :span="4" v-for="item in taskCompletionData" :key="item.id">
- <el-card class="box-card">
- <div slot="header" class="clearfix">
- <span>{{item.userName}}</span>
- </div>
- <div class="card-flex">
- <div class="card-flexLeft" style="color: #ebc4a5">待执行:</div>
- <div class="card-flexRight">{{item.waitingQuantity}}</div>
- </div>
- <div class="card-flex">
- <div class="card-flexLeft" style="color: #52a54a">执行中:</div>
- <div class="card-flexRight">{{item.carryTheQuantity}}</div>
- </div>
- <div class="card-flex">
- <div class="card-flexLeft" style="color: #f8e292">已提交:</div>
- <div class="card-flexRight">{{item.numberOfCommits}}</div>
- </div>
- <div class="card-flex">
- <div class="card-flexLeft" style="color: #de4a3b">超期:</div>
- <div class="card-flexRight">{{item.theNumberOfTimeouts}}</div>
- </div>
- </el-card>
- </el-col>
- </el-row>
- </div>
- </basic-container>
- </template>
- <script>
- import {getList, getDetail, add, update, remove, taskCompletion} from "@/api/TaskKanban/task";
- import {mapGetters} from "vuex";
- import {getPostList} from "@/api/system/post";
- import Da from "element-ui/src/locale/lang/da";
- import {getUserApprovalList} from "@/api/approval/processConfig";
- import {dateFormat} from "@/util/date";
- export default {
- data() {
- return {
- form: {},
- query: {},
- loading: false,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0
- },
- option:{},
- optionBack: {
- addTitle:'创建任务',
- editTitle:'编辑任务',
- viewTitle:'查看任务',
- addBtnText:'创建任务',
- // dialogDrag:true,
- height:'auto',
- calcHeight: 30,
- tip: false,
- searchShow: true,
- searchMenuSpan: 24,
- border: true,
- index: true,
- viewBtn: true,
- selection: false,
- dialogClickModal: false,
- column: [
- {
- label: "需求方",
- prop: "createUserName",
- display:false,
- },
- {
- label: "负责人",
- prop: "responsibleUserId",
- search: true,
- type:'select',
- filterable:true,
- dicUrl: "/api/blade-user/userList",
- props: {
- label: "realName",
- value: "id"
- },
- dicData:[],
- rules: [{
- required: true,
- message: "请选择负责人",
- trigger: "blur"
- }],
- // hide:true,
- },
- {
- label: "抄送人",
- prop: "ccId",
- type:'tree',
- dicUrl: "/api/blade-user/userList",
- multiple: true,
- props: {
- label: "realName",
- value: "id"
- },
- dicData:[],
- rules: [{
- required: true,
- message: "请选择抄送人",
- trigger: "blur"
- }]
- // hide:true,
- },
- {
- label: "岗位",
- prop: "postId",
- search: true,
- type:'select',
- filterable:true,
- dicData:[],
- props: {
- label: "postName",
- value: "id"
- },
- width:100,
- rules: [{
- required: true,
- message: "请选择岗位",
- trigger: "blur"
- }]
- },
- {
- label: "任务内容",
- prop: "tsInfo",
- search: true,
- type: 'textarea',
- span: 24,
- minRows: 3,
- rules: [{
- required: true,
- message: "请输入任务信息",
- trigger: "blur"
- }]
- },
- {
- label: "要求完成时间",
- prop: "completionTime",
- width:160,
- labelWidth:100,
- type: "datetime",
- format: "yyyy-MM-dd hh:mm:ss",
- valueFormat: "yyyy-MM-dd hh:mm:ss",
- searchRange: true,
- rules: [{
- required: true,
- message: "请输入要求完成时间",
- trigger: "blur"
- }]
- },
- {
- label: "是否紧急",
- prop: "isUrgency",
- type:'select',
- dicData:[{
- label:'否',
- value:0
- },{
- label:'是',
- value:1
- }],
- rules: [{
- required: true,
- message: "请输入是否紧急",
- trigger: "blur"
- }]
- },
- {
- label: "未完成原因",
- prop: "unfinishedCause",
- width:120,
- },
- {
- label: "评价",
- prop: "evaluate",
- display:false,
- },
- {
- label: "单据类型",
- prop: "documentType",
- display:false,
- hide:true,
- dicData:[{
- label:'任务',
- value:1
- },{
- label:'状态',
- value:2
- }],
- },
- {
- label: "状态",
- prop: "type",
- display:false,
- type:'select',
- dicData:[{
- label:'待执行',
- value:1
- },{
- label:'执行中',
- value:2
- },{
- label:'已提交',
- value:3
- },{
- label:'工单关闭',
- value:4
- },{
- label:'未完成',
- value:5
- }],
- },
- {
- label: "是否超时",
- prop: "isDateExceeded",
- display:false,
- },
- {
- label: "下发时间",
- prop: "createTime",
- search: true,
- type: "date",
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd",
- unlinkPanels: true,
- searchRange: true,
- display:false,
- width: 160,
- },
- {
- label: "完成时间",
- prop: "accomplishTime",
- type: "date",
- format: "yyyy-MM-dd hh:mm:ss",
- valueFormat: "yyyy-MM-dd hh:mm:ss",
- unlinkPanels: true,
- searchRange: true,
- display:false,
- width: 160,
- },
- {
- label: "备注",
- prop: "remarks",
- type: 'textarea',
- span: 24,
- minRows: 3,
- },
- {
- label: "附件",
- hide:true,
- prop: "accessory",
- type: 'upload',
- propsHttp: {
- url: 'link',
- name: 'name',
- res: 'data'
- },
- listType:'picture-card',
- dataType:'string',
- // dataType:'object',
- // props: {
- // label: 'name',
- // value: 'url'
- // },
- tip: '只能上传jpg/png文件,且不超过500kb',
- action: '/api/blade-resource/oss/endpoint/put-file',
- span: 24,
- },
- {
- label: "参考号",
- prop: "refno",
- hide:true,
- display:false,
- },
- {
- label: "创建人",
- prop: "createUser",
- hide:true,
- display:false,
- },
- {
- label: "修改人",
- hide:true,
- prop: "updateUser",
- display:false,
- },
- {
- label: "修改时间",
- hide:true,
- prop: "updateTime",
- width: 160,
- display:false,
- },
- {
- label: "是否已删除",
- hide:true,
- // (0 否 1是)
- prop: "isDeleted",
- display:false,
- type:'select',
- dicData:[{
- label:'否',
- value:0
- },{
- label:'是',
- value:1
- }],
- },
- ]
- },
- data: [],
- taskCompletionData:[],
- // 当前登录人的名称和id
- responsibleUserObj:[],
- // 表头筛选
- statistics:{},
- // 负责人数据
- dicDataName:[],
- };
- },
- async created() {
- this.option = await this.getColumnData(this.getColumnName(288), this.optionBack);
- // 传租户号查询岗位信息
- this.getPostListfun(JSON.parse(localStorage.getItem('saber-tenantId')).content)
- // 获取当前登录人的名称和id
- // console.log(JSON.parse(localStorage.getItem('saber-userInfo')).content.role_name)
- let role = JSON.parse(localStorage.getItem('saber-userInfo')).content
- this.responsibleUserObj.createUser = role.user_id
- this.responsibleUserObj.createUserName = role.real_name
- this.getUserApprovalListfun()
- },
- computed: {
- ...mapGetters(["permission"]),
- permissionList() {
- return {
- addBtn: this.vaildData(this.permission.task_add, false),
- viewBtn: this.vaildData(this.permission.task_view, false),
- delBtn: this.vaildData(this.permission.task_delete, false),
- editBtn: this.vaildData(this.permission.task_edit, false)
- };
- },
- },
- methods: {
- // 获取负责人数据
- getUserApprovalListfun(){
- getUserApprovalList().then(res=>{
- this.findObject(this.option.column, "responsibleUserId").dicData = res.data.data
- this.findObject(this.option.column, "ccId").dicData = res.data.data
- this.dicDataName = res.data.data
- })
- },
- // 受理接口
- Acceptancefun(row) {
- this.$confirm("确定将选择数据受理?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- this.updatefun(row,2)
- })
- },
- // 提交
- submitTofun(row) {
- this.$confirm("确定将选择数据提交?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- this.updatefun(row,3)
- })
- },
- // 确认事件
- determinefun(row){
- if (!row.evaluate) {
- this.$message({
- type: "success",
- message: "请评价后再点工单确认!"
- });
- return
- }
- this.$confirm("确定将选择数据确认?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- this.updatefun({...row,accomplishTime:dateFormat(new Date())},4)
- })
- },
- // 退回事件
- returnfun(row){
- this.$confirm("确定将选择数据确认?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- this.updatefun(row,2)
- })
- },
- // 评价
- evaluatefun(row,index){
- this.findObject(this.option.column, "ccId").disabled = true
- this.findObject(this.option.column, "responsibleUserId").disabled = true
- this.findObject(this.option.column, "postId").disabled = true
- this.findObject(this.option.column, "tsInfo").disabled = true
- this.findObject(this.option.column, "completionTime").disabled = true
- this.findObject(this.option.column, "isUrgency").disabled = true
- this.findObject(this.option.column, "accessory").disabled = true
- this.findObject(this.option.column, "unfinishedCause").disabled = false
- this.findObject(this.option.column, "evaluate").disabled = false
- this.findObject(this.option.column, "evaluate").display = true
- this.$refs.crud.rowEdit(row, index)
- },
- // 查看
- chakanfun(row,index) {
- this.$refs.crud.rowView(row, index)
- },
- // 保存更改状态
- updatefun(row,type){
- update({
- ...row,
- updateUser:this.responsibleUserObj.createUser,
- updateUserName:this.responsibleUserObj.createUserName,
- type:type
- }).then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- }, error => {
- loading();
- console.log(error);
- });
- },
- // 更改表格颜色
- headerClassName(tab){
- //颜色间隔
- let back = ""
- if (tab.columnIndex >= 0 && tab.column.level === 1) {
- if (tab.columnIndex % 2 === 0) {
- back = "back-one"
- } else if (tab.columnIndex % 2 === 1) {
- back = "back-two"
- }
- }
- return back;
- },
- // 获取岗位信息
- getPostListfun(tenantId){
- getPostList(tenantId).then(res => {
- const column = this.findObject(this.option.column, "postId");
- column.dicData = res.data.data;
- });
- },
- // 添加
- rowAddfun(row,index) {
- this.findObject(this.option.column, "ccId").disabled = false
- this.findObject(this.option.column, "responsibleUserId").disabled = false
- this.findObject(this.option.column, "postId").disabled = false
- this.findObject(this.option.column, "tsInfo").disabled = false
- this.findObject(this.option.column, "completionTime").disabled = false
- this.findObject(this.option.column, "isUrgency").disabled = false
- this.findObject(this.option.column, "accessory").disabled = false
- this.$refs.crud.rowAdd()
- },
- // 添加确认
- rowSave(row, done, loading) {
- row.ccId = row.ccId.join()
- this.dicDataName.map(item=>{
- if (row.responsibleUserId == item.id) {
- row.responsibleUserName = item.realName
- }
- })
- add({
- ...row,
- type:1,
- ...this.responsibleUserObj,
- }).then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- loading();
- window.console.log(error);
- });
- },
- // 编辑弹窗确认按钮
- rowUpdate(row, index, done, loading) {
- update({
- ...row,
- updateUser:this.responsibleUserObj.createUser,
- updateUserName:this.responsibleUserObj.createUserName
- }).then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- loading();
- console.log(error);
- });
- },
- // 编辑
- editOpen(row,index){
- if (this.responsibleUserObj.createUser == row.createUser) {
- }else {
- this.findObject(this.option.column, "ccId").disabled = true
- this.findObject(this.option.column, "responsibleUserId").disabled = true
- this.findObject(this.option.column, "postId").disabled = true
- this.findObject(this.option.column, "tsInfo").disabled = true
- this.findObject(this.option.column, "completionTime").disabled = true
- this.findObject(this.option.column, "isUrgency").disabled = true
- this.findObject(this.option.column, "accessory").disabled = true
- }
- this.$refs.crud.rowEdit(row, index)
- },
- // 删除
- rowDel(row) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- return remove({
- ...row.id,
- updateUser:this.responsibleUserObj.createUser,
- updateUserName:this.responsibleUserObj.createUserName
- });
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- });
- },
- beforeOpen(done, type) {
- if (["edit", "view"].includes(type)) {
- getDetail(this.form.id).then(res => {
- this.form = res.data.data;
- });
- }
- done();
- },
- searchReset() {
- this.query = {};
- this.onLoad(this.page);
- },
- // 搜索
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- params.createTimeSelect = params.createTime
- delete params.createTime
- this.onLoad(this.page, params);
- done();
- },
- // 搜索分类
- searchChangefun(params){
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- },
- currentChange(currentPage){
- this.page.currentPage = currentPage;
- },
- sizeChange(pageSize){
- this.page.pageSize = pageSize;
- },
- refreshChange() {
- this.onLoad(this.page, this.query);
- },
- // 查询列表接口
- onLoad(page, params = {}) {
- this.loading = true;
- getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
- const data = res.data.data;
- this.page.total = data.pages.total;
- this.data = data.pages.records;
- this.statistics = data.statistics
- this.loading = false;
- this.taskCompletionfun() // 查询统计
- });
- },
- // 查询统计数据
- taskCompletionfun(){
- taskCompletion().then(res=>{
- this.taskCompletionData = res.data.data
- })
- },
- //自定义列保存
- async saveColumnTwo(ref, option, optionBack, code) {
- /**
- * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
- * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
- * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
- */
- const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
- if (inSave) {
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- //自定义列重置
- async resetColumnTwo(ref, option, optionBack, code) {
- this[option] = this[optionBack];
- const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
- if (inSave) {
- this.$message.success("重置成功");
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- }
- }
- };
- </script>
- <style scoped>
- ::v-deep#out-table .back-one {
- background: #ffc000 !important;
- }
- ::v-deep#out-table .back-two {
- background: #ffc000 !important;
- }
- .clearfix {
- font-size: 18px;
- }
- .card-flex {
- display: flex;
- align-items: center;
- font-size: 16px;
- margin-top: 10px;
- }
- .card-flex:first-child {
- margin: 0;
- }
- .card-flexLeft {
- width: 80px;
- }
- .card-flexRight {
- }
- .bottomStatistics {
- padding: 10px 20px;
- font-size: 14px;
- border-radius: 4px;
- margin-right: 10px;
- }
- </style>
|