刘洋 1 éve
szülő
commit
8d7a810663

+ 6 - 0
src/api/sop.js

@@ -279,3 +279,9 @@ export const saveSopFastOptionsApi = (data) =>
     data,
     loading: true,
   });
+export const deleteSopFastOptionsApi = (params) =>
+  request({
+    url: '/api/admin/sop/quick/delete',
+    params,
+    loading: true,
+  });

+ 33 - 6
src/components/global/tag-list/index.vue

@@ -3,7 +3,7 @@
     <p class="tip pt-15px p-l-5px p-r-5px p-b-5px"
       >将上述条件设为快捷显示(最多5条)</p
     >
-    <div class="flex items-center">
+    <div class="flex items-center p-b-15px">
       <div class="flex-1">
         <t-form :data="formData" :rules="rules" ref="formRef">
           <t-form-item label="" :labelWidth="0" name="name">
@@ -27,15 +27,19 @@
         @click="tagClick(item)"
       >
         <span class="title">{{ item.name }}</span>
-        <MultiplyIcon class="icon" />
+        <MultiplyIcon class="icon" @click="deleteItem(item)" />
       </div>
     </div>
   </div>
 </template>
 <script name="TagList" setup>
 import { MultiplyIcon } from 'tdesign-icons-vue-next';
-import { ref, onMounted, reactive } from 'vue';
-import { getSopFastOptionsApi, saveSopFastOptionsApi } from '@/api/sop';
+import { ref, onMounted, reactive, nextTick } from 'vue';
+import {
+  getSopFastOptionsApi,
+  saveSopFastOptionsApi,
+  deleteSopFastOptionsApi,
+} from '@/api/sop';
 import { MessagePlugin } from 'tdesign-vue-next';
 const emit = defineEmits(['tagClick']);
 const formRef = ref();
@@ -43,8 +47,12 @@ const props = defineProps({
   type: String,
   contentType: String,
   fastOptionContent: {
-    type: Array,
-    default: () => [],
+    type: Object,
+    default: () => ({
+      dataList: [],
+      metadataList: [],
+      formWidgetMetadataOperation: '',
+    }),
   },
 });
 const formData = reactive({
@@ -78,12 +86,31 @@ const save = async () => {
     MessagePlugin.success('保存成功');
     formData.name = '';
     getList();
+    setTimeout(() => {
+      formRef.value?.clearValidate();
+    }, 0);
   });
 };
 const tagClick = (item) => {
   let content = JSON.parse(item.content);
   emit('tagClick', content);
 };
+const deleteItem = (item) => {
+  const confirmDia = DialogPlugin({
+    header: '操作提示',
+    body: `确定要删除这条快捷选项吗?`,
+    confirmBtn: '确定',
+    cancelBtn: '取消',
+    attach: 'body',
+    onConfirm: async () => {
+      confirmDia.hide();
+      deleteSopFastOptionsApi({ id: item.id }).then(() => {
+        MessagePlugin.success('删除成功');
+        getList();
+      });
+    },
+  });
+};
 </script>
 <style lang="less" scoped>
 .tag-list-box {

+ 2 - 0
src/views/sop/components/select-filter/index.vue

@@ -3,6 +3,7 @@
     overlayClassName="select-filter"
     placement="bottom-left"
     :visible="visible"
+    :zIndex="1000"
   >
     <t-button variant="outline" @click="toggleVisible">
       <template #icon><svg-icon name="filter" color="#262626" /></template>
@@ -204,6 +205,7 @@ const fastOptionContent = computed(() => {
   return {
     dataList: dataList.value,
     metadataList: metadataList.value,
+    formWidgetMetadataOperation: formWidgetMetadataOperation.value,
   };
 });
 </script>

+ 132 - 52
src/views/sop/sop-manage/office-sop/index.vue

@@ -15,6 +15,8 @@
         type="OFFICE_SOP_FLOW"
         :originColumns="originColumns"
         @change="metadataChange"
+        contentType="VIEW"
+        :fastOptionContent="formWidgetMetadataViewList"
       ></select-metadata>
       <t-button variant="outline" @click="handleRefresh">
         <template #icon><svg-icon name="refresh" color="#262626" /></template>
@@ -40,6 +42,12 @@
         <template #icon><svg-icon name="shrink" color="#262626" /></template>
         缩小</t-button
       >
+      <select-filter
+        :metadata="formWidgetMetadataViewList"
+        @confirm="filterConfirm"
+        type="CLOUD_MARK_SOP_FLOW"
+        contentType="SEARCH"
+      ></select-filter>
     </div>
     <SearchForm :fields="fields" :params="params" :search="search">
       <template #service="{ item, params }">
@@ -51,14 +59,20 @@
           }"
         ></select-service-unit>
       </template>
