Commit 58f796ae by liyuhang19990520

下拉组件

parent bd837ca8
......@@ -5,6 +5,7 @@
margin: 0;
box-sizing: border-box;
}
.disabel {
border: none !important;
background-color: #ecedf1 !important;
......@@ -61,7 +62,7 @@ $width: 1210px;
background-color: $base-color !important;
}
body {
body /deep/ {
line-height: 1.8;
font-family: "Helvetica Neue", Helvetica, "MicrosoftYaHei", "PingFang SC", "Hiragino Sans GB", "WenQuanYi Micro Hei",
sans-serif;
......
<!--
* @Author: your name
* @Date: 2021-11-25 10:15:01
* @LastEditTime: 2021-11-25 10:18:56
* @LastEditTime: 2021-11-25 11:31:33
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \founder_vue\src\components\SelectCode.vue
-->
<template>
<el-select
v-model="value"
multiple
filterable
allow-create
default-first-option
loading
placeholder="请选择文章标签"
>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
<div :style="{ width: width + 'px' }">
<el-select
v-model="value"
filterable
popper-class="popperClass"
:multiple="multiple"
default-first-option
:popper-append-to-body="false"
:loading="options.length <= 0"
:placeholder="placeholder"
@focus="placeholder = '请输入'"
@blur="placeholder = '请选择'"
:clearable="clearable"
@change="change"
>
</el-option>
</el-select>
<el-option
v-for="item in options"
:key="item.id"
:label="item.name"
:value="item.code"
>
</el-option>
</el-select>
</div>
</template>
<script>
export default {
data() {
return {
options: [
{
value: "HTML",
label: "HTML",
},
{
value: "CSS",
label: "CSS",
},
{
value: "JavaScript",
label: "JavaScript",
},
],
placeholder: "请选择",
options: [],
value: [],
};
},
mounted(){
console.log(11111111111)
props: {
//接口的最后的url
codeUrl: {
type: String,
required: true,
},
//是否多选
multiple: Boolean,
//是否有清楚功能
clearable: {
type: Boolean,
default: true,
},
//form
form: Object,
//form对应的字段
id: String,
//宽度设置
width: {
type: [String, Number],
default: 264,
},
},
watch: {
multiple: {
handler(val) {
if (val == true) {
this.value = [];
} else {
this.value = "";
}
},
immediate: true,
},
},
methods: {
change(val) {
let newVal = val;
if (!newVal && !this.multiple) newVal = "";
if (newVal.length <= 0 && this.multiple) newVal = "";
this.$set(this.form, this.id, newVal);
},
getOptions() {
this.$axios.get("/api/code/" + this.codeUrl).then((res) => {
if (res.data.code == 0 && res.data.message == "success") {
this.options = res.data.ret || [];
}
});
},
},
mounted() {
this.getOptions();
},
};
</script>
\ No newline at end of file
</script>
<style>
</style>
<style lang="scss" scoped>
.el-select /deep/ {
width: 100% !important;
.popperClass {
.el-select-dropdown__item {
padding: 0 10px;
box-sizing: border-box;
}
}
}
</style>
\ No newline at end of file
/*
* @Author: your name
* @Date: 2021-11-02 15:41:31
* @LastEditTime: 2021-11-22 16:06:21
* @LastEditTime: 2021-11-25 10:45:50
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \founder_vue\src\store\modules\user.js
......@@ -28,7 +28,7 @@ const mutations = {
const actions = {
_getList(context, options) {
_axios.get('JsonData/CODE_DW.json', { loading: false }).then(res => {
_axios.get('JsonData/CODE_DW.json').then(res => {
if (res.data.code == 0 && res.data.message == "success") {
context.commit('resetUnitData', res.data.ret);
}
......
......@@ -294,12 +294,11 @@
<Cascader :form="addFormParams" id="unitCode"></Cascader>
</el-form-item>
<el-form-item class="info-item" label="用户警号:" prop="policeNumber">
<SelectCode></SelectCode>
<!-- <el-input
<el-input
placeholder="请输入用户警号"
class="input-info"
v-model="addFormParams.policeNumber"
></el-input> -->
></el-input>
</el-form-item>
<el-form-item class="info-item" label="密码:" prop="password">
<el-input
......@@ -785,24 +784,26 @@ export default {
this.$refs.editFormParams.validate((valid) => {
console.log(valid);
if (valid) {
this.$axios.put("/security/users", this.editFormParams).then((res) => {
if (res.data.code == 200) {
setTimeout(() => {
this.$message.success("修改成功");
}, 800);
this.isShowEditUserDialog = false;
this.isShowEditUserDialogBg = false;
this.search();
} else if (res.data.code == 400 || res.data.code == 500) {
setTimeout(() => {
this.$message.error(res.data.detail);
}, 500);
} else if (res.data.code == 404) {
setTimeout(() => {
this.$message.error("服务不存在");
}, 500);
}
});
this.$axios
.put("/security/users", this.editFormParams)
.then((res) => {
if (res.data.code == 200) {
setTimeout(() => {
this.$message.success("修改成功");
}, 800);
this.isShowEditUserDialog = false;
this.isShowEditUserDialogBg = false;
this.search();
} else if (res.data.code == 400 || res.data.code == 500) {
setTimeout(() => {
this.$message.error(res.data.detail);
}, 500);
} else if (res.data.code == 404) {
setTimeout(() => {
this.$message.error("服务不存在");
}, 500);
}
});
} else {
console.log("error submit!!");
return false;
......@@ -893,18 +894,24 @@ export default {
// 人员信息
getPersonInfor(id) {
this.loading = true;
this.$axios.get("/security/users/" + id, { loading: false }).then((res) => {
this.loading = false;
if (res.data) {
let result = res.data;
for (let key in this.editFormParams) {
this.$set(this.editFormParams, key, result[key]);
this.$axios
.get("/security/users/" + id, { loading: false })
.then((res) => {
this.loading = false;
if (res.data) {
let result = res.data;
for (let key in this.editFormParams) {
this.$set(this.editFormParams, key, result[key]);
}
this.$set(this.editFormParams, "id", id);
this.$set(
this.editFormParams,
"userGroupId",
result["userGroupIds"]
);
this.$set(this.editFormParams, "roleId", result["roleIds"]);
}
this.$set(this.editFormParams, "id", id);
this.$set(this.editFormParams, "userGroupId", result["userGroupIds"]);
this.$set(this.editFormParams, "roleId", result["roleIds"]);
}
});
});
},
// 关闭新增弹窗
canceladd() {
......
/*
* @Author: your name
* @Date: 2021-09-07 09:57:48
* @LastEditTime: 2021-11-25 10:25:19
* @LastEditTime: 2021-11-25 10:26:49
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \指纹系统\founder_vue\vue.config.js
......@@ -126,12 +126,12 @@ module.exports = {
// },
"/security": {
target: "http://192.168.128.106:8765", // 湖南-王
// target: "http://www.meetfood.cn:2390/system", // 湖南-王
//target: "http://192.168.128.106:8765", // 湖南-王
target: "http://www.meetfood.cn:2390", // 湖南-王
ws: true,
changeOrigin: true,
pathRewrite: {
"^/security": ""
"^/security": "/security"
}
}
// 阿里
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment