ezhizao_zx 1 yıl önce
ebeveyn
işleme
71bc7cd809

+ 1 - 1
src/api/business/crm/company.js

@@ -83,7 +83,7 @@ export function importCompanyTemplate() {
     "business/company/importTemplate",
     {
     },
-    `company_template${new Date().getTime()}.xlsx`
+    `客户导入模板${new Date().getTime()}.xlsx`
   )
 
 }

+ 149 - 104
src/views/business/crm/company/ExportColumn.vue

@@ -1,15 +1,33 @@
 <template>
   <!-- 添加或修改菜单对话框 -->
-  <el-dialog :title="客户导出" v-model="visible" width="680px" append-to-body draggable>
+  <el-dialog
+    :title="客户导出"
+    v-model="visible"
+    width="680px"
+    append-to-body
+    draggable
+  >
     <el-form ref="menuRef" :model="form" size="small" label-width="100px">
       <el-row>
         <el-col :span="24">
           <el-form-item label="选择列" prop="name">
-            <el-checkbox v-model="allChecked" @change="changeAll" :indeterminate="isIndeterminate">全选</el-checkbox>
-            <el-checkbox-group v-model="columns" ref="columnRef" @change="columnChange">
-              <el-checkbox v-for="column in defaultColumns" :key="column.field" :label="column.field">{{
-                column.label
-              }}</el-checkbox>
+            <el-checkbox
+              v-model="allChecked"
+              @change="changeAll"
+              :indeterminate="isIndeterminate"
+              >全选</el-checkbox
+            >
+            <el-checkbox-group
+              v-model="columns"
+              ref="columnRef"
+              @change="columnChange"
+            >
+              <el-checkbox
+                v-for="column in defaultColumns"
+                :key="column.field"
+                :label="column.field"
+                >{{ column.label }}</el-checkbox
+              >
               <!-- <el-checkbox label="code">客户编号</el-checkbox>
               <el-checkbox label="name">客户名称</el-checkbox>
               <el-checkbox label="sourceCategoryName">客户来源类型</el-checkbox>
@@ -24,8 +42,14 @@
     </el-form>
     <template #footer>
       <div class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
-        <el-button @click="cancel">取 消</el-button>
+        <el-button
+          type="primary"
+          icon="Finished"
+          size="small"
+          @click="submitForm"
+          >确 定</el-button
+        >
+        <el-button icon="Close" size="small" @click="cancel">取 消</el-button>
       </div>
     </template>
   </el-dialog>
@@ -33,158 +57,179 @@
   
   
 <script setup>
-import { getToken, getTenant } from '@/utils/auth'
-import { addCompany } from "@/api/business/crm/company"
-import useUserStore from '@/store/modules/user'
-import { listSource } from '@/api/settings/source'
-import { deepClone } from '@/utils'
-import { incomeDefault, taxTypes, confirmDefault } from "@/utils/default"
-const { proxy } = getCurrentInstance()
+import { getToken, getTenant } from "@/utils/auth";
+import { addCompany } from "@/api/business/crm/company";
+import useUserStore from "@/store/modules/user";
+import { listSource } from "@/api/settings/source";
+import { deepClone } from "@/utils";
+import { incomeDefault, taxTypes, confirmDefault } from "@/utils/default";
+const { proxy } = getCurrentInstance();
 /** 父组件传参 */
 const props = defineProps({
   getList: {
     type: Function,
-    default: () => { }
-  }
-})
-const { getList } = toRefs(props)
+    default: () => {},
+  },
+});
+const { getList } = toRefs(props);
 /** 字典数组区 */
-const { develop_type } = proxy.useDict('develop_type')
+const { develop_type } = proxy.useDict("develop_type");
 /** 表单抽屉 页变量 */
