|
|
@ -6,7 +6,7 @@ |
|
|
|
<div class="container-left"> |
|
|
|
<span class="right-top-line" /> |
|
|
|
<span class="left-bottom-line" /> |
|
|
|
<el-tree :data="fourDatas" :props="defaultProps" node-key="id" :expand-on-click-node="false" highlight-current :default-expanded-keys="[1]" :default-checked-keys="[1]" @node-click="handleNodeClick" /> |
|
|
|
<el-tree ref="tree" :data="fourDatas" :props="defaultProps" node-key="id" :expand-on-click-node="false" highlight-current :default-expanded-keys="defaultExpandedKeys" @node-click="handleNodeClick" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<!--用户数据--> |
|
|
@ -15,14 +15,21 @@ |
|
|
|
<div class="head-container"> |
|
|
|
<div class="head-search"> |
|
|
|
<!-- 搜索 --> |
|
|
|
<el-input v-model="query.blurry" clearable size="small" placeholder="输入用检测编号或检测项目" prefix-icon="el-icon-search" style="width: 225px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
|
|
|
<el-select v-model="query.enabled" clearable size="small" placeholder="状态" class="filter-item" style="width: 100px" @change="crud.toQuery"> |
|
|
|
<el-input v-model="query.search" clearable size="small" placeholder="输入用检测编号或检测项目" prefix-icon="el-icon-search" style="width: 225px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
|
|
|
<el-select v-model="query.isOpen" clearable size="small" placeholder="状态" class="filter-item" style="width: 100px" @change="crud.toQuery"> |
|
|
|
<i slot="prefix" class="iconfont icon-zhuangtai" /> |
|
|
|
<el-option v-for="item in enabledTypeOptions" :key="item.key" :label="item.display_name" :value="item.key" /> |
|
|
|
</el-select> |
|
|
|
<rrOperation /> |
|
|
|
</div> |
|
|
|
<crudOperation :permission="permission" /> |
|
|
|
<crudOperation :permission="permission"> |
|
|
|
<template v-slot:right> |
|
|
|
<el-button :loading="crud.downloadLoading" size="mini" :disabled="crud.selections.length === 0" @click="doExport(crud.selections)"> |
|
|
|
<i class="iconfont icon-daochu" /> |
|
|
|
导出 |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
</crudOperation> |
|
|
|
<div class="hide-bar"> |
|
|
|
<el-checkbox v-model="fixedStatus" @change="statusBarChecked">隐藏状态栏</el-checkbox> |
|
|
|
</div> |
|
|
@ -33,22 +40,22 @@ |
|
|
|
<!--表格渲染--> |
|
|
|
<el-table ref="table" v-loading="crud.loading" class="fixed-table" :data="crud.data" style="width: 100%;" @row-click="clickRowHandler" @selection-change="crud.selectionChangeHandler"> |
|
|
|
<el-table-column type="selection" align="center" width="55" /> |
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="oneLevel" label="一级分类" width="140" /> |
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="twoLevel" label="二级分类" width="200" /> |
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="number" label="检测编号" width="100" /> |
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="item" label="检测项目" width="340" /> |
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="object" label="检测目的" width="340" /> |
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="basis" label="检测对象" width="160" /> |
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="method" label="依据和方法" width="140" /> |
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="type" label="检测类" width="140" /> |
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="primaryClassId" label="一级分类" width="140" /> |
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="secondaryClassId" label="二级分类" width="200" /> |
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="detectionCode" label="检测编号" width="100" /> |
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="detectionProject" label="检测项目" width="340" /> |
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="detectionObjective" label="检测目的" width="340" /> |
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="detectionObject" label="检测对象" width="160" /> |
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="detectionAccording" label="依据和方法" width="140" /> |
|
|
|
<el-table-column :show-overflow-tooltip="true" prop="detectionMethod" label="检测类" width="140" /> |
|
|
|
<el-table-column class="state-right" label="状态" align="center" width="108" prop="enabled" :fixed="fixedStatus ? false : 'right' "> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span :class="['row-state', scope.row.enabled ? 'active-state': 'disabled-state']">{{ scope.row.enabled ? '启用中': '停用中' }}</span> |
|
|
|
<span :class="['row-state', scope.row.isOpen ? 'active-state': 'disabled-state']">{{ scope.row.isOpen ? '启用中': '停用中' }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
<!--分页组件--> |
|
|
|
<pagination /> |
|
|
|
<pagination v-if="crud.data.length!==0" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -75,8 +82,8 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import crudUser from '@/api/system/user' |
|
|
|
import { verifyMaintenance } from '@/api/archivesConfig/field' |
|
|
|
import crudFourTests from '@/api/system/fourTests' |
|
|
|
import { verifyMaintenance } from '@/api/system/fourTests' |
|
|
|
import { encrypt } from '@/utils/rsaEncrypt' |
|
|
|
import CRUD, { presenter, header, crud } from '@crud/crud' |
|
|
|
import rrOperation from '@crud/RR.operation' |
|
|
@ -84,21 +91,26 @@ import crudOperation from '@crud/CRUD.operation' |
|
|
|
import pagination from '@crud/Pagination' |
|
|
|
import dataJson from './data.json' |
|
|
|
import eForm from './module/form' |
|
|
|
import Vue from 'vue' |
|
|
|
import { exportFile } from '@/utils/index' |
|
|
|
import qs from 'qs' |
|
|
|
import { mapGetters } from 'vuex' |
|
|
|
export default { |
|
|
|
name: 'FourCharacterDetection', |
|
|
|
components: { crudOperation, rrOperation, pagination, eForm }, |
|
|
|
cruds() { |
|
|
|
return CRUD({ title: '四性检测项目', url: 'api/users', crudMethod: { ...crudUser }, optShow: { |
|
|
|
return CRUD({ title: '四性检测项目', url: 'api/fourTests/initFourTests', crudMethod: { ...crudFourTests }, optShow: { |
|
|
|
add: true, |
|
|
|
edit: true, |
|
|
|
del: false, |
|
|
|
download: true, |
|
|
|
download: false, |
|
|
|
group: false |
|
|
|
}}) |
|
|
|
}, |
|
|
|
mixins: [presenter(), header(), crud()], |
|
|
|
data() { |
|
|
|
return { |
|
|
|
defaultExpandedKeys: [], |
|
|
|
fixedStatus: true, |
|
|
|
verifyDialogVisible: false, |
|
|
|
form: { |
|
|
@ -108,26 +120,33 @@ export default { |
|
|
|
btn: '', |
|
|
|
defaultProps: { children: 'children', label: 'name', isLeaf: 'leaf' }, |
|
|
|
permission: { |
|
|
|
add: ['admin', 'user:add'], |
|
|
|
edit: ['admin', 'user:edit'], |
|
|
|
del: ['admin', 'user:del'] |
|
|
|
add: ['admin', 'fourTests:add'], |
|
|
|
edit: ['admin', 'fourTests:edit'], |
|
|
|
del: ['admin', 'fourTests:del'] |
|
|
|
}, |
|
|
|
enabledTypeOptions: [ |
|
|
|
{ key: 'true', display_name: '启用中' }, |
|
|
|
{ key: 'false', display_name: '停用中' } |
|
|
|
{ key: '1', display_name: '启用中' }, |
|
|
|
{ key: '0', display_name: '停用中' } |
|
|
|
] |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
...mapGetters([ |
|
|
|
'baseApi' |
|
|
|
]) |
|
|
|
}, |
|
|
|
created() { |
|
|
|
this.fourDatas = dataJson |
|
|
|
}, |
|
|
|
mounted: function() { |
|
|
|
this.fixedStatus = JSON.parse(localStorage.getItem('statusFourFixed')) === true |
|
|
|
this.$nextTick(() => { |
|
|
|
Vue.set(this.defaultExpandedKeys, 0, this.fourDatas[0].children[0].id) |
|
|
|
this.$refs.tree.setCurrentKey(this.fourDatas[0].children[0].id) |
|
|
|
this.handleNodeClick(this.fourDatas[0].children[0]) |
|
|
|
}) |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
|
|
|
|
[CRUD.HOOK.beforeToCU](crud, form, btn) { |
|
|
|
if (this.showVerifyDialog) { |
|
|
|
// 打开输入验证码对话框 |
|
|
@ -148,8 +167,17 @@ export default { |
|
|
|
// 提交前做的操作 |
|
|
|
[CRUD.HOOK.afterValidateCU](crud) { |
|
|
|
}, |
|
|
|
[CRUD.HOOK.beforeRefresh]() { |
|
|
|
this.handleNodeClick() |
|
|
|
}, |
|
|
|
// tree |
|
|
|
handleNodeClick(data) { |
|
|
|
handleNodeClick(val) { |
|
|
|
if (val) { |
|
|
|
if (val.id !== 0) { |
|
|
|
this.crud.query.secondaryClassId = val.name |
|
|
|
this.crud.toQuery() |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
handleConfirm() { |
|
|
|
verifyMaintenance(encrypt(this.form.verifyCode)).then((res) => { |
|
|
@ -179,6 +207,25 @@ export default { |
|
|
|
}, |
|
|
|
statusBarChecked(val) { |
|
|
|
localStorage.setItem('statusFourFixed', val) |
|
|
|
}, |
|
|
|
doExport(data) { |
|
|
|
crud.downloadLoading = true |
|
|
|
this.$confirm('此操作将导出所选数据' + '<span>你是否还要继续?</span>', '提示', { |
|
|
|
confirmButtonText: '继续', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning', |
|
|
|
dangerouslyUseHTMLString: true |
|
|
|
}).then(() => { |
|
|
|
const ids = [] |
|
|
|
data.forEach(val => { |
|
|
|
ids.push(val.id) |
|
|
|
}) |
|
|
|
const params = { |
|
|
|
'ids': ids |
|
|
|
} |
|
|
|
exportFile(this.baseApi + '/api/fourTests/download?' + qs.stringify(params, { indices: false })) |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|