Browse Source

更新弹窗提示

lex 2 năm trước cách đây
mục cha
commit
6ff5341b12

+ 123 - 344
src/views/process/list/handle.vue

@@ -1,92 +1,7 @@
 <template>
   <div class="app-container">
-    <div v-if="isLoadingStatus" />
+    <div v-if="isLoadingStatus"></div>
     <div v-else>
-      <!-- <el-card class="box-card">
-        <div class="text item">
-          <el-steps
-            v-if="
-              currentNode.clazz !== undefined &&
-                currentNode.clazz !== null &&
-                currentNode.clazz !== ''
-            "
-            :active="activeIndex"
-            finish-status="success"
-          >
-            <template v-for="(item, index) in circulationList">
-              <el-step
-                v-if="
-                  item.isHideNode === false ||
-                    item.isHideNode === undefined ||
-                    item.isHideNode == null ||
-                    item.id === processStructureValue.workOrder.current_state
-                "
-                :key="index"
-                :title="item.state || item.label"
-              >
-                <template #description>
-                  <template v-if="!item.create_time">
-                    <p
-                      class="apply-status"
-                      v-if="item.assignUsers && item.assignUsers.length > 0"
-                    >
-                      <template
-                        v-if="
-                          item.assignUsers[0].userId == userInfo.userId &&
-                            activeIndex == index
-                        "
-                      >
-                        我(审批中)
-                      </template>
-                      <template v-else>
-                        <template v-if="item.isCounterSign">
-                          <span
-                            v-for="(au, aIndex) in item.assignUsers"
-                            :key="aIndex"
-                          >
-                            {{ au.username
-                            }}{{
-                              aIndex < item.assignUsers.length - 1 ? "," : null
-                            }}
-                          </span>
-                        </template>
-                        <template v-else>
-                          {{ item.assignUsers[0].username }}
-                        </template>
-                        {{ activeIndex == index ? `(审批中)` : null }}
-                      </template>
-                    </p>
-                  </template>
-                  <template v-else>
-                    <p class="apply-status" v-if="item.processor">
-                      {{ item.processor
-                      }}{{
-                        item.circulation ? `(${item.circulation})` : null
-                      }}
-                    </p>
-                  </template>
-                  <template
-                    v-if="
-                      item.cc_user &&
-                        item.cc_user.length > 0 &&
-                        activeIndex > index
-                    "
-                  >
-                  </template>
-                </template>
-              </el-step>
-            </template>
-          </el-steps>
-          <div v-else>
-            <el-alert
-              show-icon
-              title="未找到当前工单流程信息,请确认当前工单绑定的流程是否存在。"
-              type="warning"
-            />
-          </div>
-        </div>
-      </el-card> -->
-
       <el-alert
         v-if="
           activeIndex !== nodeStepList.length &&
@@ -138,13 +53,6 @@
       <el-card class="box-card" style="margin-top: 15px">
         <div slot="header" class="clearfix">
           <span>表单信息</span>
-          <!-- {{ (currentNode.hideTpls!==undefined &&
-                currentNode.hideTpls!==null &&
-                currentNode.hideTpls.indexOf(tplItem.form_structure.id)!==-1) ||
-                (currentNode.writeTpls===undefined ||
-                currentNode.writeTpls===null ||
-                currentNode.writeTpls.indexOf(tplItem.form_structure.id)===-1)||
-                (isActiveProcessing && currentNode.activeOrder)? true: false}} -->
         </div>
         <div class="text item">
           <template v-for="(tplItem, tplIndex) in processStructureValue.tpls">
@@ -164,169 +72,50 @@
             />
           </template>
         </div>
-        <div
-          v-if="
-            (processStructureValue.userAuthority || ownerApply) && is_end == 0
-          "
-        >
-          <hr
-            style="
+        <hr
+          v-if="is_end == 0"
+          style="
               background-color: #d9d9d9;
               border: 0;
               height: 1px;
               margin-bottom: 15px;
             "
-          />
-          <el-form
-            ref="dataFrom"
-            label-position="left"
-            :model="dataList"
-            label-width="150"
+        />
+        <div class="text item" style="margin-top: 18px; text-align: center;">
+          <!-- 只要没有结束就可以评论 -->
+          <el-button round type="info" @click="handleCommit" v-if="is_end == 0"
+            >评论</el-button
           >
-            <el-form-item
-              label="备注信息"
-              prop="remarks"
-              :rules="[
-                { required: true, message: '请输入备注信息', trigger: 'blur' }
-              ]"
-            >
-              <el-input
-                v-model="dataList.remarks"
-                type="textarea"
-                placeholder="请输入备注信息"
-                maxlength="200"
-                :autosize="{ minRows: 3, maxRows: 99 }"
-                show-word-limit
-              />
-            </el-form-item>
 
-            <el-form-item>
-              <Upload :fileUrl="fileUrl" ref="upload" />
-            </el-form-item>
-            <div class="text item" style="margin-top: 18px">
-              <el-button round type="info" @click="handleCommit(endNodeDetail)"
-                >评论</el-button
-              >
-              <el-button
-                type="warning"
-                v-if="is_end == 0 && processStructureValue.userAuthority"
-                round
-                @click="handleInversion(endNodeDetail)"
-                >转交</el-button
-              >
-              <template v-if="processStructureValue.userAuthority">
-                <el-button
-                  v-for="(item, index) in btn_group"
-                  :key="index"
-                  :type="item.className"
-                  @click="submitAction(item)"
-                  round
-                  >{{ item.labelShow }}</el-button
-                >
-
-                <!-- 拒绝按钮内置 -->
-                <el-button
-                  v-if="endNodeDetail.id"
-                  type="danger"
-                  round
-                  @click="submitAction(endNodeDetail)"
-                  >{{ endNodeDetail.label }}</el-button
-                >
-              </template>
+          <template v-if="is_end == 0 && processStructureValue.userAuthority">
+            <!-- 没有结束,自己审批 -->
+            <el-button
+              type="warning"
+              round
+              @click="handleInversion(endNodeDetail)"
+              >转交</el-button
+            >
+            <el-button
+              v-for="(item, index) in btn_group"
+              :key="index"
+              :type="item.className"
+              @click="submitAction(item)"
+              round
+              >{{ item.labelShow }}</el-button
+            >
 
-              <!-- <div
-              v-if="isActiveProcessing && currentNode.activeOrder"
+            <!-- 拒绝按钮内置 -->
+            <el-button
+              v-if="endNodeDetail.id"
+              type="danger"
+              round
+              @click="submitAction(endNodeDetail)"
+              >{{ endNodeDetail.label }}</el-button
             >
-              <el-button
-                v-permisaction="['process:list:handle:active']"
-                type="primary"
-                @click="activeOrderActive"
-              >
-                主动接单
-              </el-button>
-            </div>
-            <div v-else> -->
-              <!-- <template v-for="(item, index) in processStructureValue.edges">
-                <el-button
-                  v-if="processStructureValue.workOrder.is_end===0 && item.source===currentNode.id"
-                  :key="index"
-                  type="primary"
-                  @click="submitAction(item)"
-                >
-                  {{ item.label }}
-                </el-button>
-              </template> -->
-              <!-- </div> -->
-            </div>
-          </el-form>
+          </template>
         </div>
       </el-card>
 
