| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361 |
- <template>
- <div class="ele-body">
- <el-card shadow="never">
- <!-- 搜索表单 -->
- <user-search @search="reload" />
- <!-- 数据表格 -->
- <ele-pro-table
- ref="table"
- :columns="columns"
- :datasource="datasource"
- :selection.sync="selection"
- row-key="code"
- :page-size="20"
- >
- <!-- 表头工具栏 -->
- <template v-slot:toolbar>
- <el-button
- size="small"
- type="primary"
- icon="el-icon-plus"
- class="ele-btn-icon"
- @click="openEdit()"
- >
- 新建
- </el-button>
- <el-button
- type="primary"
- size="mini"
- icon="el-icon-upload2"
- plain
- @click="uploadFile"
- >导入</el-button
- >
- </template>
- <template v-slot:maxValue="{ row }">
- {{ row.maxValue }} <span v-if="row.maxValue">{{ row.unitName }}</span>
- </template>
- <template v-slot:minValue="{ row }">
- {{ row.minValue }} <span v-if="row.minValue">{{ row.unitName }}</span>
- </template>
- <template v-slot:defaultValue="{ row }">
- <span v-if="row.defaultValue">{{ row.symbol }}</span>
- {{ row.defaultValue }}
- </template>
- <template v-slot:textType="{ row }">
- {{
- row.textType == 1
- ? '数值'
- : row.textType == 2
- ? '选择'
- : row.textType == 3
- ? '上下限'
- : row.textType == 4
- ? '规格'
- : row.textType == 5
- ? '时间'
- : row.textType == 6
- ? '范围'
- : row.textType == 7
- ? '文本'
- : ''
- }}
- </template>
- <template v-slot:type="{ row }">
- {{ getDictValue('质检标准类型', row.qualityStandardType) }}
- </template>
- <template v-slot:toolList="{ row }">
- <div
- style="display: inline-block"
- v-for="(item, idx) in row.toolList"
- :key="idx"
- >{{ item.name }}
- <span v-if="row.toolList && idx != row.toolList.length - 1"
- >,
- </span>
- </div>
- </template>
- <!-- 操作列 -->
- <template v-slot:action="{ row }">
- <el-popconfirm
- class="ele-action"
- title="确定要复制当前质检吗?"
- @confirm="copy(row)"
- >
- <template v-slot:reference>
- <el-link type="primary" :underline="false" icon="el-icon-tickets">
- 复制
- </el-link>
- </template>
- </el-popconfirm>
- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-edit"
- @click="openEdit(row)"
- >
- 修改
- </el-link>
- <el-popconfirm
- class="ele-action"
- title="确定要删除当前质检吗?"
- @confirm="remove(row)"
- >
- <template v-slot:reference>
- <el-link type="danger" :underline="false" icon="el-icon-delete">
- 删除
- </el-link>
- </template>
- </el-popconfirm>
- </template>
- </ele-pro-table>
- </el-card>
- <!-- 编辑弹窗 -->
- <user-edit
- :visible.sync="showEdit"
- :data="current"
- @done="reload"
- ref="userEdit"
- />
- <!-- 导入弹窗 -->
- <importDialog
- ref="importDialogRef"
- @success="reload"
- :fileUrl="'/qms/static/质检项导入模板.xlsx'"
- fileName="质检项导入模板"
- apiUrl="/qms/inspectionProject/importFile"
- ></importDialog>
- </div>
- </template>
- <script>
- import UserSearch from './components/user-search.vue';
- import UserEdit from './components/user-edit.vue';
- import importDialog from './components/import-dialog.vue';
- import { getList, removeItem, copyItem } from '@/api/inspectionProject';
- import dictMixins from '@/mixins/dictMixins';
- export default {
- name: 'inspectionProject',
- components: {
- UserSearch,
- UserEdit,
- importDialog
- },
- mixins: [dictMixins],
- data() {
- return {
- // 表格列配置
- columns: [
- {
- prop: 'inspectionCode',
- label: '参数编码',
- align: 'center',
- minWidth: 130
- },
- {
- prop: 'inspectionName',
- label: '参数名称',
- align: 'center',
- minWidth: 110
- },
- {
- prop: 'textType',
- label: '参数类型',
- align: 'center',
- slot: 'textType',
- minWidth: 110
- },
- {
- prop: 'defaultValue',
- slot: 'defaultValue',
- label: '默认值',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'maxValue',
- slot: 'maxValue',
- label: '参数上限',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'minValue',
- slot: 'minValue',
- label: '参数下限',
- align: 'center',
- showOverflowTooltip: true
- },
- // {
- // label: '工艺要求',
- // prop: 'inspectionStandard',
- // formatter: (row, column, cellValue) => {
- // return row.symbol + ' ' + cellValue + ' ' + row.unit;
- // },
- // minWidth: 150
- // },
- {
- label: '标准类型',
- prop: 'type',
- slot: 'type'
- },
- {
- prop: 'unitName',
- label: '参数单位',
- align: 'center'
- },
- {
- prop: 'qualityStandardName',
- label: '标准名称',
- align: 'center',
- minWidth: 110
- },
- {
- prop: 'standardCode',
- label: '标准代码',
- align: 'center',
- minWidth: 110
- },
- {
- prop: 'toolList',
- slot: 'toolList',
- label: '工具名称',
- align: 'center',
- minWidth: 150
- },
- {
- label: '状态',
- prop: 'status',
- formatter: (row, column, cellValue) => {
- return cellValue == 1 ? '启用' : cellValue === 0 ? '停用' : '';
- }
- },
- {
- label: '备注',
- prop: 'inspectionRemark'
- },
- {
- columnKey: 'action',
- label: '操作',
- width: 220,
- align: 'center',
- resizable: false,
- slot: 'action',
- showOverflowTooltip: true
- }
- ],
- // 表格选中数据
- selection: [],
- // 当前编辑数据
- current: null,
- // 是否显示编辑弹窗
- showEdit: false,
- // 是否显示导入弹窗
- showImport: false,
- moudleName: ''
- };
- },
- methods: {
- /*回显类型 */
- /* 表格数据源 */
- datasource({ page, where, limit }) {
- return getList({
- ...where,
- pageNum: page,
- size: limit
- });
- },
- /* 刷新表格 */
- reload(where) {
- this.$refs.table.reload({ page: 1, where: where });
- },
- uploadFile() {
- this.$refs.importDialogRef.open();
- },
- /* 打开编辑弹窗 */
- openEdit(row) {
- this.current = row;
- this.showEdit = true;
- this.$refs.userEdit.$refs.form &&
- this.$refs.userEdit.$refs.form.clearValidate();
- },
- /* 删除 */
- remove(row) {
- const loading = this.$loading({ lock: true });
- removeItem([row.id])
- .then((msg) => {
- loading.close();
- this.$message.success('删除' + msg);
- this.reload();
- })
- .catch((e) => {
- loading.close();
- });
- },
- // 复制
- copy(row) {
- console.log(row, '33333');
- const loading = this.$loading({ lock: true });
- copyItem(row.id)
- .then((msg) => {
- loading.close();
- this.$message.success('复制成功');
- this.reload();
- })
- .catch((e) => {
- loading.close();
- });
- },
- /* 批量删除 */
- removeBatch() {
- if (!this.selection.length) {
- this.$message.error('请至少选择一条数据');
- return;
- }
- this.$confirm('确定要删除选中的质检吗?', '提示', {
- type: 'warning'
- })
- .then(() => {
- const loading = this.$loading({ lock: true });
- removeItem(this.selection.map((d) => d.id))
- .then((msg) => {
- loading.close();
- this.$message.success('删除' + msg);
- this.reload();
- })
- .catch((e) => {
- loading.close();
- });
- })
- .catch(() => {});
- }
- }
- };
- </script>
|