月球大数据地理空间分析展示平台-【中台】
Surpriseplus
2023-09-13 8f6271eca8eb12710a07ed1a1b82fc491dfd4a5a
src/views/datamanage/uploadmanage.vue
@@ -98,11 +98,12 @@
          </el-select>
        </el-form-item>
        <!-- 类型 -->
        <el-form-item v-if="active == 'first'">
        <el-form-item>
          <el-select
            size="small"
            v-model="formInline.type"
            @change="handleTypeChange"
            :placeholder="$t('shuJuGuanLi.shuJuJianSuo.selectDataType')"
          >
            <el-option
              v-for="item in typeOption"
@@ -510,7 +511,7 @@
            </el-select>
          </el-form-item>
          <!-- 坐标系 -->
          <!-- 拉伸因子 -->
          <el-form-item
            v-show="insertLayer.showFactor"
            :label="$t('dataManage.vmobj.labe17')"
@@ -521,9 +522,62 @@
              :min="insertLayer.min"
              :step="insertLayer.step"
              :max="insertLayer.max"
              class="setEnhanceFactor"
              style="width: 100%;"
            ></el-input-number>
          </el-form-item>
          <el-form-item :label="$t('dataManage.vmobj.labe19')">
            <el-select
              size="small"
              placeholder="请选择颜色表"
              v-model="colorTableType"
              style="width: 100%;"
            >
              <el-option
                v-for="(item, i) in colorTableOptions"
                :key="i"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </el-form-item>
          <!-- 颜色表 -->
          <el-form-item
            v-show="colorTableType != 2"
            :label="$t('dataManage.vmobj.labe18')"
          >
            <el-select
              v-model="renderType"
              placeholder="请选择渲染类型"
              size="small"
              @change="changeSelection(renderType)"
              ref="selectColor"
              style="width: 100%;"
              clearable
            >
              <el-option
                v-for="(item, i) in renderTypeOptions"
                :key="i"
                :label="item.name"
                :value="item.name"
              >
                <div
                  style="
                height: 30px;
                width: 100%;
                position: relative;
                top: 50%;
                left: 50%;
                transform: translate(-50%, -50%);
              "
                  :style="item.domCss"
                ></div>
              </el-option>
            </el-select>
          </el-form-item>
          <!-- 坐标系 -->
          <el-form-item :label="$t('dataManage.vmobj.labe16')">
            <el-select
@@ -643,7 +697,7 @@
      <div
        v-loading="true"
        element-loading-background="rgba(0, 0, 0, 0.0) "
        element-loading-text="数据发布中"
        :element-loading-text="loadingText"
        style="margin: 0px 20px;widht:100%;height:calc(100% - 80px); "
      >
      </div>
