272 lines
8.0 KiB
HTML
272 lines
8.0 KiB
HTML
{% extends 'template/jhTemplateV3.html'%}
|
|
|
|
{% block vue_template %}
|
|
|
|
<jh-layout-v3>
|
|
|
|
<template slot="serverSearch">
|
|
<v-row class="ma-0 align-center flex-none pa-0" :class="{'pa-2': !isMobile, 'pa-2': isMobile}" style="justify-content: end">
|
|
<v-col :class="{'pt-2': isMobile, 'pl-0': isMobile, 'pr-0': !isMobile}" style="max-width: 77px">
|
|
<v-btn
|
|
class="elevation-0"
|
|
color="success"
|
|
dark
|
|
@click="doUiAction('refreshTableData')"
|
|
>
|
|
查询
|
|
</v-btn>
|
|
</v-col>
|
|
</v-row>
|
|
</template>
|
|
|
|
<!-- 页面主要内容 -->
|
|
<v-container class="fullScreen d-flex flex-column pa-xs-0 pa-0">
|
|
<v-card>
|
|
<v-row class="ma-0 pa-xs-4 align-center flex-none pt-0 " :class="{'pa-4': !isMobile, 'pb-0': !isMobile, 'pa-2': isMobile}">
|
|
|
|
<v-col cols="12" xs="4" sm="4" md="4" xl="4" class="pl-0">
|
|
<span class="body-2">共{{ tableData.length }}条记录</span>
|
|
</v-col>
|
|
|
|
<v-spacer></v-spacer>
|
|
|
|
<v-col cols="12" xs="8" sm="4" md="3" xl="3" class="pa-xs-0 pa-xs-2 col-sm-8-flex">
|
|
<v-text-field v-model="searchInput" label="表格过滤" class="cus-v-input" dense filled single-line></v-text-field>
|
|
</v-col>
|
|
</v-row>
|
|
<v-data-table fixed-header
|
|
:headers="headers"
|
|
:items="tableData"
|
|
:search="searchInput"
|
|
:footer-props="{ itemsPerPageOptions: [20, 40, 60, 100, -1] }"
|
|
:items-per-page="20"
|
|
mobile-breakpoint="0"
|
|
:loading="isTableLoading"
|
|
checkbox-color="success"
|
|
class="elevation-0 mt-0 mb-xs-4 flex-fill d-flex flex-column">
|
|
<!-- <template v-slot:item.level="{ item }">-->
|
|
<!-- {{ getConstantCollectionItemText('level', item.level) }}-->
|
|
<!-- </template>-->
|
|
<template v-slot:item.action="{ item }">
|
|
<v-btn small color="warning" class="mr-2" @click="doUiAction('toTaskHistory', {item})">
|
|
查看
|
|
</v-btn>
|
|
</template>
|
|
</v-data-table>
|
|
</v-card>
|
|
</v-container>
|
|
</jh-layout-v3>
|
|
|
|
{% endblock %}
|
|
|
|
{% block vue_body %}
|
|
|
|
{% include 'layout/jhLayout.html' %}
|
|
{% include 'common/resetTableMaxHeight.html' %}
|
|
|
|
<script type="module">
|
|
new Vue({
|
|
el: '#app',
|
|
template: '#app-template',
|
|
vuetify: new Vuetify(),
|
|
mixins: [window.jianghuUiActionMixins],
|
|
data: () => ({
|
|
// 表格相关数据
|
|
isFormValid: true,
|
|
requireRules: [
|
|
v => !!v || 'This is required',
|
|
],
|
|
constantCollection: {
|
|
},
|
|
|
|
serverSearchInput: {
|
|
studentId: null,
|
|
classId: null
|
|
},
|
|
currentTableGenderType: 'all',
|
|
isEditDrawerShow: false,
|
|
searchInput: null,
|
|
isTableLoading: true,
|
|
tableDataFromBackend: [],
|
|
headers: [
|
|
{text: "ID", value: "id", width: 120, class: 'fixed', cellClass: 'fixed'},
|
|
|
|
{text: "任务ID", value: "taskId", width: 120},
|
|
{text: "任务名称", value: "taskTitle", width: 120},
|
|
{text: "任务状态:running 执行中;deny 拒绝;end 结束", value: "taskStatus", width: 120},
|
|
{text: "当前执行中节点ID", value: "taskConfigId", width: 120},
|
|
{text: "申请人", value: "taskInitUser", width: 120},
|
|
{text: "当前执行的处理人员,用逗号分隔", value: "taskEditUserList", width: 120},
|
|
{text: "所有相关人员,用逗号分隔", value: "taskViewUserList", width: 120},
|
|
{text: "备注", value: "taskComment", width: 120},
|
|
{text: "任务创建人", value: "createByUser", width: 120},
|
|
{text: "操作者", value: "operationByUser", width: 120},
|
|
{text: "操作时间", value: "operationAt", width: 250},
|
|
{text: '操作', value: 'action', align: 'center', sortable: false, width: 200, class: 'fixed', cellClass: 'fixed'},
|
|
],
|
|
|
|
currentClickButton: {title: '新增', action: 'add'},
|
|
editItem: {},
|
|
tableButtonList: [
|
|
{text: '删除', buttonType: 'delete', color: 'error', action: 'deleteItem'},
|
|
],
|
|
dialogSaveInfoAction: ''
|
|
}),
|
|
computed: {
|
|
isMobile() {
|
|
return window.innerWidth < 600;
|
|
},
|
|
tableData() {
|
|
if (!this.currentTableGenderType || this.currentTableGenderType === 'all') {
|
|
return this.tableDataFromBackend;
|
|
}
|
|
return this.tableDataFromBackend.filter(({gender}) => gender === this.currentTableGenderType);
|
|
},
|
|
computedEditItem() {
|
|
return this.editItem;
|
|
},
|
|
},
|
|
watch: {},
|
|
async created() {
|
|
await this.doUiAction('refreshTableData');
|
|
},
|
|
mounted() {},
|
|
methods: {
|
|
/**
|
|
* 获取表格数据
|
|
*/
|
|
async refreshTableData() {
|
|
this.isTableLoading = true;
|
|
const serverSearchInput = _.pickBy(this.serverSearchInput, value=> !!value);
|
|
const { data: { appData: { rows } } } = await window.jianghuAxios({
|
|
data: {
|
|
appData: {
|
|
pageId: 'taskICreateManagement',
|
|
actionId: 'selectItemList',
|
|
actionData: {},
|
|
where: {},
|
|
whereLike: serverSearchInput,
|
|
orderBy: [{column: 'operationAt', order: 'desc'}]
|
|
}
|
|
}
|
|
});
|
|
|
|
this.tableDataFromBackend = rows;
|
|
this.isTableLoading = false;
|
|
},
|
|
|
|
// startCreateItem
|
|
async clearItemData() {
|
|
this.editItem = {};
|
|
},
|
|
|
|
async openCreateItemDialog() {
|
|
this.currentClickButton = {action: 'add', title: '新增'};
|
|
this.isEditDrawerShow = true;
|
|
this.dialogSaveInfoAction = 'createItem';
|
|
},
|
|
|
|
// createItem
|
|
async confirmCreateItemDialog() {
|
|
return window.confirmDialog({title: '新增', content: '确定新增吗?'})
|
|
},
|
|
|
|
/**
|
|
* 新增数据
|
|
*/
|
|
async doCreateItem() {
|
|
delete this.computedEditItem.id;
|
|
await window.vtoast.loading("新增数据");
|
|
await window.jianghuAxios({
|
|
data: {
|
|
appData: {
|
|
pageId: 'taskManagement',
|
|
actionId: 'insertItem',
|
|
actionData: this.computedEditItem
|
|
}
|
|
}
|
|
})
|
|
await window.vtoast.success("新增数据成功");
|
|
},
|
|
|
|
async closeDrawerShow() {
|
|
this.isEditDrawerShow = false;
|
|
},
|
|
|
|
// startUpdateItem
|
|
async prepareItemData({item}) {
|
|
this.editItem = {...item};
|
|
},
|
|
|
|
async openUpdateDialog() {
|
|
this.currentClickButton = {action: 'edit', title: '修改'};
|
|
this.isEditDrawerShow = true;
|
|
this.dialogSaveInfoAction = 'updateItem';
|
|
},
|
|
|
|
// updateItem
|
|
async confirmUpdateItemDialog() {
|
|
return window.confirmDialog({title: '修改', content: '确定修改吗?'});
|
|
},
|
|
|
|
/**
|
|
* 保存数据
|
|
*/
|
|
async doUpdateItem() {
|
|
const id = this.computedEditItem.id;
|
|
delete this.computedEditItem.id;
|
|
await window.vtoast.loading("修改数据");
|
|
await window.jianghuAxios({
|
|
data: {
|
|
appData: {
|
|
pageId: 'taskManagement',
|
|
actionId: 'updateItem',
|
|
actionData: this.computedEditItem,
|
|
where: {id: id}
|
|
}
|
|
}
|
|
})
|
|
await window.vtoast.success("修改数据成功");
|
|
},
|
|
|
|
// updateItem
|
|
async confirmDeleteItemDialog() {
|
|
return window.confirmDialog({title: '删除', content: '确定删除吗?'});
|
|
},
|
|
|
|
/**
|
|
* 删除数据
|
|
*/
|
|
async doDeleteItem({item}) {
|
|
const { id } = item;
|
|
await window.vtoast.loading("删除数据");
|
|
await window.jianghuAxios({
|
|
data: {
|
|
appData: {
|
|
pageId: 'taskManagement',
|
|
actionId: 'deleteItem',
|
|
actionData: {},
|
|
where: { id: id }
|
|
}
|
|
}
|
|
});
|
|
await window.vtoast.success("删除数据成功");
|
|
},
|
|
getConstantCollectionItemText(key, _value) {
|
|
const constantCollectionItemFind = this.constantCollection[key].find(({value}) => value === _value);
|
|
if(constantCollectionItemFind) {
|
|
return constantCollectionItemFind.text;
|
|
}
|
|
return _value;
|
|
},
|
|
toTaskHistory({item}) {
|
|
window.open(`/${window.appInfo.appId}/page/taskHistoryManagement?taskId=${item.taskId}`);
|
|
}
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<style scoped>
|
|
</style>
|
|
{% endblock %}
|