feta:完成代码块类目模块页面 fix:客户模块页面调整、代码块模块文件位置调整
This commit is contained in:
parent
1e629bd7b8
commit
18931aa94b
@ -7,7 +7,6 @@
|
||||
<!-- 搜索 -->
|
||||
<el-form inline :model="params">
|
||||
|
||||
|
||||
<el-form-item label="客户名称">
|
||||
<el-input v-model='params.customer_name' placeholder='请输入客户名称'></el-input>
|
||||
</el-form-item>
|
||||
@ -35,7 +34,6 @@
|
||||
<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">
|
||||
@ -48,7 +46,6 @@
|
||||
<!-- 导出 -->
|
||||
<el-button icon="ElIconDocument" @click="exportExcel(params)">导出</el-button>
|
||||
|
||||
|
||||
<!-- 下拉操作 -->
|
||||
<el-dropdown v-if="selectionData.length">
|
||||
<el-button type="primary">
|
@ -0,0 +1,247 @@
|
||||
<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 :lg="24">
|
||||
<el-form-item :label-width="labelWidth" label="上级类目" prop="works_type_parent_guid">
|
||||
<el-cascader class="w100" filterable :options="dataList" :on-change="completeInfo()"
|
||||
:props="{ checkStrictly: true, value: 'code_module_category_guid', label: 'code_module_category_name', emitPath: false }"
|
||||
placeholder="请选择上级类目" clearable v-model="formData.code_module_category_parent_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_category_name">
|
||||
<el-input v-model='formData.code_module_category_name' type="text" placeholder='请输入类目名'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="补充" prop="code_module_category_ps">
|
||||
<el-input v-model='formData.code_module_category_ps' type="text" placeholder='请输入补充'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="全局模式" prop="code_module_category_global_mode">
|
||||
<el-select style="width: 100%;" multiple v-model="formData.code_module_category_global_mode" clearable
|
||||
:disabled="commonFiledDisabled" placeholder="请选择">
|
||||
<el-option v-for="item in global_mode" :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_category_library_type">
|
||||
<el-select :disabled="commonFiledDisabled" v-model="formData.code_module_category_library_type" clearable
|
||||
placeholder="请选择">
|
||||
<el-option v-for="item in library_type" :key="item.dicitonary_guid" :label="item.dictionary_name"
|
||||
:value="parseInt(item.dictionary_value)"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="所属客户" prop="customer_guid">
|
||||
<el-select :disabled="commonFiledDisabled" style="width: 100%;" v-model="formData.customer_guid" clearable
|
||||
placeholder="请选择">
|
||||
<el-option v-for="item in customerOptionList" :key="item.dictionary_guid" :label="item.customer_show_text"
|
||||
:value="item.customer_guid"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="排序" prop="code_module_category_sort">
|
||||
<el-input-number min="0" v-model="formData.code_module_category_sort" controls-position="right" />
|
||||
</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 { addCodeModuleCategory, getDictionary, getCodeModuleCategoryList, getCodeModuleCategoryInfo } from "~/service/code_module_category";
|
||||
import { getCustomerOptionList } from "~/service/customer";
|
||||
import { useLoginStore } from "~/store";
|
||||
|
||||
// --业务参数
|
||||
|
||||
|
||||
|
||||
// --业务方法
|
||||
|
||||
// 字典获取
|
||||
const global_mode = ref([]);
|
||||
async function get_global_mode() {
|
||||
await getDictionary({ dictionary_value: 'global_mode' }).then((res) => {
|
||||
global_mode.value = res
|
||||
})
|
||||
}
|
||||
// 字典获取
|
||||
const library_type = ref([]);
|
||||
async function get_library_type() {
|
||||
await getDictionary({ dictionary_value: 'library_type' }).then((res) => {
|
||||
library_type.value = res
|
||||
})
|
||||
}
|
||||
// 字典获取
|
||||
const audit_status = ref([]);
|
||||
async function get_audit_status() {
|
||||
await getDictionary({ dictionary_value: 'audit_status' }).then((res) => {
|
||||
audit_status.value = res
|
||||
})
|
||||
}
|
||||
// 获取客户下拉选项数据
|
||||
const customerOptionList = ref([]);
|
||||
async function getCustomerOptions() {
|
||||
await getCustomerOptionList().then((res) => {
|
||||
customerOptionList.value = res.data
|
||||
})
|
||||
}
|
||||
//获取代码块类目树形列表
|
||||
const dataList = ref([])
|
||||
async function getList() {
|
||||
await getCodeModuleCategoryList().then((res) => {
|
||||
if (res.code == 0) {
|
||||
dataList.value = res.data
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取并补全父子类目共用信息
|
||||
const commonFiledDisabled = ref(false);
|
||||
async function completeInfo() {
|
||||
//选中时
|
||||
if (formData.code_module_category_parent_guid && formData.code_module_category_parent_guid != '0') {
|
||||
await getCodeModuleCategoryInfo({ code_module_category_guid: formData.code_module_category_parent_guid }).then((res) => {
|
||||
if (res.code == 0) {
|
||||
let data = res.data;
|
||||
formData.code_module_category_global_mode = data.code_module_category_global_mode
|
||||
formData.code_module_category_library_type = data.code_module_category_library_type
|
||||
formData.customer_guid = data.customer_guid
|
||||
commonFiledDisabled.value = true;
|
||||
ElMessage.success('父子类目共用信息补全成功!')
|
||||
}
|
||||
})
|
||||
} //清空时
|
||||
if (!formData.code_module_category_parent_guid) {
|
||||
commonFiledDisabled.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --基础参数
|
||||
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({
|
||||
code_module_category_sort: 0
|
||||
});
|
||||
|
||||
const uoloadData = ref({
|
||||
dirName: "CodeModuleCategory"
|
||||
})
|
||||
|
||||
watch(props, (v) => {
|
||||
dialogVisible.value = v.modelValue;
|
||||
});
|
||||
|
||||
const rules = reactive({
|
||||
code_module_category_name: [
|
||||
{
|
||||
required: true,
|
||||
message: '类目名不能为空'
|
||||
}
|
||||
],
|
||||
code_module_category_ps: [
|
||||
{
|
||||
required: true,
|
||||
message: '补充不能为空'
|
||||
}
|
||||
],
|
||||
code_module_category_sort: [
|
||||
{
|
||||
required: true,
|
||||
message: '排序不能为空'
|
||||
}
|
||||
],
|
||||
code_module_category_global_mode: [
|
||||
{
|
||||
required: true,
|
||||
message: '全局模式不能为空'
|
||||
}
|
||||
],
|
||||
code_module_category_library_type: [
|
||||
{
|
||||
required: true,
|
||||
message: '库类型不能为空'
|
||||
}
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
// --基础方法
|
||||
|
||||
// 打开弹窗时执行
|
||||
const openDialog = () => {
|
||||
get_global_mode()
|
||||
get_library_type()
|
||||
get_audit_status()
|
||||
getCustomerOptions()
|
||||
getList()
|
||||
};
|
||||
|
||||
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, msg } = await addCodeModuleCategory(formData);
|
||||
if (code == 0) {
|
||||
closeDialog();
|
||||
props.done();
|
||||
ElMessage.success(msg);
|
||||
} else {
|
||||
isBtnLod.value = false;
|
||||
ElMessage.error(msg);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const handleResetClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
@ -0,0 +1,151 @@
|
||||
<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 :lg="24">
|
||||
<el-form-item :label-width="labelWidth" label="上级类目" prop="works_type_parent_guid">
|
||||
<el-cascader class="w100" filterable :options="dataList"
|
||||
:props="{ checkStrictly: true, value: 'code_module_category_guid', label: 'code_module_category_name', emitPath: false }"
|
||||
placeholder="请选择上级类目" clearable v-model="formData.code_module_category_parent_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_category_name">
|
||||
<el-input v-model='formData.code_module_category_name' type="text" placeholder='请输入类目名'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="补充" prop="code_module_category_ps">
|
||||
<el-input v-model='formData.code_module_category_ps' type="text" placeholder='请输入补充'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="全局模式" prop="code_module_category_global_mode">
|
||||
<el-select style="width: 100%;" multiple v-model="formData.code_module_category_global_mode" clearable
|
||||
placeholder="请选择">
|
||||
<el-option v-for="item in global_mode" :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_category_library_type">
|
||||
<el-select v-model="formData.code_module_category_library_type" clearable placeholder="请选择">
|
||||
<el-option v-for="item in library_type" :key="item.dictionary_guid" :label="item.dictionary_name"
|
||||
:value="parseInt(item.dictionary_value)"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="所属客户" prop="customer_guid">
|
||||
<el-select style="width: 100%;" v-model="formData.customer_guid" clearable placeholder="请选择">
|
||||
<el-option v-for="item in customerOptionList" :key="item.dictionary_guid" :label="item.customer_show_text"
|
||||
:value="item.customer_guid"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="排序" prop="code_module_category_sort">
|
||||
<el-input-number min="0" v-model="formData.code_module_category_sort" controls-position="right" />
|
||||
</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_category';
|
||||
import { getCustomerOptionList } from "~/service/customer";
|
||||
|
||||
// --业务参数
|
||||
|
||||
|
||||
|
||||
// --业务方法
|
||||
|
||||
// 字典获取
|
||||
const global_mode = ref([]);
|
||||
async function get_global_mode() {
|
||||
await getDictionary({ dictionary_value: 'global_mode' }).then((res) => {
|
||||
global_mode.value = res
|
||||
})
|
||||
}
|
||||
// 字典获取
|
||||
const library_type = ref([]);
|
||||
async function get_library_type() {
|
||||
await getDictionary({ dictionary_value: 'library_type' }).then((res) => {
|
||||
library_type.value = res
|
||||
})
|
||||
}
|
||||
// 字典获取
|
||||
const audit_status = ref([]);
|
||||
async function get_audit_status() {
|
||||
await getDictionary({ dictionary_value: 'audit_status' }).then((res) => {
|
||||
audit_status.value = res
|
||||
})
|
||||
}
|
||||
// 获取客户下拉选项数据
|
||||
const customerOptionList = ref([]);
|
||||
async function getCustomerOptions() {
|
||||
await getCustomerOptionList().then((res) => {
|
||||
customerOptionList.value = res.data
|
||||
})
|
||||
}
|
||||
//获取代码块类目树形列表
|
||||
const dataList = ref([])
|
||||
function getList() {
|
||||
getCodeModuleCategoryList().then((res) => {
|
||||
if (res.code == 0) {
|
||||
dataList.value = res.data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
// --基础参数
|
||||
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_global_mode()
|
||||
get_library_type()
|
||||
get_audit_status()
|
||||
getCustomerOptions()
|
||||
getList()
|
||||
};
|
||||
|
||||
const closeDialog = () => {
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
@ -0,0 +1,248 @@
|
||||
<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 :lg="24">
|
||||
<el-form-item :label-width="labelWidth" label="上级类目" prop="works_type_parent_guid">
|
||||
<el-cascader class="w100" filterable :options="dataList" :on-change="completeInfo()"
|
||||
:props="{ checkStrictly: true, value: 'code_module_category_guid', label: 'code_module_category_name', emitPath: false }"
|
||||
placeholder="请选择上级类目" clearable v-model="formData.code_module_category_parent_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_category_name">
|
||||
<el-input v-model='formData.code_module_category_name' type="text" placeholder='请输入类目名'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="补充" prop="code_module_category_ps">
|
||||
<el-input v-model='formData.code_module_category_ps' type="text" placeholder='请输入补充'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="全局模式" prop="code_module_category_global_mode">
|
||||
<el-select :disabled="commonFiledDisabled" style="width: 100%;" multiple
|
||||
v-model="formData.code_module_category_global_mode" clearable placeholder="请选择">
|
||||
<el-option v-for="item in global_mode" :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_category_library_type">
|
||||
<el-select :disabled="commonFiledDisabled" v-model="formData.code_module_category_library_type" clearable
|
||||
placeholder="请选择">
|
||||
<el-option v-for="item in library_type" :key="item.dictionary_guid" :label="item.dictionary_name"
|
||||
:value="parseInt(item.dictionary_value)"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="所属客户" prop="customer_guid">
|
||||
<el-select :disabled="commonFiledDisabled" style="width: 100%;" v-model="formData.customer_guid" clearable
|
||||
placeholder="请选择">
|
||||
<el-option v-for="item in customerOptionList" :key="item.dictionary_guid" :label="item.customer_show_text"
|
||||
:value="item.customer_guid"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="排序" prop="code_module_category_sort">
|
||||
<el-input-number min="0" v-model="formData.code_module_category_sort" controls-position="right" />
|
||||
</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 { editCodeModuleCategory, getDictionary, getCodeModuleCategoryList, getCodeModuleCategoryInfo } from "~/service/code_module_category";
|
||||
import { getCustomerOptionList } from "~/service/customer";
|
||||
import { useLoginStore } from "~/store";
|
||||
|
||||
// --业务参数
|
||||
|
||||
|
||||
|
||||
// --业务方法
|
||||
|
||||
// 字典获取
|
||||
const global_mode = ref([]);
|
||||
async function get_global_mode() {
|
||||
await getDictionary({ dictionary_value: 'global_mode' }).then((res) => {
|
||||
global_mode.value = res
|
||||
})
|
||||
}
|
||||
// 字典获取
|
||||
const library_type = ref([]);
|
||||
async function get_library_type() {
|
||||
await getDictionary({ dictionary_value: 'library_type' }).then((res) => {
|
||||
library_type.value = res
|
||||
})
|
||||
}
|
||||
// 字典获取
|
||||
const audit_status = ref([]);
|
||||
async function get_audit_status() {
|
||||
await getDictionary({ dictionary_value: 'audit_status' }).then((res) => {
|
||||
audit_status.value = res
|
||||
})
|
||||
}
|
||||
// 获取客户下拉选项数据
|
||||
const customerOptionList = ref([]);
|
||||
async function getCustomerOptions() {
|
||||
await getCustomerOptionList().then((res) => {
|
||||
customerOptionList.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
const dataList = ref([])
|
||||
function getList() {
|
||||
getCodeModuleCategoryList().then((res) => {
|
||||
if (res.code == 0) {
|
||||
dataList.value = res.data
|
||||
}
|
||||
})
|
||||
}
|
||||
//补全父子类目共用信息
|
||||
const antiShake = ref();
|
||||
const commonFiledDisabled = ref(false);
|
||||
async function completeInfo() {
|
||||
//选中时
|
||||
if (formData.value.code_module_category_parent_guid && formData.value.code_module_category_parent_guid != '0' && formData.value.code_module_category_parent_guid != antiShake.value) {
|
||||
antiShake.value = formData.value.code_module_category_parent_guid
|
||||
await getCodeModuleCategoryInfo({ code_module_category_guid: formData.value.code_module_category_parent_guid }).then((res) => {
|
||||
if (res.code == 0) {
|
||||
let data = res.data;
|
||||
formData.value.code_module_category_global_mode = data.code_module_category_global_mode
|
||||
formData.value.code_module_category_library_type = data.code_module_category_library_type
|
||||
formData.value.customer_guid = data.customer_guid
|
||||
commonFiledDisabled.value = true;
|
||||
ElMessage.success('父子类目共用信息补全成功!')
|
||||
} else {
|
||||
ElMessage.error(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
//清空时
|
||||
if (!formData.value.code_module_category_parent_guid) {
|
||||
commonFiledDisabled.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// --基础参数
|
||||
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 = () => {
|
||||
get_global_mode()
|
||||
get_library_type()
|
||||
get_audit_status()
|
||||
getCustomerOptions()
|
||||
getList()
|
||||
};
|
||||
|
||||
const closeDialog = () => {
|
||||
props.done();
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
|
||||
const rules = reactive({
|
||||
code_module_category_name: [
|
||||
{
|
||||
required: true,
|
||||
message: '类目名不能为空'
|
||||
}
|
||||
],
|
||||
code_module_category_ps: [
|
||||
{
|
||||
required: true,
|
||||
message: '补充不能为空'
|
||||
}
|
||||
],
|
||||
code_module_category_sort: [
|
||||
{
|
||||
required: true,
|
||||
message: '排序不能为空'
|
||||
}
|
||||
],
|
||||
code_module_category_global_mode: [
|
||||
{
|
||||
required: true,
|
||||
message: '全局模式不能为空'
|
||||
}
|
||||
],
|
||||
code_module_category_library_type: [
|
||||
{
|
||||
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, msg } = await editCodeModuleCategory(formData.value);
|
||||
if (code == 0) {
|
||||
closeDialog();
|
||||
props.done();
|
||||
ElMessage.success(msg);
|
||||
} else {
|
||||
isBtnLod.value = false;
|
||||
ElMessage.error(msg);
|
||||
}
|
||||
});
|
||||
};
|
||||
const handleResetClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
268
src/pages/index/code/code_module_category/index.vue
Normal file
268
src/pages/index/code/code_module_category/index.vue
Normal file
@ -0,0 +1,268 @@
|
||||
<template>
|
||||
<!-- 面包屑 -->
|
||||
<el-breadcrumb>
|
||||
<el-breadcrumb-item>代码块类目管理</el-breadcrumb-item>
|
||||
<el-breadcrumb-item to="/code_module_category/list">代码块类目列表</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<!-- 搜索 -->
|
||||
<el-form inline :model="params">
|
||||
|
||||
<el-form-item label="类目名">
|
||||
<el-input v-model='params.code_module_category_name' placeholder='请输入类目名'></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="补充">
|
||||
<el-input v-model='params.code_module_category_ps' placeholder='请输入补充'></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="全局模式">
|
||||
<el-select v-model="params.code_module_category_global_mode" clearable placeholder="请选择">
|
||||
<el-option v-for="item in global_mode" :key="item.dictionary_guid" :label="item.dictionary_name"
|
||||
:value="item.dictionary_value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="库类型">
|
||||
<el-select v-model="params.code_module_category_library_type" clearable placeholder="请选择">
|
||||
<el-option v-for="item in library_type" :key="item.dictionary_guid" :label="item.dictionary_name"
|
||||
:value="item.dictionary_value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="客户信息">
|
||||
<el-input v-model='params.customer' placeholder='请输入客户名称/账号'></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="审核状态">
|
||||
<el-select v-model="params.code_module_category_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="getList()" icon="ElIconSearch">
|
||||
搜索
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-space style="margin-bottom: 10px;">
|
||||
<!-- 添加代码块类目 -->
|
||||
<el-col :span="1">
|
||||
<el-button type="primary" @click="addCodeModuleCategoryDialogVisible = true"> 添加 </el-button>
|
||||
</el-col>
|
||||
|
||||
|
||||
<!-- 下拉操作 -->
|
||||
<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>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-space>
|
||||
<!-- 数据表格 -->
|
||||
<el-table :data="dataList" ref="tableRef" border highlight-current-row
|
||||
:onSelectionChange="data => (selectionData = data)" :default-expand-all="tableExpandAll"
|
||||
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">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="code_module_category_sort" width="200" label="排序" sort>
|
||||
<template #default="scope">
|
||||
<el-input-number v-model='scope.row.code_module_category_sort' controls-position="right"
|
||||
@change="handleEditOrder(scope.row)"></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" align="center" width="250" fixed='right'>
|
||||
<template #default="scope">
|
||||
<el-button size="small" type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
|
||||
<el-button size="small" type="danger" @click="handleDelete([scope.row])">删除</el-button>
|
||||
<el-button size="small" type="info" @click="handleDetail(scope.row)">查看</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<pagination :total="pageCount" v-model:page="params.page" v-model:limit="params.limit" @pagination="getList()" />
|
||||
|
||||
<!-- 添加代码块类目 -->
|
||||
<AddCodeModuleCategoryDialog v-model="addCodeModuleCategoryDialogVisible" :done="() => getList()">
|
||||
</AddCodeModuleCategoryDialog>
|
||||
<!-- 编辑代码块类目 -->
|
||||
<EditCodeModuleCategoryDialog v-model="EditCodeModuleCategoryDialogVisible" :data="EditCodeModuleCategoryDialogRow"
|
||||
:done="() => getList()"></EditCodeModuleCategoryDialog>
|
||||
<!-- 代码块类目详情 -->
|
||||
<DetailCodeModuleCategoryDialog v-model="DetailCodeModuleCategoryDialogVisible"
|
||||
:data="DetailCodeModuleCategoryDialogRow"></DetailCodeModuleCategoryDialog>
|
||||
</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 AddCodeModuleCategoryDialog from './components/AddCodeModuleCategoryDialog.vue';
|
||||
import EditCodeModuleCategoryDialog from './components/EditCodeModuleCategoryDialog.vue';
|
||||
import DetailCodeModuleCategoryDialog from './components/DetailCodeModuleCategoryDialog.vue';
|
||||
|
||||
const tableRef = ref();
|
||||
const selectionData = ref([]);
|
||||
const store = useLoginStore();
|
||||
|
||||
const addCodeModuleCategoryDialogVisible = ref(false);
|
||||
const EditCodeModuleCategoryDialogVisible = ref(false);
|
||||
const EditCodeModuleCategoryDialogRow = ref({});
|
||||
const DetailCodeModuleCategoryDialogVisible = ref(false);
|
||||
const DetailCodeModuleCategoryDialogRow = ref({});
|
||||
|
||||
const headers = {
|
||||
Accept: "application/json",
|
||||
...store.headers,
|
||||
};
|
||||
|
||||
const pageCount = ref(0)
|
||||
// 查询参数
|
||||
const params = reactive({
|
||||
code_module_category_name: "",
|
||||
code_module_category_ps: "",
|
||||
code_module_category_global_mode: "",
|
||||
code_module_category_library_type: "",
|
||||
customer: "",
|
||||
code_module_category_audit: "",
|
||||
page: 1,
|
||||
limit: 10,
|
||||
});
|
||||
const column = [
|
||||
|
||||
{
|
||||
fixed: true,
|
||||
type: 'selection'
|
||||
},
|
||||
{
|
||||
prop: "code_module_category_name",
|
||||
label: '类目名',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
prop: "code_module_category_ps",
|
||||
label: '补充',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
prop: "code_module_category_parent_guid",
|
||||
label: '父级guid',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
prop: "code_module_category_sort",
|
||||
label: '排序',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
prop: "code_module_category_global_mode",
|
||||
label: '全局模式',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
prop: "code_module_category_library_type",
|
||||
label: '库类型',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
prop: "customer_guid",
|
||||
label: '所属客户',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
prop: "code_module_category_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 dataList = ref([])
|
||||
function getList() {
|
||||
getCodeModuleCategoryList(params).then((res) => {
|
||||
if (res.code == 0) {
|
||||
dataList.value = res.data
|
||||
pageCount.value = res.count
|
||||
}
|
||||
})
|
||||
}
|
||||
getList()
|
||||
|
||||
//排序
|
||||
async function handleEditOrder(data) {
|
||||
const { code, msg } = await editCodeModuleCategory(data);
|
||||
getList();
|
||||
}
|
||||
|
||||
// 删除数据
|
||||
const handleDelete = data => {
|
||||
ElMessageBox.confirm(`您确定要删除该代码块类目吗?`).then(async () => {
|
||||
const res = await deleteCodeModuleCategory({
|
||||
code_module_category_guid: data.map(v => v.code_module_category_guid).join()
|
||||
});
|
||||
if (res) {
|
||||
getList()
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 修改
|
||||
function handleUpdate(row) {
|
||||
EditCodeModuleCategoryDialogVisible.value = true
|
||||
EditCodeModuleCategoryDialogRow.value = row
|
||||
}
|
||||
|
||||
// 详情
|
||||
function handleDetail(row) {
|
||||
DetailCodeModuleCategoryDialogVisible.value = true
|
||||
DetailCodeModuleCategoryDialogRow.value = row
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 字典获取
|
||||
const global_mode = ref([]);
|
||||
async function get_global_mode() {
|
||||
await getDictionary({ dictionary_value: 'global_mode' }).then((res) => {
|
||||
global_mode.value = res
|
||||
})
|
||||
}
|
||||
get_global_mode()
|
||||
// 字典获取
|
||||
const library_type = ref([]);
|
||||
async function get_library_type() {
|
||||
await getDictionary({ dictionary_value: 'library_type' }).then((res) => {
|
||||
library_type.value = res
|
||||
})
|
||||
}
|
||||
get_library_type()
|
||||
// 字典获取
|
||||
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>
|
@ -2,6 +2,8 @@
|
||||
<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_name">
|
||||
<el-input v-model='formData.customer_name' type="text" placeholder='请输入客户昵称'></el-input>
|
||||
@ -28,13 +30,21 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="客户性别" prop="customer_sex">
|
||||
<el-form-item :label-width="labelWidth" label="客户性别" prop="customer_sex">
|
||||
<el-select v-model="formData.customer_sex" clearable placeholder="请选择">
|
||||
<el-option v-for="item in sex" :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='customer_blacklist'>
|
||||
<el-switch v-model='formData.customer_blacklist' inline-prompt :inactive-value=2 :active-value=1
|
||||
style='--el-switch-on-color: #ff4949;' />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
@ -65,6 +75,13 @@ async function get_sex() {
|
||||
sex.value = res
|
||||
})
|
||||
}
|
||||
// 字典获取
|
||||
const blacklist = ref([]);
|
||||
async function get_blacklist() {
|
||||
await getDictionary({ dictionary_value: 'blacklist' }).then((res) => {
|
||||
blacklist.value = res
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -114,25 +131,6 @@ const rules = reactive({
|
||||
message: '客户密码不能为空'
|
||||
}
|
||||
],
|
||||
// customer_phone: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '客户手机号不能为空'
|
||||
// }
|
||||
// ],
|
||||
// customer_email: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '客户邮箱不能为空'
|
||||
// }
|
||||
// ],
|
||||
// customer_sex: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '客户性别不能为空'
|
||||
// }
|
||||
// ],
|
||||
|
||||
});
|
||||
|
||||
|
||||
@ -141,6 +139,7 @@ const rules = reactive({
|
||||
// 打开弹窗时执行
|
||||
const openDialog = () => {
|
||||
get_sex()
|
||||
get_blacklist()
|
||||
|
||||
};
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
<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_name">
|
||||
<el-input v-model='formData.customer_name' type="text" placeholder='请输入客户昵称'></el-input>
|
||||
@ -12,11 +14,6 @@
|
||||
<el-input v-model='formData.customer_account' type="text" placeholder='请输入客户账号'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户密码" prop="customer_password">
|
||||
<el-input v-model='formData.customer_password' type="text" placeholder='请输入客户密码'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户手机号" prop="customer_phone">
|
||||
<el-input v-model='formData.customer_phone' type="text" placeholder='请输入客户手机号'></el-input>
|
||||
@ -28,13 +25,20 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="客户性别" prop="customer_sex">
|
||||
<el-form-item :label-width="labelWidth" label="客户性别" prop="customer_sex">
|
||||
<el-select v-model="formData.customer_sex" clearable placeholder="请选择">
|
||||
<el-option v-for="item in sex" :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='customer_blacklist'>
|
||||
<el-switch v-model='formData.customer_blacklist' inline-prompt :inactive-value=2 :active-value=1
|
||||
style='--el-switch-on-color: #ff4949;' />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
@ -59,6 +63,13 @@ async function get_sex() {
|
||||
sex.value = res
|
||||
})
|
||||
}
|
||||
// 字典获取
|
||||
const blacklist = ref([]);
|
||||
async function get_blacklist() {
|
||||
await getDictionary({ dictionary_value: 'blacklist' }).then((res) => {
|
||||
blacklist.value = res
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -88,6 +99,7 @@ watch(props, (v) => {
|
||||
const openDialog = () => {
|
||||
|
||||
get_sex()
|
||||
get_blacklist()
|
||||
|
||||
};
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
<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_name">
|
||||
<el-input v-model='formData.customer_name' type="text" placeholder='请输入客户昵称'></el-input>
|
||||
@ -9,12 +11,7 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户账号" prop="customer_account">
|
||||
<el-input v-model='formData.customer_account' type="text" placeholder='请输入客户账号'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户密码" prop="customer_password">
|
||||
<el-input v-model='formData.customer_password' type="text" placeholder='请输入客户密码'></el-input>
|
||||
<el-input disabled v-model='formData.customer_account' type="text" placeholder='请输入客户账号'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
@ -28,13 +25,21 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="客户性别" prop="customer_sex">
|
||||
<el-form-item :label-width="labelWidth" label="客户性别" prop="customer_sex">
|
||||
<el-select v-model="formData.customer_sex" clearable placeholder="请选择">
|
||||
<el-option v-for="item in sex" :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='customer_blacklist'>
|
||||
<el-switch v-model='formData.customer_blacklist' inline-prompt :inactive-value=2 :active-value=1
|
||||
style='--el-switch-on-color: #ff4949;' />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@ -64,6 +69,13 @@ async function get_sex() {
|
||||
sex.value = res
|
||||
})
|
||||
}
|
||||
// 字典获取
|
||||
const blacklist = ref([]);
|
||||
async function get_blacklist() {
|
||||
await getDictionary({ dictionary_value: 'blacklist' }).then((res) => {
|
||||
blacklist.value = res
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -94,13 +106,12 @@ const uoloadData = ref({
|
||||
// --基础方法
|
||||
watch(props, (v) => {
|
||||
formData.value = v.data;
|
||||
|
||||
|
||||
});
|
||||
|
||||
// 打开弹窗时执行
|
||||
const openDialog = () => {
|
||||
get_sex()
|
||||
get_blacklist()
|
||||
|
||||
};
|
||||
|
||||
@ -122,31 +133,6 @@ const rules = reactive({
|
||||
message: '客户账号不能为空'
|
||||
}
|
||||
],
|
||||
// customer_password: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '客户密码不能为空'
|
||||
// }
|
||||
// ],
|
||||
// customer_phone: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '客户手机号不能为空'
|
||||
// }
|
||||
// ],
|
||||
// customer_email: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '客户邮箱不能为空'
|
||||
// }
|
||||
// ],
|
||||
// customer_sex: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '客户性别不能为空'
|
||||
// }
|
||||
// ],
|
||||
|
||||
});
|
||||
|
||||
const handleEditClick = async (formEl) => {
|
||||
@ -158,7 +144,6 @@ const handleEditClick = async (formEl) => {
|
||||
}
|
||||
isBtnLod.value = true;
|
||||
|
||||
|
||||
const { code } = await editCustomer(formData.value);
|
||||
if (code == 0) {
|
||||
closeDialog();
|
||||
|
@ -0,0 +1,107 @@
|
||||
<template>
|
||||
<el-dialog v-model="props.modelValue" title="修改客户密码" width="900px" @closed="closeDialog" @open="openDialog">
|
||||
<el-form ref="formRef" :model="formData" :rules="rules">
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户昵称" prop="customer_name">
|
||||
<el-input v-model='formData.customer_name' disabled type="text" placeholder='请输入客户昵称'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户账号" prop="customer_account">
|
||||
<el-input v-model='formData.customer_account' disabled type="text" placeholder='请输入客户账号'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="客户密码" prop="customer_password">
|
||||
<el-input v-model='formData.customer_password' type="text" placeholder='请输入客户密码'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button type="primary" @click="handleEditClick(formRef)">编辑</el-button>
|
||||
<el-button @click="handleResetClick(formRef)">重置</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { editPassword } from "~/service/customer";
|
||||
import { useLoginStore } from "~/store";
|
||||
|
||||
|
||||
// --基础参数
|
||||
const store = useLoginStore();
|
||||
const headers = {
|
||||
Accept: "application/json",
|
||||
...store.headers,
|
||||
};
|
||||
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: "Customer"
|
||||
})
|
||||
|
||||
|
||||
// --基础方法
|
||||
watch(props, (v) => {
|
||||
formData.value = v.data;
|
||||
console.log(formData.value);
|
||||
});
|
||||
|
||||
// 打开弹窗时执行
|
||||
const openDialog = () => {
|
||||
|
||||
|
||||
};
|
||||
|
||||
const closeDialog = () => {
|
||||
props.done();
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
|
||||
const rules = reactive({
|
||||
customer_password: [
|
||||
{
|
||||
required: true,
|
||||
message: '客户密码不能为空'
|
||||
}
|
||||
],
|
||||
});
|
||||
|
||||
const handleEditClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.validate(async (valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { code } = await editPassword(formData.value);
|
||||
if (code == 0) {
|
||||
closeDialog();
|
||||
props.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
const handleResetClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
|
@ -6,6 +6,8 @@
|
||||
</el-breadcrumb>
|
||||
<!-- 搜索 -->
|
||||
<el-form inline :model="params">
|
||||
|
||||
|
||||
<el-form-item label="客户昵称">
|
||||
<el-input v-model='params.customer_name' placeholder='请输入客户昵称'></el-input>
|
||||
</el-form-item>
|
||||
@ -24,6 +26,12 @@
|
||||
:value="item.dictionary_value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="黑名单">
|
||||
<el-select v-model="params.customer_blacklist" clearable placeholder="请选择">
|
||||
<el-option v-for="item in blacklist" :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">
|
||||
搜索
|
||||
@ -35,6 +43,7 @@
|
||||
<el-col :span="1">
|
||||
<el-button type="primary" @click="addCustomerDialogVisible = true"> 添加 </el-button>
|
||||
</el-col>
|
||||
|
||||
<!-- 下拉操作 -->
|
||||
<el-dropdown v-if="selectionData.length">
|
||||
<el-button type="primary">
|
||||
@ -58,8 +67,10 @@
|
||||
<dict-tag :options='sex' :value='scope.row.customer_sex' />
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<template #customer_blacklist="scope">
|
||||
<el-switch v-model="scope.row.customer_blacklist" :active-value="1" :inactive-value="2"
|
||||
style='--el-switch-on-color: #ff4949;' @change="editCustomerBlacklist(scope.row)" />
|
||||
</template>
|
||||
|
||||
<template #chaoz="scope">
|
||||
<el-space>
|
||||
@ -78,6 +89,9 @@
|
||||
<el-dropdown-item :command="{ type: 'delete', row: scope.row }">
|
||||
删除
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="{ type: 'edit_psw', row: scope.row }">
|
||||
修改密码
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
@ -92,6 +106,8 @@
|
||||
</EditCustomerDialog>
|
||||
<!-- 客户详情 -->
|
||||
<DetailCustomerDialog v-model="DetailCustomerDialogVisible" :data="DetailCustomerDialogRow"></DetailCustomerDialog>
|
||||
<!-- 修改密码 -->
|
||||
<EditPswDialog v-model="EditPswDialogVisible" :data="DditPswDialogRow" :done="() => tableRef.reload()"></EditPswDialog>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ArrowDown } from '@element-plus/icons-vue';
|
||||
@ -101,6 +117,7 @@ import { getCustomerList, editCustomer, deleteCustomer, getDictionary } from '~/
|
||||
import AddCustomerDialog from './components/AddCustomerDialog.vue';
|
||||
import EditCustomerDialog from './components/EditCustomerDialog.vue';
|
||||
import DetailCustomerDialog from './components/DetailCustomerDialog.vue';
|
||||
import EditPswDialog from './components/EditPswDialog.vue';
|
||||
|
||||
const tableRef = ref();
|
||||
const selectionData = ref([]);
|
||||
@ -111,6 +128,8 @@ const EditCustomerDialogVisible = ref(false);
|
||||
const EditCustomerDialogRow = ref({});
|
||||
const DetailCustomerDialogVisible = ref(false);
|
||||
const DetailCustomerDialogRow = ref({});
|
||||
const EditPswDialogVisible = ref(false);
|
||||
const DditPswDialogRow = ref({});
|
||||
|
||||
const headers = {
|
||||
Accept: "application/json",
|
||||
@ -124,6 +143,7 @@ const params = reactive({
|
||||
customer_phone: "",
|
||||
customer_email: "",
|
||||
customer_sex: "",
|
||||
customer_blacklist: "",
|
||||
|
||||
});
|
||||
const column = [
|
||||
@ -157,6 +177,11 @@ const column = [
|
||||
label: '客户性别',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
prop: "customer_blacklist",
|
||||
label: '黑名单',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
label: '操作',
|
||||
prop: 'chaoz',
|
||||
@ -174,6 +199,9 @@ const handleCommand = ({ type, row }) => {
|
||||
case 'delete':
|
||||
handleDelete([row]);
|
||||
break;
|
||||
case 'edit_psw':
|
||||
handleEditPswShow(row);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
@ -189,6 +217,12 @@ const handleDelete = data => {
|
||||
});
|
||||
};
|
||||
|
||||
// 修改黑名单状态
|
||||
const editCustomerBlacklist = data => {
|
||||
data.customer_blacklist == 1 ? 2 : 1
|
||||
editCustomer(data);
|
||||
};
|
||||
|
||||
// 修改
|
||||
function handleUpdate(row) {
|
||||
EditCustomerDialogVisible.value = true
|
||||
@ -201,8 +235,24 @@ function handleDetail(row) {
|
||||
DetailCustomerDialogRow.value = row
|
||||
}
|
||||
|
||||
// 修改密码
|
||||
function handleEditPswShow(row) {
|
||||
EditPswDialogVisible.value = true
|
||||
DditPswDialogRow.value = row
|
||||
}
|
||||
|
||||
|
||||
// 展示切换
|
||||
async function handleEditShow(data) {
|
||||
if (data.customer_blacklist === 1) return;
|
||||
|
||||
loading.value = true
|
||||
const { code } = await editCustomer(data);
|
||||
if (code == 0) {
|
||||
loading.value = false
|
||||
tableRef.value.reload()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -214,4 +264,12 @@ async function get_sex() {
|
||||
})
|
||||
}
|
||||
get_sex()
|
||||
// 字典获取
|
||||
const blacklist = ref([]);
|
||||
async function get_blacklist() {
|
||||
await getDictionary({ dictionary_value: 'blacklist' }).then((res) => {
|
||||
blacklist.value = res
|
||||
})
|
||||
}
|
||||
get_blacklist()
|
||||
</script>
|
||||
|
@ -4,14 +4,13 @@ import {
|
||||
createApiUrl
|
||||
} from '~/utils/axios';
|
||||
|
||||
|
||||
/**
|
||||
* 下载代码块模板
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function downloadTemplate(data) {
|
||||
downloadFile(createApiUrl('CodeModule.CodeModule/downloadTemplate'), data);
|
||||
downloadFile(createApiUrl('Code.CodeModule/downloadTemplate'), data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -19,7 +18,7 @@ export function downloadTemplate(data) {
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export const importExcel = createApiUrl('CodeModule.CodeModule/importExcel');
|
||||
export const importExcel = createApiUrl('Code.CodeModule/importExcel');
|
||||
|
||||
/**
|
||||
* 导出代码块
|
||||
@ -27,15 +26,9 @@ export const importExcel = createApiUrl('CodeModule.CodeModule/importExcel');
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function exportExcel(data) {
|
||||
downloadFile(createApiUrl('CodeModule.CodeModule/exportExcel'), data);
|
||||
downloadFile(createApiUrl('Code.CodeModule/exportExcel'), data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取字典值
|
||||
* @param {Object} data
|
||||
@ -45,14 +38,13 @@ 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);
|
||||
return api.post('Code.CodeModule/getCodeModuleList', data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,7 +53,7 @@ export function getCodeModuleList(data) {
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function deleteCodeModule(data) {
|
||||
return api.post('CodeModule.CodeModule/deleteCodeModule', data, {
|
||||
return api.post('Code.CodeModule/deleteCodeModule', data, {
|
||||
isTransformResponse: true,
|
||||
isShowSuccessMessage: true,
|
||||
errorMessageText: '删除失败'
|
||||
@ -74,7 +66,7 @@ export function deleteCodeModule(data) {
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function addCodeModule(data) {
|
||||
return api.post('CodeModule.CodeModule/addCodeModule', data, {
|
||||
return api.post('Code.CodeModule/addCodeModule', data, {
|
||||
isTransformResponse: true,
|
||||
isShowSuccessMessage: true,
|
||||
errorMessageText: '添加失败'
|
||||
@ -86,7 +78,7 @@ export function addCodeModule(data) {
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function editCodeModule(data) {
|
||||
return api.post('CodeModule.CodeModule/editCodeModule', data, {
|
||||
return api.post('Code.CodeModule/editCodeModule', data, {
|
||||
isTransformResponse: true,
|
||||
isShowSuccessMessage: true,
|
||||
errorMessageText: '编辑失败'
|
||||
@ -99,7 +91,7 @@ export function editCodeModule(data) {
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function audit(data) {
|
||||
return api.post('CodeModule.CodeModule/auditCodeModule', data, {
|
||||
return api.post('Code.CodeModule/auditCodeModule', data, {
|
||||
errorMessageText: '审核失败'
|
||||
});
|
||||
}
|
78
src/service/code_module_category.js
Normal file
78
src/service/code_module_category.js
Normal file
@ -0,0 +1,78 @@
|
||||
import {
|
||||
api,
|
||||
downloadFile,
|
||||
createApiUrl
|
||||
} from '~/utils/axios';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取字典值
|
||||
* @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 getCodeModuleCategoryList(data) {
|
||||
return api.post('Code.CodeModuleCategory/getCodeModuleCategoryList', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取父子类目共用信息
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function getCodeModuleCategoryInfo(data) {
|
||||
return api.post('Code.CodeModuleCategory/getCodeModuleCategoryInfo', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除代码块类目
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function deleteCodeModuleCategory(data) {
|
||||
return api.post('Code.CodeModuleCategory/deleteCodeModuleCategory', data, {
|
||||
isTransformResponse: true,
|
||||
isShowSuccessMessage: true,
|
||||
errorMessageText: '删除失败'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加代码块类目
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function addCodeModuleCategory(data) {
|
||||
return api.post('Code.CodeModuleCategory/addCodeModuleCategory', data, {
|
||||
// isTransformResponse: true,
|
||||
// isShowSuccessMessage: true,
|
||||
errorMessageText: '添加失败'
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 编辑代码块类目
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function editCodeModuleCategory(data) {
|
||||
return api.post('Code.CodeModuleCategory/editCodeModuleCategory', data, {
|
||||
// isTransformResponse: true,
|
||||
// isShowSuccessMessage: true,
|
||||
errorMessageText: '编辑失败'
|
||||
});
|
||||
}
|
@ -13,6 +13,7 @@ export function getDictionary(data) {
|
||||
return api.post('Dictionary.Dictionary/getDictionary', data, {});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取客户列表
|
||||
* @param {Object} data
|
||||
@ -58,4 +59,24 @@ export function editCustomer(data) {
|
||||
isShowSuccessMessage: true,
|
||||
errorMessageText: '编辑失败'
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 修改密码
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function editPassword(data) {
|
||||
return api.post('Customer.Customer/editPassword', data, {
|
||||
isTransformResponse: true,
|
||||
isShowSuccessMessage: true,
|
||||
errorMessageText: '修改失败'
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 获取客户下拉选项数据
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function getCustomerOptionList(data) {
|
||||
return api.post('Customer.Customer/getCustomerOptionList', data);
|
||||
}
|
Loading…
Reference in New Issue
Block a user