Explorar el Código

新列表自定义下拉框

zhouhao hace 2 años
padre
commit
d4821b7c68

+ 10 - 0
src/api/sales.js

@@ -140,3 +140,13 @@ export function listOrder(params) {
     data: params
   })
 }
+
+
+// 下拉框查询
+export function commonDict(params) {
+  return request({
+    url: "/common/dict/listDict",
+    method: "get",
+    params
+  });
+}

+ 9 - 0
src/api/user.js

@@ -86,3 +86,12 @@ export function zfireDel(data, adminUserId, moduleId) {
     data
   });
 }
+
+// 下拉框查询
+export function commonDict(params) {
+  return request({
+    url: "/common/dict/listDict",
+    method: "get",
+    params
+  });
+}

+ 1 - 0
src/components/template/import_mixin.js

@@ -19,6 +19,7 @@ export default {
                   })
                 })
                 .catch(err => {
+                  console.log(err,55);
                   this.$message({
                     type: 'error',
                     message: err.message || '导入失败'

+ 36 - 42
src/components/template/template-page-1.vue

@@ -1,34 +1,19 @@
 <template>
-  <zj-page-template
-    ref="zjpage"
-    style="width: 100%;height: 100%;"
-    :get-table-data="getTableData"
-    :options-evens="evens"
+  <zj-page-template ref="zjpage" style="width: 100%;height: 100%;" :get-table-data="getTableData" :options-evens="evens"
     :options-evens-group="selBtn(optionsEvensGroup)"
     :table-attributes="{ ...defaultTableAttributes, ...tableAttributes }"
-    :table-events="{ ...defaultTableEvents, ...tableEvents }"
-    :column-parsing="columnParsing"
-    :reduction="reduction"
-    :plan="[...plan, ...morePlan]"
-    :operation="operation"
-    :operation-column-width="operationColumnWidth"
-    :show-table="showTable"
-    :code-gather="codeGather"
-    @columnWidthChange="columnWidthChange" 
-    @columnListChange="columnListChange"
-  >
-    <sel-export-column-list
-      :column-list="columnList"
-      @determine="exportDetermine"
-      @cancel="columnList = []"
-    />
+    :table-events="{ ...defaultTableEvents, ...tableEvents }" :column-parsing="columnParsing" :reduction="reduction"
+    :plan="[...plan, ...morePlan]" :operation="operation" :operation-column-width="operationColumnWidth"
+    :show-table="showTable" :code-gather="codeGather" @columnWidthChange="columnWidthChange"
+    @columnListChange="columnListChange">
+    <sel-export-column-list :column-list="columnList" @determine="exportDetermine" @cancel="columnList = []" />
     <slot />
   </zj-page-template>
 </template>
 
 <script>
 
-import { zfireSave, zfireDel } from "@/api/user";
+import { zfireSave, zfireDel, commonDict } from "@/api/user";
 import SelExportColumnList from './sel-export-column-list'
 
 export default {
@@ -122,21 +107,26 @@ export default {
         ]
       ]
     }
-    // commonDict().then(res => {
-    //   var codeGather = {}
-    //   res.data.map(item => {
-    //     if (!codeGather[item.dictCode]) {
-    //       codeGather[item.dictCode] = []
-    //     }
-    //     codeGather[item.dictCode].push({
-    //       label: item.dictName,
-    //       value: item.dictValue
-    //     })
-    //   })
-    //   this.codeGather = codeGather
-    // })
+
   },
+
   methods: {
+    getDictCode(params) {
+    
+      commonDict(params).then(res => {
+        if (res.data.length) {
+          res.data.map(item => {
+            if (!this.codeGather[params.code]) {
+              this.$set(this.codeGather,params.code,[])
+            }
+            this.$set(this.codeGather,params.code,[...this.codeGather[params.code],{
+              label: item.dictValue,
+              value: item.dictCode
+            }])
+          })
+        }
+      })
+    },
     selBtn(arr) {
       for (var i = 0; i < arr.length; i++) {
         if (Array.isArray(arr[i])) {
@@ -173,6 +163,12 @@ export default {
               this.showTable = true
             })
           }
+          res.fieldBeans.forEach(k => {
+            if (k.frontCode) {
+              this.getDictCode({ code: k.frontCode })
+            }
+          });
+
           return res
         }
       } catch (error) {
@@ -278,12 +274,9 @@ export default {
 <style lang="scss" scoped>
 @font-face {
   font-family: "aliyun_iconfont";
-  src: url("//at.alicdn.com/t/font_2075393_0cjq4n8ykvds.woff2?t=1647587689181")
-  format("woff2"),
-  url("//at.alicdn.com/t/font_2075393_0cjq4n8ykvds.woff?t=1647587689181")
-  format("woff"),
-  url("//at.alicdn.com/t/font_2075393_0cjq4n8ykvds.ttf?t=1647587689181")
-  format("truetype");
+  src: url("//at.alicdn.com/t/font_2075393_0cjq4n8ykvds.woff2?t=1647587689181") format("woff2"),
+    url("//at.alicdn.com/t/font_2075393_0cjq4n8ykvds.woff?t=1647587689181") format("woff"),
+    url("//at.alicdn.com/t/font_2075393_0cjq4n8ykvds.ttf?t=1647587689181") format("truetype");
 }
 
 ::v-deep .el-table__cell {
@@ -324,7 +317,7 @@ export default {
   flex-direction: row;
   align-items: center;
 
-  & > *:not(:last-child) {
+  &>*:not(:last-child) {
     margin-right: 5px;
   }
 
@@ -334,6 +327,7 @@ export default {
 }
 
 ::v-deep .is-disabled {
+
   .el-textarea__inner,
   .el-input__inner {
     background-color: #fff;

+ 1 - 1
src/utils/request.js

@@ -169,7 +169,7 @@ export async function handleImport(url, formData, id = '') {
         }
       })
       .then(res => {
-        if (res.data.code !== 1) {
+        if (res.data.code !== 200) {
           reject(new Error(res.data.message || 'Error'))
           return
         }

+ 1 - 0
src/views/sales_control/preposition_stock_list.vue

@@ -32,6 +32,7 @@ export default {
               click: () => {
                 workerTemplateExcel({}, `${this.$route.meta.title}`)
                   .then(res => {
+                    console.log('chengg');
                     this.$message({
                       message: "下载成功",
                       type: "success"