-const title = ref("")
-const loading = ref(false)
-const multiple = ref(true)
-const visible = ref(false)
-const editStatus = ref(false)
-const isFullscreen = ref(false)
-const addDetailNum = ref(1)
-const currentMember = {}
-const column = ref([])
-
-const defaultColumns = ref([{
-  field: 'name', label: '客户名称'
-}, {
-  field: 'code', label: '客户编码'
-}, {
-  field: 'sourceCategoryName', label: '客户来源类型'
-}, {
-  field: 'sourceName', label: '客户来源'
-}, {
-  field: 'area', label: '所属区域'
-}, {
-  field: 'taxNo', label: '税号'
-}, {
-  field: 'annualIncome', label: '年收入'
-}, {
-  field: 'taxType', label: '纳税类型'
-}, {
-  field: 'isZero', label: '是否零申报'
-}, {
-  field: 'collectionMethod', label: '征收方式'
-}, {
-  field: 'quotaAmount', label: '定额金额'
-}])
-
-const sourceCategories = ref([])
-
-const allChecked = ref(false)
-const isIndeterminate = ref(true)
-
-const addType = ref(1)
-
-const webHost = import.meta.env.VITE_APP_BASE_API
+const title = ref("");
+const loading = ref(false);
+const multiple = ref(true);
+const visible = ref(false);
+const editStatus = ref(false);
+const isFullscreen = ref(false);
+const addDetailNum = ref(1);
+const currentMember = {};
+const column = ref([]);
+
+const defaultColumns = ref([
+  {
+    field: "name",
+    label: "客户名称",
+  },
+  {
+    field: "code",
+    label: "客户编码",
+  },
+  {
+    field: "sourceCategoryName",
+    label: "客户来源类型",
+  },
+  {
+    field: "sourceName",
+    label: "客户来源",
+  },
+  {
+    field: "area",
+    label: "所属区域",
+  },
+  {
+    field: "taxNo",
+    label: "税号",
+  },
+  {
+    field: "annualIncome",
+    label: "年收入",
+  },
+  {
+    field: "taxType",
+    label: "纳税类型",
+  },
+  {
+    field: "isZero",
+    label: "是否零申报",
+  },
+  {
+    field: "collectionMethod",
+    label: "征收方式",
+  },
+  {
+    field: "quotaAmount",
+    label: "定额金额",
+  },
+]);
+
+const sourceCategories = ref([]);
+
+const allChecked = ref(false);
+const isIndeterminate = ref(true);
+
+const addType = ref(1);
+
+const webHost = import.meta.env.VITE_APP_BASE_API;
 
 const setHeaders = {
-  Authorization: getToken()
-}
+  Authorization: getToken(),
+};
 const data = reactive({
-  columns: []
-})
+  columns: [],
+});
 
 /*** 客户导入参数 */
 const upload = reactive({
   // 是否禁用上传
   isUploading: false,
   // 设置上传的请求头部
-  headers: { Authorization: 'Bearer ' + getToken(), tenantId: getTenant() },
+  headers: { Authorization: "Bearer " + getToken(), tenantId: getTenant() },
   // 上传的地址
-  url: '/ezhizao-yzbh-crm/business/company/importData'
-})
+  url: "/ezhizao-yzbh-crm/business/company/importData",
+});
 
 const contactorEmptyData = {
   id: null,
-  name: '',
-  position: '',
-  gender: '男',
-  phone: '',
-  email: '',
-  isMain: '是',
-  remark: ''
-}
+  name: "",
+  position: "",
+  gender: "男",
+  phone: "",
+  email: "",
+  isMain: "是",
+  remark: "",
+};
 
-const companyEmptyData = {
-}
+const companyEmptyData = {};
 
-const followQuery = ref({})
-const { columns } = toRefs(data)
-const conditions = ref({})
+const followQuery = ref({});
+const { columns } = toRefs(data);
+const conditions = ref({});
 
 /***********************  表单页方法 ****************************/
 
 /** 抽屉打开 */
 function open(options) {
   reset();
-  conditions.value = options
+  conditions.value = options;
   visible.value = true;
 }
 
