<template>
|
<div class="apply-info">
|
<div class="dialog-form">
|
<!-- {{quotaType}} -->
|
<p class="dialog-form-title">{{taskController === '0' ? '任务指派' : '退回任务池'}}</p>
|
<CommForm
|
class="editMarkForm"
|
:inline="true"
|
:list="formList"
|
@updateValue="updateValue"
|
ref="editMarkForm"
|
:formValues="formValues"
|
:formRules="formRules"
|
:column="2"
|
></CommForm>
|
<div class="dialog-form-buttons">
|
<p>
|
<el-button class="comm-button" @click="$emit('close')">取消</el-button>
|
</p>
|
<p>
|
<!-- <el-button
|
class="comm-button"
|
type="primary"
|
@click="submit"
|
>{{taskController === '0' ? '提交':'确定'}}</el-button>-->
|
<el-button
|
class="comm-button"
|
type="primary"
|
@click="submit"
|
:disabled="subLoading"
|
>{{taskController === '0' ? '提交':'确定'}}</el-button>
|
<!-- <el-button class="comm-button" type="primary" @click="$emit('callback')">确定</el-button> -->
|
</p>
|
</div>
|
</div>
|
</div>
|
</template>
|
<script>
|
// 修改转账备注
|
import CommForm from "@/components/CommForm";
|
import qryQuotaControlChangeUserDetail from "@/controller/qryQuotaControlChangeUserDetail"; // 管控额度表单信息
|
import qryCustQuotaChangeUserDetail from "@/controller/qryCustQuotaChangeUserDetail"; // 客户额度表单信息
|
|
import qryTaskChangeUserList from "@/controller/qryTaskChangeUserList";
|
// import queryCodeValueList from "@/controller/queryCodeValueList";
|
import turnFlowUserList from "@/controller/turnFlowUserList"; // 指派任务
|
import returnTaskPool from "@/controller/returnTaskPool"; // 退回任务池
|
|
// 部分参数统一说明
|
// taskController 0 任务指派 1 退回任务池
|
// quotaType 0 管控额度 1 客户额度
|
|
export default {
|
components: {
|
CommForm
|
},
|
props: {
|
taskController: {
|
type: String,
|
default: ""
|
},
|
info: {
|
type: Object,
|
default: () => ({})
|
},
|
isShow: {
|
type: Boolean,
|
default: false
|
},
|
detail: {
|
type: Object,
|
default: () => ({})
|
},
|
trxnBr: {
|
type: String,
|
default: ""
|
},
|
buttonProp: {
|
type: String,
|
default: ""
|
},
|
// 0 管控额度 1 客户额度
|
quotaType: {
|
type: String,
|
default: "0"
|
}
|
},
|
data() {
|
return {
|
model: null,
|
subLoading: false,
|
formList: [],
|
taskOrgId: "",
|
taskOrgName: "",
|
taskUserId: "",
|
taskUserName: ""
|
};
|
},
|
created() {
|
this.init();
|
},
|
methods: {
|
init() {
|
const { taskController, quotaType } = this;
|
this.model =
|
taskController === "0" ? turnFlowUserList() : returnTaskPool();
|
this.taskInfoModel =
|
quotaType === "0"
|
? qryQuotaControlChangeUserDetail()
|
: qryCustQuotaChangeUserDetail();
|
this.TaskInfoChange();
|
},
|
|
async TaskInfoChange() {
|
const { taskInfoModel, info, taskController } = this;
|
const { applySerialNo } = info;
|
const data = await taskInfoModel.request({
|
applySerialNo
|
});
|
this.formList = taskInfoModel.getFormList(data);
|
// 退回任务池 -1
|
if (taskController === "1") {
|
this.returnTask();
|
}
|
// 任务指派 -0
|
if (taskController === "0") {
|
this.assignTask();
|
}
|
},
|
|
// 退回任务池
|
returnTask() {
|
this.formList = this.formList.filter(
|
item => item.name !== "newOperUserName"
|
);
|
},
|
|
// 任务指派
|
assignTask() {
|
const { formList } = this;
|
const index = formList.findIndex(item => item.name === "newOperUserName");
|
if (index > -1) {
|
this.name = formList[index].name;
|
this.formList[index] = {
|
...formList[index],
|
attrs: [
|
"clearable",
|
"filterable",
|
"remote",
|
{
|
"remote-method": v => {
|
if (v !== "") {
|
this.qryTaskChangeUserList(v);
|
}
|
}
|
}
|
]
|
};
|
}
|
},
|
// 查询用户列表
|
async qryTaskChangeUserList(userName) {
|
const { name } = this;
|
const tempModel = qryTaskChangeUserList();
|
const { list } = await tempModel.request({
|
userName
|
});
|
this.updateValue(name, { options: list });
|
},
|
// 更新表单数据
|
updateValue(index = "", data = {}) {
|
const { formList } = this;
|
if (isNaN(index)) {
|
// index is name
|
index = formList.findIndex(({ name }) => name === index);
|
}
|
|
if (!isNaN(index) && index > -1) {
|
const preInfo = formList[index];
|
const newRemarkIndex = formList.findIndex(
|
({ name }) => name === "newRemark"
|
);
|
const oldIndex = formList.findIndex(({ name }) => name === "trxTxt");
|
const remarkIndex = formList.findIndex(({ name }) => name === "remark");
|
|
this.$set(formList, index, { ...preInfo, ...data });
|
if (index === newRemarkIndex) {
|
this.$set(formList, remarkIndex, {
|
...formList[remarkIndex],
|
value: `${formList[oldIndex].value},${data.value}`
|
});
|
}
|
}
|
|
if (index === 11) {
|
const { value, options } = formList[index];
|
options.map(item => {
|
if (item.value === value) {
|
this.taskUserId = item.value;
|
this.taskUserName = item.label;
|
this.taskOrgId = item.taskOrgId;
|
this.taskOrgName = item.taskOrgName;
|
}
|
});
|
}
|
},
|
|
// 表单按钮事件处理
|
submit() {
|
const { taskController } = this;
|
// 任务指派
|
if (taskController === "0") {
|
this.assignTaskSubmit();
|
}
|
// 退回任务池
|
if (taskController === "1") {
|
this.returnTaskSubmit();
|
}
|
},
|
// 任务指派提交
|
async assignTaskSubmit() {
|
let {
|
info,
|
model,
|
taskOrgId,
|
taskOrgName,
|
taskUserId,
|
taskUserName
|
} = this;
|
taskUserName = taskUserName.split("-")[0];
|
const { ftSerialNo } = info;
|
// console.log(ftSerialNo,taskOrgId,taskOrgName,taskUserId,taskUserName)
|
const values = this.$refs.editMarkForm.validate();
|
if (values) {
|
try {
|
this.subLoading = true;
|
await model.request({
|
ftSerialNo,
|
taskOrgId,
|
taskOrgName,
|
taskUserId,
|
taskUserName,
|
...values
|
});
|
this.$emit("callback");
|
} catch (error) {
|
console.log(error);
|
}
|
this.subLoading = true;
|
}
|
},
|
// 退回任务池
|
async returnTaskSubmit() {
|
const { model, info } = this;
|
const { objectType, applySerialNo } = info;
|
const values = this.$refs.editMarkForm.validate();
|
// console.log(objectType,applySerialNo,values)
|
if (values) {
|
try {
|
this.subLoading = true;
|
await model.request({
|
objectNo: applySerialNo,
|
objectType,
|
...values
|
});
|
this.$emit("callback");
|
} catch (error) {
|
console.log(error);
|
}
|
this.subLoading = false;
|
}
|
}
|
},
|
computed: {
|
// 表单值信息
|
formValues() {
|
const { model, formList } = this;
|
if (model) {
|
return model.getFormValues(formList);
|
}
|
return {};
|
},
|
formRules() {
|
const { model, formList } = this;
|
if (model) {
|
return model.getFormRules(formList);
|
}
|
return {};
|
}
|
},
|
watch: {
|
isShow() {
|
const { isShow } = this;
|
if (isShow) {
|
this.init();
|
}
|
}
|
}
|
};
|
</script>
|
<style lang="postcss" scoped>
|
.dialog-form {
|
& .dialog-form-title {
|
margin-top: 0px;
|
}
|
& .dialog-form-buttons {
|
display: flex;
|
justify-content: center;
|
padding-top: 20px;
|
& p {
|
margin: 0 40px 0 0;
|
}
|
& p:last-child {
|
margin-right: 0;
|
}
|
}
|
& .editMarkForm {
|
& >>> .el-form {
|
& .el-form-item__label {
|
width: 120px !important;
|
}
|
}
|
}
|
}
|
</style>
|