Browse Source

feat:合同导入时,需要找出同公司同服务中开始时间大于当前时间和结束时间小于当前时间的数据展示在页面上让用户确认。

ly 11 months ago
parent
commit
1ab18a1420

+ 116 - 57
src/views/business/upgrade/WorkOrderDialog.vue

@@ -1,41 +1,61 @@
 <template>
-  <el-dialog id="workdialog" v-model="outerVisible" title="Outer Dialog" width="800">
-    <el-table
-        ref="singleTableRef"
-        :data="gridData"
+  <el-dialog id="workdialog" v-model="outerVisible" title="合同列表" width="800">
+    <span>导入的合同开始时间大于当前时间&nbsp;<br/>
+    注:当前导入的以下合同,其最小开始月大于当前时间,会在开始月之前无法将任务委托给工厂进行工作,请确认以下客户开始服务的时间是否正确。</span>
+      <el-table
+          ref="singleTableRef"
+          :data="data.startMonth"
+          highlight-current-row
+          style="width: 100%"
+          max-height="250"
+          @current-change="handleCurrentChange"
+      >
+        <el-table-column type="index" label="序号" width="50" />
+        <el-table-column property="contractNo" label="合同编号" width="120" />
+        <el-table-column property="companyName" label="客户名称" width="120" />
+
+        <el-table-column property="taskType" label="服务类型" width="120" />
+        <el-table-column property="startMonth" label="开始月" width="120" />
+        <el-table-column property="endMonth" label="结束月" width="120" />
+        <el-table-column label="操作" min-width="120">
+          <template #default="scope">
+            <el-button size="small" :disabled="scope.row.disabled" @click="handleClick(scope.$index, scope.row,this)">
+              确认
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+    <span>导入的合同结束时间小于当前时间&nbsp;<br/>
+    注:当前导入的以下合同,其最大结束月小于当前时间,会导致洪喜爱月开始该服务将无法委托给工厂工作,请确认一下客户是否都已经停止服务,如果未停止服务,需要补传续合同。</span>
+      <el-table
+
+        :data="data.endMonth"
         highlight-current-row
         style="width: 100%"
+        max-height="250"
         @current-change="handleCurrentChange"
     >
-      <el-table-column type="index" width="50" />
-      <el-table-column property="date" label="Date" width="120" />
-      <el-table-column property="name" label="Name" width="120" />
-      <el-table-column property="address" label="Address" />
-    </el-table>
-    <div style="margin-top: 20px">
-      <el-button @click="setCurrent(gridData[1])">Select second row</el-button>
-      <el-button @click="setCurrent()">Clear selection</el-button>
-    </div>
-    <el-dialog
-        v-model="innerVisible"
-        title="Inner Dialog"
-        width="400px"
-        append-to-body
-    >
-      <span>确定要更换这条工单详细吗?</span>
-      <template #footer>
-        <div class="dialog-footer">
-          <el-button @click="innerVisible = false">取消</el-button>
-          <el-button type="primary" @click="sumbit">
-           提交
+      <el-table-column type="index" label="序号" width="50" />
+      <el-table-column property="contractNo" label="合同编号" width="120" />
+      <el-table-column property="companyName" label="客户名称" width="120" />
+
+      <el-table-column property="taskType" label="服务类型" width="120" />
+      <el-table-column property="startMonth" label="开始月" width="120" />
+      <el-table-column property="endMonth" label="结束月" width="120" />
+      <el-table-column label="操作" min-width="120">
+        <template #default="scope">
+          <el-button size="small" :disabled="scope.row.disabled" @click="handleClick(scope.$index, scope.row,this)">
+            确认
           </el-button>
-        </div>
-      </template>
-    </el-dialog>
+        </template>
+      </el-table-column>
+    </el-table>
+
+
     <template #footer>
       <div class="dialog-footer">
         <el-button @click="outerVisible = false">取消</el-button>
-        <el-button type="primary" @click="innerVisible = true">
+        <el-button type="primary" @click="sumbit">
           确认
         </el-button>
       </div>
@@ -43,8 +63,10 @@
   </el-dialog>
 </template>
 <script lang="ts" setup>
-import { reactive, ref } from 'vue'
-import {ElTable} from "element-plus";
+import {getCurrentInstance, reactive, ref, toRefs} from 'vue'
+import {ElTable,ElButton} from "element-plus";
+
+import { defineProps,defineEmits } from 'vue';
 
 const dialogTableVisible = ref(false)
 const dialogFormVisible = ref(false)
@@ -52,6 +74,9 @@ const formLabelWidth = '140px'
 const outerVisible = ref(false);
 const innerVisible = ref(false);
 const currentRow = ref();