-      <!-- <el-card class="box-card" style="margin-top: 15px">
-        <div slot="header" class="clearfix">
-          <span>工单流转历史</span>
-        </div>
-        <div class="text item">
-          <el-table :data="circulationHistoryList" border style="width: 100%">
-            <el-table-column prop="state" label="节点" />
-            <el-table-column prop="circulation" label="流转" />
-            <el-table-column prop="processor" label="处理人" />
-            <el-table-column prop="create_time" label="处理时间" />
-            <el-table-column prop="remarks" label="备注" />
-            <el-table-column label="图片">
-              <template slot-scope="scope">
-                <div
-                  v-if="
-                    scope.row.fileUrl.image &&
-                      scope.row.fileUrl.image.length > 0
-                  "
-                >
-                  <el-image
-                    style="width: 40px; height: 40px"
-                    :src="scope.row.fileUrl.image[0]"
-                    :preview-src-list="scope.row.fileUrl.image"
-                  >
-                  </el-image>
-                </div>
-              </template>
-            </el-table-column>
-            <el-table-column label="附件" width="300">
-              <template slot-scope="scope">
-                <div
-                  v-if="
-                    scope.row.fileUrl.file && scope.row.fileUrl.file.length > 0
-                  "
-                >
-                  <div
-                    v-for="(uploadUrlItem, uploadUrlIndex) of scope.row.fileUrl
-                      .file"
-                    :key="uploadUrlIndex"
-                    style="margin-bottom: 3px"
-                  >
-                    <i style="color: #909399;" class="el-icon-document" />
-                    <span>{{ uploadUrlItem.name || uploadUrlItem.url }}</span>
-                    <el-button
-                      round
-                      size="mini"
-                      @click="onDownload(uploadUrlItem, 'download')"
-                      >下载</el-button
-                    >
-                    <el-button
-                      round
-                      type="primary"
-                      @click="onDownload(uploadUrlItem)"
-                      v-if="checkFileSuffix(uploadUrlItem.url)"
-                      size="mini"
-                      >预览</el-button
-                    >
-                  </div>
-                </div>
-              </template>
-            </el-table-column>
-          </el-table>
-        </div>
-      </el-card> -->
-
       <el-card class="box-card" style="margin-top: 15px">
         <div slot="header" class="clearfix">
           <span>流程</span>
@@ -346,7 +135,6 @@
               :class="activeIndex >= index ? 'large-icon' : ''"
               size="large"
             >
-              <!-- :color="formatIcon(item, index, 'color')" -->
               <div class="step-title">
                 {{ item.state || item.label }}
                 <span class="apply-time">
@@ -494,6 +282,15 @@
         @close="dialogVisible = false"
       />
     </el-dialog>
+    <el-dialog :title="submitTitle" :visible.sync="dialogSubmit" width="40%">
+      <TransferSubmit
+        v-if="dialogSubmit"
+        :type="submitType"
+        :submitItem="submitItem"
+        @getList="getProcessNodeList"
+        @close="dialogSubmit = false"
+      />
+    </el-dialog>
   </div>
 </template>
 
@@ -519,17 +316,23 @@ import { getInfo } from "@/api/user";
 
 import { listUser } from "@/api/system/sysuser";
 import TransferInversion from "./model/transferInversion";
+import TransferSubmit from "./model/transferSubmit.vue";
 import load from "@/utils/loading";
 
 import { mapGetters } from "vuex";
 export default {
   components: {
     TransferInversion,
+    TransferSubmit,
     Upload
   },
   data() {
     const query = this.$route.query;
     return {
+      submitTitle: "提交信息",
+      dialogSubmit: false,
+      submitType: "commit",
+      submitItem: {},
       workOrderId: query.workOrderId,
       processId: query.processId,
       isLoadingStatus: true,
@@ -609,6 +412,11 @@ export default {
     } catch {
       //
     }
+    console.log({
+      is_end: this.is_end,
+      ownerApply: this.ownerApply,
+      userAuthority: this.processStructureValue.userAuthority
+    });
   },
   methods: {
     dayjs,
@@ -668,31 +476,13 @@ export default {
       }
     },
     async handleCommit() {
-      try {
-        // orderComment
-        // console.log(JSON.stringify(this.fileUrl || []))
-        this.$refs["dataFrom"].validate(async _ => {
-          if (_) {
-            const res = await orderComment({
-              workOrderId: parseInt(this.workOrderId),
-              remarks: this.dataList.remarks,
-              fileUrl: JSON.stringify(this.fileUrl || [])
-            });
-            // console.log(res, "res");
-            if (res.code == 200) {
-              this.$message.success("评论成功");
-              this.dataList.remarks = "";
-              this.fileUrl = [];
-              // 充值数据
-              this.getProcessNodeList();
-            } else {
-              this.$message.error(res.message);
-            }
-          }
-        });
-      } catch {
-        //
-      }
+      console.log("handleCommit", true);
+      this.submitTitle = "添加评论";
+      this.submitType = "commit";
+      this.submitItem = {
+        workOrderId: parseInt(this.workOrderId)
+      };
+      this.dialogSubmit = true;
     },
     async handleInversion() {
       let workOrder = this.processStructureValue.workOrder;
@@ -789,6 +579,7 @@ export default {
         });
         this.isActiveProcessing = false;
         this.processStructureValue = response.data;
+        this.is_end = this.processStructureValue.workOrder.is_end;
         this.circulationHistoryList = this.processStructureValue.circulationHistory;
         this.circulationList = JSON.parse(
           JSON.stringify(this.circulationHistoryList)
@@ -826,7 +617,7 @@ export default {
           });
           item.fileUrl = tempFile;
         });
