<template>
|
<a-card :bordered="false">
|
<!-- 查询区域 -->
|
<div class="table-page-search-wrapper">
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
<a-row :gutter="24">
|
<a-col :md="6" :sm="8">
|
<a-form-item label="检验方案编码">
|
<a-input placeholder="请输入检验方案编码" v-model="queryParam.planCode" />
|
</a-form-item>
|
</a-col>
|
<a-col :md="6" :sm="8">
|
<a-form-item label="检验方案分类">
|
<j-search-select-tag
|
placeholder="请选择检验方案分类"
|
v-model="queryParam.planCategory"
|
dict="plan_category"
|
/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="6" :sm="8">
|
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
<a-button type="info" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
</span>
|
</a-col>
|
</a-row>
|
</a-form>
|
</div>
|
|
<!-- 操作按钮区域 -->
|
<div class="table-operator">
|
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
</div>
|
|
<!-- table区域-begin -->
|
<a-table
|
ref="table"
|
size="middle"
|
bordered
|
rowKey="id"
|
:customRow="customRow"
|
:rowClassName="tableRowClass"
|
:columns="columns"
|
:dataSource="dataSource"
|
:pagination="ipagination"
|
:loading="loading"
|
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type:'radio'}"
|
@change="handleTableChange"
|
>
|
<!--状态栏个性展示-->
|
<span
|
slot="status"
|
slot-scope="text,record"
|
>
|
<a-badge
|
v-if="record.planStatus==1"
|
status="success"
|
/>
|
<span
|
v-if="record.planStatus==1"
|
class="success"
|
>启用</span>
|
<a-badge
|
v-if="record.planStatus==0"
|
status="error"
|
/>
|
<span
|
v-if="record.planStatus==0"
|
class="error"
|
>禁用</span>
|
</span>
|
<span
|
slot="publishStatus"
|
slot-scope="text,record"
|
>
|
<a-badge
|
v-if="record.publishStatus==1"
|
status="success"
|
/>
|
<span
|
v-if="record.publishStatus==1"
|
class="success"
|
>已发布</span>
|
<a-badge
|
v-if="record.publishStatus==0"
|
status="error"
|
/>
|
<span
|
v-if="record.publishStatus==0"
|
class="error"
|
>待发布</span>
|
</span>
|
<span
|
slot="version"
|
slot-scope="text,record"
|
>
|
<span
|
v-if="record.planStatus==1"
|
class="success"
|
>{{record.version}}</span>
|
<span
|
v-if="record.planStatus==0"
|
class="error"
|
>{{record.version}}</span>
|
</span>
|
<span
|
slot="action"
|
slot-scope="text, record"
|
v-if="record.isNewVersion == 1"
|
>
|
<a-popconfirm
|
v-if="record.publishStatus == 0 && record.planStatus == 1"
|
title="确定发布吗?"
|
@confirm="() => handlePublish(record.id)"
|
>
|
<a>发布</a>
|
</a-popconfirm>
|
<a-popconfirm
|
v-if="record.publishStatus == 1 && record.planStatus == 1"
|
title="确定取消发布吗?"
|
@confirm="() => handlePublish(record.id)"
|
>
|
<a>取消发布</a>
|
</a-popconfirm>
|
<a-divider type="vertical" v-if="record.publishStatus == 1 && record.planStatus == 1"/>
|
<a-popconfirm
|
v-if="record.publishStatus == 1 && record.planStatus == 1"
|
title="确定升版吗?"
|
@confirm="() => handleVersion(record.id)"
|
>
|
<a>升版</a>
|
</a-popconfirm>
|
<a-divider type="vertical" v-if="record.planStatus == 1"/>
|
<a-dropdown>
|
<a class="ant-dropdown-link">更多
|
<a-icon type="down" />
|
</a>
|
<a-menu slot="overlay">
|
<a-menu-item v-if="record.planStatus==1 && record.publishStatus==0">
|
<a @click="handleEdit(record)">编辑</a>
|
</a-menu-item>
|
<a-menu-item>
|
<a
|
href="javascript:;"
|
@click="handleDetail(record)"
|
>详情</a>
|
</a-menu-item>
|
<a-menu-item v-if="record.publishStatus==0">
|
<a-popconfirm
|
title="确定删除吗?"
|
@confirm="() => handleDelete(record.id)"
|
>
|
<a>删除</a>
|
</a-popconfirm>
|
|
</a-menu-item>
|
<a-menu-item v-if="record.planStatus == 0">
|
<a-popconfirm
|
title="确定启用吗?"
|
@confirm="() => handleActive(record.id)"
|
>
|
<a>启用</a>
|
</a-popconfirm>
|
</a-menu-item>
|
<a-menu-item v-if="record.planStatus == 1 && record.publishStatus == 0">
|
<a-popconfirm
|
title="确定禁用吗?"
|
@confirm="() => handleActive(record.id)"
|
>
|
<a>禁用</a>
|
</a-popconfirm>
|
</a-menu-item>
|
</a-menu>
|
</a-dropdown>
|
</span>
|
</a-table>
|
<a-tabs defaultActiveKey="1">
|
<a-tab-pane tab="检验方案检验项明细" key="1">
|
<inspection-plan-item-list ref="inspectionPlanItemList"></inspection-plan-item-list>
|
</a-tab-pane>
|
</a-tabs>
|
<!-- table区域-end -->
|
<inspection-plan-model ref="modalForm" @ok="modalFormOk"></inspection-plan-model>
|
</a-card>
|
</template>
|
|
<script>
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import InspectionPlanModel from './modules/inspectionPlan/InspectionPlanModel'
|
import InspectionPlanItemList from './modules/inspectionPlan/InspectionPlanItemList'
|
import { requestPut,postAction,getAction } from '@/api/manage'
|
import JDictSelectTag from '@/components/dict/JDictSelectTag'
|
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
|
|
export default {
|
name: 'InspectionPlanList',
|
mixins: [JeecgListMixin],
|
components: {
|
InspectionPlanModel,
|
InspectionPlanItemList,
|
JDictSelectTag,
|
JSearchSelectTag,
|
},
|
data() {
|
return {
|
description: '检验方案',
|
url: {
|
list: '/qms/inspectionPlan/list',
|
importExcelUrl: '/qms/inspectionPlan/importExcel',
|
exportXlsUrl: '/qms/inspectionPlan/exportXls',
|
edit:'/qms/inspectionPlan/edit',
|
submit:'/qms/inspectionPlan/submit',
|
active: '/qms/inspectionPlan/active',
|
publish:'/qms/inspectionPlan/publish',
|
version:'/qms/inspectionPlan/version'
|
},
|
columns: [
|
{
|
title: '#',
|
dataIndex: '',
|
key: 'rowIndex',
|
align: 'center',
|
customRender: function (t, r, index) {
|
return parseInt(index) + 1
|
},
|
},
|
{
|
title: '检验方案编码',
|
align: 'center',
|
dataIndex: 'planCode',
|
sorter: true,
|
},
|
{
|
title: '检验方案名称',
|
align: 'center',
|
dataIndex: 'planName',
|
},
|
{
|
title: '检验方案分类',
|
align: 'center',
|
dataIndex: 'planCategory_dictText',
|
},
|
{
|
title: '物料编码',
|
align: 'center',
|
dataIndex: 'materialNumber',
|
},
|
{
|
title: '物料名称',
|
align: 'center',
|
dataIndex: 'materialName',
|
},
|
{
|
title: '抽样规则',
|
align: 'center',
|
dataIndex: 'ruleId_dictText',
|
},
|
{
|
title: '方案描述',
|
align: 'center',
|
dataIndex: 'descreption',
|
},
|
{
|
title: '版本',
|
align: 'center',
|
scopedSlots: {
|
customRender: 'version',
|
},
|
dataIndex: 'version',
|
},
|
{
|
title: '方案状态',
|
align: 'center',
|
scopedSlots: {
|
customRender: 'status',
|
},
|
dataIndex: 'planStatus',
|
},
|
{
|
title: '发布状态',
|
align: 'center',
|
scopedSlots: {
|
customRender: 'publishStatus',
|
},
|
dataIndex: 'publishStatus',
|
},
|
{
|
width: 180,
|
title: '操作',
|
dataIndex: 'action',
|
align: 'center',
|
scopedSlots: { customRender: 'action' },
|
},
|
],
|
loading:false
|
}
|
},
|
computed: {
|
/* 导入路径页面重新计算 */
|
importExcelUrl: function () {
|
// return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;//开发环境指向
|
return `${window._CONFIG['hxFileURL']}/${this.url.importExcelUrl}`
|
},
|
},
|
methods: {
|
searchQuery(){
|
this.selectedRowKeys = []
|
this.$refs.inspectionPlanItemList.dataSource = []
|
this.loadData(1);
|
},
|
searchReset() {
|
this.queryParam = {}
|
this.selectedRowKeys = []
|
this.$refs.inspectionPlanItemList.dataSource = []
|
this.loadData(1);
|
},
|
customRow(record) {
|
return {
|
on: {
|
click: (e) => {
|
this.onSelectChange(record.id.split(","), [record]);
|
},
|
},
|
}
|
},
|
onSelectChange(selectedRowKeys, selectionRows) {
|
this.selectedRowKeys = selectedRowKeys;
|
this.selectionRows = selectionRows;
|
//将当前选中的记录传到子页面
|
this.$bus.$emit('getInspectionPlanItemData', this.selectionRows[0])
|
},
|
handleEdit: function (record) {
|
this.$refs.modalForm.edit(record)
|
this.$refs.modalForm.title = '编辑'
|
this.$refs.modalForm.disableSubmit = false
|
},
|
handleAdd() {
|
this.$refs.modalForm.add()
|
this.$refs.modalForm.title = '新增'
|
this.$refs.modalForm.disableSubmit = false
|
},
|
handleSubmit(record) {
|
let that = this;
|
that.loading = true
|
getAction(that.url.submit, { id:record.id}).then((res) => {
|
if (res.success) {
|
that.$message.success(res.message);
|
that.loadData();
|
} else {
|
that.$message.warning(res.message);
|
}
|
}).finally(() => {
|
that.loading = false
|
})
|
},
|
//启用禁用
|
handleActive(id) {
|
if (!this.url.active) {
|
this.$message.error("请设置url.active!")
|
return
|
}
|
let that = this;
|
requestPut(that.url.active, {}, { id: id }).then((res) => {
|
if (res.success) {
|
that.$message.success(res.message);
|
that.loadData();
|
} else {
|
that.$message.warning(res.message);
|
}
|
});
|
},
|
|
//发布
|
handlePublish(id) {
|
if (!this.url.publish) {
|
this.$message.error("请设置url.publish!")
|
return
|
}
|
let that = this;
|
requestPut(that.url.publish, {}, { id: id }).then((res) => {
|
if (res.success) {
|
that.$message.success(res.message);
|
that.loadData();
|
} else {
|
that.$message.warning(res.message);
|
}
|
});
|
},
|
|
//升版
|
handleVersion(id) {
|
if (!this.url.version) {
|
this.$message.error("请设置url.version!")
|
return
|
}
|
let that = this;
|
requestPut(that.url.version, {}, { id: id }).then((res) => {
|
if (res.success) {
|
that.$message.success(res.message);
|
that.loadData();
|
} else {
|
that.$message.warning(res.message);
|
}
|
});
|
},
|
|
tableRowClass(record, index) {
|
if (record.isNewVersion != '1') {
|
return "frozenRowClass";
|
}
|
return "";
|
},
|
},
|
}
|
</script>
|
|
<style lang="less" scoped>
|
@import '~@assets/less/common.less';
|
/deep/ .frozenRowClass {
|
color: #c9c9c9;
|
}
|
/deep/ .notshow {
|
display: none;
|
}
|
/deep/ .checked-td-of-add-table {
|
background-color: rgba(220, 220, 220, 1);
|
}
|
</style>
|