gaoluyang
5 天以前 84076d95a74a44876e4ce29a3df52479f18a0c47
src/views/customerService/afterSalesHandling/components/formDia.vue
@@ -10,7 +10,7 @@
            :model="form"
            label-width="140px"
            label-position="top"
            :rules="rules"
            :rules="operationType === 'view' ? {} : rules"
            ref="formRef"
         >
            <el-row :gutter="30">
@@ -63,7 +63,7 @@
                        v-model="form.proDesc"
                        placeholder="请输入"
                        clearable
                        disabled
                        :disabled="operationType === 'view'"
                        type="textarea"
                     />
                  </el-form-item>
@@ -118,8 +118,9 @@
         </el-row>
         <template #footer>
            <div class="dialog-footer">
               <el-button type="primary" @click="submitForm">确认</el-button>
               <el-button @click="closeDia">取消</el-button>
               <el-button v-if="operationType === 'approve'" type="primary" @click="submitForm">确认</el-button>
               <el-button v-if="operationType === 'approve'" @click="closeDia">取消</el-button>
               <el-button v-else type="primary" @click="closeDia">关闭</el-button>
            </div>
         </template>
    </el-dialog>
@@ -131,6 +132,7 @@
import useUserStore from "@/store/modules/user.js";
import {userListNoPageByTenantId} from "@/api/system/user.js";
import {afterSalesServiceAdd, afterSalesServiceDispose, afterSalesServiceUpdate} from "@/api/customerService/index.js";
import { getCurrentDate } from "@/utils/index.js";
const { proxy } = getCurrentInstance()
const emit = defineEmits(['close'])
const dialogFormVisible = ref(false);
@@ -168,8 +170,14 @@
      userList.value = res.data;
   });
   form.value = {...row}
   form.value.disposeUserId = userStore.id;
   form.value.disDate = getCurrentDate();
   if (type === 'approve') {
      if (!form.value.disposeUserId) {
         form.value.disposeUserId = userStore.id;
      }
      if (!form.value.disDate) {
         form.value.disDate = getCurrentDate();
      }
   }
}
// const setName = (code) => {
//    const index = userList.value.findIndex(item => item.deviceModel === code);
@@ -179,13 +187,16 @@
//    }
// }
const submitForm = () => {
   if (operationType.value === 'view') {
      closeDia();
      return;
   }
   proxy.$refs["formRef"].validate(valid => {
      if (valid) {
         afterSalesServiceDispose(form.value).then(response => {
            proxy.$modal.msgSuccess("新增成功")
            closeDia()
         })
      }
      if (!valid) return;
      afterSalesServiceDispose(form.value).then(() => {
         proxy.$modal.msgSuccess("处理成功")
         closeDia()
      })
   })
}
// 关闭弹框
@@ -194,14 +205,6 @@
  dialogFormVisible.value = false;
  emit('close')
};
// 获取当前日期并格式化为 YYYY-MM-DD
function getCurrentDate() {
   const today = new Date();
   const year = today.getFullYear();
   const month = String(today.getMonth() + 1).padStart(2, "0"); // 月份从0开始
   const day = String(today.getDate()).padStart(2, "0");
   return `${year}-${month}-${day}`;
}
defineExpose({
  openDialog,
});
@@ -209,4 +212,4 @@
<style scoped>
</style>
</style>