zhangh 3 年 前
コミット
d79b0ac258

+ 232 - 2
src/views/exctab/ElementIdentification/index.vue

@@ -1,3 +1,233 @@
 <template>
-  <div>元素识别</div>
-</template>
+  <basic-container>
+    <el-row :gutter="20">
+      <el-col :span="5">
+        <div style="text-align: center;">元素识别</div>
+        <el-tree
+          :data="treeData"
+          :props="treeProps"
+          @node-click="handleNodeClick"
+          :load="loadNode"
+          lazy
+        ></el-tree>
+      </el-col>
+      <el-col :span="19">
+        <div>模板名称</div>
+        <el-row
+          class="martop20"
+          :gutter="20"
+        >
+          <el-col :span="16">
+            <iframe
+              :src="excelSrc"
+              width="100%"
+              height="700px"
+            ></iframe>
+          </el-col>
+          <el-col :span="8">
+            <div class="flexBetween flexItemsC">
+              <el-button
+                type="info"
+                size="mini"
+                @click="automaticRecognition"
+              >自动识别</el-button>
+              <div
+                class="el-icon-plus"
+                @click="pushTableData"
+                style="width:16px;height:16px;backgroundColor:#1DD81D;color:#fff;cursor: pointer;"
+              ></div>
+            </div>
+            <el-table
+              class="martop20"
+              :data="tableData"
+              border
+              style="width: 100%"
+            >
+              <el-table-column
+                type="index"
+                label="坐标"
+              >
+              </el-table-column>
+              <el-table-column
+                prop="eName"
+                label="元素名称"
+              >
+                <template slot-scope="scope">
+                  <el-input
+                    v-model="scope.row.eName"
+                    placeholder="请输入内容"
+                  ></el-input>
+                </template>
+              </el-table-column>
+              <el-table-column
+                prop="eType"
+                label="数据类型"
+              >
+                <template slot-scope="scope">
+                  <el-select
+                    v-model="scope.row.eType"
+                    placeholder="请选择"
+                  >
+                    <el-option
+                      v-for="item in dataType"
+                      :key="item.dictKey"
+                      :label="item.dictValue"
+                      :value="item.dictKey"
+                    >
+                    </el-option>
+                  </el-select>
+                </template>
+              </el-table-column>
+              <el-table-column
+                prop="eAllowDeviation"
+                label="允许偏差值"
+              >
+                <template slot-scope="scope">
+                  <el-input
+                    v-model="scope.row.eAllowDeviation"
+                    placeholder="请输入内容"
+                  ></el-input>
+                </template>
+              </el-table-column>
+            </el-table>
+            <el-button
+              type="success"
+              class="martop20"
+              @click="establish()"
+            >关联WBS并创建元素</el-button>
+          </el-col>
+        </el-row>
+      </el-col>
+    </el-row>
+
+    <el-dialog
+      title="关联公共WBS模板"
+      :visible.sync="AssociatedPublicTap"
+      width="30%"
+      :before-close="AssociatedPublicClose"
+    >
+      <span>这是一段信息</span>
+      <span
+        slot="footer"
+        class="dialog-footer"
+      >
+        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="dialogVisible = false"
+        >确 定</el-button>
+      </span>
+    </el-dialog>
+  </basic-container>
+</template>
+<script>
+import { tabLazytree, detailExcel } from "@/api/exctab/excelmodel";
+import { dictionarydataType } from "@/api/exctab/editelement";
+import { getColByTabId } from "@/api/manager/AdjustForm";
+export default {
+  data () {
+    return {
+      treeData: [],
+      treeProps: {
+        label: 'name',
+        children: 'children',
+        isLeaf: 'hasChildren'
+      },
+      excelSrc: '',
+      from: {
+        id: '',
+        extension: '',
+      },
+      tableData: [],
+      dataType: [],
+    }
+  },
+  methods: {
+    //#region 
+    handleNodeClick (data) {
+      console.log(data);
+      if (data.hasChildren) {
+        this.detailExcel(data.id)
+        if (this.dataType.length == 0) {
+          this.dictionarydataType()
+        }
+        this.from.id = data.id
+      }
+    },
+    async loadNode (node, resolve) {//懒加载获取节点
+      if (node.level === 0) {
+        return resolve(await this.tabLazytree(this.$route.params.id, 0))
+      }
+      if (node.level > 0) {
+        return resolve(await this.tabLazytree(this.$route.params.id, node.data.id))
+      }
+    },
+    automaticRecognition () {//自动识别按钮
+      this.getColByTabId()
+    },
+    pushTableData () {//
+      this.tableData.push({
+        eName: '',
+        eType: '',
+        eAllowDeviation: ''
+      })
+    },
+    async getColByTabId () {//获取字段信息
+      const { data: res } = await getColByTabId({ tabId: this.from.id })
+      console.log(res);
+      if (res.code === 200) {
+        // this.tableData = res.data
+      }
+    },
+    establish () {//关联WBS并创建元素
+
+    },
+    //#endregion
+
+    //#region 
+    AssociatedPublicClose () {//关联公共WBS模板关闭事件
+
+    },
+    //#endregion
+
+    //#region 接口
+    async tabLazytree (modeId, parentId) {
+      const { data: res } = await tabLazytree({ modeId, parentId })
+      console.log(res);
+      if (res.code == 200) {
+        if (res.data.length > 0) {
+          res.data.forEach(val => {
+            val.hasChildren = !val.hasChildren
+          });
+        }
+        return res.data
+      }
+    },
+    async detailExcel (id) {//获取列表信息
+      const { data: res } = await detailExcel({ id })
+      console.log(res);
+      if (res.code === 200) {
+        this.from.id = res.data.id
+        this.from.extension = res.data.extension  //文件名称
+        // this.from.fileUrl = res.data.fileUrl      //文件路径
+        let routeUrl = res.data.fileUrl
+        let pSrc = routeUrl + '?r=' + new Date()
+        this.excelSrc = 'http://view.officeapps.live.com/op/view.aspx?src=' + encodeURIComponent(pSrc)
+      }
+    },
+    async dictionarydataType () {//数据类型字典
+      const { data: res } = await dictionarydataType()
+      console.log(res);
+      if (res.code == 200) {
+        this.dataType = res.data
+      }
+    },
+    //#endregion
+  },
+  created () {
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 1 - 1
src/views/exctab/excelmodel/excelmodel.vue

@@ -241,7 +241,7 @@
                   <td style="width:50%;">{{val.tableName}}</td>
                   <td style="text-align: center;height:30px;">
                     <el-button
-                      v-if="val.isLinkTable==1"
+                      v-if="val.isLinkTable!=2"
                       type="info"
                       size="small"
                       @click="relation(index)"

+ 1 - 1
src/views/manager/projectinfo/editElement/editElement.vue

@@ -278,6 +278,7 @@ export default {
       });
     },
     async cop () {
+      // console.log(localStorage.getItem('editElement'));
       let _that = this
       var MyComponent = await Vue.extend({
         template: localStorage.getItem('editElement'),
@@ -288,7 +289,6 @@ export default {
         }
       })
       var component = new MyComponent().$mount()
-      let na = document.getElementById('parent')
       document.getElementById('parent').appendChild(component.$el);
     },
     async copss () {