| | |
| | | <div class="app-container"> |
| | | <!--左侧树形开始--> |
| | | <el-col :span="5"> |
| | | <el-card class="box-card" shadow="never"> |
| | | <my-tree ref="searchTree" :tree-list="treeDataList" @setNode="nodeClick" @search="search"></my-tree> |
| | | </el-card> |
| | | </el-col> |
| | | <!--左侧树形结束--> |
| | | <!--右侧列表开始--> |
| | | <el-card class="box-card" shadow="never"> |
| | | <my-tree ref="searchTree" :tree-list="treeDataList" @setNode="nodeClick" @search="search"></my-tree> |
| | | </el-card> |
| | | </el-col> |
| | | <!--左侧树形结束--> |
| | | <!--右侧列表开始--> |
| | | <el-container> |
| | | <el-card class="box-card" style="width: 100%" shadow="never"> |
| | | <!-- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">--> |
| | | <!-- <el-form-item label="字典名称" prop="dictName">--> |
| | | <!-- <el-input--> |
| | | <!-- v-model="queryParams.dictName"--> |
| | | <!-- placeholder="请输入"--> |
| | | <!-- clearable--> |
| | | <!-- style="width: 150px"--> |
| | | <!-- @keyup.enter.native="handleQuery"--> |
| | | <!-- />--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item label="状态" prop="status">--> |
| | | <!-- <el-select--> |
| | | <!-- v-model="queryParams.status"--> |
| | | <!-- placeholder="请选择"--> |
| | | <!-- clearable--> |
| | | <!-- style="width: 150px"--> |
| | | <!-- >--> |
| | | <!-- <el-option--> |
| | | <!-- v-for="item in constants.normalOrDisabled"--> |
| | | <!-- :key="item.value"--> |
| | | <!-- :label="item.label"--> |
| | | <!-- :value="item.value"--> |
| | | <!-- />--> |
| | | <!-- </el-select>--> |
| | | <!-- </el-form-item>--> |
| | | <!-- <el-form-item>--> |
| | | <!-- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>--> |
| | | <!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>--> |
| | | <!-- </el-form-item>--> |
| | | <!-- </el-form>--> |
| | | <!-- <el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">--> |
| | | <!-- <el-table-column type="selection" width="55" align="center" />--> |
| | | <!-- <el-table-column label="字典编号" align="center" prop="dict_id" />--> |
| | | <!-- <el-table-column label="字典名称" align="center" prop="dict_name" :show-overflow-tooltip="true" />--> |
| | | <!-- <el-table-column label="字典类型" align="center" :show-overflow-tooltip="true">--> |
| | | <!-- <template slot-scope="scope">--> |
| | | <!-- <router-link :to="'/systemSetting/dictdata/data/' + scope.row.dict_id" class="link-type">--> |
| | | <!-- <span>{{ scope.row.dict_type }}</span>--> |
| | | <!-- </router-link>--> |
| | | <!-- </template>--> |
| | | <!-- </el-table-column>--> |
| | | <!-- <el-table-column label="状态" align="center" prop="status">--> |
| | | <!-- <template slot-scope="scope">--> |
| | | <!-- <span>{{ scope.row.status == 0? '正常':'禁用' }}</span>--> |
| | | <!-- </template>--> |
| | | <!-- </el-table-column>--> |
| | | <!-- <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />--> |
| | | <!-- <el-table-column label="创建时间" align="center" prop="create_time" width="180">--> |
| | | <!-- <template slot-scope="scope">--> |
| | | <!-- <span>{{ dateTo(scope.row.create_time) }}</span>--> |
| | | <!-- </template>--> |
| | | <!-- <!– <template slot-scope="scope">–>--> |
| | | <!-- <!– <span>{{ parseTime(scope.row.create_time) }}</span>–>--> |
| | | <!-- <!– </template>–>--> |
| | | <!-- </el-table-column>--> |
| | | <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">--> |
| | | <!-- <template slot-scope="scope">--> |
| | | <!-- <el-button--> |
| | | <!-- size="mini"--> |
| | | <!-- type="text"--> |
| | | <!-- icon="el-icon-edit"--> |
| | | <!-- @click="handleUpdate(scope.row)"--> |
| | | <!-- v-hasPermi="['system:dict:edit']"--> |
| | | <!-- >修改</el-button>--> |
| | | <!-- <!– <el-button--> |
| | | <!-- size="mini"--> |
| | | <!-- type="text"--> |
| | | <!-- icon="el-icon-delete"--> |
| | | <!-- @click="handleDelete(scope.row)"--> |
| | | <!-- v-hasPermi="['system:dict:remove']"--> |
| | | <!-- >删除</el-button>–>--> |
| | | <!-- </template>--> |
| | | <!-- </el-table-column>--> |
| | | <!-- </el-table>--> |
| | | <!--搜索条件--> |
| | | <div class="filter-container"> |
| | | <my-search ref="searchBar" :items="items" @search="fifterForm"></my-search> |
| | |
| | | <el-row style="margin-top: 8px"> |
| | | <el-col> |
| | | <!--列表--> |
| | | <my-table-v2 ref="myTable" :filter="queryParams" :table="table"/> |
| | | <my-table-v2 ref="myTable" :filter="filterFrom" :table="table" /> |
| | | </el-col> |
| | | </el-row> |
| | | </el-card> |
| | | </el-container> |
| | | <!-- 添加或修改参数配置对话框 --> |
| | | <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> |
| | | <el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
| | | <el-form-item label="字典名称" prop="dictName"> |
| | | <el-input v-model="form.dictName" placeholder="请输入字典名称" /> |
| | | </el-form-item> |
| | | <el-form-item label="字典类型" prop="dictType"> |
| | | <el-input v-model="form.dictType" placeholder="请输入字典类型" /> |
| | | </el-form-item> |
| | | <el-form-item label="状态" prop="status"> |
| | | <el-radio-group v-model="form.status"> |
| | | <el-radio |
| | | v-for="item in constants.normalOrDisabled" |
| | | :key="item.value" |
| | | :label="item.value" |
| | | >{{item.label}}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="备注" prop="remark"> |
| | | <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确 定</el-button> |
| | | <el-button @click="cancel">取 消</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <edit v-if="editSetting.show" :setting="editSetting" @close="editSetting.show = false" @search="search()" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import myTree from '@/components/myTree/index'; |
| | | import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type"; |
| | | import * as DateFormatter from "@/utils/DateFormatter"; |
| | | import MyTableV2 from "@/components/myTable/myTableV2"; |
| | | import MyTableV2 from '@/components/myTable/myTableV2'; |
| | | import SettingIplatform from '@/utils/settingIplatform'; |
| | | import items from './items' |
| | | import edit from './edit'; |
| | | import * as finsystenant from '@/api/baseSetting/finsystenant'; |
| | | |
| | | export default { |
| | | name: "Dict", |
| | | components: { MyTableV2, myTree }, |
| | | name: 'Dict', |
| | | components: { MyTableV2, myTree, edit }, |
| | | data() { |
| | | return { |
| | | // 树数据 |
| | |
| | | // 字典表格数据 |
| | | typeList: [], |
| | | // 弹出层标题 |
| | | title: "", |
| | | title: '', |
| | | // 是否显示弹出层 |
| | | open: false, |
| | | // 日期范围 |
| | | dateRange: [], |
| | | // 查询参数 |
| | | queryParams: { |
| | | dictName: undefined, |
| | | dictType: undefined, |
| | | status: 0 |
| | | editSetting: { |
| | | title: '', |
| | | id: '', |
| | | show: false, |
| | | }, |
| | | items:items, |
| | | filterFrom: {}, |
| | | items: [ |
| | | { |
| | | type: 'text', |
| | | dataIndex: 'name', |
| | | label: '部门名称', |
| | | placeholder: '请输入', |
| | | defaultValue: '', |
| | | }, |
| | | { |
| | | type: 'text', |
| | | dataIndex: 'code', |
| | | label: '编号', |
| | | placeholder: '请输入', |
| | | defaultValue: '', |
| | | }, |
| | | { |
| | | type: 'select', |
| | | dataIndex: 'status', |
| | | label: '状态', |
| | | placeholder: '请选择', |
| | | defaultValue: '1', |
| | | options: [ |
| | | { |
| | | value: '1', |
| | | label: '启用', |
| | | }, |
| | | { |
| | | value: '0', |
| | | label: '禁用', |
| | | }, |
| | | ], |
| | | }, |
| | | ], |
| | | table: { |
| | | showIndex: true, // 是否显示序号 |
| | | expand: false, // 是否显示详情数据 |
| | | url: SettingIplatform.apiBaseURL + '/system/dict/type/list', // 请求地址 |
| | | url: SettingIplatform.apiBaseURL + '/pc/fin/sys/tenant/department/list', // 请求地址 |
| | | // 工具条 |
| | | tools: { |
| | | columnsCtrl: {// 列控制按钮 |
| | | show: false |
| | | columnsCtrl: { |
| | | // 列控制按钮 |
| | | show: false, |
| | | }, |
| | | generalExport: {// 通用导出按钮 |
| | | show: false |
| | | generalExport: { |
| | | // 通用导出按钮 |
| | | show: false, |
| | | }, |
| | | // 自定义工具条按钮 |
| | | custom: [ |
| | | { |
| | | { |
| | | name: '新增', |
| | | click: () => { |
| | | this.showAdd(null); |
| | | this.handleAdd(null); |
| | | }, |
| | | }, |
| | | ] |
| | | ], |
| | | }, |
| | | // 列信息 |
| | | columns: [ |
| | | {title: '编号', field: 'dict_id', align: 'center', width: '100px'}, |
| | | {title: '部门', field: 'dict_name', align: 'left'}, |
| | | {title: '顺序号', field: 'dict_name', align: 'left'}, |
| | | {title: '备注', field: 'remark', align: 'left', width: '200px'}, |
| | | { title: '编号', field: 'code', align: 'center', width: 80 }, |
| | | { title: '部门', field: 'name', align: 'left', minWidth: 200 }, |
| | | { title: '顺序号', field: 'orderNum', align: 'center', width: 100 }, |
| | | { title: '备注', field: 'remark', align: 'left', minWidth: 200 }, |
| | | { |
| | | title: '状态', field: 'status', align: 'center', width: '180px', |
| | | formatter: row => { |
| | | return { value: row.status=== 0? '启用':'禁用' } |
| | | } |
| | | title: '状态', |
| | | field: 'status', |
| | | align: 'center', |
| | | width: 100, |
| | | formatter: (row) => { |
| | | return { value: row.status === 1 ? '启用' : '禁用' }; |
| | | }, |
| | | }, |
| | | ], |
| | | // 操作信息 |
| | | operation: { |
| | | // width: 150, |
| | | width: 100, |
| | | align: 'center', |
| | | show: false, // 显示操作列 |
| | | show: true, // 显示操作列 |
| | | attr: [ |
| | | // 分类下有正在进行中的项目时,给出提示不允许禁用和删除。且禁用一级分类前需要先禁用下面的所有二级,有启用的二级时不允许禁用一级 |
| | | { |
| | | // checkPermission:'system:role:edit', |
| | | title: '修改', |
| | | events: row => { |
| | | this.handleUpdate(row) |
| | | } |
| | | title: '编辑', |
| | | events: (row) => { |
| | | this.showEdit(row); |
| | | }, |
| | | }, |
| | | // { |
| | | // // checkPermission: 'system:role:remove', |
| | | // title: '删除', |
| | | // events: row => { |
| | | // this.handleDelete(row) |
| | | // } |
| | | // }, |
| | | ] |
| | | ], |
| | | }, |
| | | paging: { |
| | | show: true, // 显示分页 |
| | |
| | | small: false, |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | total: 0 |
| | | } |
| | | } |
| | | total: 0, |
| | | }, |
| | | }, |
| | | }, |
| | | // 表单参数 |
| | | form: {}, |
| | | // 表单校验 |
| | | rules: { |
| | | dictName: [ |
| | | { required: true, message: "字典名称不能为空", trigger: "blur" } |
| | | ], |
| | | dictType: [ |
| | | { required: true, message: "字典类型不能为空", trigger: "blur" } |
| | | ] |
| | | } |
| | | }; |
| | | }, |
| | | created() { |
| | | this.initTreeData() |
| | | this.initTreeData(); |
| | | }, |
| | | methods: { |
| | | // 左侧树初始化 |
| | |
| | | }); |
| | | }, |
| | | nodeClick(param) { |
| | | console.log(param,'param'); |
| | | this.search(1) |
| | | this.p = Object.assign( |
| | | {}, |
| | | { |
| | | id: param.id, |
| | | name: param.name, |
| | | }, |
| | | ); |
| | | if (this.p.id) { |
| | | this.filterFrom.tenantId = this.p.id; |
| | | this.editSetting.tenantId = this.p.id; |
| | | } else { |
| | | this.filterFrom.tenantId = null; |
| | | this.editSetting.tenantId = null; |
| | | } |
| | | this.search(1); |
| | | }, |
| | | fifterForm(params) { |
| | | this.queryParams = Object.assign(this.queryParams, params) |
| | | this.search(1) |
| | | this.filterFrom = Object.assign(this.filterFrom, params); |
| | | this.search(1); |
| | | }, |
| | | // 查询table列表 |
| | | search(pageNum) { |
| | | if (pageNum != undefined) { |
| | | this.$refs.myTable.search(pageNum) |
| | | this.$refs.myTable.search({pageNum}); |
| | | } else { |
| | | this.$refs.myTable.search() |
| | | this.$refs.myTable.search(); |
| | | } |
| | | }, |
| | | dateTo(val) { |
| | | return DateFormatter.LongToDateTime(val); |
| | | }, |
| | | changeSize(e){ |
| | | this.queryParams.pageSize = e |
| | | this.getList() |
| | | }, |
| | | changePage(e){ |
| | | this.queryParams.pageNum = e |
| | | this.getList() |
| | | }, |
| | | /** 查询字典类型列表 */ |
| | | getList() { |
| | | this.loading = true; |
| | | listType(this.queryParams).then(response => { |
| | | // this.typeList = response.rows; |
| | | this.typeList = response.datas; |
| | | this.total = response.totalRows; |
| | | this.loading = false; |
| | | } |
| | | ); |
| | | }, |
| | | // 取消按钮 |
| | | cancel() { |
| | | this.open = false; |
| | | this.reset(); |
| | | }, |
| | | // 表单重置 |
| | | reset() { |
| | | this.form = { |
| | | dictId: undefined, |
| | | dictName: undefined, |
| | | dictType: undefined, |
| | | status: "0", |
| | | remark: undefined |
| | | }; |
| | | this.resetForm("form"); |
| | | }, |
| | | /** 搜索按钮操作 */ |
| | | handleQuery() { |
| | | this.queryParams.pageNum = 1; |
| | | this.getList(); |
| | | }, |
| | | /** 重置按钮操作 */ |
| | | resetQuery() { |
| | | this.dateRange = []; |
| | | this.resetForm("queryForm"); |
| | | this.handleQuery(); |
| | | }, |
| | | /** 新增按钮操作 */ |
| | | handleAdd() { |
| | | this.reset(); |
| | | this.open = true; |
| | | this.title = "添加字典类型"; |
| | | if (this.editSetting.tenantId) { |
| | | this.editSetting.id = null; |
| | | this.editSetting.info = null; |
| | | this.editSetting.title = '新增'; |
| | | this.editSetting.show = true; |
| | | } else { |
| | | this.$message.warning('请先选择左侧机构'); |
| | | } |
| | | }, |
| | | // 多选框选中数据 |
| | | handleSelectionChange(selection) { |
| | | this.ids = selection.map(item => item.dictId) |
| | | this.single = selection.length!=1 |
| | | this.multiple = !selection.length |
| | | showEdit(row) { |
| | | console.log(row); |
| | | this.editSetting.id = row.id; |
| | | this.editSetting.info = row; |
| | | this.editSetting.title = '编辑'; |
| | | this.editSetting.show = true; |
| | | }, |
| | | /** 修改按钮操作 */ |
| | | handleUpdate(row) { |
| | | this.reset(); |
| | | const dictId = row.dict_id || this.ids |
| | | getType(dictId).then(response => { |
| | | this.form = response; |
| | | this.form.dictName = this.form.dict_name |
| | | this.form.dictType = this.form.dict_type |
| | | this.open = true; |
| | | this.title = "修改字典类型"; |
| | | }); |
| | | }, |
| | | /** 提交按钮 */ |
| | | submitForm: function() { |
| | | this.$refs["form"].validate(valid => { |
| | | if (valid) { |
| | | if (this.form.dictId != undefined) { |
| | | updateType(this.form).then(response => { |
| | | this.$modal.msgSuccess("修改成功"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } else { |
| | | addType(this.form).then(response => { |
| | | this.$modal.msgSuccess("新增成功"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | /** 删除按钮操作 */ |
| | | handleDelete(row) { |
| | | const dictIds = row.dictId || this.ids; |
| | | this.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?').then(function() { |
| | | return delType(dictIds); |
| | | }).then(() => { |
| | | this.getList(); |
| | | this.$modal.msgSuccess("删除成功"); |
| | | }).catch(() => {}); |
| | | }, |
| | | /** 导出按钮操作 */ |
| | | handleExport() { |
| | | this.download('system/dict/type/export', { |
| | | ...this.queryParams |
| | | }, `type_${new Date().getTime()}.xlsx`) |
| | | }, |
| | | /** 刷新缓存按钮操作 */ |
| | | handleRefreshCache() { |
| | | refreshCache().then(() => { |
| | | this.$modal.msgSuccess("刷新成功"); |
| | | this.$store.dispatch('dict/cleanDict'); |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | }; |
| | | </script> |