|
@@ -7,7 +7,7 @@
|
|
|
</el-select>
|
|
|
</template>
|
|
|
</custom-search-bar>
|
|
|
- <custom-button-bar :fields="buttonFields"></custom-button-bar>
|
|
|
+ <custom-button-bar :fields="buttonFields" @export="toOpen"></custom-button-bar>
|
|
|
<custom-table :data="data" :fields="fields" @query="search" :total="total" :opera="opera" @edit="toEdit" @exam="toExam">
|
|
|
<template #status="{ row }">
|
|
|
<el-tag v-if="row.status == '1'" type="success">{{ getDict(row.status, 'status') }}</el-tag>
|
|
@@ -36,6 +36,19 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</template>
|
|
|
+ <template v-if="dialog.type == '3'">
|
|
|
+ <el-col :span="24" class="one">
|
|
|
+ <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="two">
|
|
|
+ <el-checkbox-group v-model="checkedExport" @change="checkedExportChange">
|
|
|
+ <el-checkbox v-for="i in formFields" :label="i" :key="i.model">{{ i.label }}</el-checkbox>
|
|
|
+ </el-checkbox-group>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="btn">
|
|
|
+ <el-button type="primary" size="mini" @click="toFile()">确定导出</el-button>
|
|
|
+ </el-col>
|
|
|
+ </template>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -47,10 +60,12 @@ import { CompanyStore } from '@/store/api/user/company'
|
|
|
import { DictDataStore } from '@/store/api/system/dictData'
|
|
|
import { get, cloneDeep, isArray } from 'lodash-es'
|
|
|
import { RegionStore } from '@/store/api/system/region'
|
|
|
+import { UtilStore } from '@/store/api/util'
|
|
|
import companyForm from './company/form.vue'
|
|
|
const regionStore = RegionStore()
|
|
|
const store = CompanyStore()
|
|
|
const dictDataStore = DictDataStore()
|
|
|
+const utilStore = UtilStore()
|
|
|
const $checkRes = inject('$checkRes')
|
|
|
let skip = 0
|
|
|
const limit = inject('limit')
|
|
@@ -65,12 +80,41 @@ const fields = [
|
|
|
{ label: t('pages.company.email'), model: 'email' },
|
|
|
{ label: t('pages.company.status'), model: 'status', isSearch: true, custom: true }
|
|
|
]
|
|
|
-const buttonFields = []
|
|
|
+const buttonFields = [{ label: t('common.export'), method: 'export' }]
|
|
|
const opera = [
|
|
|
{ label: t('common.update'), method: 'edit', type: 'primary' },
|
|
|
{ label: t('common.exam'), method: 'exam', type: 'warning', display: (i) => i.status !== '1' }
|
|
|
]
|
|
|
-
|
|
|
+// 导出文件
|
|
|
+const checkAll = ref(false)
|
|
|
+const checkedExport = ref([])
|
|
|
+const isIndeterminate = ref(true)
|
|
|
+const formFields = ref([
|
|
|
+ { label: t('pages.company.name'), model: 'name' },
|
|
|
+ { label: t('pages.company.representative'), model: 'representative' },
|
|
|
+ { label: t('pages.company.code'), model: 'code' },
|
|
|
+ { label: t('pages.company.type'), model: 'type', mark: 'dict', code: 'companyIndustry' },
|
|
|
+ { label: t('pages.company.pattern'), model: 'pattern', mark: 'dict', code: 'companyType' },
|
|
|
+ { label: t('pages.company.scale'), model: 'scale', mark: 'dict', code: 'companyScale' },
|
|
|
+ { label: t('pages.company.area'), model: 'area', mark: 'area' },
|
|
|
+ { label: t('pages.company.email'), model: 'email' },
|
|
|
+ { label: t('pages.company.person'), model: 'person' },
|
|
|
+ { label: t('pages.company.register'), model: 'register' },
|
|
|
+ { label: t('pages.company.graduate_num'), model: 'graduate_num' },
|
|
|
+ { label: t('pages.company.doctor_num'), model: 'doctor_num' },
|
|
|
+ { label: t('pages.company.returnee_num'), model: 'returnee_num' },
|
|
|
+ { label: t('pages.company.knowledge'), model: 'knowledge' },
|
|
|
+ { label: t('pages.company.patent'), model: 'patent' },
|
|
|
+ { label: t('pages.company.utility'), model: 'utility' },
|
|
|
+ { label: t('pages.company.copyright'), model: 'copyright' },
|
|
|
+ { label: t('pages.company.is_tech'), model: 'is_tech', mark: 'dict', code: 'isUse' },
|
|
|
+ { label: t('pages.company.is_new'), model: 'is_new', mark: 'dict', code: 'isUse' },
|
|
|
+ { label: t('pages.company.is_show'), model: 'is_show', mark: 'dict', code: 'isUse' },
|
|
|
+ { label: t('pages.company.create_time'), model: 'create_time' },
|
|
|
+ { label: t('pages.company.address'), model: 'address' },
|
|
|
+ { label: t('pages.company.products'), model: 'products' },
|
|
|
+ { label: t('pages.company.brief'), model: 'brief' }
|
|
|
+])
|
|
|
// #endregion
|
|
|
|
|
|
// #region 列表操作
|
|
@@ -91,6 +135,34 @@ const toClose = () => {
|
|
|
form.value = {}
|
|
|
dialog.value = { show: false }
|
|
|
}
|
|
|
+const toOpen = () => {
|
|
|
+ dialog.value = { type: '3', show: true, title: t('pages.company.expertTitle') }
|
|
|
+}
|
|
|
+// 全选
|
|
|
+const handleCheckAllChange = (val) => {
|
|
|
+ checkedExport.value = val ? formFields.value : []
|
|
|
+ isIndeterminate.value = false
|
|
|
+}
|
|
|
+// 选择
|
|
|
+const checkedExportChange = (value) => {
|
|
|
+ let checkedCount = value.length
|
|
|
+ checkAll.value = checkedCount === formFields.value.length
|
|
|
+ isIndeterminate.value = checkedCount > 0 && checkedCount < formFields.value.length
|
|
|
+}
|
|
|
+// 导出数据
|
|
|
+const toFile = async () => {
|
|
|
+ if (checkedExport.value.length > 0) {
|
|
|
+ const reqData = { table: 'company', config: checkedExport.value }
|
|
|
+ const res = await utilStore.toExport(reqData)
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ ElMessage({ type: `success`, message: `导出成功` })
|
|
|
+ window.open(res.data)
|
|
|
+ }
|
|
|
+ toClose()
|
|
|
+ } else {
|
|
|
+ ElMessage({ type: `warning`, message: `请选择导出信息字段` })
|
|
|
+ }
|
|
|
+}
|
|
|
// #endregion
|
|
|
|
|
|
// #region 表单
|
|
@@ -237,4 +309,18 @@ const search = async (query = { skip, limit }) => {
|
|
|
}
|
|
|
// #endregion
|
|
|
</script>
|
|
|
-<style scoped></style>
|
|
|
+<style scoped>
|
|
|
+.one {
|
|
|
+ margin: 0 0 10px 0;
|
|
|
+}
|
|
|
+.two {
|
|
|
+ margin: 0 0 10px 0;
|
|
|
+ :deep(.el-checkbox) {
|
|
|
+ padding: 0 0 20px 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+.btn {
|
|
|
+ text-align: center;
|
|
|
+ margin: 20px 0 0 0;
|
|
|
+}
|
|
|
+</style>
|