Blame view

src/components/scm/ConfigSupplier.vue 2.17 KB
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
1
  <template>
f22ec63c   wuxw   开发供应商功能
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
    <el-dialog 
      :title="$t('supplierManage.config')" 
      :visible.sync="visible" 
      width="800px"
      @close="resetForm">
      <el-form ref="form" :model="form" label-width="200px">
        <el-form-item 
          v-for="(item, index) in form.configs" 
          :key="index"
          :label="item.name">
          <el-input 
            v-model="item.columnValue" 
            :placeholder="item.remark" 
            class="w-100" />
        </el-form-item>
      </el-form>
      
      <div slot="footer" class="dialog-footer">
        <el-button @click="visible = false">{{ $t('supplierManage.cancel') }}</el-button>
        <el-button type="primary" @click="saveConfigSupplierInfo">{{ $t('supplierManage.confirm') }}</el-button>
      </div>
    </el-dialog>
  </template>
  
  <script>
  import { listSupplierConfig, saveSupplierConfig } from '@/api/scm/supplierManageApi'
  
  export default {
    name: 'ConfigSupplier',
    data() {
      return {
        visible: false,
        form: {
          supplierId: '',
          configs: []
        }
      }
    },
    methods: {
      async open(row) {
        this.form.supplierId = row.supplierId
        this.visible = true
        await this.loadSupplierConfigs()
      },
      
      async loadSupplierConfigs() {
        if (!this.form.supplierId) return
        
        try {
          const res = await listSupplierConfig({
            supplierId: this.form.supplierId,
            page: 1,
            row: 100
          })
          this.form.configs = res.data || []
        } catch (error) {
          console.error('加载供应商配置失败:', error)
        }
      },
      
      async saveConfigSupplierInfo() {
        try {
          const res = await saveSupplierConfig(this.form)
          if (res.code === 0) {
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
66
            this.$message.success(this.$t('common.operationSuccess'))
f22ec63c   wuxw   开发供应商功能
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
            this.visible = false
          } else {
            this.$message.error(res.msg || this.$t('common.saveFailed'))
          }
        } catch (error) {
          console.error('保存供应商配置失败:', error)
          this.$message.error(this.$t('common.saveFailed'))
        }
      },
      
      resetForm() {
        this.form = {
          supplierId: '',
          configs: []
        }
      }
    }
  }
  </script>
  
  <style scoped>
  .w-100 {
    width: 100%;
  }
  </style>