<!-- c产品仍无调整 -->
|
<template>
|
<div class="task_list_main">
|
<SearchCondition
|
:info="formItems"
|
ref="condRef"
|
:conForm="conForm"
|
:isShowDetail="isShowDetail"
|
:screenWidth="screenWidth"
|
@handleOnSeach="handleOnSeach"
|
@handleOnRest="handleOnRest"
|
@handleClick="isShowDetail = !isShowDetail"
|
/>
|
<ProTable
|
:pageInfo="pageInfo"
|
@doAction="doAction"
|
@handleCurrentChange="handleCurrentChange"
|
@handleSizeChange="handleSizeChange"
|
:isAutoIndex="true"
|
:list="records"
|
:header="tableHeader"
|
:loading="loading"
|
/>
|
<el-dialog
|
:title="dialogTitle"
|
:visible.sync="assignmentDialogVisible"
|
:close-on-click-modal="false"
|
:close-on-press-escape="false"
|
:destroy-on-close="true"
|
width="1000"
|
center
|
custom-class="assign_dialog_main"
|
>
|
<CreateForms
|
ref="assignment"
|
v-if="assignmentDialogVisible"
|
:screenWidth="1000"
|
@remoteMethod="remoteMethod"
|
:formItems="assignmentFormItems"
|
:defValues="assignmentDefValues"
|
:formRules="assignmentFormRules"
|
/>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="handleCloseDialog">取 消</el-button>
|
<el-button type="primary" @click="handleSubmit">确 定</el-button>
|
</span>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import {
|
PROTASKADJUTITEMS,
|
PROTASKADJUTLISTDEF
|
} from "../utils/condtionConfig";
|
import { PROTASKADJUTCOLUMN } from "../utils/columnConfig";
|
import { PROTASKADJUTLISTFORM } from "../utils/formsConfig";
|
import { PROTASKADJUTDEFVALUE } from "../utils/defValueConfig";
|
import { PROTASKADJUTRULES } from "../utils/formRulesConfig";
|
import {
|
qryProductTaskAdjustmentList,
|
qryCondition,
|
turnFlowUser,
|
returnTaskPool,
|
qryFlowUserList
|
} from "../api/productManage.api";
|
import ProTable from "../components/ProTable.vue";
|
import CreateForms from "../components/CreateForms.vue";
|
import SearchCondition from "../components/SearchCondition.vue";
|
export default {
|
props: {},
|
data() {
|
return {
|
formItems: [...PROTASKADJUTITEMS],
|
assignmentFormItems: [...PROTASKADJUTLISTFORM],
|
assignmentDefValues: { ...PROTASKADJUTDEFVALUE },
|
assignmentFormRules: { ...PROTASKADJUTRULES },
|
tableHeader: [...PROTASKADJUTCOLUMN],
|
conForm: { ...PROTASKADJUTLISTDEF },
|
pageInfo: {
|
currentPage: 1,
|
pageSize: 10,
|
total: 0
|
},
|
condtionValue: {},
|
dialogTitle: "任务指派",
|
records: [],
|
isShowDetail: false, // 是否显示所有表单项
|
loading: false,
|
btnLoading: false,
|
assignmentDialogVisible: false,
|
screenWidth: document.body.offsetWidth,
|
flowUserList: [],
|
oprateColumn: {},
|
operateDialog: ""
|
};
|
},
|
computed: {},
|
created() {
|
// 当前阶段:phaseNo
|
// 产品类型:ProductCode
|
const opyionItems = [
|
{ name: "currentPhaseNo", code: "phaseNo" },
|
{ name: "productType", code: "ProductCode" }
|
];
|
opyionItems.forEach(item => {
|
this.getCondition(item.name, item.code);
|
});
|
},
|
mounted() {
|
window.addEventListener("resize", this.getScreenWidth);
|
this.$router.afterEach((to, from, next) => {
|
window.scrollTo(0, 0);
|
});
|
this.getProductTaskAdjustmentList();
|
},
|
destroyed() {
|
window.removeEventListener("resize", this.getScreenWidth);
|
},
|
watch: {},
|
methods: {
|
// 确定事件处理
|
handleSubmit() {
|
const { operateDialog } = this;
|
operateDialog === "assignment"
|
? this.submitTurnFlowUser()
|
: this.returnTaskPool();
|
},
|
// 关闭弹出框
|
handleCloseDialog() {
|
this.assignmentFormItems = [...PROTASKADJUTLISTFORM];
|
this.assignmentDefValues = { ...PROTASKADJUTDEFVALUE };
|
this.assignmentDialogVisible = false;
|
},
|
// 表单事件回调
|
async doAction(name, item, { key, label }) {
|
if (key === "details") {
|
this.$router.push({
|
name: "productDetail",
|
query: {
|
serialno: item.serialNo,
|
productid: item.productCode,
|
objecttype: item.objectType
|
}
|
});
|
return false;
|
}
|
// 任务指派
|
if (key === "assignment") {
|
this.operateDialog = "assignment";
|
this.dialogTitle = "任务指派";
|
this.assignmentDefValues = {
|
serialNo: item.serialNo,
|
productType: item.productType,
|
productCode: item.productCode,
|
productName: item.productName,
|
currentPhaseNo: item.currentPhaseNo,
|
currentUser: item.currentUser,
|
taskUserName: ""
|
};
|
this.oprateColumn = item;
|
this.assignmentDialogVisible = true;
|
}
|
// 退回任务池
|
if (key === "returnOps") {
|
this.operateDialog = "returnOps";
|
this.dialogTitle = "退回任务池确认";
|
this.assignmentFormItems = [...PROTASKADJUTLISTFORM].filter(
|
form => form.name !== "taskUserName"
|
);
|
this.assignmentDefValues = {
|
serialNo: item.serialNo,
|
productType: item.productType,
|
productCode: item.productCode,
|
productName: item.productName,
|
currentPhaseNo: item.currentPhaseNo,
|
currentUser: item.currentUser,
|
taskUserName: ""
|
};
|
this.oprateColumn = item;
|
this.assignmentDialogVisible = true;
|
}
|
},
|
/**
|
* 获取下拉选择项
|
*/
|
async getCondition(name, conditionName) {
|
const params = { conditionName };
|
const re = await qryCondition(params);
|
if (re.code && re.code === "00") {
|
const options = re.result;
|
this.setOrGetFormInfo(name, { options }, "settingDef");
|
}
|
},
|
// 更新表单数据或查找某项数据
|
setOrGetFormInfo(nameKey, newInfo, def) {
|
const { formItems } = this;
|
const index = formItems.findIndex(({ name }) => name === nameKey);
|
if (!isNaN(index)) {
|
this.$set(this.formItems, index, { ...formItems[index], ...newInfo });
|
}
|
},
|
getScreenWidth() {
|
this.$set(this, "screenWidth", document.body.offsetWidth);
|
},
|
submitTurnFlowUser() {
|
const assignmentForm = this.$refs.assignment;
|
assignmentForm.$refs["createForm"].validate(async valid => {
|
if (valid) {
|
const { taskUserName } = assignmentForm.formValues;
|
const taskUserData = this.flowUserList.filter(
|
item => item.taskUserId === taskUserName
|
);
|
console.log("taskUserData", this.flowUserList, taskUserName);
|
const { taskOrgId, taskOrgName, taskUserId } = taskUserData[0];
|
const {
|
flowNo,
|
ftSerialNo,
|
operateOrgId,
|
operateUserId,
|
phaseNo,
|
productCode
|
} = this.oprateColumn;
|
const params = {
|
flowNo,
|
ftSerialNo,
|
operateOrgId,
|
operateUserId,
|
phaseNo,
|
productID: productCode,
|
taskOrgId,
|
taskOrgName,
|
taskUserId,
|
taskUserName
|
};
|
this.btnLoading = true;
|
const loading = this.$loading({
|
lock: true,
|
text: "正在调整,请稍后!",
|
background: "hsla(0,0%,100%,.9)"
|
});
|
this.handleCloseDialog();
|
setTimeout(() => {
|
loading.close();
|
}, 3000);
|
const turnFlowUserRes = await turnFlowUser(params);
|
loading.close();
|
this.handleCloseDialog();
|
this.btnLoading = false;
|
if (!turnFlowUserRes || turnFlowUserRes.code !== "00") {
|
return false;
|
}
|
this.getProductTaskAdjustmentList();
|
} else {
|
this.$message.warning("请输入处理人!");
|
return false;
|
}
|
});
|
},
|
// 退回任务池
|
async returnTaskPool() {
|
const { serialNo, objectType } = this.oprateColumn;
|
const params = {
|
objectNo: serialNo,
|
objectType
|
};
|
const returnTaskRes = await returnTaskPool(params);
|
if (!returnTaskRes || returnTaskRes.code !== "00") {
|
return false;
|
}
|
this.handleCloseDialog();
|
this.$message.success("退回成功");
|
this.getProductTaskAdjustmentList();
|
},
|
// 处理远程搜索
|
async remoteMethod(query, name, type) {
|
if (!query || query.length < 2) {
|
return false;
|
}
|
this.assignmentFormItems = this.getOptions();
|
const taskRes = await qryFlowUserList({ userName: query });
|
if (!taskRes || taskRes.code !== "00") {
|
return false;
|
}
|
this.flowUserList = taskRes.result;
|
this.assignmentFormItems = this.getOptions(taskRes.result);
|
},
|
// 处理form options
|
getOptions(result) {
|
return [...this.assignmentFormItems].map(form => {
|
const newForm = { ...form };
|
if (newForm.name === "taskUserName") {
|
newForm.options =
|
result && result.length > 0
|
? result.map(({ taskUserId, taskUserName, taskOrgName }) => {
|
return {
|
label: `${taskUserName}-${taskUserId}-${taskOrgName}`,
|
value: taskUserId
|
};
|
})
|
: [];
|
}
|
return newForm;
|
});
|
},
|
async getProductTaskAdjustmentList() {
|
const { currentPage, pageSize } = this.pageInfo;
|
const {
|
serialNo,
|
beginTime,
|
endTime,
|
currentPhaseNo,
|
productCode,
|
productName,
|
productType
|
} = this.condtionValue;
|
const loading = this.$loading({
|
lock: true,
|
text: "",
|
background: "hsla(0,0%,100%,.9)"
|
});
|
setTimeout(() => {
|
loading.close();
|
}, 1500);
|
const params = {
|
applyTime: {
|
beginTime,
|
endTime
|
},
|
currentPage,
|
pageSize,
|
currentPhaseNo: currentPhaseNo || [],
|
productCode,
|
productName,
|
productType,
|
serialNo
|
};
|
const res = await qryProductTaskAdjustmentList(params);
|
loading.close();
|
if (res.code && res.code === "00") {
|
this.$set(this, "records", res.result && res.result.records);
|
this.$set(this.pageInfo, "total", res.result && res.result.total);
|
}
|
},
|
// 搜索列表
|
handleOnSeach() {
|
const conRef = this.$refs.condRef;
|
this.$set(this, "condtionValue", conRef.$refs["conform"].model);
|
this.$set(this, "pageInfo", { currentPage: 1, pageSize: 10, total: 0 });
|
this.getProductTaskAdjustmentList();
|
},
|
// 重置
|
handleOnRest(proListForm) {
|
this.$set(this, "condtionValue", {});
|
},
|
// 修改翻页条数
|
handleSizeChange(val) {
|
this.pageInfo.pageSize = val;
|
this.getProductTaskAdjustmentList();
|
},
|
|
// 修改翻页数
|
handleCurrentChange(val) {
|
this.pageInfo.currentPage = val;
|
this.getProductTaskAdjustmentList();
|
}
|
},
|
components: {
|
SearchCondition,
|
ProTable,
|
CreateForms
|
}
|
};
|
</script>
|
|
<style lang="stylus" scoped>
|
.task_list_main {
|
padding: 16px 0px 0 20px;
|
& >>> .assign_dialog_main {
|
width: 1000px;
|
& .el-dialog__footer {
|
& .dialog-footer {
|
& .el-button--default {
|
width: 120px;
|
height: 30px;
|
line-height: 7px;
|
border-radius: 4px;
|
border: 1px solid rgba(204, 204, 204, 1);
|
}
|
& .el-button--primary {
|
width: 120px;
|
height: 30px;
|
line-height: 7px;
|
background: #0081f0;
|
border-color: #0081f0;
|
border-radius: 4px;
|
margin-left: 40px;
|
}
|
}
|
}
|
}
|
}
|
</style>
|