¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-dialog :title="titleMap[mode]" v-model="visible" :width="600" destroy-on-close @closed="$emit('closed')"> |
| | | <el-form :model="addParamForm" :rules="addParamRules" :disabled="mode=='show'" ref="dialogForm" label-width="120px" label-position="center"> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="åæ°åç§°" prop="paramName"> |
| | | <el-input v-model="addParamForm.paramName" :placeholder="mode =='add'?'请è¾å
¥åæ°åç§°':''" clearable></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="åæ°é®å" prop="paramKey"> |
| | | <el-input v-model="addParamForm.paramKey" :placeholder="mode =='add'?'请è¾å
¥åæ°é®å':''" clearable></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="åæ°é®å¼" prop="paramValue"> |
| | | <el-input v-model="addParamForm.paramValue" type="textarea" :placeholder="mode =='add'?'请è¾å
¥åæ°é®å¼':''" clearable></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="æè¿°" > |
| | | <el-input v-model="addParamForm.remark" :placeholder="mode =='add'?'请è¾å
¥æè¿°':''" clearable></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <el-button v-if="mode!='show'" type="primary" :loading="isSaveing" @click="ParamSubmit">{{mode =='add'?"ä¿ å":"ä¿® æ¹"}}</el-button> |
| | | <el-button @click="visible=false">å æ¶</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | emits: ['success', 'closed'], |
| | | data() { |
| | | return { |
| | | value1: true, |
| | | mode: "add", |
| | | titleMap: { |
| | | add: 'æ°å¢', |
| | | edit: 'ä¿®æ¹', |
| | | show: 'æ¥ç' |
| | | }, |
| | | visible: false, |
| | | isSaveing: false, |
| | | //è¡¨åæ°æ® |
| | | addParamForm: { |
| | | paramKey: "", |
| | | paramName: "", |
| | | paramValue: "", |
| | | remark: "" |
| | | }, |
| | | //éªè¯è§å |
| | | addParamRules: { |
| | | paramName:[{required: true, message: '请è¾å
¥åæ°åç§°'}], |
| | | paramKey:[{required: true, message: '请è¾å
¥åæ°é®å'}], |
| | | paramValue:[{required: true, message: '请è¾å
¥åæ°é®å¼'}] |
| | | }, |
| | | //æéæ°æ®é项 |
| | | groups: [], |
| | | groupsProps: { |
| | | value: "id", |
| | | multiple: true, |
| | | checkStrictly: true |
| | | }, |
| | | depts: [], |
| | | deptsProps: { |
| | | value: "id", |
| | | checkStrictly: true |
| | | } |
| | | } |
| | | }, |
| | | mounted() { |
| | | // this.getGroup() |
| | | // this.getDept() |
| | | }, |
| | | methods: { |
| | | //æ¾ç¤º |
| | | open(mode='add'){ |
| | | this.mode = mode; |
| | | this.visible = true; |
| | | return this |
| | | }, |
| | | //å è½½æ æ°æ® |
| | | async getGroup(){ |
| | | var res = await this.$API.system.role.list.get(); |
| | | this.groups = res.data.rows; |
| | | }, |
| | | async getDept(){ |
| | | var res = await this.$API.system.dept.list.get(); |
| | | this.depts = res.data; |
| | | }, |
| | | //表åæäº¤æ¹æ³ |
| | | ParamSubmit(){ |
| | | var obj = Object.assign({},this.addParamForm); |
| | | this.$refs.dialogForm.validate(async (valid) => { |
| | | if (valid) { |
| | | this.isSaveing = true; |
| | | this.$HTTP.post("/api/blade-system/param/submit",obj).then(res=> { |
| | | this.isSaveing = false; |
| | | if(res.code == 200) { |
| | | this.$emit('success', this.addParamForm, this.mode); |
| | | this.visible = false; |
| | | this.$message.success("æä½æå"); |
| | | this.addParamForm = { |
| | | paramKey: "", |
| | | paramName: "", |
| | | paramValue: "", |
| | | remark: "" |
| | | } |
| | | }else { |
| | | this.$alert(res.message, "æç¤º", {type: 'error'}); |
| | | } |
| | | }) |
| | | }else{ |
| | | return false; |
| | | } |
| | | }) |
| | | }, |
| | | //è¡¨åæ³¨å
¥æ°æ® |
| | | setData(data){ |
| | | console.log(data) |
| | | //å¯ä»¥åä¸é¢ä¸æ ·å个注å
¥ï¼ä¹å¯ä»¥åä¸é¢ä¸æ ·ç´æ¥åå¹¶è¿å» |
| | | Object.assign(this.addParamForm, data); |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <!-- |
| | | * @Author: lzhe lzhe@example.com |
| | | * @Date: 2024-03-26 10:28:33 |
| | | * @LastEditors: lzhe lzhe@example.com |
| | | * @LastEditTime: 2024-06-13 20:21:56 |
| | | * @FilePath: /smart-web/src/views/master/person/main/index.vue |
| | | * @Description: è¿æ¯é»è®¤è®¾ç½®,请设置`customMade`, æå¼koroFileHeaderæ¥çé
ç½® è¿è¡è®¾ç½®: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE |
| | | --> |
| | | <template> |
| | | <div class="param-main"> |
| | | <el-form :inline="true" :model="searchData" label-width="80px"> |
| | | <el-form-item label="åæ°åç§°"> |
| | | <el-input v-model="searchData.paramName" placeholder="åæ°åç§°" clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="åæ°é®å"> |
| | | <el-input v-model="searchData.paramKey" placeholder="åæ°é®å" clearable></el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="searchclick">æç´¢</el-button> |
| | | <el-button @click="searchClearBtn">æ¸
空</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div> |
| | | <div class="param-Btn"> |
| | | <div class="param-btn-bottom"> |
| | | <el-button type="primary" @click="addData">+ æ°å¢</el-button> |
| | | <el-button type="danger" plain @click="delData">å é¤</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="param-table"> |
| | | <el-table ref="multipleTableRef" :data="tableData" border style="width: 100%" class="multipleTableRef" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="paramName" label="åæ°åç§°"></el-table-column> |
| | | <el-table-column prop="paramKey" label="åæ°é®å"></el-table-column> |
| | | <el-table-column prop="paramValue" label="åæ°é®å¼"></el-table-column> |
| | | <el-table-column prop="remark" label="æè¿°"></el-table-column> |
| | | <el-table-column fixed="right" label="æä½"> |
| | | <template #default="scope"> |
| | | <el-button text type="primary" size="small" @click="table_show(scope.row, scope.$index)">æ¥ç</el-button> |
| | | <el-button type="text" size="small" @click="table_edit(scope.row, scope.$index)">ç¼è¾</el-button> |
| | | <el-button text type="primary" size="small" @click="table_del(scope.row, scope.$index)">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-pagination |
| | | style="margin-top: 12px;" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | :current-page="currentPage4" |
| | | :page-sizes="[15, 50, 100]" |
| | | :page-size="15" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="total"> |
| | | </el-pagination> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <save-dialog v-if="dialog.save" ref="saveDialog" @success="addparamSuccess" @closed="dialog.save=false"></save-dialog> |
| | | </template> |
| | | <script> |
| | | import saveDialog from './addParam' |
| | | export default { |
| | | name: "allocation", |
| | | data(){ |
| | | return { |
| | | getModalData: [], |
| | | selection: [], |
| | | total: 0, |
| | | searchData: { |
| | | paramName: "", |
| | | paramKey: "", |
| | | current: "1", |
| | | size: "15" |
| | | }, |
| | | dialog: { |
| | | save: false |
| | | }, |
| | | tableData: [] |
| | | } |
| | | }, |
| | | created(){ |
| | | |
| | | }, |
| | | mounted(){ |
| | | this.searchBtn(); |
| | | }, |
| | | components: { |
| | | saveDialog |
| | | }, |
| | | methods: { |
| | | codeClick() { |
| | | |
| | | }, |
| | | addparamSuccess(addparamForm) { |
| | | this.searchBtn(); |
| | | }, |
| | | searchClearBtn() { |
| | | this.searchData = { |
| | | code: "", |
| | | paramValue: "", |
| | | current: "1", |
| | | size: "15" |
| | | } |
| | | this.searchBtn(); |
| | | }, |
| | | searchclick() { |
| | | this.searchData.current = "1"; |
| | | this.searchData.size = "15"; |
| | | this.searchBtn(); |
| | | }, |
| | | searchBtn() { |
| | | this.$HTTP.get("/api/blade-system/param/list",this.searchData).then(res=> { |
| | | if(res.code == 200) { |
| | | this.tableData = res.data.records; |
| | | this.total = res.data.total; |
| | | } |
| | | }) |
| | | }, |
| | | //å é¤ |
| | | table_del(row) { |
| | | var that = this; |
| | | this.$confirm(`ç¡®å®å°éæ©æ°æ®å é¤?`, '', { |
| | | type: 'warning' |
| | | }).then(() => { |
| | | this.$HTTP.post("/api/blade-system/param/remove?ids="+row.id).then(res=> { |
| | | if(res.code == 200) { |
| | | that.$message.success("æä½æå"); |
| | | that.searchBtn(); |
| | | } |
| | | }) |
| | | }).catch(() => { |
| | | |
| | | }) |
| | | }, |
| | | //æ·»å |
| | | addData(){ |
| | | this.dialog.save = true |
| | | this.$nextTick(() => { |
| | | this.$refs.saveDialog.open() |
| | | }) |
| | | }, |
| | | table_edit(row){ |
| | | this.dialog.save = true; |
| | | this.$nextTick(() => { |
| | | this.$refs.saveDialog.open('edit').setData(row); |
| | | }) |
| | | }, |
| | | //æ¥ç |
| | | table_show(row){ |
| | | this.dialog.save = true |
| | | this.$nextTick(() => { |
| | | this.$refs.saveDialog.open('show').setData(row) |
| | | }) |
| | | }, |
| | | handleSelectionChange(selection) { |
| | | this.selection = selection; |
| | | }, |
| | | delData() { |
| | | if(this.selection.length == 0) { |
| | | this.$message({ |
| | | message: 'è¯·éæ©è³å°ä¸æ¡æ°æ®', |
| | | type: 'warning' |
| | | }); |
| | | return; |
| | | } |
| | | var selStr = ""; |
| | | this.selection.map(item=> { |
| | | selStr += item.id + "," |
| | | }) |
| | | selStr = selStr.replace(/,$/, ''); |
| | | var that = this; |
| | | this.$HTTP.post("/api/blade-system/param/remove?ids="+selStr).then(res=> { |
| | | if(res.code == 200) { |
| | | that.$message.success("æä½æå"); |
| | | that.searchclick(); |
| | | } |
| | | }) |
| | | }, |
| | | handleSizeChange(val) { |
| | | console.log(`æ¯é¡µ ${val} æ¡`); |
| | | this.searchData.current = "1"; |
| | | this.searchData.size = val; |
| | | this.searchBtn(); |
| | | }, |
| | | handleCurrentChange(val) { |
| | | console.log(`å½å页: ${val}`); |
| | | this.searchData.current = val; |
| | | this.searchBtn(); |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .param-main { |
| | | background-color: #fff; |
| | | margin: 8px; |
| | | padding: 8px; |
| | | } |
| | | .param-Btn { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | margin-bottom: 8px; |
| | | padding-left: 8px; |
| | | padding-right: 8px; |
| | | } |
| | | .searchStatus { |
| | | margin-right: 6px; |
| | | width: 200px; |
| | | } |
| | | .param-btn-bottom { |
| | | padding-left: 8px; |
| | | padding-right: 8px; |
| | | margin-bottom: 8px; |
| | | } |
| | | .param-table { |
| | | padding-left: 8px; |
| | | padding-right: 8px; |
| | | margin-bottom: 8px; |
| | | |
| | | } |
| | | .multipleTableRef { |
| | | margin-bottom: 8px; |
| | | } |
| | | </style> |