ly преди 11 месеца
родител
ревизия
f1fa7e498c
променени са 2 файла, в които са добавени 385 реда и са изтрити 0 реда
  1. 187 0
      src/views/business/production/onWorkDetail/onWorkDetailDialog.vue
  2. 198 0
      src/views/business/production/onceWork/resultDialog.vue

+ 187 - 0
src/views/business/production/onWorkDetail/onWorkDetailDialog.vue

@@ -0,0 +1,187 @@
+<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-item label="记录日期">
+        <el-date-picker v-model="sumbitForm.recordDate" type="date" clearable
+                        format="YYYY-MM-DD" value-format="YYYY-MM-DD"
+                        style="width: 100%;">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item label="进度描述">
+        <el-input v-model="sumbitForm.recordDetail" />
+      </el-form-item>
+      <div style="display: flex;
+    justify-content: flex-end;
+    flex-direction: row;">
+        <el-button  @click="formclear">清空</el-button>
+        <el-button type="primary" @click="onSubmit">添加</el-button>
+      </div>
+    </el-form>
+    <br>
+    <el-table
+        ref="singleTableRef"
+        :data="onworkDetailData"
+        highlight-current-row
+        style="width: 100%"
+        max-height="250"
+        @current-change="handleCurrentChange"
+    >
+      <el-table-column type="index" label="序号" width="50" />
+      <el-table-column property="recordDate" label="工作日期" width="120" >
+        <template #default="scope">
+          <el-date-picker v-model="scope.row.recordDate" type="date" clearable size="small"
+                          format="YYYY-MM-DD " value-format="YYYY-MM-DD"
+                          :disabled="scope.row.inputdisabled"
+                          style="width: 100%;">
+          </el-date-picker>
+        </template>
+      </el-table-column>
+      <el-table-column property="recordDetail" label="工作详情" width="200" >
+        <template #default="scope">
+          <el-input v-model="scope.row.recordDetail" :disabled="scope.row.inputdisabled"/>
+        </template>
+      </el-table-column>
+      <el-table-column property="userName" label="操作人" width="120" >
+        <template #default="scope">
+          <el-input v-model="scope.row.userName" disabled />
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" min-width="120">
+        <template #default="scope">
+          <el-button :disabled="scope.row.disabled" size="small" type="primary"  @click="handleClick(scope.$index, scope.row,this)">
+           {{scope.row.buttonName}}
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <template #footer>
+      <div class="dialog-footer">
+        <el-button @click="outerVisible = false">取消</el-button>
+      </div>
+    </template>
+  </el-dialog>
+</template>
+<script lang="ts" setup>
+import {ElButton, ElTable} from "element-plus";
+import {ref} from "@vue/reactivity";
+
+import {defineProps, getCurrentInstance, reactive, toRefs} from "vue";
+import {
+  getDetail,
+  updateDetail,
+  addDetail
+} from "@/api/business/onWorkDetail";
+
+const outerVisible = ref(false);
+const onworkDetailData = ref<TFrom[]>([]);
+const currentRow = ref();
+const fullscreenLoading = ref<boolean>(false);
+const { proxy } = getCurrentInstance();
+const form = reactive({
+  buttonName: "修改",
+  disabled: false,
+  id: null,
+  inputdisabled: false,
+  recordDate: '',
+  recordDetail: '',
+  userName: '',
+  workOrderId: null,
+});
+type TFrom = typeof form;
+const sumbitForm = reactive<TFrom>(form);
+const workDetailForm = ref();
+const workOrderId = ref();
+const singleTableRef = ref<InstanceType<typeof ElTable>>()
+const setCurrent = (row?: any) => {
+  singleTableRef.value!.setCurrentRow(row)
+}
+
+const handleCurrentChange = (val: any | undefined) => {
+  currentRow.value = val
+}
+//点击处理,每次点击都要改变状态默认状态时修改
+const handleClick = (index: number, row: TFrom, ele: ElButton) => {
+  console.log(row)
+  if(!row.inputdisabled){
+    fullscreenLoading.value = true;
+    updateDetail(row).then(res => {
+      fullscreenLoading.value = false;
+      row.inputdisabled = false;
+      row.buttonName = '修改';
+      restDetail();
+      proxy.$alert(
+          "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
+          "修改完成" +
+          "</div>"
+          ,
+          { dangerouslyUseHTMLString: true }
+      );
+    }).catch((error)=>{
+      fullscreenLoading.value = false;
+    })
+  }else{
+    setDisabled(false);
+  }
+
+}
+//重新获取数据
+const restDetail = () =>{
+  getDetail(workOrderId.value).then((res) => {
+    onworkDetailData.value = res.rows;
+    setDisabled(true);
+  }).catch((error) => {
+    console.log(error);
+  })
+}
+//打开本弹窗的方法暴露给父组件
+const openView = (id) => {
+  sumbitForm.recordDate = null;
+  sumbitForm.recordDetail = null;
+  workOrderId.value = id;
+  outerVisible.value = true;
+  restDetail();
+}
+//设置属性
+const setDisabled = (falg:boolean) => {
+  onworkDetailData.value.forEach((value) => {
+
+    value.inputdisabled = falg;
+    if(falg){
+      value.buttonName = '修改';
+    }else{
+      value.buttonName = '确认';
+    }
+
+  })
+}
+//表单清空
+const formclear = () => {
+  sumbitForm.recordDetail = '';
+  sumbitForm.recordDate = '';
+}
+
+//这个提交是表单提交
+const onSubmit = () =>{
+  fullscreenLoading.value = true;
+  sumbitForm.workOrderId = workOrderId;
+  addDetail(sumbitForm).then((response) => {
+    console.log(response);
+    restDetail();
+    fullscreenLoading.value = false;
+  }).catch((error) => {
+    console.log(error);
+    fullscreenLoading.value = false;
+  })
+}
+
+defineExpose({
+  openView,
+});
+</script>
+<style>
+.clearButton>.el-form-item__content{
+  flex:none !important;
+}
+
+</style>