+
+const checkNumber = ref(0);
+const { proxy } = getCurrentInstance();
 const form = reactive({
   name: '',
   region: '',
@@ -62,41 +87,69 @@ const form = reactive({
   resource: '',
   desc: '',
 })
-interface workOrder {
-
+// interface Props {
+//   inputData?:Map<string, any>
+// }
+// const prop = defineProps<Props>()
+interface input {
+ contractNo:string;
+ companyName:string;
+ taskType:string;
+ startMonth:Date;
+ endMonth:Date;
+ disabled: boolean;
 }
-const gridData = [
-  {
-    date: '2016-05-02',
-    name: 'John Smith',
-    address: 'No.1518,  Jinshajiang Road, Putuo District',
-  },
-  {
-    date: '2016-05-04',
-    name: 'John Smith',
-    address: 'No.1518,  Jinshajiang Road, Putuo District',
-  },
-  {
-    date: '2016-05-01',
-    name: 'John Smith',
-    address: 'No.1518,  Jinshajiang Road, Putuo District',
+const emit = defineEmits(['event']);
+const props = defineProps({
+  data: {
+    type: Object,
+    default: () => {},
   },
-  {
-    date: '2016-05-03',
-    name: 'John Smith',
-    address: 'No.1518,  Jinshajiang Road, Putuo District',
-  },
-]
+  checksuccess:{
+    type: Number,
+    default: 0,
+  }
+});
+const { data,checksuccess } = toRefs(props);
+//torefs()
+
 
 function open() {
   outerVisible.value = true;
-
 }
 
 
 function sumbit() {
-  outerVisible.value = false;
-  innerVisible.value = false;
+
+
+  if(data.value.startMonth == null && data.value.endMonth == null  ){
+    emit('event',1)
+    outerVisible.value = false;
+  }
+  if(data.value.startMonth == 0 && data.value.endMonth == 0){
+    emit('event',1)
+    outerVisible.value = false;
+  }
+  if(data.value.startMonth.length+data.value.endMonth.length===checkNumber.value){
+    emit('event',1)
+    proxy.$alert(
+        "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
+        "已完成确认请重新上传文件" +
+        "</div>"
+        ,
+        { dangerouslyUseHTMLString: true }
+    );
+    outerVisible.value = false;
+  }else{
+    proxy.$alert(
+        "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
+        "还有未确认数据" +
+        "</div>"
+        ,
+        { dangerouslyUseHTMLString: true }
+    );
+  }
+  checkNumber.value = 0;
 }
 
 
@@ -108,9 +161,15 @@ const setCurrent = (row?: any) => {
 const handleCurrentChange = (val: any | undefined) => {
   currentRow.value = val
 }
+const handleClick =(index:number ,row:input,ele:ElButton) => {
+  checkNumber.value = checkNumber.value+1;
+  row.disabled = true;
+
+}
 defineExpose({
   open,
 });
+
 </script>
 <style scoped>
   #workdialog{

+ 22 - 3
src/views/business/upgrade/order/importExcelDialog.vue

@@ -29,6 +29,7 @@
               :limit="1"
               accept=".xlsx, .xls"
               :headers="addType === 1 ? uploadLoop.headers : uploadOnce.headers"
+              :data="falg"
               :action="
                 (addType === 1 ? uploadLoop.url : uploadOnce.url) +
                 '?updateSupport=' +
@@ -88,6 +89,7 @@
       </div>
     </template>
   </el-dialog>
+  <work-order-dialog ref="workOrderDialog" @event="setchecksuccess" v-if="inputData" :checksuccess="checksuccess" :data="inputData"></work-order-dialog>
 </template>
 
 
@@ -101,7 +103,9 @@ import {
   exportOnceTemplate,
   importLoop,
   importOnce,
+  checkInput
 } from "@/api/upgrade/contract";
+import WorkOrderDialog  from "@/views/business/upgrade/WorkOrderDialog.vue";
 const { proxy } = getCurrentInstance();
 /** 父组件传参 */
 const props = defineProps({
@@ -118,7 +122,11 @@ const visible = ref(false);
 const fullLoading = ref(false);
 const addType = ref(1);
 const webHost = import.meta.env.VITE_APP_BASE_API;
-
+const workOrderDialog = ref(null);
+const checksuccess = ref(0);
+const setchecksuccess = (val)=>{
+  checksuccess.value = val;
+}
 const setHeaders = {
   Authorization: getToken(),
 };
@@ -225,7 +233,7 @@ const companyEmptyData = {
 
 const followQuery = ref({});
 const { form, rules, followData } = toRefs(data);
-
+const inputData = ref();
 /***********************  表单页方法 ****************************/
 
 /** 抽屉打开 */
@@ -260,7 +268,16 @@ const importTemplate = () => {
 };
 
 function handleBeforeUpload(file) {
-  console.log(file);
+  const formData = new FormData();
+  formData.append("file", file);
+  if(checksuccess.value === 0){
+    return checkInput(formData).then(res =>{
+      fullLoading.value = false;
+      inputData.value = res.data;
+      workOrderDialog.value.open()
+      return false;
+    })
+  }
   if (
     file.type !==
       "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" &&
@@ -283,6 +300,7 @@ const handleFileUploadProgress = (event, file, fileList) => {
 /** 文件上传成功处理 */
 const handleFileSuccess = (response, file, fileList) => {
   fullLoading.value = false;
+  checksuccess.value = 0;
   if (addType === 1) {
     uploadLoop.open = false;
     uploadLoop.isUploading = false;
@@ -311,6 +329,7 @@ const handleFileSuccess = (response, file, fileList) => {
 };
 /** 提交上传文件 */
 function submitFileForm() {
+
   proxy.$refs["uploadRef"].submit();
 }