zxl
2025-03-21 3bd55592b33a86c8b0dce21a9e8ea6126b9c2d94
Merge branch 'dev'
4个文件已修改
2个文件已添加
653 ■■■■■ 已修改文件
src/api/codingRuler/codingRuler.js 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/VisibilityToolbar/index.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/codingRuler/index.vue 485 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/components/Map/index.vue 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/projectEngineering/projectLibrary/component/legalPerson.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/projectEngineering/projectLibrary/index.vue 70 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/codingRuler/codingRuler.js
New file
@@ -0,0 +1,68 @@
import request from '@/utils/request'
// 获取分页
export const getCodingRulers = (params) => {
    return request({
        url: "/coding-ruler/page",
        method: "GET",
        params: params
    })
}
// 获取列表
export const getCodingRulerList = () => {
    return request({
        url: "/coding-ruler/list",
        method: "GET"
    })
}
// 通过id获取
export const getCodingRulerById = (params) => {
    return request({
        url: "/coding-ruler/" + params,
        method: "GET"
    })
}
// 通过id删除
export const deleteCodingRulerById = (params) => {
    return request({
        url: "/coding-ruler/" + params,
        method: "DELETE"
    })
}
// 批量删除
export const deleteCodingRulerByIds = (params) => {
    return request({
        url: "/coding-ruler/batch",
        method: "DELETE",
        data: params
    })
}
// 修改
export const editCodingRuler = (params) => {
    return request({
        url: "/coding-ruler/",
        method: "PUT",
        data: params
    })
}
// 添加
export const addCodingRuler = (params) => {
    return request({
        url: "/coding-ruler/",
        method: "POST",
        data: params
    })
}
// 通过id修改启动状态
export const changeCodingRulerStatus = (params) =>{
    return request({
        url:'/coding-ruler/change/' + params,
        method: "GET",
    })
}
src/components/VisibilityToolbar/index.vue
@@ -23,7 +23,7 @@
        <span>信息显隐筛选</span>
      </div>
      <div slot="default" style="margin-left: 20px;margin-top: 20px">
        <el-table :data="getPage" style="width: 95%; height: 80%;;margin-bottom: 40px;">
        <el-table :row-key="row => { return row.id }" :data="getPage" style="width: 95%; height: 80%;;margin-bottom: 40px;" >
          <el-table-column prop="index" label="序号" width="80"></el-table-column>
          <el-table-column prop="label" label="数据名称"></el-table-column>
          <el-table-column prop="visible" label="是否显示">
@@ -37,9 +37,10 @@
              ></el-switch>
            </template>
          </el-table-column>
          <el-table-column prop="date" label="排序">
          <el-table-column prop="sort" label="排序">
            <template slot-scope="scope">
              <el-input-number v-model="scope.row.sort" :min="0" style="width: 120px" @change="sortChange(scope.row, $event)"></el-input-number>
              <el-input-number v-model="scope.row.sort" :min="0" style="width: 120px"
                               @change="sortChange(scope.row, $event)"></el-input-number>
            </template>
          </el-table-column>
        </el-table>
@@ -148,6 +149,7 @@
          this.saveList.push(row)
        }
      }
      console
      this.$emit('update:columns', row);
    },
    handlePageChange(page) {
src/views/codingRuler/index.vue
New file
@@ -0,0 +1,485 @@
<template>
  <div class="app-container">
    <div v-loading="loading">
    <div class="slot">
      <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="75px">
        <el-form-item label="项目码类型" prop="projectCodeType">
          <el-select v-model="queryParams.projectCodeType" placeholder="项目码类型" @change="handleQuery">
            <el-option
              v-for="dict in dict.type.coding_type"
              :key="dict.value"
              :value="dict.value"
              :label="dict.label"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="区间类型" prop="intervalType">
          <el-select v-model="queryParams.intervalType" placeholder="区间类型" @change="handleQuery">
            <el-option
              v-for="dict in dict.type.interval_type"
              :key="dict.value"
              :value="dict.value"
              :label="dict.label"
            >
            </el-option>
          </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>
      <div class="right-section">
        <div class="add-btn">
          <el-tooltip content="新增" effect="dark" placement="top">
            <el-button :disabled="!isReserve" circle icon="el-icon-plus" @click="add()" size="small"/>
          </el-tooltip>
        </div>
      </div>
    </div>
      <el-table
        :data="tableData"
        row-key="id"
        border
        @selection-change="handleSelectionChange">
        <el-table-column
          type="selection"
          width="55">
        </el-table-column>
        <el-table-column
          prop="projectCodeType"
          label="项目码类型"
        >
          <template slot-scope="scope">
            <dict-tag :options="dict.type.coding_type" :value="scope.row.projectCodeType"/>
          </template>
        </el-table-column>
        <el-table-column
          prop="intervalType"
          label="区间类型"
        >
          <template slot-scope="scope">
            <dict-tag :options="dict.type.interval_type" :value="scope.row.intervalType"/>
          </template>
        </el-table-column>
        <el-table-column
          prop="leftSymbol"
          label="左符号"
        >
          <template slot-scope="scope">
            <dict-tag :options="dict.type.sys_coding_operator" :value="scope.row.leftSymbol"/>
          </template>
        </el-table-column>
        <el-table-column
          prop="leftValue"
          label="左值"
        >
        </el-table-column>
        <el-table-column
          prop="rightSymbol"
          label="右符号"
        >
          <template slot-scope="scope">
            <dict-tag :options="dict.type.sys_coding_operator" :value="scope.row.rightSymbol"/>
          </template>
        </el-table-column>
        <el-table-column
          prop="rightValue"
          label="右值"
        >
        </el-table-column>
        <el-table-column
          prop="status"
          label="状态"
        >
          <template slot-scope="scope">
              <el-tag :type="scope.row.status === 0 ? 'info' : 'success'">
                {{scope.row.status === 0 ? "未启用" : "启用"}}
              </el-tag>
          </template>
        </el-table-column>
        <el-table-column
          label="操作"  min-width="100">
          <template slot-scope="scope">
            <el-button v-if="editShow" size="medium" type="text"
                       @click="changeStatus(scope.row)">
              {{scope.row.status === 0 ? "启用" : "停用"}}
            </el-button>
            <el-button v-if="editShow" size="medium" type="text"
                       @click="editCodingRuler(scope.row)"
                       :disabled="scope.row.status === 1"
            >编辑</el-button>
            <el-button v-if="delShow" size="medium"
                       type="text"
                       @click="deleteCodingRuler(scope.row)"
                       :disabled="scope.row.status === 1"
            >删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="queryParams.currentPage"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
      <el-dialog width="45%" :title="dialogTitle" @close="closeDialog" :visible.sync="open" :show-close="true"  :close-on-click-modal="true"  :destroy-on-close="true">
            <el-form :model="codingRulerForm" :rules="rules" ref="codingRulerForm">
              <el-form-item label="项目码类型" :label-width="formLabelWidth" prop="projectCodeType">
                <el-select v-model="codingRulerForm.projectCodeType" placeholder="项目码类型" @change="changeOption($event)">
                  <el-option
                    v-for="dict in dict.type.coding_type"
                    :key="dict.value"
                    :value="dict.value"
                    :label="dict.label"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="区间类型" :label-width="formLabelWidth" prop="intervalType">
                <el-select v-model="codingRulerForm.intervalType" placeholder="区间类型" @change="changeOption($event)">
                  <el-option
                    v-for="dict in dict.type.interval_type"
                    :key="dict.value"
                    :value="dict.value"
                    :label="dict.label"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="左符号" :label-width="formLabelWidth" prop="leftSymbol" >
                    <el-select v-model="codingRulerForm.leftSymbol" placeholder="选择符号" @change="changeOption($event)">
                      <el-option
                        v-for="dict in leftOption"
                        :key="dict.value"
                        :value="dict.value"
                        :label="dict.label.replace('大于', '>')
                    .replace('小于', '<')
                    .replace('大等于', '>=')
                    .replace('等于', '=')
                    .replace('小于等于', '<=')"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="左值" :label-width="formLabelWidth" prop="leftValue">
                    <el-input v-model="codingRulerForm.leftValue" autocomplete="off" type="number" :min="0"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
            <el-form :model="singleForm" :rules="rules2" ref="singleForm" v-show="isSingleInterval">
              <el-row>
                <el-col :span="12">
                  <el-form-item label="右符号" :label-width="formLabelWidth" prop="rightSymbol"  >
                    <el-select v-model="singleForm.rightSymbol" placeholder="选择符号" @change="changeOption($event)">
                      <el-option
                        v-for="dict in rightOption"
                        :key="dict.value"
                        :value="dict.value"
                        :label="dict.label.replace('大于', '>')
                    .replace('小于', '<')
                    .replace('大等于', '>=')
                    .replace('等于', '=')
                    .replace('小于等于', '<=')"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="右值" :label-width="formLabelWidth" prop="rightValue">
                    <el-input v-model="singleForm.rightValue" autocomplete="off" type="number" :min="0"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
            <div slot="footer" class="dialog-footer">
              <el-button @click="closeDialog">取 消</el-button>
              <el-button type="primary" @click="addOrEditCodingRuler">确 定</el-button>
            </div>
          </el-dialog>
    </div>
  </div>
</template>
<script>
import {
  addCodingRuler,
  changeCodingRulerStatus,
  deleteCodingRulerById,
  editCodingRuler,
  getCodingRulers
} from '@/api/codingRuler/codingRuler.js'
export default {
  dicts: ['sys_coding_operator','coding_type','interval_type'],
  name: "CodingRulerDialog",
  data() {
    return {
      rules2:{
        rightSymbol:[{ required: true, message: '请输入右符号', trigger: 'blur' }],
        rightValue:[{ required: true, message: '请输入右值', trigger: 'blur' }],
      },
      rules:{
        projectCodeType: [{ required: true, message: '请输入项目码类型', trigger: 'blur' }],
        intervalType: [{ required: true, message: '请输入区间类型', trigger: 'blur' }],
        leftSymbol: [{ required: true, message: '请输入左符号', trigger: 'blur' }],
        leftValue: [{ required: true, message: '请输入左值', trigger: 'blur' }],
      },
      // 是否为单区间
      isSingleInterval:false,
      // 弹出框标题
      dialogTitle:"",
      //是否新增条件
      isReserve: true,
      // 能否修改条件
      editShow:true,
      // 能否删除条件
      delShow:true,
      // 总条数
      total:0,
      // 表格内容
      tableData:[],
      // 是否开启搜索条件
      showSearch:true,
      queryParams:{
        intervalType:'',
        currentPage: 1,
        pageSize: 10,
        projectCodeType:'',
      },
      formLabelWidth: '120px',
      // 表单参数
      codingRulerForm:{
        projectCodeType:'',
        intervalType:'',
        leftSymbol:'',
        leftValue:'',
      },
      singleForm:{
        rightSymbol:'',
        rightValue:'',
      },
      // 是否显示弹出层
      open: false,
      // 选中数组
      ids: [],
      loading:false,
    }
  },
  computed:{
    leftOption(){
      if (this.codingRulerForm.intervalType === null || this.codingRulerForm.intervalType === ''){
        return  this.dict.type.sys_coding_operator
      }else {
        if (this.codingRulerForm.intervalType === 'interval'){
          return this.dict.type.sys_coding_operator.filter(item => item.value <= 2);
        }else {
          return  this.dict.type.sys_coding_operator;
        }
      }
    },
    rightOption(){
        return this.dict.type.sys_coding_operator.filter(item => item.value >= 2);
    }
  },
  created(){
  },
  mounted() {
    // 初始化表单数据
    this.getList();
  },
  watch:{
    'codingRulerForm.intervalType'(val){
      if (val && val === 'single_interval'){
        this.isSingleInterval = false;
      }else if (val === 'interval'){
        this.isSingleInterval =true;
      }else {
        this.isSingleInterval =false;
      }
    }
  },
  methods: {
    // 清除验证样式以及单区间右符号的值
    changeOption(e){
      if (e === 'single_interval'){
        this.singleForm.rightValue = null;
        this.singleForm.rightSymbol = null;
      }
    },
    // 获取表格数据
    getList(){
      this.loading = true;
      getCodingRulers(this.queryParams).then(res =>{
        this.tableData = res.data;
        this.total = res.total;
        this.loading = false;
      })
    },
    // 修改
    editCodingRuler(row){
      this.open = true;
      this.dialogTitle = "编辑";
      // 表单赋值
      // 拷贝
      this.codingRulerForm = {...row};
      this.singleForm =  {...row};
    },
    // 删除
    deleteCodingRuler(row){
      this.$modal.confirm('是否删除选中编码规则?').then(function(){
        return deleteCodingRulerById(row.id);
      }).then(() =>{
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    // 新增
    add(){
      this.open = true;
      this.dialogTitle = "新增";
    },
    // 取消
    closeDialog() {
      this.open = false;
      this.clearForm();
    },
    // 清空表单
    clearForm() {
      this.codingRulerForm = {
        id :null,
        projectCodeType:null,
        intervalType:null,
        leftSymbol:null,
        leftValue:null,
      }
      this.singleForm ={
        rightSymbol:null,
        rightValue:null,
      }
      this.resetForm("codingRulerForm");
      this.resetForm("singleForm");
      this.isSingleInterval = false;
    },
    handleSelectionChange(val) {
      this.ids = val.map(item => item.id)
      console.log(ids)
    },
    // 搜索按钮操作
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    // 重置搜索
    resetQuery(){
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 状态切换
    changeStatus(row){
      changeCodingRulerStatus(row.id).then(res =>{
        this.getList();
        this.$message.info(res.msg)
      })
    },
    async addOrEditCodingRuler() {
      // 默认
      let intervalState = false;
      if(this.codingRulerForm.intervalType && this.codingRulerForm.intervalType === "interval"){
        // 区间情况
        intervalState = true;
      }else {
        intervalState = false;
      }
      if (intervalState){
        let need1 = false;
        let need2 = false;
        let warning = false;
         await this.$refs["singleForm"].validate((valid) =>{
          if (valid){
            need1 = true;
          }
        })
          await this.$refs["codingRulerForm"].validate((valid) => {
          if (valid) {
            need2 = true;
            if(this.codingRulerForm.leftValue >= this.singleForm.rightValue){
              warning = true;
            }
          }
        });
         if (warning){
           this.$message.warning("右值应该大于左值")
           return
         }
        if (need1 && need2){
          this.addOrEdit();
        }
      }else {
        this.$refs["codingRulerForm"].validate((valid) => {
          if (valid) {
            this.addOrEdit();
          }
        });
      }
    },
    async addOrEdit(){
      const form = this.codingRulerForm;
      form.rightSymbol = this.singleForm.rightSymbol;
      form.rightValue = this.singleForm.rightValue;
      if (this.dialogTitle === "新增") {
        await addCodingRuler(form).then((res) => {
          this.$message.success(res.msg);
          this.open = false;
          this.getList();
        })
      } else if (this.dialogTitle === "编辑" && this.codingRulerForm.id){
        await editCodingRuler(form).then((res) => {
          this.$message.success(res.msg);
          this.open = false;
          this.getList()
        })
      }
      this.isSingleInterval = false;
    }
  }
}
</script>
<style scoped>
.right-section {
  display: flex;
  .add-btn {
    margin: 0 10px;
  }
}
.slot {
  display: flex;
}
</style>
src/views/components/Map/index.vue
@@ -281,17 +281,10 @@
    },
    showProjectStatusStr(status) {
      switch (status) {
        case "1":
          return "储备项目";
        case "2":
          return "前期项目";
        case "3":
          return "实施项目";
        case "4":
          return "竣工项目";
        case "5":
          return "异常项目";
        case "pendding":
          return "未开工";
        case "working":
          return "已开工";
        default:
          return "异常项目";
      }
@@ -410,7 +403,7 @@
            ? item.yearInvestAmount + "元"
            : "暂无数据",
          projectAddr: item.projectAddress,
          projectStatus: item.usedStatus,
          projectStatus: item.projectStatus,
        };
       
        _this.makeMask(item.longitude, item.latitude, config);
src/views/projectEngineering/projectLibrary/component/legalPerson.vue
@@ -246,7 +246,7 @@
    }
    this.legalPersonForm.projectId = this.projectForm.id;
    this.handleBlur();
  },
  beforeDestroy() {
    if(Object.keys(this.legalPersonForm).length !==0)  localStorage.setItem("legalPersonForm", JSON.stringify(this.legalPersonForm));
@@ -258,6 +258,7 @@
        this.options.forEach(item => {
          if (item.id === row) {
            this.legalPersonForm = item;
            this.legalPersonForm.id = null;
          }
        })
      }
@@ -265,7 +266,7 @@
    },
    //项目单位输入时触发
    handleBlur(query){
      console.log(query)
      this.legalPersonForm.projectUnit = query;
      if (this.legalPersonForm.projectUnit !== null && this.legalPersonForm.projectUnit !== '' && this.legalPersonForm.projectUnit !== undefined){
        getUnitRegistrationInfoByName(this.legalPersonForm).then(res =>{
src/views/projectEngineering/projectLibrary/index.vue
@@ -205,7 +205,6 @@
      <!-- 动态列 -->
      <el-table-column
        v-for="item in columnsNew"
        :key="item.columns"
        v-if="item.visible"
        :prop="item.columns"
        :label="item.label"
@@ -242,15 +241,21 @@
            <template v-if="item.slotName === 'importanceType'">
              <dict-tag :options="dict.type.sys_key_categories" :value="scope.row.importanceType"/>
            </template>
            <!-- planStartTime -->
            <template v-if="item.slotName === 'planStartTime'">
              {{ scope.row.planStartTime ? scope.row.planStartTime.split('-')[0] + '年' : '' }}
            <!-- plannedStartDate -->
            <template v-if="item.slotName === 'plannedStartDate'">
              {{ scope.row.plannedStartDate ? scope.row.plannedStartDate.split('-')[0] + '年' : '' }}
            </template>
            <!-- usedStatus插槽 -->
            <template v-if="item.slotName === 'usedStatus'">
              <dict-tag :options="dict.type.sys_used_status" :value="scope.row.usedStatus"/>
            </template>
            <!-- planStartTime -->
            <template v-else-if="item.slotName === 'planStartTime'">
              {{ scope.row.planStartTime ? scope.row.planStartTime.split(' ')[0] : '' }}
          </template>
          </template>
          <!-- 转换计划开工样式 空格切割数组 -->
          <!-- 默认显示 -->
          <span v-else>{{ scope.row[item.columns] }}</span>
        </template>
@@ -442,8 +447,8 @@
        //转换
         res.data.forEach((item,index)=>{
           item.index = index + 1;
           item.key = index;
           item.label = item.name;
          if(item.display === '0'){
            item.visible = false
          }else {
@@ -478,9 +483,7 @@
      //转换
      data.forEach((item,index)=>{
        item.index = index + 1;
        item.key = index;
        item.label = item.name;
        // item.slotName = item.columns;
        if(item.display === '0'){
          item.visible = false
        }else {
@@ -540,28 +543,28 @@
      localStorage.removeItem("documentsInfoForm")
    },
    save(){
      const list =current.map((item, index) => {
            item.name = item.label;
            item.sort = index + 1;
            item.columns = item.id;
            item.id = 0;
            if(item.slotName === undefined){
              item.slotName = null;
            }
            if(item.visible){
              item.display = "1";
            }else {
              item.display ="0";
            }
            return item;
          });
      console.log(list)
      addList(list).then(res=>{
        console.log(res.msg)
      })
    },
    // save(){
    //   const list =current.map((item, index) => {
    //         item.name = item.label;
    //         item.sort = index + 1;
    //         item.columns = item.id;
    //         item.id = 0;
    //         if(item.slotName === undefined){
    //           item.slotName = null;
    //         }
    //         if(item.visible){
    //           item.display = "1";
    //         }else {
    //           item.display ="0";
    //         }
    //         return item;
    //       });
    //   console.log(list)
    //   addList(list).then(res=>{
    //     console.log(res.msg)
    //   })
    //
    // },
    // 重置排序的方法
    handleResetSort() {
      this.hiddenColumnsList();
@@ -579,22 +582,25 @@
      });
    },
    //点击排序加减更新
    handleUpdateSort(row) {
      //替换表头元素
      this.columnsNew = this.columnsNew.map(item => {
        if (item.columns === row.columns) {
        if (item.id === row.id) {
          return row;
        }
        return item;
      });
      //替换传入显隐组件数据
      this.defaultColumns = this.defaultColumns.map(item => {
        if (item.columns === row.columns) {
        if (item.id === row.id) {
          return row;
        }
        return item;
      });
      this.defaultColumns = this.defaultColumns.sort((a, b) => a.sort - b.sort);
      //显隐排序
      this.defaultColumns.sort((a, b) => a.sort - b.sort);
      //主页表头数据排序
      this.columnsNew.sort((a, b) => a.sort - b.sort);
      //强制table渲染