+ 198 - 0
src/views/business/production/onceWork/resultDialog.vue

@@ -0,0 +1,198 @@
+<template>
+  <el-dialog v-loading.fullscreen.lock="fullscreenLoading" :close-on-click-modal = "false"
+             v-model="outerVisible" title="任务进度" width="600">
+    <el-form :model="sumbitForm" label-width="auto" ref="workDetailForm" style="max-width: 600px">
+      <el-form-item v-if="handlerId === useUserStore().user.userId" label="任务结果">
+        <el-select
+            v-model="sumbitForm.recordStatus"
+            placeholder="任务结果"
+            size="large"
+            style="width: 240px"
+            :disabled ="sumbitForm.recordStatus ==5 || sumbitForm.recordStatus ==6"
+        >
+          <el-option
+              v-for="item in selectStatus"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+          />
+        </el-select>
+
+      </el-form-item>
+      <el-form-item v-if=" handlerId === useUserStore().user.userId">
+        <el-upload
+            v-if="sumbitForm.recordStatus !==5 && sumbitForm.recordStatus !==6 "
+            ref="upload"
+            class="upload-demo"
+            style="flex: auto;"
+            drag
+            action=""
+            :multiple="false"
+            :auto-upload="false"
+            :before-upload="handleBeforeUpload"
+            :http-request="httpRequest"
+        >
+          <el-icon class="el-icon--upload"><upload-filled /></el-icon>
+          <div class="el-upload__text">
+            将文件拖入此处, <em>或点击上传</em>
+          </div>
+
+        </el-upload>
+      </el-form-item>
+      <el-table ref="Table" :data="filesTable" size="small" height="100%" border
+                header-row-class-name="list-header-row">
+        <el-table-column type="index" label="序号" width="47" align="center" />
+        <el-table-column label="文件名" prop="originalFileName" align="center">
+          <template #default="scope">
+            <el-link :href="`${baseUrl}${scope.row.fileUrl}`" :underline="false" target="_blank"
+                     type="primary">
+              {{ scope.row.originalFileName }}
+            </el-link>
+          </template>
+        </el-table-column>
+      </el-table>
+    </el-form>
+    <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>
+      </div>
+    </template>
+  </el-dialog>
+</template>
+<script lang="ts" setup>
+import {ElButton, ElTable} from "element-plus";
+import {ref} from "@vue/reactivity";
+import { uploadFile } from "@/api/tool/file";
+import {defineProps, getCurrentInstance, reactive, toRefs} from "vue";
+import useUserStore from "@/store/modules/user";
+import {
+  updateRecordStatus,
+  FileList
+} from "@/api/business/production/onceWorkOrder";
+const { proxy } = getCurrentInstance();
+const props = defineProps({
+  getList: {
+    type: Function,
+    default: () => { },
+  },
+});
+const { getList } = toRefs(props);
+
+
+const outerVisible = ref(false);
+const currentRow = ref();
+const fullscreenLoading = ref<boolean>(false);
+const workOrderId = ref();
+const baseUrl = import.meta.env.VITE_APP_BASE_API;
+const filesTable = ref<Ifile[]>();
+const handlerId = ref();
+const tenantId = ref();
+let refile = null;
+const fileEntity = reactive<Ifile>({});
+interface Ifile{
+  fileName?:string;
+  url?:string;
+  originalFileName?:string;
+  fileUrl?:string;
+}
+const data = reactive({
+  selectStatus: [
+    {
+      label: "终止任务",
+      value: 5,
+      color: "#2FCB81",
+    },
+    {
+      label: "完成任务",
+      value: 6,
+      color: "#2FCB81",
+    },
+    {
+      label: "暂停办理",
+      value: 7,
+      color: "#2FCB81",
+    },
+    {
+      label: "办理中",
+      value: 1,
+      color: "#2FCB81",
+    },
+  ],
+});
+
+const { selectStatus } = toRefs(data);
+
+
+const form = reactive({
+    recordStatus:0,
+    file:Blob
+})
+type Tform = typeof form;
+const sumbitForm = reactive<Tform>({
+  file: new Blob,
+  recordStatus: null
+});
+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);
+  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);
+    }
+  }).then((res) => {
+    proxy.$refs['upload'].clearFiles();
+  }).catch((err) => {
+    proxy.$refs['upload'].clearFiles();
+  })
+}
+function openView(id,status,userId){
+  outerVisible.value = true;
+  workOrderId.value = id;
+  sumbitForm.recordStatus = status;
+  sumbitForm.file = null;
+  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
+    })
+    outerVisible.value = false;
+    getList.value();
+  })
+}
+function handleBeforeUpload(file) {
+  //const formData = new FormData();
+  refile = file
+  // formData.append("file", file);
+
+}
+defineExpose({
+  openView,
+});
+</script>
+<style scoped>
+</style>