Browse Source

数据导入

codeMan 1 year ago
parent
commit
3940ca4df7

+ 138 - 99
src/optionSystem/executeManage/index.vue

@@ -1,117 +1,156 @@
 <template>
   <basicLayout
-      ref="basicLayout"
-      :oldFormPath="{
-        add:'optionSystem/executeManage/modules'
-      }"
-      tableName="executeTable"
-      idName="itemid"
-      ownertable="plm_item"
-      :apiId="{query:2024060514063602,del:2024060514040602}"
-      :detailPath="{
-        path:'/executeDetail'
-      }"
-      :isExport="false"
+    ref="basicLayout"
+    :oldFormPath="{
+      add: 'optionSystem/executeManage/modules',
+    }"
+    tableName="executeTable"
+    idName="itemid"
+    ownertable="plm_item"
+    :apiId="{ query: 2024060514063602, del: 2024060514040602 }"
+    :detailPath="{
+      path: '/executeDetail',
+    }"
+    :isExport="false"
+  >
+    <template #titleRight>
+      <ImportFile
+        :templateParam="{ id: 20240618111502, content: {} }"
+        title="执行器"
+        @onSuccess="bindImport"
+        :errorUrl="errorUrl"
+        @clearUrl="errorUrl = null"
+        v-if="tool.checkAuth($route.name,'importFile')"
+      ></ImportFile>
+    </template>
+    <template #custom>
+      <div class="mt-10">
+        <label class="search__label">创建时间:</label>
+        <el-date-picker
+          style="margin-right: 24px !important"
+          size="small"
+          @change="selectTimeChange"
+          value-format="yyyy-MM-dd"
+          v-model="dateSelect"
+          type="daterange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          clearable
+        >
+        </el-date-picker>
+      </div>
+      <div class="mt-10">
+        <label class="search__label">状态:</label>
+        <el-select
+          class="inline-24"
+          v-model="selectParam.status"
+          placeholder="请选择状态"
+          @change="selectStatusChange"
+          size="small"
+          clearable
+        >
+          <el-option label="新建" value="新建"></el-option>
+          <el-option label="审核" value="审核"></el-option>
+        </el-select>
+      </div>
+    </template>
+    <template v-slot:tbList="scope">
+      <div
+        :style="
+          scope.data.column.data.status === '审核'
+            ? 'color:#52C41A'
+            : 'color:000000'
+        "
+        v-if="scope.data.column.columnname === 'status'"
       >
-      <template #titleRight>
-      </template>
-      <template #custom>
-        <div class="mt-10">
-          <label class="search__label" >创建时间:</label>
-          <el-date-picker
-              style="margin-right: 24px !important;"
-              size="small"
-              @change="selectTimeChange"
-              value-format="yyyy-MM-dd"
-              v-model="dateSelect"
-              type="daterange"
-              range-separator="至"
-              start-placeholder="开始日期"
-              end-placeholder="结束日期"
-              clearable>
-          </el-date-picker>
-        </div>
-        <div class="mt-10">
-          <label  class="search__label" >状态:</label>
-          <el-select class="inline-24" v-model="selectParam.status" placeholder="请选择状态" @change="selectStatusChange" size="small" clearable>
-            <el-option label="新建" value="新建"></el-option>
-            <el-option label="审核" value="审核"></el-option>
-          </el-select>
-        </div>
-        
-      </template>
-      <template v-slot:tbList="scope">
-        <div :style="scope.data.column.data.status === '审核'?'color:#52C41A':'color:000000'" v-if="scope.data.column.columnname === 'status'">
-          {{ scope.data.column.data.status }}
-        </div>
-        <div v-else-if="scope.data.column.columnname === 'marketprice'">
-          {{ tool.formatAmount(scope.data.column.data.marketprice,2) }}
-        </div>
-        <p v-else> {{scope.data.column.data[[scope.data.column.columnname]]}}</p>
-      </template>
-      <!-- <template v-slot:tbOpreation="scope">
+        {{ scope.data.column.data.status }}
+      </div>
+      <div v-else-if="scope.data.column.columnname === 'marketprice'">
+        {{ tool.formatAmount(scope.data.column.data.marketprice, 2) }}
+      </div>
+      <p v-else>{{ scope.data.column.data[[scope.data.column.columnname]] }}</p>
+    </template>
+    <!-- <template v-slot:tbOpreation="scope">
        <editTemp :data="scope.data.data"></editTemp>
       </template> -->
-    </basicLayout>
+  </basicLayout>
 </template>
 
 <script>