+      <template #leadId="{ item, params }">
+        <select-type-user
+          v-model="params[item.prop]"
+          type="REGION_MANAGER"
+        ></select-type-user>
+      </template>
       <template #buttons>
-        <t-space :size="16">
+        <!-- <t-space :size="16">
           <select-filter
             :metadata="formWidgetMetadataViewList"
             @confirm="filterConfirm"
-          ></select-filter>
-          <t-button theme="primary" @click="search">搜索</t-button>
-        </t-space>
+          ></select-filter> -->
+        <t-button theme="primary" @click="search">搜索</t-button>
+        <!-- </t-space> -->
       </template>
     </SearchForm>
 
@@ -82,27 +96,6 @@
         :selected-row-keys="selectedRowKeys"
         @select-change="selectChange"
       >
-        <!-- <template #sopNo="{ col, row }">
-          <more-content
-            :content="row[col.colKey]"
-            @action="editSopFlowHandle(row, 'view')"
-          ></more-content>
-        </template> -->
-        <!-- <template #beginTime="{ col, row }">
-          {{ timestampFilter(row[col.colKey]) }}
-        </template>
-        <template #examStartTime="{ col, row }">
-          {{ timestampFilter(row[col.colKey]) }}
-        </template>
-        <template #examEndTime="{ col, row }">
-          {{ timestampFilter(row[col.colKey]) }}
-        </template>
-        <template #flowCreateTime="{ col, row }">
-          {{ timestampFilter(row[col.colKey]) }}
-        </template>
-        <template #flowUpdateTime="{ col, row }">
-          {{ timestampFilter(row[col.colKey]) }}
-        </template> -->
         <template
           v-for="field in formWidgetMetadataViewList"
           #[field.fieldId]="{ col, row }"
@@ -233,9 +226,9 @@
 </template>
 
 <script setup name="OfficeSop">
-import { ref, reactive, computed } from 'vue';
+import { ref, reactive, computed, watch } from 'vue';
 import useFetchTable from '@/hooks/useFetchTable';
-import { sopListApi, sopBatchCancelApi } from '@/api/sop';
+import { sopListApi, sopBatchCancelApi, getSopFastOptionsApi } from '@/api/sop';
 import { timestampFilter } from '@/utils/filter';
 import SelectFilter from '../../components/select-filter/index.vue';
 import SopSortPanel from '../../components/sop-sort-panel/index.vue';
@@ -251,6 +244,7 @@ import { cloneDeep } from 'lodash-es';
 import { CUSTOMER_TYPE, FLOW_STATUS } from '@/config/constants';
 import { dictToOptionList } from '@/utils/tool';
 import DeviceManageNew from '@/components/common/device-manage-new';
+import { omit } from 'lodash-es';
 const { perm } = usePermission();
 
 const appStore = useAppStore();
@@ -259,8 +253,8 @@ const selectedRowKeys = ref([]);
 const selectChange = (value) => {
   selectedRowKeys.value = value;
 };
