| | |
| | | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
| | | <el-form-item label="åå
¸åç§°" prop="dictType"> |
| | | <el-select v-model="queryParams.dictType"> |
| | | <el-option |
| | | v-for="item in typeOptions" |
| | | :key="item.dictId" |
| | | :label="item.dictName" |
| | | :value="item.dictType" |
| | | /> |
| | | <el-option v-for="item in typeOptions" :key="item.dictId" :label="item.dictName" :value="item.dictType" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="åå
¸æ ç¾" prop="dictLabel"> |
| | | <el-input |
| | | v-model="queryParams.dictLabel" |
| | | placeholder="请è¾å
¥åå
¸æ ç¾" |
| | | clearable |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | <el-input v-model="queryParams.dictLabel" placeholder="请è¾å
¥åå
¸æ ç¾" clearable @keyup.enter.native="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="ç¶æ" prop="status"> |
| | | <el-select v-model="queryParams.status" placeholder="æ°æ®ç¶æ" clearable> |
| | | <el-option |
| | | v-for="dict in dict.type.sys_normal_disable" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | <el-option v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | |
| | | |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="primary" |
| | | plain |
| | | icon="el-icon-plus" |
| | | size="mini" |
| | | @click="handleAdd" |
| | | v-hasPermi="['system:dict:add']" |
| | | >æ°å¢</el-button> |
| | | <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:dict:add']">æ°å¢</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="success" |
| | | plain |
| | | icon="el-icon-edit" |
| | | size="mini" |
| | | :disabled="single" |
| | | @click="handleUpdate" |
| | | v-hasPermi="['system:dict:edit']" |
| | | >ä¿®æ¹</el-button> |
| | | <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['system:dict:edit']">ä¿®æ¹</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="danger" |
| | | plain |
| | | icon="el-icon-delete" |
| | | size="mini" |
| | | :disabled="multiple" |
| | | @click="handleDelete" |
| | | v-hasPermi="['system:dict:remove']" |
| | | >å é¤</el-button> |
| | | <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['system:dict:remove']">å é¤</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="warning" |
| | | plain |
| | | icon="el-icon-download" |
| | | size="mini" |
| | | @click="handleExport" |
| | | v-hasPermi="['system:dict:export']" |
| | | >导åº</el-button> |
| | | <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:dict:export']">导åº</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="warning" |
| | | plain |
| | | icon="el-icon-close" |
| | | size="mini" |
| | | @click="handleClose" |
| | | >å
³é</el-button> |
| | | <el-button type="warning" plain icon="el-icon-close" size="mini" @click="handleClose">å
³é</el-button> |
| | | </el-col> |
| | | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | |
| | | </el-table-column> |
| | | <el-table-column label="æä½" align="center" class-name="small-padding fixed-width"> |
| | | <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> |
| | | <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> |
| | | |
| | | <pagination |
| | | v-show="total>0" |
| | | :total="total" |
| | | :page.sync="queryParams.pageNum" |
| | | :limit.sync="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" /> |
| | | |
| | | <!-- æ·»å æä¿®æ¹åæ°é
ç½®å¯¹è¯æ¡ --> |
| | | <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> |
| | |
| | | </el-form-item> |
| | | <el-form-item label="åæ¾æ ·å¼" prop="listClass"> |
| | | <el-select v-model="form.listClass"> |
| | | <el-option |
| | | v-for="item in listClassOptions" |
| | | :key="item.value" |
| | | :label="item.label + '(' + item.value + ')'" |
| | | :value="item.value" |
| | | ></el-option> |
| | | <el-option v-for="item in listClassOptions" :key="item.value" :label="item.label + '(' + item.value + ')'" :value="item.value"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ç¶æ" prop="status"> |
| | | <el-radio-group v-model="form.status"> |
| | | <el-radio |
| | | v-for="dict in dict.type.sys_normal_disable" |
| | | :key="dict.value" |
| | | :label="dict.value" |
| | | >{{dict.label}}</el-radio> |
| | | <el-radio v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="夿³¨" prop="remark"> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data"; |
| | | import { optionselect as getDictOptionselect, getType } from "@/api/system/dict/type"; |
| | | import { listData, getData, delData, addData, updateData } from '@/api/system/dict/data'; |
| | | import { optionselect as getDictOptionselect, getType } from '@/api/system/dict/type'; |
| | | |
| | | export default { |
| | | name: "Data", |
| | | name: 'Data', |
| | | dicts: ['sys_normal_disable'], |
| | | data() { |
| | | return { |
| | |
| | | // åå
¸è¡¨æ ¼æ°æ® |
| | | dataList: [], |
| | | // é»è®¤åå
¸ç±»å |
| | | defaultDictType: "", |
| | | defaultDictType: '', |
| | | // å¼¹åºå±æ é¢ |
| | | title: "", |
| | | title: '', |
| | | // æ¯å¦æ¾ç¤ºå¼¹åºå± |
| | | open: false, |
| | | // æ°æ®æ ç¾åæ¾æ ·å¼ |
| | | listClassOptions: [ |
| | | { |
| | | value: "default", |
| | | label: "é»è®¤" |
| | | value: 'default', |
| | | label: 'é»è®¤', |
| | | }, |
| | | { |
| | | value: "primary", |
| | | label: "主è¦" |
| | | value: 'primary', |
| | | label: '主è¦', |
| | | }, |
| | | { |
| | | value: "success", |
| | | label: "æå" |
| | | value: 'success', |
| | | label: 'æå', |
| | | }, |
| | | { |
| | | value: "info", |
| | | label: "ä¿¡æ¯" |
| | | value: 'info', |
| | | label: 'ä¿¡æ¯', |
| | | }, |
| | | { |
| | | value: "warning", |
| | | label: "è¦å" |
| | | value: 'warning', |
| | | label: 'è¦å', |
| | | }, |
| | | { |
| | | value: "danger", |
| | | label: "å±é©" |
| | | } |
| | | value: 'danger', |
| | | label: 'å±é©', |
| | | }, |
| | | ], |
| | | // ç±»åæ°æ®åå
¸ |
| | | typeOptions: [], |
| | |
| | | pageSize: 10, |
| | | dictName: undefined, |
| | | dictType: undefined, |
| | | status: undefined |
| | | status: undefined, |
| | | }, |
| | | // 表ååæ° |
| | | form: {}, |
| | | // è¡¨åæ ¡éª |
| | | rules: { |
| | | dictLabel: [ |
| | | { required: true, message: "æ°æ®æ ç¾ä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ], |
| | | dictValue: [ |
| | | { required: true, message: "æ°æ®é®å¼ä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ], |
| | | dictSort: [ |
| | | { required: true, message: "æ°æ®é¡ºåºä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ] |
| | | } |
| | | dictLabel: [{ required: true, message: 'æ°æ®æ ç¾ä¸è½ä¸ºç©º', trigger: 'blur' }], |
| | | dictValue: [{ required: true, message: 'æ°æ®é®å¼ä¸è½ä¸ºç©º', trigger: 'blur' }], |
| | | dictSort: [{ required: true, message: 'æ°æ®é¡ºåºä¸è½ä¸ºç©º', trigger: 'blur' }], |
| | | }, |
| | | }; |
| | | }, |
| | | created() { |
| | | const dictId = this.$route.params && this.$route.params.dictId; |
| | | this.getType(dictId); |
| | | this.getType('optionselect'); |
| | | this.getTypeList(); |
| | | }, |
| | | methods: { |
| | | /** æ¥è¯¢åå
¸ç±»åè¯¦ç» */ |
| | | getType(dictId) { |
| | | getType(dictId).then(response => { |
| | | getType(dictId).then((response) => { |
| | | this.queryParams.dictType = response.data.dictType; |
| | | this.defaultDictType = response.data.dictType; |
| | | this.getList(); |
| | |
| | | }, |
| | | /** æ¥è¯¢åå
¸ç±»åå表 */ |
| | | getTypeList() { |
| | | getDictOptionselect().then(response => { |
| | | getDictOptionselect().then((response) => { |
| | | this.typeOptions = response.data; |
| | | }); |
| | | }, |
| | | /** æ¥è¯¢åå
¸æ°æ®å表 */ |
| | | getList() { |
| | | this.loading = true; |
| | | listData(this.queryParams).then(response => { |
| | | listData(this.queryParams).then((response) => { |
| | | this.dataList = response.rows; |
| | | this.total = response.total; |
| | | this.loading = false; |
| | |
| | | cssClass: undefined, |
| | | listClass: 'default', |
| | | dictSort: 0, |
| | | status: "0", |
| | | remark: undefined |
| | | status: '0', |
| | | remark: undefined, |
| | | }; |
| | | this.resetForm("form"); |
| | | this.resetForm('form'); |
| | | }, |
| | | /** æç´¢æé®æä½ */ |
| | | handleQuery() { |
| | |
| | | }, |
| | | /** è¿åæé®æä½ */ |
| | | handleClose() { |
| | | const obj = { path: "/system/dict" }; |
| | | const obj = { path: '/system/dict' }; |
| | | this.$tab.closeOpenPage(obj); |
| | | }, |
| | | /** éç½®æé®æä½ */ |
| | | resetQuery() { |
| | | this.resetForm("queryForm"); |
| | | this.resetForm('queryForm'); |
| | | this.queryParams.dictType = this.defaultDictType; |
| | | this.handleQuery(); |
| | | }, |
| | |
| | | handleAdd() { |
| | | this.reset(); |
| | | this.open = true; |
| | | this.title = "æ·»å åå
¸æ°æ®"; |
| | | this.title = 'æ·»å åå
¸æ°æ®'; |
| | | this.form.dictType = this.queryParams.dictType; |
| | | }, |
| | | // å¤éæ¡é䏿°æ® |
| | | handleSelectionChange(selection) { |
| | | this.ids = selection.map(item => item.dictCode) |
| | | this.single = selection.length!=1 |
| | | this.multiple = !selection.length |
| | | this.ids = selection.map((item) => item.dictCode); |
| | | this.single = selection.length != 1; |
| | | this.multiple = !selection.length; |
| | | }, |
| | | /** ä¿®æ¹æé®æä½ */ |
| | | handleUpdate(row) { |
| | | this.reset(); |
| | | const dictCode = row.dictCode || this.ids |
| | | getData(dictCode).then(response => { |
| | | const dictCode = row.dictCode || this.ids; |
| | | getData(dictCode).then((response) => { |
| | | this.form = response.data; |
| | | this.open = true; |
| | | this.title = "ä¿®æ¹åå
¸æ°æ®"; |
| | | this.title = 'ä¿®æ¹åå
¸æ°æ®'; |
| | | }); |
| | | }, |
| | | /** æäº¤æé® */ |
| | | submitForm: function() { |
| | | this.$refs["form"].validate(valid => { |
| | | this.$refs['form'].validate((valid) => { |
| | | if (valid) { |
| | | if (this.form.dictCode != undefined) { |
| | | updateData(this.form).then(response => { |
| | | updateData(this.form).then((response) => { |
| | | this.$store.dispatch('dict/removeDict', this.queryParams.dictType); |
| | | this.$modal.msgSuccess("ä¿®æ¹æå"); |
| | | this.$modal.msgSuccess('ä¿®æ¹æå'); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } else { |
| | | addData(this.form).then(response => { |
| | | addData(this.form).then((response) => { |
| | | this.$store.dispatch('dict/removeDict', this.queryParams.dictType); |
| | | this.$modal.msgSuccess("æ°å¢æå"); |
| | | this.$modal.msgSuccess('æ°å¢æå'); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | |
| | | /** å é¤æé®æä½ */ |
| | | handleDelete(row) { |
| | | const dictCodes = row.dictCode || this.ids; |
| | | this.$modal.confirm('æ¯å¦ç¡®è®¤å é¤åå
¸ç¼ç 为"' + dictCodes + '"çæ°æ®é¡¹ï¼').then(function() { |
| | | this.$modal |
| | | .confirm('æ¯å¦ç¡®è®¤å é¤åå
¸ç¼ç 为"' + dictCodes + '"çæ°æ®é¡¹ï¼') |
| | | .then(function () { |
| | | return delData(dictCodes); |
| | | }).then(() => { |
| | | }) |
| | | .then(() => { |
| | | this.getList(); |
| | | this.$modal.msgSuccess("å 餿å"); |
| | | this.$modal.msgSuccess('å 餿å'); |
| | | this.$store.dispatch('dict/removeDict', this.queryParams.dictType); |
| | | }).catch(() => {}); |
| | | }) |
| | | .catch(() => {}); |
| | | }, |
| | | /** å¯¼åºæé®æä½ */ |
| | | handleExport() { |
| | | this.download('system/dict/data/export', { |
| | | ...this.queryParams |
| | | }, `data_${new Date().getTime()}.xlsx`) |
| | | } |
| | | } |
| | | this.download( |
| | | 'system/dict/data/export', |
| | | { |
| | | ...this.queryParams, |
| | | }, |
| | | `data_${new Date().getTime()}.xlsx` |
| | | ); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |