浏览代码

Merge remote-tracking branch 'origin/master'

yu jie 4 年之前
父节点
当前提交
e48b5094fc

+ 5 - 1
src/layout/components/header.vue

@@ -17,7 +17,8 @@
       <!-- <a-icon type="search" /> -->
     </div>
     <div class="news-container">
-      <a-badge @click="openNotice">
+      <a-badge @click="openNotice"
+               :dot="getUnReadNoticeLength().length > 0">
         <svg class="icon svg-icon"
              aria-hidden="true">
           <use xlink:href="#icon-xiaoxi"></use>
@@ -53,6 +54,7 @@ import { getUserName } from '@/services/bus/user';
 import { logout } from '@/services/bus/login';
 import APP from '@/services';
 import Router from '@/router';
+import { handleNotice } from '@/views/setting/notice/setup';
 
 // 设置
 const setFn = () => {
@@ -100,9 +102,11 @@ export default defineComponent({
     },
     setup() {
         const { openAction: openNotice } = openModal('notice');
+        const { getUnReadNoticeLength } = handleNotice();
         return {
             openNotice,
             getUserName,
+            getUnReadNoticeLength,
             ...setFn(),
             ...onSearch(),
         };

+ 8 - 5
src/views/platinum/platinum_agreement/compoments/add/index.vue

@@ -3,7 +3,7 @@
   <a-modal class="add-custom"
            title="新增协议"
            v-model:visible="visible"
-           @cancel="cancel"
+           @cancel="colseAction"
            centered
            :maskClosable="false"
            width="890px">
@@ -79,7 +79,7 @@
 <script lang="ts">
 import { closeModal } from '@/common/setup/modal/index';
 import { defineComponent, ref } from 'vue';
-import { handleForm } from './setup';
+import { handleForm, initFormState } from './setup';
 import { FormState } from './interface';
 import { validateAction } from '@/common/setup/form';
 import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
@@ -100,7 +100,10 @@ export default defineComponent({
         const { getAgreementTypeList, getRate } = handleArgreementType(formState);
 
         const loading = ref<boolean>(false);
-
+        function colseAction() {
+            Object.assign(formState, initFormState());
+            cancel();
+        }
         function submit(OperateType: 1 | 2) {
             validateAction<FormState>(formRef, formState).then((param) => {
                 const reqParam: QHJAgreementConfigOperateReq = {
@@ -113,7 +116,7 @@ export default defineComponent({
                     operateid: getUserId(), // uint64 操作人
                 };
                 requestResultLoadingAndInfo(agreementConfigOperate, reqParam, loading, ['新增协议成功', '新增协议失败:']).then(() => {
-                    cancel();
+                    colseAction();
                     context.emit('refresh');
                 });
             });
@@ -126,7 +129,7 @@ export default defineComponent({
             rules,
             formRef,
             visible,
-            cancel,
+            colseAction,
             submit,
             loading,
         };

+ 82 - 8
src/views/platinum/platinum_agreement/compoments/detail/index.vue

@@ -1,7 +1,7 @@
 <template>
-  <!-- 客户资料详情-->
-  <a-modal class="add-custom custom-detail"
-           title="客户资料详情"
+  <!-- 协议详情-->
+  <a-modal class="commonModal addSpotVariety"
+           title="协议详情"
            centered
            v-model:visible="visible"
            :maskClosable="false"
@@ -13,18 +13,78 @@
                 :loading="loading"
                 @click="cancel">关闭</a-button>
     </template>
-    <Des :list="desList" />
+    <a-form class="inlineForm">
+      <fieldset class="formFieldSet">
+        <legend>协议信息</legend>
+        <Des :list="desList"
+             @onClick="getContent(selectedRow.agreementcontent)" />
+      </fieldset>
+      <fieldset class="formFieldSet">
+        <legend>修改流水</legend>
+        <div class="tableDatas tableContextCenter">
+          <a-table class="dialogTable"
+                   :columns="columns"
+                   :data-source="tableList"
+                   :pagination="false">
+            <!-- 协议类型-->
+            <template #agreementcontent="{ record }">
+              <a @click="getContent(record.agreementcontent)">查看</a>
+            </template>
+          </a-table>
+        </div>
+      </fieldset>
+    </a-form>
+  </a-modal>
+  <a-modal class="commonModal addSpotVariety"
+           title="协议内容"
+           centered
+           v-model:visible="visibleContent"
+           :maskClosable="false"
+           @cancel="visibleContent = false"
+           width="890px">
+    <a-textarea class="dialogInput"
+                v-model:value="content"
+                style="width: 100%"
+                placeholder="请输入协议内容"
+                readonly
+                :autosize="{ minRows: 8, maxRows: 24 }" />
+    <template #footer>
+      <a-button key="submit"
+                type="primary"
+                @click="visibleContent = false">关闭</a-button>
+    </template>
   </a-modal>
 </template>
 
 <script lang="ts">
-import { defineComponent, PropType, watchEffect } from 'vue';
+import { defineComponent, PropType, ref, watchEffect } from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
 import { Des, handleDesList } from '@/common/components/commonDes';
-import { QhjAgreementConfig } from '@/services/go/ermcp/qhj/interface';
+import { QhjAgreementChangeLog, QhjAgreementConfig } from '@/services/go/ermcp/qhj/interface';
 import { formatValue } from '@/common/methods';
 import { getAgreementTypeName } from '@/common/constants/enumsName';
 import { handleArgreementType } from '../../setup';
+import { queryTableList } from '@/common/setup/table';
+import { queryAgreementChangeLog } from '@/services/go/ermcp/qhj';
+
+const columns = [
+    {
+        title: '时间',
+        dataIndex: 'updatetime',
+        key: 'updatetime',
+    },
+    {
+        title: '协议名称',
+        dataIndex: 'agreementname',
+        key: 'agreementname',
+    },
+    {
+        title: '内容',
+        dataIndex: 'agreementcontent',
+        key: 'agreementcontent',
+        slots: { customRender: 'agreementcontent' },
+    },
+];
 
 export default defineComponent({
     name: 'custom-detail',
@@ -39,25 +99,39 @@ export default defineComponent({
         const { visible, cancel } = closeModal('detail');
         const { desList, getDesList } = handleDesList();
         const { getRateEnumName } = handleArgreementType();
+        const { loading, tableList, queryTable } = queryTableList<QhjAgreementChangeLog>();
+        // 协议内容
+        const visibleContent = ref<boolean>(false);
+        const content = ref<string>('');
+        function getContent(value: string) {
+            visibleContent.value = true;
+            content.value = value;
+        }
         watchEffect(() => {
             if (visible.value) {
                 const data = props.selectedRow;
-                // 个人
+                queryTable(queryAgreementChangeLog, { agreementid: data.agreementid });
+
                 const list = [
                     { label: '协议编号', value: formatValue(data.agreementno) },
                     { label: '协议名称', value: formatValue(data.agreementname) },
                     { label: '协议类型', value: getAgreementTypeName(data.agreementtype) },
                     { label: '签署频率', value: getRateEnumName(data.agreementfrequency) },
-                    { label: '内容', value: formatValue(data.agreementcontent), className: 'blue' },
+                    { label: '内容', value: '查看', className: 'blue' },
                 ];
                 getDesList(list);
             }
         });
 
         return {
+            visibleContent,
+            content,
+            getContent,
+            columns,
             cancel,
             desList,
             visible,
+            tableList,
         };
     },
 });

+ 0 - 1
src/views/platinum/platinum_financing_information/list/tab/compoments/detail/index.vue

@@ -24,7 +24,6 @@
                    :columns="columns"
                    :data-source="tableList"
                    :pagination="false">
-
           </a-table>
         </div>
       </fieldset>

+ 6 - 2
src/views/setting/notice/components/noticeContent.vue

@@ -32,8 +32,9 @@
 import { defineComponent, PropType, reactive, computed } from 'vue';
 import { QueryNoticeRsp } from '@/services/go/commonService/interface';
 import { mergeObj } from '@/utils/objHandle';
+import { handleNotice } from '../setup';
 
-function chooseNotice() {
+function chooseNotice(fn: Function) {
     interface ItemNotice {
         title: string;
         content: string; //内容
@@ -45,6 +46,7 @@ function chooseNotice() {
         createtime: '',
     });
     function choose(item: QueryNoticeRsp) {
+        fn(item);
         mergeObj(chooseItemNotice, item);
     }
     return { chooseItemNotice, choose };
@@ -59,7 +61,9 @@ export default defineComponent({
         },
     },
     setup(props) {
-        const { chooseItemNotice, choose } = chooseNotice();
+        // 公告消息
+        const { readNotice } = handleNotice();
+        const { chooseItemNotice, choose } = chooseNotice(readNotice);
         computed(() => {
             props.noticeList.length && mergeObj(chooseItemNotice, props.noticeList[0]);
         });

+ 10 - 10
src/views/setting/notice/index.vue

@@ -10,21 +10,21 @@
         <template #tab>
           <span>
             公告
-            <a-badge count="25"
+            <a-badge :count="getUnReadNoticeByType([1])"
                      :number-style="{ backgroundColor: '#FF9000' }" />
           </span>
         </template>
-        <NoticeContent :noticeList="noticeList" />
+        <NoticeContent :noticeList="getNoticeByType([1])" />
       </a-tab-pane>
       <a-tab-pane key="2">
         <template #tab>
           <span>
             系统消息
-            <a-badge count="25"
+            <a-badge :count="getUnReadNoticeByType([2])"
                      :number-style="{ backgroundColor: '#FF9000' }" />
           </span>
         </template>
-        <NoticeContent />
+        <NoticeContent :noticeList="getNoticeByType([2])" />
       </a-tab-pane>
     </a-tabs>
   </a-modal>
@@ -35,8 +35,7 @@ import { defineComponent, ref } from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
 import NoticeContent from './components/noticeContent.vue';
 import { initData } from '@/common/methods';
-import { queryNotice } from '@/services/go/commonService/index';
-import { QueryNoticeRsp } from '@/services/go/commonService/interface';
+import { handleNotice } from './setup';
 
 export default defineComponent({
     name: 'notice',
@@ -46,17 +45,18 @@ export default defineComponent({
     setup() {
         const { visible, cancel } = closeModal('notice');
         // 公告消息
-        const noticeList = ref<QueryNoticeRsp[]>([]);
+        const { noticeList, queryNoticeAction, getNoticeByType, updateNotice, getUnReadNoticeByType } = handleNotice();
 
         initData(() => {
-            queryNotice().then((res) => {
-                noticeList.value = res.filter((e) => e.msgtype === 1);
-            });
+            queryNoticeAction();
+            updateNotice();
         });
         return {
             visible,
             cancel,
             noticeList,
+            getNoticeByType,
+            getUnReadNoticeByType,
             activeKey: ref('1'),
         };
     },

+ 42 - 0
src/views/setting/notice/setup.ts

@@ -0,0 +1,42 @@
+import { queryNotice, queryNoticeReaded } from "@/services/go/commonService";
+import { QueryNoticeRsp } from '@/services/go/commonService/interface';
+import timerUtil from '@/utils/timer/timerUtil';
+import { ref } from "vue";
+
+// 消息
+const noticeList = ref<QueryNoticeRsp[]>([]);
+
+export function handleNotice() {
+    // 查询通知数据
+    function queryNoticeAction() {
+        queryNotice().then((res) => {
+            noticeList.value = res;
+        });
+    }
+    // 查询通知数据
+    function getNoticeByType(type: number[]): QueryNoticeRsp[] {
+        //消息类型 - 1:公告通知 2:系统消息 3:商品到期提货通知
+        return noticeList.value.filter((e: QueryNoticeRsp) => type.includes(e.msgtype));
+    }
+    // 获取具体某个类型未读通知的个数
+    function getUnReadNoticeByType(type: number[]): number {
+        return getNoticeByType(type).filter(e => !e.readed).length
+    }
+    // 设置已读消息
+    function readNotice({ readed, autoid }: QueryNoticeRsp) {
+        if (!readed) {
+            queryNoticeReaded(autoid).then(() => {
+                queryNoticeAction()
+            });
+        }
+    }
+    // 更新通知,通知没有推送,所有需要轮询
+    function updateNotice() {
+        timerUtil.setInterval(queryNoticeAction, 1 * 60 * 1000, 'pollingNotice')
+    }
+    // 获取未读通知的消息的个数
+    function getUnReadNoticeLength() {
+        return noticeList.value.filter(e => !e.readed).length
+    }
+    return { noticeList, queryNoticeAction, getNoticeByType, readNotice, updateNotice, getUnReadNoticeLength, getUnReadNoticeByType }
+}