+import ImportFile from "../modules/importFile.vue";
 export default {
-    data () {
-        return {
-          selectParam: {
-            status:'',
-          },
-          dateSelect:'',
-          bodystructure:[],
-          func:[]
-        }
-    },
-    provide () {
-      return {
-        bodystructure: () => {
-          return this.bodystructure
-        },
-        func: () => {
-          return this.func
+  components: { ImportFile },
+  data() {
+    return {
+      selectParam: {
+        status: "",
+      },
+      dateSelect: "",
+      bodystructure: [],
+      func: [],
+      errorUrl: null,
+    };
+  },
+  provide() {
+    return {
+      bodystructure: () => {
+        return this.bodystructure;
+      },
+      func: () => {
+        return this.func;
+      },
+    };
+  },
+  methods: {
+    async bindImport(id) {
+      const res = await this.$api.requested({
+        id: 20240618133002,
+        content: {
+          attachmentid: id[0],
         },
+      });
+      if (res.data !== "成功") {
+        this.errorUrl = res.data;
+      } else {
+        this.tool.showMessage(res, () => {
+          this.$refs.basicLayout.listData();
+        });
       }
     },
-    methods: {
-      selectStatusChange () {
-        this.$refs['basicLayout'].param.content.where = this.selectParam
-        this.$refs['basicLayout'].param.content.pageNumber = 1
-        this.$refs['basicLayout'].listData()
-      },
-      selectTimeChange(){
-      if (this.dateSelect !== '' && this.dateSelect !== null){
-          this.selectParam.begindate = this.dateSelect[0]
-          this.selectParam.enddate = this.dateSelect[1]
-        }else {
-          this.selectParam.begindate = ''
-          this.selectParam.enddate = ''
-        }
-        this.$refs.basicLayout.param.content.pageNumber = 1
-        this.$refs.basicLayout.param.content.where = this.selectParam
-        this.$refs.basicLayout.listData()
-      },
-      optionList () {
-        this.$store.dispatch('optiontypeselect','bodystructure').then(res => {
-          this.bodystructure = res.data
-          console.log(this.bodystructure,'结构');
-        })
-        this.$store.dispatch('optiontypeselect','func').then(res => {
-          this.func = res.data
-          console.log(this.func,'功能');
-        })
+    selectStatusChange() {
+      this.$refs["basicLayout"].param.content.where = this.selectParam;
+      this.$refs["basicLayout"].param.content.pageNumber = 1;
+      this.$refs["basicLayout"].listData();
+    },
+    selectTimeChange() {
+      if (this.dateSelect !== "" && this.dateSelect !== null) {
+        this.selectParam.begindate = this.dateSelect[0];
+        this.selectParam.enddate = this.dateSelect[1];
+      } else {
+        this.selectParam.begindate = "";
+        this.selectParam.enddate = "";
       }
+      this.$refs.basicLayout.param.content.pageNumber = 1;
+      this.$refs.basicLayout.param.content.where = this.selectParam;
+      this.$refs.basicLayout.listData();
     },
-    created () {
-      this.optionList()
-    }
-}
+    optionList() {
+      this.$store.dispatch("optiontypeselect", "bodystructure").then((res) => {
+        this.bodystructure = res.data;
+        console.log(this.bodystructure, "结构");
+      });
+      this.$store.dispatch("optiontypeselect", "func").then((res) => {
+        this.func = res.data;
+        console.log(this.func, "功能");
+      });
+    },
+  },
+  created() {
+    this.optionList();
+  },
+};
 </script>
 
 <style scoped>
-
 </style>

+ 212 - 160
src/optionSystem/itemManage/index.vue

@@ -1,184 +1,236 @@
 <template>
   <basicLayout
-      ref="basicLayout"
-      :oldFormPath="{
-        add:'optionSystem/itemManage/modules'
-      }"
-      tableName="itemTable"
-      idName="itemid"
-      ownertable="plm_item"
-      :apiId="{query:2024060309533402,del:2024060309421602}"
-      :detailPath="{
-        path:'/itemDetail'
-      }"
-      :isExport="false"
+    ref="basicLayout"
+    :oldFormPath="{
+      add: 'optionSystem/itemManage/modules',
+    }"
+    tableName="itemTable"
+    idName="itemid"
+    ownertable="plm_item"
+    :apiId="{ query: 2024060309533402, del: 2024060309421602 }"
+    :detailPath="{
+      path: '/itemDetail',
+    }"
+    :isExport="false"
+  >
+    <template #titleRight>
+      <ImportFile
+        :templateParam="{ id: 20240617141002, content: {} }"
+        title="主阀"
+        @onSuccess="bindImport"
+        :errorUrl="errorUrl"
+        @clearUrl="errorUrl = null"
+        v-if="tool.checkAuth($route.name,'importFile')"
+      ></ImportFile>
+    </template>
+    <template #custom>
+      <div class="mt-10">
+        <label class="search__label">创建时间:</label>
+        <el-date-picker
+          style="margin-right: 24px !important"
+          size="small"
+          @change="selectTimeChange"
+          value-format="yyyy-MM-dd"
+          v-model="dateSelect"
+          type="daterange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          clearable
+        >
+        </el-date-picker>
+      </div>
+      <div class="mt-10">
+        <label class="search__label">阀门类型:</label>
+        <el-select
+          class="inline-24"
+          v-model="selectParam.valvetype"
+          placeholder="请选择阀门类型"
+          @change="selecttypeChange"
+          size="small"
+          clearable
+        >
+          <el-option
+            :label="item.remarks"
+            :value="item.value"
+            v-for="item in typeList"
+            :key="item.value"
+          ></el-option>
+        </el-select>
+      </div>
+      <div class="mt-10">
+        <label class="search__label">状态:</label>
+        <el-select
+          class="inline-24"
+          v-model="selectParam.status"
+          placeholder="请选择状态"
+          @change="selectStatusChange"
+          size="small"
+          clearable
+        >
+          <el-option label="新建" value="新建"></el-option>
+          <el-option label="审核" value="审核"></el-option>
+        </el-select>
+      </div>
+    </template>
+    <template v-slot:tbList="scope">
+      <div
+        :style="
+          scope.data.column.data.status === '审核'
+            ? 'color:#52C41A'
+            : 'color:000000'
+        "
+        v-if="scope.data.column.columnname === 'status'"
       >
