Skip to content

Commit

Permalink
完成自定义列数据分配。新加全局样式文件
Browse files Browse the repository at this point in the history
  • Loading branch information
wangraoji committed Sep 13, 2023
1 parent 07b8ae5 commit 4987c57
Show file tree
Hide file tree
Showing 23 changed files with 527 additions and 104 deletions.
20 changes: 20 additions & 0 deletions src/api/approval.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,25 @@ export default {
getEntityList: async (data) => {
return await http.get("/approval/getAllApprovalConfigEntity", data);
},
/**
*
* 审批流程专用
* @param {*} mainEntity 实体名称
* @param {*} fieldsList 要显示的字段名称
* @param {*} pageSize 默认页数大小
* @param {*} pageNo 页数大小
* @param {*} filter { equation="AND", items:[{ "fieldName": "flowName", "op": "LK", "value": "修改"}] } 过滤
* @param {*} advFilter { equation="AND", items:[{ "fieldName": "flowName", "op": "LK", "value": "修改"}] } 常用查询
* @param {*} quickFilter "" 快速查询
* @param {*} sortFields [{ "fieldName": "entityCode","type": "desc" }] 排序
*/
getDataList: async (entity, fields, filter, pageSize, pageNo, sortFields, advFilter, quickFilter) => {
return http.post('approval/listQuery', {
'mainEntity': entity,
'fieldsList': fields,
filter, pageSize, pageNo, sortFields, advFilter, quickFilter
})
}

},
}
12 changes: 12 additions & 0 deletions src/api/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,16 @@ export default {
isEquation: async (data) => {
return await http.get("/crud/testEquation", data);
},
/**
* 获取主实体相关实体数据
*
* @param entityCode 实体code
* @param queryMain 是否查询出主实体
* @param queryReference 是否查询主实体引用的实体
* @param queryReferenced 是否查询引用主实体的实体
* @param querySystem 是否查询系统实体
* */
queryEntityList: async (entityCode, queryMain = false, queryReference = false, queryReferenced = false, querySystem = false) => {
return http.get('/systemManager/queryEntityList', { entityCode, queryMain, queryReference, queryReferenced, querySystem })
}
}
10 changes: 8 additions & 2 deletions src/api/crud.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ export function deleteRecord(id) {
* @param {*} quickFilter "" 快速查询
* @param {*} sortFields [{ "fieldName": "entityCode","type": "desc" }] 排序
*/
export function getDataList(entity, fields, filter, pageSize, pageNo, sortFields,advFilter,quickFilter) {
export function getDataList(entity, fields, filter, pageSize, pageNo, sortFields, advFilter, quickFilter) {
return http.post('crud/listQuery', {
'mainEntity': entity,
'fieldsList': fields,
filter, pageSize, pageNo, sortFields,advFilter,quickFilter
filter, pageSize, pageNo, sortFields, advFilter, quickFilter
})
}

Expand Down Expand Up @@ -77,3 +77,9 @@ export function queryEntityFields(entityCode, queryReference, queryReserved) {
return http.get('/crud/queryEntityFields', { entityCode, queryReference, queryReserved })
}

/**
* 分配
*/
export function assignRecord(body) {
return http.post('/crud/assignRecord', body)
}
2 changes: 1 addition & 1 deletion src/components/mlListAdvancedQuery/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ const handleCommand = (e) => {
padding: 0 10px;
&.is-active {
color: #409eff;
color: $ml-primary;
}
height: 34px;
.item-text {
Expand Down
2 changes: 1 addition & 1 deletion src/components/mlSelectUser/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ let filterMethod = (keyword) => {
border-bottom: 0;
}
&:hover {
background: #409eff;
background: $ml-primary;
color: #fff;
}
.tab-item-icon {
Expand Down
4 changes: 2 additions & 2 deletions src/components/mlShareTo/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ const confrimUse = () => {
top: 2px;
}
.a-span {
color: #409eff;
color: $ml-primary;
cursor: pointer;
&:hover {
color: #a0cfff;
color: $ml-primary-hover;
}
}
</style>
30 changes: 22 additions & 8 deletions src/components/mlSingleList/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import { onMounted, ref, reactive, inject } from "vue";
import { getDataList } from "@/api/crud";
const message = inject("$ElMessage");
const $API = inject("$API");
const props = defineProps({
// 表格名字
title: { type: String, default: "" },
Expand Down Expand Up @@ -109,14 +110,27 @@ async function getTableList() {
},
sortFields,
};
let res = await getDataList(
param.mainEntity,
param.fieldsList,
param.filter,
param.pageSize,
param.pageNo,
param.sortFields
);
let res;
if (param.mainEntity == "ApprovalTask") {
res = await $API.approval.list.getDataList(
param.mainEntity,
param.fieldsList,
param.filter,
param.pageSize,
param.pageNo,
param.sortFields
);
} else {
res = await getDataList(
param.mainEntity,
param.fieldsList,
param.filter,
param.pageSize,
param.pageNo,
param.sortFields
);
}
if (res.code === 200) {
tableList.value = res.data.dataList;
page.total = res.data.pagination.total;
Expand Down
4 changes: 2 additions & 2 deletions src/components/mlWorkflow/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -539,10 +539,10 @@ const editZoom = (target) => {
cursor: pointer;
}
.node-wrap-drawer__title label:hover {
border-bottom: 1px dashed #409eff;
border-bottom: 1px dashed $ml-primary;
}
.node-wrap-drawer__title .node-wrap-drawer__title-edit {
color: #409eff;
color: $ml-primary;
margin-left: 10px;
vertical-align: middle;
}
Expand Down
2 changes: 1 addition & 1 deletion src/layout/components/navigationList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const delMenu = (item, inx) => {
padding: 0 10px;
position: relative;
&.is-active {
color: #409eff;
color: $ml-primary;
}
.action-icon {
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion src/style/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ textarea {
.div-disabled {
color: #c8cbd2;
&:hover {
cursor: not-allowed;
cursor: not-allowed !important;
}
}

Expand Down
13 changes: 13 additions & 0 deletions src/style/fix.scss
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ body .tox-tinymce-aux {
display: block;
white-space: normal;
height: 30px;
line-height: 30px;
.el-radio__input {
position: relative;
top: -1px;
Expand Down Expand Up @@ -393,3 +394,15 @@ body .tox-tinymce-aux {
.advfilter-popper {
z-index: 3001!important;
}


.ml-drawer {
*{
box-sizing: border-box;
}
.el-drawer__header {
padding: 0;
margin-bottom: 0;
}
}

3 changes: 2 additions & 1 deletion src/style/global.scss
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@

$ml-primary: #409eff;
$ml-primary-hover: #a0cfff;
1 change: 1 addition & 0 deletions src/style/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
@import 'pages.scss';
@import 'media.scss';
@import 'dark.scss';

114 changes: 114 additions & 0 deletions src/views/customize-menu/components/Allocation.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<template>
<ml-dialog title="数据导出" v-model="dialogShow" width="500px">
<div v-loading="loading" class="main pr-30">
<el-form label-width="120px">
<el-form-item label="分配哪些记录" class="mb-10">选中的记录({{ formData.list.length }} 条)</el-form-item>
<el-form-item label="分配给谁" class="mb-10">
<mlSelectUser type="User" v-model="formData.allocationTo" clearable />
</el-form-item>
<el-form-item label=" " v-if="!formData.isAssociatedRecords">
<span class="ml-a-span" @click="showAssociatedRecords">同时分配关联记录</span>
</el-form-item>
<el-form-item label="选择相关记录" v-if="formData.isAssociatedRecords">
<el-select
v-model="formData.associatedRecords"
multiple
filterable
class="w-100"
value-key="label"
>
<el-option
v-for="item in entityList"
:key="item.value"
:label="item.label"
:value="item"
/>
</el-select>
</el-form-item>
</el-form>
</div>
<template #footer>
<el-button @click="dialogShow=false" :loading="loading">取消</el-button>
<el-button @click="confirm" :loading="loading" type="primary">确定</el-button>
</template>
</ml-dialog>
</template>

<script setup>
import { reactive, ref, inject } from "vue";
import { useRouter } from "vue-router";
import { assignRecord } from "@/api/crud";
const router = useRouter();
const $ElMessage = inject("$ElMessage");
const $API = inject("$API");
let dialogShow = ref(false);
let loading = ref(false);
// 分配实体列表
let entityList = ref([]);
let formData = reactive({
// 分配哪些记录
list: [],
// 分配给谁
allocationTo: [],
// 同时分配关联记录
isAssociatedRecords: false,
// 选择的相关记录
associatedRecords: [],
});
const openDialog = (data) => {
dialogShow.value = true;
formData.list = [...data];
};
// 同时分配关联记录
const showAssociatedRecords = async () => {
formData.isAssociatedRecords = true;
loading.value = true;
let entityCode = router.currentRoute.value.meta.entityCode;
let res = await $API.common.queryEntityList(entityCode, false, false, true);
if (res.code == 200) {
entityList.value = res.data || [];
} else {
$ElMessage.error("获取相关记录失败:" + res.error);
}
loading.value = false;
};
// 确认
const confirm =async () => {
if (!formData.allocationTo || formData.allocationTo.length < 1) {
$ElMessage.warning("请选择分配给谁");
return;
}
let param = {
body: {
toUser: formData.allocationTo[0].id,
recordIds: formData.list.map((el) => el.demoCompanyId),
cascades: formData.associatedRecords.map((el) => el),
},
};
loading.value = true;
let res = await assignRecord(param.body);
if(res.code == 200){
if(res.data > 0){
$ElMessage.success("成功分配 " + res.data + " 条记录")
}else {
$ElMessage.success("分配成功")
}
dialogShow.value = false;
}else {
$ElMessage.error("分配失败:" + res.error)
}
loading.value = false;
};
defineExpose({
openDialog,
});
</script>
<style lang='scss' scoped>
.main {
line-height: 0;
}
</style>
3 changes: 2 additions & 1 deletion src/views/customize-menu/components/DataExport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

<script setup>
import { reactive, ref, inject } from "vue";
import axios from "axios";
const $ElMessage = inject("$ElMessage");
const $API = inject("$API");
let dialogShow = ref(false);
Expand Down Expand Up @@ -61,9 +60,11 @@ defineExpose({
});
</script>
<style lang='scss' scoped>
.lable-title {
font-size: 14px;
font-weight: bold;
color: #666;
line-height: 24px;
}
</style>
47 changes: 47 additions & 0 deletions src/views/customize-menu/components/DetailTabs.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<template>
<div class="detail-tabs">
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<el-tab-pane
v-for="(tab,tabInx) of tabs"
:key="tabInx"
:label="tab.label"
:name="tab.name"
></el-tab-pane>
</el-tabs>
<span class="setting-tabs">
<el-icon>
<ElIconSetting />
</el-icon>
</span>
</div>
</template>

<script setup>
import { onMounted, ref } from "vue";
const props = defineProps({
tabs: { type: Array, default: () => [] },
activeName: { type: String, default: "" },
});
let activeName = ref("");
onMounted(() => {
activeName.value = props.tabs[0].name;
});
const handleClick = () => {};
</script>
<style lang='scss' scoped>
.detail-tabs {
position: relative;
.setting-tabs {
cursor: pointer;
font-size: 16px;
position: absolute;
top: 12px;
right: -18px;
&:hover {
color: $ml-primary;
}
}
}
</style>
Loading

0 comments on commit 4987c57

Please sign in to comment.