fix:代码块类目模块优化

This commit is contained in:
LAPTOP-8RNQO8UO\86159 2023-07-04 14:43:24 +08:00
parent 6a5124755a
commit 499fff8e28
6 changed files with 169 additions and 40 deletions

View File

@ -1,12 +1,11 @@
<template>
<!-- 面包屑 -->
<el-breadcrumb>
<el-breadcrumb v-if="!code_module_category">
<el-breadcrumb-item>代码块管理</el-breadcrumb-item>
<el-breadcrumb-item to="/code_module/list">代码块列表</el-breadcrumb-item>
</el-breadcrumb>
<!-- 搜索 -->
<el-form inline :model="params">
<el-form v-if="code_module_category != false" inline :model="params">
<el-form-item label="类目">
<el-cascader class="w100" filterable :options="dataList"
:props="{ checkStrictly: false, value: 'code_module_category_guid', label: 'code_module_category_name', emitPath: false }"
@ -151,11 +150,23 @@ const headers = {
//
const params = reactive({
customer_guid: "",
code_module_category_guid: "",
code_module_category_guid: props.code_module_category.code_module_category_guid ? props.code_module_category.code_module_category_guid : "",
code_module_name: "",
code_module_audit: "",
});
const props = defineProps({
code_module_category: Object,
});
watch(props, (v) => {
params.code_module_category_guid = props.code_module_category.code_module_category_guid
});
if (props.code_module_category) {
params.code_module_category_guid = props.code_module_category.code_module_category_guid
}
const column = [
{
@ -226,6 +237,7 @@ function handleDetail(row) {
DetailCodeModuleDialogRow.value = row
}
//
const dataList = ref([])
async function getList() {

View File

@ -175,12 +175,6 @@ const rules = reactive({
message: '类目名不能为空'
}
],
code_module_category_ps: [
{
required: true,
message: '补充不能为空'
}
],
code_module_category_sort: [
{
required: true,

View File

@ -193,12 +193,6 @@ const rules = reactive({
message: '类目名不能为空'
}
],
code_module_category_ps: [
{
required: true,
message: '补充不能为空'
}
],
code_module_category_sort: [
{
required: true,

View File

@ -0,0 +1,57 @@
<template>
<el-dialog v-model="props.modelValue" title="查看代码块列表" width="85%" @closed="closeDialog" @open="openDialog">
<CodeModuleLisrView v-if="formData" :code_module_category="formData">
</CodeModuleLisrView>
</el-dialog>
</template>
<script setup>
import { reactive, ref, watch } from "vue";
import { editCodeModuleCategory, getDictionary, getCodeModuleCategoryList, getCodeModuleCategoryInfo } from "~/service/code_module_category";
import { getCustomerOptionList } from "~/service/customer";
import { useLoginStore } from "~/store";
import CodeModuleLisrView from "~/pages/index/code/code_module/index.vue";
// --
const store = useLoginStore();
const headers = {
Accept: "application/json",
...store.headers,
};
const isBtnLod = ref(false);
const formRef = ref();
const labelWidth = 100;
const props = defineProps({
modelValue: Boolean,
data: Object,
done: Function,
});
const emits = defineEmits(["update:modelValue"]);
const formData = ref({
...props.data,
});
const uoloadData = ref({
dirName: "CodeModuleCategory"
})
// --
watch(props, (v) => {
formData.value = v.data;
});
//
const openDialog = async () => {
};
const closeDialog = () => {
props.done();
emits("update:modelValue", false);
};
</script>
<style lang="less" scoped></style>

View File

@ -55,6 +55,9 @@
<el-dropdown-item @click="handleDelete(selectionData)">
批量删除
</el-dropdown-item>
<el-dropdown-item @click="handleAudit(selectionData)">
批量审核
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
@ -65,6 +68,28 @@
row-key="code_module_category_guid" :tree-props="{ children: 'children' }">
<el-table-column type="selection" width="50" align="center" />
<el-table-column prop="code_module_category_name" width="200" label="类目名称" :show-overflow-tooltip="true">
<template #default="scope">
<span>
<Icon v-if="scope.row.code_module_category_parent_guid == '0'" name="ElIconFolderOpened" />
<Icon v-else name="ElIconFolder" />
{{ scope.row.code_module_category_name }}
</span>
</template>
</el-table-column>
<el-table-column prop="code_module_category_library_type" width="100" label="库类型" :show-overflow-tooltip="true">
<template #default="scope">
<dict-tag :options='library_type' :value='scope.row.code_module_category_library_type' />
</template>
</el-table-column>
<el-table-column prop="global_mode" width="200" label="全局模式" :show-overflow-tooltip="true">
<template #default="scope">
<dict-tag :options='global_mode' :value='scope.row.code_module_category_global_mode' />
</template>
</el-table-column>
<el-table-column prop="code_module_category_audit" width="100" label="审核状态" :show-overflow-tooltip="true">
<template #default="scope">
<dict-tag :options='audit_status' :value='scope.row.code_module_category_audit' />
</template>
</el-table-column>
<el-table-column sortable prop="code_module_category_sort" width="200" label="排序" sort>
<template #default="scope">
@ -73,7 +98,7 @@
</template>
</el-table-column>
<el-table-column label="操作" width="200" fixed='right'>
<el-table-column width="350" label="操作" fixed='right'>
<template #default="scope">
<el-button size="small" type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
<el-dropdown style="margin: 0 10px;">
@ -87,6 +112,14 @@
</el-dropdown-menu>
</template>
</el-dropdown>
<el-button v-if="scope.row.code_module_category_parent_guid != '0'" type="danger" size="small"
@click="handleLookCodeModuleList(scope.row)">
查看代码块列表
</el-button>
<el-button v-if="scope.row.code_module_category_audit == 1" type="warning" size="small"
@click="handleAudit([scope.row])">
审核
</el-button>
</template>
</el-table-column>
</el-table>
@ -102,15 +135,20 @@
<!-- 代码块类目详情 -->
<DetailCodeModuleCategoryDialog v-model="DetailCodeModuleCategoryDialogVisible"
:data="DetailCodeModuleCategoryDialogRow"></DetailCodeModuleCategoryDialog>
<!-- 查看代码块列表 -->
<LookCodeModuleListDialog :done="() => getList()" v-model="LookCodeModuleListDialogVisible"
:data="LookCodeModuleListDialogRow">
</LookCodeModuleListDialog>
</template>
<script setup>
import { ArrowDown } from '@element-plus/icons-vue';
import { ref, reactive, watch } from 'vue';
import { useLoginStore } from "~/store";
import { getCodeModuleCategoryList, editCodeModuleCategory, deleteCodeModuleCategory, getDictionary } from '~/service/code_module_category';
import { getCodeModuleCategoryList, editCodeModuleCategory, deleteCodeModuleCategory, getDictionary, auditCodeModuleCategory } from '~/service/code_module_category';
import AddCodeModuleCategoryDialog from './components/AddCodeModuleCategoryDialog.vue';
import EditCodeModuleCategoryDialog from './components/EditCodeModuleCategoryDialog.vue';
import DetailCodeModuleCategoryDialog from './components/DetailCodeModuleCategoryDialog.vue';
import LookCodeModuleListDialog from './components/LookCodeModuleListDialog.vue';
const tableRef = ref();
const selectionData = ref([]);
@ -121,6 +159,8 @@ const EditCodeModuleCategoryDialogVisible = ref(false);
const EditCodeModuleCategoryDialogRow = ref({});
const DetailCodeModuleCategoryDialogVisible = ref(false);
const DetailCodeModuleCategoryDialogRow = ref({});
const LookCodeModuleListDialogVisible = ref(false);
const LookCodeModuleListDialogRow = ref({});
const headers = {
Accept: "application/json",
@ -133,25 +173,13 @@ const params = reactive({
code_module_category_name: "",
code_module_category_ps: "",
code_module_category_global_mode: "",
code_module_category_library_type: "2",
code_module_category_library_type: "",
customer: "",
code_module_category_audit: "2",
code_module_category_audit: "",
page: 1,
limit: 10,
});
const handleCommand = ({ type, row }) => {
switch (type) {
case "detail":
handleDetail(row);
break;
case 'delete':
handleDelete([row]);
break;
}
};
const dataList = ref([])
function getList() {
getCodeModuleCategoryList(params).then((res) => {
@ -181,6 +209,37 @@ const handleDelete = data => {
});
};
//
const handleAudit = data => {
let code_module_category_guid = data.map(v => v.code_module_category_guid).join()
ElMessageBox.confirm("是否通过审核?", "系统提示", {
distinguishCancelAndClose: true,
confirmButtonText: '通过',
cancelButtonText: '驳回',
type: "warning",
})
.then(async () => {
const res = await auditCodeModuleCategory({
code_module_category_guid: code_module_category_guid,
code_module_category_audit: 2,
});
if (res) {
getList()
}
})
.catch(async (action) => {
if (action == 'cancel') {
const res = await auditCodeModuleCategory({
code_module_category_guid: code_module_category_guid,
code_module_category_audit: 3,
});
if (res) {
getList()
}
}
})
};
//
function handleUpdate(row) {
EditCodeModuleCategoryDialogVisible.value = true
@ -193,6 +252,12 @@ function handleDetail(row) {
DetailCodeModuleCategoryDialogRow.value = row
}
//
function handleLookCodeModuleList(row) {
LookCodeModuleListDialogVisible.value = true
LookCodeModuleListDialogRow.value = row
}
//

View File

@ -4,13 +4,6 @@ import {
createApiUrl
} from '~/utils/axios';
/**
* 获取字典值
* @param {Object} data
@ -64,6 +57,7 @@ export function addCodeModuleCategory(data) {
errorMessageText: '添加失败'
});
}
/**
* 编辑代码块类目
* @param {Object} data
@ -75,4 +69,17 @@ export function editCodeModuleCategory(data) {
// isShowSuccessMessage: true,
errorMessageText: '编辑失败'
});
}
/**
* 审核代码类目
* @param {Object} data
* @return {Promise} api
*/
export function auditCodeModuleCategory(data) {
return api.post('Code.CodeModuleCategory/auditCodeModuleCategory', data, {
isTransformResponse: true,
isShowSuccessMessage: true,
errorMessageText: '操作失败'
});
}