diff --git a/src/components/uploadFile/index.vue b/src/components/upload-file/index.vue similarity index 100% rename from src/components/uploadFile/index.vue rename to src/components/upload-file/index.vue diff --git a/src/components/uploadExcel/index.vue b/src/components/uploadExcel/index.vue index 8c89d69..43b38cf 100644 --- a/src/components/uploadExcel/index.vue +++ b/src/components/uploadExcel/index.vue @@ -17,7 +17,7 @@ <script> import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包 import waves from '@/directive/waves' // waves directive -import uploadFile from '../uploadFile/index.vue' +import uploadFile from '../upload-file/index.vue' export default { components: { Pagination, uploadFile }, diff --git a/src/views/Label/components/editLabel.vue b/src/views/Label/components/editLabel.vue index 28da606..22ee67f 100644 --- a/src/views/Label/components/editLabel.vue +++ b/src/views/Label/components/editLabel.vue @@ -64,7 +64,7 @@ <script> import Pagination from '@/components/Pagination' import waves from '@/directive/waves' -import uploadFile from '../../../components/uploadFile' +import uploadFile from '../../../components/upload-file' import { requestFN } from '@/utils/request' import editSonLabel from './editSonLabel' diff --git a/src/views/Label/components/editSonLabel.vue b/src/views/Label/components/editSonLabel.vue index 8dd3c2b..4636901 100644 --- a/src/views/Label/components/editSonLabel.vue +++ b/src/views/Label/components/editSonLabel.vue @@ -27,7 +27,7 @@ <script> import Pagination from '@/components/Pagination' import waves from '@/directive/waves' -import uploadFile from '../../../components/uploadFile' +import uploadFile from '../../../components/upload-file' export default { components: { uploadFile, Pagination }, diff --git a/src/views/Label/components/selectLable.vue b/src/views/Label/components/selectLable.vue index febcb8e..793604f 100644 --- a/src/views/Label/components/selectLable.vue +++ b/src/views/Label/components/selectLable.vue @@ -56,7 +56,7 @@ <script> import Pagination from '@/components/Pagination' import waves from '@/directive/waves' -import uploadFile from '../../../components/uploadFile' +import uploadFile from '../../../components/upload-file' import { requestFN } from '@/utils/request' import editSonLabel from './editSonLabel' diff --git a/src/views/threeSystems/emergencyPlanManagement/components/editTextLibrary.vue b/src/views/threeSystems/emergencyPlanManagement/components/editTextLibrary.vue index 0e832c0..8b7a881 100644 --- a/src/views/threeSystems/emergencyPlanManagement/components/editTextLibrary.vue +++ b/src/views/threeSystems/emergencyPlanManagement/components/editTextLibrary.vue @@ -45,7 +45,7 @@ import { requestFN } from '@/utils/request' import editLabel from '../../../Label/components/editLabel.vue' import selectType from '../../../util/selectType.vue' import multipleChoice from '../../../util/multipleChoice.vue' -import uploadFile from '../../../../components/uploadFile/index.vue' +import uploadFile from '../../../../components/upload-file/index.vue' import TextEditing from '../../../util/textEditing.vue' export default { diff --git a/src/views/threeSystems/emergencyPlanManagement/components/updateFile.vue b/src/views/threeSystems/emergencyPlanManagement/components/updateFile.vue index ece604f..63cfb6f 100644 --- a/src/views/threeSystems/emergencyPlanManagement/components/updateFile.vue +++ b/src/views/threeSystems/emergencyPlanManagement/components/updateFile.vue @@ -15,7 +15,7 @@ import Pagination from '@/components/Pagination' import waves from '@/directive/waves' import { upload } from '@/utils/upload' -import uploadFile from '../../../../components/uploadFile/index.vue' +import uploadFile from '../../../../components/upload-file/index.vue' export default { components: { Pagination, uploadFile }, diff --git a/src/views/threeSystems/safetyOperationRegulations/components/editTextLibrary.vue b/src/views/threeSystems/safetyOperationRegulations/components/editTextLibrary.vue index a2f4635..22a38ef 100644 --- a/src/views/threeSystems/safetyOperationRegulations/components/editTextLibrary.vue +++ b/src/views/threeSystems/safetyOperationRegulations/components/editTextLibrary.vue @@ -79,7 +79,7 @@ import editLabel from '../../../Label/components/editLabel.vue' import selectLabel from '../../../Label/components/selectLable.vue' import selectType from '../../../util/selectType.vue' import multipleChoice from '../../../util/multipleChoice.vue' -import uploadFile from '../../../../components/uploadFile/index.vue' +import uploadFile from '../../../../components/upload-file/index.vue' import TextEditing from '../../../util/textEditing.vue' export default { diff --git a/src/views/threeSystems/safetyOperationRegulations/components/updateFile.vue b/src/views/threeSystems/safetyOperationRegulations/components/updateFile.vue index ece604f..63cfb6f 100644 --- a/src/views/threeSystems/safetyOperationRegulations/components/updateFile.vue +++ b/src/views/threeSystems/safetyOperationRegulations/components/updateFile.vue @@ -15,7 +15,7 @@ import Pagination from '@/components/Pagination' import waves from '@/directive/waves' import { upload } from '@/utils/upload' -import uploadFile from '../../../../components/uploadFile/index.vue' +import uploadFile from '../../../../components/upload-file/index.vue' export default { components: { Pagination, uploadFile }, diff --git a/src/views/threeSystems/safetyProductionManagementSystem/components/editTextLibrary.vue b/src/views/threeSystems/safetyProductionManagementSystem/components/editTextLibrary.vue index 1263e2c..3bdf4b2 100644 --- a/src/views/threeSystems/safetyProductionManagementSystem/components/editTextLibrary.vue +++ b/src/views/threeSystems/safetyProductionManagementSystem/components/editTextLibrary.vue @@ -59,7 +59,7 @@ import editLabel from '../../../Label/components/editLabel.vue' import selectLabel from '../../../Label/components/selectLable.vue' import selectType from '../../../util/selectType.vue' import multipleChoice from '../../../util/multipleChoice.vue' -import uploadFile from '../../../../components/uploadFile/index.vue' +import uploadFile from '../../../../components/upload-file/index.vue' import TextEditing from '../../../util/textEditing.vue' export default { diff --git a/src/views/threeSystems/safetyProductionManagementSystem/components/updateFile.vue b/src/views/threeSystems/safetyProductionManagementSystem/components/updateFile.vue index ece604f..63cfb6f 100644 --- a/src/views/threeSystems/safetyProductionManagementSystem/components/updateFile.vue +++ b/src/views/threeSystems/safetyProductionManagementSystem/components/updateFile.vue @@ -15,7 +15,7 @@ import Pagination from '@/components/Pagination' import waves from '@/directive/waves' import { upload } from '@/utils/upload' -import uploadFile from '../../../../components/uploadFile/index.vue' +import uploadFile from '../../../../components/upload-file/index.vue' export default { components: { Pagination, uploadFile }, diff --git a/src/views/threeSystems/safetyProductionResponsibilitySystem/components/editTextLibrary.vue b/src/views/threeSystems/safetyProductionResponsibilitySystem/components/editTextLibrary.vue index 9030247..7a40a16 100644 --- a/src/views/threeSystems/safetyProductionResponsibilitySystem/components/editTextLibrary.vue +++ b/src/views/threeSystems/safetyProductionResponsibilitySystem/components/editTextLibrary.vue @@ -59,7 +59,7 @@ import editLabel from '../../../Label/components/editLabel.vue' import selectLabel from '../../../Label/components/selectLable.vue' import selectType from '../../../util/selectType.vue' import multipleChoice from '../../../util/multipleChoice.vue' -import uploadFile from '../../../../components/uploadFile/index.vue' +import uploadFile from '../../../../components/upload-file/index.vue' import TextEditing from '../../../util/textEditing.vue' export default { diff --git a/src/views/threeSystems/safetyProductionResponsibilitySystem/components/updateFile.vue b/src/views/threeSystems/safetyProductionResponsibilitySystem/components/updateFile.vue index ece604f..63cfb6f 100644 --- a/src/views/threeSystems/safetyProductionResponsibilitySystem/components/updateFile.vue +++ b/src/views/threeSystems/safetyProductionResponsibilitySystem/components/updateFile.vue @@ -15,7 +15,7 @@ import Pagination from '@/components/Pagination' import waves from '@/directive/waves' import { upload } from '@/utils/upload' -import uploadFile from '../../../../components/uploadFile/index.vue' +import uploadFile from '../../../../components/upload-file/index.vue' export default { components: { Pagination, uploadFile }, diff --git a/src/views/threeSystems/soLibrary/components/condition.vue b/src/views/threeSystems/soLibrary/components/condition.vue new file mode 100644 index 0000000..c9af125 --- /dev/null +++ b/src/views/threeSystems/soLibrary/components/condition.vue @@ -0,0 +1,188 @@ +<template> + <el-drawer + v-if="visible" + ref="drawer" + :visible.sync="visible" + :before-close="close" + title="搜索条件" + size="50%"> + <div style="margin-left: 30px"> + <el-form ref="form" label-width="200px"> + <el-form-item label="规程属性:" prop="CATEGORY_LIST"> + <multiple-choice :dynamic-tags.sync="form.CATEGORY_LIST" :labels="categoryList" :row-key="key.categoryKey" :row-name="key.categoryName" title="选择"/> + </el-form-item> + <el-form-item label="类型:" prop="TYPES"> + <multiple-choice :dynamic-tags.sync="form.TYPES" :labels="typeList" :row-key="key.typeKey" :row-name="key.typeName" title="选择"/> + </el-form-item> + <el-form-item label="国民经济行业类型:" prop="SPECIFICATION_TYPES"> + <multiple-choice :dynamic-tags.sync="form.SPECIFICATION_TYPES" :labels="industryTypeList" :row-key="key.specificationTypeKey" :row-name="key.specificationTypeName" lazy title="选择"/> + </el-form-item> + <el-form-item label="标签:" prop="LABELS"> + <multiple-choice :dynamic-tags.sync="form.LABELS" :row-key="key.labelsKey" :row-name="key.labelsName" title="选择"/> + </el-form-item> + <el-form-item v-if="false" label="企业:"> + <el-select + v-model="form.CORPINFO_ID" + :remote-method="searchCorp" + :loading="selectLoading" + filterable + remote + reserve-keyword + placeholder="请输入关键词"> + <el-option + v-for="item in corp_list" + :key="item.CORPINFO_ID" + :label="item.CORP_NAME" + :value="item.CORPINFO_ID"/> + </el-select> + </el-form-item> + </el-form> + <div> + <el-button @click="closePanel">取 消</el-button> + <el-button :loading="loading" type="primary" @click="submit">{{ loading ? '提交中 ...' : '确 定' }}</el-button> + </div> + </div> + </el-drawer> +</template> +<script> +import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包 +import waves from '@/directive/waves' // waves directive +import { videoPlayer } from 'vue-video-player' +import 'video.js/dist/video-js.css' +import multipleChoice from '../../../util/multipleChoice.vue' +import { requestFN } from '@/utils/request' +export default { + components: { multipleChoice, Pagination, videoPlayer }, + directives: { waves }, + props: { + haveCorpFlag: { + type: Boolean, + default: false + } + }, + data() { + return { + visible: false, + loading: false, + key: { + typeKey: 'DICTIONARIES_ID', + typeName: 'NAME', + specificationTypeKey: 'DICTIONARIES_ID', + specificationTypeName: 'NAME', + categoryKey: 'DICTIONARIES_ID', + categoryName: 'NAME', + labelsKey: 'BUS_LABEL_FACTORY_ID', + labelsName: 'NAME' + }, + typeList: [], + industryTypeList: [], + categoryList: [], + form: { + CATEGORY_LIST: [''], + TYPES: [''], + SPECIFICATION_TYPES: [''], + LABELS: [''], + CORPINFO_ID: '' + }, + corp_list: [], + selectLoading: false + } + }, + watch: { + filterText(val) { + this.$refs.tree.filter(val) + } + }, + created() { + this.getDic() + }, + methods: { + init(tags) { + this.visible = true + }, + close(done) { + this.$confirm('确认关闭?') + .then(_ => { + this.form = { + CATEGORY_LIST: [''], + TYPES: [''], + SPECIFICATION_TYPES: [''], + LABELS: [''] + } + done() + }) + .catch(e => {}) + }, + closePanel() { + this.visible = false + this.form = { + CATEGORY_LIST: [''], + TYPES: [''], + SPECIFICATION_TYPES: [''], + LABELS: [''] + } + }, + submit() { + this.$emit('getResult', this.form) + this.visible = false + }, + getDic() { + // 安全操作规程类型 + requestFN( + 'dictionaries/getLevels', { DICTIONARIES_ID: 'ca4e4a7597f8485d8be323bd6876c40b' } + ).then((data) => { + this.typeList = data.list + }).catch((e) => { + this.loading = false + }) + // 操作规程行业类型 + requestFN( + 'dictionaries/getLevels', { DICTIONARIES_ID: 'f2598ba72e864eadabf0ca4b664d26b9' } + ).then((data) => { + this.industryTypeList = data.list + }).catch((e) => { + this.loading = false + }) + // 行业类别 + requestFN( + 'dictionaries/getLevels', { DICTIONARIES_ID: '99543742b79b473480617191f7ac256e' } + ).then((data) => { + this.categoryList = data.list + }).catch((e) => { + this.loading = false + }) + }, + clear() { + this.form = { + CATEGORY_LIST: [''], + TYPES: [''], + SPECIFICATION_TYPES: [''], + LABELS: [''], + TTRIBUTE_LIST: [''], + CORPINFO_ID: '' + } + }, + searchCorp(query) { + if (query !== '') { + this.selectLoading = true + requestFN( + 'corpinfo/list', { KEYWORDS: query } + ).then((data) => { + this.corp_list = data.varList + this.selectLoading = false + }).catch((e) => { + console.log(e) + this.selectLoading = false + }) + } + } + } +} + +</script> + +<style scoped> +.information >>> .el-scrollbar__wrap { + overflow-x: hidden; +} +</style> diff --git a/src/views/threeSystems/soLibrary/components/dashboard.vue b/src/views/threeSystems/soLibrary/components/dashboard.vue new file mode 100644 index 0000000..56486f2 --- /dev/null +++ b/src/views/threeSystems/soLibrary/components/dashboard.vue @@ -0,0 +1,38 @@ +<template> + <div class="app-container"> + <el-tabs type="border-card" @tab-click="changTab"> + <el-tab-pane label="安全操作规程平台资源库"> + <list/> + </el-tab-pane> + </el-tabs> + </div> +</template> +<style> +.el-table .warning-row { + background: oldlace; +} +</style> +<script> +import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包 +import waves from '@/directive/waves' +import List from './list.vue' +import ListEm from './listEm.vue' +export default { + components: { List, Pagination, ListEm }, + directives: { waves }, + data() { + return { + vectory: 'listEm' + } + }, + created() { + }, + methods: { + changTab(title) { + console.log(title.label) + if (title.label === '安全操作规程平台资源库') { this.vectory = 'list' } + if (title.label === '安全操作规程') { this.vectory = 'listEm' } + } + } +} +</script> diff --git a/src/views/threeSystems/soLibrary/components/editTextLibrary.vue b/src/views/threeSystems/soLibrary/components/editTextLibrary.vue new file mode 100644 index 0000000..6faae97 --- /dev/null +++ b/src/views/threeSystems/soLibrary/components/editTextLibrary.vue @@ -0,0 +1,392 @@ +<template> + <el-dialog v-loading="loading" v-if="dialogVisible" :visible.sync="dialogVisible" :title="title" destroy-on-close @close="clear" > + <el-form ref="form" :model="form" :rules="rules" label-width="180px"> + <el-form-item v-if="false" label="规程属性:" prop="CATEGORY_LIST"> + <multiple-choice :dynamic-tags.sync="form.CATEGORY_LIST" :labels="categoryList" :row-key="key.categoryKey" :row-name="key.categoryName" :limit="1" @getChooseOne="getChooseOne"/> + </el-form-item> + <el-form-item label="安全操作规程名称:" prop="REMARKS"> + <el-input v-model="form.REMARKS" style="width: 100%"/> + </el-form-item> + <el-form-item label="类型:" prop="TYPES"> + <multiple-choice :dynamic-tags.sync="form.TYPES" :labels="typeList" :row-key="key.typeKey" :row-name="key.typeName"/> + </el-form-item> + <el-form-item v-if="false" label="国民经济行业类型:" prop="SPECIFICATION_TYPES"> + <multiple-choice :dynamic-tags.sync="form.SPECIFICATION_TYPES" :labels="industryTypeList" :row-key="key.specificationTypeKey" :row-name="key.specificationTypeName" lazy/> + </el-form-item> + <el-form-item v-if="false" label="状态:" prop="STATUS"> + <el-select v-model="form.STATUS" placeholder="请选择" style="width: 100%;"> + <el-option label="停用" value="0"/> + <el-option label="启用" value="1"/> + </el-select> + </el-form-item> + <el-form-item v-if="!isEdit" label="文件:" prop="FILE"> + <upload-file :file-list.sync="form.FILE" :limit="1" :file-size="200" append-to-body accept=".pdf"/> + </el-form-item> + <el-form-item v-if="!isEdit" label="添加文件内容:"> + <el-button size="small" type="primary" @click="openTextEdit()">添加文件内容</el-button> + </el-form-item> + <el-form-item v-if="isEdit" label="添加文件内容:"> + <el-button size="small" type="primary" @click="openTextEdit({BUS_TEXT_LIBRARY_ID:form.BUS_TEXT_LIBRARY_ID},true)">查看</el-button> + <el-button size="small" type="primary" @click="openTextEdit({BUS_TEXT_LIBRARY_ID:form.BUS_TEXT_LIBRARY_ID},false)">编辑内容</el-button> + <el-button size="small" type="primary" @click="exportWord({BUS_TEXT_LIBRARY_ID:form.BUS_TEXT_LIBRARY_ID})">导出word</el-button> + </el-form-item> + <el-form-item label="标签:" prop="labels"> + <multiple-choice :dynamic-tags.sync="form.labels" :row-key="key.labelsKey" :row-name="key.labelsName" can-add/> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button @click="goBack">取 消</el-button> + <el-button type="primary" @click="save">确 定</el-button> + </div> + <edit-label ref="editLabel" append-to-body/> + <select-label ref="selectLabel" append-to-body @getResult="getChooseTage"/> + <select-type ref="selectType" :limit="1" append-to-body @getResult="getType"/> + <text-editing ref="textEditing" :disabled="textDisabled" append-to-body title="文本编辑器" @getResult="getText"/> + </el-dialog> +</template> +<script> +import Pagination from '@/components/Pagination' +import waves from '@/directive/waves' +import { upload } from '@/utils/upload' +import { requestFN } from '@/utils/request' +import editLabel from '../../../Label/components/editLabel.vue' +import selectLabel from '../../../Label/components/selectLable.vue' +import selectType from '../../../util/selectType.vue' +import multipleChoice from '../../../util/multipleChoice.vue' +import UploadFile from '../../../../components/upload-file/index.vue' +import TextEditing from '../../../util/textEditing.vue' + +export default { + components: { TextEditing, Pagination, editLabel, selectLabel, selectType, multipleChoice, UploadFile }, + directives: { waves }, + props: { + title: { + type: String, + default: '' + } + }, + data() { + return { + dialogVisible: false, + form: { + REMARKS: '', + FILE: [], + labels: [''], + TYPE: '', + TYPES: [''], + SPECIFICATION_TYPES: [''], + CATEGORY_LIST: [''], + STATUS: '', + ASSOCIATION: '0', + types: [], + specification_types: [], + category_list: [], + TEXT_INFO: '' + }, + key: { + typeKey: 'DICTIONARIES_ID', + typeName: 'NAME', + specificationTypeKey: 'DICTIONARIES_ID', + specificationTypeName: 'NAME', + categoryKey: 'DICTIONARIES_ID', + categoryName: 'NAME', + labelsKey: 'BUS_LABEL_FACTORY_ID', + labelsName: 'NAME' + }, + rules: { + REMARKS: [{ required: true, message: '请输安全操作规程', trigger: 'change' }], + STATUS: [{ required: true, message: '请选择状态', trigger: 'change' }], + FILE: [{ required: true, message: '请选择文件', trigger: 'blur' }], + TYPES: [{ + required: true, + validator: (rules, value, callback) => { + if (!value || value.length === 0 || value[0] === '') { + return callback(new Error('类型必选')) + } + return callback() + }, + trigger: 'blur' + }], + SPECIFICATION_TYPES: [{ + required: true, + validator: (rules, value, callback) => { + if (!value || value.length === 0 || value[0] === '') { + return callback(new Error('操作规程行业类型必选')) + } + return callback() + }, + trigger: 'blur' + }], + CATEGORY_LIST: [{ + required: true, + validator: (rules, value, callback) => { + if (!value || value.length === 0 || value[0] === '') { + return callback(new Error('规程属性必选')) + } + return callback() + }, + trigger: 'blur' + }] + }, + + loading: false, + e: {}, + isEdit: false, + typeList: [], + industryTypeList: [], + categoryList: [], + + remoteControl: { + keyOne: true + }, + textDisabled: false + } + }, + methods: { + init(e) { + this.dialogVisible = true + this.e = e ? e.e : {} + this.isEdit = e ? e.isEdit : false + this.getDic() + if (e) { + this.loading = true + requestFN( + '/textLibrary/goEdit', + { BUS_TEXT_LIBRARY_ID: this.e.BUS_TEXT_LIBRARY_ID } + ).then((data) => { + this.loading = false + this.form = data.data + this.form.FILE = [] + this.form.types = [] + this.form.specification_types = [] + this.form.category_list = [] + + if (!this.form.TYPES || this.form.TYPES.length === 0) this.form.TYPES = [''] + if (!this.form.SPECIFICATION_TYPES || this.form.SPECIFICATION_TYPES.length === 0) this.form.SPECIFICATION_TYPES = [''] + if (!this.form.CATEGORY_LIST || this.form.CATEGORY_LIST.length === 0) this.form.CATEGORY_LIST = [''] + if (!this.form.labels || this.form.labels.length === 0) this.form.labels = [''] + + this.remoteControl.keyOne = !(this.form.CATEGORY_LIST[0].CATEGORY_ID === '8051d985a2bc406a83ea9360b64182b2') + }).catch((e) => { + this.$message.error(e) + this.loading = false + }) + } else { + this.isEdit = false + } + }, + save() { + if (this.checkForm()) { + return + } + this.$refs.form.validate((valid) => { + if (valid) { + const loading = this.$loading({ + lock: true, + text: '上传中...', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) + const formData = new FormData() + if (this.form.TEXT_INFO) this.form.TEXT_INFO = this.form.TEXT_INFO.replaceAll('<img', '<img style="max-width:100%"') + Object.keys(this.form).map(key => { + formData.append(key, this.form[key]) + }) + if (!this.isEdit) { + if (!this.form.FILE || this.form.FILE.length <= 0) { + this.$message.error('请上传文件') + loading.close() + return + } + } + for (let i = 0; i < this.form.FILE.length; i++) { + if (this.form.FILE[i].raw) { + formData.append('FILE', this.form.FILE[i].raw) + } + } + formData.append('labels', JSON.stringify(this.form.labels)) + for (let i = 0; i < this.form.TYPES.length; i++) { + if (this.form.TYPES[i]) { + this.form.types.push({ + CATEGORY: 'TYPES', + CATEGORY_ID: this.form.TYPES[i].DICTIONARIES_ID, + CATEGORY_NAME: this.form.TYPES[i].NAME + }) + } + } + formData.append('TYPES', JSON.stringify(this.form.types)) + for (let i = 0; i < this.form.SPECIFICATION_TYPES.length; i++) { + if (this.form.SPECIFICATION_TYPES[i]) { + this.form.specification_types.push({ + CATEGORY: 'SPECIFICATION_TYPES', + CATEGORY_ID: this.form.SPECIFICATION_TYPES[i].DICTIONARIES_ID, + CATEGORY_NAME: this.form.SPECIFICATION_TYPES[i].NAME + }) + } + } + formData.append('SPECIFICATION_TYPES', JSON.stringify(this.form.specification_types)) + if (!this.form.category_list) this.form.category_list = [] + this.form.category_list.push({ + CATEGORY: 'CATEGORY_LIST', + CATEGORY_ID: '31c2e389f2284ac48d54e85d56528092', + CATEGORY_NAME: '行业专属类' + }) + formData.append('CATEGORY_LIST', JSON.stringify(this.form.category_list)) + upload( + '/textLibrary/init', + formData + ).then((data) => { + loading.close() + this.dialogVisible = false + this.$emit('logical-end', { result: 'OK' }) + this.$message.success('保存成功') + }).catch((e) => { + loading.close() + console.log(e) + }) + this.clear() + } else { + return false + } + }) + }, + checkForm() { + if (this.form.labels.length > 15) { + this.$message.error('关联标签数不能超过15个') + return true + } + }, + goBack() { + this.dialogVisible = false + this.clear() + this.$emit('goBack', this.e) + }, + getChooseTage(e) { + if (e.TYPE === '0') { + const list = e.e + for (const listKey in list) { + const index = this.form.labels.findIndex(item => { + item.BUS_LABEL_FACTORY_ID === list[listKey].BUS_LABEL_FACTORY_ID + }) + if (index < 0) { + const label = JSON.parse(JSON.stringify(list[listKey])) + label.label = label.NAME + label.value = JSON.stringify(list[listKey]) + const index = this.form.labels.findIndex(item => item.value === label.value) + if (index < 0) { + this.form.labels.push(label) + } + } + } + } else { + if (e.e.length > 1) { + this.$message.error('只能选择一个类型') + return + } + this.form.TYPE_NAME = e.e[0].NAME + this.form.TYPE = e.e[0].BUS_LABEL_FACTORY_ID + this.$forceUpdate() + } + }, + getType(e) { + this.form.TYPE = e.info[0].DICTIONARIES_ID + this.form.TYPE_NAME = e.info[0].NAME + }, + clear() { + this.dialogVisible = false + console.log('clear') + this.isEdit = false + this.form = { + REMARKS: '', + FILE: [], + labels: [''], + TYPE: '', + TYPES: [''], + SPECIFICATION_TYPES: [''], + STATUS: '', + ASSOCIATION: '0', + types: [], + specification_types: [] + } + }, + getDic() { + // 安全操作规程类型 + requestFN( + 'dictionaries/getLevels', { DICTIONARIES_ID: 'ca4e4a7597f8485d8be323bd6876c40b' } + ).then((data) => { + this.typeList = data.list + }).catch((e) => { + this.loading = false + }) + // 操作规程行业类型 + requestFN( + 'dictionaries/getLevels', { DICTIONARIES_ID: 'f2598ba72e864eadabf0ca4b664d26b9' } + ).then((data) => { + this.industryTypeList = data.list + }).catch((e) => { + this.loading = false + }) + // 行业类别 + requestFN( + 'dictionaries/getLevels', { DICTIONARIES_ID: '99543742b79b473480617191f7ac256e' } + ).then((data) => { + this.categoryList = data.list + }).catch((e) => { + this.loading = false + }) + }, + getChooseOne(e) { + this.remoteControl.keyOne = !(e && e.info && e.info.DICTIONARIES_ID && e.info.DICTIONARIES_ID === '8051d985a2bc406a83ea9360b64182b2') + }, + openTextEdit(id, textDisabled) { + if (!id) { + this.textDisabled = false + this.$refs.textEditing.init({ text: this.form.TEXT_INFO }) + } else { + this.textDisabled = textDisabled + this.loading = true + requestFN('textLibrary/getTextInfo', id) + .then((data) => { + if (data.info && data.info.TEXT_INFO && data.info.TEXT_INFO !== '') { + this.$refs.textEditing.init({ text: data.info.TEXT_INFO }) + } else { + if (((!this.form.TEXT_INFO) || this.form.TEXT_INFO === '') && this.textDisabled) { + this.$message.error('此数据未维护文件内容') + } else { + this.$refs.textEditing.init({ text: this.form.TEXT_INFO }) + } + } + this.loading = false + }).catch((e) => { + console.log(e) + this.loading = false + }) + } + }, + getText(e) { + this.form.TEXT_INFO = e.text + }, + exportWord(info) { + this.loading = true + requestFN('textLibrary/getTextInfo', info) + .then((data) => { + if (data.info) { + if ((!data.info) || data.info.TEXT_INFO === '') { + this.$message.error('没有文件导出') + } else { + this.$message.success('导出成功') + window.open(config.httpurl + '/textLibrary/exportWord?BUS_TEXT_LIBRARY_ID=' + info.BUS_TEXT_LIBRARY_ID) + } + } else { + this.$message.error('此数据未维护文件内容') + } + this.loading = false + }).catch((e) => { + console.log(e) + this.loading = false + }) + } + } +} + +</script> diff --git a/src/views/threeSystems/soLibrary/components/list.vue b/src/views/threeSystems/soLibrary/components/list.vue new file mode 100644 index 0000000..bbf4709 --- /dev/null +++ b/src/views/threeSystems/soLibrary/components/list.vue @@ -0,0 +1,561 @@ +<template> + <div class="app-container"> + <div class="filter-container"> + <el-form label-width="50px"> + <el-row> + <el-col :span="6"> + <el-form-item label="安全操作规程名称:" label-width="150px"> + <el-input v-model="form.KEYWORDS" placeholder="请输入" class="filter-item"/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label-width="10px"> + <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="getQuery"> + 搜索 + </el-button> + <el-button v-waves class="filter-item" type="success" icon="el-icon-magic-stick" @click="addCondition"> + 添加其他搜索条件 + </el-button> + <el-button v-waves class="filter-item" type="success" icon="el-icon-magic-stick" @click="clearMessage"> + 重置 + </el-button> + </el-form-item> + </el-col> + </el-row> + </el-form> + </div> + <el-table + v-loading="listLoading" + ref="multipleTable" + :row-key="getRowKey" + :data="varList" + :header-cell-style="{ + 'font-weight': 'bold', + 'color': '#000' + }" + :row-class-name="tableRowClassName" + tooltip-effect="dark" + border + fit + highlight-current-row + @cell-mouse-enter="enterSelectionRows" + @cell-mouse-leave="leaveSelectionRows"> + <el-table-column type="expand"> + <template slot-scope="props"> + <div style="text-align: left;padding: 10px;"> + <el-form label-position="left" inline> + <el-form-item label="标签"> + <el-tag + v-for="tag in props.row.labels" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.NAME }} + </el-tag> + </el-form-item> + <el-form-item label="国民经济行业类型"> + <div v-if="(props.row.SPECIFICATION_TYPES && props.row.SPECIFICATION_TYPES.length > 0) && ((!props.row.CATEGORY_LIST) || (!props.row.CATEGORY_LIST[0]) || (props.row.CATEGORY_LIST[0].CATEGORY_ID !== '691346658ed744a1bda2ed3a755f606c')) "> + <el-tag + v-for="tag in props.row.SPECIFICATION_TYPES" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </div> + <div v-else> + <el-tag type="warning">通用</el-tag> + </div> + </el-form-item> + </el-form> + </div> + </template> + </el-table-column> + <el-table-column + v-if="false" + :reserve-selection="true" + type="selection" + width="55" + align="center"/> + <el-table-column type="index" label="序号" width="50" align="center" /> + <el-table-column align="center" prop="REMARKS" label="安全操作规程名称" /> + <el-table-column align="center" prop="TYPES" label="类型" > + <template slot-scope="{row}"> + <el-tag + v-for="tag in row.TYPES" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </template> + </el-table-column> + <el-table-column v-if="false" prop="LABEL" align="center" label="标签" > + <template slot-scope="{row}"> + <el-tag + v-for="tag in row.labels" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.NAME }} + </el-tag> + </template> + </el-table-column> + <el-table-column v-if="false" align="center" prop="SPECIFICATION_TYPES" label="国民经济行业类型" width="300px"> + <template slot-scope="{row}"> + <div v-if="(row.SPECIFICATION_TYPES && row.SPECIFICATION_TYPES.length > 0) && ((!row.CATEGORY_LIST) || (!row.CATEGORY_LIST[0]) || (row.CATEGORY_LIST[0].CATEGORY_ID !== '8051d985a2bc406a83ea9360b64182b2')) "> + <el-tag + v-for="tag in row.SPECIFICATION_TYPES" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </div> + <div v-else> + <el-tag type="warning">通用</el-tag> + </div> + </template> + </el-table-column> + <el-table-column align="center" prop="UPLOAD_TIME" label="上传时间" width="200px"/> + <el-table-column v-if="false" :show-overflow-tooltip="true" align="center" prop="UPLOAD_USER_NAME" width="100px" label="数据来源" > + <template slot-scope="{row}"> + {{ '资源库数据' }} + </template> + </el-table-column> + <el-table-column label="操作" align="center" width="200px"> + <template slot-scope="{row}"> + <el-row> + <el-col :span="14"> + <el-button v-show="!row.LOCKTOOL" type="primary" icon="el-icon-edit" size="mini" @click="handleExport(row)">导出</el-button> + </el-col> + <el-col :span="10"> + <el-button type="primary" icon="el-icon-edit" size="mini" @click="getInformation(row)">查看</el-button> + </el-col> + </el-row> + </template> + </el-table-column> + </el-table> + <div class="page-btn-group"> + <div/> + <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" /> + </div> + <edit-text-library ref="editTextLibrary" :title="title" @logical-end="saveClose"/> + <text-library-info ref="textLibraryInfo"/> + <update-spe-file ref="updateFile"/> + <update-log ref="updateLog"/> + <condition ref="condition" @getResult="getCondition"/> + </div> +</template> +<style> +.el-table .warning-row { + background: oldlace; +} +</style> +<script> +import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包 +import { requestFN } from '@/utils/request' +import waves from '@/directive/waves' +import editTextLibrary from './editTextLibrary.vue' +import textLibraryInfo from './textLibraryInfo.vue' +import updateLog from './updateLog.vue' +import condition from './condition.vue' +import UpdateSpeFile from './updateSpeFile.vue' +export default { + components: { UpdateSpeFile, Pagination, editTextLibrary, textLibraryInfo, updateLog, condition }, + directives: { waves }, + data() { + return { + config: config, + listLoading: true, + add: false, + del: false, + edit: false, + listQuery: { + page: 1, + limit: 10 + }, + total: 0, + form: { + KEYWORDS: '', + labels: [], + CATEGORY_LIST: [], + TYPES: [], + SPECIFICATION_TYPES: [], + STATUS: '' + }, + label_name: '', + + varList: [], + pd: [], + isEdit: false, + isLook: false, + title: '' + } + }, + created() { + this.getList() + }, + methods: { + getRowKey(row) { + return row.BUS_TEXT_LIBRARY_ID + }, + getQuery() { + this.$refs.multipleTable.clearSelection() + this.getList() + }, + addCondition() { + this.$refs.condition.init() + }, + getCondition(info) { + this.form.CATEGORY_LIST = info.CATEGORY_LIST + this.form.TYPES = info.TYPES + this.form.SPECIFICATION_TYPES = info.SPECIFICATION_TYPES + this.form.labels = info.LABELS + }, + clearMessage() { + this.label_name = '' + this.form = { + KEYWORDS: '', + labels: [], + CATEGORY_LIST: [], + TYPES: [], + SPECIFICATION_TYPES: [], + STATUS: '' + } + this.$refs.condition.clear() + this.getList() + }, + getList() { + this.listLoading = true + requestFN( + '/textLibrary/list?showCount=' + this.listQuery.limit + '¤tPage=' + this.listQuery.page, + { + KEYWORDS: this.form.KEYWORDS, + CATEGORY_LIST: JSON.stringify(this.form.CATEGORY_LIST), + TYPES: JSON.stringify(this.form.TYPES), + SPECIFICATION_TYPES: JSON.stringify(this.form.SPECIFICATION_TYPES), + labels: JSON.stringify(this.form.labels), + STATUS: this.form.STATUS, + ASSOCIATION: '0', + CORPINFO_ID: '0', + LIBRARY_FLAG: '1' + } + ).then((data) => { + this.listLoading = false + this.varList = data.varList + this.total = data.page.totalResult + this.hasButton() + this.pd = data.pd + }).catch((e) => { + this.listLoading = false + }) + }, + handleAdd() { + this.title = '新增' + this.$refs.editTextLibrary.init() + }, + handleEdit(e) { + this.title = '编辑' + this.$refs.editTextLibrary.init({ e: e, isEdit: true }) + }, + getInformation(e) { + this.$refs.textLibraryInfo.init({ e: e }) + }, + handleDelete(e) { + this.$confirm('确定要删除吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/delete', + { + BUS_TEXT_LIBRARY_ID: e.BUS_TEXT_LIBRARY_ID + } + ).then((data) => { + if (data.code === '0') { + this.$message({ + message: '删除成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.getList() + } else { + this.listLoading = false + this.$message.error(data.errorMessage) + } + }).catch((e) => { + this.listLoading = false + }) + }).catch((e) => { + console.log(e) + }) + }, + handleLock(e, flag) { + this.$confirm(flag === '1' ? '确定要锁定吗?' : '确定要解锁吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/lock', + { + BUS_TEXT_LIBRARY_ID: e.BUS_TEXT_LIBRARY_ID, + isLock: flag + } + ).then(() => { + this.$message({ + message: '操作成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch((e) => { + console.log(e) + }) + }, + handleTop(e, flag) { + this.$confirm(flag === '1' ? '确定要置顶吗?' : '确定要取消置顶吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/top', + { + BUS_TEXT_LIBRARY_ID: e.BUS_TEXT_LIBRARY_ID, + isTop: flag + } + ).then(() => { + this.$message({ + message: '操作成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch((e) => { + console.log(e) + }) + }, + handleExport(e) { + this.$confirm('确定要导出文件吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + if (e.MIGRATION_FLAG === '1') { + window.open(config.fileUrl + e.PATH) + } else { + window.open(e.PATH) + } + }).catch((e) => { + console.log(e) + }) + }, + batchDel() { + const _selectData = this.$refs.multipleTable.selection + if (_selectData == null || _selectData.length == 0) { + this.$message({ + message: '请选中要删除的项...', + type: 'error' + }) + return false + } + const _ids = _selectData.filter((item, index) => { + return item.LOCKTOOL + }) + if (_ids.length > 0) { + this.$message.error('选中的数据有锁定数据,请重新选择') + return + } + const ids = _selectData.map((item, index) => { + return item.BUS_TEXT_LIBRARY_ID + }).join(',') + + this.$confirm('确定要删除选中的数据吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/deleteAll', + { + DATA_IDS: ids + } + ).then(() => { + this.$message({ + message: '删除成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.$refs.multipleTable.clearSelection() + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch(() => { + }) + }, + hasButton: function() { + var keys = 'textlibraryOne:add,textlibraryOne:del,textlibraryOne:edit,toExcel' + requestFN( + '/head/hasButton', + { + keys: keys + } + ).then((data) => { + this.add = data.textlibraryOnefhadminadd // 新增权限 + this.del = data.textlibraryOnefhadmindel // 删除权限 + this.edit = data.textlibraryOnefhadminedit // 修改权限 + }).catch((e) => { + this.listLoading = false + }) + }, + tableRowClassName({ row, rowIndex }) { + if (row.ISTOPTIME) { + return 'warning-row' + } + }, + saveClose(e) { + this.getList() + }, + openUpdateFile(row) { + this.$refs.updateFile.init(row) + }, + openUpdateLog(row) { + this.$refs.updateLog.init(row) + }, + setStatus(row, status) { + this.listLoading = true + this.$confirm('是否更改状态?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + requestFN( + '/textLibrary/setStatus', + { + BUS_TEXT_LIBRARY_ID: row.BUS_TEXT_LIBRARY_ID, + STATUS: status + } + ).then((data) => { + this.listLoading = false + this.$message({ + type: 'success', + message: '修改成功!' + }) + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消' + }) + this.listLoading = false + }) + }, + handleCopy(row) { + this.$confirm('确定要将此条数据添加到本地', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.copyInfo(row) + }).catch((e) => { + console.log(e) + this.$message({ + type: 'info', + message: '已取消添加' + }) + }) + }, + copyInfo(row) { + requestFN( + '/textLibrary/copyToOperate?showCount=' + this.listQuery.limit + '¤tPage=' + this.listQuery.page, + { BUS_TEXT_LIBRARY_ID: row.BUS_TEXT_LIBRARY_ID } + ).then((data) => { + if (data.code === '0') { + this.$message.success('添加成功') + } else { + this.$message.success('添加失败') + } + }).catch((e) => { + this.$message.success('添加失败') + }) + }, + enterSelectionRows(row, column, cell, event) { + console.log(row, 'row') + if (row.ISTOPTIME) { + this.createTips(event, row, '数据已置顶') + } + }, + leaveSelectionRows(row, column, cell, event) { + if (row.ISTOPTIME) { + this.removeTips(row) + } + }, + createTips(el, row, value) { + const { BUS_TEXT_LIBRARY_ID } = row + const tooltipDom = document.createElement('div') + tooltipDom.style.cssText = ` + display: inline-block; + max-width: 400px; + max-height: 400px; + position: absolute; + top: ${el.clientY + 5}px; + left: ${el.clientX}px; + padding:5px 10px; + overflow: auto; + font-size: 12px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #595959; + background: #fff; + border-radius: 5px; + z-index: 19999; + box-shadow: 0 4px 12px 1px #ccc; + ` + tooltipDom.innerHTML = value + tooltipDom.setAttribute('id', `tooltip-${BUS_TEXT_LIBRARY_ID}`) + // 将浮层插入到body中 + document.body.appendChild(tooltipDom) + }, + removeTips(row) { + console.log(row, 'row') + const { BUS_TEXT_LIBRARY_ID } = row + const tooltipDomLeave = document.querySelectorAll(`#tooltip-${BUS_TEXT_LIBRARY_ID}`) + if (tooltipDomLeave.length) { + tooltipDomLeave.forEach(dom => { + document.body.removeChild(dom) + }) + } + } + } +} +</script> diff --git a/src/views/threeSystems/soLibrary/components/listEm.vue b/src/views/threeSystems/soLibrary/components/listEm.vue new file mode 100644 index 0000000..2e5a16f --- /dev/null +++ b/src/views/threeSystems/soLibrary/components/listEm.vue @@ -0,0 +1,504 @@ +<template> + <div class="app-container"> + <div class="filter-container"> + <el-form label-width="50px"> + <el-row> + <el-col :span="6"> + <el-form-item label="安全操作规程名称:" label-width="150px"> + <el-input v-model="form.KEYWORDS" placeholder="请输入" class="filter-item"/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label-width="10px"> + <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="getQuery"> + 搜索 + </el-button> + <el-button v-waves class="filter-item" type="success" icon="el-icon-magic-stick" @click="addCondition"> + 添加其他搜索条件 + </el-button> + <el-button v-waves class="filter-item" type="success" icon="el-icon-magic-stick" @click="clearMessage"> + 重置 + </el-button> + </el-form-item> + </el-col> + </el-row> + </el-form> + </div> + <el-table + v-loading="listLoading" + ref="multipleTable" + :row-key="getRowKey" + :data="varList" + :header-cell-style="{ + 'font-weight': 'bold', + 'color': '#000' + }" + :row-class-name="tableRowClassName" + tooltip-effect="dark" + border + fit + highlight-current-row + @cell-mouse-enter="enterSelectionRows" + @cell-mouse-leave="leaveSelectionRows"> + <el-table-column + :reserve-selection="true" + type="selection" + width="55" + align="center" + /> + <el-table-column type="index" label="序号" width="50" align="center" /> + <el-table-column align="center" prop="REMARKS" label="安全操作规程名称" /> + <el-table-column align="center" prop="TYPES" label="类型" > + <template slot-scope="{row}"> + <el-tag + v-for="tag in row.TYPES" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </template> + </el-table-column> + <el-table-column prop="LABEL" align="center" label="标签" > + <template slot-scope="{row}"> + <el-tag + v-for="tag in row.labels" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.NAME }} + </el-tag> + </template> + </el-table-column> + <el-table-column align="center" prop="SPECIFICATION_TYPES" label="国民经济行业类型" width="300px"> + <template slot-scope="{row}"> + <div v-if="row.SPECIFICATION_TYPES && row.SPECIFICATION_TYPES.length > 0"> + <el-tag + v-for="tag in row.SPECIFICATION_TYPES" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </div> + <div v-else> + <el-tag type="warning">通用</el-tag> + </div> + </template> + </el-table-column> + <el-table-column align="center" prop="UPLOAD_TIME" label="上传时间" width="90px"/> + <el-table-column v-if="false" :show-overflow-tooltip="true" align="center" prop="UPLOAD_USER_NAME" width="100px" label="数据来源" > + <template slot-scope="{row}"> + {{ !row.CORP_NAME === '' ? '资源库数据' : row.CORP_NAME }} + </template> + </el-table-column> <el-table-column label="操作" align="center" width="200px"> + <template slot-scope="{row}"> + <el-row> + <el-col :span="24" style="padding-bottom: 10px"> + <el-button type="info" icon="el-icon-view" size="mini" @click="getInformation(row)">查看</el-button> + <el-button type="warning" icon="el-icon-printer" size="mini" @click="handleExport(row)">导出</el-button> + </el-col> + <el-col :span="24"> + <el-button v-if="edit" type="primary" icon="el-icon-edit" size="mini" @click="handleEdit(row)">编辑</el-button> + <el-button v-if="del" type="danger" icon="el-icon-delete" size="mini" @click="handleDelete(row)">删除</el-button> + </el-col> + </el-row> + </template> + </el-table-column> + </el-table> + <div class="page-btn-group"> + <div> + <el-button v-if="add" type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button> + </div> + <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" /> + </div> + <edit-text-library ref="editTextLibrary" :title="title" @logical-end="saveClose"/> + <text-library-info ref="textLibraryInfo"/> + <update-spe-file ref="updateFile"/> + <update-log ref="updateLog"/> + <condition ref="condition" have-corp-flag @getResult="getCondition"/> + </div> +</template> +<style> +.el-table .warning-row { + background: oldlace; +} +</style> +<script> +import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包 +import { requestFN } from '@/utils/request' +import waves from '@/directive/waves' +import editTextLibrary from './editTextLibrary.vue' +import textLibraryInfo from './textLibraryInfo.vue' +import updateLog from './updateLog.vue' +import UpdateLog from './updateLog.vue' +import condition from './condition.vue' +import UpdateSpeFile from './updateSpeFile.vue' +export default { + components: { UpdateSpeFile, UpdateLog, Pagination, editTextLibrary, textLibraryInfo, updateLog, condition }, + directives: { waves }, + data() { + return { + config: config, + listLoading: true, + add: false, + del: false, + edit: false, + listQuery: { + page: 1, + limit: 10 + }, + total: 0, + form: { + KEYWORDS: '', + labels: [], + CATEGORY_LIST: [], + TYPES: [], + SPECIFICATION_TYPES: [], + STATUS: '' + }, + label_name: '', + + varList: [], + pd: [], + isEdit: false, + isLook: false, + title: '' + } + }, + created() { + this.getList() + }, + methods: { + getRowKey(row) { + return row.BLACKSPOT_ID + }, + getQuery() { + this.$refs.multipleTable.clearSelection() + this.getList() + }, + addCondition() { + this.$refs.condition.init() + }, + getCondition(info) { + this.form.CATEGORY_LIST = info.CATEGORY_LIST + this.form.TYPES = info.TYPES + this.form.SPECIFICATION_TYPES = info.SPECIFICATION_TYPES + this.form.labels = info.LABELS + this.form.CORPINFO_ID = info.CORPINFO_ID + }, + clearMessage() { + this.label_name = '' + this.form = { + KEYWORDS: '', + labels: [], + CATEGORY_LIST: [], + TYPES: [], + SPECIFICATION_TYPES: [], + STATUS: '' + } + this.$refs.condition.clear() + this.getList() + }, + getList() { + this.listLoading = true + requestFN( + '/textLibrary/list?showCount=' + this.listQuery.limit + '¤tPage=' + this.listQuery.page, + { + KEYWORDS: this.form.KEYWORDS, + CATEGORY_LIST: JSON.stringify(this.form.CATEGORY_LIST), + TYPES: JSON.stringify(this.form.TYPES), + SPECIFICATION_TYPES: JSON.stringify(this.form.SPECIFICATION_TYPES), + labels: JSON.stringify(this.form.labels), + STATUS: this.form.STATUS, + ASSOCIATION: '0', + ENTERPRISE_SIDE: '0', + CORPINFO_ID: this.form.CORPINFO_ID + } + ).then((data) => { + this.listLoading = false + this.varList = data.varList + this.total = data.page.totalResult + this.hasButton() + this.pd = data.pd + }).catch((e) => { + this.listLoading = false + }) + }, + handleAdd() { + this.title = '新增' + this.$refs.editTextLibrary.init() + }, + handleEdit(e) { + this.title = '编辑' + this.$refs.editTextLibrary.init({ e: e, isEdit: true }) + }, + getInformation(e) { + this.$refs.textLibraryInfo.init({ e: e }) + }, + handleDelete(e) { + this.$confirm('确定要删除吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/delete', + { + BUS_TEXT_LIBRARY_ID: e.BUS_TEXT_LIBRARY_ID + } + ).then((data) => { + if (data.code === '0') { + this.$message({ + message: '删除成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.getList() + } else { + this.listLoading = false + this.$message.error(data.errorMessage) + } + }).catch((e) => { + this.listLoading = false + }) + }).catch((e) => { + console.log(e) + }) + }, + handleLock(e, flag) { + this.$confirm(flag === '1' ? '确定要锁定吗?' : '确定要解锁吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/lock', + { + BUS_TEXT_LIBRARY_ID: e.BUS_TEXT_LIBRARY_ID, + isLock: flag + } + ).then(() => { + this.$message({ + message: '操作成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch((e) => { + console.log(e) + }) + }, + handleTop(e, flag) { + this.$confirm(flag === '1' ? '确定要置顶吗?' : '确定要取消置顶吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/top', + { + BUS_TEXT_LIBRARY_ID: e.BUS_TEXT_LIBRARY_ID, + isTop: flag + } + ).then(() => { + this.$message({ + message: '操作成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch((e) => { + console.log(e) + }) + }, + handleExport(e) { + this.$confirm('确定要导出文件吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + if (e.MIGRATION_FLAG === '1') { + window.open(config.fileUrl + e.PATH) + } else { + window.open(e.PATH) + } + }).catch((e) => { + console.log(e) + }) + }, + batchDel() { + const _selectData = this.$refs.multipleTable.selection + if (_selectData == null || _selectData.length == 0) { + this.$message({ + message: '请选中要删除的项...', + type: 'error' + }) + return false + } + const _ids = _selectData.filter((item, index) => { + return item.LOCKTOOL + }) + if (_ids.length > 0) { + this.$message.error('选中的数据有锁定数据,请重新选择') + return + } + const ids = _selectData.map((item, index) => { + return item.BUS_TEXT_LIBRARY_ID + }).join(',') + + this.$confirm('确定要删除选中的数据吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/deleteAll', + { + DATA_IDS: ids + } + ).then(() => { + this.$message({ + message: '删除成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.$refs.multipleTable.clearSelection() + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch(() => { + }) + }, + hasButton: function() { + var keys = 'textlibraryOne:add,textlibraryOne:del,textlibraryOne:edit,toExcel' + requestFN( + '/head/hasButton', + { + keys: keys + } + ).then((data) => { + this.add = data.textlibraryOnefhadminadd // 新增权限 + this.del = data.textlibraryOnefhadmindel // 删除权限 + this.edit = data.textlibraryOnefhadminedit // 修改权限 + }).catch((e) => { + this.listLoading = false + }) + }, + tableRowClassName({ row, rowIndex }) { + if (row.ISTOPTIME) { + return 'warning-row' + } + }, + saveClose(e) { + this.getList() + }, + openUpdateFile(row) { + this.$refs.updateFile.init(row) + }, + openUpdateLog(row) { + this.$refs.updateLog.init(row) + }, + setStatus(row, status) { + this.listLoading = true + this.$confirm('是否更改状态?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + requestFN( + '/textLibrary/setStatus', + { + BUS_TEXT_LIBRARY_ID: row.BUS_TEXT_LIBRARY_ID, + STATUS: status + } + ).then((data) => { + this.listLoading = false + this.$message({ + type: 'success', + message: '修改成功!' + }) + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消' + }) + this.listLoading = false + }) + }, + enterSelectionRows(row, column, cell, event) { + console.log('row', row) + if (row.ISTOPTIME) { + this.createTips(event, row, '数据已置顶') + } + }, + leaveSelectionRows(row, column, cell, event) { + if (row.ISTOPTIME) { + this.removeTips(row) + } + }, + createTips(el, row, value) { + const { BUS_TEXT_LIBRARY_ID } = row + const tooltipDom = document.createElement('div') + tooltipDom.style.cssText = ` + display: inline-block; + max-width: 400px; + max-height: 400px; + position: absolute; + top: ${el.clientY + 5}px; + left: ${el.clientX}px; + padding:5px 10px; + overflow: auto; + font-size: 12px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #595959; + background: #fff; + border-radius: 5px; + z-index: 19999; + box-shadow: 0 4px 12px 1px #ccc; + ` + tooltipDom.innerHTML = value + tooltipDom.setAttribute('id', `tooltip-${BUS_TEXT_LIBRARY_ID}`) + // 将浮层插入到body中 + document.body.appendChild(tooltipDom) + }, + removeTips(row) { + console.log(row, 'row') + const { BUS_TEXT_LIBRARY_ID } = row + const tooltipDomLeave = document.querySelectorAll(`#tooltip-${BUS_TEXT_LIBRARY_ID}`) + if (tooltipDomLeave.length) { + tooltipDomLeave.forEach(dom => { + document.body.removeChild(dom) + }) + } + } + } +} +</script> diff --git a/src/views/threeSystems/soLibrary/components/textLibraryInfo.vue b/src/views/threeSystems/soLibrary/components/textLibraryInfo.vue new file mode 100644 index 0000000..b104a8f --- /dev/null +++ b/src/views/threeSystems/soLibrary/components/textLibraryInfo.vue @@ -0,0 +1,146 @@ +<template> + <el-dialog v-loading="loading" v-if="dialogVisible" :visible.sync="dialogVisible" title="详情"> + <el-form ref="form" :model="form" label-width="180px"> + <el-form-item label="安全操作规程名称:" prop="FILE_NAME"> + <el-input v-model="form.REMARKS" disabled style="width: 70%"/> + </el-form-item> + <el-form-item label="规程属性:" prop="FILE_NAME"> + <el-tag + v-for="tag in form.CATEGORY_LIST" + :key="tag.value" + :disable-transitions="false" + style="margin-right: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </el-form-item> + <el-form-item label="类型:" prop="FILE_NAME"> + <el-tag + v-for="tag in form.TYPES" + :key="tag.value" + :disable-transitions="false" + style="margin-right: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </el-form-item> + <el-form-item v-if="remoteControl.keyOne" label="国民经济行业类型:" prop="FILE_NAME"> + <el-tag v-for="tag in form.SPECIFICATION_TYPES" :key="tag.value" :disable-transitions="false" style="margin-right: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </el-form-item> + <el-form-item label="上传时间:" prop="FILE_NAME"> + <el-input v-model="form.UPLOAD_TIME" disabled style="width: 70%"/> + </el-form-item> + <el-form-item label="上传人:" prop="FILE_NAME"> + <el-input v-model="form.UPLOAD_USER_NAME" disabled style="width: 70%"/> + </el-form-item> + <el-form-item prop="tags" label="标签:"> + <el-tag + v-for="tag in form.labels" + :key="tag.value" + :disable-transitions="false" + style="margin-right: 10px"> + {{ tag.NAME }} + </el-tag> + </el-form-item> + <el-form-item label="文件详情:"> + <el-button size="small" type="primary" @click="openTextEdit({BUS_TEXT_LIBRARY_ID:form.BUS_TEXT_LIBRARY_ID})">查看文件详情</el-button> + <el-button size="small" type="primary" @click="exportWord(form)">导出word</el-button> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button @click="goBack">返 回</el-button> + </div> + <text-editing ref="textEditing" :disabled="true" append-to-body title="文本编辑器"/> + </el-dialog> +</template> +<script> +import Pagination from '@/components/Pagination' +import waves from '@/directive/waves' +import { requestFN } from '@/utils/request' +import TextEditing from '../../../util/textEditing.vue' + +export default { + components: { TextEditing, Pagination }, + directives: { waves }, + data() { + return { + config: config, + dialogVisible: false, + form: { + BUS_TEXT_LIBRARY_ID: '', + FILE_NAME: '', + FILE: [], + TYPE: '', + labels: [], + UPLOAD_TIME: '', + UPLOAD_USER_NAME: '' + }, + loading: false, + remoteControl: { + keyOne: true + } + } + }, + methods: { + init(e) { + this.dialogVisible = true + this.loading = true + this.e = e.e + requestFN( + '/textLibrary/goEdit', + { + BUS_TEXT_LIBRARY_ID: this.e.BUS_TEXT_LIBRARY_ID + } + ).then((data) => { + this.loading = false + this.form = data.data + this.form.FILE = [] + this.remoteControl.keyOne = !(this.form.CATEGORY_LIST[0].CATEGORY_ID === '8051d985a2bc406a83ea9360b64182b2') + }).catch((e) => { + this.$message.error(e) + this.loading = false + }) + }, + goBack() { + this.dialogVisible = false + this.$emit('goBack', this.e) + }, + openTextEdit(id) { + this.loading = true + requestFN('textLibrary/getTextInfo', id) + .then((data) => { + if (data.info && data.info.TEXT_INFO && data.info.TEXT_INFO !== '') { + this.$refs.textEditing.init({ text: data.info.TEXT_INFO }) + } else { + this.$message.error('此数据未维护文件内容') + } + this.loading = false + }).catch((e) => { + console.log(e) + this.loading = false + }) + }, + exportWord(info) { + this.loading = true + requestFN('textLibrary/getTextInfo', info) + .then((data) => { + if (data.info) { + if ((!data.info) || data.info.TEXT_INFO === '') { + this.$message.error('没有文件导出') + } else { + this.$message.success('导出成功') + window.open(config.httpurl + '/textLibrary/exportWord?BUS_TEXT_LIBRARY_ID=' + info.BUS_TEXT_LIBRARY_ID) + } + } else { + this.$message.error('此数据未维护文件内容') + } + this.loading = false + }).catch((e) => { + console.log(e) + this.loading = false + }) + } + } +} + +</script> diff --git a/src/views/threeSystems/soLibrary/components/updateLog.vue b/src/views/threeSystems/soLibrary/components/updateLog.vue new file mode 100644 index 0000000..ee30bd2 --- /dev/null +++ b/src/views/threeSystems/soLibrary/components/updateLog.vue @@ -0,0 +1,55 @@ +<template> + <el-dialog v-loading="loading" v-if="visible" :visible.sync="visible" title="替换"> + <el-table :data="list"> + <el-table-column prop="CREATE_TIME" label="日期"/> + <el-table-column prop="CREATOR_NAME" label="姓名"/> + </el-table> + <div slot="footer" class="dialog-footer"> + <el-button @click="goBack">取 消</el-button> + </div> + </el-dialog> +</template> +<script> +import Pagination from '@/components/Pagination' +import waves from '@/directive/waves' +import { requestFN } from '@/utils/request' + +export default { + components: { Pagination }, + directives: { waves }, + data() { + return { + visible: false, + list: [], + loading: false, + id: '' + } + }, + methods: { + init(e) { + this.visible = true + this.id = e.BUS_TEXT_LIBRARY_ID + this.getList() + }, + goBack() { + this.list = [] + this.visible = false + }, + getList() { + this.loading = true + requestFN( + '/textLibrary/getUpdateLog', + { + BUS_TEXT_LIBRARY_ID: this.id + } + ).then((data) => { + this.loading = false + this.list = data.list + }).catch((e) => { + this.loading = false + }) + } + } +} + +</script> diff --git a/src/views/threeSystems/soLibrary/components/updateSpeFile.vue b/src/views/threeSystems/soLibrary/components/updateSpeFile.vue new file mode 100644 index 0000000..63cfb6f --- /dev/null +++ b/src/views/threeSystems/soLibrary/components/updateSpeFile.vue @@ -0,0 +1,77 @@ +<template> + <el-dialog v-loading="loading" v-if="visible" :visible.sync="visible" title="替换"> + <el-form ref="form" :model="form" :rules="rules" label-width="150px"> + <el-form-item label="文件:" prop="FILE"> + <upload-file :file-list.sync="form.FILE" :limit="1" :file-size="200" append-to-body accept=".pdf"/> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button @click="goBack">取 消</el-button> + <el-button type="primary" @click="save">确 定</el-button> + </div> + </el-dialog> +</template> +<script> +import Pagination from '@/components/Pagination' +import waves from '@/directive/waves' +import { upload } from '@/utils/upload' +import uploadFile from '../../../../components/upload-file/index.vue' + +export default { + components: { Pagination, uploadFile }, + directives: { waves }, + data() { + return { + visible: false, + form: { + FILE: [], + BUS_TEXT_LIBRARY_ID: '' + }, + rules: { + FILE: [{ required: true, message: '请选择文件', trigger: 'blur' }] + }, + loading: false + } + }, + methods: { + init(e) { + this.visible = true + this.form.BUS_TEXT_LIBRARY_ID = e.BUS_TEXT_LIBRARY_ID + }, + goBack() { + this.form = { + FILE: [], + BUS_TEXT_LIBRARY_ID: '' + } + this.visible = false + }, + save() { + const loading = this.$loading({ + lock: true, + text: '上传中...', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) + const formData = new FormData() + for (let i = 0; i < this.form.FILE.length; i++) { + if (this.form.FILE[i].raw) { + formData.append('FILE', this.form.FILE[i].raw) + } + } + formData.append('BUS_TEXT_LIBRARY_ID', this.form.BUS_TEXT_LIBRARY_ID) + upload( + '/textLibrary/updateFile', + formData + ).then((data) => { + loading.close() + this.visible = false + this.$emit('logical-end', { result: 'OK' }) + }).catch((e) => { + loading.close() + console.log(e) + }) + } + } +} + +</script> diff --git a/src/views/threeSystems/soLibrary/index.vue b/src/views/threeSystems/soLibrary/index.vue new file mode 100644 index 0000000..8d78561 --- /dev/null +++ b/src/views/threeSystems/soLibrary/index.vue @@ -0,0 +1,19 @@ +<template> + <div> + <List v-if="activeName==='List'" ref="list" /> + <Dashboard v-if="activeName==='Dashboard'" ref="Dashboard"/> + </div> +</template> +<script> +import List from './components/list.vue' +import Dashboard from './components/dashboard.vue' +export default { + components: { List, Dashboard }, + data() { + return { + activeName: 'Dashboard' + } + } +} + +</script> diff --git a/src/views/threeSystems/spmLibrary/components/condition.vue b/src/views/threeSystems/spmLibrary/components/condition.vue new file mode 100644 index 0000000..051c13e --- /dev/null +++ b/src/views/threeSystems/spmLibrary/components/condition.vue @@ -0,0 +1,188 @@ +<template> + <el-drawer + v-if="visible" + ref="drawer" + :visible.sync="visible" + :before-close="close" + title="搜索条件" + size="50%"> + <div style="margin-left: 30px"> + <el-form ref="form" label-width="200px"> + <el-form-item label="规程属性:" prop="CATEGORY_LIST"> + <multiple-choice :dynamic-tags.sync="form.CATEGORY_LIST" :labels="categoryList" :row-key="key.categoryKey" :row-name="key.categoryName" title="选择"/> + </el-form-item> + <el-form-item label="类型:" prop="TYPES"> + <multiple-choice :dynamic-tags.sync="form.TYPES" :labels="typeList" :row-key="key.typeKey" :row-name="key.typeName" title="选择"/> + </el-form-item> + <el-form-item label="国民经济行业类型:" prop="SPECIFICATION_TYPES"> + <multiple-choice :dynamic-tags.sync="form.SPECIFICATION_TYPES" :labels="industryTypeList" :row-key="key.specificationTypeKey" :row-name="key.specificationTypeName" lazy title="选择"/> + </el-form-item> + <el-form-item label="标签:" prop="LABELS"> + <multiple-choice :dynamic-tags.sync="form.LABELS" :row-key="key.labelsKey" :row-name="key.labelsName" title="选择"/> + </el-form-item> + <el-form-item v-if="false" label="企业:"> + <el-select + v-model="form.CORPINFO_ID" + :remote-method="searchCorp" + :loading="selectLoading" + filterable + remote + reserve-keyword + placeholder="请输入关键词"> + <el-option + v-for="item in corp_list" + :key="item.CORPINFO_ID" + :label="item.CORP_NAME" + :value="item.CORPINFO_ID"/> + </el-select> + </el-form-item> + </el-form> + <div> + <el-button @click="closePanel">取 消</el-button> + <el-button :loading="loading" type="primary" @click="submit">{{ loading ? '提交中 ...' : '确 定' }}</el-button> + </div> + </div> + </el-drawer> +</template> +<script> +import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包 +import waves from '@/directive/waves' // waves directive +import { videoPlayer } from 'vue-video-player' +import 'video.js/dist/video-js.css' +import multipleChoice from '../../../util/multipleChoice.vue' +import { requestFN } from '@/utils/request' +export default { + components: { multipleChoice, Pagination, videoPlayer }, + directives: { waves }, + props: { + haveCorpFlag: { + type: Boolean, + default: false + } + }, + data() { + return { + visible: false, + loading: false, + key: { + typeKey: 'DICTIONARIES_ID', + typeName: 'NAME', + specificationTypeKey: 'DICTIONARIES_ID', + specificationTypeName: 'NAME', + categoryKey: 'DICTIONARIES_ID', + categoryName: 'NAME', + labelsKey: 'BUS_LABEL_FACTORY_ID', + labelsName: 'NAME' + }, + typeList: [], + industryTypeList: [], + categoryList: [], + form: { + CATEGORY_LIST: [''], + TYPES: [''], + SPECIFICATION_TYPES: [''], + LABELS: [''], + CORPINFO_ID: '' + }, + corp_list: [], + selectLoading: false + } + }, + watch: { + filterText(val) { + this.$refs.tree.filter(val) + } + }, + created() { + this.getDic() + }, + methods: { + init(tags) { + this.visible = true + }, + close(done) { + this.$confirm('确认关闭?') + .then(_ => { + this.form = { + CATEGORY_LIST: [''], + TYPES: [''], + SPECIFICATION_TYPES: [''], + LABELS: [''] + } + done() + }) + .catch(e => {}) + }, + closePanel() { + this.visible = false + this.form = { + CATEGORY_LIST: [''], + TYPES: [''], + SPECIFICATION_TYPES: [''], + LABELS: [''] + } + }, + submit() { + this.$emit('getResult', this.form) + this.visible = false + }, + getDic() { + // 安全生产基础类型 + requestFN( + 'dictionaries/getLevels', { DICTIONARIES_ID: '675ed73a7d7d42a488491f6e0e9c8fd5' } + ).then((data) => { + this.typeList = data.list + }).catch((e) => { + this.loading = false + }) + // 安全生产类型 + requestFN( + 'dictionaries/getLevels', { DICTIONARIES_ID: 'f2598ba72e864eadabf0ca4b664d26b9' } + ).then((data) => { + this.industryTypeList = data.list + }).catch((e) => { + this.loading = false + }) + // 行业类别 + requestFN( + 'dictionaries/getLevels', { DICTIONARIES_ID: 'c35e6f7ea1b844e7946b2f78e1cc3907' } + ).then((data) => { + this.categoryList = data.list + }).catch((e) => { + this.loading = false + }) + }, + clear() { + this.form = { + CATEGORY_LIST: [''], + TYPES: [''], + SPECIFICATION_TYPES: [''], + LABELS: [''], + TTRIBUTE_LIST: [''], + CORPINFO_ID: '' + } + }, + searchCorp(query) { + if (query !== '') { + this.selectLoading = true + requestFN( + 'corpinfo/list', { KEYWORDS: query } + ).then((data) => { + this.corp_list = data.varList + this.selectLoading = false + }).catch((e) => { + console.log(e) + this.selectLoading = false + }) + } + } + } +} + +</script> + +<style scoped> +.information >>> .el-scrollbar__wrap { + overflow-x: hidden; +} +</style> diff --git a/src/views/threeSystems/spmLibrary/components/dashboard.vue b/src/views/threeSystems/spmLibrary/components/dashboard.vue new file mode 100644 index 0000000..f9b3596 --- /dev/null +++ b/src/views/threeSystems/spmLibrary/components/dashboard.vue @@ -0,0 +1,38 @@ +<template> + <div class="app-container"> + <el-tabs type="border-card" @tab-click="changTab"> + <el-tab-pane label="安全生产管理制度平台资源库"> + <list/> + </el-tab-pane> + </el-tabs> + </div> +</template> +<style> +.el-table .warning-row { + background: oldlace; +} +</style> +<script> +import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包 +import waves from '@/directive/waves' +import List from './list.vue' +import ListEm from './listEm.vue' +export default { + components: { List, Pagination, ListEm }, + directives: { waves }, + data() { + return { + vectory: 'listEm' + } + }, + created() { + }, + methods: { + changTab(title) { + console.log(title.label) + if (title.label === '安全生产管理制度平台资源库') { this.vectory = 'list' } + if (title.label === '安全生产管理制度') { this.vectory = 'listEm' } + } + } +} +</script> diff --git a/src/views/threeSystems/spmLibrary/components/editTextLibrary.vue b/src/views/threeSystems/spmLibrary/components/editTextLibrary.vue new file mode 100644 index 0000000..590cc93 --- /dev/null +++ b/src/views/threeSystems/spmLibrary/components/editTextLibrary.vue @@ -0,0 +1,390 @@ +<template> + <el-dialog v-loading="loading" v-if="dialogVisible" :visible.sync="dialogVisible" :title="title" destroy-on-close @close="clear"> + <el-form ref="form" :model="form" :rules="rules" label-width="180px"> + <el-form-item v-if="false" label="规程属性:" prop="CATEGORY_LIST"> + <multiple-choice :dynamic-tags.sync="form.CATEGORY_LIST" :labels="categoryList" :row-key="key.categoryKey" :row-name="key.categoryName" :limit="1" @getChooseOne="getChooseOne"/> + </el-form-item> + <el-form-item label="安全管理制度名称:" prop="REMARKS"> + <el-input v-model="form.REMARKS" style="width: 100%"/> + </el-form-item> + <el-form-item label="类型:" prop="TYPES"> + <multiple-choice :dynamic-tags.sync="form.TYPES" :labels="typeList" :row-key="key.typeKey" :row-name="key.typeName"/> + </el-form-item> + <el-form-item v-if="false" label="国民经济行业类型:" prop="SPECIFICATION_TYPES"> + <multiple-choice :dynamic-tags.sync="form.SPECIFICATION_TYPES" :labels="industryTypeList" :row-key="key.specificationTypeKey" :row-name="key.specificationTypeName" lazy/> + </el-form-item> + <el-form-item v-if="false" label="状态:" prop="STATUS"> + <el-select v-model="form.STATUS" placeholder="请选择" style="width: 100%;"> + <el-option label="停用" value="0"/> + <el-option label="启用" value="1"/> + </el-select> + </el-form-item> + <el-form-item v-if="!isEdit" label="文件:" prop="FILE"> + <upload-file :file-list.sync="form.FILE" :limit="1" :file-size="200" append-to-body accept=".pdf"/> + </el-form-item> + <el-form-item v-if="!isEdit" label="添加文件内容:"> + <el-button size="small" type="primary" @click="openTextEdit()">添加文件内容</el-button> + </el-form-item> + <el-form-item v-if="isEdit" label="添加文件内容:"> + <el-button size="small" type="primary" @click="openTextEdit({BUS_TEXT_LIBRARY_ID:form.BUS_TEXT_LIBRARY_ID},true)">查看</el-button> + <el-button size="small" type="primary" @click="openTextEdit({BUS_TEXT_LIBRARY_ID:form.BUS_TEXT_LIBRARY_ID},false)">编辑内容</el-button> + <el-button size="small" type="primary" @click="exportWord({BUS_TEXT_LIBRARY_ID:form.BUS_TEXT_LIBRARY_ID})">导出word</el-button> + </el-form-item> + <el-form-item label="标签:" prop="labels"> + <multiple-choice :dynamic-tags.sync="form.labels" :row-key="key.labelsKey" :row-name="key.labelsName" can-add/> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button @click="goBack">取 消</el-button> + <el-button type="primary" @click="save">确 定</el-button> + </div> + <edit-label ref="editLabel" append-to-body/> + <select-label ref="selectLabel" append-to-body @getResult="getChooseTage"/> + <select-type ref="selectType" :limit="1" append-to-body @getResult="getType"/> + <text-editing ref="textEditing" :disabled="textDisabled" append-to-body title="文本编辑器" @getResult="getText"/> + </el-dialog> +</template> +<script> +import Pagination from '@/components/Pagination' +import waves from '@/directive/waves' +import { upload } from '@/utils/upload' +import { requestFN } from '@/utils/request' +import editLabel from '../../../Label/components/editLabel.vue' +import selectLabel from '../../../Label/components/selectLable.vue' +import selectType from '../../../util/selectType.vue' +import multipleChoice from '../../../util/multipleChoice.vue' +import UploadFile from '../../../../components/upload-file/index.vue' +import TextEditing from '../../../util/textEditing.vue' + +export default { + components: { TextEditing, Pagination, editLabel, selectLabel, selectType, multipleChoice, UploadFile }, + directives: { waves }, + props: { + title: { + type: String, + default: '' + } + }, + data() { + return { + dialogVisible: false, + form: { + REMARKS: '', + FILE: [], + labels: [''], + TYPE: '', + TYPES: [''], + SPECIFICATION_TYPES: [''], + CATEGORY_LIST: [''], + STATUS: '', + ASSOCIATION: '1', + types: [], + specification_types: [], + category_list: [], + TEXT_INFO: '' + }, + key: { + typeKey: 'DICTIONARIES_ID', + typeName: 'NAME', + specificationTypeKey: 'DICTIONARIES_ID', + specificationTypeName: 'NAME', + categoryKey: 'DICTIONARIES_ID', + categoryName: 'NAME', + labelsKey: 'BUS_LABEL_FACTORY_ID', + labelsName: 'NAME' + }, + rules: { + REMARKS: [{ required: true, message: '请输安全操作规程', trigger: 'change' }], + STATUS: [{ required: true, message: '请选择状态', trigger: 'change' }], + FILE: [{ required: true, message: '请选择文件', trigger: 'blur' }], + TYPES: [{ + required: true, + validator: (rules, value, callback) => { + if (!value || value.length === 0 || value[0] === '') { + return callback(new Error('类型必选')) + } + return callback() + }, + trigger: 'blur' + }], + SPECIFICATION_TYPES: [{ + required: true, + validator: (rules, value, callback) => { + if (!value || value.length === 0 || value[0] === '') { + return callback(new Error('操作规程行业类型必选')) + } + return callback() + }, + trigger: 'blur' + }], + CATEGORY_LIST: [{ + required: true, + validator: (rules, value, callback) => { + if (!value || value.length === 0 || value[0] === '') { + return callback(new Error('规程属性必选')) + } + return callback() + }, + trigger: 'blur' + }] + }, + + loading: false, + e: {}, + isEdit: false, + typeList: [], + industryTypeList: [], + categoryList: [], + + remoteControl: { + keyOne: true + }, + textDisabled: false + } + }, + methods: { + init(e) { + this.dialogVisible = true + this.e = e ? e.e : {} + this.isEdit = e ? e.isEdit : false + this.getDic() + if (e) { + this.loading = true + requestFN( + '/textLibrary/goEdit', + { BUS_TEXT_LIBRARY_ID: this.e.BUS_TEXT_LIBRARY_ID } + ).then((data) => { + this.loading = false + this.form = data.data + this.form.FILE = [] + this.form.types = [] + this.form.specification_types = [] + this.form.category_list = [] + + if (!this.form.TYPES || this.form.TYPES.length === 0) this.form.TYPES = [''] + if (!this.form.SPECIFICATION_TYPES || this.form.SPECIFICATION_TYPES.length === 0) this.form.SPECIFICATION_TYPES = [''] + if (!this.form.CATEGORY_LIST || this.form.CATEGORY_LIST.length === 0) this.form.CATEGORY_LIST = [''] + if (!this.form.labels || this.form.labels.length === 0) this.form.labels = [''] + + this.remoteControl.keyOne = !(this.form.CATEGORY_LIST[0].CATEGORY_ID === '691346658ed744a1bda2ed3a755f606c') + }).catch((e) => { + this.$message.error(e) + this.loading = false + }) + } else { + this.isEdit = false + } + }, + save() { + if (this.checkForm()) { + return + } + this.$refs.form.validate((valid) => { + if (valid) { + const loading = this.$loading({ + lock: true, + text: '上传中...', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) + const formData = new FormData() + if (this.form.TEXT_INFO) this.form.TEXT_INFO = this.form.TEXT_INFO.replaceAll('<img', '<img style="max-width:100%"') + Object.keys(this.form).map(key => { + formData.append(key, this.form[key]) + }) + if (!this.isEdit) { + if (!this.form.FILE || this.form.FILE.length <= 0) { + this.$message.error('请上传文件') + loading.close() + return + } + } + for (let i = 0; i < this.form.FILE.length; i++) { + if (this.form.FILE[i].raw) { + formData.append('FILE', this.form.FILE[i].raw) + } + } + formData.append('labels', JSON.stringify(this.form.labels)) + for (let i = 0; i < this.form.TYPES.length; i++) { + if (this.form.TYPES[i]) { + this.form.types.push({ + CATEGORY: 'TYPES', + CATEGORY_ID: this.form.TYPES[i].DICTIONARIES_ID, + CATEGORY_NAME: this.form.TYPES[i].NAME + }) + } + } + formData.append('TYPES', JSON.stringify(this.form.types)) + for (let i = 0; i < this.form.SPECIFICATION_TYPES.length; i++) { + if (this.form.SPECIFICATION_TYPES[i]) { + this.form.specification_types.push({ + CATEGORY: 'SPECIFICATION_TYPES', + CATEGORY_ID: this.form.SPECIFICATION_TYPES[i].DICTIONARIES_ID, + CATEGORY_NAME: this.form.SPECIFICATION_TYPES[i].NAME + }) + } + } + formData.append('SPECIFICATION_TYPES', JSON.stringify(this.form.specification_types)) + if (!this.form.category_list) this.form.category_list = [] + this.form.category_list.push({ + CATEGORY: 'CATEGORY_LIST', + CATEGORY_ID: '0ac08f29beec46bd93956afec058e189', + CATEGORY_NAME: '行业专属类' + }) + formData.append('CATEGORY_LIST', JSON.stringify(this.form.category_list)) + upload( + '/textLibrary/init', + formData + ).then((data) => { + loading.close() + this.dialogVisible = false + this.$emit('logical-end', { result: 'OK' }) + this.$message.success('保存成功') + }).catch((e) => { + loading.close() + console.log(e) + }) + this.clear() + } else { + return false + } + }) + }, + checkForm() { + if (this.form.labels.length > 15) { + this.$message.error('关联标签数不能超过15个') + return true + } + }, + goBack() { + this.dialogVisible = false + this.clear() + this.$emit('goBack', this.e) + }, + getChooseTage(e) { + if (e.TYPE === '0') { + const list = e.e + for (const listKey in list) { + const index = this.form.labels.findIndex(item => { + item.BUS_LABEL_FACTORY_ID === list[listKey].BUS_LABEL_FACTORY_ID + }) + if (index < 0) { + const label = JSON.parse(JSON.stringify(list[listKey])) + label.label = label.NAME + label.value = JSON.stringify(list[listKey]) + const index = this.form.labels.findIndex(item => item.value === label.value) + if (index < 0) { + this.form.labels.push(label) + } + } + } + } else { + if (e.e.length > 1) { + this.$message.error('只能选择一个类型') + return + } + this.form.TYPE_NAME = e.e[0].NAME + this.form.TYPE = e.e[0].BUS_LABEL_FACTORY_ID + this.$forceUpdate() + } + }, + getType(e) { + this.form.TYPE = e.info[0].DICTIONARIES_ID + this.form.TYPE_NAME = e.info[0].NAME + }, + clear() { + this.isEdit = false + this.form = { + REMARKS: '', + FILE: [], + labels: [''], + TYPE: '', + TYPES: [''], + SPECIFICATION_TYPES: [''], + STATUS: '', + ASSOCIATION: '1', + types: [], + specification_types: [] + } + }, + getDic() { + // 安全操作规程类型 + requestFN( + 'dictionaries/getLevels', { DICTIONARIES_ID: '675ed73a7d7d42a488491f6e0e9c8fd5' } + ).then((data) => { + this.typeList = data.list + }).catch((e) => { + this.loading = false + }) + // 操作规程行业类型 + requestFN( + 'dictionaries/getLevels', { DICTIONARIES_ID: 'f2598ba72e864eadabf0ca4b664d26b9' } + ).then((data) => { + this.industryTypeList = data.list + }).catch((e) => { + this.loading = false + }) + // 行业类别 + requestFN( + 'dictionaries/getLevels', { DICTIONARIES_ID: 'c35e6f7ea1b844e7946b2f78e1cc3907' } + ).then((data) => { + this.categoryList = data.list + }).catch((e) => { + this.loading = false + }) + }, + getChooseOne(e) { + this.remoteControl.keyOne = !(e && e.info && e.info.DICTIONARIES_ID && e.info.DICTIONARIES_ID === '691346658ed744a1bda2ed3a755f606c') + }, + openTextEdit(id, textDisabled) { + if (!id) { + this.textDisabled = false + this.$refs.textEditing.init({ text: this.form.TEXT_INFO }) + } else { + this.textDisabled = textDisabled + this.loading = true + requestFN('textLibrary/getTextInfo', id) + .then((data) => { + if (data.info && data.info.TEXT_INFO && data.info.TEXT_INFO !== '') { + this.$refs.textEditing.init({ text: data.info.TEXT_INFO }) + } else { + if (((!this.form.TEXT_INFO) || this.form.TEXT_INFO === '') && this.textDisabled) { + this.$message.error('此数据未维护文件内容') + } else { + this.$refs.textEditing.init({ text: this.form.TEXT_INFO }) + } + } + this.loading = false + }).catch((e) => { + console.log(e) + this.loading = false + }) + } + }, + getText(e) { + this.form.TEXT_INFO = e.text + }, + exportWord(info) { + this.loading = true + requestFN('textLibrary/getTextInfo', info) + .then((data) => { + if (data.info) { + if ((!data.info) || data.info.TEXT_INFO === '') { + this.$message.error('没有文件导出') + } else { + this.$message.success('导出成功') + window.open(config.httpurl + '/textLibrary/exportWord?BUS_TEXT_LIBRARY_ID=' + info.BUS_TEXT_LIBRARY_ID) + } + } else { + this.$message.error('此数据未维护文件内容') + } + this.loading = false + }).catch((e) => { + console.log(e) + this.loading = false + }) + } + } +} + +</script> diff --git a/src/views/threeSystems/spmLibrary/components/list.vue b/src/views/threeSystems/spmLibrary/components/list.vue new file mode 100644 index 0000000..a3f8660 --- /dev/null +++ b/src/views/threeSystems/spmLibrary/components/list.vue @@ -0,0 +1,562 @@ +<template> + <div class="app-container"> + <div class="filter-container"> + <el-form label-width="50px"> + <el-row> + <el-col :span="6"> + <el-form-item label="安全生产管理制度名称:" label-width="200px"> + <el-input v-model="form.KEYWORDS" placeholder="请输入" class="filter-item"/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label-width="10px"> + <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="getQuery"> + 搜索 + </el-button> + <el-button v-waves class="filter-item" type="success" icon="el-icon-magic-stick" @click="addCondition"> + 添加其他搜索条件 + </el-button> + <el-button v-waves class="filter-item" type="success" icon="el-icon-magic-stick" @click="clearMessage"> + 重置 + </el-button> + </el-form-item> + </el-col> + </el-row> + </el-form> + </div> + <el-table + v-loading="listLoading" + ref="multipleTable" + :row-key="getRowKey" + :data="varList" + :header-cell-style="{ + 'font-weight': 'bold', + 'color': '#000' + }" + :row-class-name="tableRowClassName" + tooltip-effect="dark" + border + fit + highlight-current-row + @cell-mouse-enter="enterSelectionRows" + @cell-mouse-leave="leaveSelectionRows"> + <el-table-column + v-if="false" + :reserve-selection="true" + type="selection" + width="55" + align="center" + /> + <el-table-column type="expand"> + <template slot-scope="props"> + <div style="text-align: left;padding: 10px;"> + <el-form label-position="left" inline> + <el-form-item label="标签"> + <el-tag + v-for="tag in props.row.labels" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.NAME }} + </el-tag> + </el-form-item> + <el-form-item label="国民经济行业类型"> + <div v-if="(props.row.SPECIFICATION_TYPES && props.row.SPECIFICATION_TYPES.length > 0) && ((!props.row.CATEGORY_LIST) || (!props.row.CATEGORY_LIST[0]) || (props.row.CATEGORY_LIST[0].CATEGORY_ID !== '691346658ed744a1bda2ed3a755f606c')) "> + <el-tag + v-for="tag in props.row.SPECIFICATION_TYPES" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </div> + <div v-else> + <el-tag type="warning">通用</el-tag> + </div> + </el-form-item> + </el-form> + </div> + </template> + </el-table-column> + <el-table-column type="index" label="序号" width="50" align="center" /> + <el-table-column align="center" prop="REMARKS" label="安全生产管理制度名称" /> + <el-table-column align="center" prop="TYPES" label="类型" > + <template slot-scope="{row}"> + <el-tag + v-for="tag in row.TYPES" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </template> + </el-table-column> + <el-table-column v-if="false" prop="LABEL" align="center" label="标签" > + <template slot-scope="{row}"> + <el-tag + v-for="tag in row.labels" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.NAME }} + </el-tag> + </template> + </el-table-column> + <el-table-column v-if="false" align="center" prop="SPECIFICATION_TYPES" label="国民经济行业类型" width="300px"> + <template slot-scope="{row}"> + <div v-if="(row.SPECIFICATION_TYPES && row.SPECIFICATION_TYPES.length > 0) && ((!row.CATEGORY_LIST) || (!row.CATEGORY_LIST[0]) || (row.CATEGORY_LIST[0].CATEGORY_ID !== '691346658ed744a1bda2ed3a755f606c')) "> + <el-tag + v-for="tag in row.SPECIFICATION_TYPES" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </div> + <div v-else> + <el-tag type="warning">通用</el-tag> + </div> + </template> + </el-table-column> + <el-table-column align="center" prop="UPLOAD_TIME" label="上传时间" width="200px"/> + <el-table-column v-if="false" :show-overflow-tooltip="true" align="center" prop="UPLOAD_USER_NAME" width="100px" label="数据来源" > + <template slot-scope="{row}"> + {{ '资源库数据' }} + </template> + </el-table-column> + <el-table-column label="操作" align="center" width="200px"> + <template slot-scope="{row}"> + <el-row> + <el-col :span="14"> + <el-button v-show="!row.LOCKTOOL" type="primary" icon="el-icon-edit" size="mini" @click="handleExport(row)">导出</el-button> + </el-col> + <el-col :span="10"> + <el-button type="primary" icon="el-icon-edit" size="mini" @click="getInformation(row)">查看</el-button> + </el-col> + </el-row> + </template> + </el-table-column> + </el-table> + <div class="page-btn-group"> + <div/> + <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" /> + </div> + <edit-text-library ref="editTextLibrary" :title="title" @logical-end="saveClose"/> + <text-library-info ref="textLibraryInfo"/> + <update-spe-file ref="updateFile"/> + <update-log ref="updateLog"/> + <condition ref="condition" @getResult="getCondition"/> + </div> +</template> +<style> +.el-table .warning-row { + background: oldlace; +} +</style> +<script> +import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包 +import { requestFN } from '@/utils/request' +import waves from '@/directive/waves' +import editTextLibrary from './editTextLibrary.vue' +import textLibraryInfo from './textLibraryInfo.vue' +import updateFile from './updateSpeFile.vue' +import updateLog from './updateLog.vue' +import condition from './condition.vue' +import UpdateSpeFile from './updateSpeFile.vue' +export default { + components: { UpdateSpeFile, Pagination, editTextLibrary, textLibraryInfo, updateFile, updateLog, condition }, + directives: { waves }, + data() { + return { + config: config, + listLoading: true, + add: false, + del: false, + edit: false, + listQuery: { + page: 1, + limit: 10 + }, + total: 0, + form: { + KEYWORDS: '', + labels: [], + CATEGORY_LIST: [], + TYPES: [], + SPECIFICATION_TYPES: [], + STATUS: '' + }, + label_name: '', + + varList: [], + pd: [], + isEdit: false, + isLook: false, + title: '' + } + }, + created() { + this.getList() + }, + methods: { + getRowKey(row) { + return row.BUS_TEXT_LIBRARY_ID + }, + getQuery() { + this.$refs.multipleTable.clearSelection() + this.getList() + }, + addCondition() { + this.$refs.condition.init() + }, + getCondition(info) { + this.form.CATEGORY_LIST = info.CATEGORY_LIST + this.form.TYPES = info.TYPES + this.form.SPECIFICATION_TYPES = info.SPECIFICATION_TYPES + this.form.labels = info.LABELS + }, + clearMessage() { + this.label_name = '' + this.form = { + KEYWORDS: '', + labels: [], + CATEGORY_LIST: [], + TYPES: [], + SPECIFICATION_TYPES: [], + STATUS: '' + } + this.$refs.condition.clear() + this.getList() + }, + getList() { + this.listLoading = true + requestFN( + '/textLibrary/list?showCount=' + this.listQuery.limit + '¤tPage=' + this.listQuery.page, + { + KEYWORDS: this.form.KEYWORDS, + CATEGORY_LIST: JSON.stringify(this.form.CATEGORY_LIST), + TYPES: JSON.stringify(this.form.TYPES), + SPECIFICATION_TYPES: JSON.stringify(this.form.SPECIFICATION_TYPES), + labels: JSON.stringify(this.form.labels), + STATUS: this.form.STATUS, + ASSOCIATION: '1', + CORPINFO_ID: '0', + LIBRARY_FLAG: '1' + } + ).then((data) => { + this.listLoading = false + this.varList = data.varList + this.total = data.page.totalResult + this.hasButton() + this.pd = data.pd + }).catch((e) => { + this.listLoading = false + }) + }, + handleAdd() { + this.title = '新增' + this.$refs.editTextLibrary.init() + }, + handleEdit(e) { + this.title = '编辑' + this.$refs.editTextLibrary.init({ e: e, isEdit: true }) + }, + getInformation(e) { + this.$refs.textLibraryInfo.init({ e: e }) + }, + handleDelete(e) { + this.$confirm('确定要删除吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/delete', + { + BUS_TEXT_LIBRARY_ID: e.BUS_TEXT_LIBRARY_ID + } + ).then((data) => { + if (data.code === '0') { + this.$message({ + message: '删除成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.getList() + } else { + this.listLoading = false + this.$message.error(data.errorMessage) + } + }).catch((e) => { + this.listLoading = false + }) + }).catch((e) => { + console.log(e) + }) + }, + handleLock(e, flag) { + this.$confirm(flag === '1' ? '确定要锁定吗?' : '确定要解锁吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/lock', + { + BUS_TEXT_LIBRARY_ID: e.BUS_TEXT_LIBRARY_ID, + isLock: flag + } + ).then(() => { + this.$message({ + message: '操作成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch((e) => { + console.log(e) + }) + }, + handleTop(e, flag) { + this.$confirm(flag === '1' ? '确定要置顶吗?' : '确定要取消置顶吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/top', + { + BUS_TEXT_LIBRARY_ID: e.BUS_TEXT_LIBRARY_ID, + isTop: flag + } + ).then(() => { + this.$message({ + message: '操作成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch((e) => { + console.log(e) + }) + }, + handleExport(e) { + this.$confirm('确定要导出文件吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + if (e.MIGRATION_FLAG === '1') { + window.open(config.fileUrl + e.PATH) + } else { + window.open(e.PATH) + } + }).catch((e) => { + console.log(e) + }) + }, + batchDel() { + const _selectData = this.$refs.multipleTable.selection + if (_selectData == null || _selectData.length == 0) { + this.$message({ + message: '请选中要删除的项...', + type: 'error' + }) + return false + } + const _ids = _selectData.filter((item, index) => { + return item.LOCKTOOL + }) + if (_ids.length > 0) { + this.$message.error('选中的数据有锁定数据,请重新选择') + return + } + const ids = _selectData.map((item, index) => { + return item.BUS_TEXT_LIBRARY_ID + }).join(',') + + this.$confirm('确定要删除选中的数据吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/deleteAll', + { + DATA_IDS: ids + } + ).then(() => { + this.$message({ + message: '删除成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.$refs.multipleTable.clearSelection() + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch(() => { + }) + }, + hasButton: function() { + var keys = 'textlibraryTwo:add,textlibraryTwo:del,textlibraryTwo:edit,toExcel' + requestFN( + '/head/hasButton', + { + keys: keys + } + ).then((data) => { + this.add = data.textlibraryTwofhadminadd // 新增权限 + this.del = data.textlibraryTwofhadmindel // 删除权限 + this.edit = data.textlibraryTwofhadminedit // 修改权限 + }).catch((e) => { + this.listLoading = false + }) + }, + tableRowClassName({ row, rowIndex }) { + if (row.ISTOPTIME) { + return 'warning-row' + } + }, + saveClose(e) { + this.getList() + }, + openUpdateFile(row) { + this.$refs.updateFile.init(row) + }, + openUpdateLog(row) { + this.$refs.updateLog.init(row) + }, + setStatus(row, status) { + this.listLoading = true + this.$confirm('是否更改状态?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + requestFN( + '/textLibrary/setStatus', + { + BUS_TEXT_LIBRARY_ID: row.BUS_TEXT_LIBRARY_ID, + STATUS: status + } + ).then((data) => { + this.listLoading = false + this.$message({ + type: 'success', + message: '修改成功!' + }) + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消' + }) + this.listLoading = false + }) + }, + handleCopy(row) { + this.$confirm('确定要将此条数据添加到本地', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.copyInfo(row) + }).catch((e) => { + console.log(e) + this.$message({ + type: 'info', + message: '已取消添加' + }) + }) + }, + copyInfo(row) { + requestFN( + '/textLibrary/copyToOperate?showCount=' + this.listQuery.limit + '¤tPage=' + this.listQuery.page, + { BUS_TEXT_LIBRARY_ID: row.BUS_TEXT_LIBRARY_ID } + ).then((data) => { + if (data.code === '0') { + this.$message.success('添加成功') + } else { + this.$message.success('添加失败') + } + }).catch((e) => { + this.$message.success('添加失败') + }) + }, + enterSelectionRows(row, column, cell, event) { + if (row.ISTOPTIME) { + this.createTips(event, row, '数据已置顶') + } + }, + leaveSelectionRows(row, column, cell, event) { + if (row.ISTOPTIME) { + this.removeTips(row) + } + }, + createTips(el, row, value) { + const { BUS_TEXT_LIBRARY_ID } = row + const tooltipDom = document.createElement('div') + tooltipDom.style.cssText = ` + display: inline-block; + max-width: 400px; + max-height: 400px; + position: absolute; + top: ${el.clientY + 5}px; + left: ${el.clientX}px; + padding:5px 10px; + overflow: auto; + font-size: 12px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #595959; + background: #fff; + border-radius: 5px; + z-index: 19999; + box-shadow: 0 4px 12px 1px #ccc; + ` + tooltipDom.innerHTML = value + tooltipDom.setAttribute('id', `tooltip-${BUS_TEXT_LIBRARY_ID}`) + // 将浮层插入到body中 + document.body.appendChild(tooltipDom) + }, + removeTips(row) { + console.log(row, 'row') + const { BUS_TEXT_LIBRARY_ID } = row + const tooltipDomLeave = document.querySelectorAll(`#tooltip-${BUS_TEXT_LIBRARY_ID}`) + if (tooltipDomLeave.length) { + tooltipDomLeave.forEach(dom => { + document.body.removeChild(dom) + }) + } + } + } +} +</script> diff --git a/src/views/threeSystems/spmLibrary/components/listEm.vue b/src/views/threeSystems/spmLibrary/components/listEm.vue new file mode 100644 index 0000000..f275b9d --- /dev/null +++ b/src/views/threeSystems/spmLibrary/components/listEm.vue @@ -0,0 +1,503 @@ +<template> + <div class="app-container"> + <div class="filter-container"> + <el-form label-width="50px"> + <el-row> + <el-col :span="6"> + <el-form-item label="安全生产管理制度名称:" label-width="200px"> + <el-input v-model="form.KEYWORDS" placeholder="请输入" class="filter-item"/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label-width="10px"> + <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="getQuery"> + 搜索 + </el-button> + <el-button v-waves class="filter-item" type="success" icon="el-icon-magic-stick" @click="addCondition"> + 添加其他搜索条件 + </el-button> + <el-button v-waves class="filter-item" type="success" icon="el-icon-magic-stick" @click="clearMessage"> + 重置 + </el-button> + </el-form-item> + </el-col> + </el-row> + </el-form> + </div> + <el-table + v-loading="listLoading" + ref="multipleTable" + :row-key="getRowKey" + :data="varList" + :header-cell-style="{ + 'font-weight': 'bold', + 'color': '#000' + }" + :row-class-name="tableRowClassName" + tooltip-effect="dark" + border + fit + highlight-current-row + @cell-mouse-enter="enterSelectionRows" + @cell-mouse-leave="leaveSelectionRows"> + <el-table-column + :reserve-selection="true" + type="selection" + width="55" + align="center" + /> + <el-table-column type="index" label="序号" width="50" align="center" /> + <el-table-column align="center" prop="REMARKS" label="安全生产管理制度名称" /> + <el-table-column align="center" prop="TYPES" label="类型" > + <template slot-scope="{row}"> + <el-tag + v-for="tag in row.TYPES" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </template> + </el-table-column> + <el-table-column prop="LABEL" align="center" label="标签" > + <template slot-scope="{row}"> + <el-tag + v-for="tag in row.labels" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.NAME }} + </el-tag> + </template> + </el-table-column> + <el-table-column align="center" prop="SPECIFICATION_TYPES" label="国民经济行业类型" width="300px"> + <template slot-scope="{row}"> + <div v-if="row.SPECIFICATION_TYPES && row.SPECIFICATION_TYPES.length > 0"> + <el-tag + v-for="tag in row.SPECIFICATION_TYPES" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </div> + <div v-else> + <el-tag type="warning">通用</el-tag> + </div> + </template> + </el-table-column> + <el-table-column align="center" prop="UPLOAD_TIME" label="上传时间" width="90px"/> + <el-table-column v-if="false" :show-overflow-tooltip="true" align="center" prop="UPLOAD_USER_NAME" width="100px" label="数据来源" > + <template slot-scope="{row}"> + {{ !row.CORP_NAME ? '资源库数据' : row.CORP_NAME }} + </template> + </el-table-column> <el-table-column label="操作" align="center" width="200px"> + <template slot-scope="{row}"> + <el-row> + <el-col :span="24" style="padding-bottom: 10px"> + <el-button type="info" icon="el-icon-view" size="mini" @click="getInformation(row)">查看</el-button> + <el-button type="warning" icon="el-icon-printer" size="mini" @click="handleExport(row)">导出</el-button> + </el-col> + <el-col :span="24"> + <el-button v-if="edit" type="primary" icon="el-icon-edit" size="mini" @click="handleEdit(row)">编辑</el-button> + <el-button v-if="del" type="danger" icon="el-icon-delete" size="mini" @click="handleDelete(row)">删除</el-button> + </el-col> + </el-row> + </template> + </el-table-column> + </el-table> + <div class="page-btn-group"> + <div> + <el-button v-if="add" type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button> + </div> + <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" /> + </div> + <edit-text-library ref="editTextLibrary" :title="title" @logical-end="saveClose"/> + <text-library-info ref="textLibraryInfo"/> + <update-spe-file ref="updateFile"/> + <update-log ref="updateLog"/> + <condition ref="condition" have-corp-flag @getResult="getCondition"/> + </div> +</template> +<style> +.el-table .warning-row { + background: oldlace; +} +</style> +<script> +import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包 +import { requestFN } from '@/utils/request' +import waves from '@/directive/waves' +import editTextLibrary from './editTextLibrary.vue' +import textLibraryInfo from './textLibraryInfo.vue' +import updateLog from './updateLog.vue' +import UpdateLog from './updateLog.vue' +import condition from './condition.vue' +import UpdateSpeFile from './updateSpeFile.vue' +export default { + components: { UpdateSpeFile, UpdateLog, Pagination, editTextLibrary, textLibraryInfo, updateLog, condition }, + directives: { waves }, + data() { + return { + config: config, + listLoading: true, + add: false, + del: false, + edit: false, + listQuery: { + page: 1, + limit: 10 + }, + total: 0, + form: { + KEYWORDS: '', + labels: [], + CATEGORY_LIST: [], + TYPES: [], + SPECIFICATION_TYPES: [], + STATUS: '' + }, + label_name: '', + + varList: [], + pd: [], + isEdit: false, + isLook: false, + title: '' + } + }, + created() { + this.getList() + }, + methods: { + getRowKey(row) { + return row.BLACKSPOT_ID + }, + getQuery() { + this.$refs.multipleTable.clearSelection() + this.getList() + }, + addCondition() { + this.$refs.condition.init() + }, + getCondition(info) { + this.form.CATEGORY_LIST = info.CATEGORY_LIST + this.form.TYPES = info.TYPES + this.form.SPECIFICATION_TYPES = info.SPECIFICATION_TYPES + this.form.labels = info.LABELS + this.form.CORPINFO_ID = info.CORPINFO_ID + }, + clearMessage() { + this.label_name = '' + this.form = { + KEYWORDS: '', + labels: [], + CATEGORY_LIST: [], + TYPES: [], + SPECIFICATION_TYPES: [], + STATUS: '' + } + this.$refs.condition.clear() + this.getList() + }, + getList() { + this.listLoading = true + requestFN( + '/textLibrary/list?showCount=' + this.listQuery.limit + '¤tPage=' + this.listQuery.page, + { + KEYWORDS: this.form.KEYWORDS, + CATEGORY_LIST: JSON.stringify(this.form.CATEGORY_LIST), + TYPES: JSON.stringify(this.form.TYPES), + SPECIFICATION_TYPES: JSON.stringify(this.form.SPECIFICATION_TYPES), + labels: JSON.stringify(this.form.labels), + STATUS: this.form.STATUS, + ASSOCIATION: '1', + ENTERPRISE_SIDE: '0', + CORPINFO_ID: this.form.CORPINFO_ID + } + ).then((data) => { + this.listLoading = false + this.varList = data.varList + this.total = data.page.totalResult + this.hasButton() + this.pd = data.pd + }).catch((e) => { + this.listLoading = false + }) + }, + handleAdd() { + this.title = '新增' + this.$refs.editTextLibrary.init() + }, + handleEdit(e) { + this.title = '编辑' + this.$refs.editTextLibrary.init({ e: e, isEdit: true }) + }, + getInformation(e) { + this.$refs.textLibraryInfo.init({ e: e }) + }, + handleDelete(e) { + this.$confirm('确定要删除吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/delete', + { + BUS_TEXT_LIBRARY_ID: e.BUS_TEXT_LIBRARY_ID + } + ).then((data) => { + if (data.code === '0') { + this.$message({ + message: '删除成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.getList() + } else { + this.listLoading = false + this.$message.error(data.errorMessage) + } + }).catch((e) => { + this.listLoading = false + }) + }).catch((e) => { + console.log(e) + }) + }, + handleLock(e, flag) { + this.$confirm(flag === '1' ? '确定要锁定吗?' : '确定要解锁吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/lock', + { + BUS_TEXT_LIBRARY_ID: e.BUS_TEXT_LIBRARY_ID, + isLock: flag + } + ).then(() => { + this.$message({ + message: '操作成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch((e) => { + console.log(e) + }) + }, + handleTop(e, flag) { + this.$confirm(flag === '1' ? '确定要置顶吗?' : '确定要取消置顶吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/top', + { + BUS_TEXT_LIBRARY_ID: e.BUS_TEXT_LIBRARY_ID, + isTop: flag + } + ).then(() => { + this.$message({ + message: '操作成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch((e) => { + console.log(e) + }) + }, + handleExport(e) { + this.$confirm('确定要导出文件吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + if (e.MIGRATION_FLAG === '1') { + window.open(config.fileUrl + e.PATH) + } else { + window.open(e.PATH) + } + }).catch((e) => { + console.log(e) + }) + }, + batchDel() { + const _selectData = this.$refs.multipleTable.selection + if (_selectData == null || _selectData.length == 0) { + this.$message({ + message: '请选中要删除的项...', + type: 'error' + }) + return false + } + const _ids = _selectData.filter((item, index) => { + return item.LOCKTOOL + }) + if (_ids.length > 0) { + this.$message.error('选中的数据有锁定数据,请重新选择') + return + } + const ids = _selectData.map((item, index) => { + return item.BUS_TEXT_LIBRARY_ID + }).join(',') + + this.$confirm('确定要删除选中的数据吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/deleteAll', + { + DATA_IDS: ids + } + ).then(() => { + this.$message({ + message: '删除成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.$refs.multipleTable.clearSelection() + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch(() => { + }) + }, + hasButton: function() { + var keys = 'textlibraryTwo:add,textlibraryTwo:del,textlibraryTwo:edit,toExcel' + requestFN( + '/head/hasButton', + { + keys: keys + } + ).then((data) => { + this.add = data.textlibraryTwofhadminadd // 新增权限 + this.del = data.textlibraryTwofhadmindel // 删除权限 + this.edit = data.textlibraryTwofhadminedit // 修改权限 + }).catch((e) => { + this.listLoading = false + }) + }, + tableRowClassName({ row, rowIndex }) { + if (row.ISTOPTIME) { + return 'warning-row' + } + }, + saveClose(e) { + this.getList() + }, + openUpdateFile(row) { + this.$refs.updateFile.init(row) + }, + openUpdateLog(row) { + this.$refs.updateLog.init(row) + }, + setStatus(row, status) { + this.listLoading = true + this.$confirm('是否更改状态?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + requestFN( + '/textLibrary/setStatus', + { + BUS_TEXT_LIBRARY_ID: row.BUS_TEXT_LIBRARY_ID, + STATUS: status + } + ).then((data) => { + this.listLoading = false + this.$message({ + type: 'success', + message: '修改成功!' + }) + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消' + }) + this.listLoading = false + }) + }, + enterSelectionRows(row, column, cell, event) { + if (row.ISTOPTIME) { + this.createTips(event, row, '数据已置顶') + } + }, + leaveSelectionRows(row, column, cell, event) { + if (row.ISTOPTIME) { + this.removeTips(row) + } + }, + createTips(el, row, value) { + const { BUS_TEXT_LIBRARY_ID } = row + const tooltipDom = document.createElement('div') + tooltipDom.style.cssText = ` + display: inline-block; + max-width: 400px; + max-height: 400px; + position: absolute; + top: ${el.clientY + 5}px; + left: ${el.clientX}px; + padding:5px 10px; + overflow: auto; + font-size: 12px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #595959; + background: #fff; + border-radius: 5px; + z-index: 19999; + box-shadow: 0 4px 12px 1px #ccc; + ` + tooltipDom.innerHTML = value + tooltipDom.setAttribute('id', `tooltip-${BUS_TEXT_LIBRARY_ID}`) + // 将浮层插入到body中 + document.body.appendChild(tooltipDom) + }, + removeTips(row) { + console.log(row, 'row') + const { BUS_TEXT_LIBRARY_ID } = row + const tooltipDomLeave = document.querySelectorAll(`#tooltip-${BUS_TEXT_LIBRARY_ID}`) + if (tooltipDomLeave.length) { + tooltipDomLeave.forEach(dom => { + document.body.removeChild(dom) + }) + } + } + } +} +</script> diff --git a/src/views/threeSystems/spmLibrary/components/textLibraryInfo.vue b/src/views/threeSystems/spmLibrary/components/textLibraryInfo.vue new file mode 100644 index 0000000..e9f9aac --- /dev/null +++ b/src/views/threeSystems/spmLibrary/components/textLibraryInfo.vue @@ -0,0 +1,146 @@ +<template> + <el-dialog v-loading="loading" v-if="dialogVisible" :visible.sync="dialogVisible" title="详情"> + <el-form ref="form" :model="form" label-width="180px"> + <el-form-item label="安全管理制度名称:" prop="FILE_NAME"> + <el-input v-model="form.REMARKS" disabled style="width: 70%"/> + </el-form-item> + <el-form-item label="规程属性:" prop="FILE_NAME"> + <el-tag + v-for="tag in form.CATEGORY_LIST" + :key="tag.value" + :disable-transitions="false" + style="margin-right: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </el-form-item> + <el-form-item label="类型:" prop="FILE_NAME"> + <el-tag + v-for="tag in form.TYPES" + :key="tag.value" + :disable-transitions="false" + style="margin-right: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </el-form-item> + <el-form-item v-if="remoteControl.keyOne" label="国民经济行业类型:" prop="FILE_NAME"> + <el-tag v-for="tag in form.SPECIFICATION_TYPES" :key="tag.value" :disable-transitions="false" style="margin-right: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </el-form-item> + <el-form-item label="上传时间:" prop="FILE_NAME"> + <el-input v-model="form.UPLOAD_TIME" disabled style="width: 70%"/> + </el-form-item> + <el-form-item label="上传人:" prop="FILE_NAME"> + <el-input v-model="form.UPLOAD_USER_NAME" disabled style="width: 70%"/> + </el-form-item> + <el-form-item prop="tags" label="标签:"> + <el-tag + v-for="tag in form.labels" + :key="tag.value" + :disable-transitions="false" + style="margin-right: 10px"> + {{ tag.NAME }} + </el-tag> + </el-form-item> + <el-form-item label="文件详情:"> + <el-button size="small" type="primary" @click="openTextEdit({BUS_TEXT_LIBRARY_ID:form.BUS_TEXT_LIBRARY_ID})">查看文件详情</el-button> + <el-button size="small" type="primary" @click="exportWord({BUS_TEXT_LIBRARY_ID:form.BUS_TEXT_LIBRARY_ID})">导出word</el-button> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button @click="goBack">返 回</el-button> + </div> + <text-editing ref="textEditing" :disabled="true" append-to-body title="文本编辑器"/> + </el-dialog> +</template> +<script> +import Pagination from '@/components/Pagination' +import waves from '@/directive/waves' +import { requestFN } from '@/utils/request' +import TextEditing from '../../../util/textEditing.vue' + +export default { + components: { TextEditing, Pagination }, + directives: { waves }, + data() { + return { + config: config, + dialogVisible: false, + form: { + BUS_TEXT_LIBRARY_ID: '', + FILE_NAME: '', + FILE: [], + TYPE: '', + labels: [], + UPLOAD_TIME: '', + UPLOAD_USER_NAME: '' + }, + loading: false, + remoteControl: { + keyOne: true + } + } + }, + methods: { + init(e) { + this.dialogVisible = true + this.loading = true + this.e = e.e + requestFN( + '/textLibrary/goEdit', + { + BUS_TEXT_LIBRARY_ID: this.e.BUS_TEXT_LIBRARY_ID + } + ).then((data) => { + this.loading = false + this.form = data.data + this.form.FILE = [] + this.remoteControl.keyOne = !(this.form.CATEGORY_LIST[0].CATEGORY_ID === '691346658ed744a1bda2ed3a755f606c') + }).catch((e) => { + this.$message.error(e) + this.loading = false + }) + }, + goBack() { + this.dialogVisible = false + this.$emit('goBack', this.e) + }, + openTextEdit(id) { + this.loading = true + requestFN('textLibrary/getTextInfo', id) + .then((data) => { + if (data.info && data.info.TEXT_INFO && data.info.TEXT_INFO !== '') { + this.$refs.textEditing.init({ text: data.info.TEXT_INFO }) + } else { + this.$message.error('此数据未维护文件内容') + } + this.loading = false + }).catch((e) => { + console.log(e) + this.loading = false + }) + }, + exportWord(info) { + this.loading = true + requestFN('textLibrary/getTextInfo', info) + .then((data) => { + if (data.info) { + if ((!data.info) || data.info.TEXT_INFO === '') { + this.$message.error('没有文件导出') + } else { + this.$message.success('导出成功') + window.open(config.httpurl + '/textLibrary/exportWord?BUS_TEXT_LIBRARY_ID=' + info.BUS_TEXT_LIBRARY_ID) + } + } else { + this.$message.error('此数据未维护文件内容') + } + this.loading = false + }).catch((e) => { + console.log(e) + this.loading = false + }) + } + } +} + +</script> diff --git a/src/views/threeSystems/spmLibrary/components/updateLog.vue b/src/views/threeSystems/spmLibrary/components/updateLog.vue new file mode 100644 index 0000000..ee30bd2 --- /dev/null +++ b/src/views/threeSystems/spmLibrary/components/updateLog.vue @@ -0,0 +1,55 @@ +<template> + <el-dialog v-loading="loading" v-if="visible" :visible.sync="visible" title="替换"> + <el-table :data="list"> + <el-table-column prop="CREATE_TIME" label="日期"/> + <el-table-column prop="CREATOR_NAME" label="姓名"/> + </el-table> + <div slot="footer" class="dialog-footer"> + <el-button @click="goBack">取 消</el-button> + </div> + </el-dialog> +</template> +<script> +import Pagination from '@/components/Pagination' +import waves from '@/directive/waves' +import { requestFN } from '@/utils/request' + +export default { + components: { Pagination }, + directives: { waves }, + data() { + return { + visible: false, + list: [], + loading: false, + id: '' + } + }, + methods: { + init(e) { + this.visible = true + this.id = e.BUS_TEXT_LIBRARY_ID + this.getList() + }, + goBack() { + this.list = [] + this.visible = false + }, + getList() { + this.loading = true + requestFN( + '/textLibrary/getUpdateLog', + { + BUS_TEXT_LIBRARY_ID: this.id + } + ).then((data) => { + this.loading = false + this.list = data.list + }).catch((e) => { + this.loading = false + }) + } + } +} + +</script> diff --git a/src/views/threeSystems/spmLibrary/components/updateSpeFile.vue b/src/views/threeSystems/spmLibrary/components/updateSpeFile.vue new file mode 100644 index 0000000..63cfb6f --- /dev/null +++ b/src/views/threeSystems/spmLibrary/components/updateSpeFile.vue @@ -0,0 +1,77 @@ +<template> + <el-dialog v-loading="loading" v-if="visible" :visible.sync="visible" title="替换"> + <el-form ref="form" :model="form" :rules="rules" label-width="150px"> + <el-form-item label="文件:" prop="FILE"> + <upload-file :file-list.sync="form.FILE" :limit="1" :file-size="200" append-to-body accept=".pdf"/> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button @click="goBack">取 消</el-button> + <el-button type="primary" @click="save">确 定</el-button> + </div> + </el-dialog> +</template> +<script> +import Pagination from '@/components/Pagination' +import waves from '@/directive/waves' +import { upload } from '@/utils/upload' +import uploadFile from '../../../../components/upload-file/index.vue' + +export default { + components: { Pagination, uploadFile }, + directives: { waves }, + data() { + return { + visible: false, + form: { + FILE: [], + BUS_TEXT_LIBRARY_ID: '' + }, + rules: { + FILE: [{ required: true, message: '请选择文件', trigger: 'blur' }] + }, + loading: false + } + }, + methods: { + init(e) { + this.visible = true + this.form.BUS_TEXT_LIBRARY_ID = e.BUS_TEXT_LIBRARY_ID + }, + goBack() { + this.form = { + FILE: [], + BUS_TEXT_LIBRARY_ID: '' + } + this.visible = false + }, + save() { + const loading = this.$loading({ + lock: true, + text: '上传中...', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) + const formData = new FormData() + for (let i = 0; i < this.form.FILE.length; i++) { + if (this.form.FILE[i].raw) { + formData.append('FILE', this.form.FILE[i].raw) + } + } + formData.append('BUS_TEXT_LIBRARY_ID', this.form.BUS_TEXT_LIBRARY_ID) + upload( + '/textLibrary/updateFile', + formData + ).then((data) => { + loading.close() + this.visible = false + this.$emit('logical-end', { result: 'OK' }) + }).catch((e) => { + loading.close() + console.log(e) + }) + } + } +} + +</script> diff --git a/src/views/threeSystems/spmLibrary/index.vue b/src/views/threeSystems/spmLibrary/index.vue new file mode 100644 index 0000000..8d78561 --- /dev/null +++ b/src/views/threeSystems/spmLibrary/index.vue @@ -0,0 +1,19 @@ +<template> + <div> + <List v-if="activeName==='List'" ref="list" /> + <Dashboard v-if="activeName==='Dashboard'" ref="Dashboard"/> + </div> +</template> +<script> +import List from './components/list.vue' +import Dashboard from './components/dashboard.vue' +export default { + components: { List, Dashboard }, + data() { + return { + activeName: 'Dashboard' + } + } +} + +</script> diff --git a/src/views/threeSystems/sprLibrary/components/condition.vue b/src/views/threeSystems/sprLibrary/components/condition.vue new file mode 100644 index 0000000..fbb3b86 --- /dev/null +++ b/src/views/threeSystems/sprLibrary/components/condition.vue @@ -0,0 +1,188 @@ +<template> + <el-drawer + v-if="visible" + ref="drawer" + :visible.sync="visible" + :before-close="close" + title="搜索条件" + size="50%"> + <div style="margin-left: 30px"> + <el-form ref="form" label-width="200px"> + <el-form-item label="规程属性:" prop="CATEGORY_LIST"> + <multiple-choice :dynamic-tags.sync="form.CATEGORY_LIST" :labels="categoryList" :row-key="key.categoryKey" :row-name="key.categoryName" title="选择"/> + </el-form-item> + <el-form-item label="类型:" prop="TYPES"> + <multiple-choice :dynamic-tags.sync="form.TYPES" :labels="typeList" :row-key="key.typeKey" :row-name="key.typeName" title="选择"/> + </el-form-item> + <el-form-item label="国民经济行业类型:" prop="SPECIFICATION_TYPES"> + <multiple-choice :dynamic-tags.sync="form.SPECIFICATION_TYPES" :labels="industryTypeList" :row-key="key.specificationTypeKey" :row-name="key.specificationTypeName" lazy title="选择"/> + </el-form-item> + <el-form-item label="标签:" prop="LABELS"> + <multiple-choice :dynamic-tags.sync="form.LABELS" :row-key="key.labelsKey" :row-name="key.labelsName" title="选择"/> + </el-form-item> + <el-form-item v-if="false" label="企业:"> + <el-select + v-model="form.CORPINFO_ID" + :remote-method="searchCorp" + :loading="selectLoading" + filterable + remote + reserve-keyword + placeholder="请输入关键词"> + <el-option + v-for="item in corp_list" + :key="item.CORPINFO_ID" + :label="item.CORP_NAME" + :value="item.CORPINFO_ID"/> + </el-select> + </el-form-item> + </el-form> + <div> + <el-button @click="closePanel">取 消</el-button> + <el-button :loading="loading" type="primary" @click="submit">{{ loading ? '提交中 ...' : '确 定' }}</el-button> + </div> + </div> + </el-drawer> +</template> +<script> +import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包 +import waves from '@/directive/waves' // waves directive +import { videoPlayer } from 'vue-video-player' +import 'video.js/dist/video-js.css' +import multipleChoice from '../../../util/multipleChoice.vue' +import { requestFN } from '@/utils/request' +export default { + components: { multipleChoice, Pagination, videoPlayer }, + directives: { waves }, + props: { + haveCorpFlag: { + type: Boolean, + default: false + } + }, + data() { + return { + visible: false, + loading: false, + key: { + typeKey: 'DICTIONARIES_ID', + typeName: 'NAME', + specificationTypeKey: 'DICTIONARIES_ID', + specificationTypeName: 'NAME', + categoryKey: 'DICTIONARIES_ID', + categoryName: 'NAME', + labelsKey: 'BUS_LABEL_FACTORY_ID', + labelsName: 'NAME' + }, + typeList: [], + industryTypeList: [], + categoryList: [], + form: { + CATEGORY_LIST: [''], + TYPES: [''], + SPECIFICATION_TYPES: [''], + LABELS: [''], + CORPINFO_ID: '' + }, + corp_list: [], + selectLoading: false + } + }, + watch: { + filterText(val) { + this.$refs.tree.filter(val) + } + }, + created() { + this.getDic() + }, + methods: { + init(tags) { + this.visible = true + }, + close(done) { + this.$confirm('确认关闭?') + .then(_ => { + this.form = { + CATEGORY_LIST: [''], + TYPES: [''], + SPECIFICATION_TYPES: [''], + LABELS: [''] + } + done() + }) + .catch(e => {}) + }, + closePanel() { + this.visible = false + this.form = { + CATEGORY_LIST: [''], + TYPES: [''], + SPECIFICATION_TYPES: [''], + LABELS: [''] + } + }, + submit() { + this.$emit('getResult', this.form) + this.visible = false + }, + getDic() { + // 安全生产基础类型 + requestFN( + 'dictionaries/getLevels', { DICTIONARIES_ID: '5a7c94b2b9514285b433759edd848b4a' } + ).then((data) => { + this.typeList = data.list + }).catch((e) => { + this.loading = false + }) + // 安全生产类型 + requestFN( + 'dictionaries/getLevels', { DICTIONARIES_ID: 'f2598ba72e864eadabf0ca4b664d26b9' } + ).then((data) => { + this.industryTypeList = data.list + }).catch((e) => { + this.loading = false + }) + // 行业类别 + requestFN( + 'dictionaries/getLevels', { DICTIONARIES_ID: '84254cb5b2ae40eb9f451509b2d370ae' } + ).then((data) => { + this.categoryList = data.list + }).catch((e) => { + this.loading = false + }) + }, + clear() { + this.form = { + CATEGORY_LIST: [''], + TYPES: [''], + SPECIFICATION_TYPES: [''], + LABELS: [''], + TTRIBUTE_LIST: [''], + CORPINFO_ID: '' + } + }, + searchCorp(query) { + if (query !== '') { + this.selectLoading = true + requestFN( + 'corpinfo/list', { KEYWORDS: query } + ).then((data) => { + this.corp_list = data.varList + this.selectLoading = false + }).catch((e) => { + console.log(e) + this.selectLoading = false + }) + } + } + } +} + +</script> + +<style scoped> +.information >>> .el-scrollbar__wrap { + overflow-x: hidden; +} +</style> diff --git a/src/views/threeSystems/sprLibrary/components/dashboard.vue b/src/views/threeSystems/sprLibrary/components/dashboard.vue new file mode 100644 index 0000000..e7c8301 --- /dev/null +++ b/src/views/threeSystems/sprLibrary/components/dashboard.vue @@ -0,0 +1,38 @@ +<template> + <div class="app-container"> + <el-tabs type="border-card" @tab-click="changTab"> + <el-tab-pane label="安全生产责任制平台资源库"> + <list/> + </el-tab-pane> + </el-tabs> + </div> +</template> +<style> +.el-table .warning-row { + background: oldlace; +} +</style> +<script> +import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包 +import waves from '@/directive/waves' +import List from './list.vue' +import ListEm from './listEm.vue' +export default { + components: { List, Pagination, ListEm }, + directives: { waves }, + data() { + return { + vectory: 'listEm' + } + }, + created() { + }, + methods: { + changTab(title) { + console.log(title.label) + if (title.label === '安全生产责任制平台资源库') { this.vectory = 'list' } + if (title.label === '安全生产责任制') { this.vectory = 'listEm' } + } + } +} +</script> diff --git a/src/views/threeSystems/sprLibrary/components/editTextLibrary.vue b/src/views/threeSystems/sprLibrary/components/editTextLibrary.vue new file mode 100644 index 0000000..d3b2599 --- /dev/null +++ b/src/views/threeSystems/sprLibrary/components/editTextLibrary.vue @@ -0,0 +1,390 @@ +<template> + <el-dialog v-loading="loading" v-if="dialogVisible" :visible.sync="dialogVisible" :title="title" destroy-on-close @close="clear"> + <el-form ref="form" :model="form" :rules="rules" label-width="180px"> + <el-form-item v-if="false" label="规程属性:" prop="CATEGORY_LIST"> + <multiple-choice :dynamic-tags.sync="form.CATEGORY_LIST" :labels="categoryList" :row-key="key.categoryKey" :row-name="key.categoryName" :limit="1" @getChooseOne="getChooseOne"/> + </el-form-item> + <el-form-item label="安全生产责任制名称:" prop="REMARKS"> + <el-input v-model="form.REMARKS" style="width: 100%"/> + </el-form-item> + <el-form-item label="类型:" prop="TYPES"> + <multiple-choice :dynamic-tags.sync="form.TYPES" :labels="typeList" :row-key="key.typeKey" :row-name="key.typeName"/> + </el-form-item> + <el-form-item v-if="false" label="国民经济行业类型:" prop="SPECIFICATION_TYPES"> + <multiple-choice :dynamic-tags.sync="form.SPECIFICATION_TYPES" :labels="industryTypeList" :row-key="key.specificationTypeKey" :row-name="key.specificationTypeName" lazy/> + </el-form-item> + <el-form-item v-if="false" label="状态:" prop="STATUS"> + <el-select v-model="form.STATUS" placeholder="请选择" style="width: 100%;"> + <el-option label="停用" value="0"/> + <el-option label="启用" value="1"/> + </el-select> + </el-form-item> + <el-form-item v-if="!isEdit" label="文件:" prop="FILE"> + <upload-file :file-list.sync="form.FILE" :limit="1" :file-size="200" append-to-body accept=".pdf"/> + </el-form-item> + <el-form-item v-if="!isEdit" label="添加文件内容:"> + <el-button size="small" type="primary" @click="openTextEdit()">添加文件内容</el-button> + </el-form-item> + <el-form-item v-if="isEdit" label="添加文件内容:"> + <el-button size="small" type="primary" @click="openTextEdit({BUS_TEXT_LIBRARY_ID:form.BUS_TEXT_LIBRARY_ID},true)">查看</el-button> + <el-button size="small" type="primary" @click="openTextEdit({BUS_TEXT_LIBRARY_ID:form.BUS_TEXT_LIBRARY_ID},false)">编辑内容</el-button> + <el-button size="small" type="primary" @click="exportWord(form)">导出word</el-button> + </el-form-item> + <el-form-item label="标签:" prop="labels"> + <multiple-choice :dynamic-tags.sync="form.labels" :row-key="key.labelsKey" :row-name="key.labelsName" can-add/> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button @click="goBack">取 消</el-button> + <el-button type="primary" @click="save">确 定</el-button> + </div> + <edit-label ref="editLabel" append-to-body/> + <select-label ref="selectLabel" append-to-body @getResult="getChooseTage"/> + <select-type ref="selectType" :limit="1" append-to-body @getResult="getType"/> + <text-editing ref="textEditing" :disabled="textDisabled" append-to-body title="文本编辑器" @getResult="getText"/> + </el-dialog> +</template> +<script> +import Pagination from '@/components/Pagination' +import waves from '@/directive/waves' +import { upload } from '@/utils/upload' +import { requestFN } from '@/utils/request' +import editLabel from '../../../Label/components/editLabel.vue' +import selectLabel from '../../../Label/components/selectLable.vue' +import selectType from '../../../util/selectType.vue' +import multipleChoice from '../../../util/multipleChoice.vue' +import UploadFile from '../../../../components/upload-file/index.vue' +import TextEditing from '../../../util/textEditing.vue' + +export default { + components: { TextEditing, Pagination, editLabel, selectLabel, selectType, multipleChoice, UploadFile }, + directives: { waves }, + props: { + title: { + type: String, + default: '' + } + }, + data() { + return { + dialogVisible: false, + form: { + REMARKS: '', + FILE: [], + labels: [''], + TYPE: '', + TYPES: [''], + SPECIFICATION_TYPES: [''], + CATEGORY_LIST: [''], + STATUS: '', + ASSOCIATION: '2', + types: [], + specification_types: [], + category_list: [], + TEXT_INFO: '' + }, + key: { + typeKey: 'DICTIONARIES_ID', + typeName: 'NAME', + specificationTypeKey: 'DICTIONARIES_ID', + specificationTypeName: 'NAME', + categoryKey: 'DICTIONARIES_ID', + categoryName: 'NAME', + labelsKey: 'BUS_LABEL_FACTORY_ID', + labelsName: 'NAME' + }, + rules: { + REMARKS: [{ required: true, message: '请输安全操作规程', trigger: 'change' }], + STATUS: [{ required: true, message: '请选择状态', trigger: 'change' }], + FILE: [{ required: true, message: '请选择文件', trigger: 'blur' }], + TYPES: [{ + required: true, + validator: (rules, value, callback) => { + if (!value || value.length === 0 || value[0] === '') { + return callback(new Error('类型必选')) + } + return callback() + }, + trigger: 'blur' + }], + SPECIFICATION_TYPES: [{ + required: true, + validator: (rules, value, callback) => { + if (!value || value.length === 0 || value[0] === '') { + return callback(new Error('操作规程行业类型必选')) + } + return callback() + }, + trigger: 'blur' + }], + CATEGORY_LIST: [{ + required: true, + validator: (rules, value, callback) => { + if (!value || value.length === 0 || value[0] === '') { + return callback(new Error('规程属性必选')) + } + return callback() + }, + trigger: 'blur' + }] + }, + + loading: false, + e: {}, + isEdit: false, + typeList: [], + industryTypeList: [], + categoryList: [], + + remoteControl: { + keyOne: true + }, + textDisabled: false + } + }, + methods: { + init(e) { + this.dialogVisible = true + this.e = e ? e.e : {} + this.isEdit = e ? e.isEdit : false + this.getDic() + if (e) { + this.loading = true + requestFN( + '/textLibrary/goEdit', + { BUS_TEXT_LIBRARY_ID: this.e.BUS_TEXT_LIBRARY_ID } + ).then((data) => { + this.loading = false + this.form = data.data + this.form.FILE = [] + this.form.types = [] + this.form.specification_types = [] + this.form.category_list = [] + + if (!this.form.TYPES || this.form.TYPES.length === 0) this.form.TYPES = [''] + if (!this.form.SPECIFICATION_TYPES || this.form.SPECIFICATION_TYPES.length === 0) this.form.SPECIFICATION_TYPES = [''] + if (!this.form.CATEGORY_LIST || this.form.CATEGORY_LIST.length === 0) this.form.CATEGORY_LIST = [''] + if (!this.form.labels || this.form.labels.length === 0) this.form.labels = [''] + + this.remoteControl.keyOne = !(this.form.CATEGORY_LIST[0].CATEGORY_ID === '7158f688d0f34054a28a9275139298df') + }).catch((e) => { + this.$message.error(e) + this.loading = false + }) + } else { + this.isEdit = false + } + }, + save() { + if (this.checkForm()) { + return + } + this.$refs.form.validate((valid) => { + if (valid) { + const loading = this.$loading({ + lock: true, + text: '上传中...', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) + const formData = new FormData() + if (this.form.TEXT_INFO) this.form.TEXT_INFO = this.form.TEXT_INFO.replaceAll('<img', '<img style="max-width:100%"') + Object.keys(this.form).map(key => { + formData.append(key, this.form[key]) + }) + if (!this.isEdit) { + if (!this.form.FILE || this.form.FILE.length <= 0) { + this.$message.error('请上传文件') + loading.close() + return + } + } + for (let i = 0; i < this.form.FILE.length; i++) { + if (this.form.FILE[i].raw) { + formData.append('FILE', this.form.FILE[i].raw) + } + } + formData.append('labels', JSON.stringify(this.form.labels)) + for (let i = 0; i < this.form.TYPES.length; i++) { + if (this.form.TYPES[i]) { + this.form.types.push({ + CATEGORY: 'TYPES', + CATEGORY_ID: this.form.TYPES[i].DICTIONARIES_ID, + CATEGORY_NAME: this.form.TYPES[i].NAME + }) + } + } + formData.append('TYPES', JSON.stringify(this.form.types)) + for (let i = 0; i < this.form.SPECIFICATION_TYPES.length; i++) { + if (this.form.SPECIFICATION_TYPES[i]) { + this.form.specification_types.push({ + CATEGORY: 'SPECIFICATION_TYPES', + CATEGORY_ID: this.form.SPECIFICATION_TYPES[i].DICTIONARIES_ID, + CATEGORY_NAME: this.form.SPECIFICATION_TYPES[i].NAME + }) + } + } + formData.append('SPECIFICATION_TYPES', JSON.stringify(this.form.specification_types)) + if (!this.form.category_list) this.form.category_list = [] + this.form.category_list.push({ + CATEGORY: 'CATEGORY_LIST', + CATEGORY_ID: '7158f688d0f34054a28a9275139298df', + CATEGORY_NAME: '行业专属类' + }) + formData.append('CATEGORY_LIST', JSON.stringify(this.form.category_list)) + upload( + '/textLibrary/init', + formData + ).then((data) => { + loading.close() + this.dialogVisible = false + this.$emit('logical-end', { result: 'OK' }) + this.$message.success('保存成功') + }).catch((e) => { + loading.close() + console.log(e) + }) + this.clear() + } else { + return false + } + }) + }, + checkForm() { + if (this.form.labels.length > 15) { + this.$message.error('关联标签数不能超过15个') + return true + } + }, + goBack() { + this.dialogVisible = false + this.clear() + this.$emit('goBack', this.e) + }, + getChooseTage(e) { + if (e.TYPE === '0') { + const list = e.e + for (const listKey in list) { + const index = this.form.labels.findIndex(item => { + item.BUS_LABEL_FACTORY_ID === list[listKey].BUS_LABEL_FACTORY_ID + }) + if (index < 0) { + const label = JSON.parse(JSON.stringify(list[listKey])) + label.label = label.NAME + label.value = JSON.stringify(list[listKey]) + const index = this.form.labels.findIndex(item => item.value === label.value) + if (index < 0) { + this.form.labels.push(label) + } + } + } + } else { + if (e.e.length > 1) { + this.$message.error('只能选择一个类型') + return + } + this.form.TYPE_NAME = e.e[0].NAME + this.form.TYPE = e.e[0].BUS_LABEL_FACTORY_ID + this.$forceUpdate() + } + }, + getType(e) { + this.form.TYPE = e.info[0].DICTIONARIES_ID + this.form.TYPE_NAME = e.info[0].NAME + }, + clear() { + this.isEdit = false + this.form = { + REMARKS: '', + FILE: [], + labels: [''], + TYPE: '', + TYPES: [''], + SPECIFICATION_TYPES: [''], + STATUS: '', + ASSOCIATION: '2', + types: [], + specification_types: [] + } + }, + getDic() { + // 安全生产责任制基础类型 + requestFN( + 'dictionaries/getLevels', { DICTIONARIES_ID: '5a7c94b2b9514285b433759edd848b4a' } + ).then((data) => { + this.typeList = data.list + }).catch((e) => { + this.loading = false + }) + // 安全生产责任制类型 + requestFN( + 'dictionaries/getLevels', { DICTIONARIES_ID: 'f2598ba72e864eadabf0ca4b664d26b9' } + ).then((data) => { + this.industryTypeList = data.list + }).catch((e) => { + this.loading = false + }) + // 行业类别 + requestFN( + 'dictionaries/getLevels', { DICTIONARIES_ID: '84254cb5b2ae40eb9f451509b2d370ae' } + ).then((data) => { + this.categoryList = data.list + }).catch((e) => { + this.loading = false + }) + }, + getChooseOne(e) { + this.remoteControl.keyOne = !(e && e.info && e.info.DICTIONARIES_ID && e.info.DICTIONARIES_ID === '7158f688d0f34054a28a9275139298df') + }, + openTextEdit(id, textDisabled) { + if (!id) { + this.textDisabled = false + this.$refs.textEditing.init({ text: this.form.TEXT_INFO }) + } else { + this.textDisabled = textDisabled + this.loading = true + requestFN('textLibrary/getTextInfo', id) + .then((data) => { + if (data.info && data.info.TEXT_INFO && data.info.TEXT_INFO !== '') { + this.$refs.textEditing.init({ text: data.info.TEXT_INFO }) + } else { + if (((!this.form.TEXT_INFO) || this.form.TEXT_INFO === '') && this.textDisabled) { + this.$message.error('此数据未维护文件内容') + } else { + this.$refs.textEditing.init({ text: this.form.TEXT_INFO }) + } + } + this.loading = false + }).catch((e) => { + console.log(e) + this.loading = false + }) + } + }, + getText(e) { + this.form.TEXT_INFO = e.text + }, + exportWord(info) { + this.loading = true + requestFN('textLibrary/getTextInfo', info) + .then((data) => { + if (data.info) { + if ((!data.info) || data.info.TEXT_INFO === '') { + this.$message.error('没有文件导出') + } else { + this.$message.success('导出成功') + window.open(config.httpurl + '/textLibrary/exportWord?BUS_TEXT_LIBRARY_ID=' + info.BUS_TEXT_LIBRARY_ID) + } + } else { + this.$message.error('此数据未维护文件内容') + } + this.loading = false + }).catch((e) => { + console.log(e) + this.loading = false + }) + } + } +} + +</script> diff --git a/src/views/threeSystems/sprLibrary/components/list.vue b/src/views/threeSystems/sprLibrary/components/list.vue new file mode 100644 index 0000000..8829e4d --- /dev/null +++ b/src/views/threeSystems/sprLibrary/components/list.vue @@ -0,0 +1,562 @@ +<template> + <div class="app-container"> + <div class="filter-container"> + <el-form label-width="50px"> + <el-row> + <el-col :span="6"> + <el-form-item label="安全生产责任制名称:" label-width="150px"> + <el-input v-model="form.KEYWORDS" placeholder="请输入" class="filter-item"/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label-width="10px"> + <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="getQuery"> + 搜索 + </el-button> + <el-button v-waves class="filter-item" type="success" icon="el-icon-magic-stick" @click="addCondition"> + 添加其他搜索条件 + </el-button> + <el-button v-waves class="filter-item" type="success" icon="el-icon-magic-stick" @click="clearMessage"> + 重置 + </el-button> + </el-form-item> + </el-col> + </el-row> + </el-form> + </div> + <el-table + v-loading="listLoading" + ref="multipleTable" + :row-key="getRowKey" + :data="varList" + :header-cell-style="{ + 'font-weight': 'bold', + 'color': '#000' + }" + :row-class-name="tableRowClassName" + tooltip-effect="dark" + border + fit + highlight-current-row + @cell-mouse-enter="enterSelectionRows" + @cell-mouse-leave="leaveSelectionRows"> + <el-table-column + v-if="false" + :reserve-selection="true" + type="selection" + width="55" + align="center" + /> + <el-table-column type="expand"> + <template slot-scope="props"> + <div style="text-align: left;padding: 10px;"> + <el-form label-position="left" inline> + <el-form-item label="标签"> + <el-tag + v-for="tag in props.row.labels" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.NAME }} + </el-tag> + </el-form-item> + <el-form-item label="国民经济行业类型"> + <div v-if="(props.row.SPECIFICATION_TYPES && props.row.SPECIFICATION_TYPES.length > 0) && ((!props.row.CATEGORY_LIST) || (!props.row.CATEGORY_LIST[0]) || (props.row.CATEGORY_LIST[0].CATEGORY_ID !== '691346658ed744a1bda2ed3a755f606c')) "> + <el-tag + v-for="tag in props.row.SPECIFICATION_TYPES" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </div> + <div v-else> + <el-tag type="warning">通用</el-tag> + </div> + </el-form-item> + </el-form> + </div> + </template> + </el-table-column> + <el-table-column type="index" label="序号" width="50" align="center" /> + <el-table-column align="center" prop="REMARKS" label="安全生产责任制名称" /> + <el-table-column align="center" prop="TYPES" label="类型" > + <template slot-scope="{row}"> + <el-tag + v-for="tag in row.TYPES" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </template> + </el-table-column> + <el-table-column v-if="false" align="center" prop="LABEL" label="标签" > + <template slot-scope="{row}"> + <el-tag + v-for="tag in row.labels" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.NAME }} + </el-tag> + </template> + </el-table-column> + <el-table-column v-if="false" align="center" prop="SPECIFICATION_TYPES" label="国民经济行业类型" width="300px"> + <template slot-scope="{row}"> + <div v-if="(row.SPECIFICATION_TYPES && row.SPECIFICATION_TYPES.length > 0) && ((!row.CATEGORY_LIST) || (!row.CATEGORY_LIST[0]) || (row.CATEGORY_LIST[0].CATEGORY_ID !== '7158f688d0f34054a28a9275139298df'))"> + <el-tag + v-for="tag in row.SPECIFICATION_TYPES" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </div> + <div v-else> + <el-tag type="warning">通用</el-tag> + </div> + </template> + </el-table-column> + <el-table-column align="center" prop="UPLOAD_TIME" label="上传时间" width="200px"/> + <el-table-column v-if="false" :show-overflow-tooltip="true" align="center" prop="UPLOAD_USER_NAME" width="100px" label="数据来源" > + <template slot-scope="{row}"> + {{ !row.CORP_NAME ? '资源库数据' : row.CORP_NAME }} + </template> + </el-table-column> + <el-table-column label="操作" align="center" width="200px"> + <template slot-scope="{row}"> + <el-row> + <el-col :span="14"> + <el-button v-show="!row.LOCKTOOL" type="primary" icon="el-icon-edit" size="mini" @click="handleExport(row)">导出</el-button> + </el-col> + <el-col :span="10"> + <el-button type="primary" icon="el-icon-edit" size="mini" @click="getInformation(row)">查看</el-button> + </el-col> + </el-row> + </template> + </el-table-column> + </el-table> + <div class="page-btn-group"> + <div/> + <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" /> + </div> + <edit-text-library ref="editTextLibrary" :title="title" @logical-end="saveClose"/> + <text-library-info ref="textLibraryInfo"/> + <update-spe-file ref="updateFile"/> + <update-log ref="updateLog"/> + <condition ref="condition" @getResult="getCondition"/> + </div> +</template> +<style> +.el-table .warning-row { + background: oldlace; +} +</style> +<script> +import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包 +import { requestFN } from '@/utils/request' +import waves from '@/directive/waves' +import editTextLibrary from './editTextLibrary.vue' +import textLibraryInfo from './textLibraryInfo.vue' +import updateLog from './updateLog.vue' +import UpdateLog from './updateLog.vue' +import condition from './condition.vue' +import UpdateSpeFile from './updateSpeFile.vue' +export default { + components: { UpdateSpeFile, UpdateLog, Pagination, editTextLibrary, textLibraryInfo, updateLog, condition }, + directives: { waves }, + data() { + return { + config: config, + listLoading: true, + add: false, + del: false, + edit: false, + listQuery: { + page: 1, + limit: 10 + }, + total: 0, + form: { + KEYWORDS: '', + labels: [], + CATEGORY_LIST: [], + TYPES: [], + SPECIFICATION_TYPES: [], + STATUS: '' + }, + label_name: '', + + varList: [], + pd: [], + isEdit: false, + isLook: false, + title: '' + } + }, + created() { + this.getList() + }, + methods: { + getRowKey(row) { + return row.BUS_TEXT_LIBRARY_ID + }, + getQuery() { + this.$refs.multipleTable.clearSelection() + this.getList() + }, + addCondition() { + this.$refs.condition.init() + }, + getCondition(info) { + this.form.CATEGORY_LIST = info.CATEGORY_LIST + this.form.TYPES = info.TYPES + this.form.SPECIFICATION_TYPES = info.SPECIFICATION_TYPES + this.form.labels = info.LABELS + }, + clearMessage() { + this.label_name = '' + this.form = { + KEYWORDS: '', + labels: [], + CATEGORY_LIST: [], + TYPES: [], + SPECIFICATION_TYPES: [], + STATUS: '' + } + this.$refs.condition.clear() + this.getList() + }, + getList() { + this.listLoading = true + requestFN( + '/textLibrary/list?showCount=' + this.listQuery.limit + '¤tPage=' + this.listQuery.page, + { + KEYWORDS: this.form.KEYWORDS, + CATEGORY_LIST: JSON.stringify(this.form.CATEGORY_LIST), + TYPES: JSON.stringify(this.form.TYPES), + SPECIFICATION_TYPES: JSON.stringify(this.form.SPECIFICATION_TYPES), + labels: JSON.stringify(this.form.labels), + STATUS: this.form.STATUS, + ASSOCIATION: '2', + CORPINFO_ID: '0', + LIBRARY_FLAG: '1' + } + ).then((data) => { + this.listLoading = false + this.varList = data.varList + this.total = data.page.totalResult + this.hasButton() + this.pd = data.pd + }).catch((e) => { + this.listLoading = false + }) + }, + handleAdd() { + this.title = '新增' + this.$refs.editTextLibrary.init() + }, + handleEdit(e) { + this.title = '编辑' + this.$refs.editTextLibrary.init({ e: e, isEdit: true }) + }, + getInformation(e) { + this.$refs.textLibraryInfo.init({ e: e }) + }, + handleDelete(e) { + this.$confirm('确定要删除吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/delete', + { + BUS_TEXT_LIBRARY_ID: e.BUS_TEXT_LIBRARY_ID + } + ).then((data) => { + if (data.code === '0') { + this.$message({ + message: '删除成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.getList() + } else { + this.listLoading = false + this.$message.error(data.errorMessage) + } + }).catch((e) => { + this.listLoading = false + }) + }).catch((e) => { + console.log(e) + }) + }, + handleLock(e, flag) { + this.$confirm(flag === '1' ? '确定要锁定吗?' : '确定要解锁吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/lock', + { + BUS_TEXT_LIBRARY_ID: e.BUS_TEXT_LIBRARY_ID, + isLock: flag + } + ).then(() => { + this.$message({ + message: '操作成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch((e) => { + console.log(e) + }) + }, + handleTop(e, flag) { + this.$confirm(flag === '1' ? '确定要置顶吗?' : '确定要取消置顶吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/top', + { + BUS_TEXT_LIBRARY_ID: e.BUS_TEXT_LIBRARY_ID, + isTop: flag + } + ).then(() => { + this.$message({ + message: '操作成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch((e) => { + console.log(e) + }) + }, + handleExport(e) { + this.$confirm('确定要导出文件吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + if (e.MIGRATION_FLAG === '1') { + window.open(config.fileUrl + e.PATH) + } else { + window.open(e.PATH) + } + }).catch((e) => { + console.log(e) + }) + }, + batchDel() { + const _selectData = this.$refs.multipleTable.selection + if (_selectData == null || _selectData.length == 0) { + this.$message({ + message: '请选中要删除的项...', + type: 'error' + }) + return false + } + const _ids = _selectData.filter((item, index) => { + return item.LOCKTOOL + }) + if (_ids.length > 0) { + this.$message.error('选中的数据有锁定数据,请重新选择') + return + } + const ids = _selectData.map((item, index) => { + return item.BUS_TEXT_LIBRARY_ID + }).join(',') + + this.$confirm('确定要删除选中的数据吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/deleteAll', + { + DATA_IDS: ids + } + ).then(() => { + this.$message({ + message: '删除成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.$refs.multipleTable.clearSelection() + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch(() => { + }) + }, + hasButton: function() { + var keys = 'textlibraryThree:add,textlibraryThree:del,textlibraryThree:edit,toExcel' + requestFN( + '/head/hasButton', + { + keys: keys + } + ).then((data) => { + this.add = data.textlibraryThreefhadminadd // 新增权限 + this.del = data.textlibraryThreefhadmindel // 删除权限 + this.edit = data.textlibraryThreefhadminedit // 修改权限 + }).catch((e) => { + this.listLoading = false + }) + }, + tableRowClassName({ row, rowIndex }) { + if (row.ISTOPTIME) { + return 'warning-row' + } + }, + saveClose(e) { + this.getList() + }, + openUpdateFile(row) { + this.$refs.updateFile.init(row) + }, + openUpdateLog(row) { + this.$refs.updateLog.init(row) + }, + setStatus(row, status) { + this.listLoading = true + this.$confirm('是否更改状态?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + requestFN( + '/textLibrary/setStatus', + { + BUS_TEXT_LIBRARY_ID: row.BUS_TEXT_LIBRARY_ID, + STATUS: status + } + ).then((data) => { + this.listLoading = false + this.$message({ + type: 'success', + message: '修改成功!' + }) + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消' + }) + this.listLoading = false + }) + }, + handleCopy(row) { + this.$confirm('确定要将此条数据添加到本地', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.copyInfo(row) + }).catch((e) => { + console.log(e) + this.$message({ + type: 'info', + message: '已取消添加' + }) + }) + }, + copyInfo(row) { + requestFN( + '/textLibrary/copyToOperate?showCount=' + this.listQuery.limit + '¤tPage=' + this.listQuery.page, + { BUS_TEXT_LIBRARY_ID: row.BUS_TEXT_LIBRARY_ID } + ).then((data) => { + if (data.code === '0') { + this.$message.success('添加成功') + } else { + this.$message.success('添加失败') + } + }).catch((e) => { + this.$message.success('添加失败') + }) + }, + enterSelectionRows(row, column, cell, event) { + if (row.ISTOPTIME) { + this.createTips(event, row, '数据已置顶') + } + }, + leaveSelectionRows(row, column, cell, event) { + if (row.ISTOPTIME) { + this.removeTips(row) + } + }, + createTips(el, row, value) { + const { BUS_TEXT_LIBRARY_ID } = row + const tooltipDom = document.createElement('div') + tooltipDom.style.cssText = ` + display: inline-block; + max-width: 400px; + max-height: 400px; + position: absolute; + top: ${el.clientY + 5}px; + left: ${el.clientX}px; + padding:5px 10px; + overflow: auto; + font-size: 12px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #595959; + background: #fff; + border-radius: 5px; + z-index: 19999; + box-shadow: 0 4px 12px 1px #ccc; + ` + tooltipDom.innerHTML = value + tooltipDom.setAttribute('id', `tooltip-${BUS_TEXT_LIBRARY_ID}`) + // 将浮层插入到body中 + document.body.appendChild(tooltipDom) + }, + removeTips(row) { + console.log(row, 'row') + const { BUS_TEXT_LIBRARY_ID } = row + const tooltipDomLeave = document.querySelectorAll(`#tooltip-${BUS_TEXT_LIBRARY_ID}`) + if (tooltipDomLeave.length) { + tooltipDomLeave.forEach(dom => { + document.body.removeChild(dom) + }) + } + } + } +} +</script> diff --git a/src/views/threeSystems/sprLibrary/components/listEm.vue b/src/views/threeSystems/sprLibrary/components/listEm.vue new file mode 100644 index 0000000..a1c6b1e --- /dev/null +++ b/src/views/threeSystems/sprLibrary/components/listEm.vue @@ -0,0 +1,503 @@ +<template> + <div class="app-container"> + <div class="filter-container"> + <el-form label-width="50px"> + <el-row> + <el-col :span="6"> + <el-form-item label="安全生产责任制名称:" label-width="150px"> + <el-input v-model="form.KEYWORDS" placeholder="请输入" class="filter-item"/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label-width="10px"> + <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="getQuery"> + 搜索 + </el-button> + <el-button v-waves class="filter-item" type="success" icon="el-icon-magic-stick" @click="addCondition"> + 添加其他搜索条件 + </el-button> + <el-button v-waves class="filter-item" type="success" icon="el-icon-magic-stick" @click="clearMessage"> + 重置 + </el-button> + </el-form-item> + </el-col> + </el-row> + </el-form> + </div> + <el-table + v-loading="listLoading" + ref="multipleTable" + :row-key="getRowKey" + :data="varList" + :header-cell-style="{ + 'font-weight': 'bold', + 'color': '#000' + }" + :row-class-name="tableRowClassName" + tooltip-effect="dark" + border + fit + highlight-current-row + @cell-mouse-enter="enterSelectionRows" + @cell-mouse-leave="leaveSelectionRows"> + <el-table-column + :reserve-selection="true" + type="selection" + width="55" + align="center" + /> + <el-table-column type="index" label="序号" width="50" align="center" /> + <el-table-column align="center" prop="REMARKS" label="安全生产管理制度名称" /> + <el-table-column align="center" prop="TYPES" label="类型" > + <template slot-scope="{row}"> + <el-tag + v-for="tag in row.TYPES" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </template> + </el-table-column> + <el-table-column prop="LABEL" align="center" label="标签" > + <template slot-scope="{row}"> + <el-tag + v-for="tag in row.labels" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.NAME }} + </el-tag> + </template> + </el-table-column> + <el-table-column align="center" prop="SPECIFICATION_TYPES" label="国民经济行业类型" width="300px"> + <template slot-scope="{row}"> + <div v-if="row.SPECIFICATION_TYPES && row.SPECIFICATION_TYPES.length > 0"> + <el-tag + v-for="tag in row.SPECIFICATION_TYPES" + :key="tag.BUS_LIBRARY_LABELS_ID" + :disable-transitions="false" + type="warning" + style="margin-right: 10px;margin-bottom: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </div> + <div v-else> + <el-tag type="warning">通用</el-tag> + </div> + </template> + </el-table-column> + <el-table-column align="center" prop="UPLOAD_TIME" label="上传时间" width="90px"/> + <el-table-column v-if="false" :show-overflow-tooltip="true" align="center" prop="UPLOAD_USER_NAME" width="100px" label="数据来源" > + <template slot-scope="{row}"> + {{ !row.CORP_NAME ? '资源库数据' : row.CORP_NAME }} + </template> + </el-table-column> <el-table-column label="操作" align="center" width="200px"> + <template slot-scope="{row}"> + <el-row> + <el-col :span="24" style="padding-bottom: 10px"> + <el-button type="info" icon="el-icon-view" size="mini" @click="getInformation(row)">查看</el-button> + <el-button type="warning" icon="el-icon-printer" size="mini" @click="handleExport(row)">导出</el-button> + </el-col> + <el-col :span="24"> + <el-button v-if="edit" type="primary" icon="el-icon-edit" size="mini" @click="handleEdit(row)">编辑</el-button> + <el-button v-if="del" type="danger" icon="el-icon-delete" size="mini" @click="handleDelete(row)">删除</el-button> + </el-col> + </el-row> + </template> + </el-table-column> + </el-table> + <div class="page-btn-group"> + <div> + <el-button v-if="add" type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button> + </div> + <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" /> + </div> + <edit-text-library ref="editTextLibrary" :title="title" @logical-end="saveClose"/> + <text-library-info ref="textLibraryInfo"/> + <update-spe-file ref="updateFile"/> + <update-log ref="updateLog"/> + <condition ref="condition" have-corp-flag @getResult="getCondition"/> + </div> +</template> +<style> +.el-table .warning-row { + background: oldlace; +} +</style> +<script> +import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包 +import { requestFN } from '@/utils/request' +import waves from '@/directive/waves' +import editTextLibrary from './editTextLibrary.vue' +import textLibraryInfo from './textLibraryInfo.vue' +import updateLog from './updateLog.vue' +import UpdateLog from './updateLog.vue' +import condition from './condition.vue' +import UpdateSpeFile from './updateSpeFile.vue' +export default { + components: { UpdateSpeFile, UpdateLog, Pagination, editTextLibrary, textLibraryInfo, updateLog, condition }, + directives: { waves }, + data() { + return { + config: config, + listLoading: true, + add: false, + del: false, + edit: false, + listQuery: { + page: 1, + limit: 10 + }, + total: 0, + form: { + KEYWORDS: '', + labels: [], + CATEGORY_LIST: [], + TYPES: [], + SPECIFICATION_TYPES: [], + STATUS: '' + }, + label_name: '', + + varList: [], + pd: [], + isEdit: false, + isLook: false, + title: '' + } + }, + created() { + this.getList() + }, + methods: { + getRowKey(row) { + return row.BLACKSPOT_ID + }, + getQuery() { + this.$refs.multipleTable.clearSelection() + this.getList() + }, + addCondition() { + this.$refs.condition.init() + }, + getCondition(info) { + this.form.CATEGORY_LIST = info.CATEGORY_LIST + this.form.TYPES = info.TYPES + this.form.SPECIFICATION_TYPES = info.SPECIFICATION_TYPES + this.form.labels = info.LABELS + this.form.CORPINFO_ID = info.CORPINFO_ID + }, + clearMessage() { + this.label_name = '' + this.form = { + KEYWORDS: '', + labels: [], + CATEGORY_LIST: [], + TYPES: [], + SPECIFICATION_TYPES: [], + STATUS: '' + } + this.$refs.condition.clear() + this.getList() + }, + getList() { + this.listLoading = true + requestFN( + '/textLibrary/list?showCount=' + this.listQuery.limit + '¤tPage=' + this.listQuery.page, + { + KEYWORDS: this.form.KEYWORDS, + CATEGORY_LIST: JSON.stringify(this.form.CATEGORY_LIST), + TYPES: JSON.stringify(this.form.TYPES), + SPECIFICATION_TYPES: JSON.stringify(this.form.SPECIFICATION_TYPES), + labels: JSON.stringify(this.form.labels), + STATUS: this.form.STATUS, + ASSOCIATION: '2', + ENTERPRISE_SIDE: '0', + CORPINFO_ID: this.form.CORPINFO_ID + } + ).then((data) => { + this.listLoading = false + this.varList = data.varList + this.total = data.page.totalResult + this.hasButton() + this.pd = data.pd + }).catch((e) => { + this.listLoading = false + }) + }, + handleAdd() { + this.title = '新增' + this.$refs.editTextLibrary.init() + }, + handleEdit(e) { + this.title = '编辑' + this.$refs.editTextLibrary.init({ e: e, isEdit: true }) + }, + getInformation(e) { + this.$refs.textLibraryInfo.init({ e: e }) + }, + handleDelete(e) { + this.$confirm('确定要删除吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/delete', + { + BUS_TEXT_LIBRARY_ID: e.BUS_TEXT_LIBRARY_ID + } + ).then((data) => { + if (data.code === '0') { + this.$message({ + message: '删除成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.getList() + } else { + this.listLoading = false + this.$message.error(data.errorMessage) + } + }).catch((e) => { + this.listLoading = false + }) + }).catch((e) => { + console.log(e) + }) + }, + handleLock(e, flag) { + this.$confirm(flag === '1' ? '确定要锁定吗?' : '确定要解锁吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/lock', + { + BUS_TEXT_LIBRARY_ID: e.BUS_TEXT_LIBRARY_ID, + isLock: flag + } + ).then(() => { + this.$message({ + message: '操作成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch((e) => { + console.log(e) + }) + }, + handleTop(e, flag) { + this.$confirm(flag === '1' ? '确定要置顶吗?' : '确定要取消置顶吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/top', + { + BUS_TEXT_LIBRARY_ID: e.BUS_TEXT_LIBRARY_ID, + isTop: flag + } + ).then(() => { + this.$message({ + message: '操作成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch((e) => { + console.log(e) + }) + }, + handleExport(e) { + this.$confirm('确定要导出文件吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + if (e.MIGRATION_FLAG === '1') { + window.open(config.fileUrl + e.PATH) + } else { + window.open(e.PATH) + } + }).catch((e) => { + console.log(e) + }) + }, + batchDel() { + const _selectData = this.$refs.multipleTable.selection + if (_selectData == null || _selectData.length == 0) { + this.$message({ + message: '请选中要删除的项...', + type: 'error' + }) + return false + } + const _ids = _selectData.filter((item, index) => { + return item.LOCKTOOL + }) + if (_ids.length > 0) { + this.$message.error('选中的数据有锁定数据,请重新选择') + return + } + const ids = _selectData.map((item, index) => { + return item.BUS_TEXT_LIBRARY_ID + }).join(',') + + this.$confirm('确定要删除选中的数据吗?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.listLoading = true + requestFN( + '/textLibrary/deleteAll', + { + DATA_IDS: ids + } + ).then(() => { + this.$message({ + message: '删除成功', + type: 'success' + }) + this.listLoading = false + this.varList = [] + this.listQuery.page = 1 + this.$refs.multipleTable.clearSelection() + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch(() => { + }) + }, + hasButton: function() { + var keys = 'textlibraryThree:add,textlibraryThree:del,textlibraryThree:edit,toExcel' + requestFN( + '/head/hasButton', + { + keys: keys + } + ).then((data) => { + this.add = data.textlibraryThreefhadminadd // 新增权限 + this.del = data.textlibraryThreefhadmindel // 删除权限 + this.edit = data.textlibraryThreefhadminedit // 修改权限 + }).catch((e) => { + this.listLoading = false + }) + }, + tableRowClassName({ row, rowIndex }) { + if (row.ISTOPTIME) { + return 'warning-row' + } + }, + saveClose(e) { + this.getList() + }, + openUpdateFile(row) { + this.$refs.updateFile.init(row) + }, + openUpdateLog(row) { + this.$refs.updateLog.init(row) + }, + setStatus(row, status) { + this.listLoading = true + this.$confirm('是否更改状态?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + requestFN( + '/textLibrary/setStatus', + { + BUS_TEXT_LIBRARY_ID: row.BUS_TEXT_LIBRARY_ID, + STATUS: status + } + ).then((data) => { + this.listLoading = false + this.$message({ + type: 'success', + message: '修改成功!' + }) + this.getList() + }).catch((e) => { + this.listLoading = false + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消' + }) + this.listLoading = false + }) + }, + enterSelectionRows(row, column, cell, event) { + if (row.ISTOPTIME) { + this.createTips(event, row, '数据已置顶') + } + }, + leaveSelectionRows(row, column, cell, event) { + if (row.ISTOPTIME) { + this.removeTips(row) + } + }, + createTips(el, row, value) { + const { BUS_TEXT_LIBRARY_ID } = row + const tooltipDom = document.createElement('div') + tooltipDom.style.cssText = ` + display: inline-block; + max-width: 400px; + max-height: 400px; + position: absolute; + top: ${el.clientY + 5}px; + left: ${el.clientX}px; + padding:5px 10px; + overflow: auto; + font-size: 12px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #595959; + background: #fff; + border-radius: 5px; + z-index: 19999; + box-shadow: 0 4px 12px 1px #ccc; + ` + tooltipDom.innerHTML = value + tooltipDom.setAttribute('id', `tooltip-${BUS_TEXT_LIBRARY_ID}`) + // 将浮层插入到body中 + document.body.appendChild(tooltipDom) + }, + removeTips(row) { + console.log(row, 'row') + const { BUS_TEXT_LIBRARY_ID } = row + const tooltipDomLeave = document.querySelectorAll(`#tooltip-${BUS_TEXT_LIBRARY_ID}`) + if (tooltipDomLeave.length) { + tooltipDomLeave.forEach(dom => { + document.body.removeChild(dom) + }) + } + } + } +} +</script> diff --git a/src/views/threeSystems/sprLibrary/components/textLibraryInfo.vue b/src/views/threeSystems/sprLibrary/components/textLibraryInfo.vue new file mode 100644 index 0000000..5ce9a08 --- /dev/null +++ b/src/views/threeSystems/sprLibrary/components/textLibraryInfo.vue @@ -0,0 +1,146 @@ +<template> + <el-dialog v-loading="loading" v-if="dialogVisible" :visible.sync="dialogVisible" title="详情"> + <el-form ref="form" :model="form" label-width="180px"> + <el-form-item label="安全生产责任制名称:" prop="FILE_NAME"> + <el-input v-model="form.REMARKS" disabled style="width: 70%"/> + </el-form-item> + <el-form-item label="规程属性:" prop="FILE_NAME"> + <el-tag + v-for="tag in form.CATEGORY_LIST" + :key="tag.value" + :disable-transitions="false" + style="margin-right: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </el-form-item> + <el-form-item label="类型:" prop="FILE_NAME"> + <el-tag + v-for="tag in form.TYPES" + :key="tag.value" + :disable-transitions="false" + style="margin-right: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </el-form-item> + <el-form-item v-if="remoteControl.keyOne" label="国民经济行业类型:" prop="FILE_NAME"> + <el-tag v-for="tag in form.SPECIFICATION_TYPES" :key="tag.value" :disable-transitions="false" style="margin-right: 10px"> + {{ tag.CATEGORY_NAME }} + </el-tag> + </el-form-item> + <el-form-item label="上传时间:" prop="FILE_NAME"> + <el-input v-model="form.UPLOAD_TIME" disabled style="width: 70%"/> + </el-form-item> + <el-form-item label="上传人:" prop="FILE_NAME"> + <el-input v-model="form.UPLOAD_USER_NAME" disabled style="width: 70%"/> + </el-form-item> + <el-form-item prop="tags" label="标签:"> + <el-tag + v-for="tag in form.labels" + :key="tag.value" + :disable-transitions="false" + style="margin-right: 10px"> + {{ tag.NAME }} + </el-tag> + </el-form-item> + <el-form-item label="文件详情:"> + <el-button size="small" type="primary" @click="openTextEdit({BUS_TEXT_LIBRARY_ID:form.BUS_TEXT_LIBRARY_ID})">查看文件详情</el-button> + <el-button size="small" type="primary" @click="exportWord({BUS_TEXT_LIBRARY_ID:form.BUS_TEXT_LIBRARY_ID})">导出word</el-button> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button @click="goBack">返 回</el-button> + </div> + <text-editing ref="textEditing" :disabled="true" append-to-body title="文本编辑器"/> + </el-dialog> +</template> +<script> +import Pagination from '@/components/Pagination' +import waves from '@/directive/waves' +import { requestFN } from '@/utils/request' +import TextEditing from '../../../util/textEditing.vue' + +export default { + components: { TextEditing, Pagination }, + directives: { waves }, + data() { + return { + config: config, + dialogVisible: false, + form: { + BUS_TEXT_LIBRARY_ID: '', + FILE_NAME: '', + FILE: [], + TYPE: '', + labels: [], + UPLOAD_TIME: '', + UPLOAD_USER_NAME: '' + }, + loading: false, + remoteControl: { + keyOne: true + } + } + }, + methods: { + init(e) { + this.dialogVisible = true + this.loading = true + this.e = e.e + requestFN( + '/textLibrary/goEdit', + { + BUS_TEXT_LIBRARY_ID: this.e.BUS_TEXT_LIBRARY_ID + } + ).then((data) => { + this.loading = false + this.form = data.data + this.form.FILE = [] + this.remoteControl.keyOne = !(this.form.CATEGORY_LIST[0].CATEGORY_ID === '7158f688d0f34054a28a9275139298df') + }).catch((e) => { + this.$message.error(e) + this.loading = false + }) + }, + goBack() { + this.dialogVisible = false + this.$emit('goBack', this.e) + }, + openTextEdit(id) { + this.loading = true + requestFN('textLibrary/getTextInfo', id) + .then((data) => { + if (data.info && data.info.TEXT_INFO && data.info.TEXT_INFO !== '') { + this.$refs.textEditing.init({ text: data.info.TEXT_INFO }) + } else { + this.$message.error('此数据未维护文件内容') + } + this.loading = false + }).catch((e) => { + console.log(e) + this.loading = false + }) + }, + exportWord(info) { + this.loading = true + requestFN('textLibrary/getTextInfo', info) + .then((data) => { + if (data.info) { + if ((!data.info) || data.info.TEXT_INFO === '') { + this.$message.error('没有文件导出') + } else { + this.$message.success('导出成功') + window.open(config.httpurl + '/textLibrary/exportWord?BUS_TEXT_LIBRARY_ID=' + info.BUS_TEXT_LIBRARY_ID) + } + } else { + this.$message.error('此数据未维护文件内容') + } + this.loading = false + }).catch((e) => { + console.log(e) + this.loading = false + }) + } + } +} + +</script> diff --git a/src/views/threeSystems/sprLibrary/components/updateLog.vue b/src/views/threeSystems/sprLibrary/components/updateLog.vue new file mode 100644 index 0000000..ee30bd2 --- /dev/null +++ b/src/views/threeSystems/sprLibrary/components/updateLog.vue @@ -0,0 +1,55 @@ +<template> + <el-dialog v-loading="loading" v-if="visible" :visible.sync="visible" title="替换"> + <el-table :data="list"> + <el-table-column prop="CREATE_TIME" label="日期"/> + <el-table-column prop="CREATOR_NAME" label="姓名"/> + </el-table> + <div slot="footer" class="dialog-footer"> + <el-button @click="goBack">取 消</el-button> + </div> + </el-dialog> +</template> +<script> +import Pagination from '@/components/Pagination' +import waves from '@/directive/waves' +import { requestFN } from '@/utils/request' + +export default { + components: { Pagination }, + directives: { waves }, + data() { + return { + visible: false, + list: [], + loading: false, + id: '' + } + }, + methods: { + init(e) { + this.visible = true + this.id = e.BUS_TEXT_LIBRARY_ID + this.getList() + }, + goBack() { + this.list = [] + this.visible = false + }, + getList() { + this.loading = true + requestFN( + '/textLibrary/getUpdateLog', + { + BUS_TEXT_LIBRARY_ID: this.id + } + ).then((data) => { + this.loading = false + this.list = data.list + }).catch((e) => { + this.loading = false + }) + } + } +} + +</script> diff --git a/src/views/threeSystems/sprLibrary/components/updateSpeFile.vue b/src/views/threeSystems/sprLibrary/components/updateSpeFile.vue new file mode 100644 index 0000000..63cfb6f --- /dev/null +++ b/src/views/threeSystems/sprLibrary/components/updateSpeFile.vue @@ -0,0 +1,77 @@ +<template> + <el-dialog v-loading="loading" v-if="visible" :visible.sync="visible" title="替换"> + <el-form ref="form" :model="form" :rules="rules" label-width="150px"> + <el-form-item label="文件:" prop="FILE"> + <upload-file :file-list.sync="form.FILE" :limit="1" :file-size="200" append-to-body accept=".pdf"/> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button @click="goBack">取 消</el-button> + <el-button type="primary" @click="save">确 定</el-button> + </div> + </el-dialog> +</template> +<script> +import Pagination from '@/components/Pagination' +import waves from '@/directive/waves' +import { upload } from '@/utils/upload' +import uploadFile from '../../../../components/upload-file/index.vue' + +export default { + components: { Pagination, uploadFile }, + directives: { waves }, + data() { + return { + visible: false, + form: { + FILE: [], + BUS_TEXT_LIBRARY_ID: '' + }, + rules: { + FILE: [{ required: true, message: '请选择文件', trigger: 'blur' }] + }, + loading: false + } + }, + methods: { + init(e) { + this.visible = true + this.form.BUS_TEXT_LIBRARY_ID = e.BUS_TEXT_LIBRARY_ID + }, + goBack() { + this.form = { + FILE: [], + BUS_TEXT_LIBRARY_ID: '' + } + this.visible = false + }, + save() { + const loading = this.$loading({ + lock: true, + text: '上传中...', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) + const formData = new FormData() + for (let i = 0; i < this.form.FILE.length; i++) { + if (this.form.FILE[i].raw) { + formData.append('FILE', this.form.FILE[i].raw) + } + } + formData.append('BUS_TEXT_LIBRARY_ID', this.form.BUS_TEXT_LIBRARY_ID) + upload( + '/textLibrary/updateFile', + formData + ).then((data) => { + loading.close() + this.visible = false + this.$emit('logical-end', { result: 'OK' }) + }).catch((e) => { + loading.close() + console.log(e) + }) + } + } +} + +</script> diff --git a/src/views/threeSystems/sprLibrary/index.vue b/src/views/threeSystems/sprLibrary/index.vue new file mode 100644 index 0000000..8d78561 --- /dev/null +++ b/src/views/threeSystems/sprLibrary/index.vue @@ -0,0 +1,19 @@ +<template> + <div> + <List v-if="activeName==='List'" ref="list" /> + <Dashboard v-if="activeName==='Dashboard'" ref="Dashboard"/> + </div> +</template> +<script> +import List from './components/list.vue' +import Dashboard from './components/dashboard.vue' +export default { + components: { List, Dashboard }, + data() { + return { + activeName: 'Dashboard' + } + } +} + +</script>