init 初始化代码块
This commit is contained in:
parent
62c3a9f28b
commit
1e629bd7b8
@ -170,8 +170,8 @@ body {
|
||||
// justify-content: space-around;
|
||||
height: 70px;
|
||||
text-align: center;
|
||||
background-color: #23d96e; // 头部logo背景色
|
||||
// background-color: #2b333e; //默认
|
||||
// background-color: #23d96e; // 头部logo背景色
|
||||
background-color: #2b333e; //默认
|
||||
cursor: pointer;
|
||||
color: white;
|
||||
z-index: 99;
|
||||
|
185
src/pages/index/code_module/components/AddCodeModuleDialog.vue
Normal file
185
src/pages/index/code_module/components/AddCodeModuleDialog.vue
Normal file
@ -0,0 +1,185 @@
|
||||
<template>
|
||||
<el-dialog v-model="dialogVisible" 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-row>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button type="primary" @click="handleAddClick(formRef)">添加</el-button>
|
||||
<el-button @click="handleResetClick(formRef)">重置</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { addCodeModule, getDictionary } from "~/service/code_module";
|
||||
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 store = useLoginStore();
|
||||
const headers = {
|
||||
Accept: "application/json",
|
||||
...store.headers,
|
||||
};
|
||||
|
||||
const isBtnLod = ref(false);
|
||||
const formRef = ref();
|
||||
const labelWidth = 90;
|
||||
const props = defineProps({
|
||||
modelValue: Boolean,
|
||||
done: Function,
|
||||
});
|
||||
const emits = defineEmits(["update:modelValue"]);
|
||||
const dialogVisible = ref(props.modelValue);
|
||||
const formData = reactive({});
|
||||
|
||||
const uoloadData = ref({
|
||||
dirName: "CodeModule"
|
||||
})
|
||||
|
||||
watch(props, (v) => {
|
||||
dialogVisible.value = v.modelValue;
|
||||
});
|
||||
|
||||
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: '审核状态不能为空'
|
||||
}
|
||||
],
|
||||
|
||||
});
|
||||
|
||||
|
||||
// --基础方法
|
||||
|
||||
// 打开弹窗时执行
|
||||
const openDialog = () => {
|
||||
get_audit_status()
|
||||
|
||||
};
|
||||
|
||||
const closeDialog = () => {
|
||||
handleResetClick(formRef.value);
|
||||
dialogVisible.value = false;
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
|
||||
const handleAddClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.validate(async (valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
isBtnLod.value = true;
|
||||
|
||||
|
||||
const { code } = await addCodeModule(formData);
|
||||
if (code == 0) {
|
||||
closeDialog();
|
||||
props.done();
|
||||
}
|
||||
isBtnLod.value = flase;
|
||||
});
|
||||
};
|
||||
|
||||
const handleResetClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<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-row>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { isEmptyObject } from "~/utils/index";
|
||||
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 formRef = ref();
|
||||
const labelWidth = 100;
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: Boolean,
|
||||
data: Object,
|
||||
done: Function,
|
||||
});
|
||||
const emits = defineEmits(["update:modelValue"]);
|
||||
const formData = ref({
|
||||
...props.data,
|
||||
});
|
||||
|
||||
|
||||
// --基础方法
|
||||
watch(props, (v) => {
|
||||
formData.value = v.data;
|
||||
|
||||
|
||||
});
|
||||
|
||||
// 打开弹窗时执行
|
||||
const openDialog = () => {
|
||||
|
||||
get_audit_status()
|
||||
|
||||
};
|
||||
|
||||
const closeDialog = () => {
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
</style>
|
188
src/pages/index/code_module/components/EditCodeModuleDialog.vue
Normal file
188
src/pages/index/code_module/components/EditCodeModuleDialog.vue
Normal file
@ -0,0 +1,188 @@
|
||||
<template>
|
||||
<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-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button type="primary" @click="handleEditClick(formRef)" :loading="isBtnLod">编辑</el-button>
|
||||
<el-button @click="handleResetClick(formRef)">重置</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { editCodeModule , getDictionary } from "~/service/code_module";
|
||||
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 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: "CodeModule"
|
||||
})
|
||||
|
||||
|
||||
// --基础方法
|
||||
watch(props, (v) => {
|
||||
formData.value = v.data;
|
||||
|
||||
|
||||
});
|
||||
|
||||
// 打开弹窗时执行
|
||||
const openDialog = () => {
|
||||
get_audit_status()
|
||||
|
||||
};
|
||||
|
||||
const closeDialog = () => {
|
||||
props.done();
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
|
||||
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: '审核状态不能为空'
|
||||
}
|
||||
],
|
||||
|
||||
});
|
||||
|
||||
const handleEditClick = async (formEl) => {
|
||||
console.log(formData.value);
|
||||
if (!formEl) return;
|
||||
formEl.validate(async (valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
isBtnLod.value = true;
|
||||
|
||||
|
||||
const { code } = await editCodeModule(formData.value);
|
||||
if (code == 0) {
|
||||
closeDialog();
|
||||
props.done();
|
||||
}
|
||||
isBtnLod.value = false;
|
||||
});
|
||||
};
|
||||
const handleResetClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
</style>
|
335
src/pages/index/code_module/index.vue
Normal file
335
src/pages/index/code_module/index.vue
Normal file
@ -0,0 +1,335 @@
|
||||
<template>
|
||||
<!-- 面包屑 -->
|
||||
<el-breadcrumb>
|
||||
<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-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-form-item>
|
||||
<el-form-item label="代码块名称">
|
||||
<el-input v-model='params.code_module_name' placeholder='请输入代码块名称'></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="审核状态">
|
||||
<el-select v-model="params.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-form-item>
|
||||
<el-button type="primary" @click="tableRef.reload()" icon="ElIconSearch">
|
||||
搜索
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-space style="margin-bottom: 10px;">
|
||||
<!-- 添加代码块 -->
|
||||
<el-col :span="1">
|
||||
<el-button type="primary" @click="addCodeModuleDialogVisible = true"> 添加 </el-button>
|
||||
</el-col>
|
||||
|
||||
|
||||
<!-- 导入 -->
|
||||
<el-upload class="upload-demo" :action="importExcel" :headers="headers" :on-success="handleExcelSuccess"
|
||||
:on-progress="uploadLoading" :on-error="closeUploadLoading" style="margin-left: 10px" :show-file-list="false">
|
||||
<el-button type="primary">导入</el-button>
|
||||
</el-upload>
|
||||
|
||||
<!-- 下载导入模板 -->
|
||||
<el-button icon="ElIconDownload" @click="downloadTemplate()">下载导入模板</el-button>
|
||||
|
||||
<!-- 导出 -->
|
||||
<el-button icon="ElIconDocument" @click="exportExcel(params)">导出</el-button>
|
||||
|
||||
|
||||
<!-- 下拉操作 -->
|
||||
<el-dropdown v-if="selectionData.length">
|
||||
<el-button type="primary">
|
||||
批量操作<el-icon class="el-icon--right"><arrow-down /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click="handleDelete(selectionData)">
|
||||
批量删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click="handleAudit(selectionData)">
|
||||
批量审核
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-space>
|
||||
<!-- 数据表格 -->
|
||||
<DataTable ref="tableRef" style="width: 100%" :onSelectionChange="data => (selectionData = data)" :column="column"
|
||||
:params="params" :request="params => getCodeModuleList(params)">
|
||||
|
||||
|
||||
<template #code_module_audit='scope'>
|
||||
<dict-tag :options='audit_status' :value='scope.row.code_module_audit' />
|
||||
</template>
|
||||
|
||||
|
||||
<!-- 排序 -->
|
||||
<template #code_module_sort='scope'>
|
||||
<el-input-number :disabled='loading' v-model='scope.row.code_module_sort' :min='1' controls-position='right'
|
||||
@change='handleEditOrder(scope.row)'></el-input-number>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<template #chaoz="scope">
|
||||
<el-space>
|
||||
<el-button v-if="scope.row.code_module_audit == 1" type="warning" size="small" @click="handleAudit(scope.row)">
|
||||
审核
|
||||
</el-button>
|
||||
<el-button size="small" @click="handleUpdate(scope.row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-dropdown @command="handleCommand">
|
||||
<el-button type="primary" size="small">
|
||||
更多<el-icon class="el-icon--right"><arrow-down /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item :command="{ type: 'detail', row: scope.row }">
|
||||
详情
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="{ type: 'delete', row: scope.row }">
|
||||
删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-space>
|
||||
</template>
|
||||
</DataTable>
|
||||
|
||||
<!-- 添加代码块 -->
|
||||
<AddCodeModuleDialog v-model="addCodeModuleDialogVisible" :done="() => tableRef.reload()"></AddCodeModuleDialog>
|
||||
<!-- 编辑代码块 -->
|
||||
<EditCodeModuleDialog v-model="EditCodeModuleDialogVisible" :data="EditCodeModuleDialogRow"
|
||||
:done="() => tableRef.reload()"></EditCodeModuleDialog>
|
||||
<!-- 代码块详情 -->
|
||||
<DetailCodeModuleDialog v-model="DetailCodeModuleDialogVisible" :data="DetailCodeModuleDialogRow">
|
||||
</DetailCodeModuleDialog>
|
||||
</template>
|
||||
<script setup>
|
||||
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 AddCodeModuleDialog from './components/AddCodeModuleDialog.vue';
|
||||
import EditCodeModuleDialog from './components/EditCodeModuleDialog.vue';
|
||||
import DetailCodeModuleDialog from './components/DetailCodeModuleDialog.vue';
|
||||
|
||||
const tableRef = ref();
|
||||
const selectionData = ref([]);
|
||||
const store = useLoginStore();
|
||||
|
||||
const addCodeModuleDialogVisible = ref(false);
|
||||
const EditCodeModuleDialogVisible = ref(false);
|
||||
const EditCodeModuleDialogRow = ref({});
|
||||
const DetailCodeModuleDialogVisible = ref(false);
|
||||
const DetailCodeModuleDialogRow = ref({});
|
||||
|
||||
const headers = {
|
||||
Accept: "application/json",
|
||||
...store.headers,
|
||||
};
|
||||
|
||||
// 查询参数
|
||||
const params = reactive({
|
||||
customer_guid: "",
|
||||
code_module_catetory_guid: "",
|
||||
code_module_name: "",
|
||||
code_module_audit: "",
|
||||
|
||||
});
|
||||
const column = [
|
||||
|
||||
{
|
||||
fixed: true,
|
||||
type: 'selection'
|
||||
},
|
||||
{
|
||||
prop: "customer_name",
|
||||
label: '所属客户',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
prop: "code_module_catetory_name",
|
||||
label: '类目',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
prop: "code_module_name",
|
||||
label: '代码块名称',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
prop: "code_module_sort",
|
||||
label: '排序',
|
||||
width: '180'
|
||||
},
|
||||
{
|
||||
prop: "code_module_audit",
|
||||
label: '审核状态',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
label: '操作',
|
||||
prop: 'chaoz',
|
||||
width: '250',
|
||||
fixed: 'right'
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
const handleCommand = ({ type, row }) => {
|
||||
switch (type) {
|
||||
case "detail":
|
||||
handleDetail(row);
|
||||
break;
|
||||
case 'delete':
|
||||
handleDelete([row]);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
// 删除数据
|
||||
const handleDelete = data => {
|
||||
ElMessageBox.confirm(`您确定要删除该代码块吗?`).then(async () => {
|
||||
const res = await deleteCodeModule({
|
||||
code_module_guid: data.map(v => v.code_module_guid).join()
|
||||
});
|
||||
if (res) {
|
||||
tableRef.value.reload();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 修改
|
||||
function handleUpdate(row) {
|
||||
EditCodeModuleDialogVisible.value = true
|
||||
EditCodeModuleDialogRow.value = row
|
||||
}
|
||||
|
||||
// 详情
|
||||
function handleDetail(row) {
|
||||
DetailCodeModuleDialogVisible.value = true
|
||||
DetailCodeModuleDialogRow.value = row
|
||||
}
|
||||
|
||||
|
||||
// 导入方法
|
||||
let loadingImoprt = null;
|
||||
const uploadLoading = () => {
|
||||
loadingImoprt = ElLoading.service({
|
||||
lock: true,
|
||||
text: "正在导入中...",
|
||||
background: "rgba(255, 255, 255, 0.7)",
|
||||
});
|
||||
};
|
||||
const closeUploadLoading = () => loadingImoprt.close();
|
||||
const handleExcelSuccess = (value) => {
|
||||
if (value.code == 0) {
|
||||
ElMessageBox.alert(value.msg, "导入信息", {
|
||||
dangerouslyUseHTMLString: true,
|
||||
confirmButtonText: "确定",
|
||||
});
|
||||
} else {
|
||||
ElMessage.error(value.msg);
|
||||
}
|
||||
closeUploadLoading();
|
||||
tableRef.value.reload();
|
||||
};
|
||||
|
||||
|
||||
/** 审核按钮操作 */
|
||||
const AuditData = reactive({
|
||||
code_module_audit: null,
|
||||
code_module_guid: null,
|
||||
})
|
||||
function handleAudit(row) {
|
||||
const Ids = row.code_module_guid || selectionData.value.map(v => v.code_module_guid).join()
|
||||
console.log(Ids);
|
||||
|
||||
ElMessageBox.confirm("是否通过审核?", "系统提示", {
|
||||
distinguishCancelAndClose: true,
|
||||
confirmButtonText: '通过',
|
||||
cancelButtonText: '驳回',
|
||||
type: "warning",
|
||||
})
|
||||
.then(async () => {
|
||||
AuditData.code_module_audit = 2
|
||||
AuditData.code_module_guid = Ids
|
||||
Audit()
|
||||
})
|
||||
.catch((action) => {
|
||||
if (action == 'cancel') {
|
||||
AuditData.code_module_audit = 3
|
||||
AuditData.code_module_guid = Ids
|
||||
Audit()
|
||||
// console.log("拒绝");
|
||||
}
|
||||
else {
|
||||
// console.log("关闭");
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 审核
|
||||
async function Audit() {
|
||||
audit(AuditData).then((res) => {
|
||||
if (res.code == 0) {
|
||||
AuditData.code_module_audit = null
|
||||
AuditData.code_module_guid = null
|
||||
// ElMessageBox.alert(res.msg, "受理信息", {
|
||||
// dangerouslyUseHTMLString: true,
|
||||
// confirmButtonText: "确定",
|
||||
// callback: () => {
|
||||
// tableRef.value.reload();
|
||||
// },
|
||||
// });
|
||||
ElMessage.success(res.msg)
|
||||
}
|
||||
else {
|
||||
ElMessage.error(res.msg)
|
||||
}
|
||||
tableRef.value.reload();
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//排序
|
||||
const loading = ref(false)
|
||||
async function handleEditOrder(data) {
|
||||
loading.value = true
|
||||
const { code } = await editCodeModule(data);
|
||||
if (code == 0) {
|
||||
loading.value = false
|
||||
tableRef.value.reload()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 字典获取
|
||||
const audit_status = ref([]);
|
||||
async function get_audit_status() {
|
||||
await getDictionary({ dictionary_value: 'audit_status' }).then((res) => {
|
||||
audit_status.value = res
|
||||
})
|
||||
}
|
||||
get_audit_status()
|
||||
</script>
|
105
src/service/code_module.js
Normal file
105
src/service/code_module.js
Normal file
@ -0,0 +1,105 @@
|
||||
import {
|
||||
api,
|
||||
downloadFile,
|
||||
createApiUrl
|
||||
} from '~/utils/axios';
|
||||
|
||||
|
||||
/**
|
||||
* 下载代码块模板
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function downloadTemplate(data) {
|
||||
downloadFile(createApiUrl('CodeModule.CodeModule/downloadTemplate'), data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入代码块
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export const importExcel = createApiUrl('CodeModule.CodeModule/importExcel');
|
||||
|
||||
/**
|
||||
* 导出代码块
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function exportExcel(data) {
|
||||
downloadFile(createApiUrl('CodeModule.CodeModule/exportExcel'), data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取字典值
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function getDictionary(data) {
|
||||
return api.post('Dictionary.Dictionary/getDictionary', data, {});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取代码块列表
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function getCodeModuleList(data) {
|
||||
return api.post('CodeModule.CodeModule/getCodeModuleList', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除代码块
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function deleteCodeModule(data) {
|
||||
return api.post('CodeModule.CodeModule/deleteCodeModule', data, {
|
||||
isTransformResponse: true,
|
||||
isShowSuccessMessage: true,
|
||||
errorMessageText: '删除失败'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加代码块
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function addCodeModule(data) {
|
||||
return api.post('CodeModule.CodeModule/addCodeModule', data, {
|
||||
isTransformResponse: true,
|
||||
isShowSuccessMessage: true,
|
||||
errorMessageText: '添加失败'
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 编辑代码块
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function editCodeModule(data) {
|
||||
return api.post('CodeModule.CodeModule/editCodeModule', data, {
|
||||
isTransformResponse: true,
|
||||
isShowSuccessMessage: true,
|
||||
errorMessageText: '编辑失败'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核代码块
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function audit(data) {
|
||||
return api.post('CodeModule.CodeModule/auditCodeModule', data, {
|
||||
errorMessageText: '审核失败'
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user