You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
969 lines
32 KiB
969 lines
32 KiB
<template>
|
|
<div class="mod-config">
|
|
|
|
<!-- 收藏 -->
|
|
<div>
|
|
<span @click="favoriteFunction()">
|
|
<icon-svg :name="favorite?'xiangqufill':'xiangqu'" class="sl-svg"></icon-svg>
|
|
</span>
|
|
</div>
|
|
|
|
<!-- 条件查询 -->
|
|
<el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList()">
|
|
<el-form-item :label="'BU'">
|
|
<el-select v-model="searchData.buDesc" placeholder="请选择" clearable style="width: 130px">
|
|
<el-option
|
|
v-for = "i in userBuList"
|
|
:key = "i.buNo"
|
|
:label = "i.buDesc"
|
|
:value = "i.buDesc">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item :label="'检验水平'">
|
|
<el-input v-model="searchData.samplingLevelDesc" clearable style="width: 120px"></el-input>
|
|
</el-form-item>
|
|
<el-form-item :label="'样本量字码'">
|
|
<el-input v-model="searchData.samplingQtyDesc" clearable style="width: 120px"></el-input>
|
|
</el-form-item>
|
|
<el-form-item :label="'是否可用'">
|
|
<el-select v-model="searchData.samplingPlanActive" style="width: 130px">
|
|
<el-option label="全部" value=""></el-option>
|
|
<el-option label="是" value="Y"></el-option>
|
|
<el-option label="否" value="N"></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item :label="' '">
|
|
<!-- <el-button @click="doEmpty()">清空</el-button>-->
|
|
<el-button v-if="!authSearch" type="primary" @click="getDataList()">查询</el-button>
|
|
<el-button v-if="!authSave" type="primary" @click="addModal()">新增</el-button>
|
|
<download-excel
|
|
:fields="fields()"
|
|
:data="exportData"
|
|
type="xls"
|
|
:name="exportName"
|
|
:header="exportHeader"
|
|
:footer="exportFooter"
|
|
:fetch="createExportData"
|
|
:before-generate="startDownload"
|
|
:before-finish="finishDownload"
|
|
worksheet="导出信息"
|
|
class="el-button el-button--primary el-button--medium">
|
|
{{ "导出" }}
|
|
</download-excel>
|
|
</el-form-item>
|
|
</el-form>
|
|
|
|
<!-- 展示列表 -->
|
|
<el-table
|
|
:height="height"
|
|
:data="dataList"
|
|
border
|
|
v-loading="dataListLoading"
|
|
style="width: 100%;">
|
|
<el-table-column
|
|
v-for="(item,index) in columnList" :key="index"
|
|
:sortable="item.columnSortable"
|
|
:prop="item.columnProp"
|
|
:header-align="item.headerAlign"
|
|
:show-overflow-tooltip="item.showOverflowTooltip"
|
|
:align="item.align"
|
|
:fixed="item.fixed === ''?false:item.fixed"
|
|
:min-width="item.columnWidth"
|
|
:label="item.columnLabel">
|
|
<template slot-scope="scope">
|
|
<span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
|
|
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
fixed="right"
|
|
header-align="center"
|
|
align="center"
|
|
width="160"
|
|
label="操作">
|
|
<template slot-scope="scope">
|
|
<a v-if="!authUpdate" type="text" size="small" @click="updateModal(scope.row)">编辑</a>
|
|
<a v-if="!authDelete" type="text" size="small" @click="deleteModal(scope.row)">删除</a>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
<!-- 分页-->
|
|
<el-pagination
|
|
@size-change="sizeChangeHandle"
|
|
@current-change="currentChangeHandle"
|
|
:current-page="pageIndex"
|
|
:page-sizes="[20, 50, 100, 200, 500]"
|
|
:page-size="pageSize"
|
|
:total="totalPage"
|
|
layout="total, sizes, prev, pager, next, jumper">
|
|
</el-pagination>
|
|
|
|
<!-- 新增和修改 -->
|
|
<el-dialog title="样本量字码矩阵" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="500px">
|
|
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
|
|
<el-form-item label="BU" prop="bu" :rules="rules.bu">
|
|
<el-select v-model="modalData.bu" placeholder="请选择" :disabled="modalDisableFlag" style="width: 456px">
|
|
<el-option
|
|
v-for = "i in userBuList"
|
|
:key = "i.buNo"
|
|
:label = "i.sitename"
|
|
:value = "i.buNo">
|
|
<span style="float: left;width: 100px">{{ i.sitename }}</span>
|
|
<span style="float: right; color: #8492a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; font-size: 11px;width: 60px">
|
|
{{ i.buDesc }}
|
|
</span>
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
|
|
<el-form-item label="矩阵名称:" prop="samplingPlanDesc" :rules="rules.samplingPlanDescType">
|
|
<el-input v-model="modalData.samplingPlanDesc" style="width: 221px"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="是否在用:" prop="samplingPlanActive" :rules="rules.samplingPlanActiveType">
|
|
<el-select filterable v-model="modalData.samplingPlanActive" style="width: 221px">
|
|
<el-option label="是" value="Y"></el-option>
|
|
<el-option label="否" value="N"></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
|
|
<el-form-item prop="samplingQtyNo" :rules="rules.samplingQtyNoType">
|
|
<span slot="label" style="" @click="getBaseList(210)"><a herf="#">样本量编码</a></span>
|
|
<el-input v-model="modalData.samplingQtyNo" style="width: 221px"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="样本量字码:" prop="samplingQtyDesc" :rules="rules.samplingQtyDescType">
|
|
<el-input v-model="modalData.samplingQtyDesc" disabled style="width: 221px"></el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
|
|
<el-form-item prop="samplingQtyRankNo" :rules="rules.samplingQtyRankNoType">
|
|
<span slot="label" style="" @click="getBaseList(209)"><a herf="#">抽样量级别编码</a></span>
|
|
<el-input v-model="modalData.samplingQtyRankNo" style="width: 221px"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="抽样量级别名称:" prop="samplingQtyRankDesc" :rules="rules.samplingQtyRankDescType">
|
|
<el-input v-model="modalData.samplingQtyRankDesc" disabled style="width: 221px"></el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
|
|
<el-form-item prop="samplingLevelNo" :rules="rules.samplingLevelNoType">
|
|
<span slot="label" style="" @click="getBaseList(208)"><a herf="#">抽样等级编码</a></span>
|
|
<el-input v-model="modalData.samplingLevelNo" style="width: 221px"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="抽样等级名称:" prop="samplingLevelDesc" :rules="rules.samplingLevelDescType">
|
|
<el-input v-model="modalData.samplingLevelDesc" disabled style="width: 221px"></el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-footer style="height:40px;margin-top: 20px;text-align:center">
|
|
<el-button type="primary" @click="saveData()">保存</el-button>
|
|
<el-button type="primary" @click="modalFlag = false">关闭</el-button>
|
|
</el-footer>
|
|
</el-dialog>
|
|
|
|
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
samplingInspectionPlanSearch, // 查询矩阵
|
|
samplingInspectionPlanSave, // 新增矩阵
|
|
samplingInspectionPlanUpdate, // 修改矩阵
|
|
samplingInspectionPlanDelete, // 删除矩阵
|
|
getSiteAndBuByUserName
|
|
} from "@/api/qc/qc.js"
|
|
import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
|
|
import Chooselist from '@/views/modules/common/Chooselist_eam'
|
|
import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
|
|
export default {
|
|
components: {
|
|
Chooselist
|
|
},
|
|
watch: {
|
|
modalData: {
|
|
deep: true,
|
|
handler: function (newV, oldV) {
|
|
this.modalData.samplingPlanNo = this.modalData.samplingPlanNo.toUpperCase()
|
|
}
|
|
}
|
|
},
|
|
data () {
|
|
return {
|
|
// 是否收藏
|
|
favorite: false,
|
|
// 导出 start
|
|
exportData: [],
|
|
exportName: "检验项目" + this.dayjs().format('YYYYMMDDHHmmss'),
|
|
exportHeader: ["检验项目"],
|
|
exportFooter: [],
|
|
exportList: [],
|
|
// 导出 end
|
|
// 条件查询对象
|
|
searchData: {
|
|
site: '',
|
|
userName: this.$store.state.user.name,
|
|
samplingLevelDesc: '',
|
|
samplingQtyDesc: '',
|
|
samplingPlanActive: '',
|
|
buDesc: '',
|
|
page: 1,
|
|
limit: 10,
|
|
},
|
|
// 分页对象
|
|
pageIndex: 1,
|
|
pageSize: 20,
|
|
totalPage: 0,
|
|
height: 200,
|
|
dataList: [],
|
|
dataListLoading: false,
|
|
dataListSelections: [],
|
|
// 其它对象
|
|
modalFlag: false,
|
|
modalDisableFlag: false,
|
|
modalData: {
|
|
flag: '',
|
|
site: '',
|
|
bu: '',
|
|
samplingPlanNo: '',
|
|
samplingPlanDesc: '',
|
|
samplingQtyNo: '',
|
|
samplingQty: '',
|
|
samplingQtyDesc: '',
|
|
samplingQtyRankDesc: '',
|
|
samplingQtyRankNo: '',
|
|
minQty: '',
|
|
maxQty: '',
|
|
samplingLevelNo: '',
|
|
samplingLevelDesc: '',
|
|
samplingPlanActive: '',
|
|
createBy: this.$store.state.user.name,
|
|
updateBy: this.$store.state.user.name
|
|
},
|
|
detailData: {
|
|
id: '',
|
|
site: '',
|
|
buNo: '',
|
|
samplingQtyRankNo: '',
|
|
samplingQtyRankDesc: '',
|
|
samplingLevelNo: '',
|
|
samplingLevelDesc: '',
|
|
samplingQtyNo: '',
|
|
samplingQty: '',
|
|
samplingPlanActive: ''
|
|
},
|
|
// 展示标头
|
|
columnList: [
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 301012,
|
|
serialNumber: '301012TableBuDesc',
|
|
tableId: "301012Table",
|
|
tableName: "样本量字码矩阵表",
|
|
columnProp: 'buDesc',
|
|
headerAlign: 'center',
|
|
align: "center",
|
|
columnLabel: 'BU',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 100,
|
|
},
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 301012,
|
|
serialNumber: '301012TableSamplingPlanNo',
|
|
tableId: "301012Table",
|
|
tableName: "样本量字码矩阵表",
|
|
columnProp: 'samplingPlanNo',
|
|
headerAlign: 'center',
|
|
align: "center",
|
|
columnLabel: '矩阵编码',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 100,
|
|
},
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 301012,
|
|
serialNumber: '301012TableSamplingPlanDesc',
|
|
tableId: "301012Table",
|
|
tableName: "样本量字码矩阵表",
|
|
columnProp: 'samplingPlanDesc',
|
|
headerAlign: 'center',
|
|
align: "center",
|
|
columnLabel: '矩阵名称',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 100,
|
|
},
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 301012,
|
|
serialNumber: '301012TableSamplingQtyDesc',
|
|
tableId: "301012Table",
|
|
tableName: "样本量字码矩阵表",
|
|
columnProp: 'samplingQtyDesc',
|
|
headerAlign: 'center',
|
|
align: "center",
|
|
columnLabel: '样本量字码',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 100,
|
|
},
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 301012,
|
|
serialNumber: '301012TableSamplingQty',
|
|
tableId: "301012Table",
|
|
tableName: "样本量字码矩阵表",
|
|
columnProp: 'samplingQty',
|
|
headerAlign: 'center',
|
|
align: "right",
|
|
columnLabel: '样本量',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 100,
|
|
},
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 301012,
|
|
serialNumber: '301012TableSamplingQtyRankDesc',
|
|
tableId: "301012Table",
|
|
tableName: "样本量字码矩阵表",
|
|
columnProp: 'samplingQtyRankDesc',
|
|
headerAlign: 'center',
|
|
align: "right",
|
|
columnLabel: '批量级次',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 200,
|
|
},
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 301012,
|
|
serialNumber: '301012TableMinQty',
|
|
tableId: "301012Table",
|
|
tableName: "样本量字码矩阵表",
|
|
columnProp: 'minQty',
|
|
headerAlign: 'center',
|
|
align: "right",
|
|
columnLabel: '最小抽样数',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 110,
|
|
},
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 301012,
|
|
serialNumber: '301012TableMaxQty',
|
|
tableId: "301012Table",
|
|
tableName: "样本量字码矩阵表",
|
|
columnProp: 'maxQty',
|
|
headerAlign: 'center',
|
|
align: "right",
|
|
columnLabel: '最大抽样数',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 110,
|
|
},
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 301012,
|
|
serialNumber: '301012TableSamplingLevelDesc',
|
|
tableId: "301012Table",
|
|
tableName: "样本量字码矩阵表",
|
|
columnProp: 'samplingLevelDesc',
|
|
headerAlign: 'center',
|
|
align: "left",
|
|
columnLabel: '抽样等级',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 200,
|
|
},
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 301012,
|
|
serialNumber: '301012TableSamplingPlanActive',
|
|
tableId: "301012Table",
|
|
tableName: "样本量字码矩阵表",
|
|
columnProp: 'samplingPlanActive',
|
|
headerAlign: 'center',
|
|
align: "center",
|
|
columnLabel: '是否可用',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 100,
|
|
},
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 301012,
|
|
serialNumber: '301012TableCreateDate',
|
|
tableId: "301012Table",
|
|
tableName: "样本量字码矩阵表",
|
|
columnProp: 'createDate',
|
|
headerAlign: 'center',
|
|
align: "center",
|
|
columnLabel: '创建时间',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 170,
|
|
},
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 301012,
|
|
serialNumber: '301012TableCreateBy',
|
|
tableId: "301012Table",
|
|
tableName: "样本量字码矩阵表",
|
|
columnProp: 'createBy',
|
|
headerAlign: 'center',
|
|
align: "center",
|
|
columnLabel: '创建人',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 100,
|
|
},
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 301012,
|
|
serialNumber: '301012TableUpdateDate',
|
|
tableId: "301012Table",
|
|
tableName: "样本量字码矩阵表",
|
|
columnProp: 'updateDate',
|
|
headerAlign: 'center',
|
|
align: "center",
|
|
columnLabel: '更新时间',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 170,
|
|
},
|
|
{
|
|
userId: this.$store.state.user.name,
|
|
functionId: 301012,
|
|
serialNumber: '301012TableUpdateBy',
|
|
tableId: "301012Table",
|
|
tableName: "样本量字码矩阵表",
|
|
columnProp: 'updateBy',
|
|
headerAlign: 'center',
|
|
align: "center",
|
|
columnLabel: '更新人',
|
|
columnHidden: false,
|
|
columnImage: false,
|
|
columnSortable: false,
|
|
sortLv: 0,
|
|
status: true,
|
|
fixed: '',
|
|
columnWidth: 100,
|
|
},
|
|
],
|
|
rules: {
|
|
samplingPlanDescType:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: ['blur','change']
|
|
}
|
|
],
|
|
samplingPlanActiveType:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: ['blur','change']
|
|
}
|
|
],
|
|
samplingQtyNoType:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: ['blur','change']
|
|
}
|
|
],
|
|
samplingQtyDescType:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: ['blur','change']
|
|
}
|
|
],
|
|
samplingQtyRankNoType:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: ['blur','change']
|
|
}
|
|
],
|
|
samplingQtyRankDescType:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: ['blur','change']
|
|
}
|
|
],
|
|
samplingLevelNoType:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: ['blur','change']
|
|
}
|
|
],
|
|
samplingLevelDescType:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: ['blur','change']
|
|
}
|
|
],
|
|
bu:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: ['blur','change']
|
|
}
|
|
]
|
|
},
|
|
userBuList: [],
|
|
authSearch: false,
|
|
authSave: false,
|
|
authUpdate: false,
|
|
authDelete: false,
|
|
menuId: this.$route.meta.menuId,
|
|
}
|
|
},
|
|
|
|
mounted () {
|
|
this.$nextTick(() => {
|
|
this.height = window.innerHeight - 180
|
|
})
|
|
},
|
|
|
|
created () {
|
|
// 按钮控制
|
|
this.getButtonAuthData()
|
|
// 获取用户的 site 和 bu
|
|
this.getSiteAndBuByUserName()
|
|
// 校验用户是否收藏
|
|
this.favoriteIsOk()
|
|
// 动态列
|
|
this.getTableUserColumn(this.$route.meta.menuId+'table',1)
|
|
if (!this.authSearch) {
|
|
// 获取数据列表
|
|
this.getDataList()
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
// 获取用户的bu
|
|
getSiteAndBuByUserName () {
|
|
let tempData = {
|
|
username: this.$store.state.user.name,
|
|
}
|
|
getSiteAndBuByUserName(tempData).then(({data}) => {
|
|
if (data.code === 0) {
|
|
this.userBuList = data.rows
|
|
}
|
|
})
|
|
},
|
|
|
|
// 获取数据列表
|
|
getDataList () {
|
|
this.searchData.limit = this.pageSize
|
|
this.searchData.page = this.pageIndex
|
|
samplingInspectionPlanSearch(this.searchData).then(({data}) => {
|
|
if (data.code === 0) {
|
|
this.dataList = data.page.list
|
|
this.pageIndex = data.page.currPage
|
|
this.pageSize = data.page.pageSize
|
|
this.totalPage = data.page.totalCount
|
|
}
|
|
this.dataListLoading = false
|
|
})
|
|
},
|
|
|
|
// 每页数
|
|
sizeChangeHandle (val) {
|
|
this.pageSize = val
|
|
this.pageIndex = 1
|
|
this.getDataList()
|
|
},
|
|
|
|
// 当前页
|
|
currentChangeHandle (val) {
|
|
this.pageIndex = val
|
|
this.getDataList()
|
|
},
|
|
|
|
// 多选
|
|
selectionChangeHandle (val) {
|
|
this.dataListSelections = val
|
|
},
|
|
|
|
// 获取方法数据列表
|
|
getBaseList (val,type) {
|
|
this.tagNo = val
|
|
this.$nextTick(() => {
|
|
let strVal = ''
|
|
if (val === 210) {
|
|
strVal = this.detailData.samplingQtyNo
|
|
this.$refs.baseList.init(val, strVal)
|
|
}
|
|
if (val === 209) {
|
|
strVal = this.detailData.samplingQtyRankNo
|
|
this.$refs.baseList.init(val, strVal)
|
|
}
|
|
if (val === 208) {
|
|
strVal = this.detailData.samplingLevelNo
|
|
this.$refs.baseList.init(val, strVal)
|
|
}
|
|
})
|
|
},
|
|
|
|
// 列表方法的回调
|
|
getBaseData (val) {
|
|
if (this.tagNo === 210) {
|
|
this.modalData.samplingQtyNo = val.sampling_qty_no
|
|
this.modalData.samplingQtyDesc = val.sampling_qty_desc
|
|
}
|
|
if (this.tagNo === 209) {
|
|
this.modalData.samplingQtyRankNo = val.sampling_qty_rank_no
|
|
this.modalData.samplingQtyRankDesc = val.sampling_qty_rank_desc
|
|
}
|
|
if (this.tagNo === 208) {
|
|
this.modalData.samplingLevelNo = val.sampling_level_no
|
|
this.modalData.samplingLevelDesc = val.sampling_level_desc
|
|
}
|
|
},
|
|
|
|
// 新增
|
|
addModal () {
|
|
this.modalData = {
|
|
flag: '1',
|
|
site: '',
|
|
bu: this.userBuList[0].buNo,
|
|
samplingPlanNo: '',
|
|
samplingQtyNo: '',
|
|
samplingQty: '',
|
|
samplingQtyDesc: '',
|
|
samplingQtyRankDesc: '',
|
|
samplingQtyRankNo: '',
|
|
minQty: '',
|
|
maxQty: '',
|
|
samplingLevelNo: '',
|
|
samplingLevelDesc: '',
|
|
samplingPlanActive: 'Y',
|
|
createBy: this.$store.state.user.name,
|
|
updateBy: this.$store.state.user.name
|
|
}
|
|
this.modalDisableFlag = false
|
|
this.modalFlag = true
|
|
},
|
|
|
|
// 修改
|
|
updateModal (row) {
|
|
this.modalData = {
|
|
flag: '2',
|
|
bu: row.site + '_' + row.buNo,
|
|
site: row.site,
|
|
samplingPlanNo: row.samplingPlanNo,
|
|
samplingPlanDesc: row.samplingPlanDesc,
|
|
samplingQtyNo: row.samplingQtyNo,
|
|
samplingQty: row.samplingQty,
|
|
samplingQtyDesc: row.samplingQtyDesc,
|
|
samplingQtyRankDesc: row.samplingQtyRankDesc,
|
|
samplingQtyRankNo: row.samplingQtyRankNo,
|
|
minQty: row.minQty,
|
|
maxQty: row.maxQty,
|
|
samplingLevelNo: row.samplingLevelNo,
|
|
samplingLevelDesc: row.samplingLevelDesc,
|
|
samplingPlanActive: row.samplingPlanActive,
|
|
createBy: this.$store.state.user.name,
|
|
updateBy: this.$store.state.user.name
|
|
}
|
|
this.modalDisableFlag = true
|
|
this.modalFlag = true
|
|
},
|
|
|
|
// 删除
|
|
deleteModal (row) {
|
|
this.$confirm(`是否删除这个矩阵?`, '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
samplingInspectionPlanDelete(row).then(({data}) => {
|
|
if (data && data.code === 0) {
|
|
this.getDataList()
|
|
this.$message({
|
|
message: '操作成功',
|
|
type: 'success',
|
|
duration: 1500,
|
|
onClose: () => {}
|
|
})
|
|
} else {
|
|
this.$alert(data.msg, '错误', {
|
|
confirmButtonText: '确定'
|
|
})
|
|
}
|
|
})
|
|
}).catch(() => {
|
|
})
|
|
},
|
|
|
|
saveData () {
|
|
if (this.modalData.bu === '' || this.modalData.bu == null) {
|
|
this.$message.warning('请选择BU!')
|
|
return
|
|
}
|
|
if (this.modalData.samplingPlanDesc === '' || this.modalData.samplingPlanDesc == null) {
|
|
this.$message.warning('请输入矩阵名称!')
|
|
return
|
|
}
|
|
if (this.modalData.samplingQtyNo === '' || this.modalData.samplingQtyNo == null) {
|
|
this.$message.warning('请选择样本量编码!')
|
|
return
|
|
}
|
|
if (this.modalData.samplingQtyRankNo === '' || this.modalData.samplingQtyRankNo == null) {
|
|
this.$message.warning('请选择批量级次编码!')
|
|
return
|
|
}
|
|
if (this.modalData.samplingLevelNo === '' || this.modalData.samplingLevelNo == null) {
|
|
this.$message.warning('请选择检验水平编码!')
|
|
return
|
|
}
|
|
if (this.modalData.samplingPlanActive === '' || this.modalData.samplingPlanActive == null) {
|
|
this.$message.warning('请选择是否在用!')
|
|
return
|
|
}
|
|
if (this.modalData.flag === '1') {
|
|
samplingInspectionPlanSave(this.modalData).then(({data}) => {
|
|
if (data && data.code === 0) {
|
|
this.getDataList()
|
|
this.modalFlag = false
|
|
this.$message({
|
|
message: '操作成功',
|
|
type: 'success',
|
|
duration: 1500,
|
|
onClose: () => {}
|
|
})
|
|
} else {
|
|
this.$alert(data.msg, '错误', {
|
|
confirmButtonText: '确定'
|
|
})
|
|
}
|
|
})
|
|
} else {
|
|
samplingInspectionPlanUpdate(this.modalData).then(({data}) => {
|
|
if (data && data.code === 0) {
|
|
this.getDataList()
|
|
this.modalFlag = false
|
|
this.$message({
|
|
message: '操作成功',
|
|
type: 'success',
|
|
duration: 1500,
|
|
onClose: () => {}
|
|
})
|
|
} else {
|
|
this.$alert(data.msg, '错误', {
|
|
confirmButtonText: '确定'
|
|
})
|
|
}
|
|
})
|
|
}
|
|
},
|
|
|
|
// 校验用户是否收藏
|
|
favoriteIsOk () {
|
|
let userFavorite = {
|
|
userId: this.$store.state.user.id,
|
|
languageCode: this.$i18n.locale
|
|
}
|
|
userFavoriteList(userFavorite).then(({data}) => {
|
|
for (let i = 0; i < data.list.length; i++) {
|
|
if (this.$route.meta.menuId === data.list[i].menuId) {
|
|
this.favorite = true
|
|
}
|
|
}
|
|
})
|
|
},
|
|
|
|
// 收藏 OR 取消收藏
|
|
favoriteFunction () {
|
|
let userFavorite = {
|
|
userId: this.$store.state.user.id,
|
|
functionId: this.$route.meta.menuId,
|
|
}
|
|
if (this.favorite) {
|
|
removeUserFavorite(userFavorite).then(({data}) => {
|
|
this.$message.success(data.msg)
|
|
this.favorite = false
|
|
})
|
|
} else {
|
|
// 收藏
|
|
saveUserFavorite(userFavorite).then(({data}) => {
|
|
this.$message.success(data.msg)
|
|
this.favorite = true
|
|
})
|
|
}
|
|
},
|
|
|
|
//导出excel
|
|
async createExportData () {
|
|
this.searchData.limit = -1
|
|
this.searchData.page = 1
|
|
await samplingInspectionPlanSearch(this.searchData).then(({data}) => {
|
|
this.exportList = data.page.list
|
|
})
|
|
return this.exportList
|
|
},
|
|
|
|
startDownload() {},
|
|
|
|
finishDownload() {},
|
|
|
|
fields () {
|
|
let json = "{"
|
|
this.columnList.forEach((item, index) => {
|
|
if (index == this.columnList.length - 1) {
|
|
json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
|
|
} else {
|
|
json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
|
|
}
|
|
})
|
|
json += "}"
|
|
let s = eval("(" + json + ")")
|
|
return s
|
|
},
|
|
|
|
// 动态列开始 获取 用户保存的 格式列
|
|
async getTableUserColumn (tableId, columnId) {
|
|
let queryTableUser = {
|
|
userId: this.$store.state.user.name,
|
|
functionId: this.$route.meta.menuId,
|
|
tableId: tableId,
|
|
status: true,
|
|
languageCode: this.$i18n.locale
|
|
}
|
|
await getTableUserListLanguage(queryTableUser).then(({data}) => {
|
|
if (data.rows.length > 0) {
|
|
//this.columnList1 = []
|
|
switch (columnId) {
|
|
case 1:
|
|
this.columnList = data.rows
|
|
break;
|
|
// case 2:
|
|
// this.columnDetailList = data.rows
|
|
// break;
|
|
// case 3:
|
|
// this.columnList2 = data.rows
|
|
// break;
|
|
// case 4:
|
|
// this.columnList3 = data.rows
|
|
// break;
|
|
}
|
|
} else {
|
|
this.getColumnList(tableId, columnId)
|
|
}
|
|
})
|
|
},
|
|
|
|
// 获取 tableDefault 列
|
|
async getColumnList(tableId, columnId) {
|
|
let queryTable = {
|
|
functionId: this.$route.meta.menuId,
|
|
tableId: tableId,
|
|
languageCode: this.$i18n.locale
|
|
}
|
|
await getTableDefaultListLanguage(queryTable).then(({data}) => {
|
|
if (!data.rows.length == 0) {
|
|
switch (columnId) {
|
|
case 1:
|
|
this.columnList = data.rows
|
|
break;
|
|
// case 2:
|
|
// this.columnDetailList = data.rows
|
|
// break;
|
|
// case 3:
|
|
// this.columnList2 = data.rows
|
|
// break;
|
|
// case 4:
|
|
// this.columnList3 = data.rows
|
|
// break;
|
|
}
|
|
} else {
|
|
// this.showDefault = true.
|
|
}
|
|
})
|
|
},
|
|
|
|
//获取按钮的权限数据
|
|
getButtonAuthData () {
|
|
let searchFlag = this.isAuth(this.menuId+":search")
|
|
let saveFlag = this.isAuth(this.menuId+":save")
|
|
let updateFlag = this.isAuth(this.menuId+":update")
|
|
let deleteFlag = this.isAuth(this.menuId+":delete")
|
|
//处理页面的权限数据
|
|
this.authSearch = !searchFlag
|
|
this.authSave = !saveFlag
|
|
this.authUpdate = !updateFlag
|
|
this.authDelete = !deleteFlag
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
<style scoped>
|
|
.el-table /deep/ .cell{
|
|
height: auto;
|
|
line-height: 1.5;
|
|
}
|
|
</style>
|