lex vor 3 Jahren
Ursprung
Commit
371cd57247

+ 3 - 1
src/main.js

@@ -59,6 +59,7 @@ import {
   GoodsActionIcon,
   Steps,
   Step,
+  TreeSelect,
 } from "vant";
 Vue.use(Button)
   .use(Icon)
@@ -113,7 +114,8 @@ Vue.use(Button)
   .use(GoodsActionButton)
   .use(GoodsActionIcon)
   .use(Steps)
-  .use(Step);
+  .use(Step)
+  .use(TreeSelect);
 
 Vue.config.productionTip = false;
 

+ 2 - 2
src/views/message/Approval.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="approval">
     <van-sticky>
-      <!-- <m-header :isFixed="false" :isNative="false" :backUrl="backUrl" /> -->
+      <m-header :isFixed="false" :appHide="true" />
       <div class="user-container m-shadow">
         <van-grid :column-num="3" :border="false">
           <van-grid-item
@@ -26,7 +26,7 @@
   </div>
 </template>
 <script>
-import MHeader from "@/components/MHeader";
+import MHeader from "@/components/header";
 import MEmpty from "@/components/MEmpty";
 import { classify, todoCount } from "./api";
 import ApplyModal from "./modal/applyModal";

+ 2 - 2
src/views/message/ApprovalAction.vue

@@ -1,6 +1,6 @@
 <template>
     <div :class="(userAuthority || ownerApply) && is_end == 0 && share != 1 ? 'approvalAction' : null">
-        <m-header v-if="share != 1" :isNative="false">
+        <m-header v-if="share != 1" :appHide="true">
             <template #right>
                 <van-icon @click="onShare" :name="iconShare" style="transform: translateY(5px);" size="22"></van-icon>
             </template>
@@ -196,7 +196,7 @@
     </div>
 </template>
 <script>
-import MHeader from '@/components/MHeader'
+import MHeader from '@/components/header'
 import { processStructure, handleWorkOrder, sysUserList, urgeWorkOrder, getInfo, unityWorkOrder, asyncPlayLog } from './api'
 import FormModal from './modal/formModal'
 import TransferModal from './modal/transferModal'

+ 397 - 368
src/views/message/ApprovalApply.vue

@@ -1,393 +1,422 @@
 <template>
-    <div :class="[btn_group && btn_group.length > 0 ? 'approvalApply' : null]">
-        <!-- <m-header :name="name" :isNative="false" /> -->
+  <div :class="[btn_group && btn_group.length > 0 ? 'approvalApply' : null]">
+    <m-header :name="name" :appHide="true" />
 
-        <van-form ref="headForm" validate-first @submit="onSubmitHead" @failed="onFailed" validate-trigger="onSubmit" :scroll-to-error="false" :show-error="false">
-            <van-field
-                clearable
-                name='deptName'
-                v-show="deptList.length > 1"
-                class="style"
-                required
-                v-model="deptName"
-                placeholder="请选择申请部门"
-                readonly
-                @click="showSelect = true"
-                :rules="[{ required: true, message: '请选择申请部门' }]"
-            >
-                <template #label>申请部门
-                    <span style="color: red" v-if="!socialId">
-                        (未设置社保部门)
-                    </span>
-                    <template v-else>
-                        <span style="color: red" v-if="socialId != ruleForm.deptId">
-                            (该部门非社保部门)
-                        </span>
-                    </template>
-                </template>
-                <template #right-icon>
-                    <i class="van-icon van-icon-arrow van-cell__right-icon"></i>
-                </template>
-            </van-field>
-            <van-field
-                :label="'优先级'"
-                clearable
-                name='priority'
-                class="style"
-                required
-                :rules="[{ required: true, message: '请选择工单优先级' }]"
-            >
-                <template #input>
-                    <van-radio-group v-model="ruleForm.priority" direction="horizontal">
-                        <van-radio :name="1">一般</van-radio>
-                        <van-radio :name="2">紧急</van-radio>
-                        <van-radio :name="3">非常紧急</van-radio>
-                    </van-radio-group>
-                </template>
-            </van-field>
-            <template v-for="(tplItem, tplIndex) in processStructureValue.tpls">
-                <form-modal
-                    :key="tplIndex"
-                    v-if="currentNode.hideTpls === undefined || currentNode.hideTpls === null || currentNode.hideTpls.indexOf(tplItem.id) === -1"
-                    :ref="'generateForm-'+tplItem.id"
-                    :formData="tplItem.form_structure"
-                    :disabled="currentNode.readonlyTpls===undefined || currentNode.readonlyTpls===null || currentNode.readonlyTpls.indexOf(tplItem.id)===-1?null:true" />
-            </template>
-        </van-form>
-        <!-- 是自己审批 或者 是自己提交的记录 -->
-        <van-goods-action v-if="btn_group && btn_group.length > 0" style="padding: 0 4%;">
-            <van-goods-action-button
-                v-for="(item, index) in btn_group"
-                :key="index"
-                :type="item.className"
-                :disabled="submitDisabled"
-                text="提交"
-                plain
-                @click="onCheckSubmit(item)"
-            />
-        </van-goods-action>
+    <van-form
+      ref="headForm"
+      validate-first
+      @submit="onSubmitHead"
+      @failed="onFailed"
+      validate-trigger="onSubmit"
+      :scroll-to-error="false"
+      :show-error="false"
+    >
+      <van-field
+        clearable
+        name="deptName"
+        v-show="deptList.length > 1"
+        class="style"
+        required
+        v-model="deptName"
+        placeholder="请选择申请部门"
+        readonly
+        @click="showSelect = true"
+        :rules="[{ required: true, message: '请选择申请部门' }]"
+      >
+        <template #label
+          >申请部门
+          <span style="color: red" v-if="!socialId"> (未设置社保部门) </span>
+          <template v-else>
+            <span style="color: red" v-if="socialId != ruleForm.deptId">
+              (该部门非社保部门)
+            </span>
+          </template>
+        </template>
+        <template #right-icon>
+          <i class="van-icon van-icon-arrow van-cell__right-icon"></i>
+        </template>
+      </van-field>
+      <van-field
+        :label="'优先级'"
+        clearable
+        name="priority"
+        class="style"
+        required
+        :rules="[{ required: true, message: '请选择工单优先级' }]"
+      >
+        <template #input>
+          <van-radio-group v-model="ruleForm.priority" direction="horizontal">
+            <van-radio :name="1">一般</van-radio>
+            <van-radio :name="2">紧急</van-radio>
+            <van-radio :name="3">非常紧急</van-radio>
+          </van-radio-group>
+        </template>
+      </van-field>
+      <template v-for="(tplItem, tplIndex) in processStructureValue.tpls">
+        <form-modal
+          :key="tplIndex"
+          v-if="
+            currentNode.hideTpls === undefined ||
+            currentNode.hideTpls === null ||
+            currentNode.hideTpls.indexOf(tplItem.id) === -1
+          "
+          :ref="'generateForm-' + tplItem.id"
+          :formData="tplItem.form_structure"
+          :disabled="
+            currentNode.readonlyTpls === undefined ||
+            currentNode.readonlyTpls === null ||
+            currentNode.readonlyTpls.indexOf(tplItem.id) === -1
+              ? null
+              : true
+          "
+        />
+      </template>
+    </van-form>
+    <!-- 是自己审批 或者 是自己提交的记录 -->
+    <van-goods-action
+      v-if="btn_group && btn_group.length > 0"
+      style="padding: 0 4%"
+    >
+      <van-goods-action-button
+        v-for="(item, index) in btn_group"
+        :key="index"
+        :type="item.className"
+        :disabled="submitDisabled"
+        text="提交"
+        plain
+        @click="onCheckSubmit(item)"
+      />
+    </van-goods-action>
 
