Kaynağa Gözat

feat:单次任务弹窗传输数据修改

ly 11 ay önce
ebeveyn
işleme
34afd04dfb

+ 14 - 4
src/views/business/production/onWorkDetail/onWorkDetailDialog.vue

@@ -1,7 +1,7 @@
 <template>
   <el-dialog v-loading.fullscreen.lock="fullscreenLoading" :close-on-click-modal = "false"
               v-model="outerVisible" title="任务进度" width="700" height="800">
-    <el-form  :model="sumbitForm" label-width="auto" ref="workDetailForm" style="max-width: 700px;">
+    <el-form v-if="handlerId === useUserStore().user.userId" :model="sumbitForm" label-width="auto" ref="workDetailForm" style="max-width: 700px;">
       <el-form-item label="记录日期">
         <el-date-picker v-model="sumbitForm.recordDate" type="date" clearable
                         format="YYYY-MM-DD" value-format="YYYY-MM-DD"
@@ -65,7 +65,7 @@
 <script lang="ts" setup>
 import {ElButton, ElTable} from "element-plus";
 import {ref} from "@vue/reactivity";
-
+import useUserStore from "@/store/modules/user";
 import {defineProps, getCurrentInstance, reactive, toRefs} from "vue";
 import {
   getDetail,
@@ -78,6 +78,13 @@ const onworkDetailData = ref<TFrom[]>([]);
 const currentRow = ref();
 const fullscreenLoading = ref<boolean>(false);
 const { proxy } = getCurrentInstance();
+const props = defineProps({
+  getList: {
+    type: Function,
+    default: () => { },
+  },
+});
+const { getList } = toRefs(props);
 const form = reactive({
   buttonName: "修改",
   disabled: false,
@@ -96,7 +103,7 @@ const singleTableRef = ref<InstanceType<typeof ElTable>>()
 const setCurrent = (row?: any) => {
   singleTableRef.value!.setCurrentRow(row)
 }
-
+const handlerId = ref();
 const handleCurrentChange = (val: any | undefined) => {
   currentRow.value = val
 }
@@ -117,6 +124,7 @@ const handleClick = (index: number, row: TFrom, ele: ElButton) => {
           ,
           { dangerouslyUseHTMLString: true }
       );
+      getList.value();
     }).catch((error)=>{
       fullscreenLoading.value = false;
     })
@@ -135,11 +143,12 @@ const restDetail = () =>{
   })
 }
 //打开本弹窗的方法暴露给父组件