-      <template #titleRight>
-      </template>
-      <template #custom>
-        <div class="mt-10">
-          <label class="search__label" >创建时间:</label>
-          <el-date-picker
-              style="margin-right: 24px !important;"
-              size="small"
-              @change="selectTimeChange"
-              value-format="yyyy-MM-dd"
-              v-model="dateSelect"
-              type="daterange"
-              range-separator="至"
-              start-placeholder="开始日期"
-              end-placeholder="结束日期"
-              clearable>
-          </el-date-picker>
-        </div>
-        <div class="mt-10">
-          <label  class="search__label" >阀门类型:</label>
-          <el-select class="inline-24" v-model="selectParam.valvetype" placeholder="请选择阀门类型" @change="selecttypeChange" size="small" clearable>
-            <el-option :label="item.remarks" :value="item.value" v-for="item in typeList" :key="item.value"></el-option>
-          </el-select>
-        </div>
-        <div class="mt-10">
-          <label  class="search__label" >状态:</label>
-          <el-select class="inline-24" v-model="selectParam.status" placeholder="请选择状态" @change="selectStatusChange" size="small" clearable>
-            <el-option label="新建" value="新建"></el-option>
-            <el-option label="审核" value="审核"></el-option>
-          </el-select>
-        </div>
-        
-      </template>
-      <template v-slot:tbList="scope">
-        <div :style="scope.data.column.data.status === '审核'?'color:#52C41A':'color:000000'" v-if="scope.data.column.columnname === 'status'">
-          {{ scope.data.column.data.status }}
-        </div>
-        <div v-else-if="scope.data.column.columnname === 'marketprice'">
-          {{ tool.formatAmount(scope.data.column.data.marketprice,2) }}
-        </div>
-        <p v-else> {{scope.data.column.data[[scope.data.column.columnname]]}}</p>
-      </template>
-      <!-- <template v-slot:tbOpreation="scope">
+        {{ scope.data.column.data.status }}
+      </div>
+      <div v-else-if="scope.data.column.columnname === 'marketprice'">
+        {{ tool.formatAmount(scope.data.column.data.marketprice, 2) }}
+      </div>
+      <p v-else>{{ scope.data.column.data[[scope.data.column.columnname]] }}</p>
+    </template>
+    <!-- <template v-slot:tbOpreation="scope">
        <editTemp :data="scope.data.data"></editTemp>
       </template> -->
-    </basicLayout>
+  </basicLayout>
 </template>
 
 <script>