-
-const originColumns = [
+const originColumns = ref([]);
+const defaultTableColumns = [
   { fieldId: 'serviceName', fieldTitle: '服务单元', width: 160, code: 'TEXT' },
   { fieldId: 'sopNo', fieldTitle: 'SOP流水号', width: 200, code: 'TEXT' },
   { fieldId: 'crmNo', fieldTitle: '项目单号', width: 200, code: 'TEXT' },
@@ -324,7 +318,10 @@ const originColumns = [
     code: 'SINGLE_SELECT',
   },
 ];
-const originFieldIds = originColumns.map((item) => item.fieldId);
+originColumns.value = cloneDeep(defaultTableColumns);
+const originFieldIds = computed(() => {
+  return originColumns.value.map((item) => item.fieldId);
+});
 const columns = computed(() => {
   const defaultColumns = [
     {
@@ -333,23 +330,6 @@ const columns = computed(() => {
       width: 50,
       fixed: 'left',
     },
-    // { colKey: 'serviceName', title: '服务单元', width: 160 },
-    // { colKey: 'sopNo', title: 'SOP流水号', width: 200 },
-    // { colKey: 'crmNo', title: '项目单号', width: 200 },
-    // { colKey: 'beginTime', title: '派单时间', width: 180 },
-    // { colKey: 'customManagerName', title: '客户经理', width: 140 },
-    // { colKey: 'customManagerTypeStr', title: '客户类型', width: 120 },
-    // { colKey: 'customName', title: '客户名称', width: 140 },
-    // { colKey: 'crmName', title: '项目名称', minWidth: 160 },
-    // { colKey: 'productName', title: '实施产品', width: 120 },
-    // { colKey: 'examStartTime', title: '考试开始时间', width: 180 },
-    // { colKey: 'examEndTime', title: '考试结束时间', width: 180 },
-    // { colKey: 'flowCreateName', title: '提交人', width: 140 },
-    // { colKey: 'flowCreateTime', title: '提交时间', width: 180 },
-    // { colKey: 'flowUpdateTime', title: '更新时间', width: 180 },
-    // { colKey: 'statusStr', title: '流程状态', width: 120 },
-    // { colKey: 'taskName', title: '流程节点', width: 160 },
-    // { colKey: 'pendApproveName', title: '当前节点负责人', width: 140 },
     {
       title: '管理',
       colKey: 'operate',
@@ -378,16 +358,96 @@ const columns = computed(() => {
     return defaultColumns;
   }
 });
-
+const fastShowOptions = ref([]);
+const getFastShowOptions = () => {
+  getSopFastOptionsApi({
+    type: 'CLOUD_MARK_SOP_FLOW',
+    contentType: 'VIEW',
+  }).then((res) => {
+    fastShowOptions.value = (res || []).map((item) => ({
+      ...item,
+      label: item.name,
+      value: item.id,
+    }));
+  });
+};
+getFastShowOptions();
 const fields = ref([
   {
     prop: 'serviceId',
     label: '服务单元',
     type: 'select',
-    labelWidth: 70,
+    labelWidth: 104,
     colSpan: 6,
     cell: 'service',
   },
+  {
+    prop: 'leadId',
+    label: '大区经理',
+    labelWidth: 104,
+    colSpan: 6,
+    cell: 'leadId',
+  },
+  {
+    prop: 'customName',
+    label: '客户名称',
+    labelWidth: 104,
+    colSpan: 6,
+  },
+  {
+    prop: 'taskKey',
+    label: '当前节点',
+    type: 'select',
+    labelWidth: 104,
+    colSpan: 6,
+    options:
+      appStore
+        .getFlowDetailByType('CLOUD_MARK_SOP_FLOW')
+        ?.setupList?.map((item) => ({ value: item, label: item })) || [],
+  },
+  {
+    prop: 'crmUserId',
+    label: '客户经理',
+    labelWidth: 104,
+    colSpan: 6,
+  },
+
+  {
+    prop: 'crmName',
+    label: '项目名称',
+    labelWidth: 104,
+    colSpan: 6,
+  },
+  {
+    prop: 'sopNo',
+    label: 'sop号',
+    labelWidth: 104,
+    colSpan: 6,
+  },
+  {
+    prop: 'fastSearch',
+    label: '快捷搜索',
+    type: 'select',
+    labelWidth: 104,
+    colSpan: 6,
+    options: [],
+  },
+  {
+    prop: 'fastColumns',
+    label: '快捷显示',
+    type: 'select',
+    labelWidth: 104,
+    colSpan: 6,
+    options: fastShowOptions.value,
+  },
+  {
+    prop: 'eee',
+    label: '打卡在时限内',
+    type: 'select',
+    labelWidth: 104,
+    colSpan: 6,
+    options: [],
+  },
   {
     prop: 'buttons',
     colSpan: 4,
@@ -396,6 +456,13 @@ const fields = ref([
 ]);
 const params = reactive({
   serviceId: '',
+  leadId: '',
+  customName: '',
+  taskKey: '',
+  crmUserId: '',
+  crmName: '',
+  sopNo: '',
+  eee: '',
   formWidgetMetadataViewList: cloneDeep(originColumns),
   formWidgetMetadataConditionList: [],
   formWidgetMetadataOrderList: [],
@@ -403,9 +470,13 @@ const params = reactive({
 });
 const transParams = computed(() => {
   let formWidgetMetadataViewList = params.formWidgetMetadataViewList.filter(
-    (item) => !originFieldIds.includes(item.fieldId)
+    (item) => !originFieldIds.value.includes(item.fieldId)
   );
-  return { ...params, formWidgetMetadataViewList, type: 'OFFICE_SOP_FLOW' };
+  return {
+    ...omit(params, ['fastSearch', 'fastColumns']),
+    formWidgetMetadataViewList,
+    type: 'OFFICE_SOP_FLOW',
+  };
 });
 const {
   loading: tableLoading,
@@ -423,7 +494,12 @@ const {
 
 const formWidgetMetadataViewList = ref(cloneDeep(originColumns));
 const metadataChange = (vals) => {
-  formWidgetMetadataViewList.value = vals;
+  formWidgetMetadataViewList.value = vals.map((item) => {
+    if (item.options && typeof item.options === 'string') {
+      item.options = JSON.parse(item.options);
+    }
+    return item;
+  });
   search();
 };
 
@@ -527,4 +603,8 @@ const toDeviceManage = (row) => {
   curSopData.value = row;
   showDeviceManage.value = true;
 };
+watch(originColumns, () => {
+  params.formWidgetMetadataViewList = cloneDeep(originColumns.value);
+  formWidgetMetadataViewList.value = cloneDeep(originColumns.value);
+});
 </script>

+ 29 - 22
src/views/sop/sop-manage/student-sop/index.vue

@@ -234,6 +234,7 @@ import { cloneDeep } from 'lodash-es';
 import { CUSTOMER_TYPE, FLOW_STATUS } from '@/config/constants';
 import { dictToOptionList } from '@/utils/tool';
 import DeviceManageNew from '@/components/common/device-manage-new';
+import { omit } from 'lodash-es';
 const { perm } = usePermission();
 
 const appStore = useAppStore();
@@ -323,25 +324,6 @@ const defaultTableColumns = [
   },
 ];
 originColumns.value = cloneDeep(defaultTableColumns);
-const getCustomColumns = (id) => {
-  getSopFastOptionsApi({
-    type: 'CLOUD_MARK_SOP_FLOW',
-    contentType: 'VIEW',
-  }).then((res) => {
-    if (res && res?.length) {
-      let option = res.find((item) => item.id == id);
-      let data = JSON.parse(option.content || '[]').map((item) => {
-        if (item.options && typeof item.options === 'string') {
-          item.options = JSON.parse(item.options);
-        }
-        return item;
-      });
-      originColumns.value = data;
-    } else {
-      originColumns.value = [];
-    }
-  });
-};
 
 const originFieldIds = computed(() => {
   return originColumns.value.map((item) => item.fieldId);
@@ -383,7 +365,20 @@ const columns = computed(() => {
     return defaultColumns;
   }
 });
-
+const fastShowOptions = ref([]);
+const getFastShowOptions = () => {
+  getSopFastOptionsApi({
+    type: 'CLOUD_MARK_SOP_FLOW',
+    contentType: 'VIEW',
+  }).then((res) => {
+    fastShowOptions.value = (res || []).map((item) => ({
+      ...item,
+      label: item.name,
+      value: item.id,
+    }));
+  });
+};
+getFastShowOptions();
 const fields = computed(() => {
   return [
     {
@@ -451,7 +446,7 @@ const fields = computed(() => {
       type: 'select',
       labelWidth: 104,
       colSpan: 6,
-      options: [],
+      options: fastShowOptions.value,
     },
     {
       prop: 'eee',
@@ -470,6 +465,13 @@ const fields = computed(() => {
 });
 const params = reactive({
   serviceId: '',
+  leadId: '',
+  customName: '',
+  taskKey: '',
+  crmUserId: '',
+  crmName: '',
+  sopNo: '',
+  eee: '',
   formWidgetMetadataViewList: cloneDeep(originColumns),
   formWidgetMetadataConditionList: [],
   formWidgetMetadataOrderList: [],
@@ -480,7 +482,11 @@ const transParams = computed(() => {
   let formWidgetMetadataViewList = params.formWidgetMetadataViewList.filter(
     (item) => !originFieldIds.value.includes(item.fieldId)
   );
-  return { ...params, formWidgetMetadataViewList, type: 'CLOUD_MARK_SOP_FLOW' };
+  return {
+    ...omit(params, ['fastSearch', 'fastColumns']),
+    formWidgetMetadataViewList,
+    type: 'CLOUD_MARK_SOP_FLOW',
+  };
 });
 const {
   loading: tableLoading,
@@ -508,6 +514,7 @@ const metadataChange = (vals) => {
 };
 
 const filterConfirm = (data, formWidgetMetadataOperation) => {
+  console.log(data, formWidgetMetadataOperation);
   params.formWidgetMetadataConditionList = data.map((item) => {
     return {
       fieldId: item.fieldId,