-        <van-popup v-model="showSelect" position="bottom">
-            <van-picker
-                show-toolbar
-                :columns="deptList"
-                @confirm="onConfirm"
-                visible-item-count="4"
-                @cancel="showSelect = false"
-            />
-        </van-popup>
-    </div>
+    <van-popup v-model="showSelect" position="bottom">
+      <van-picker
+        show-toolbar
+        :columns="deptList"
+        @confirm="onConfirm"
+        visible-item-count="4"
+        @cancel="showSelect = false"
+      />
+    </van-popup>
+  </div>
 </template>
 <script>
-import MHeader from '@/components/MHeader'
-import { processStructure, createWorkOrder, checkCourseReturnFee } from './api'
-import FormModal from './modal/formModal'
+import MHeader from "@/components/header";
+import { processStructure, createWorkOrder, checkCourseReturnFee } from "./api";
+import FormModal from "./modal/formModal";
 // import { launchInfo, approvalCancel } from '@/api/message'
 export default {
-    name: 'approvalApply',
-    components: { MHeader, FormModal },
-    data() {
-        const query = this.$route.query
-        return {
-            active: 0,
-            processId: query.processId,
-            name: query.name,
-            submitDisabled: false,
-            showSelect: false,
-            deptName: null, // 部门名称
-            socialId: null, // 是否是社保分部
-            ruleForm: {
-                deptId: null, // 部门编号
-                priority: 1,
-                process: '',
-                classify: '',
-                state: [],
-                source: '',
-                source_state: '',
-                process_method: '',
-                tpls: {
-                    'form_structure': [],
-                    'form_data': []
-                },
-                tasks: []
-            },
-            currentNode: {},
-            processStructureValue: {},
-            tempProcessStructureValue: {},
-            selectTarget: null,
-            btn_group: [],
-            deptList: [], // 部门列表
+  name: "approvalApply",
+  components: { MHeader, FormModal },
+  data() {
+    const query = this.$route.query;
+    return {
+      active: 0,
+      processId: query.processId,
+      name: query.name,
+      submitDisabled: false,
+      showSelect: false,
+      deptName: null, // 部门名称
+      socialId: null, // 是否是社保分部
+      ruleForm: {
+        deptId: null, // 部门编号
+        priority: 1,
+        process: "",
+        classify: "",
+        state: [],
+        source: "",
+        source_state: "",
+        process_method: "",
+        tpls: {
+          form_structure: [],
+          form_data: [],
+        },
+        tasks: [],
+      },
+      currentNode: {},
+      processStructureValue: {},
+      tempProcessStructureValue: {},
+      selectTarget: null,
+      btn_group: [],
+      deptList: [], // 部门列表
+    };
+  },
+  async mounted() {
+    document.title = this.name;
+    this.getProcessNodeList();
+  },
+  methods: {
+    async getProcessNodeList() {
+      try {
+        const userId = sessionStorage.getItem("userId");
+        let params = {
+          processId: this.processId,
+        };
+        if (userId) {
+          params.userId = userId;
         }
-    },
-    async mounted() {
-        document.title = this.name
-        this.getProcessNodeList()
-    },
-    methods: {
-        async getProcessNodeList() {
-            try {
-                const userId = sessionStorage.getItem('userId')
-                let params = {
-                    processId: this.processId
-                }
-                if(userId) {
-                    params.userId = userId
-                }
-                const res = await processStructure(params)
-                this.processStructureValue = res.data || {}
-                this.tempProcessStructureValue = JSON.parse(JSON.stringify(res.data || {}))
-                this.processStructureValue.nodes.forEach((node, index) => {
-                    if(node.clazz == 'start') {
-                        this.active = index
-                        this.currentNode = node
-                    }
-                })
-
-                this.deptList = res.data.depts || []
-                const defaultDept = res.data.deptId
-                this.socialId = defaultDept
-                this.deptList.forEach((item, index) => {
-                    if(defaultDept) {
-                        if(item.deptId == defaultDept) {
-                            this.deptName = item.deptName
-                            this.ruleForm.deptId = item.deptId
-                        }
-                    } else {
-                        if(index == 0) {
-                            this.deptName = item.deptName
-                            this.ruleForm.deptId = item.deptId
-                        }
-                    }
-                    item.text = item.deptName
-                })
-                let psv = res.data?.edges || []
-                let btn_group = []
-                psv.forEach(item => {
-                    if(item.source===this.currentNode.id && item.flowProperties == 1) {
-                        if(item.flowProperties == 1) {
-                            item.className = 'info'
-                        } else if(item.flowProperties == 0) {
-                            item.className = 'danger'
-                        } else if(item.flowProperties == 2) {
-                            item.className = 'info'
-                        }
-                        btn_group.push(item)
-                    } else {
-                        item.className = 'info'
-                    }
-                })
-                this.btn_group = btn_group
+        const res = await processStructure(params);
+        this.processStructureValue = res.data || {};
+        this.tempProcessStructureValue = JSON.parse(
+          JSON.stringify(res.data || {})
+        );
+        this.processStructureValue.nodes.forEach((node, index) => {
+          if (node.clazz == "start") {
+            this.active = index;
+            this.currentNode = node;
+          }
+        });
 
-                if(!this.socialId && this.deptList.length <= 0) {
-                    this.$dialog.alert({
-                        message: '您当前暂未设置所属部门,请联系管理员',
-                        confirmButtonColor: '#01C1B5'
-                    })
-                }
-            } catch {
-                //
+        this.deptList = res.data.depts || [];
+        const defaultDept = res.data.deptId;
+        this.socialId = defaultDept;
+        this.deptList.forEach((item, index) => {
+          if (defaultDept) {
+            if (item.deptId == defaultDept) {
+              this.deptName = item.deptName;
+              this.ruleForm.deptId = item.deptId;
             }
-        },
-        onConfirm(value) {
-            this.deptName = value.deptName
-            this.ruleForm.deptId = value.deptId
-            this.showSelect = false
-        },
-        onCheckSubmit(item) {
-            if(!this.socialId && this.deptList.length <= 0 || !this.deptName) {
-                this.$dialog.alert({
-                    message: '您当前暂未设置所属部门,请联系管理员',
-                    confirmButtonColor: '#01C1B5'
-                })
-                return
+          } else {
+            if (index == 0) {
+              this.deptName = item.deptName;
+              this.ruleForm.deptId = item.deptId;
             }
-            this.selectTarget = item.target
-            this.$refs.headForm.submit()
-        },
-        onFailed() {
-            // console.log(errorInfo)
-        },
-        async onSubmitHead(values) {
-            // eslint-disable-next-line no-unused-vars
-            let { priority, deptName, ...res } = values
-            const psv = this.tempProcessStructureValue
-            this.submitDisabled = true
-            let ruleForm = this.ruleForm
-            ruleForm.priority = priority
-            let stateMap = {}
-            ruleForm.process = parseInt(this.processId)
-            ruleForm.classify = psv.process.classify
-            stateMap['id'] = this.selectTarget
-            ruleForm.source_state = psv.nodes[this.active].label
-            for (let v of psv.nodes) {
-                if (v.id === this.selectTarget) {
-                    if (v.assignType !== undefined) {
-                        stateMap['process_method'] = v.assignType
-                    }
-                    if (v.assignValue !== undefined) {
-                        stateMap['processor'] = Array.from(new Set(v.assignValue))
-                    }
-                    stateMap['label'] = v.label
-                    break
-                }
+          }
+          item.text = item.deptName;
+        });
+        let psv = res.data?.edges || [];
+        let btn_group = [];
+        psv.forEach((item) => {
+          if (item.source === this.currentNode.id && item.flowProperties == 1) {
+            if (item.flowProperties == 1) {
+              item.className = "info";
+            } else if (item.flowProperties == 0) {
+              item.className = "danger";
+            } else if (item.flowProperties == 2) {
+              item.className = "info";
             }
-            ruleForm.state = [stateMap]
+            btn_group.push(item);
+          } else {
+            item.className = "info";
+          }
+        });
+        this.btn_group = btn_group;
 
-            ruleForm.tpls = {
-                'form_structure': [],
-                'form_data': []
-            }
-            // 绑定流程任务
-            ruleForm.tasks = psv.process.task === undefined ? [] : psv.process.task
-            // 追加节点任务
-            if (psv.nodes[this.active].task !== undefined && psv.nodes[this.active].task.length > 0) {
-                for (var task of psv.nodes[this.active].task) {
-                    if (ruleForm.tasks.indexOf(task) === -1) {
-                        ruleForm.tasks.push(task)
-                    }
-                }
-            }
-            // 不能一個流程用多个模板
-            for (let tpl of psv.tpls) {
-                tpl.form_structure.id = tpl.id
-                ruleForm.tpls.form_structure.push(tpl.form_structure)
-                if(this.currentNode.hideTpls === undefined || this.currentNode.hideTpls === null || this.currentNode.hideTpls.indexOf(tpl.id) === -1) {
-                    let fd = this.formatData(res)
-                    ruleForm.tpls.form_data.push(fd)
-                } else {
-                    let hideFd = this.getHideTplData(tpl.form_structure)
-                    ruleForm.tpls.form_data.push(hideFd)
-                }
-            }
-            ruleForm.source = psv.nodes[this.active].id
-            try {
-                // console.log(ruleForm)
-                const tplInfo = this.processStructureValue.tpls[0] // 默认只用第一个模板
-                const formData = ruleForm?.tpls?.form_data[0]
-                await checkCourseReturnFee({ tplInfoId: tplInfo.id, formData }) // 做校验
-                await createWorkOrder(ruleForm)
-                this.submitDisabled = false
-                this.$toast('申请成功')
-                setTimeout(() => {
-                    this.$router.push({
-                        path: '/myApproval',
-                        query: {
-                            classify: 2
-                        }
-                    })
-                }, 500)
-            } catch {
-                //
-                this.submitDisabled = false
-            }
-        },
-        formatData(json) {
-            let tempJson = {}
-            let subFormList = {}
-            for(let v in json) {
-                let nameList = v.split('.')
-                // 只要大于1说明是子表单
-                if(nameList.length > 1) {
-                    nameList.push(v)
-                    let delName = nameList.shift()
-                    if(subFormList[delName]) {
-                        subFormList[delName].push(nameList)
-                    } else {
-                        subFormList[delName] = []
-                        subFormList[delName].push(nameList)
-                    }
-                } else {
-                    tempJson[v] = json[v]
-                }
-            }
+        if (!this.socialId && this.deptList.length <= 0) {
+          this.$dialog.alert({
+            message: "您当前暂未设置所属部门,请联系管理员",
+            confirmButtonColor: "#01C1B5",
+          });
+        }
+      } catch {
+        //
+      }
+    },
+    onConfirm(value) {
+      this.deptName = value.deptName;
+      this.ruleForm.deptId = value.deptId;
+      this.showSelect = false;
+    },
+    onCheckSubmit(item) {
+      if ((!this.socialId && this.deptList.length <= 0) || !this.deptName) {
+        this.$dialog.alert({
+          message: "您当前暂未设置所属部门,请联系管理员",
+          confirmButtonColor: "#01C1B5",
+        });
+        return;
+      }
+      this.selectTarget = item.target;
+      this.$refs.headForm.submit();
+    },
+    onFailed() {
+      // console.log(errorInfo)
+    },
+    async onSubmitHead(values) {
+      // eslint-disable-next-line no-unused-vars
+      let { priority, deptName, ...res } = values;
+      const psv = this.tempProcessStructureValue;
+      this.submitDisabled = true;
+      let ruleForm = this.ruleForm;
+      ruleForm.priority = priority;
+      let stateMap = {};
+      ruleForm.process = parseInt(this.processId);
+      ruleForm.classify = psv.process.classify;
+      stateMap["id"] = this.selectTarget;
+      ruleForm.source_state = psv.nodes[this.active].label;
+      for (let v of psv.nodes) {
+        if (v.id === this.selectTarget) {
+          if (v.assignType !== undefined) {
+            stateMap["process_method"] = v.assignType;
+          }
+          if (v.assignValue !== undefined) {
+            stateMap["processor"] = Array.from(new Set(v.assignValue));
+          }
+          stateMap["label"] = v.label;
+          break;
+        }
+      }
+      ruleForm.state = [stateMap];
 
-            for(let sub in subFormList) {
-                let subList = subFormList[sub] || []
-                let subDown = []
-                subList.forEach(item => {
-                    if(subDown[item[1]]) {
-                        subDown[item[1]][item[0]] = json[item[2]]
-                    } else {
-                        subDown[item[1]] = {}
-                        subDown[item[1]][item[0]] = json[item[2]]
-                    }
-                })
-                tempJson[sub] = subDown
-            }
-            return tempJson
-        },
-        getHideTplData(tpl) {
-            // 獲取隱藏模板數據
-            let list = tpl.list
-            let data = {}
-            list.forEach(item => {
-                if(item.type == 'subform') {
-                    if(item.columns.length > 0) {
-                        data[item.model] = []
-                        let arr = []
-                        item.columns?.forEach(col => {
-                            if(col.list?.length > 0) {
-                                arr.push(...col.list)
-                            }
-                        })
-                        let tempSub = {}
-                        arr.forEach(a => {
-                            tempSub[a.model] = a.options.defaultValue
-                        })
-                        data[item.model].push(tempSub)
-                    } else {
-                        data[item.model] = ''
-                    }
-                } else {
-                    data[item.model] = item.options.defaultValue
-                }
-            })
-            return data
+      ruleForm.tpls = {
+        form_structure: [],
+        form_data: [],
+      };
+      // 绑定流程任务
+      ruleForm.tasks = psv.process.task === undefined ? [] : psv.process.task;
+      // 追加节点任务
+      if (
+        psv.nodes[this.active].task !== undefined &&
+        psv.nodes[this.active].task.length > 0
+      ) {
+        for (var task of psv.nodes[this.active].task) {
+          if (ruleForm.tasks.indexOf(task) === -1) {
+            ruleForm.tasks.push(task);
+          }
         }
-    }
-}
+      }
+      // 不能一個流程用多个模板
+      for (let tpl of psv.tpls) {
+        tpl.form_structure.id = tpl.id;
+        ruleForm.tpls.form_structure.push(tpl.form_structure);
+        if (
+          this.currentNode.hideTpls === undefined ||
+          this.currentNode.hideTpls === null ||
+          this.currentNode.hideTpls.indexOf(tpl.id) === -1
+        ) {
+          let fd = this.formatData(res);
+          ruleForm.tpls.form_data.push(fd);
+        } else {
+          let hideFd = this.getHideTplData(tpl.form_structure);
+          ruleForm.tpls.form_data.push(hideFd);
+        }
+      }
+      ruleForm.source = psv.nodes[this.active].id;
+      try {
+        // console.log(ruleForm)
+        const tplInfo = this.processStructureValue.tpls[0]; // 默认只用第一个模板
+        const formData = ruleForm?.tpls?.form_data[0];
+        await checkCourseReturnFee({ tplInfoId: tplInfo.id, formData }); // 做校验
+        await createWorkOrder(ruleForm);
+        this.submitDisabled = false;
+        this.$toast("申请成功");
+        setTimeout(() => {
+          this.$router.push({
+            path: "/myApproval",
+            query: {
+              classify: 2,
+            },
+          });
+        }, 500);
+      } catch {
+        //
+        this.submitDisabled = false;
+      }
+    },
+    formatData(json) {
+      let tempJson = {};
+      let subFormList = {};
+      for (let v in json) {
+        let nameList = v.split(".");
+        // 只要大于1说明是子表单
+        if (nameList.length > 1) {
+          nameList.push(v);
+          let delName = nameList.shift();
+          if (subFormList[delName]) {
+            subFormList[delName].push(nameList);
+          } else {
+            subFormList[delName] = [];
+            subFormList[delName].push(nameList);
+          }
+        } else {
+          tempJson[v] = json[v];
+        }
+      }
+
+      for (let sub in subFormList) {
+        let subList = subFormList[sub] || [];
+        let subDown = [];
+        subList.forEach((item) => {
+          if (subDown[item[1]]) {
+            subDown[item[1]][item[0]] = json[item[2]];
+          } else {
+            subDown[item[1]] = {};
+            subDown[item[1]][item[0]] = json[item[2]];
+          }
+        });
+        tempJson[sub] = subDown;
+      }
+      return tempJson;
+    },
+    getHideTplData(tpl) {
+      // 獲取隱藏模板數據
+      let list = tpl.list;
+      let data = {};
+      list.forEach((item) => {
+        if (item.type == "subform") {
+          if (item.columns.length > 0) {
+            data[item.model] = [];
+            let arr = [];
+            item.columns?.forEach((col) => {
+              if (col.list?.length > 0) {
+                arr.push(...col.list);
+              }
+            });
+            let tempSub = {};
+            arr.forEach((a) => {
+              tempSub[a.model] = a.options.defaultValue;
+            });
+            data[item.model].push(tempSub);
+          } else {
+            data[item.model] = "";
+          }
+        } else {
+          data[item.model] = item.options.defaultValue;
+        }
+      });
+      return data;
+    },
+  },
+};
 </script>
-<style lang='less' scoped>
+<style lang="less" scoped>
 @import url("../../assets/commonLess/variable.less");
 .approvalApply {
-    margin-bottom: 85px;
+  margin-bottom: 85px;
 }
 
 /deep/.van-goods-action {
-    box-shadow: 0 4px 10px 0 #cecece;
-    z-index: 99;
-    justify-content: space-around;
-    height: 70px;
-    .van-goods-action-icon__icon {
-        font-size: 20px;
-        min-width: 55px;
-    }
-    .van-goods-action-button--last {
-        margin-right: .12rem;
-    }
-    .van-button--danger {
-        background: #fff;
-        border: 1px solid #01C1B5;
-        color: #01C1B5;
-    }
+  box-shadow: 0 4px 10px 0 #cecece;
+  z-index: 99;
+  justify-content: space-around;
+  height: 70px;
+  .van-goods-action-icon__icon {
+    font-size: 20px;
+    min-width: 55px;
+  }
+  .van-goods-action-button--last {
+    margin-right: 0.12rem;
+  }
+  .van-button--danger {
+    background: #fff;
+    border: 1px solid #01c1b5;
+    color: #01c1b5;
+  }
 }
 
-
 .style {
-    margin-bottom: .12rem;
-    padding: 12px 16px;
-    line-height: 1.3;
-    display: flex;
-    flex-direction: column;
-    font-size: 16px;
-    /deep/.van-field__label {
-        margin-bottom: 7px;
-        width: auto;
-        color: #111F2C;
-        font-size: 14px;
-    }
-    /deep/.van-field__value {
-        padding: .03rem 0;
-    }
+  margin-bottom: 0.12rem;
+  padding: 12px 16px;
+  line-height: 1.3;
+  display: flex;
+  flex-direction: column;
+  font-size: 16px;
+  /deep/.van-field__label {
+    margin-bottom: 7px;
+    width: auto;
+    color: #111f2c;
+    font-size: 14px;
+  }
+  /deep/.van-field__value {
+    padding: 0.03rem 0;
+  }
 }
-</style>
+</style>

+ 0 - 1
src/views/message/control/organ.vue

@@ -104,7 +104,6 @@ export default {
         this.columns = [];
         // let res = await queryEmployeeOrgan()
         let res = this.selects.allBranch;
-        console.log(res, "res");
         // console.log(res)
         let tempRes = res || [];
         tempRes.forEach((item) => {

+ 259 - 155
src/views/message/myApproval.vue

@@ -1,42 +1,70 @@
 <template>
   <div class="myApproval">
     <van-sticky>
-        <!-- <m-header :backUrl="backUrl" :name="name" :isNative="false" :isFixed="false" /> -->
-        <van-dropdown-menu active-color="#01C1B5" :close-on-click-outside="false">
-            <van-dropdown-item :title="value0" ref="treeSelect">
-              <van-tree-select
-                :items="items"
-                :active-id.sync="activeId"
-                :main-active-index.sync="activeIndex"
-                @click-item="clickItem"
-              />
-            </van-dropdown-item>
-            <van-dropdown-item v-model="value1" @change="onSearch" :options="option1" />
-            <van-dropdown-item v-model="value2" @change="onSearch" :options="option2" />
-            <van-dropdown-item title="创建时间" ref="item">
-                <van-cell title="开始时间" is-link @click="onChangeDate('showStart')" :value="searchList.startTime"></van-cell>
-                <van-cell title="结束时间" is-link @click="onChangeDate('showEnd')" :value="searchList.endTime"></van-cell>
-                <div class="btnWrap">
-                    <div class="cancelBtn" @click="cancelBtn">重置</div>
-                    <div class="okBtn" @click="okBtn">确定</div>
-                </div>
-            </van-dropdown-item>
-        </van-dropdown-menu>
+      <m-header
+        :backUrl="backUrl"
+        :name="name"
+        :isFixed="false"
+        :appHide="true"
+      />
+      <van-dropdown-menu active-color="#01C1B5" :close-on-click-outside="false">
+        <van-dropdown-item :title="value0" ref="treeSelect">
+          <van-tree-select
+            :items="items"
+            :active-id.sync="activeId"
+            :main-active-index.sync="activeIndex"
+            @click-item="clickItem"
+          />
+        </van-dropdown-item>
+        <van-dropdown-item
+          v-model="value1"
+          @change="onSearch"
+          :options="option1"
+        />
+        <van-dropdown-item
+          v-model="value2"
+          @change="onSearch"
+          :options="option2"
+        />
+        <van-dropdown-item title="创建时间" ref="item">
+          <van-cell
+            title="开始时间"
+            is-link
+            @click="onChangeDate('showStart')"
+            :value="searchList.startTime"
+          ></van-cell>
+          <van-cell
+            title="结束时间"
+            is-link
+            @click="onChangeDate('showEnd')"
+            :value="searchList.endTime"
+          ></van-cell>
+          <div class="btnWrap">
+            <div class="cancelBtn" @click="cancelBtn">重置</div>
+            <div class="okBtn" @click="okBtn">确定</div>
+          </div>
+        </van-dropdown-item>
+      </van-dropdown-menu>
 
-        <search @onSearch="onSearchChange"></search>
+      <search @onSearch="onSearchChange"></search>
 
-        <van-popup v-model="dataForm.status" position="bottom" round :style="{ height: '40%' }">
-            <van-datetime-picker
-                v-model="dataForm.currentDate"
-                :min-date="dataForm.minDate"
-                :max-date="dataForm.maxDate"
-                :formatter="formatter"
-                @cancel="dataForm.status = false"
-                type="date"
-                @confirm="chioseDate"
-            />
-        </van-popup>
-        <!-- <van-search placeholder="请输入工单标题" background="#ffffff" @search="onSearch" shape="round" show-action v-model="searchList.title">
+      <van-popup
+        v-model="dataForm.status"
+        position="bottom"
+        round
+        :style="{ height: '40%' }"
+      >
+        <van-datetime-picker
+          v-model="dataForm.currentDate"
+          :min-date="dataForm.minDate"
+          :max-date="dataForm.maxDate"
+          :formatter="formatter"
+          @cancel="dataForm.status = false"
+          type="date"
+          @confirm="chioseDate"
+        />
+      </van-popup>
+      <!-- <van-search placeholder="请输入工单标题" background="#ffffff" @search="onSearch" shape="round" show-action v-model="searchList.title">
             <div slot="action" @click="onSearch">搜索</div>
         </van-search> -->
     </van-sticky>
@@ -48,36 +76,103 @@
         v-if="dataShow"
         key="data"
         :finished="finished"
-        style="margin-top: .1rem;"
+        style="margin-top: 0.1rem"
         :immediate-check="false"
         finished-text="- 没有更多内容 -"
         @load="getList"
       >
-        <van-cell-group class="app-item" v-for="(item, index) in dataList" :key="index" @click="onClick(item)">
-          <van-cell class="appItem-title" :border="false" style="padding-bottom: 0" :title="item.title" :value="dayjs(item.create_time).format('YYYY-MM-DD HH:mm')"></van-cell>
+        <van-cell-group
+          class="app-item"
+          v-for="(item, index) in dataList"
+          :key="index"
+          @click="onClick(item)"
+        >
+          <van-cell
+            class="appItem-title"
+            :border="false"
+            style="padding-bottom: 0"
+            :title="item.title"
+            :value="dayjs(item.create_time).format('YYYY-MM-DD HH:mm')"
+          ></van-cell>
           <van-cell>
             <template #title>
               <!-- <p>标题:{{ item.title }}</p> -->
-              <p>优先级:
-                <van-tag size="small" v-if="item.priority == 2" style="background: #fff9f6;vertical-align: text-bottom;" plain type="warning">紧急</van-tag>
-                <van-tag size="small" v-if="item.priority == 3" style="background: #fff6f7;vertical-align: text-bottom;" plain type="danger">非常紧急</van-tag>
-                <van-tag size="small" v-if="item.priority == 1" style="background: #edfff6;vertical-align: text-bottom;" plain type="success">一般</van-tag>
+              <p>
+                优先级:
+                <van-tag
+                  size="small"
+                  v-if="item.priority == 2"
+                  style="background: #fff9f6; vertical-align: text-bottom"
+                  plain
+                  type="warning"
+                  >紧急</van-tag
+                >
+                <van-tag
+                  size="small"
+                  v-if="item.priority == 3"
+                  style="background: #fff6f7; vertical-align: text-bottom"
+                  plain
+                  type="danger"
+                  >非常紧急</van-tag
+                >
+                <van-tag
+                  size="small"
+                  v-if="item.priority == 1"
+                  style="background: #edfff6; vertical-align: text-bottom"
+                  plain
+                  type="success"
+                  >一般</van-tag
+                >
                 <!-- {{ item.priority | statusFilter }} -->
               </p>
               <div class="info van-hairline--top">
-                <span>由 <span style="color: #01C1B5">{{ item.creator_name }}</span> 提交</span>
-                 <template v-if="item.is_end">
+                <span
+                  >由
+                  <span style="color: #01c1b5">{{ item.creator_name }}</span>
+                  提交</span
+                >
+                <template v-if="item.is_end">
                   <template v-if="item.is_cancel">
-                    <van-tag color="#999999" size="medium" plain>已关闭</van-tag>
+                    <van-tag color="#999999" size="medium" plain
+                      >已关闭</van-tag
+                    >
                   </template>
                   <template v-else>
-                    <van-tag color="#FF4444" style="background: #FFFBFB;" size="medium" v-if="item.is_denied" plain>审批拒绝</van-tag>
-                    <van-tag color="#00C988" style="background: #F1FCF9" size="medium" v-else plain>审批通过</van-tag>
+                    <van-tag
+                      color="#FF4444"
+                      style="background: #fffbfb"
+                      size="medium"
+                      v-if="item.is_denied"
+                      plain
+                      >审批拒绝</van-tag
+                    >
+                    <van-tag
+                      color="#00C988"
+                      style="background: #f1fcf9"
+                      size="medium"
+                      v-else
+                      plain
+                      >审批通过</van-tag
+                    >
                   </template>
                 </template>
                 <template v-else>
-                  <p class="orangeStatus" style="display: flex;" v-if="item.principals">
-                    <span style="width: 100px;white-space: nowrap;overflow: hidden;display: inline-block;text-overflow: ellipsis;text-align:right;">{{ item.principals }}</span>处理中
+                  <p
+                    class="orangeStatus"
+                    style="display: flex"
+                    v-if="item.principals"
+                  >
+                    <span
+                      style="
+                        width: 100px;
+                        white-space: nowrap;
+                        overflow: hidden;
+                        display: inline-block;
+                        text-overflow: ellipsis;
+                        text-align: right;
+                      "
+                      >{{ item.principals }}</span
+                    >处理中
                   </p>
                 </template>
               </div>
@@ -90,46 +185,46 @@
   </div>
 </template>
 <script>
-import MHeader from "@/components/MHeader";
-import Search from '@/components/Search'
+import MHeader from "@/components/header";
+import Search from "@/components/Search";
 import { getWorkOrderList, classify } from "./api";
 import MEmpty from "@/components/MEmpty";
 import dayjs from "dayjs";
-import setLoading from '@/common/loading'
+import setLoading from "@/common/loading";
 export default {
   components: { MHeader, MEmpty, Search },
   data() {
-    let query = this.$route.query
+    let query = this.$route.query;
     return {
       dayjs,
       backUrl: {
         status: true,
-        path: '/approval'
+        path: "/approval",
       },
       classify: query.classify,
       value1: 0,
       value2: -1,
       option1: [
-        { text: '优先级', value: 0 },
-        { text: '一般', value: 1 },
-        { text: '紧急', value: 2 },
-        { text: '非常紧急', value: 3 },
+        { text: "优先级", value: 0 },
+        { text: "一般", value: 1 },
+        { text: "紧急", value: 2 },
+        { text: "非常紧急", value: 3 },
       ],
       option2: [
-          { text: '是否结束', value: -1 },
-          { text: '是', value: 1 },
-          { text: '否', value: 0 }
+        { text: "是否结束", value: -1 },
+        { text: "是", value: 1 },
+        { text: "否", value: 0 },
       ],
       dataForm: {
-          // 时间下拉框
-          status: false,
-          minDate: new Date(2000, 0, 1),
-          maxDate: new Date(2025, 10, 1),
-          currentDate: new Date(),
+        // 时间下拉框
+        status: false,
+        minDate: new Date(2000, 0, 1),
+        maxDate: new Date(2025, 10, 1),
+        currentDate: new Date(),
       },
       items: [],
       activeIndex: 0,
-      value0: '全部',
+      value0: "全部",
       activeId: 0,
       searchList: {
         search: null,
@@ -144,148 +239,157 @@ export default {
       finished: false,
       dataShow: true,
       dataList: [],
-      name:''
+      name: "",
     };
   },
   async mounted() {
     let classifyStr = this.classify;
     if (classifyStr == 1) {
-      this.name =  "需我审批"
+      this.name = "需我审批";
     } else if (classifyStr == 2) {
-         this.name = "我发起的"
+      this.name = "我发起的";
     } else if (classifyStr == 3) {
-         this.name =  "我相关的"
+      this.name = "我相关的";
     }
-    document.title = this.name
+    document.title = this.name;
     try {
-      let res = await classify()
-      let tempList = res.data || []
-      let lastArr = [{ text: '全部', children: [{text: '全部', id: 0}] }]
+      let res = await classify();
+      let tempList = res.data || [];
+      let lastArr = [{ text: "全部", children: [{ text: "全部", id: 0 }] }];
       tempList.forEach((item, index) => {
         lastArr[index + 1] = {
           text: item.name,
-          children: []
-        }
-        if(item.process_list && item.process_list.length > 0) {
-          item.process_list.forEach(child => {
+          children: [],
+        };
+        if (item.process_list && item.process_list.length > 0) {
+          item.process_list.forEach((child) => {
             lastArr[index + 1].children.push({
               text: child.name,
-              id: child.id
-            })
-          })
+              id: child.id,
+            });
+          });
         }
       });
-      this.items = lastArr
-    } catch(e) {
-        //
+      this.items = lastArr;
+    } catch (e) {
+      //
     }
-    setLoading(true)
+    setLoading(true);
     await this.getList();
-    setLoading(false)
+    setLoading(false);
   },
   methods: {
     clickItem(val) {
       this.value0 = val.text;
       this.$refs.treeSelect.toggle();
-      this.onSearch()
+      this.onSearch();
     },
     onSearchChange(val) {
-      this.searchList.search = val
-      this.onSearch()
+      this.searchList.search = val;
+      this.onSearch();
     },
     onSearch() {
-      this.dataList = [] // 重置数据
-      this.dataShow = true
-      this.loading = true
-      this.searchList.page = 1
-      this.finished = false
-      this.getList()
+      this.dataList = []; // 重置数据
+      this.dataShow = true;
+      this.loading = true;
+      this.searchList.page = 1;
+      this.finished = false;
+      this.getList();
     },
     onClick(item) {
       this.$router.push({
-        path: '/ApprovalAction',
+        path: "/ApprovalAction",
         query: {
           // classify: this.classify,
           workOrderId: item.id,
           processId: item.process,
           // title: `${item.creator_name}提交的${item.process_name}`,
           // principals: item.principals + '处理中'
-        }
-      })
+        },
+      });
     },
     async getList() {
       let { ...params } = this.searchList;
-      params.endTime = params.endTime ? dayjs(params.endTime).format('YYYY-MM-DD') + ' 23:59:59' : null
-      params.priority = this.value1 ? this.value1 : null
-      params.isEnd = this.value2 != -1 ? this.value2 : null
-      params.processId = this.activeId ? this.activeId : null // 分类id
-      const userId = sessionStorage.getItem('userId')
-      params.userId = userId
+      params.endTime = params.endTime
+        ? dayjs(params.endTime).format("YYYY-MM-DD") + " 23:59:59"
+        : null;
+      params.priority = this.value1 ? this.value1 : null;
+      params.isEnd = this.value2 != -1 ? this.value2 : null;
+      params.processId = this.activeId ? this.activeId : null; // 分类id
+      const userId = sessionStorage.getItem("userId");
+      params.userId = userId;
 
       try {
-        const res = await getWorkOrderList(params)
-        let result = res.data
-        this.loading = false
+        const res = await getWorkOrderList(params);
+        let result = res.data;
+        this.loading = false;
         // 重点这句,判断是不是重复请求了
         if (this.dataList.length > 0 && result.total_page == 1) {
-            return;
+          return;
         }
-        let data = result.data || []
-        this.dataList.push(...data)
-        if(params.page >= Math.ceil(result.total_count / params.per_page)) {
-            this.finished = true
+        let data = result.data || [];
+        this.dataList.push(...data);
+        if (params.page >= Math.ceil(result.total_count / params.per_page)) {
+          this.finished = true;
         }
-        this.searchList.page++
-        if(this.dataList.length <= 0) {
-            this.dataShow = false
+        this.searchList.page++;
+        if (this.dataList.length <= 0) {
+          this.dataShow = false;
         }
       } catch {
         //
-        this.finished = true
+        this.finished = true;
       }
     },
     cancelBtn() {
-        this.searchList.startTime = null;
-        this.searchList.endTime = null;
-        this.onSearch()
-        this.$refs.item.toggle();
+      this.searchList.startTime = null;
+      this.searchList.endTime = null;
+      this.onSearch();
+      this.$refs.item.toggle();
     },
     okBtn() {
-        if(this.searchList.startTime || this.searchList.endTime) {
-            this.onSearch()
-        }
-        this.$refs.item.toggle();
+      if (this.searchList.startTime || this.searchList.endTime) {
+        this.onSearch();
+      }
+      this.$refs.item.toggle();
     },
     onChangeDate(type) {
-        let dataForm = this.dataForm
-        let searchList = this.searchList
-        if(type == 'showEnd') {
-            if(searchList.startTime) {
-            dataForm.minDate = new Date(dayjs(searchList.startTime))
-            }
-            setTimeout(() => {
-                dataForm.currentDate = searchList.endTime ? new Date(dayjs(searchList.endTime)) : new Date()
-            }, 500)
-        } else if(type == 'showStart') {
-            dataForm.minDate = new Date(2000, 0, 1)
-            setTimeout(() => {
-                dataForm.currentDate = searchList.startTime ? new Date(dayjs(searchList.startTime)) : new Date()
-            }, 500)
+      let dataForm = this.dataForm;
+      let searchList = this.searchList;
+      if (type == "showEnd") {
+        if (searchList.startTime) {
+          dataForm.minDate = new Date(dayjs(searchList.startTime));
         }
-        dataForm.status = true
-        dataForm.type = type
+        setTimeout(() => {
+          dataForm.currentDate = searchList.endTime
+            ? new Date(dayjs(searchList.endTime))
+            : new Date();
+        }, 500);
+      } else if (type == "showStart") {
+        dataForm.minDate = new Date(2000, 0, 1);
+        setTimeout(() => {
+          dataForm.currentDate = searchList.startTime
+            ? new Date(dayjs(searchList.startTime))
+            : new Date();
+        }, 500);
+      }
+      dataForm.status = true;
+      dataForm.type = type;
     },
     chioseDate(value) {
-        let dataForm = this.dataForm
-        if(dataForm.type == 'showStart') {
-            this.searchList.startTime = dayjs(value).format('YYYY-MM-DD')
-            if(this.searchList.endTime && dayjs(value).unix() > dayjs(this.searchList.endTime).unix()) {
-            this.searchList.endTime = null
-            }
-        } else if(dataForm.type == 'showEnd') {
-            this.searchList.endTime = dayjs(value).format('YYYY-MM-DD')
+      let dataForm = this.dataForm;
+      if (dataForm.type == "showStart") {
+        this.searchList.startTime = dayjs(value).format("YYYY-MM-DD");
+        if (
+          this.searchList.endTime &&
+          dayjs(value).unix() > dayjs(this.searchList.endTime).unix()
+        ) {
+          this.searchList.endTime = null;
         }
-        dataForm.status = false
+      } else if (dataForm.type == "showEnd") {
+        this.searchList.endTime = dayjs(value).format("YYYY-MM-DD");
+      }
+      dataForm.status = false;
     },
     formatter(type, val) {
       if (type === "year") {
@@ -296,7 +400,7 @@ export default {
         return `${val}日`;
       }
       return val;
-    }
+    },
   },
   filters: {
     statusFilter(item) {
@@ -336,7 +440,7 @@ export default {
   }
 }
 /deep/.van-dropdown-menu__title {
-  font-size: .15rem;
+  font-size: 0.15rem;
 }
 /deep/.van-tree-select__item--active {
   color: #01c1b5;
@@ -354,7 +458,7 @@ export default {
     /deep/.van-cell__title {
       flex-basis: 65%;
       color: #333;
-      font-size: .16rem;
+      font-size: 0.16rem;
     }
     /deep/.van-cell__value {
       flex-basis: 35%;
@@ -365,9 +469,9 @@ export default {
     align-items: center;
     justify-content: space-between;
     color: #333;
-    font-size: .14rem;
-    padding-top: .1rem;
-    margin-top: .1rem;
+    font-size: 0.14rem;
+    padding-top: 0.1rem;
+    margin-top: 0.1rem;
   }
   /deep/.van-cell {
     color: #666666;