+import ImportFile from "../modules/importFile.vue";
 export default {
-    data () {
-        return {
-          selectParam: {
-            status:''
-          },
-          dateSelect:'',
-          typeList:[],
-          caliber:[],
-          pressure:[],
-          connection:[],
-          bodymaterial:[],
-          valveplatematerial:[],
-          stemmaterial:[],
-          plinthmaterial:[],
-        }
-    },
-    provide () {
-      return {
-        itemTypeList: () => {
-          return this.typeList
-        },
-        caliber: () => {
-          return this.caliber
-        },
-        pressure: () => {
-          return this.pressure
-        },
-        connection: () => {
-          return this.connection
-        },
-        bodymaterial: () => {
-          return this.bodymaterial
-        },
-        valveplatematerial: () => {
-          return this.valveplatematerial
-        },
-        stemmaterial: () => {
-          return this.stemmaterial
-        },
-        plinthmaterial: () => {
-          return this.plinthmaterial
-        },
-      }
-    },
-    methods: {
-      selectStatusChange () {
-        this.$refs['basicLayout'].param.content.where = this.selectParam
-        this.$refs['basicLayout'].param.content.pageNumber = 1
-        this.$refs['basicLayout'].listData()
+  components: { ImportFile },
+  data() {
+    return {
+      selectParam: {
+        status: "",
       },
-      selecttypeChange () {
-        this.$refs['basicLayout'].param.content.where = this.selectParam
-        this.$refs['basicLayout'].param.content.pageNumber = 1
-        this.$refs['basicLayout'].listData()
+      dateSelect: "",
+      typeList: [],
+      caliber: [],
+      pressure: [],
+      connection: [],
+      bodymaterial: [],
+      valveplatematerial: [],
+      stemmaterial: [],
+      plinthmaterial: [],
+      errorUrl:null,
+    };
+  },
+  provide() {
+    return {
+      itemTypeList: () => {
+        return this.typeList;
       },
-      selectTimeChange(){
-      if (this.dateSelect !== '' && this.dateSelect !== null){
-          this.selectParam.begindate = this.dateSelect[0]
-          this.selectParam.enddate = this.dateSelect[1]
-        }else {
-          this.selectParam.begindate = ''
-          this.selectParam.enddate = ''
-        }
-        this.$refs.basicLayout.param.content.pageNumber = 1
-        this.$refs.basicLayout.param.content.where = this.selectParam
-        this.$refs.basicLayout.listData()
+      caliber: () => {
+        return this.caliber;
       },
-      optionList () {
-        this.$store.dispatch('optiontypeselect','famentype').then(res => {
-          this.typeList = res.data
-          console.log(this.typeList,'阀门类型');
-        })
-        this.$store.dispatch('optiontypeselect','caliber').then(res => {
-          this.caliber = res.data
-          console.log(this.caliber,'公称通径');
-        })
-
-        this.$store.dispatch('optiontypeselect','pressure').then(res => {
-          this.pressure = res.data
-          console.log(this.pressure,'公称压力');
-        })
-        
-        this.$store.dispatch('optiontypeselect','connection').then(res => {
-          this.connection = res.data
-          console.log(this.connection,'连接方式');
+      pressure: () => {
+        return this.pressure;
+      },
+      connection: () => {
+        return this.connection;
+      },
+      bodymaterial: () => {
+        return this.bodymaterial;
+      },
+      valveplatematerial: () => {
+        return this.valveplatematerial;
+      },
+      stemmaterial: () => {
+        return this.stemmaterial;
+      },
+      plinthmaterial: () => {
+        return this.plinthmaterial;
+      },
+    };
+  },
+  methods: {
+    async bindImport (id) {
+      const res = await this.$api.requested({
+        "id": 20240617142502,
+        "content": {
+          "attachmentid":id[0]
+        }
+      })
+      if (res.data !== '成功') {
+        this.errorUrl = res.data
+      } else {
+        this.tool.showMessage(res,() => {
+          this.$refs.basicLayout.listData()
         })
+      }
+      
+    },
+    selectStatusChange() {
+      this.$refs["basicLayout"].param.content.where = this.selectParam;
+      this.$refs["basicLayout"].param.content.pageNumber = 1;
+      this.$refs["basicLayout"].listData();
+    },
+    selecttypeChange() {
+      this.$refs["basicLayout"].param.content.where = this.selectParam;
+      this.$refs["basicLayout"].param.content.pageNumber = 1;
+      this.$refs["basicLayout"].listData();
+    },
+    selectTimeChange() {
+      if (this.dateSelect !== "" && this.dateSelect !== null) {
+        this.selectParam.begindate = this.dateSelect[0];
+        this.selectParam.enddate = this.dateSelect[1];
+      } else {
+        this.selectParam.begindate = "";
+        this.selectParam.enddate = "";
+      }
+      this.$refs.basicLayout.param.content.pageNumber = 1;
+      this.$refs.basicLayout.param.content.where = this.selectParam;
+      this.$refs.basicLayout.listData();
+    },
+    optionList() {
+      this.$store.dispatch("optiontypeselect", "famentype").then((res) => {
+        this.typeList = res.data;
+        console.log(this.typeList, "阀门类型");
+      });
+      this.$store.dispatch("optiontypeselect", "caliber").then((res) => {
+        this.caliber = res.data;
+        console.log(this.caliber, "公称通径");
+      });
 
-        this.$store.dispatch('optiontypeselect','bodymaterial').then(res => {
-          this.bodymaterial = res.data
-          console.log(this.bodymaterial,'阀体材质');
-        })
+      this.$store.dispatch("optiontypeselect", "pressure").then((res) => {
+        this.pressure = res.data;
+        console.log(this.pressure, "公称压力");
+      });
 
-        this.$store.dispatch('optiontypeselect','valveplatematerial').then(res => {
-          this.valveplatematerial = res.data
-          console.log(this.valveplatematerial,'阀板材质');
-        })
+      this.$store.dispatch("optiontypeselect", "connection").then((res) => {
+        this.connection = res.data;
+        console.log(this.connection, "连接方式");
+      });
 
-        this.$store.dispatch('optiontypeselect','stemmaterial').then(res => {
-          this.stemmaterial = res.data
-          console.log(this.stemmaterial,'阀杆材质');
-        })
+      this.$store.dispatch("optiontypeselect", "bodymaterial").then((res) => {
+        this.bodymaterial = res.data;
+        console.log(this.bodymaterial, "阀体材质");
+      });
 
-        this.$store.dispatch('optiontypeselect','plinthmaterial').then(res => {
-          this.plinthmaterial = res.data
-          console.log(this.plinthmaterial,'阀座材质');
-        })
+      this.$store
+        .dispatch("optiontypeselect", "valveplatematerial")
+        .then((res) => {
+          this.valveplatematerial = res.data;
+          console.log(this.valveplatematerial, "阀板材质");
+        });
 
+      this.$store.dispatch("optiontypeselect", "stemmaterial").then((res) => {
+        this.stemmaterial = res.data;
+        console.log(this.stemmaterial, "阀杆材质");
+      });
 
-      }
+      this.$store.dispatch("optiontypeselect", "plinthmaterial").then((res) => {
+        this.plinthmaterial = res.data;
+        console.log(this.plinthmaterial, "阀座材质");
+      });
     },
-    created () {
-      this.optionList()
-    }
-}
+  },
+  created() {
+    this.optionList();
+  },
+};
 </script>
 
 <style scoped>
-
 </style>

+ 207 - 0
src/optionSystem/modules/importFile.vue

@@ -0,0 +1,207 @@
+<template>
+  <div>
+    <!-- 按钮类型 -->
+    <el-button type="primary" size="small" @click="dialogUploadVisible = true">{{ btnName || '导入' }}</el-button>
+    <el-dialog title="文件上传" class="import-panel" :visible.sync="dialogUploadVisible" width="500px" append-to-body :close-on-click-modal="false" :show-close="false" :before-close="clearFiles">
+      <div slot="title"></div>
+      <div style="background:#f1f2f3" class="my-tabs" >
+        <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
+          <!-- <el-tab-pane label="导入经销商线索" name="first"></el-tab-pane> -->
+          <el-tab-pane :label="`导入${title||'数据'}模板`" name="second"></el-tab-pane>
+        </el-tabs>
+      </div>
+      <div style="padding:20px">
+        <el-upload
+          style="width:100%"
+          ref="my-upload"
+          class="upload-demo normal-margin"
+          :accept="accept"
+          action="#"
+          :auto-upload="false"
+          :show-file-list="false"
+          :on-change="handleChange"
+          drag
+          multiple>
+          <i class="el-icon-upload"></i>
+          <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
+        </el-upload>
+        <div class="progress_panel" v-for="file in filelist" :key="file.uid">
+          <img v-if="file.type === 'DOC' || file.type === 'DOCX'" width="30" src="../../assets/file_icons/word.png"
+            alt="">
+          <img v-else-if="file.type === 'PDF'" width="30" src="../../assets/file_icons/PDF.png" alt="">
+          <img v-else-if="file.type === 'MP4' || file.type === 'AVI'" width="30" src="../../assets/file_icons/video.png"
+            alt="">
+          <img v-else-if="file.type === 'XLS' || file.type === 'XLSX'" width="30" src="../../assets/file_icons/excel.png"
+            alt="">
+          <img v-else-if="file.type === 'PNG' || file.type === 'JPG'|| file.type === 'JPEG'" width="30"
+            src="../../assets/file_icons/image.png" alt="">
+          <img v-else-if="file.type === 'PPT' || file.type === 'PPTX'" width="30" src="../../assets/file_icons/PPT.png"
+            alt="">
+          <img v-else width="30" src="../../assets/file_icons/unknow.png" alt="">
+          <div>
+            <p v-if="file.progress === 100" style="float:right"><span style="color:#67C23A">●</span>上传成功</p>
+            <p>{{file.raw?file.raw.name:'暂无上传文件'}}</p>
+            <el-progress :percentage="file.progress" :show-text="false"></el-progress>
+          </div>
+        </div>
+        <slot name="errorFile"></slot>
+        <p class="tips">• 为保证数据导入顺利,推荐您下载并使用<a :href="modelurl">《Excel{{title||'数据'}}标准模板》</a></p>
+        <p class="tips">• 文件中数据不能超过5000行</p>
+        <a :href="errorUrl" class="tips" style="color:red" v-if="errorUrl">•下载错误数据</a>
+        <div class="dialog-footer">
+          <el-button size="small" @click="cancel" class="normal-btn-width">取 消</el-button>
+          <el-button size="small" type="warning" @click="dialogUploadVisible = false" class="normal-btn-width btn-warning">确 定</el-button>
+        </div>
+      </div>
+      
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+
+export default {
+  /*
+    folderid:文件夹id; 必填
+    btntype:展示上传按钮的类型;
+    accept:限制上传文件类型;
+    bindData:附件上传成功后对应需要绑定的数据信息
+  */
+  props:['folderid','btntype','accept','bindData','btnName','templateParam','title','errorUrl'],
+  data () {
+    return {
+      dialogUploadVisible: false,
+      params: {
+        "classname": "system.attachment.huawei.OBS",
+        "method": "getFileName",
+        "content": {
+          "filename": '',
+          "filetype": '',
+          "parentid": ""//归属文件夹ID
+        }
+      },
+      file: {},
+      filelist: [],
+      CampaignList:[],
+      activeName:'last',
+      modelurl:'',
+      campaignid:''
+
+    }
+  },
+  mounted () {
+    this.getModelUrl()
+  },
+  methods: {
+    cancel () {
+      this.campaignid = ''
+      this.clearFiles()
+    },
+    handleChange (file, filelist) {
+      this.filelist = filelist
+      var index = file.raw.name.lastIndexOf(".");
+      var ext = file.name.substr(index + 1);
+      this.params.content.filename = file.raw.name
+      this.params.content.filetype = ext
+      this.getUploadUrl(file, ext)
+    },
+    handleClick () {
+      this.getModelUrl()
+    },
+    // 获取导入模板
+    async getModelUrl () {
+      const res = await this.$api.requested(this.templateParam)
+      this.modelurl = res.data
+      console.log(this.modelurl);
+      
+    },
+    // 获取华为云上传地址
+    async getUploadUrl (file, ext) {
+      this.params.content.parentid = JSON.parse(sessionStorage.getItem('folderid')).appfolderid
+      const res = await this.$api.requested(this.params)
+      let url = res.data.uploadurl
+      let obsfilename = res.data.serialfilename
+
+      this.upoladFileToServer(url, file, ext, obsfilename)
+    },
+    // 上传到华为云
+    async upoladFileToServer (url, file, ext, obsfilename) {      
+      let THIS = this
+      let config = {
+        headers: ext === 'pdf' ? { 'Content-Type': 'application/pdf' } : { 'Content-Type': 'application/octet-stream' },
+        onUploadProgress: function (progressEvent) {
+          let percent = progressEvent.loaded / progressEvent.total * 100
+          THIS.filelist.forEach(e => {
+            if (e.uid === file.uid) {
+              THIS.$set(e, 'type', ext.toUpperCase());
+              THIS.$set(e, 'progress', percent);
+            }
+          })
+        },
+      }
+      const res = await this.$upload.hw_upload(url, file.raw, config)
+      this.createFileRecord(obsfilename)
+    },
+
+    // 上传成功以后生成附件记录
+    async createFileRecord (obsfilename) {
+      let obj = {
+         "serialfilename": obsfilename
+      }
+      obj = Object.assign({},obj,this.bindData)
+      let param = {
+        "classname": "system.attachment.huawei.OBS",
+        "method": "uploadSuccess",
+        "content":obj
+      }
+      
+      const res = await this.$api.requested(param)
+      console.log(res,'结果')
+      this.$emit('onSuccess',res.data.attachmentids)
+    },
+
+    clearFiles () {
+      this.$refs['my-upload'].clearFiles()
+      this.filelist = []
+      this.dialogUploadVisible = false
+      this.$emit('clearUrl')
+    },
+  }
+}
+
+</script>
+<style>
+.import-panel .el-dialog__header,.import-panel .el-dialog__body{
+  padding: 0 !important;
+}
+.upload-demo > div {
+  width: 100% !important;
+}
+.upload-demo .el-upload-dragger {
+  width: 100% !important;
+}
+</style>
+<style scoped>
+.progress_panel {
+  display: flex;
+  align-items: center;
+  padding: 10px;
+  margin: 10px 0;
+  border-radius: 5px;
+  transition: linear 0.2s all;
+}
+.progress_panel:hover {
+  box-shadow: 0px 0px 5px #ccc;
+}
+.progress_panel > div {
+  flex: 1;
+  padding: 0 10px;
+}
+.progress_panel > div > p {
+  line-height: 30px;
+}
+.tips{
+  line-height: 30px;
+}
+</style>
+

+ 117 - 79
src/optionSystem/otherFileManage/index.vue

@@ -1,94 +1,132 @@
 <template>
   <basicLayout
-      ref="basicLayout"
-      :oldFormPath="{
-        add:'optionSystem/otherFileManage/modules'
-      }"
-      tableName="otherTable"
-      idName="itemid"
-      ownertable="plm_item"
-      :apiId="{query:20240605145002,del:20240605144802}"
-      :detailPath="{
-        path:'/otherFileDetail'
-      }"
-      :isExport="false"
+    ref="basicLayout"
+    :oldFormPath="{
+      add: 'optionSystem/otherFileManage/modules',
+    }"
+    tableName="otherTable"
+    idName="itemid"
+    ownertable="plm_item"
+    :apiId="{ query: 20240605145002, del: 20240605144802 }"
+    :detailPath="{
+      path: '/otherFileDetail',
+    }"
+    :isExport="false"
+  >
+    <template #titleRight>
+      <ImportFile
+        :templateParam="{ id: 20240618091202, content: {} }"
+        title="其它附件"
+        @onSuccess="bindImport"
+        :errorUrl="errorUrl"
+        @clearUrl="errorUrl = null"
+        v-if="tool.checkAuth($route.name,'importFile')"
+      ></ImportFile>
+    </template>
+    <template #custom>
+      <div class="mt-10">
+        <label class="search__label">创建时间:</label>
+        <el-date-picker
+          style="margin-right: 24px !important"
+          size="small"
+          @change="selectTimeChange"
+          value-format="yyyy-MM-dd"
+          v-model="dateSelect"
+          type="daterange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          clearable
+        >
+        </el-date-picker>
+      </div>
+      <div class="mt-10">
+        <label class="search__label">状态:</label>
+        <el-select
+          class="inline-24"
+          v-model="selectParam.status"
+          placeholder="请选择状态"
+          @change="selectStatusChange"
+          size="small"
+          clearable
+        >
+          <el-option label="新建" value="新建"></el-option>
+          <el-option label="审核" value="审核"></el-option>
+        </el-select>
+      </div>
+    </template>
+    <template v-slot:tbList="scope">
+      <div
+        :style="
+          scope.data.column.data.status === '审核'
+            ? 'color:#52C41A'
+            : 'color:000000'
+        "
+        v-if="scope.data.column.columnname === 'status'"
       >
-      <template #titleRight>
-      </template>
-      <template #custom>
-        <div class="mt-10">
-          <label class="search__label" >创建时间:</label>
-          <el-date-picker
-              style="margin-right: 24px !important;"
-              size="small"
-              @change="selectTimeChange"
-              value-format="yyyy-MM-dd"
-              v-model="dateSelect"
-              type="daterange"
-              range-separator="至"
-              start-placeholder="开始日期"
-              end-placeholder="结束日期"
-              clearable>
-          </el-date-picker>
-        </div>
-        <div class="mt-10">
-          <label  class="search__label" >状态:</label>
-          <el-select class="inline-24" v-model="selectParam.status" placeholder="请选择状态" @change="selectStatusChange" size="small" clearable>
-            <el-option label="新建" value="新建"></el-option>
-            <el-option label="审核" value="审核"></el-option>
-          </el-select>
-        </div>
-        
-      </template>
-      <template v-slot:tbList="scope">
-        <div :style="scope.data.column.data.status === '审核'?'color:#52C41A':'color:000000'" v-if="scope.data.column.columnname === 'status'">
-          {{ scope.data.column.data.status }}
-        </div>
-        <div v-else-if="scope.data.column.columnname === 'marketprice'">
-          {{ tool.formatAmount(scope.data.column.data.marketprice,2) }}
-        </div>
-        <p v-else> {{scope.data.column.data[[scope.data.column.columnname]]}}</p>
-      </template>
-      <!-- <template v-slot:tbOpreation="scope">
+        {{ scope.data.column.data.status }}
+      </div>
+      <div v-else-if="scope.data.column.columnname === 'marketprice'">
+        {{ tool.formatAmount(scope.data.column.data.marketprice, 2) }}
+      </div>
+      <p v-else>{{ scope.data.column.data[[scope.data.column.columnname]] }}</p>
+    </template>
+    <!-- <template v-slot:tbOpreation="scope">
        <editTemp :data="scope.data.data"></editTemp>
       </template> -->
-    </basicLayout>
+  </basicLayout>
 </template>
 
 <script>
+import ImportFile from "../modules/importFile.vue";
 export default {
-    data () {
-        return {
-          selectParam: {
-            status:'',
-          },
-          dateSelect:'',
-        }
-    },
-    methods: {
-      selectStatusChange () {
-        this.$refs['basicLayout'].param.content.where = this.selectParam
-        this.$refs['basicLayout'].param.content.pageNumber = 1
-        this.$refs['basicLayout'].listData()
-      },
-      selectTimeChange(){
-      if (this.dateSelect !== '' && this.dateSelect !== null){
-          this.selectParam.begindate = this.dateSelect[0]
-          this.selectParam.enddate = this.dateSelect[1]
-        }else {
-          this.selectParam.begindate = ''
-          this.selectParam.enddate = ''
-        }
-        this.$refs.basicLayout.param.content.pageNumber = 1
-        this.$refs.basicLayout.param.content.where = this.selectParam
-        this.$refs.basicLayout.listData()
+  components: { ImportFile },
+  data() {
+    return {
+      selectParam: {
+        status: "",
       },
+      dateSelect: "",
+      errorUrl: null,
+    };
+  },
+  methods: {
+    async bindImport(id) {
+      const res = await this.$api.requested({
+        id: 20240618102002,
+        content: {
+          attachmentid: id[0],
+        },
+      });
+      if (res.data !== "成功") {
+        this.errorUrl = res.data;
+      } else {
+        this.tool.showMessage(res, () => {
+          this.$refs.basicLayout.listData();
+        });
+      }
+    },
+    selectStatusChange() {
+      this.$refs["basicLayout"].param.content.where = this.selectParam;
+      this.$refs["basicLayout"].param.content.pageNumber = 1;
+      this.$refs["basicLayout"].listData();
     },
-    created () {
-    }
-}
+    selectTimeChange() {
+      if (this.dateSelect !== "" && this.dateSelect !== null) {
+        this.selectParam.begindate = this.dateSelect[0];
+        this.selectParam.enddate = this.dateSelect[1];
+      } else {
+        this.selectParam.begindate = "";
+        this.selectParam.enddate = "";
+      }
+      this.$refs.basicLayout.param.content.pageNumber = 1;
+      this.$refs.basicLayout.param.content.where = this.selectParam;
+      this.$refs.basicLayout.listData();
+    },
+  },
+  created() {},
+};
 </script>
 
 <style scoped>
-
 </style>

+ 138 - 99
src/optionSystem/speedBoxManage/index.vue

@@ -1,117 +1,156 @@
 <template>
   <basicLayout
-      ref="basicLayout"
-      :oldFormPath="{
-        add:'optionSystem/speedBoxManage/modules'
-      }"
-      tableName="speedBoxTable"
-      idName="itemid"
-      ownertable="plm_item"
-      :apiId="{query:20240615136202,del:20240615136002}"
-      :detailPath="{
-        path:'/speedBoxDetail'
-      }"
-      :isExport="false"
+    ref="basicLayout"
+    :oldFormPath="{
+      add: 'optionSystem/speedBoxManage/modules',
+    }"
+    tableName="speedBoxTable"
+    idName="itemid"
+    ownertable="plm_item"
+    :apiId="{ query: 20240615136202, del: 20240615136002 }"
+    :detailPath="{
+      path: '/speedBoxDetail',
+    }"
+    :isExport="false"
+  >
+    <template #titleRight>
+      <ImportFile
+        :templateParam="{ id: 20240618135602, content: {} }"
+        title="执行器"
+        @onSuccess="bindImport"
+        :errorUrl="errorUrl"
+        @clearUrl="errorUrl = null"
+        v-if="tool.checkAuth($route.name, 'importFile')"
+      ></ImportFile>
+    </template>
+    <template #custom>
+      <div class="mt-10">
+        <label class="search__label">创建时间:</label>
+        <el-date-picker
+          style="margin-right: 24px !important"
+          size="small"
+          @change="selectTimeChange"
+          value-format="yyyy-MM-dd"
+          v-model="dateSelect"
+          type="daterange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          clearable
+        >
+        </el-date-picker>
+      </div>
+      <div class="mt-10">
+        <label class="search__label">状态:</label>
+        <el-select
+          class="inline-24"
+          v-model="selectParam.status"
+          placeholder="请选择状态"
+          @change="selectStatusChange"
+          size="small"
+          clearable
+        >
+          <el-option label="新建" value="新建"></el-option>
+          <el-option label="审核" value="审核"></el-option>
+        </el-select>
+      </div>
+    </template>
+    <template v-slot:tbList="scope">
+      <div
+        :style="
+          scope.data.column.data.status === '审核'
+            ? 'color:#52C41A'
+            : 'color:000000'
+        "
+        v-if="scope.data.column.columnname === 'status'"
       >