-        console.log(this.circulationHistoryList, "circulationHistoryList");
+        // console.log(this.circulationHistoryList, "circulationHistoryList");
 
         // 获取当前展示节点列表
         // this.nodeStepList = this.processStructureValue.circulationHistory
@@ -836,11 +627,11 @@ export default {
         let nodes = this.processStructureValue.nodes;
         this.principals = "处理中";
         for (var i = 0; i < nodes.length; i++) {
-          console.log(
-            nodes[i].id,
-            this.processStructureValue.workOrder.current_state,
-            "xji"
-          );
+          // console.log(
+          //   nodes[i].id,
+          //   this.processStructureValue.workOrder.current_state,
+          //   "xji"
+          // );
           if (
             nodes[i].id === this.processStructureValue.workOrder.current_state
           ) {
@@ -872,7 +663,7 @@ export default {
         }
         this.circulationList.reverse();
         // 如果审批流程没有结束则,流程和历史记录合并显示;结束了,就只显示历史记录
-        if (!this.is_end) {
+        if (!this.processStructureValue.workOrder.is_end) {
           this.circulationList.forEach(cir => {
             this.nodeStepList.forEach(node => {
               if (cir.source == node.id) {
@@ -989,8 +780,8 @@ export default {
         });
         this.btn_group = btn_group;
         this.isLoadingStatus = false;
-        console.log(this.circulationList, "circulationList");
-        console.log(this.currentNode, "currentNode  ");
+        // console.log(this.circulationList, "circulationList");
+        // console.log(this.currentNode, "currentNode  ");
         this.getAlertMessage();
       });
     },
@@ -1120,75 +911,63 @@ export default {
         tpls: this.tpls
       });
 
-      this.$refs["dataFrom"].validate(_ => {
-        if (_) {
-          const flow =
-            item.flowProperties === undefined
-              ? 2
-              : parseInt(item.flowProperties);
-          let str = "同意";
-          if (flow == 1) {
-            str = "同意";
-          } else if (flow == 0) {
-            str = "拒绝";
-          } else {
-            str = "操作";
-          }
-          const tips = `您是否${str}此审批?`;
-          this.$confirm(tips, "提示", {
-            confirmButtonText: "确定",
-            cancelButtonText: "取消",
-            type: "warning"
-          }).then(() => {
-            Promise.all(promiseList).then(values => {
-              for (var tplDataIndex in this.tpls) {
-                this.tpls[tplDataIndex].tplValue = values[tplDataIndex];
-              }
+      const flow =
+        item.flowProperties === undefined ? 2 : parseInt(item.flowProperties);
+      let str = "同意";
+      if (flow == 1) {
+        str = "同意";
+        this.submitTitle = "确认同意";
+        this.submitType = "argee";
+      } else if (flow == 0) {
+        str = "拒绝";
+        this.submitTitle = "确认拒绝";
+        this.submitType = "reject";
+      } else {
+        str = "操作";
+        this.submitTitle = "操作";
+        this.submitType = "operation";
+      }
+      const tips = `您是否${str}此审批?`;
+      // this.$confirm(tips, "提示", {
+      //   confirmButtonText: "确定",
+      //   cancelButtonText: "取消",
+      //   type: "warning"
+      // }).then(() => {
+      Promise.all(promiseList).then(values => {
+        for (var tplDataIndex in this.tpls) {
+          this.tpls[tplDataIndex].tplValue = values[tplDataIndex];
+        }
 
-              let fileList = [];
-              this.tpls &&
-                this.tpls.forEach(tpl => {
-                  for (let val in tpl.tplValue) {
-                    if (val.indexOf("file") != -1) {
-                      const file = tpl.tplValue[val] || [];
-                      file.forEach(item => {
-                        fileList.push(item.url);
-                      });
-                    }
-                  }
+        let fileList = [];
+        this.tpls &&
+          this.tpls.forEach(tpl => {
+            for (let val in tpl.tplValue) {
+              if (val.indexOf("file") != -1) {
+                const file = tpl.tplValue[val] || [];
+                file.forEach(item => {
+                  fileList.push(item.url);
                 });
-              handleWorkOrder({
-                tasks: this.processStructureValue.process.task,
-                source_state: this.processStructureValue.workOrder
-                  .current_state,
-                target_state: item.target,
-                circulation: item.label,
-                flow_properties:
-                  item.flowProperties === undefined
-                    ? 2
-                    : parseInt(item.flowProperties),
-                work_order_id: parseInt(this.$route.query.workOrderId),
-                remarks: this.dataList.remarks,
-                fileUrl: JSON.stringify(this.fileUrl || []),
-                tpls: this.tpls
-              }).then(async response => {
-                if (response.code === 200) {
-                  // this.$router.push({ name: 'upcoming' })
-
-                  await asyncPlayLog({
-                    workOrderId: parseInt(this.$route.query.workOrderId),
-                    fileUrl: fileList.join(",")
-                  });
-                  // window.location.reload()
-                  this.getProcessNodeList();
-
-                  await store.dispatch("user/getInitData");
-                }
-              });
-            });
+              }
+            }
           });
-        }
+        this.submitItem = {
+          tasks: this.processStructureValue.process.task,
+          source_state: this.processStructureValue.workOrder.current_state,
+          target_state: item.target,
+          circulation: item.label,
+          flow_properties:
+            item.flowProperties === undefined
+              ? 2
+              : parseInt(item.flowProperties),
+          work_order_id: parseInt(this.$route.query.workOrderId),
+          remarks: this.dataList.remarks,
+          tpls: this.tpls,
+          fileList,
+          tips
+        };
+        this.dialogSubmit = true;
       });
+      // });
     },
     // 获取提示消息
     getAlertMessage() {

+ 126 - 0
src/views/process/list/model/transferSubmit.vue

@@ -0,0 +1,126 @@
+<template>
+  <el-form
+    ref="ruleForm"
+    :model="ruleForm"
+    label-width="80px"
+    class="demo-ruleForm"
+  >
+    <el-form-item
+      label="备注信息"
+      prop="remarks"
+      :rules="[{ required: true, message: '请输入备注信息', trigger: 'blur' }]"
+    >
+      <el-input
+        v-model="ruleForm.remarks"
+        type="textarea"
+        size="small"
+        rows="3"
+      />
+    </el-form-item>
+    <el-form-item>
+      <Upload :fileUrl="fileUrl" />
+    </el-form-item>
+    <el-form-item style="text-align: right">
+      <el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>
+      <el-button @click="$listeners.close()">关闭</el-button>
+    </el-form-item>
+  </el-form>
+</template>
+
+<script>
+import {
+  processStructure,
+  handleWorkOrder,
+  activeOrder,
+  asyncPlayLog,
+  queryUserInfo,
+  queryAllOrgan,
+  orderComment
+} from "@/api/process/work-order";
+import store from "@/store";
+import load from "@/utils/loading";
+import Upload from "./upload";
+export default {
+  name: "transferInversion",
+  props: {
+    submitItem: {
+      type: Object,
+      default: {}
+    },
+    type: {
+      type: String,
+      default: "commit"
+    }
+  },
+  components: { Upload },
+  data() {
+    return {
+      ruleForm: {
+        remarks: ""
+      },
+      fileUrl: []
+    };
+  },
+  mounted() {},
+  methods: {
+    submitForm() {
+      this.$refs["ruleForm"].validate(async _ => {
+        console.log(_);
+        if (_) {
+          // 评论
+          if (this.type === "commit") {
+            await this.submitCommit();
+          } else {
+            await this.submitOperation();
+          }
+        }
+      });
+    },
+    async submitCommit() {
+      load.startLoading();
+      const res = await orderComment({
+        workOrderId: this.submitItem.workOrderId,
+        remarks: this.ruleForm.remarks,
+        fileUrl: JSON.stringify(this.fileUrl || [])
+      });
+      load.endLoading();
+      if (res.code == 200) {
+        this.$message.success("评论成功");
+        this.ruleForm.remarks = "";
+        this.fileUrl = [];
+        // 充值数据
+        this.$listeners.close();
+        this.$listeners.getList();
+      } else {
+        this.$message.error(res.message);
+      }
+    },
+    async submitOperation() {
+      const { fileList, work_order_id, tips, ...res } = this.submitItem;
+      this.$confirm(tips, "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(async () => {
+        load.startLoading();
+        handleWorkOrder({
+          work_order_id,
+          fileUrl: JSON.stringify(this.fileUrl || []),
+          ...res
+        }).then(async response => {
+          load.endLoading();
+          if (response.code === 200) {
+            await asyncPlayLog({
+              workOrderId: parseInt(work_order_id),
+              fileUrl: fileList.join(",")
+            });
+            this.$listeners.close();
+            this.$listeners.getList();
+            await store.dispatch("user/getInitData");
+          }
+        });
+      });
+    }
+  }
+};
+</script>

+ 10 - 3
src/views/process/list/model/upload.vue

@@ -28,6 +28,7 @@
         :action="ossUploadUrl"
         :on-success="handleSuccess"
         :on-exceed="handleExceed"
+        :on-error="handleError"
         :before-upload="beforeUpload"
         :show-file-list="false"
         accept="image/*"
@@ -48,6 +49,7 @@
         style="margin-left: 8px"
         :on-success="handleSuccess"
         :on-exceed="handleExceedFile"
+        :on-error="handleError"
         :before-upload="beforeUploadFile"
         :show-file-list="false"
         :limit="3"
@@ -90,7 +92,7 @@ export default {
   },
   watch: {
     fileUrl(val) {
-      console.log(val);
+      // console.log(val);
       this.tempFileUrl = val;
     }
   },
@@ -134,7 +136,7 @@ export default {
           acl: "public-read",
           name: filename
         };
-        console.log(res, "policy", this.dataObj);
+        // console.log(res, "policy", this.dataObj);
 
         return isLt2M;
       } catch {
@@ -153,7 +155,7 @@ export default {
         // let filename = file.name.replaceAll(" ", "_");
         let fileFix = file.name.split(".");
         let filename = new Date().getTime();
-        console.log(fileFix);
+        // console.log(fileFix);
         let key = new Date().getTime() + "." + fileFix[1];
         let obj = {
           filename,
@@ -187,6 +189,11 @@ export default {
     handleExceedFile(files, fileList) {
       this.$message.warning(`最多允许上传 3 个文件。`);
     },
+    handleError(err) {
+      // 文件上传时
+      this.uploadFileLoading = false;
+      this.uploadLoading = false;
+    },
     handleSuccess(response, file, fileList) {
       // console.log(response, file, fileList);
       this.uploadLoading = false;