fixed 代码库对接类目

This commit is contained in:
lwh 2023-06-30 09:38:32 +08:00
parent 7602fe6629
commit b590b01a1d
5 changed files with 221 additions and 187 deletions

View File

@ -19,7 +19,7 @@ export default defineComponent({
params = {},
loading = {},
debug = false,
border = true,
border = false,
...attr
} = attrs;

View File

@ -3,15 +3,16 @@
<el-form ref="formRef" :model="formData" :rules="rules">
<el-row>
<el-col :span="12">
<el-form-item :label-width="labelWidth" label="所属客户" prop="customer_guid">
<el-input v-model='formData.customer_guid' type="text" placeholder='请输入所属客户'></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label-width="labelWidth" label="类目" prop="code_module_catetory_guid">
<el-input v-model='formData.code_module_catetory_guid' type="text" placeholder='请输入类目'></el-input>
<el-form-item :label-width="labelWidth" label="类目" prop="code_module_category_guid">
<el-cascader class="w100" filterable :options="dataList"
:props="{ checkStrictly: false, value: 'code_module_category_guid', label: 'code_module_category_name', emitPath: false }"
placeholder="请选择类目" clearable v-model="formData.code_module_category_guid">
<template #default="{ node, data }">
<span>{{ data.code_module_category_name }}</span>
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
</template>
</el-cascader>
</el-form-item>
</el-col>
<el-col :span="12">
@ -64,6 +65,7 @@
<script setup>
import { reactive, ref, watch } from "vue";
import { addCodeModule, getDictionary } from "~/service/code_module";
import { getCodeModuleCategoryList } from "~/service/code_module_category";
import { useLoginStore } from "~/store";
// --
@ -80,7 +82,15 @@ async function get_audit_status() {
})
}
//
const dataList = ref([])
async function getList() {
await getCodeModuleCategoryList({ 'all': true }).then((res) => {
if (res.code == 0) {
dataList.value = res.data
}
})
}
// --
@ -110,10 +120,10 @@ watch(props, (v) => {
});
const rules = reactive({
code_module_catetory_guid: [
code_module_category_guid: [
{
required: true,
message: '类目不能为空'
message: '代码库类目不能为空'
}
],
code_module_name: [
@ -147,9 +157,9 @@ const rules = reactive({
// --
//
const openDialog = () => {
get_audit_status()
const openDialog = async () => {
await get_audit_status()
await getList()
};
const closeDialog = () => {

View File

@ -1,55 +1,53 @@
<template>
<el-dialog v-model="props.modelValue" title="代码块详情" width="900px" @closed="closeDialog" @open="openDialog">
<el-dialog v-model="props.modelValue" title="代码块详情" width="900px" @closed="closeDialog" @open="openDialog">
<el-form ref="formRef" :model="formData" :disabled="true">
<el-row>
<el-col :span="12">
<el-form-item :label-width="labelWidth" label="所属客户" prop="customer_guid">
<el-input v-model='formData.customer_guid' type="text" placeholder='请输入所属客户'></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label-width="labelWidth" label="类目" prop="code_module_catetory_guid">
<el-input v-model='formData.code_module_catetory_guid' type="text" placeholder='请输入类目'></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label-width="labelWidth" label="代码块名称" prop="code_module_name">
<el-input v-model='formData.code_module_name' type="text" placeholder='请输入代码块名称'></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item :label-width="labelWidth" label="html内容" prop="code_module_html">
<el-input v-model='formData.code_module_html' type="textarea" :rows="5" placeholder='请输入html内容'></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item :label-width="labelWidth" label="style内容" prop="code_module_style">
<el-input v-model='formData.code_module_style' type="textarea" :rows="5" placeholder='请输入style内容'></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item :label-width="labelWidth" label="script内容" prop="code_module_script">
<el-input v-model='formData.code_module_script' type="textarea" :rows="5" placeholder='请输入script内容'></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label-width="labelWidth" label="排序" prop="code_module_sort">
<el-input-number v-model='formData.code_module_sort' controls-position='right' :min='1'></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="审核状态" prop="code_module_audit">
<el-select v-model="formData.code_module_audit" clearable placeholder="请选择">
<el-option
v-for="item in audit_status"
:key="item.dictionary_guid" :label="item.dictionary_name"
:value="item.dictionary_value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label-width="labelWidth" label="类目" prop="code_module_catetory_guid">
<el-cascader class="w100" filterable :options="dataList"
:props="{ checkStrictly: false, value: 'code_module_category_guid', label: 'code_module_category_name', emitPath: false }"
placeholder="请选择类目" clearable v-model="formData.code_module_category_guid">
<template #default="{ node, data }">
<span>{{ data.code_module_category_name }}</span>
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
</template>
</el-cascader>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label-width="labelWidth" label="代码块名称" prop="code_module_name">
<el-input v-model='formData.code_module_name' type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item :label-width="labelWidth" label="html内容" prop="code_module_html">
<el-input v-model='formData.code_module_html' type="textarea" :rows="5"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item :label-width="labelWidth" label="style内容" prop="code_module_style">
<el-input v-model='formData.code_module_style' type="textarea" :rows="5"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item :label-width="labelWidth" label="script内容" prop="code_module_script">
<el-input v-model='formData.code_module_script' type="textarea" :rows="5"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label-width="labelWidth" label="排序" prop="code_module_sort">
<el-input-number v-model='formData.code_module_sort' controls-position='right' :min='1'></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="审核状态" prop="code_module_audit">
<el-select v-model="formData.code_module_audit" clearable>
<el-option v-for="item in audit_status" :key="item.dictionary_guid" :label="item.dictionary_name"
:value="item.dictionary_value"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
@ -59,6 +57,7 @@
<script setup>
import { reactive, ref, watch } from "vue";
import { isEmptyObject } from "~/utils/index";
import { getCodeModuleCategoryList } from "~/service/code_module_category";
import { getDictionary } from '~/service/code_module';
// --
@ -67,14 +66,23 @@ import { getDictionary } from '~/service/code_module';
// --
//
const audit_status = ref([]);
async function get_audit_status() {
await getDictionary({ dictionary_value: 'audit_status'}).then((res) => {
audit_status.value = res
})
}
//
const audit_status = ref([]);
async function get_audit_status() {
await getDictionary({ dictionary_value: 'audit_status' }).then((res) => {
audit_status.value = res
})
}
//
const dataList = ref([])
async function getList() {
await getCodeModuleCategoryList({ 'all': true }).then((res) => {
if (res.code == 0) {
dataList.value = res.data
}
})
}
// --
@ -95,15 +103,15 @@ const formData = ref({
// --
watch(props, (v) => {
formData.value = v.data;
});
//
const openDialog = () => {
get_audit_status()
const openDialog = async () => {
await get_audit_status()
await getList()
};
const closeDialog = () => {
@ -111,6 +119,4 @@ const closeDialog = () => {
};
</script>
<style lang="less" scoped>
</style>
<style lang="less" scoped></style>

View File

@ -2,54 +2,53 @@
<el-dialog v-model="props.modelValue" title="编辑代码块" width="900px" @closed="closeDialog" @open="openDialog">
<el-form ref="formRef" :model="formData" :rules="rules">
<el-row>
<el-col :span="12">
<el-form-item :label-width="labelWidth" label="所属客户" prop="customer_guid">
<el-input v-model='formData.customer_guid' type="text" placeholder='请输入所属客户'></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label-width="labelWidth" label="类目" prop="code_module_catetory_guid">
<el-input v-model='formData.code_module_catetory_guid' type="text" placeholder='请输入类目'></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label-width="labelWidth" label="代码块名称" prop="code_module_name">
<el-input v-model='formData.code_module_name' type="text" placeholder='请输入代码块名称'></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item :label-width="labelWidth" label="html内容" prop="code_module_html">
<el-input v-model='formData.code_module_html' type="textarea" :rows="5" placeholder='请输入html内容'></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item :label-width="labelWidth" label="style内容" prop="code_module_style">
<el-input v-model='formData.code_module_style' type="textarea" :rows="5" placeholder='请输入style内容'></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item :label-width="labelWidth" label="script内容" prop="code_module_script">
<el-input v-model='formData.code_module_script' type="textarea" :rows="5" placeholder='请输入script内容'></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label-width="labelWidth" label="排序" prop="code_module_sort">
<el-input-number v-model='formData.code_module_sort' controls-position='right' :min='1'></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="审核状态" prop="code_module_audit">
<el-select v-model="formData.code_module_audit" clearable placeholder="请选择">
<el-option
v-for="item in audit_status"
:key="item.dictionary_guid" :label="item.dictionary_name"
:value="item.dictionary_value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label-width="labelWidth" label="类目" prop="code_module_catetory_guid">
<el-cascader class="w100" filterable :options="dataList"
:props="{ checkStrictly: false, value: 'code_module_category_guid', label: 'code_module_category_name', emitPath: false }"
placeholder="请选择类目" clearable v-model="formData.code_module_category_guid">
<template #default="{ node, data }">
<span>{{ data.code_module_category_name }}</span>
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
</template>
</el-cascader>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label-width="labelWidth" label="代码块名称" prop="code_module_name">
<el-input v-model='formData.code_module_name' type="text" placeholder='请输入代码块名称'></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item :label-width="labelWidth" label="html内容" prop="code_module_html">
<el-input v-model='formData.code_module_html' type="textarea" :rows="5" placeholder='请输入html内容'></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item :label-width="labelWidth" label="style内容" prop="code_module_style">
<el-input v-model='formData.code_module_style' type="textarea" :rows="5" placeholder='请输入style内容'></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item :label-width="labelWidth" label="script内容" prop="code_module_script">
<el-input v-model='formData.code_module_script' type="textarea" :rows="5"
placeholder='请输入script内容'></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label-width="labelWidth" label="排序" prop="code_module_sort">
<el-input-number v-model='formData.code_module_sort' controls-position='right' :min='1'></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="审核状态" prop="code_module_audit">
<el-select v-model="formData.code_module_audit" clearable placeholder="请选择">
<el-option v-for="item in audit_status" :key="item.dictionary_guid" :label="item.dictionary_name"
:value="item.dictionary_value"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
@ -64,23 +63,34 @@
<script setup>
import { reactive, ref, watch } from "vue";
import { editCodeModule , getDictionary } from "~/service/code_module";
import { editCodeModule, getDictionary } from "~/service/code_module";
import { getCodeModuleCategoryList } from "~/service/code_module_category";
import { useLoginStore } from "~/store";
// --
// --
//
const audit_status = ref([]);
async function get_audit_status() {
await getDictionary({ dictionary_value: 'audit_status'}).then((res) => {
audit_status.value = res
})
}
//
const audit_status = ref([]);
async function get_audit_status() {
await getDictionary({ dictionary_value: 'audit_status' }).then((res) => {
audit_status.value = res
})
}
//
const dataList = ref([])
async function getList() {
await getCodeModuleCategoryList({ 'all': true }).then((res) => {
if (res.code == 0) {
dataList.value = res.data
}
})
}
@ -110,14 +120,14 @@ const uoloadData = ref({
// --
watch(props, (v) => {
formData.value = v.data;
});
//
const openDialog = () => {
get_audit_status()
const openDialog = async () => {
await get_audit_status()
await getList()
};
const closeDialog = () => {
@ -127,36 +137,36 @@ const closeDialog = () => {
const rules = reactive({
code_module_catetory_guid: [
{
required: true,
message: '类目不能为空'
}
],
code_module_name: [
{
required: true,
message: '代码块名称不能为空'
}
],
code_module_html: [
{
required: true,
message: 'html内容不能为空'
}
],
code_module_sort: [
{
required: true,
message: '排序不能为空'
}
],
code_module_audit: [
{
required: true,
message: '审核状态不能为空'
}
],
{
required: true,
message: '类目不能为空'
}
],
code_module_name: [
{
required: true,
message: '代码块名称不能为空'
}
],
code_module_html: [
{
required: true,
message: 'html内容不能为空'
}
],
code_module_sort: [
{
required: true,
message: '排序不能为空'
}
],
code_module_audit: [
{
required: true,
message: '审核状态不能为空'
}
],
});
const handleEditClick = async (formEl) => {
@ -168,7 +178,7 @@ const handleEditClick = async (formEl) => {
}
isBtnLod.value = true;
const { code } = await editCodeModule(formData.value);
if (code == 0) {
closeDialog();
@ -183,6 +193,4 @@ const handleResetClick = async (formEl) => {
};
</script>
<style lang="less" scoped>
</style>
<style lang="less" scoped></style>

View File

@ -7,11 +7,15 @@
<!-- 搜索 -->
<el-form inline :model="params">
<el-form-item label="客户名称">
<el-input v-model='params.customer_name' placeholder='请输入客户名称'></el-input>
</el-form-item>
<el-form-item label="类目">
<el-input v-model='params.code_module_catetory_guid' placeholder='请输入类目'></el-input>
<el-cascader class="w100" filterable :options="dataList"
:props="{ checkStrictly: false, value: 'code_module_category_guid', label: 'code_module_category_name', emitPath: false }"
placeholder="请选择类目" clearable v-model="params.code_module_category_guid">
<template #default="{ node, data }">
<span>{{ data.code_module_category_name }}</span>
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
</template>
</el-cascader>
</el-form-item>
<el-form-item label="代码块名称">
<el-input v-model='params.code_module_name' placeholder='请输入代码块名称'></el-input>
@ -124,6 +128,7 @@ import { ArrowDown } from '@element-plus/icons-vue';
import { ref, reactive, watch } from 'vue';
import { useLoginStore } from "~/store";
import { getCodeModuleList, editCodeModule, deleteCodeModule, getDictionary, downloadTemplate, importExcel, exportExcel, audit } from '~/service/code_module';
import { getCodeModuleCategoryList } from "~/service/code_module_category";
import AddCodeModuleDialog from './components/AddCodeModuleDialog.vue';
import EditCodeModuleDialog from './components/EditCodeModuleDialog.vue';
import DetailCodeModuleDialog from './components/DetailCodeModuleDialog.vue';
@ -146,10 +151,10 @@ const headers = {
//
const params = reactive({
customer_guid: "",
code_module_catetory_guid: "",
code_module_category_guid: "",
code_module_name: "",
code_module_audit: "",
});
const column = [
@ -158,12 +163,7 @@ const column = [
type: 'selection'
},
{
prop: "customer_name",
label: '所属客户',
width: '150'
},
{
prop: "code_module_catetory_name",
prop: "code_module_category_name",
label: '类目',
width: '150'
},
@ -226,6 +226,16 @@ function handleDetail(row) {
DetailCodeModuleDialogRow.value = row
}
//
const dataList = ref([])
async function getList() {
await getCodeModuleCategoryList({ 'all': true }).then((res) => {
if (res.code == 0) {
dataList.value = res.data
}
})
}
getList()
//
let loadingImoprt = null;