-      <template #titleRight>
-      </template>
-      <template #custom>
-        <div class="mt-10">
-          <label class="search__label" >创建时间:</label>
-          <el-date-picker
-              style="margin-right: 24px !important;"
-              size="small"
-              @change="selectTimeChange"
-              value-format="yyyy-MM-dd"
-              v-model="dateSelect"
-              type="daterange"
-              range-separator="至"
-              start-placeholder="开始日期"
-              end-placeholder="结束日期"
-              clearable>
-          </el-date-picker>
-        </div>
-        <div class="mt-10">
-          <label  class="search__label" >状态:</label>
-          <el-select class="inline-24" v-model="selectParam.status" placeholder="请选择状态" @change="selectStatusChange" size="small" clearable>
-            <el-option label="新建" value="新建"></el-option>
-            <el-option label="审核" value="审核"></el-option>
-          </el-select>
-        </div>
-        
-      </template>
-      <template v-slot:tbList="scope">
-        <div :style="scope.data.column.data.status === '审核'?'color:#52C41A':'color:000000'" v-if="scope.data.column.columnname === 'status'">
-          {{ scope.data.column.data.status }}
-        </div>
-        <div v-else-if="scope.data.column.columnname === 'marketprice'">
-          {{ tool.formatAmount(scope.data.column.data.marketprice,2) }}
-        </div>
-        <p v-else> {{scope.data.column.data[[scope.data.column.columnname]]}}</p>
-      </template>
-      <!-- <template v-slot:tbOpreation="scope">
+        {{ scope.data.column.data.status }}
+      </div>
+      <div v-else-if="scope.data.column.columnname === 'marketprice'">
+        {{ tool.formatAmount(scope.data.column.data.marketprice, 2) }}
+      </div>
+      <p v-else>{{ scope.data.column.data[[scope.data.column.columnname]] }}</p>
+    </template>
+    <!-- <template v-slot:tbOpreation="scope">
        <editTemp :data="scope.data.data"></editTemp>
       </template> -->
