فهرست منبع

代码优化,bug修复-1

hbchen 2 سال پیش
والد
کامیت
e838efa4a2

+ 2 - 2
.gitignore

@@ -11,8 +11,8 @@ package-lock.json
 
 node_modules
 dist
-hrms_web
-hrms_web.zip
+hongze_fsms_web
+hongze_fsms_web.zip
 dist-ssr
 *.local
 

+ 0 - 1
src/router/index.js

@@ -43,7 +43,6 @@ export const routes=[
 
 const router = createRouter({
   history:createWebHistory(),
-  // history:createWebHashHistory(),
   routes
 })
 

+ 38 - 0
src/utils/common-methods.js

@@ -0,0 +1,38 @@
+
+// 根据字节流下载文件
+/**
+ * @param {Blob} data 流数据
+ * @param {String} type 下载的文件类型
+ * @param {String} fileName 下载的文件名
+ * @return null
+ */
+export function downloadByFlow(data,type,fileName) {
+  let fileTypeMime ='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
+  switch (type) { // 获取后缀对应的 mimeType
+    case 'png': fileTypeMime = 'image/png'; break;
+    case 'doc': fileTypeMime = 'application/msword'; break;
+    case 'docx': fileTypeMime = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; break;
+    case 'jpg': case 'jpeg': fileTypeMime = 'image/jpeg'; break;
+    case 'gif': fileTypeMime = 'image/gif'; break;
+    case 'svg': fileTypeMime = 'image/svg+xml'; break;
+    case 'tif': case 'tiff': fileTypeMime = 'image/tiff'; break;
+    case 'txt': fileTypeMime = 'text/plain'; break;
+    case 'ppt': fileTypeMime = 'application/vnd.ms-powerpoint'; break;
+    case 'pptx': fileTypeMime = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; break;
+    case 'xls': fileTypeMime = 'application/vnd.ms-excel'; break;
+    case 'xlsx': fileTypeMime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; break;
+    case 'zip': fileTypeMime = 'application/zip'; break;
+    case '7z': fileTypeMime = 'application/x-7z-compressed'; break;
+  }
+  let blob = window.URL.createObjectURL(new Blob([data], {
+    'type': fileTypeMime
+  }))
+  let link = document.createElement('a')
+  link.style.display = 'none'
+  link.href = blob
+  link.setAttribute('download', fileName.indexOf('.')?fileName:`${fileName}.${type}`)
+  document.body.appendChild(link)
+  link.click()
+  document.body.removeChild(link) //下载完成移除元素
+  window.URL.revokeObjectURL(blob) //释放掉 blob 对象
+}

+ 1 - 1
src/utils/request.js

@@ -23,7 +23,7 @@ request.interceptors.request.use(
 request.interceptors.response.use(
   res=>{
     if(res.request.responseType==='blob' || res.request.responseType==='Blob'){
-       // 二进制
+       // 字节
        if(res.status === 200){
         return res.data
        }

+ 0 - 9
src/utils/validators.js

@@ -2,12 +2,3 @@
 * 表单自定义验证规则
 */
 
-// 邮箱格式
-export const emailValid=(rule,value,callback)=>{
-  let reg = /^[a-zA-Z0-9]+([-_.][A-Za-z\d]+)*@([a-zA-Z\d]+[-.])+[A-Za-z\d]{2,5}$/
-  if(value.match(reg)){
-    callback()
-  }else{
-    callback(new Error('邮箱格式错误,请重试。'))
-  }
-}

+ 48 - 5
src/views/financialManagement/contractProgress.vue

@@ -2,12 +2,14 @@
 <script setup>
   import serviceVarietyDia from './components/serviceVarietyDia.vue'
   import {useRouter,useRoute} from 'vue-router'
+  import {useStore} from 'vuex'
   import {ElMessage} from 'element-plus'
   import {getSellerList,getContractSearchList} from '@/api/crm'
   import {getServiceList,registerAdd,registerDetail,registerEdit,registerInvoice,registerPayment} from '@/api/financialMana'
 
   const router = useRouter()
   const route = useRoute()
+  const store=useStore()
 
   const contractInfoForm=ref(null)
   // 开票记录表单
@@ -21,6 +23,12 @@
       查看-view 合规登记-compliance 开票登记-invoice 到款登记-placement
     */ 
     operationtype:"compliance",
+    // 权限对象,判断是否有 合规登记、开票登记、到款登记权限
+    permissionItem:{
+      compliance:false, //合规
+      invoice:false, // 开票
+      placement:false // 到款
+    },
     form:{
       product_id:1,
       contract_register_id:'',
@@ -143,6 +151,38 @@
   const operationType=[{op_type:1,label:"合规登记"},{op_type:2,label:"开票登记"},{op_type:3,label:"到款登记"},
   {op_type:4,label:"修改合同状态"},{op_type:5,label:"删除合同登记"}]
   // -----------------------method
+  // 权限验证
+  const permissionValidation=()=>{
+    /*
+      由于可以通过修改地址栏的type更改操作类型和权限,
+      为了防止用户修改地址栏进行权限之外的操作。
+    */
+    let flag=0 // 拥有的权限个数
+    let permissionButtons=store.getters.permissionButtons
+    for (let i = 0,len=permissionButtons.length; i < len || flag==3; i++) {
+      const element = permissionButtons[i];
+      if(element.button_code=='financial:list:complianceAdd' || element.button_code=='financial:list:complianceEdit'){
+        contractInfo.permissionItem.compliance=true
+        flag++
+      }else if(element.button_code=='financial:list:invoice'){
+        contractInfo.permissionItem.invoice=true
+        flag++
+      }else if(element.button_code=='financial:list:placement'){
+        contractInfo.permissionItem.placement=true
+        flag++
+      }
+    }
+    if(contractInfo.operationtype!='view'){
+      if(contractInfo.permissionItem[contractInfo.operationtype]===false){
+        // 没有权限
+        let messageHint=ElMessage.warning('暂无权限')
+        setTimeout(()=>{
+          messageHint.close()
+          router.back()
+        },1000)
+      }
+    }
+  }
   //获取销售列表
   const getSellerListFun=()=>{
     getSellerList().then(res=>{
@@ -484,6 +524,7 @@
         // 转化
         placementForm.placementData.forEach(element => {
           element.amount = parseFloat(element.amount)
+          element.invoice_date = element.invoice_date+'-01'
         });
         let param={
           contract_register_id:contractInfo.form.contract_register_id,
@@ -517,12 +558,14 @@
   }
 
 // ----------------------created
+  contractInfo.form.contract_register_id = parseInt(route.query.complianceId) || ''
+  // complianceId没有,认为是合规登记
+  contractInfo.operationtype=contractInfo.form.contract_register_id?(route.query.type || 'compliance'):'compliance'
+  permissionValidation()
+
   getSellerListFun()
   getServiceListFun()
 
-  contractInfo.form.contract_register_id = parseInt(route.query.complianceId) || ''
-  // id没有,认为是合规登记
-  contractInfo.operationtype=contractInfo.form.contract_register_id?(route.query.type || 'compliance'):'compliance'
   if(contractInfo.form.contract_register_id){
     //请求详情接口
     registerDetail({contract_register_id:contractInfo.form.contract_register_id}).then(res=>{
@@ -825,8 +868,8 @@
                       <template #default="{row,$index}">
                         <el-form-item :prop="`placementData.${$index}.invoice_date`" :show-message="false"
                         :rules="{required:true,message:()=>{ ElMessage.error('请选择到款日期')},trigger:'change'}">             
-                          <el-date-picker v-model="row.invoice_date" style="width: 124px;"
-                          placeholder="请选择月份" value-format="YYYY-MM-DD" format="YYYY-MM"></el-date-picker>
+                          <el-date-picker v-model="row.invoice_date" style="width: 124px;" :clearable="false"
+                          placeholder="请选择月份" value-format="YYYY-MM" format="YYYY-MM"></el-date-picker>
                         </el-form-item>
                       </template>
                     </el-table-column>

+ 13 - 42
src/views/financialManagement/financialList.vue

@@ -3,10 +3,14 @@ import { Search } from '@element-plus/icons-vue'
 import {useRouter,useRoute} from 'vue-router'
 import {getServiceList,getRegisterList,updateRegisterStatus,
   registerDelete,registerListExport} from '@/api/financialMana'
+import {downloadByFlow} from '@/utils/common-methods'
 
 const router = useRouter()
 const route = useRoute()
-  const changeStatusForm=ref(null)
+const changeStatusForm=ref(null)
+const contractTypeArray=[{id:1,label:"新签"},{id:2,label:"续约"}]
+const contractStatusArray=[{id:1,label:"已审批"},{id:2,label:"单章寄回"},{id:3,label:"已签回"}]
+const statusArray=[{id:1,label:"进行中"},{id:2,label:"已完成"}]
 
   const financial=reactive({
     searchParams:{
@@ -19,7 +23,8 @@ const route = useRoute()
       page_size:10,
       current:1,
     },
-    // updateTime:'',
+    // 创建时间数组
+    createtime:[],
     tableData:[],
     serviceTypeArray:[],
     total:100,
@@ -45,12 +50,9 @@ const route = useRoute()
     },
     currentStatusRow:{}
   })
-  const contractTypeArray=[{id:1,label:"新签"},{id:2,label:"续约"}]
-  const contractStatusArray=[{id:1,label:"已审批"},{id:2,label:"单章寄回"},{id:3,label:"已签回"}]
-  const statusArray=[{id:1,label:"进行中"},{id:2,label:"已完成"}]
 
   // 监听
-  watch(()=>financial.updateTime,(newVal)=>{
+  watch(()=>financial.createtime,(newVal)=>{
     if(!newVal){
       financial.searchParams.start_date=''
       financial.searchParams.end_date=''
@@ -68,7 +70,7 @@ const route = useRoute()
       financial.serviceTypeArray=res.data || []
     })
   }
-
+  // 请求财务列表
   const financialList=()=>{
     // console.log(financial.searchParams);
     getRegisterList(financial.searchParams).then(res=>{
@@ -100,41 +102,13 @@ const route = useRoute()
   }
 
   // 合规、开票、到账登记
-  const registration=(type,id)=>{
-    // console.log(type,id);
-  
+  const registration=(type,id)=>{  
     router.push({path:'/financial/list/contractProgress',query:{type,complianceId:id}})
   }
   // 导出数据
   const exportData=()=>{
     registerListExport(financial.searchParams).then(res=>{
-    // switch (mime) { // 获取后缀对应的 mime
-    //   case 'png': fileTypeMime = 'image/png'; break;
-    //   case 'doc': fileTypeMime = 'application/msword'; break;
-    //   case 'docx': fileTypeMime = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; break;
-    //   case 'jpg': case 'jpeg': fileTypeMime = 'image/jpeg'; break;
-    //   case 'gif': fileTypeMime = 'image/gif'; break;
-    //   case 'svg': fileTypeMime = 'image/svg+xml'; break;
-    //   case 'tif': case 'tiff': fileTypeMime = 'image/tiff'; break;
-    //   case 'txt': fileTypeMime = 'text/plain'; break;
-    //   case 'ppt': fileTypeMime = 'application/vnd.ms-powerpoint'; break;
-    //   case 'pptx': fileTypeMime = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; break;
-    //   case 'xls': fileTypeMime = 'application/vnd.ms-excel'; break;
-    //   case 'xlsx': fileTypeMime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; break;
-    //   case 'zip': fileTypeMime = 'application/zip'; break;
-    //   case '7z': fileTypeMime = 'application/x-7z-compressed'; break;
-    // }
-    let blob = window.URL.createObjectURL(new Blob([res], {
-      'type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
-    }))
-    let link = document.createElement('a')
-    link.style.display = 'none'
-    link.href = blob
-    link.setAttribute('download', `财务列表.xlsx`)
-    document.body.appendChild(link)
-    link.click()
-    document.body.removeChild(link) //下载完成移除元素
-    window.URL.revokeObjectURL(blob) //释放掉 blob 对象
+      downloadByFlow(res,'xlsx','财务列表')
     })
   }
   // 显示开票详情
@@ -202,7 +176,7 @@ const route = useRoute()
           <div class="financial-search-zone">
             <el-input v-model="financial.searchParams.keyword" placeholder="合同编号/客户姓名/销售" :prefix-icon="Search"
             style="width: 286px;margin-bottom: 8px;" @input="searchFinancial" clearable />
-            <el-date-picker v-model="financial.updateTime" start-placeholder="合同创建日期"
+            <el-date-picker v-model="financial.createtime" start-placeholder="合同创建日期"
             end-placeholder="合同创建日期" style="margin-right: 30px;max-width: 286px;margin-bottom: 8px;"
             value-format="YYYY-MM-DD" type="daterange"></el-date-picker>
             <el-select v-model="financial.searchParams.service_type" placeholder="请选择套餐类型" clearable
@@ -256,8 +230,6 @@ const route = useRoute()
                   {{contractStatusArray[row.contract_status-1].label}}
                 </template>
               </el-table-column>
-              <!-- <el-table-column label="合同状态更新时间" align="center" width="170" prop="contractStatusTime"
-              v-if="financial.tabelColumnShowArr.includes('contractStatusTime')"></el-table-column> -->
               <el-table-column label="已开票金额" align="center" prop="invoiced_amount" width="100">
                 <template #default="{row}">
                   <span style="color: var(--themeColor);cursor: pointer;" @click="invoiceDetail(row)">{{row.invoiced_amount}}</span>
@@ -290,7 +262,6 @@ const route = useRoute()
                         <el-checkbox label="contractDate">合同有效期</el-checkbox>
                         <el-checkbox label="agreed_pay_time">约定付款时间</el-checkbox>
                         <el-checkbox label="sign_date">签订日</el-checkbox>
-                        <!-- <el-checkbox label="contractStatusTime">合同状态更新时间</el-checkbox> -->
                         <el-checkbox label="remark">备注</el-checkbox>
                       </el-checkbox-group>
                       <el-button style="float: right;" @click="checkedConfirm">确认</el-button>
@@ -376,7 +347,7 @@ const route = useRoute()
   
 <style lang="scss" scoped>
   .financial-list-container{
-    height: 100%;
+    min-height: 100%;
     .financial-search-zone{
       display: flex;
       align-items: center;

+ 1 - 1
src/views/systemManagement/departmentM.vue

@@ -219,7 +219,7 @@ import {getDepartmentList,addDepartment,editDepartment,deleteDepartment} from '@
   
 <style lang="scss" scoped>
   .system-department-container{
-    height: 100%;
+    min-height: 100%;
     .department-container{
       overflow: hidden;
       .department-container-header{

+ 1 - 1
src/views/systemManagement/menuM.vue

@@ -391,7 +391,7 @@ const IconsAll=Object.keys(ElementPlusIconsVue).map(key=> key)
   
 <style lang="scss" scoped>
   .system-menu-container{
-    height: 100%;
+    min-height: 100%;
     .menu-container{
       overflow: hidden;
       .menu-container-header{

+ 1 - 1
src/views/systemManagement/roleM.vue

@@ -178,7 +178,7 @@ const route = useRoute()
   
 <style lang="scss" scoped>
   .system-role-container{
-    height: 100%;
+    min-height: 100%;
     .role-container{
       overflow: hidden;
       .role-container-header{

+ 1 - 1
src/views/systemManagement/rolePermission.vue

@@ -390,7 +390,7 @@ const router = useRouter()
   
 <style lang="scss" scoped>
   .role-permisson-contaner{
-    height: 100%;
+    min-height: 100%;
     .role-permisson-box{
       height: calc(100% - 70px);
       padding: 20px;

+ 1 - 1
src/views/systemManagement/userM.vue

@@ -469,7 +469,7 @@ const userStatus=[{value:1,label:'启用'},{value:0,label:'禁用'}]
   
 <style lang="scss" scoped>
   .system-user-container{
-    height: 100%;
+    min-height: 100%;
     display: flex;
     .user-container-left{
       padding:20px;

+ 1 - 1
vite.config.js

@@ -88,7 +88,7 @@ export default defineConfig({
     host:true
   },
   build:{
-    outDir: 'fsms_web',
+    outDir: 'hongze_fsms_web',
     minify:'terser',
     terserOptions:{
       compress:{