<template>
|
<div class="list_main">
|
<SearchCondition
|
:info="formItems"
|
ref="condRef"
|
:conForm="conForm"
|
:screenWidth="screenWidth"
|
:isShowDetail="isShowDetail"
|
@handleOnSeach="handleOnSeach"
|
@handleOnRest="handleOnRest"
|
@handleClick="isShowDetail = !isShowDetail"
|
/>
|
<el-row class="add-button">
|
<el-col :span="24">
|
<el-button
|
type="primary"
|
size="small"
|
icon="iconfont icon-xitongfenpeirenwu"
|
@click="handleRandomTask"
|
class="add-btn"
|
>系统分配任务</el-button
|
>
|
</el-col>
|
</el-row>
|
<ProTable
|
:pageInfo="pageInfo"
|
@doAction="doAction"
|
@handleCurrentChange="handleCurrentChange"
|
@handleSizeChange="handleSizeChange"
|
:isAutoIndex="true"
|
:list="records"
|
:header="tableHeader"
|
:loading="loading"
|
/>
|
</div>
|
</template>
|
|
<script>
|
import { PROFIRSTREADITEMS, PROFIRSTREADDEF } from "../utils/condtionConfig";
|
import { PROFIRSTREADCOLUMN } from "../utils/columnConfig";
|
import {
|
qryProductApproveList,
|
qryCondition,
|
productProcessingTask,
|
randomTask,
|
qryQryProductDetailParams
|
} from "../api/productManage.api";
|
import SearchCondition from "../components/SearchCondition";
|
import ProTable from "../components/ProTable.vue";
|
const opreates = {
|
doItNow: "doItNow", // 立即处理
|
continue: "continue", // 继续处理
|
details: "details" // 详情
|
};
|
|
export default {
|
data() {
|
return {
|
formItems: [...PROFIRSTREADITEMS],
|
conForm: { ...PROFIRSTREADDEF },
|
restFormItems: [...PROFIRSTREADITEMS],
|
tableHeader: [...PROFIRSTREADCOLUMN],
|
pageInfo: {
|
currentPage: 1,
|
pageSize: 10,
|
total: 0
|
},
|
screenWidth: document.body.offsetWidth,
|
records: [],
|
condtionValue: { dealIdentity: 0 }, // 表单value集合
|
isShowDetail: false, // 是否显示所有表单项
|
loading: false,
|
openAddPage: false // 打开新增产品管理页面
|
};
|
},
|
components: {
|
SearchCondition,
|
ProTable
|
},
|
created() {
|
// 当前阶段:phaseNo
|
// 产品类型:ProductCode
|
// 产品状态:EffStatus
|
const opyionItems = [
|
{ name: "currentphasename", code: "phaseNo" },
|
{ name: "producttype", code: "ProductCode" },
|
{ name: "productstatus", code: "EffStatus" }
|
];
|
opyionItems.forEach(item => {
|
this.getCondition(item.name, item.code);
|
});
|
},
|
mounted() {
|
window.addEventListener("resize", this.getScreenWidth);
|
this.getProductApproveList();
|
},
|
destroyed() {
|
window.removeEventListener("resize", this.getScreenWidth);
|
},
|
methods: {
|
/**
|
* 获取下拉选择项
|
*/
|
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");
|
}
|
},
|
getScreenWidth() {
|
this.$set(this, "screenWidth", document.body.offsetWidth);
|
},
|
// 随机认领任务
|
async handleRandomTask() {
|
const params = { phaseno: "0040" };
|
const re = await randomTask(params);
|
if (re.code && re.code === "00") {
|
this.$message.success("任务领取成功");
|
this.$router.push({
|
name: "firstReadingDetail",
|
query: {
|
serialno: re.result.serialno,
|
productid: re.result.typeno,
|
objecttype: re.result.objecttype
|
}
|
});
|
}
|
},
|
// 获取产品初审列表
|
async getProductApproveList() {
|
const { currentPage, pageSize } = this.pageInfo;
|
const {
|
typeno,
|
typename,
|
dealIdentity,
|
currentphasename,
|
producttype,
|
productstatus
|
} = this.condtionValue;
|
const params = {
|
currentPage,
|
pageSize,
|
phaseno: "0040",
|
dealIdentity,
|
currentphaseno: currentphasename,
|
productstatus,
|
producttype,
|
typename,
|
typeno
|
};
|
const res = await qryProductApproveList(params);
|
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);
|
}
|
},
|
// 更新表单数据或查找某项数据
|
setOrGetFormInfo(nameKey, newInfo, def) {
|
const { formItems, restFormItems } = this;
|
const index = formItems.findIndex(({ name }) => name === nameKey);
|
let result = {};
|
if (!isNaN(index)) {
|
this.$set(this.formItems, index, { ...formItems[index], ...newInfo });
|
if (def) {
|
this.$set(this.restFormItems, index, {
|
...restFormItems[index],
|
...newInfo
|
});
|
}
|
result = this.formItems[index];
|
}
|
if (typeof newInfo === "undefined") {
|
return result;
|
}
|
},
|
|
// 更新数据
|
updateValue(value, item) {
|
const { name } = item;
|
this.setOrGetFormInfo(name, { value });
|
},
|
|
// 搜索列表
|
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.getProductApproveList();
|
},
|
|
// 重置
|
handleOnRest(proListForm) {
|
this.$set(this, "condtionValue", { dealIdentity: "0" });
|
// this.$set(this, 'pageInfo', { currentPage: 1, pageSize: 10, total: 0 })
|
// this.getProductApproveList()
|
},
|
|
// 表单事件回调
|
async doAction(name, item, { key, label }) {
|
if (key === opreates.doItNow) {
|
const param = {
|
objecttype: item.objecttype,
|
objectno: item.serialno
|
};
|
const listPam = await this.getProductProcessingTask(param);
|
this.$router.push({
|
name: "reexamineDetail",
|
query: {
|
serialno: listPam.serialno,
|
productid: listPam.typeno,
|
objecttype: listPam.objecttype
|
}
|
});
|
}
|
if (key === opreates.continue) {
|
const param = {
|
clicktype: "0",
|
searchtype: "0",
|
serialno: item.serialno,
|
typeno: item.typeno
|
};
|
const listPam = await this.qryQryProductDetailParams(param);
|
this.$router.push({
|
name: "firstReadingDetail",
|
query: {
|
serialno: listPam.serialno,
|
productid: listPam.typeno,
|
objecttype: listPam.objecttype
|
}
|
});
|
}
|
if (key === opreates.details) {
|
const param = {
|
clicktype: "1",
|
searchtype: "0",
|
serialno: item.serialno,
|
typeno: item.typeno
|
};
|
const listPam = await this.qryQryProductDetailParams(param);
|
this.$router.push({
|
name: "firstReadingDetail",
|
query: {
|
serialno: listPam.serialno,
|
productid: listPam.typeno,
|
from: "detail",
|
objecttype: listPam.objecttype
|
}
|
});
|
}
|
},
|
// 获取产品详情参数
|
async qryQryProductDetailParams(param) {
|
const res = await qryQryProductDetailParams(param);
|
if (!res || res.code !== "00") {
|
return "";
|
}
|
return res.result;
|
},
|
// 获取立即处理参数
|
async getProductProcessingTask(param) {
|
const res = await productProcessingTask(param);
|
if (!res || res.code !== "00") {
|
return "";
|
}
|
return res.result;
|
},
|
// 新增产品管理
|
handleAddPage() {
|
this.$router.push({ name: "NewProduct", query: { type: "new" } });
|
},
|
// 修改翻页条数
|
handleSizeChange(val) {
|
this.pageInfo.pageSize = val;
|
this.getProductApproveList();
|
},
|
|
// 修改翻页数
|
handleCurrentChange(val) {
|
this.pageInfo.currentPage = val;
|
this.getProductApproveList();
|
}
|
}
|
};
|
</script>
|
|
<style lang="stylus" scoped>
|
.list_main {
|
padding: 16px 0px 0 20px;
|
& .add-button {
|
padding: 2px 0 30px 0;
|
}
|
}
|
</style>
|