-    </basicLayout>
+  </basicLayout>
 </template>
 
 <script>
+import ImportFile from "../modules/importFile.vue";
 export default {
-    data () {
-        return {
-          selectParam: {
-            status:'',
-          },
-          dateSelect:'',
-          bodystructure:[],
-          func:[]
-        }
-    },
-    provide () {
-      return {
-        bodystructure: () => {
-          return this.bodystructure
-        },
-        func: () => {
-          return this.func
+  components: { ImportFile },
+  data() {
+    return {
+      selectParam: {
+        status: "",
+      },
+      dateSelect: "",
+      bodystructure: [],
+      func: [],
+      errorUrl: null,
+    };
+  },
+  provide() {
+    return {
+      bodystructure: () => {
+        return this.bodystructure;
+      },
+      func: () => {
+        return this.func;
+      },
+    };
+  },
+  methods: {
+    async bindImport(id) {
+      const res = await this.$api.requested({
+        id: 20240618135702,
+        content: {
+          attachmentid: id[0],
         },
+      });
+      if (res.data !== "成功") {
+        this.errorUrl = res.data;
+      } else {
+        this.tool.showMessage(res, () => {
+          this.$refs.basicLayout.listData();
+        });
       }
     },
-    methods: {
-      selectStatusChange () {
-        this.$refs['basicLayout'].param.content.where = this.selectParam
-        this.$refs['basicLayout'].param.content.pageNumber = 1
-        this.$refs['basicLayout'].listData()
-      },
-      selectTimeChange(){
-      if (this.dateSelect !== '' && this.dateSelect !== null){
-          this.selectParam.begindate = this.dateSelect[0]
-          this.selectParam.enddate = this.dateSelect[1]
-        }else {
-          this.selectParam.begindate = ''
-          this.selectParam.enddate = ''
-        }
-        this.$refs.basicLayout.param.content.pageNumber = 1
-        this.$refs.basicLayout.param.content.where = this.selectParam
-        this.$refs.basicLayout.listData()
-      },
-      optionList () {
-        this.$store.dispatch('optiontypeselect','bodystructure').then(res => {
-          this.bodystructure = res.data
-          console.log(this.bodystructure,'结构');
-        })
-        this.$store.dispatch('optiontypeselect','func').then(res => {
-          this.func = res.data
-          console.log(this.func,'功能');
-        })
+    selectStatusChange() {
+      this.$refs["basicLayout"].param.content.where = this.selectParam;
+      this.$refs["basicLayout"].param.content.pageNumber = 1;
+      this.$refs["basicLayout"].listData();
+    },
+    selectTimeChange() {
+      if (this.dateSelect !== "" && this.dateSelect !== null) {
+        this.selectParam.begindate = this.dateSelect[0];
+        this.selectParam.enddate = this.dateSelect[1];
+      } else {
+        this.selectParam.begindate = "";
+        this.selectParam.enddate = "";
       }
+      this.$refs.basicLayout.param.content.pageNumber = 1;
+      this.$refs.basicLayout.param.content.where = this.selectParam;
+      this.$refs.basicLayout.listData();
     },
-    created () {
-      this.optionList()
-    }
-}
+    optionList() {
+      this.$store.dispatch("optiontypeselect", "bodystructure").then((res) => {
+        this.bodystructure = res.data;
+        console.log(this.bodystructure, "结构");
+      });
+      this.$store.dispatch("optiontypeselect", "func").then((res) => {
+        this.func = res.data;
+        console.log(this.func, "功能");
+      });
+    },
+  },
+  created() {
+    this.optionList();
+  },
+};
 </script>
 
 <style scoped>
-
 </style>

+ 29 - 1
src/optionSystem/throttleManage/index.vue

@@ -13,7 +13,16 @@
     }"
     :isExport="false"
   >
-    <template #titleRight> </template>
+    <template #titleRight>
+      <ImportFile
+        :templateParam="{ id: 20240618091202, content: {} }"
+        title="节流件"
+        @onSuccess="bindImport"
+        :errorUrl="errorUrl"
+        @clearUrl="errorUrl = null"
+        v-if="tool.checkAuth($route.name,'importFile')"
+      ></ImportFile>
+    </template>
     <template #custom>
       <div class="mt-10">
         <label class="search__label">创建时间:</label>
@@ -105,7 +114,9 @@
 </template>
 
 <script>
+import ImportFile from "../modules/importFile.vue";
 export default {
+  components:{ImportFile},
   data() {
     return {
       selectParam: {
@@ -115,6 +126,7 @@ export default {
       dateSelect: "",
       typeList: [],
       throttletype: [],
+      errorUrl:null,
     };
   },
   provide() {
@@ -128,6 +140,22 @@ export default {
     };
   },
   methods: {
+    async bindImport (id) {
+      const res = await this.$api.requested({
+        "id": 20240618093302,
+        "content": {
+          "attachmentid":id[0]
+        }
+      })
+      if (res.data !== '成功') {
+        this.errorUrl = res.data
+      } else {
+        this.tool.showMessage(res,() => {
+          this.$refs.basicLayout.listData()
+        })
+      }
+      
+    },
     selectStatusChange() {
       this.$refs["basicLayout"].param.content.where = this.selectParam;
       this.$refs["basicLayout"].param.content.pageNumber = 1;