|
@@ -0,0 +1,288 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="pageIndexClass">
|
|
|
|
+ <div class="content">
|
|
|
|
+ <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row :action-list="[
|
|
|
|
+ {
|
|
|
|
+ text: '添加',
|
|
|
|
+ action: () => openModal('add'),
|
|
|
|
+ },
|
|
|
|
+ ]" @get-list="getList">
|
|
|
|
+ </byTable>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <el-dialog :title="modalType == 'add' ? '添加' : '编辑'" v-if="dialogVisible" v-model="dialogVisible" width="50%">
|
|
|
|
+ <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit" v-loading="loadingDialog">
|
|
|
|
+
|
|
|
|
+ </byForm>
|
|
|
|
+ <template #footer>
|
|
|
|
+ <el-button @click="dialogVisible = false" size="default">取 消</el-button>
|
|
|
|
+ <el-button type="primary" @click="submitForm()" size="default">确 定</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script setup>
|
|
|
|
+import { computed, ref } from "vue";
|
|
|
|
+import byTable from "@/components/byTable/index";
|
|
|
|
+import byForm from "@/components/byForm/index";
|
|
|
|
+import useUserStore from "@/store/modules/user";
|
|
|
|
+import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
|
+
|
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
|
+const accountCurrency = ref([]);
|
|
|
|
+const typeData = ref([
|
|
|
|
+ {
|
|
|
|
+ label: "收入",
|
|
|
|
+ value: "10",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ label: "支出",
|
|
|
|
+ value: "20",
|
|
|
|
+ },
|
|
|
|
+]);
|
|
|
|
+const sourceList = ref({
|
|
|
|
+ data: [],
|
|
|
|
+ pagination: {
|
|
|
|
+ total: 0,
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageSize: 10,
|
|
|
|
+ keyword: "",
|
|
|
|
+ },
|
|
|
|
+});
|
|
|
|
+const loading = ref(false);
|
|
|
|
+const config = computed(() => {
|
|
|
|
+ return [
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "等级名称",
|
|
|
|
+ prop: "lvName",
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "至少几天跟进一次",
|
|
|
|
+ prop: "minNotFollow",
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "超几天未跟进转公海",
|
|
|
|
+ prop: "maxNotFollow",
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "操作",
|
|
|
|
+ width: "120",
|
|
|
|
+ align: "center",
|
|
|
|
+ },
|
|
|
|
+ renderHTML(row) {
|
|
|
|
+ return [
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "修改",
|
|
|
|
+ type: "primary",
|
|
|
|
+ text: true,
|
|
|
|
+ },
|
|
|
|
+ el: "button",
|
|
|
|
+ click() {
|
|
|
|
+ update(row);
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "删除",
|
|
|
|
+ type: "danger",
|
|
|
|
+ text: true,
|
|
|
|
+ },
|
|
|
|
+ el: "button",
|
|
|
|
+ click() {
|
|
|
|
+ proxy
|
|
|
|
+ .msgConfirm()
|
|
|
|
+ .then((res) => {
|
|
|
|
+ proxy
|
|
|
|
+ .post("/customerLv/delete", {
|
|
|
|
+ id: row.id,
|
|
|
|
+ })
|
|
|
|
+ .then((res) => {
|
|
|
|
+ proxy.msgTip("操作成功", 1);
|
|
|
|
+ getList();
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ .catch((err) => {});
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+});
|
|
|
|
+const corporationList = ref([]);
|
|
|
|
+
|
|
|
|
+const getList = async (req) => {
|
|
|
|
+ sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
|
+ loading.value = true;
|
|
|
|
+ proxy.post("/customerLv/page", sourceList.value.pagination).then((res) => {
|
|
|
|
+ sourceList.value.data = res.rows;
|
|
|
|
+ sourceList.value.pagination.total = res.total;
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ loading.value = false;
|
|
|
|
+ }, 200);
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+getList();
|
|
|
|
+const modalType = ref("add");
|
|
|
|
+const dialogVisible = ref(false);
|
|
|
|
+const loadingDialog = ref(false);
|
|
|
|
+const submit = ref(null);
|
|
|
|
+const formOption = reactive({
|
|
|
|
+ inline: true,
|
|
|
|
+ labelWidth: 150,
|
|
|
|
+ itemWidth: 100,
|
|
|
|
+ rules: [],
|
|
|
|
+});
|
|
|
|
+const formConfig = computed(() => {
|
|
|
|
+ return [
|
|
|
|
+ // {
|
|
|
|
+ // type: "title1",
|
|
|
|
+ // title: "基本信息",
|
|
|
|
+ // },
|
|
|
|
+ {
|
|
|
|
+ type: "input",
|
|
|
|
+ prop: "lvName",
|
|
|
|
+ label: "等级名称",
|
|
|
|
+ required: true,
|
|
|
|
+ itemWidth: 100,
|
|
|
|
+ itemType: "text",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ type: "number",
|
|
|
|
+ prop: "minNotFollow",
|
|
|
|
+ label: "至少几天跟进一次",
|
|
|
|
+ precision: 0,
|
|
|
|
+ min: 0,
|
|
|
|
+ // max: 100,
|
|
|
|
+ controls: false,
|
|
|
|
+ itemWidth: 100,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ type: "number",
|
|
|
|
+ prop: "maxNotFollow",
|
|
|
|
+ label: "超几天未跟进转公海",
|
|
|
|
+ precision: 0,
|
|
|
|
+ min: 0,
|
|
|
|
+ // max: 100,
|
|
|
|
+ controls: false,
|
|
|
|
+ itemWidth: 100,
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+});
|
|
|
|
+const rules = ref({
|
|
|
|
+ lvName: [{ required: true, message: "请输入等级名称", trigger: "blur" }],
|
|
|
|
+ minNotFollow: [
|
|
|
|
+ { required: true, message: "请输入至少几天跟进一次", trigger: "blur" },
|
|
|
|
+ ],
|
|
|
|
+ maxNotFollow: [
|
|
|
|
+ { required: true, message: "请输入超几天未跟进转公海", trigger: "blur" },
|
|
|
|
+ ],
|
|
|
|
+});
|
|
|
|
+const formData = reactive({
|
|
|
|
+ data: {
|
|
|
|
+ accountRemainderList: [{ currency: "", remainder: undefined }],
|
|
|
|
+ },
|
|
|
|
+});
|
|
|
|
+const openModal = (val) => {
|
|
|
|
+ modalType.value = val;
|
|
|
|
+ formData.data = {
|
|
|
|
+ accountRemainderList: [{ currency: "", remainder: undefined }],
|
|
|
|
+ };
|
|
|
|
+ loadingDialog.value = false;
|
|
|
|
+ dialogVisible.value = true;
|
|
|
|
+};
|
|
|
|
+const clickBalance = () => {
|
|
|
|
+ if (
|
|
|
|
+ formData.data.accountRemainderList &&
|
|
|
|
+ formData.data.accountRemainderList.length > 0
|
|
|
|
+ ) {
|
|
|
|
+ formData.data.accountRemainderList.push({
|
|
|
|
+ currency: "",
|
|
|
|
+ remainder: undefined,
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ formData.data.accountRemainderList = [
|
|
|
|
+ { currency: "", remainder: undefined },
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+const handleRemove = (index) => {
|
|
|
|
+ formData.data.accountRemainderList.splice(index, 1);
|
|
|
|
+};
|
|
|
|
+const isRepeat = (arr) => {
|
|
|
|
+ var hash = {};
|
|
|
|
+ for (var i in arr) {
|
|
|
|
+ if (hash[arr[i].currency]) return true;
|
|
|
|
+ hash[arr[i].currency] = true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+};
|
|
|
|
+const submitForm = () => {
|
|
|
|
+ submit.value.handleSubmit(() => {
|
|
|
|
+ loadingDialog.value = true;
|
|
|
|
+ proxy.post("/customerLv/" + modalType.value, formData.data).then(
|
|
|
|
+ () => {
|
|
|
|
+ proxy.msgTip("操作成功", 1);
|
|
|
|
+ dialogVisible.value = false;
|
|
|
|
+ getList();
|
|
|
|
+ },
|
|
|
|
+ (err) => {
|
|
|
|
+ console.log(err);
|
|
|
|
+ loadingDialog.value = false;
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ // if (
|
|
|
|
+ // formData.data.accountRemainderList &&
|
|
|
|
+ // formData.data.accountRemainderList.length > 0
|
|
|
|
+ // ) {
|
|
|
|
+ // if (isRepeat(formData.data.accountRemainderList)) {
|
|
|
|
+ // return ElMessage("请勿重复添加货币余额");
|
|
|
|
+ // } else {
|
|
|
|
+ // loadingDialog.value = true;
|
|
|
|
+ // proxy.post("/accountManagement/" + modalType.value, formData.data).then(
|
|
|
|
+ // () => {
|
|
|
|
+ // ElMessage({
|
|
|
|
+ // message: modalType.value == "add" ? "添加成功" : "编辑成功",
|
|
|
|
+ // type: "success",
|
|
|
|
+ // });
|
|
|
|
+ // dialogVisible.value = false;
|
|
|
|
+ // getList();
|
|
|
|
+ // },
|
|
|
|
+ // (err) => {
|
|
|
|
+ // console.log(err);
|
|
|
|
+ // loadingDialog.value = false;
|
|
|
|
+ // }
|
|
|
|
+ // );
|
|
|
|
+ // }
|
|
|
|
+ // } else {
|
|
|
|
+ // return ElMessage("请添加至少一条类型余额");
|
|
|
|
+ // }
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+const update = (row) => {
|
|
|
|
+ loadingDialog.value = false;
|
|
|
|
+ modalType.value = "edit";
|
|
|
|
+ formData.data = proxy.deepClone(row);
|
|
|
|
+ dialogVisible.value = true;
|
|
|
|
+};
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
+.tenant {
|
|
|
|
+ padding: 20px;
|
|
|
|
+}
|
|
|
|
+::v-deep(.el-input-number .el-input__inner) {
|
|
|
|
+ text-align: left;
|
|
|
|
+}
|
|
|
|
+</style>
|