-function init() {
-}
+function init() {}
 
 function reset() {
-  columns.values = []
-  allChecked.value = false
-  isIndeterminate.value = false
+  columns.values = [];
+  allChecked.value = false;
+  isIndeterminate.value = false;
 }
 
 function cancel() {
-  visible.value = false
-  reset()
+  visible.value = false;
+  reset();
 }
 
 function submitForm() {
-  conditions.value.columns = columns.value
-  console.log(conditions.value)
+  conditions.value.columns = columns.value;
+  console.log(conditions.value);
   proxy.download(
     "business/company/export",
-    conditions.value
-    ,
+    conditions.value,
     `客户管理_${new Date().getTime()}.xlsx`
   );
-  cancel()
+  cancel();
 }
 
 function changeAll(arg) {
   if (arg) {
-    columns.value = defaultColumns.value.map(l => l.field)
+    columns.value = defaultColumns.value.map((l) => l.field);
   } else {
-    columns.value = []
+    columns.value = [];
   }
 }
 
 function columnChange(value) {
-  const checkedCount = value.length
-  allChecked.value = checkedCount === defaultColumns.value.length
-  isIndeterminate.value = checkedCount > 0 && checkedCount < defaultColumns.value.length
-  console.log(columns.value)
+  const checkedCount = value.length;
+  allChecked.value = checkedCount === defaultColumns.value.length;
+  isIndeterminate.value =
+    checkedCount > 0 && checkedCount < defaultColumns.value.length;
+  console.log(columns.value);
 }
 
 // 暴露给父组件的方法
 defineExpose({
   open,
-  close
-})
-init()
+  close,
+});
+init();
 </script>
   
 <style></style>

+ 0 - 4
src/views/business/crm/company/add.vue

@@ -283,11 +283,7 @@ function handlerSelectCategory() {
   if (item) {
     form.value.sourceCategoryName = item.title;
     form.value.referrerDataSource = item.referrerDataSource;
-    // placeholderValue.value = item.title + "名称";
   }
-
-  // // 咋整都要清理 右侧
-  // sourceName.value = "";
 }
 
 /** 输入框输出建议 */

+ 11 - 3
src/views/business/crm/company/index.vue

@@ -27,14 +27,14 @@
           <el-dropdown-menu>
             <el-dropdown-item
               @click="handleAdviser()"
-              v-hasPermi="['business:company:edit']"
+              v-if="viewAdviser('business:company:adviser')"
               icon="Operation"
             >
               设置客服</el-dropdown-item
             >
             <el-dropdown-item
               @click="handleLeader()"
-              v-hasPermi="['business:company:edit']"
+              v-if="viewAdviser('business:company:leader')"
               icon="Operation"
             >
               设置负责人</el-dropdown-item
@@ -44,7 +44,7 @@
               size="small"
               icon="Download"
               @click="handleExport"
-              v-hasPermi="['business:company:export']"
+              v-if="viewAdviser('business:company:leader')"
             >
               导出</el-dropdown-item
             >
@@ -309,11 +309,14 @@ import {
   setCompanyAdviser,
   initArea,
 } from "@/api/business/crm/company";
+import useUserStore from "@/store/modules/user";
 const { proxy } = getCurrentInstance();
 /** 字典数组区 */
 const { develop_type } = proxy.useDict("develop_type");
 /** 主页面 变量 */
 const list = ref([]);
+const permissions = useUserStore().permissions;
+const all_permission = "*:*:*";
 const loading = ref(false);
 const ids = ref([]);
 const single = ref(true);
@@ -350,6 +353,11 @@ function getList() {
   });
 }
 
+//判断是否有权限
+function viewAdviser(quer) {
+  return permissions.includes(all_permission) || permissions.includes(quer);
+}
+
 /** 搜索按钮操作 */
 function handleQuery() {
   queryParams.value.pageNum = 1;