kyoyue 8 months ago
parent
commit
2741de2bed

+ 0 - 5
src/components/Upload/src/components/UploadModal.vue

@@ -213,18 +213,14 @@
 
       async function uploadApiByItem(item: FileItem) {
         const { api } = props;
-        console.log('fdffdfdfdfdfdfdfdf',api)
         if (!api || !isFunction(api)) {
-          console.error('1')
           return warn('upload api must exist and be a function');
         }
         if (!isFunction(api)) {
-          console.log('2')
           console.error('API is not a function');
           return;
         }
         try {
-          console.log('@@@@@@',item)
           item.status = UploadResultStatus.UPLOADING;
           const params = props.uploadParams;
           params['md5'] = item.md5;
@@ -285,7 +281,6 @@
           }
           const data = await Promise.all(
             uploadFileList.map((item) => {
-              console.log('item--------',item);
               return uploadApiByItem(item);
             }),
           );

+ 34 - 34
src/views/wechat/sop_task/add_sop/components/msgContant.vue

@@ -83,6 +83,7 @@
           :maxNumber="1"
           @change="handleChange"
           :api="uploadApi"
+          v-model:file="fileList"
         />
           <!-- :accept="['image/*', 'video/*', 'audio/*','application/pdf', 'application/vnd.ms-excel','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document']" -->
           <!-- @remove="emit('remove')" @moveUp="emit('moveUp')" @moveDown="emit('moveDown')" -->
@@ -129,7 +130,7 @@
   import ProductNote from './productNote.vue';
   import { BasicUpload } from '@/components/Upload';
   import { deleteFile, downloadFile, getFileList, uploadApi } from '@/api/fms/file';
-  // import { uploadApi } from '@/api/sys/upload';
+  import { uploadPics } from '@/api/wechat/tes';
   import ProductContant from './productContant.vue';
   export default defineComponent({
     name: 'MsgContant',
@@ -203,19 +204,19 @@
       };
       const isFocused = ref(false);
 
-      const uploadUrl = ref('/fms-api/upload'); // 上传地址
-      const acceptTypes = ref(
-        'image/*,video/*,application/pdf,application/msword,application/vnd.ms-excel',
-      );
+      // const uploadUrl = ref('/fms-api/upload'); // 上传地址
+      // const acceptTypes = ref(
+      //   'image/*,video/*,application/pdf,application/msword,application/vnd.ms-excel',
+      // );
       const fileList = ref([]);
 
-      const beforeUpload = (file) => {
-        const isAllowedType = /image|video|pdf|msword|vnd.ms-excel/.test(file.type);
-        if (!isAllowedType) {
-          message.error('只能上传图片、视频、PDF、Word、Excel文件');
-        }
-        return isAllowedType;
-      };
+      // const beforeUpload = (file) => {
+      //   const isAllowedType = /image|video|pdf|msword|vnd.ms-excel/.test(file.type);
+      //   if (!isAllowedType) {
+      //     message.error('只能上传图片、视频、PDF、Word、Excel文件');
+      //   }
+      //   return isAllowedType;
+      // };
 
       // const handleChange = ({ file, fileList: newFileList }) => {
       //   fileList.value = newFileList.slice(-1); // 保证只保留最新上传的一个文件
@@ -231,26 +232,26 @@
         taskForm.fileContent = '';
       };
 
-      const customRequest = async ({ file, onSuccess, onError }) => {
-        const formData = new FormData();
-        formData.append('file', file);
+      // const customRequest = async ({ file, onSuccess, onError }) => {
+      //   const formData = new FormData();
+      //   formData.append('file', file);
 
-        try {
-          const response = await fetch(uploadUrl.value, {
-            method: 'POST',
-            body: formData,
-          });
+      //   try {
+      //     const response = await fetch(uploadUrl.value, {
+      //       method: 'POST',
+      //       body: formData,
+      //     });
 
-          if (response.ok) {
-            const result = await response.json();
-            onSuccess(result);
-          } else {
-            onError(new Error('上传失败'));
-          }
-        } catch (error) {
-          onError(error);
-        }
-      };
+      //     if (response.ok) {
+      //       const result = await response.json();
+      //       onSuccess(result);
+      //     } else {
+      //       onError(new Error('上传失败'));
+      //     }
+      //   } catch (error) {
+      //     onError(error);
+      //   }
+      // };
 
       const handleFocus = () => {
         isFocused.value = true;
@@ -346,6 +347,7 @@
 
       return {
         uploadApi,
+        uploadPics,
         taskForm,
         handleCreateClick,
         addTextArea,
@@ -359,13 +361,11 @@
         handleFocus,
         handleBlur,
         handleMenuClick,
-        uploadUrl,
-        acceptTypes,
         fileList,
-        beforeUpload,
+        // beforeUpload,
         handleChange,
         handleRemove,
-        customRequest,
+        // customRequest,
         internalValue,
         updateValue,
         addCanMoveProperties,

+ 26 - 24
src/views/wechat/sop_task/add_sop/components/nodeConfigDrawer.vue

@@ -27,34 +27,34 @@
               <InfoCircleOutlined />
               主要用于执行任务的触发的条件,满足条件才可进入群发,转人工的动作
             </div>
-            <!-- <FormItem
+            <FormItem
               label="回复情况"
               name="conditionType"
               :rules="[{ required: true, message: '请选择回复情况' }]"
-            > -->
-            <!-- <Radio.Group v-model:value="form.conditionType"> -->
-            <!-- <Radio value="2">客户不回复</Radio> -->
-            <!-- <Radio value="1">客户回复</Radio> -->
-            <!-- </Radio.Group> -->
-            <!-- </FormItem> -->
-            <!-- <FormItem
+            >
+            <Radio.Group v-model:value="form.conditionType">
+            <Radio value="2">客户不回复</Radio>
+            <Radio value="1">客户回复</Radio>
+            </Radio.Group>
+            </FormItem>
+            <FormItem
               v-show="form.conditionType === '2'"
               class="no-colon"
               label="超时时间"
-              name="timeout"
+              name="noReplyCondition"
             >
               <div style="display: flex; align-items: center">
                 超过
                 <Input
-                  v-model:value="form.timeout"
+                  v-model:value="form.noReplyCondition"
                   :style="{ width: '80px', margin: '0 5px' }"
                   :rules="[{ required: true, message: '请输入' }]"
                 />
-                小时,执行该动作
+                分钟,执行该动作
               </div>
-            </FormItem> -->
-            <!-- v-show="form.conditionType === '1'" -->
+            </FormItem>
             <FormItem
+            v-show="form.conditionType === '1'" 
               label="回复内容"
               name="content"
              required
@@ -66,7 +66,7 @@
             </FormItem>
             <!-- 具体内容 -->
             <FormItem
-              v-show="form.content === 'concreteContent'"
+              v-show="form.conditionType === '1' && form.content === 'concreteContent'"
               label="具体内容"
               name="conditionList"
               :rules="[{ required: true, message: '请输入' }]"
@@ -303,8 +303,8 @@
   let actionLabel = store.sopLabelList;
   const form = reactive({
     nodeName: '', //节点名称
-    // conditionType: '1', //触发条件:1为客户回复,2为客户不回复
-    timeout: '',
+    conditionType: '1', //触发条件:1为客户回复,2为客户不回复
+    noReplyCondition: undefined,
     content: 'concreteContent',
     conditionList: [{ expression: '' }],
   });
@@ -319,8 +319,8 @@
   //     }}
   const initialForm = reactive({
     nodeName: '',
-    // conditionType: '1',
-    timeout: '',
+    conditionType: '1',
+    noReplyCondition: undefined,
     content: 'concreteContent',
     conditionList: [{ expression: '' }],
   });
@@ -380,7 +380,7 @@
         .validate()
         .then((res) => {
           const allValid = res.conditionList.every(item => item.expression.trim()!== '');
-          if(!allValid){
+          if(form.conditionType === '1' && form.content === 'concreteContent' && !allValid){
            message.warning('请填写完整具体内容!')
            return;
           }else{
@@ -425,7 +425,8 @@
     // 填充 form 数据
     Object.assign(form, {
       nodeName: data.data.name,
-      // conditionType: String(data.data.conditionType),
+      conditionType: String(data.data.conditionType),
+      noReplyCondition: data.data.noReplyCondition,
       conditionOperator: String(data.data.conditionOperator),
       conditionList: conArray,
     });
@@ -451,17 +452,18 @@
     if (!btnDisabled.value) {
       console.log(' status', !btnDisabled.value);
       // 提交表单逻辑
-      // const { nodeName, conditionType, conditionList } = form;
-      const { nodeName, conditionList } = form;
+      const { nodeName, conditionType, conditionList ,noReplyCondition} = form;
+      // const { nodeName, conditionList } = form;
       const { taskType, sendType, actionMessage, tagValue } = taskForm;
-
+       console.log('actionMessage',actionMessage)
       const listCon = conditionList.map((item) => {
         return item.expression;
       });
       const requestData = {
         name: nodeName,
-        conditionType: 1,
+        conditionType: Number(conditionType),
         conditionList: listCon,
+        noReplyCondition: Number(noReplyCondition),
         taskType,
         sendType,
         actionMessage,

+ 13 - 2
src/views/wechat/sop_task/add_sop/components/nodeMsgContant.vue

@@ -54,7 +54,7 @@
       </a-form-item>
       <a-form-item v-else-if="area.type === 2" label="" name="fileContent" class="message-content">
         <div class="upload-contant">
-          <a-upload-dragger
+          <!-- <a-upload-dragger
             class="upload"
             :custom-request="customRequest"
             :before-upload="beforeUpload"
@@ -76,7 +76,14 @@
                 <div>支持上传文件为图片、视频、pdf、word、excel</div>
               </div>
             </template>
-          </a-upload-dragger>
+          </a-upload-dragger> -->
+          <BasicUpload
+          :maxSize="100"
+          :maxNumber="1"
+          @change="handleChange"
+          :api="uploadApi"
+          v-model:file="fileList"
+        />
           <!-- @remove="emit('remove')" @moveUp="emit('moveUp')" @moveDown="emit('moveDown')" -->
           <CustomIcons :index="index" :length="length" :iconDisable="msgDisabled"/>
         </div>
@@ -118,6 +125,8 @@
   import { Form, Button, Dropdown, Menu, message, Input, SubMenu, Upload } from 'ant-design-vue';
   import { CloudUploadOutlined, PlusCircleOutlined, UserOutlined } from '@ant-design/icons-vue';
   import CustomIcons from './customIcons.vue';
+  import { BasicUpload } from '@/components/Upload';
+  import { deleteFile, downloadFile, getFileList, uploadApi } from '@/api/fms/file';
   import ProductNote from './productNote.vue';
   import ProductContant from './productContant.vue';
   export default defineComponent({
@@ -140,6 +149,7 @@
       CustomIcons,
       ProductNote,
       ProductContant,
+      BasicUpload,
     },
     // props: {
     //   actionMessage: Array,
@@ -373,6 +383,7 @@
         internalValue,
         updateValue,
         addCanMoveProperties,
+        uploadApi,
       };
     },
   });

+ 1 - 0
src/views/wechat/sop_task/add_sop/components/userPhasesDrawer.vue

@@ -500,6 +500,7 @@
       // 提交表单逻辑
       const { phaseName, conditionType, conditionOperator, conditionList } = form;
       const { taskType, sendType, actionMessage, tagValue } = taskForm;
+      console.log('actionMessage',actionMessage)
 
       const requestData = {
         name: phaseName,