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 = {}, params = {},
loading = {}, loading = {},
debug = false, debug = false,
border = true, border = false,
...attr ...attr
} = attrs; } = attrs;

View File

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

View File

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

View File

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

View File

@ -7,11 +7,15 @@
<!-- 搜索 --> <!-- 搜索 -->
<el-form inline :model="params"> <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-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>
<el-form-item label="代码块名称"> <el-form-item label="代码块名称">
<el-input v-model='params.code_module_name' placeholder='请输入代码块名称'></el-input> <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 { ref, reactive, watch } from 'vue';
import { useLoginStore } from "~/store"; import { useLoginStore } from "~/store";
import { getCodeModuleList, editCodeModule, deleteCodeModule, getDictionary, downloadTemplate, importExcel, exportExcel, audit } from '~/service/code_module'; 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 AddCodeModuleDialog from './components/AddCodeModuleDialog.vue';
import EditCodeModuleDialog from './components/EditCodeModuleDialog.vue'; import EditCodeModuleDialog from './components/EditCodeModuleDialog.vue';
import DetailCodeModuleDialog from './components/DetailCodeModuleDialog.vue'; import DetailCodeModuleDialog from './components/DetailCodeModuleDialog.vue';
@ -146,10 +151,10 @@ const headers = {
// //
const params = reactive({ const params = reactive({
customer_guid: "", customer_guid: "",
code_module_catetory_guid: "", code_module_category_guid: "",
code_module_name: "", code_module_name: "",
code_module_audit: "", code_module_audit: "",
}); });
const column = [ const column = [
@ -158,12 +163,7 @@ const column = [
type: 'selection' type: 'selection'
}, },
{ {
prop: "customer_name", prop: "code_module_category_name",
label: '所属客户',
width: '150'
},
{
prop: "code_module_catetory_name",
label: '类目', label: '类目',
width: '150' width: '150'
}, },
@ -226,6 +226,16 @@ function handleDetail(row) {
DetailCodeModuleDialogRow.value = 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; let loadingImoprt = null;