From 7c20fd15b7fbc2bd5756b39d5ab655cc849ffcc3 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期三, 16 七月 2025 22:39:23 +0800
Subject: [PATCH] 添加时间筛选
---
src/views/operate/baseSetting/illegalBuild/createUser/index.vue | 280 ++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 184 insertions(+), 96 deletions(-)
diff --git a/src/views/operate/baseSetting/illegalBuild/createUser/index.vue b/src/views/operate/baseSetting/illegalBuild/createUser/index.vue
index b609337..c38d71b 100644
--- a/src/views/operate/baseSetting/illegalBuild/createUser/index.vue
+++ b/src/views/operate/baseSetting/illegalBuild/createUser/index.vue
@@ -2,43 +2,45 @@
<div class="createUser">
<main>
<div class="mainContent">
- <el-form ref="user" label-width="140px" autoComplete="on" :model="things" label-position="right">
- <!-- 杩濊浜嬮」缂栧彿 -->
- <el-form-item class="optionItem" label="杩濊浜嬮」缂栧彿:" prop="number">
- <el-input v-model="things.number" placeholder="璇峰~鍐欒繚瑙勪簨椤圭紪鍙�"></el-input>
+ <el-form ref="user" :rules="createIll" label-width="140px" autoComplete="on" :model="things"
+ label-position="right">
+ <!-- 鏂板鐨勭被鍨嬫垨澶х被鎴栧皬绫� -->
+ <el-form-item class="optionItem" label="鏂板鍚嶇О:" prop="name">
+ <el-input v-model="things.name" placeholder="璇疯緭鍏ユ柊澧炲悕绉�"></el-input>
</el-form-item>
- <!-- 鎵�灞炵被鍨� -->
- <el-form-item class="optionItems" label="鎵�灞炵被鍨�:" prop="typeThird">
- <el-select v-model="things.typeThird" placeholder="璇烽�夋嫨鎵�灞炵被鍨�" >
- <el-option v-for="item in typeThirdList" :key="item.id" :label="item.name"
- :value="item.id">
+ <!-- 璇烽�夋嫨绾у埆 -->
+ <el-form-item class="optionItem" label="绾у埆:" prop="level">
+ <el-select v-model="things.level" placeholder="璇烽�夋嫨鎵�灞炵被鍨�" @change="resetParentList">
+ <el-option v-for="item in levelList" :key="item.value" :label="item.label"
+ :value="item.value">
</el-option>
</el-select>
</el-form-item>
- <!-- 鎵�灞炲ぇ绫� -->
- <el-form-item class="optionItem" label="鎵�灞炲ぇ绫�:" prop="typeSecond">
- <el-select v-model="things.typeSecond" placeholder="璇烽�夋嫨鎵�灞炵被鍨�" >
- <el-option v-for="item in typeSecondList" :key="item.id" :label="item.name"
- :value="item.id">
- </el-option>
- </el-select>
- </el-form-item>
- <!-- 鎵�灞炲皬绫� -->
- <el-form-item class="optionItem" label="鎵�灞炲皬绫�:" prop="typeFirst">
- <el-select v-model="things.typeFirst" placeholder="璇烽�夋嫨鎵�灞炵被鍨�" disabled>
- <el-option v-for="item in typeFirstList" :key="item.id" :label="item.name"
- :value="item.id">
+ <!-- 鐖剁骇id -->
+ <el-form-item class="optionItem" label="鐖剁骇:" prop="parentId">
+ <el-select ref="projectApplicant" v-model="things.parentId" placeholder="璇烽�夋嫨鎵�灞炵埗绾�" :disabled="things.level===1">
+ <!-- <el-option v-for="item in parentList" :key="item.id" :label="item.name" :value="item.id">
+ </el-option> -->
+ <el-option :value="mylabel">
+ <el-tree ref="tree" :check-strictly="true"
+ :data="parentList"
+ :props="defaultProps"
+ :show-checkbox="false"
+ @check-change="handleCheck"
+ @node-click="handleCheck"
+ default-expand-all
+ node-key="id">
+ </el-tree>
</el-option>
</el-select>
</el-form-item>
<!-- 妗堢敱 -->
- <el-form-item class="optionItem" label="妗堢敱:" prop="type">
- <el-input type="textarea" autosize v-model="things.type" placeholder="璇疯緭鍏ユ鐢辨弿杩板唴瀹�"
- :disabled="!updateFlag" disabled></el-input>
- </el-form-item>
- <el-form-item v-if="updateFlag">
+ <!-- <el-form-item class="optionItem" label="妗堢敱:" prop="type">
+ <el-input type="textarea" :rows="2" v-model="things.type" placeholder="璇疯緭鍏ユ鐢辨弿杩板唴瀹�" :disabled="things.level!==2"></el-input>
+ </el-form-item> -->
+ <el-form-item>
<div class="optionBtn">
- <el-button type="primary" class="btn submit" @click.native.prevent="handleUser">纭
+ <el-button type="primary" class="btn submit" @click.native.prevent="handleSubmit">纭
</el-button>
</div>
</el-form-item>
@@ -51,93 +53,179 @@
<script>
export default {
data() {
+ const checkName = (rule, value, callback) => {
+ if (value) {
+ callback();
+ } else {
+ callback(new Error('鏂板杩濆缓绫诲悕涓嶈兘涓虹┖'));
+ }
+ }
+ const checkLevel = (rule, value, callback) => {
+ if (value) {
+ callback();
+ } else {
+ callback(new Error('鏂板杩濆缓绛夌骇涓嶈兘涓虹┖'));
+ }
+ }
return {
things: {
- number: 0,
- type: '',
- typeFirst: '',
- typeSecond: '',
- typeThird: '',
+ name:'',
+ parentId:'',
+ level:'',
},
- roleList: [],
- typeThirdList:[],
- typeSecondList:[],
- typeFirstList:[],
+ createIll: {
+ name: [
+ { required: true, trigger: 'blur', validator: checkName }
+ ],
+ level: [
+ {
+ required: true, trigger: 'change', validator: checkLevel
+ }
+ ]
+ },
+ levelList: [
+ {
+ label: "杩濆缓绫诲瀷",
+ value: 1,
+ },
+ {
+ label: "绫诲埆",
+ value: 2,
+ },
+ ],
+ parentList: [],
+ selectOrg: {
+ orgsid: []
+ },
+ defaultProps: {
+ children: 'children',
+ label: 'name'
+ },
+ mylabel:''
}
},
created() {
- console.log(this.userInfo);
- this.things = JSON.parse(JSON.stringify(this.userInfo));
- // 鑾峰彇鎵�灞炵被鍨嬪垪琛�
- this.getTypeThird();
- this.getTypeSecond();
- this.getTypeFirst();
},
methods: {
- // handleUser() {
- // this.$refs.user.validate((valid) => {
- // if (valid) {
- // const { role } = this;
- // console.log(role);
- // this.$axios.post('/sccg/role/update/' + role.id, {
- // id: role.id,
- // status: role.status,
- // description: role.description,
- // name: role.name,
- // sort: 0
- // }).then(res => {
- // this.$emit('changeDialog', { dialogUpdate: false });
- // this.getUserList();
- // })
- // } else {
- // return false;
- // }
- // })
- // },
// 鏌ヨ鎵�灞炵被鍨�
- getTypeThird() {
- this.$axios({
+ async getTypeThird() {
+ let arr = [];
+ await this.$axios({
method: 'get',
- url: "sccg/violations/query/type_first",
+ url: "sccg/illegal_building/query/type_first",
})
.then(res => {
- this.typeThirdList = res.data;
+ arr = res.data;
})
+ return arr;
},
// 鏌ヨ鎵�灞炲ぇ绫�
- getTypeSecond(){
- this.$axios({
+ async getTypeSecond() {
+ let arr =[];
+ await this.$axios({
method: 'get',
- url: "sccg/violations/query/type_second",
+ url: "sccg/illegal_building/query/type_second",
})
.then(res => {
- this.typeSecondList = res.data;
+ arr = res.data;
})
+ return arr;
},
- // 鏌ヨ鎵�灞炲皬绫�
- getTypeFirst(){
- this.$axios({
- method: 'get',
- url: "sccg/violations/query/type_third",
+ // 鎻愪氦鏂板杩濊绫诲瀷
+ handleSubmit() {
+ this.$refs.user.validate((valid) => {
+ if (valid) {
+ const { things,selectOrg } = this;
+ this.$axios({
+ method: 'post',
+ url: 'sccg/illegal_building/addition/type',
+ data: {
+ code: '1111',
+ level: things.level,
+ name: things.name,
+ parentId: things.parentId === '' ? 0 : selectOrg.orgsid[0],
+ typeCode: '06',
+ typeName: '杩濆缓绫诲瀷',
+ remark: things.type,
+ }
+ })
+ .then(res => {
+ if (res.code === 200) {
+ this.$message({
+ type: 'success',
+ message: '娣诲姞鎴愬姛'
+ })
+ this.$emit('changeDialog', { flag: false });
+ } else {
+ this.$message({
+ type: 'error',
+ message: "娣诲姞澶辫触"
+ })
+ }
+ })
+ } else {
+ return false;
+ }
})
- .then(res => {
- this.typeFirstList = res.data;
- })
- }
+ },
+ // 妗堜欢绾у埆鍙樺寲
+ async resetParentList(index) {
+ if (index === 1) {
+
+ } else {
+ this.parentList = await this.getTypeThird()
+ }
+ },
+ handleCheck(data, checked) {
+ //鍙兘鐐瑰嚮鏈�鍚庝竴绾�
+ if(checked.childNodes.length == 0){
+ this.things.parentId = data.name;
+ let _this = this;
+ _this.$refs.projectApplicant.blur();
+ this.selectOrg.orgsid = []
+ this.selectOrg.orgsid.push(data.id)
+ }else {
+ return
+ }
+ // this.things.parentId = data.name;
+ // // 鑾峰彇褰撳墠閫夋嫨鐨刬d鍦ㄦ暟缁勪腑鐨勭储寮�
+ // const indexs = this.selectOrg.orgsid.indexOf(data.id)
+ // // 濡傛灉涓嶅瓨鍦ㄦ暟缁勪腑锛屽苟涓旀暟缁勪腑宸茬粡鏈変竴涓猧d骞朵笖checked涓簍rue鐨勬椂鍊欙紝浠h〃涓嶈兘鍐嶆閫夋嫨銆�
+ // if (indexs < 0 && this.selectOrg.orgsid.length === 1 && checked) {
+ // this.$message({
+ // message: '鍙兘閫夋嫨涓�涓尯鍩燂紒',
+ // type: 'warning',
+ // showClose: true
+ // })
+ // // 璁剧疆宸查�夋嫨鐨勮妭鐐逛负false 寰堥噸瑕�
+ // this.$refs.tree.setChecked(data, false)
+ // } else if (this.selectOrg.orgsid.length === 0 && checked) {
+ // // 鍙戠幇鏁扮粍涓虹┖ 骞朵笖鏄凡閫夋嫨
+ // // 闃叉鏁扮粍鏈夊�硷紝棣栧厛娓呯┖锛屽啀push
+ // this.selectOrg.orgsid = []
+ // this.selectOrg.orgsid.push(data.id)
+ // } else if (
+ // indexs >= 0 &&
+ // this.selectOrg.orgsid.length === 1 &&
+ // !checked
+ // ) {
+ // // 鍐嶆鐩存帴杩涜璧嬪�间负绌烘搷浣�
+ // this.selectOrg.orgsid = []
+ // }
+ },
},
- props: ['getUserList']
+ props: ['changeDialog']
}
</script>
<style lang="scss" scoped>
.createUser {
border-radius: 1px;
- background-color: #09152f;
+ background-color: #fff;
main {
- // border: 1px solid #fff;
text-align: left;
padding: 0 55px;
- background-color: #09152f;
+ background-color: #fff;
padding-bottom: 50px;
.mainContent {
@@ -178,18 +266,18 @@
}
}
- &::v-deep .el-textarea__inner {
- background-color: #09152f;
- border: 1px solid #17324c;
- }
+ // &::v-deep .el-textarea__inner {
+ // // background-color: #09152f;
+ // border: 1px solid #17324c;
+ // }
- ::v-deep .el-form-item__label {
- color: #4b9bb7;
- }
+ // ::v-deep .el-form-item__label {
+ // color: #4b9bb7;
+ // }
- ::v-deep .el-input__inner {
- background-color: #09152f;
- border: 1px solid #17324c;
- }
+ // ::v-deep .el-input__inner {
+ // // background-color: #09152f;
+ // border: 1px solid #17324c;
+ // }
}
-</style>
\ No newline at end of file
+</style>
--
Gitblit v1.8.0