@@ -666,10 +720,12 @@
  publish_deletesSjServices,
  publish_update,
  publish_insertSjService,
  publish_selectSjColorTables,
  publish_selectSjMissionStatus
} from '../../api/api.js'
import { conditions } from '../Archive/Archive';
import { method_option, nodata_Option, server_option, system_Option, type_option } from './js/layerManage';
import server from '../../components/js/server.js'
export default {
  components: {
    MyBread, mapview,
@@ -734,7 +790,24 @@
      serverOption: [],
      enhanceOption: [],
      epsgOption: [],
      noDataOption: []
      noDataOption: [],
      renderType: null,
      renderTypeOptions: [],
      colorTableType: null,
      colorTableOptions: [
        {
          value: 2,
          label: "请选择颜色表",
        },
        {
          value: 0,
          label: "普通颜色表",
        },
        {
          value: 1,
          label: "直方图均衡",
        }],
      loadingText: '数据发布中',
    }
  },
  methods: {
@@ -838,8 +911,36 @@
      for (var i in this.multipleSelection) {
        std.push(this.multipleSelection[i].id)
      }
      var color1 = null;
      var color2 = null;
      var level = null;
      var val_data = [];
      var dataId = 0;
      if (this.renderTypeOptions.length > 0) {
        for (var i in this.renderTypeOptions) {
          if (this.renderTypeOptions[i].name == this.renderType) {
            val_data.push(this.renderTypeOptions[i]);
          }
        }
      }
      if (val_data.length > 0) {
        level = val_data[0];
      }
      if (this.colorTableType == 0) {
        color1 = level.content.levels;
        dataId = level.data_id;
      } else if (this.colorTableType == 1) {
        color2 = level.content.levels;
        dataId = level.data_id;
      }
      var obj = {
        colorTable: color1, // 普通颜色表,可不设
        gradientColorTable: color2,
        dircode: this.formInline.dirid,
        colorTableId: dataId,
        name: name,
        ids: std,
        enhanceType: this.insertLayer.enhanceType,
@@ -851,20 +952,69 @@
      this.loadDialogVisible = true
      this.insertDialogVisible = false;
      this.loadDialogVisible = false
      const data = await publish_insertSjService(obj);
      if (data.code == 200 && data.result && data.result > 0) {
        this.loadDialogVisible = true
        this.getLoadingMsg(data.result);
      } else {
        this.$message.error("数据发布失败")
        this.getTableData();
      }
      if (data.code == 200 && data.result > 0) {
      // if (data.code == 200 && data.result > 0) {
      //   this.$message({
      //     message: '数据发布成功',
      //     type: 'success'
      //   });
      // } else {
      //   this.$message.error("数据发布失败")
      // }
      //
    },
    async getLoadingMsg(res) {
      if (!this.loadDialogVisible) return;
      const data = await publish_selectSjMissionStatus({ id: res })
      if (data.result.status == 3) {
        this.$message({
          message: '数据发布成功',
          type: 'success'
        });
      } else {
        this.loadDialogVisible = false;
        this.getTableData();
      } else if (data.result.status == 5 || data.result.status == 4) {
        this.$message.error("数据发布失败")
        this.loadDialogVisible = false;
        this.getTableData();
      } else {
        if (data.result.process == 100) {
          this.$message({
            message: '数据发布成功',
            type: 'success'
          });
          this.loadDialogVisible = false;
          this.getTableData();
        } else {
          this.loadingText = '数据发布中,已发布 ' + data.result.process + '%';
          var that = this;
          setTimeout(() => {
            that.getLoadingMsg(res);
          }, 3000);
        }
      }
      this.loadDialogVisible = false
      this.getTableData();
    },
    setEnhanceTypeChange(res) {
      var val = this.enhanceOption.filter((res) => {
        if (res.value == this.insertLayer.enhanceType) {
@@ -902,6 +1052,9 @@
      } else {
        this.insertLayer.showFactor = false;
      }
      this.colorTableType = 2;
      this.renderType = null;
      this.insertLayer.name = this.multipleSelection[0].name
      this.insertDialogVisible = true;
    },
@@ -997,8 +1150,14 @@
    //预览弹窗打开
    setPreviewLayer(res) {
      this.$store.state.previewLayer = res;
      this.dialogVisible = true;
      this.showMapView = true;
      setTimeout(() => {
        server.setAddReleaseLayer(res)
      }, 500);
    },
    //是否为全屏函数
    onFullscreen(fullscreen) {
@@ -1097,6 +1256,7 @@
          count: 0
        }
        this.showPageSize = [10, 50, 100, 200]
        this.formInline.type = this.typeOption[0].value;
      } else {
        this.listData = {
          pageIndex: 1,
@@ -1104,10 +1264,11 @@
          count: 0
        }
        this.showPageSize = [10, 50, 100, 200]
        this.formInline.type = null
      }
      this.formInline.serType = this.serverOption[0].value;
      this.formInline.type = this.typeOption[0].value;
      // this.getDepTreeList();
      this.getDirTreeList();
@@ -1274,6 +1435,74 @@
        return father.pid == 0 // 返回一级菜单
      })
    },
    async getColorJson() {
      var dt = await publish_selectSjColorTables({
        pageIndex: 1,
        pageSize: 100000,
      });
      if (!dt.result) return
      this.renderTypeOptions = dt.result.item_list;
      this.renderTypeOptions.forEach((e) => {
        let css = "";
        let css1 = "";
        e.content.levels.forEach((v) => {
          if ("r_start" in v) {
            css += `rgb(${v.r_start}, ${v.g_start}, ${v.b_start}),rgb(${v.r_end}, ${v.g_end}, ${v.b_end}),`;
          } else if ("r" in v) {
            css1 += `rgb(${v.r}, ${v.g}, ${v.b}),`;
          }
        });
        let cssColor = `${css1}${css}`;
        let cssStr = "";
        if (cssColor.length == 19) {
          cssStr = `background: ${cssColor.slice(0, -1)}`;
        } else {
          cssStr = `background-image:linear-gradient(to right, ${cssColor.slice(
            0,
            -1
          )})`;
        }
        e.domCss = cssStr;
      });
    },
    changeSelection(scope) {
      // if (scope == "") {
      //   this.$refs.selectColor.$el.children[0].children[0].removeAttribute("style");
      //   this.$refs.selectColor.$el.children[0].children[0].children[0].removeAttribute(
      //     "style"
      //   );
      //   this.$refs.selectColor.$el.children[0].children[0].children[0].children[0].removeAttribute(
      //     "style"
      //   );
      //   return;
      // }
      // for (let index in this.renderTypeOptions) {
      //   let obj = this.renderTypeOptions[index];
      //   if (obj.name == scope) {
      //     this.$refs.selectColor.$el.children[0].children[0].setAttribute(
      //       "style",
      //       `background-image: linear-gradient(to right,${obj.domCss});
      //       width: 100%; height: 100%;
      //       border: none;
      //       height: 33px;`
      //     );
      //     this.$refs.selectColor.$el.children[0].children[0].children[0].setAttribute(
      //       "style",
      //       `display: flex;
      //     justify-content: flex-end;
      //     background:transparent;`
      //     );
      //     this.$refs.selectColor.$el.children[0].children[0].children[0].children[0].setAttribute(
      //       "style",
      //       `display: none;`
      //     );
      //   }
      // }
    }
  },
  mounted() {
    this.active = 'first';
@@ -1281,7 +1510,8 @@
    this.serverOption = server_option;
    this.epsgOption = system_Option;
    this.noDataOption = nodata_Option;
    this.enhanceOption = method_option
    this.enhanceOption = method_option;
    this.getColorJson()
    this.setPageStart();
    this.setOptions();
@@ -1340,7 +1570,7 @@
  .loadBox {
    position: fixed;
    z-index: 2002;
    background: rgba(0, 0, 0, 0.2);
    background: rgba(0, 0, 0, 0.75);
    width: 100%;
    height: 100%;
    top: 0;
@@ -1358,14 +1588,6 @@
  }
  /deep/.el-dialog__header {
    padding: 10px !important;
  }
  /deep/.el-input-number__increase,
  .el-input-number__decrease {
    background: transparent !important;
  }
  .el-input-number__increase,
  .el-input-number__decrease {
    background: transparent !important;
  }
}
.elTreeData {