|
@@ -1,55 +1,92 @@
|
|
|
<template>
|
|
|
- <el-row :gutter="10" :loading="loading">
|
|
|
- <el-col :span="24">
|
|
|
- <el-form
|
|
|
- ref="ruleForm"
|
|
|
- :model="ruleForm"
|
|
|
- status-icon
|
|
|
- :rules="rulesThis"
|
|
|
- label-width="100px"
|
|
|
- class="demo-ruleForm"
|
|
|
- >
|
|
|
+ <el-form
|
|
|
+ ref="ruleForm"
|
|
|
+ :loading="loading"
|
|
|
+ :model="ruleForm"
|
|
|
+ status-icon
|
|
|
+ :rules="rulesThis"
|
|
|
+ label-width="100px"
|
|
|
+ style="width: 100%"
|
|
|
+ class="demo-ruleForm"
|
|
|
+ >
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
<el-form-item label="离职人" prop="resign_uid">
|
|
|
- <!-- :disabled="parmValue1.type == 1" -->
|
|
|
<search-account
|
|
|
- :disabled="isDetail"
|
|
|
- :is-detail="isDetail"
|
|
|
+ :disabled="
|
|
|
+ !(
|
|
|
+ id === 'add' ||
|
|
|
+ (status === '0' && powers.some((item) => item == '005'))
|
|
|
+ )
|
|
|
+ "
|
|
|
+ :is-detail="id !== 'add'"
|
|
|
:value="ruleForm.resign_uid"
|
|
|
:size="searchSize"
|
|
|
- :names="ruleForm.resign_name"
|
|
|
+ :names="resign_name"
|
|
|
:placeholder="'离职人名称'"
|
|
|
@searchChange="handleResignName"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
<el-form-item label="接受人" prop="hand_uid">
|
|
|
- <!--
|
|
|
- -->
|
|
|
<search-account
|
|
|
- :disabled="isDetail"
|
|
|
- :is-detail="isDetail"
|
|
|
+ :disabled="
|
|
|
+ !(
|
|
|
+ id === 'add' ||
|
|
|
+ (status === '0' && powers.some((item) => item == '005'))
|
|
|
+ )
|
|
|
+ "
|
|
|
+ :is-detail="id !== 'add'"
|
|
|
:value="ruleForm.hand_uid"
|
|
|
:size="searchSize"
|
|
|
- :names="ruleForm.hand_name"
|
|
|
+ :names="hand_name"
|
|
|
:placeholder="'接受人名称'"
|
|
|
@searchChange="handleHandoverName"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- isDetail:{{ isDetail }} ---------id:{{ id }}-------status{{ status }}
|
|
|
- </el-form>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24" style="text-align: right">
|
|
|
- <el-button type="primary" @click="submitForm" v-if="id === 'add'">{{
|
|
|
- id === "add" ? "保 存" : "关 闭"
|
|
|
- }}</el-button>
|
|
|
- <!-- <el-button type="primary" @click="submitForm('flow')" v-if="isBtn"
|
|
|
- >保 存 并 发 起 流 程
|
|
|
- </el-button> -->
|
|
|
- <!-- <el-button @click="closeAddEdit" v-if="isBtn"
|
|
|
- >取 消 审 核 流 程</el-button
|
|
|
- > -->
|
|
|
- <el-button @click="closeAdd"> 关 闭</el-button>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" style="text-align: right">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="submitForm"
|
|
|
+ v-if="
|
|
|
+ id === 'add' ||
|
|
|
+ (status === '0' && powers.some((item) => item == '005'))
|
|
|
+ "
|
|
|
+ >保 存</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="statusConfirm('1', '发起审核流程')"
|
|
|
+ v-if="status === '0' && powers.some((item) => item == '012')"
|
|
|
+ >发起审核流程
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ @click="statusConfirm('0', '取消审核流程')"
|
|
|
+ plain
|
|
|
+ v-if="status === '1' && powers.some((item) => item == '014')"
|
|
|
+ >取消审核流程</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ @click="statusConfirm('-1', '作废该条信息')"
|
|
|
+ type="danger"
|
|
|
+ plain
|
|
|
+ v-if="
|
|
|
+ (status === '0' || status === '1') &&
|
|
|
+ powers.some((item) => item == '015')
|
|
|
+ "
|
|
|
+ >作废该条信息</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ @click="statusConfirm('2', '通过审核')"
|
|
|
+ type="primary"
|
|
|
+ v-if="status === '1' && powers.some((item) => item == '016')"
|
|
|
+ >通过审核</el-button
|
|
|
+ >
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
</template>
|
|
|
<script>
|
|
|
import asyncRequest from "@/apis/service/interest/handover";
|
|
@@ -60,9 +97,8 @@ export default {
|
|
|
mixins: [resToken],
|
|
|
data() {
|
|
|
return {
|
|
|
- detailId: "", //详情接口使用
|
|
|
- isBtn: false,
|
|
|
loading: false,
|
|
|
+ disabled: true,
|
|
|
status: "", //存储详情接口返的状态
|
|
|
showModelThis: this.showModel,
|
|
|
resign_name: "", //离职人
|
|
@@ -93,10 +129,23 @@ export default {
|
|
|
},
|
|
|
};
|
|
|
},
|
|
|
- mounted() {
|
|
|
- console.log(this.id);
|
|
|
- this.initForm();
|
|
|
+ computed: {
|
|
|
+ powers() {
|
|
|
+ let tran =
|
|
|
+ this.$store.getters.btnList.find(
|
|
|
+ (item) => item.menu_route == "handoverDetail"
|
|
|
+ ) || {};
|
|
|
+ if (tran && tran.action && tran.action.length > 0) {
|
|
|
+ return tran.action;
|
|
|
+ } else {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
+ // mounted() {
|
|
|
+ // console.log(this.id);
|
|
|
+ // this.initForm();
|
|
|
+ // },
|
|
|
created() {
|
|
|
this.initForm();
|
|
|
},
|
|
@@ -110,124 +159,102 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
// 关闭弹窗,直接隐藏表单
|
|
|
- async closeAddEdit() {
|
|
|
- this.$emit("closeModel", false); //抛出一个事件,关闭弹窗
|
|
|
- const res = await asyncRequest.delete({ id: this.parmValue1.id });
|
|
|
- console.log(res);
|
|
|
- if (res && res.code === 0) {
|
|
|
- window.vm.$router.push({
|
|
|
- path: "handover",
|
|
|
- });
|
|
|
- } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
- } else {
|
|
|
- this.$message.warning(res.message);
|
|
|
- }
|
|
|
- },
|
|
|
+ // async closeAddEdit() {
|
|
|
+ // this.$emit("closeModel", false); //抛出一个事件,关闭弹窗
|
|
|
+ //
|
|
|
+ // },
|
|
|
closeAdd() {
|
|
|
this.$emit("closeModel", false);
|
|
|
},
|
|
|
async initForm() {
|
|
|
+ this.status = "";
|
|
|
this.loading = true;
|
|
|
if (this.id === "add") {
|
|
|
- this.isBtn = true;
|
|
|
- this.isDetail = false;
|
|
|
this.rulesThis = this.rules;
|
|
|
+ this.disabled = false;
|
|
|
await this.resetForm();
|
|
|
} else {
|
|
|
- if (this.isDetail) {
|
|
|
- this.rulesThis = {};
|
|
|
- } else {
|
|
|
- this.rulesThis = this.rules;
|
|
|
- await this.resetForm();
|
|
|
- await this.initData();
|
|
|
- }
|
|
|
+ this.rulesThis = this.rules;
|
|
|
+ await this.resetForm();
|
|
|
await this.initData();
|
|
|
}
|
|
|
this.loading = false;
|
|
|
},
|
|
|
async initData() {
|
|
|
- const model = {
|
|
|
- // id: this.parmValue1.id,
|
|
|
- };
|
|
|
- console.log(model);
|
|
|
const res = await asyncRequest.detail({ id: this.id });
|
|
|
if (res && res.code === 0 && res.data) {
|
|
|
let { hand_name, resign_name, hand_uid, resign_uid, id, status } =
|
|
|
res.data;
|
|
|
+ this.resign_name = resign_name;
|
|
|
+ this.hand_name = hand_name;
|
|
|
+ this.status = status;
|
|
|
this.ruleForm = {
|
|
|
- resign_name,
|
|
|
- hand_name,
|
|
|
hand_uid: hand_uid.split(","),
|
|
|
resign_uid: resign_uid.split(","),
|
|
|
- type: status,
|
|
|
- id,
|
|
|
};
|
|
|
- this.status = status;
|
|
|
- // this.$emit("refreshList");
|
|
|
} else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
await this.logout();
|
|
|
} else {
|
|
|
this.$message.warning(res.message);
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
async resetForm() {
|
|
|
+ this.resign_name = "";
|
|
|
+ this.hand_name = "";
|
|
|
+ this.status = "";
|
|
|
// 重置
|
|
|
await this.$nextTick(() => {
|
|
|
if (this.$refs.ruleForm) {
|
|
|
this.$refs.ruleForm.resetFields();
|
|
|
this.$refs.ruleForm.clearValidate();
|
|
|
this.ruleForm = {
|
|
|
- resign_name: "", //离职人
|
|
|
- hand_name: "", //交接人
|
|
|
hand_uid: [],
|
|
|
resign_uid: [],
|
|
|
};
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- async submitForm(flow) {
|
|
|
+ async submitForm() {
|
|
|
await this.$refs.ruleForm.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
- let resign_uid = this.ruleForm.resign_uid;
|
|
|
- let hand_uid = this.ruleForm.hand_uid;
|
|
|
- if (resign_uid.toString() !== hand_uid.toString()) {
|
|
|
- this.loading = true;
|
|
|
- const model = {
|
|
|
- id: this.ruleForm.id,
|
|
|
- resign_uid: resign_uid.toString(),
|
|
|
- hand_uid: hand_uid.toString(),
|
|
|
- };
|
|
|
- let res = {};
|
|
|
- if (this.id === "add") {
|
|
|
- delete model["id"];
|
|
|
- res = await asyncRequest.add(model);
|
|
|
- } else {
|
|
|
- res = await asyncRequest.update(model);
|
|
|
- if (flow == "flow") {
|
|
|
- this.updateStatus();
|
|
|
- }
|
|
|
- }
|
|
|
- window.vm.$router.push({
|
|
|
- path: "handover",
|
|
|
+ const { resign_uid, hand_uid } = this.ruleForm;
|
|
|
+ let rUid = resign_uid.toString(),
|
|
|
+ hUid = hand_uid.toString();
|
|
|
+ if (rUid === hUid) {
|
|
|
+ this.$message.error("离职人和接收人不能相同");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.loading = true;
|
|
|
+ const model = {
|
|
|
+ id: this.id,
|
|
|
+ resign_uid: rUid,
|
|
|
+ hand_uid: hUid,
|
|
|
+ };
|
|
|
+ let res = {};
|
|
|
+ if (this.id === "add") {
|
|
|
+ delete model["id"];
|
|
|
+ res = await asyncRequest.add(model);
|
|
|
+ } else {
|
|
|
+ res = await asyncRequest.update(model);
|
|
|
+ }
|
|
|
+
|
|
|
+ this.loading = false;
|
|
|
+ if (res && res.code === 0) {
|
|
|
+ const title = this.id === "add" ? "添加成功!" : "修改成功!";
|
|
|
+ this.$notify.success({
|
|
|
+ title,
|
|
|
+ message: "",
|
|
|
});
|
|
|
- this.loading = false;
|
|
|
- if (res && res.code === 0) {
|
|
|
- const title = this.id === "add" ? "添加成功!" : "修改成功!";
|
|
|
- this.$notify.success({
|
|
|
- title,
|
|
|
- message: "",
|
|
|
- });
|
|
|
+
|
|
|
+ if (this.id === "add") {
|
|
|
this.showModelThis = false;
|
|
|
- // 刷新
|
|
|
this.$emit("refresh", false);
|
|
|
- } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
- } else {
|
|
|
- this.$message.warning(res.message);
|
|
|
}
|
|
|
+ } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
+ await this.logout();
|
|
|
} else {
|
|
|
- this.$message.error("离职人和接收人不能相同");
|
|
|
+ this.$message.warning(res.message);
|
|
|
}
|
|
|
} else {
|
|
|
console.log("error submit!!");
|
|
@@ -235,24 +262,57 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- async updateStatus() {
|
|
|
- let { id, type } = this.ruleForm;
|
|
|
+ async statusConfirm(status, message) {
|
|
|
+ await this.$confirm(`确定要${message}?`, {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ if (status === "-1") {
|
|
|
+ await this.deleteById(message);
|
|
|
+ } else {
|
|
|
+ await this.setStatus(status, message);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ console.log("取消");
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ async deleteById(message) {
|
|
|
+ const res = await asyncRequest.delete({ id: this.id });
|
|
|
+ if (res && res.code === 0) {
|
|
|
+ this.$notify.success({
|
|
|
+ title: message + "成功!",
|
|
|
+ message: "",
|
|
|
+ });
|
|
|
+
|
|
|
+ this.routeGoto("handover", {});
|
|
|
+ // window.vm.$router.push({
|
|
|
+ // path: "handover",
|
|
|
+ // });
|
|
|
+ } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
+ await this.logout();
|
|
|
+ } else {
|
|
|
+ this.$message.warning(res.message);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ async setStatus(status, message) {
|
|
|
let model = {
|
|
|
- id: id,
|
|
|
- remark: "123",
|
|
|
- status: "1",
|
|
|
+ id: this.id,
|
|
|
+ remark: "",
|
|
|
+ status: status,
|
|
|
};
|
|
|
- console.log(model);
|
|
|
- const res = await asyncRequest.updateStatus(model);
|
|
|
+ const res = await asyncRequest.status(model);
|
|
|
+ this.loading = false;
|
|
|
if (res && res.code === 0) {
|
|
|
- const title = this.id === "add" ? "添加成功!" : "修改成功!";
|
|
|
this.$notify.success({
|
|
|
- title,
|
|
|
+ title: message + "成功!",
|
|
|
message: "",
|
|
|
});
|
|
|
- this.showModelThis = false;
|
|
|
- // 刷新
|
|
|
- this.$emit("refresh", false);
|
|
|
+ this.initForm();
|
|
|
} else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
await this.logout();
|
|
|
} else {
|