| | |
| | | </div> |
| | | </div> |
| | | <div> |
| | | <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading"></lims-table> |
| | | <lims-table :tableData="tableData" :column="column" |
| | | :height="'calc(100vh - 250px)'" |
| | | :page="page" :tableLoading="tableLoading" |
| | | @pagination="pagination"></lims-table> |
| | | </div> |
| | | <el-dialog :title="formTitle" :visible.sync="addDia" width="450px"> |
| | | <el-form ref="userForm" :model="user" :rules="userRules" label-position="right" label-width="100px"> |
| | |
| | | |
| | | <script> |
| | | import limsTable from '@/components/Table/lims-table.vue' |
| | | import {addCustom, selectCustomPageList, upCustom} from "@/api/system/customer"; |
| | | import {addCustom, delCustomById, selectCustomPageList, upCustom} from "@/api/system/customer"; |
| | | export default { |
| | | name: 'Customer', |
| | | components: { |
| | | limsTable |
| | | }, |
| | |
| | | clickFun: (row) => { |
| | | this.openFormDia('edit', row); |
| | | }, |
| | | },{ |
| | | name: '删除', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | this.delete(row); |
| | | }, |
| | | }, |
| | | ] |
| | | } |
| | |
| | | addDia: false, |
| | | addPower: true, |
| | | user: { |
| | | name: null |
| | | company: '' |
| | | }, |
| | | userRules: { |
| | | company: [{ required: true, message: '请输入客户名称', trigger: 'blur' }], |
| | | companyEn: [{ required: true, message: '请输入客户名称EN', trigger: 'blur' }], |
| | | address: [{ required: true, message: '请输入单位地址', trigger: 'blur' }], |
| | | addressEn: [{ required: true, message: '请输单位地址EN', trigger: 'blur' }], |
| | | addressEn: [{ required: true, message: '请输入单位地址EN', trigger: 'blur' }], |
| | | num: [{ required: true, message: '请输入加急额度', trigger: 'blur' }], |
| | | code2: [{ required: true, message: '请输入客户编号', trigger: 'blur' }], |
| | | }, |
| | |
| | | selectCustomPageList({...this.queryParams, ...this.page}).then(res => { |
| | | this.tableLoading = false |
| | | if (res.code === 200) { |
| | | this.tableData = res.data |
| | | this.page.total = res.total |
| | | this.tableData = res.data.records |
| | | this.page.total = res.data.total |
| | | } |
| | | }).catch(err => { |
| | | this.tableLoading = false |
| | |
| | | this.queryParams.company = '' |
| | | this.getList() |
| | | }, |
| | | pagination (page) { |
| | | this.page.size = page.limit |
| | | this.getList() |
| | | }, |
| | | openFormDia (type, row) { |
| | | this.addDia = true |
| | | this.user = {} |
| | | this.formTitle = type === 'add' ? '新增客户' : '编辑客户' |
| | | this.operationType = type |
| | | if (type === 'edit') { |
| | | this.user = this.HaveJson(row) |
| | | } |
| | | }, |
| | | customAdd() { |
| | | this.$refs['userForm'].validate((valid) => { |
| | |
| | | this.loading = true |
| | | if (this.operationType === 'add') { |
| | | addCustom(this.user).then(res => { |
| | | if (res.code === 201) return |
| | | this.loading = false |
| | | if (res.code !== 200) return |
| | | this.$message.success('新增成功') |
| | | this.getList() |
| | | this.loading = false |
| | | this.reset() |
| | | }).catch(err => { |
| | | this.loading = false |
| | | }) |
| | | } else { |
| | | upCustom(this.user).then(res => { |
| | | if (res.code === 201) return |
| | | this.loading = false |
| | | if (res.code !== 200) return |
| | | this.$message.success('修改成功') |
| | | this.getList() |
| | | this.loading = false |
| | | this.reset() |
| | | }).catch(err => { |
| | | this.loading = false |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | reset () { |
| | | this.addDia = false |
| | | this.user = {} |
| | | this.resetForm("userForm"); |
| | | this.addDia = false |
| | | }, |
| | | delete (row) { |
| | | this.$confirm('是否删除当前数据?', "警告", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }).then(() => { |
| | | delCustomById({id: row.id}).then(res => { |
| | | if (res.code === 500) { |
| | | return |
| | | } |
| | | this.$message.success('删除成功') |
| | | this.getList() |
| | | }).catch(e => { |
| | | this.$message.error('删除失败') |
| | | }) |
| | | }).catch(() => {}) |
| | | } |
| | | } |
| | | } |