-const openView = (id) => {
+const openView = (id,userId) => {
   sumbitForm.recordDate = null;
   sumbitForm.recordDetail = null;
   workOrderId.value = id;
   outerVisible.value = true;
+  handlerId.value = userId;
   restDetail();
 }
 //设置属性
@@ -169,6 +178,7 @@ const onSubmit = () =>{
     console.log(response);
     restDetail();
     fullscreenLoading.value = false;
+    getList.value();
   }).catch((error) => {
     console.log(error);
     fullscreenLoading.value = false;

+ 25 - 5
src/views/business/production/onceWork/index.vue

@@ -16,7 +16,7 @@
     </div>
     <!-- v-hasPermi="['business:entrust:workOrder:current:export']"> -->
     <!-- 搜索区 -->
-    <el-form class="list-search-container" size="small" :model="queryParams" ref="queryRef" :inline="true"
+    <el-form  class="list-search-container" size="small" :model="queryParams" ref="queryRef" :inline="true"
       label-width="78px">
       <el-form-item label="客户名称:" prop="companyName">
         <el-input v-model="queryParams.companyName" style="width: 150px" placeholder="请输入客户名称" clearable
@@ -233,7 +233,7 @@
       v-model:limit="queryParams.pageSize" @pagination="getList" />
     <contract-form ref="contractRef" :get-list="getContractList" />
     <result-dialog ref="resultDialogView" :get-list="getList"  />
-    <on-work-detail ref="onWorkDetailView" />
+    <on-work-detail ref="onWorkDetailView" :get-list="getList"  />
   </div>
 </template>
 
@@ -469,7 +469,18 @@
   getList();
   const viewOnWorkDetail = (row) =>{
     const id = row.id || ids.value;
-    onWorkDetailView.value.openView(id);
+
+    if(row.record == null){
+      proxy.$alert(
+          "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
+          "请领取任务" +
+          "</div>"
+          ,
+          { dangerouslyUseHTMLString: true }
+      );
+    }else{
+      onWorkDetailView.value.openView(id,row.record.handlerId);
+    }
   }
   const viewContract = (row) =>{
     const id = row.contractId || ids.value;
@@ -477,8 +488,17 @@
   }
   const viewResult = (row) =>{
     const id = row.id || ids.value;
-    console.log(row.record.status!== 5)
-      resultDialogView.value.openView(id,row.record.status,row.record.handlerId,row.tenantId);
+    if(row.record == null){
+      proxy.$alert(
+          "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
+          "请领取任务" +
+          "</div>"
+          ,
+          { dangerouslyUseHTMLString: true }
+      );
+    }else {
+      resultDialogView.value.openView(id, row.record.status, row.record.handlerId, row.tenantId);
+    }
   }
   const  rowNum = (num)=> {
     if (!num) {

+ 44 - 23
src/views/business/production/onceWork/resultDialog.vue

@@ -8,7 +8,7 @@
             placeholder="任务结果"
             size="large"
             style="width: 240px"
-            :disabled ="sumbitForm.recordStatus ==5 || sumbitForm.recordStatus ==6"
+            :disabled ="formHidden ==5 || formHidden ==6"
         >
           <el-option
               v-for="item in selectStatus"
@@ -21,12 +21,13 @@
       </el-form-item>
       <el-form-item v-if=" handlerId === useUserStore().user.userId">
         <el-upload
-            v-if="sumbitForm.recordStatus !==5 && sumbitForm.recordStatus !==6 "
+            v-if="formHidden !==5 && formHidden !==6 "
             ref="upload"
             class="upload-demo"
             style="flex: auto;"
             drag
             action=""
+            v-model:file-list="fileList"
             :multiple="false"
             :auto-upload="false"
             :before-upload="handleBeforeUpload"
@@ -55,7 +56,7 @@
     <template #footer>
       <div class="dialog-footer">
         <el-button @click="outerVisible = false">取消</el-button>
-        <el-button type="primary" v-if="(sumbitForm.recordStatus !==4 && sumbitForm.recordStatus !==5 )" v-hasPermi="['business:production:onceWork:finished']" @click="onsumbit">提交</el-button>
+        <el-button type="primary" v-if="handlerId === useUserStore().user.userId && (formHidden !==4 && formHidden !==5 )" v-hasPermi="['business:production:onceWork:finished']" @click="onsumbit">提交</el-button>
       </div>
     </template>
   </el-dialog>
@@ -79,7 +80,7 @@ const props = defineProps({
 });
 const { getList } = toRefs(props);
 
-
+const fileList = ref([]);
 const outerVisible = ref(false);
 const currentRow = ref();
 const fullscreenLoading = ref<boolean>(false);
@@ -88,8 +89,10 @@ const baseUrl = import.meta.env.VITE_APP_BASE_API;
 const filesTable = ref<Ifile[]>();
 const handlerId = ref();
 const tenantId = ref();
+const formHidden = ref();
 let refile = null;
-const fileEntity = reactive<Ifile>({});
+let fileEntity = {};
+
 interface Ifile{
   fileName?:string;
   url?:string;
@@ -136,17 +139,31 @@ const sumbitForm = reactive<Tform>({
 const httpRequest = (parm) => {
   const formData2 = new FormData();
   formData2.append("file", parm.file);
-  const formData = new FormData();
-  formData.append("workOrderId", workOrderId.value);
-  formData.append("recordStatus", sumbitForm.recordStatus);
+  // const formData = new FormData();
+  // formData.append("workOrderId", workOrderId.value);
+  // formData.append("recordStatus", sumbitForm.recordStatus);
+  // formData.append("sysFileStorage",fileEntity);
   uploadFile(formData2).then((res) => {
     if (res.code === 200) {
       fileEntity.fileName = res.newFileName;
       fileEntity.url = res.url;
       fileEntity.originalFileName = res.originalFilename;
       fileEntity.fileUrl = res.fileName;
-      formData.append("sysFileStorage",fileEntity);
     }
+    updateRecordStatus(workOrderId.value,sumbitForm.recordStatus,fileEntity).then(response => {
+      proxy.$alert(
+          "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
+          "提交完成" +
+          "</div>",
+          { dangerouslyUseHTMLString: true }
+      );
+      fileEntity= {};
+      FileList({"masterTableName":"biz_work_order_record","masterId":workOrderId.value}).then((response) => {
+        filesTable.value = response.data
+      })
+      //outerVisible.value = false;
+      //getList.value();
+    })
   }).then((res) => {
     proxy.$refs['upload'].clearFiles();
   }).catch((err) => {
@@ -158,31 +175,35 @@ function openView(id,status,userId){
   workOrderId.value = id;
   sumbitForm.recordStatus = status;
   sumbitForm.file = null;
+  formHidden.value = status;
   fileEntity.fileName = null;
   fileEntity.url = null;
   fileEntity.originalFileName = null;
   fileEntity.fileUrl = null;
   handlerId.value = userId;
-
   FileList({"masterTableName":"biz_work_order_record","masterId":id}).then((response) => {
     filesTable.value = response.data
   })
 }
 const onsumbit = () => {
-  proxy.$refs['upload'].submit()
-  updateRecordStatus(workOrderId.value,sumbitForm.recordStatus,fileEntity).then(response => {
-    proxy.$alert(
-        "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
-        "提交完成" +
-        "</div>",
-        { dangerouslyUseHTMLString: true }
-    );
-    FileList({"masterTableName":"biz_work_order_record","masterId":workOrderId.value}).then((response) => {
-      filesTable.value = response.data
+  console.log()
+  if(fileList.value.length===0){
+    updateRecordStatus(workOrderId.value,sumbitForm.recordStatus,fileEntity).then(response => {
+      proxy.$alert(
+          "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
+          "提交完成" +
+          "</div>",
+          { dangerouslyUseHTMLString: true }
+      );
+      outerVisible.value = false;
+      fileEntity= {};
+      FileList({"masterTableName":"biz_work_order_record","masterId":workOrderId.value}).then((response) => {
+        filesTable.value = response.data
+      })
     })
-    outerVisible.value = false;
-    getList.value();
-  })
+  }
+  proxy.$refs['upload'].submit()
+  getList.value();
 }
 function handleBeforeUpload(file) {
   //const formData = new FormData();