Bladeren bron

feat: 添加,下载强制仓模板、导入强制仓、导出强制仓

linwenxin 1 jaar geleden
bovenliggende
commit
e2697435f0
1 gewijzigde bestanden met toevoegingen van 29 en 4 verwijderingen
  1. 29 4
      src/views/setting/account.vue

+ 29 - 4
src/views/setting/account.vue

@@ -63,6 +63,20 @@
           <el-button size="mini" type="primary" @click="openAccountForm('add')">添加账号</el-button>
         </div>
         <div class="fr">
+          <el-upload
+            v-if="checkBtnRole('import')"
+            class="import-btn"
+            action=""
+            :http-request="(data)=>{
+              handleImport(data,'/stock/forceUser/batch/update')
+            }"
+            :file-list="importFileList"
+            :show-file-list="false"
+          >
+            <el-button type="primary" size="mini">导入强制仓</el-button>
+          </el-upload>
+          <el-button style="margin-left: 10px;" type="primary" size="mini" @click="handleDownloadforceexport">导出强制仓</el-button>
+          <el-button size="mini" @click="handleDownloadforceUser">下载强制仓模板</el-button>
           <el-button v-if="checkBtnRole('download')" size="mini" @click="handleDownload">下载导入模板</el-button>
           <ExportButton class="import-btn" :ex-url="'admin/user/user/listExport'" :ex-params="exParams" />
           <ImportButton
@@ -71,12 +85,13 @@
             :im-url="'admin/user/batch/update'"
             @importSuccess="getList"
           />
-
           <el-upload
             v-if="checkBtnRole('import')"
             class="import-btn"
             action=""
-            :http-request="handleImport"
+            :http-request="(data)=>{
+              handleImport(data)
+            }"
             :file-list="importFileList"
             :show-file-list="false"
           >
@@ -163,6 +178,7 @@
           <el-table-column align="center" label="操作" min-width="230">
             <template slot-scope="scope">
               <el-button
+                v-if="scope.row.roleId=='100'"
                 type="text"
                 @click="setForcedHold(scope.row)"
                 >设置强制仓</el-button>
@@ -785,6 +801,7 @@ export default {
       }
 
       getAccountList(params).then(res => {
+        console.log(res.data.records)
         this.dataList = res.data.records
         this.listTotal = res.data.total
         this.listLoading = false
@@ -1084,6 +1101,14 @@ export default {
       downloadFiles('admin/user/download')
     },
 
+    handleDownloadforceUser() {
+      downloadFiles('stock/forceUser/downloadGongcheng')
+    },
+
+    handleDownloadforceexport() {
+      downloadFiles('stock/forceUser/export')
+    },
+
     clickImport() {
       if (!this.selectDepartment) {
         return this.$errorMsg('请选择部门')
@@ -1093,14 +1118,14 @@ export default {
     },
 
     // 导入
-    async handleImport(param) {
+    async handleImport(param,url) {
       console.log(param)
       this.importLoading = true
       const file = param.file
       const formData = new FormData()
       formData.append('file', file)
 
-      const result = await handleImportTwo('/admin/user/importUser', formData)
+      const result = await handleImportTwo((url||'/admin/user/importUser'), formData)
       this.importLoading = false
       this.importFileList = []
       // console.log(result,999);