|
|
@@ -253,400 +253,400 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { createSupplier, updateSupplier, listSupplier, deleteSupplier, typeListSupplier, setStateSupplier } from "@/api/supplier";
|
|
|
-import { listDept } from "@/api/dept";
|
|
|
-import Treeselect from "@riophae/vue-treeselect";
|
|
|
-import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
-import waves from "@/directive/waves";
|
|
|
+import { createSupplier, updateSupplier, listSupplier, deleteSupplier, typeListSupplier, setStateSupplier } from '@/api/supplier'
|
|
|
+import { listDept } from '@/api/dept'
|
|
|
+import Treeselect from '@riophae/vue-treeselect'
|
|
|
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
|
|
+import waves from '@/directive/waves'
|
|
|
|
|
|
export default {
|
|
|
- components: { Treeselect },
|
|
|
- directives: { waves },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- categoryOptions: [],
|
|
|
- activeName: 'first',
|
|
|
- brandOptions: [],
|
|
|
- goodsStatusList: [
|
|
|
- { type: 0, name: '启用' },
|
|
|
- { type: 1, name: '停用' },
|
|
|
- ],
|
|
|
- list: [],
|
|
|
- total: 0,
|
|
|
- listLoading: false,
|
|
|
- listQuery: {
|
|
|
- page: 1,
|
|
|
- limit: 10,
|
|
|
- supplierName: '',
|
|
|
- supplierNum: '',
|
|
|
- typeId: '',
|
|
|
- responsibleDept: undefined,
|
|
|
- isEnable: '',
|
|
|
- },
|
|
|
- dataForm: {
|
|
|
- supplierName: undefined,
|
|
|
- supplierNum: undefined,
|
|
|
- typeId: undefined,
|
|
|
- supplierPurchasAddress: undefined,
|
|
|
- registeredCapital: undefined,
|
|
|
- bankCardNo: undefined,
|
|
|
- bankCardName: undefined,
|
|
|
- nature: undefined,
|
|
|
- taxrate: undefined,
|
|
|
- supplierContact: undefined,
|
|
|
- supplierPhone: undefined,
|
|
|
- supplierAddress: undefined,
|
|
|
- responsibleDept: undefined,
|
|
|
- supplierRemark: undefined,
|
|
|
- businessName: undefined,
|
|
|
- businessStartTime: undefined,
|
|
|
- businessEndTime: undefined,
|
|
|
- businessFile: undefined,
|
|
|
- businessFiles: [],
|
|
|
- financeFileId: undefined,
|
|
|
- financeFiles: [],
|
|
|
- auditFileId: undefined,
|
|
|
- auditFiles: [],
|
|
|
- qualifiedName: undefined,
|
|
|
- qualifiedStartTime: undefined,
|
|
|
- qualifiedEndTime: undefined,
|
|
|
- qualifiedFile: undefined,
|
|
|
- qualifiedFiles: [],
|
|
|
- },
|
|
|
- dialogFormVisible: false,
|
|
|
- dialogStatus: '',
|
|
|
- textMap: {
|
|
|
- update: "编辑供应商",
|
|
|
- create: "添加供应商",
|
|
|
- },
|
|
|
- rules: {
|
|
|
- supplierName: [{ required: true, message: "请填写供应商名称", trigger: "blur" }],
|
|
|
- typeId: [{ required: true, message: "请选择供应商类别", trigger: "blur" }],
|
|
|
- supplierPurchasAddress: [{ required: true, message: "请填写地域", trigger: "blur" }],
|
|
|
- registeredCapital: [
|
|
|
- { required: true, message: "请填写注册资本金", trigger: "blur" },
|
|
|
- { pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,2})?$/, message: "请输入合法的金额数字,最多两位小数", trigger: "blur" }
|
|
|
- ],
|
|
|
- bankCardNo: [{ required: true, message: "请填写银行卡号", trigger: "blur" }],
|
|
|
- bankCardName: [{ required: true, message: "请填写银行名称", trigger: "blur" }],
|
|
|
- nature: [{ required: true, message: "请选择纳税性质", trigger: "blur" }],
|
|
|
- taxrate: [{ required: true, message: "请选择税率", trigger: "blur" }],
|
|
|
- supplierContact: [{ required: true, message: "请填写联系人", trigger: "blur" }],
|
|
|
- supplierPhone: [{ required: true, message: "请填写联系电话", trigger: "blur" }],
|
|
|
- supplierAddress: [{ required: true, message: "请填写单位地址", trigger: "blur" }],
|
|
|
- responsibleDept: [{ required: true, message: "请选择申请部门", trigger: "blur" }],
|
|
|
- supplierRemark: [{ required: true, message: "请填写申请事由", trigger: "blur" }],
|
|
|
- businessName: [{ required: true, message: "请填写营业执照名称", trigger: "blur" }],
|
|
|
- businessStartTime: [{ required: true, message: "请选择开始日期", trigger: "blur" }],
|
|
|
- businessEndTime: [{ required: true, message: "请选择结束日期", trigger: "blur" }],
|
|
|
- businessFile: [{ required: true, message: "请上传营业执照", trigger: "blur" }],
|
|
|
- },
|
|
|
- fileImgUrl: this.upLoadUrl,
|
|
|
+ components: { Treeselect },
|
|
|
+ directives: { waves },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ categoryOptions: [],
|
|
|
+ activeName: 'first',
|
|
|
+ brandOptions: [],
|
|
|
+ goodsStatusList: [
|
|
|
+ { type: 0, name: '启用' },
|
|
|
+ { type: 1, name: '停用' }
|
|
|
+ ],
|
|
|
+ list: [],
|
|
|
+ total: 0,
|
|
|
+ listLoading: false,
|
|
|
+ listQuery: {
|
|
|
+ page: 1,
|
|
|
+ limit: 10,
|
|
|
+ supplierName: '',
|
|
|
+ supplierNum: '',
|
|
|
+ typeId: '',
|
|
|
+ responsibleDept: undefined,
|
|
|
+ isEnable: ''
|
|
|
+ },
|
|
|
+ dataForm: {
|
|
|
+ supplierName: undefined,
|
|
|
+ supplierNum: undefined,
|
|
|
+ typeId: undefined,
|
|
|
+ supplierPurchasAddress: undefined,
|
|
|
+ registeredCapital: undefined,
|
|
|
+ bankCardNo: undefined,
|
|
|
+ bankCardName: undefined,
|
|
|
+ nature: undefined,
|
|
|
+ taxrate: undefined,
|
|
|
+ supplierContact: undefined,
|
|
|
+ supplierPhone: undefined,
|
|
|
+ supplierAddress: undefined,
|
|
|
+ responsibleDept: undefined,
|
|
|
+ supplierRemark: undefined,
|
|
|
+ businessName: undefined,
|
|
|
+ businessStartTime: undefined,
|
|
|
+ businessEndTime: undefined,
|
|
|
+ businessFile: undefined,
|
|
|
+ businessFiles: [],
|
|
|
+ financeFileId: undefined,
|
|
|
+ financeFiles: [],
|
|
|
+ auditFileId: undefined,
|
|
|
+ auditFiles: [],
|
|
|
+ qualifiedName: undefined,
|
|
|
+ qualifiedStartTime: undefined,
|
|
|
+ qualifiedEndTime: undefined,
|
|
|
+ qualifiedFile: undefined,
|
|
|
+ qualifiedFiles: []
|
|
|
+ },
|
|
|
+ dialogFormVisible: false,
|
|
|
+ dialogStatus: '',
|
|
|
+ textMap: {
|
|
|
+ update: '编辑供应商',
|
|
|
+ create: '添加供应商'
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ supplierName: [{ required: true, message: '请填写供应商名称', trigger: 'blur' }],
|
|
|
+ typeId: [{ required: true, message: '请选择供应商类别', trigger: 'blur' }],
|
|
|
+ supplierPurchasAddress: [{ required: true, message: '请填写地域', trigger: 'blur' }],
|
|
|
+ registeredCapital: [
|
|
|
+ { required: true, message: '请填写注册资本金', trigger: 'blur' },
|
|
|
+ { pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,2})?$/, message: '请输入合法的金额数字,最多两位小数', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ bankCardNo: [{ required: true, message: '请填写银行卡号', trigger: 'blur' }],
|
|
|
+ bankCardName: [{ required: true, message: '请填写银行名称', trigger: 'blur' }],
|
|
|
+ nature: [{ required: true, message: '请选择纳税性质', trigger: 'blur' }],
|
|
|
+ taxrate: [{ required: true, message: '请选择税率', trigger: 'blur' }],
|
|
|
+ supplierContact: [{ required: true, message: '请填写联系人', trigger: 'blur' }],
|
|
|
+ supplierPhone: [{ required: true, message: '请填写联系电话', trigger: 'blur' }],
|
|
|
+ supplierAddress: [{ required: true, message: '请填写单位地址', trigger: 'blur' }],
|
|
|
+ responsibleDept: [{ required: true, message: '请选择申请部门', trigger: 'blur' }],
|
|
|
+ supplierRemark: [{ required: true, message: '请填写申请事由', trigger: 'blur' }],
|
|
|
+ businessName: [{ required: true, message: '请填写营业执照名称', trigger: 'blur' }],
|
|
|
+ businessStartTime: [{ required: true, message: '请选择开始日期', trigger: 'blur' }],
|
|
|
+ businessEndTime: [{ required: true, message: '请选择结束日期', trigger: 'blur' }],
|
|
|
+ businessFile: [{ required: true, message: '请上传营业执照', trigger: 'blur' }]
|
|
|
+ },
|
|
|
+ fileImgUrl: this.upLoadUrl
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getListDept()
|
|
|
+ this.getTypeList()
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleDownLoad() {
|
|
|
+ window.location.href = process.env.BASE_API + '/supplier-info/export'
|
|
|
+ },
|
|
|
+ changeState(id, isEnable) {
|
|
|
+ setStateSupplier({ id: id, isEnable: isEnable }).then(response => {
|
|
|
+ this.$notify({ title: '成功', message: '状态修改成功', type: 'success', duration: 2000 })
|
|
|
+ this.getList()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getListDept() {
|
|
|
+ listDept().then(response => {
|
|
|
+ this.categoryOptions = this.handleTree(response.data.data, 'deptId')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ normalizer(node) {
|
|
|
+ if (node.children && !node.children.length) {
|
|
|
+ delete node.children
|
|
|
+ }
|
|
|
+ return { id: node.deptId, label: node.deptName, children: node.children }
|
|
|
+ },
|
|
|
+ handleClick(tab, event) {
|
|
|
+ console.log(tab, event)
|
|
|
+ },
|
|
|
+ handleRemoveFile(file, fileList, type) {
|
|
|
+ if (type == 'financeFiles') {
|
|
|
+ const financeFiles = []
|
|
|
+ for (const i in fileList) {
|
|
|
+ const id = fileList[i].response.data.id
|
|
|
+ financeFiles.push(id)
|
|
|
+ }
|
|
|
+ this.dataForm.financeFileId = financeFiles.join(',')
|
|
|
+ } else {
|
|
|
+ const auditFiles = []
|
|
|
+ for (const i in fileList) {
|
|
|
+ const id = fileList[i].response.data.id
|
|
|
+ auditFiles.push(id)
|
|
|
+ }
|
|
|
+ this.dataForm.auditFileId = auditFiles.join(',')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeUploadFile(file) {
|
|
|
+ const size = file.size / 1024 / 1024
|
|
|
+ if (size > 10) {
|
|
|
+ this.$message.error('文件大小不能超过 10MB!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleFileSuccess(res, file, fileList, type) {
|
|
|
+ if (type == 'financeFiles') {
|
|
|
+ const financeFiles = []
|
|
|
+ for (const i in fileList) {
|
|
|
+ const response = fileList[i].response
|
|
|
+ if (response.errno && response.errno != '0') {
|
|
|
+ this.$message.error('该文件上传失败,已被移除,请重新上传!')
|
|
|
+ financeFiles.splice(i, 1)
|
|
|
+ } else {
|
|
|
+ const id = fileList[i].response.data.id
|
|
|
+ financeFiles.push(id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.dataForm.financeFileId = financeFiles.join(',')
|
|
|
+ } else {
|
|
|
+ const auditFiles = []
|
|
|
+ for (const i in fileList) {
|
|
|
+ const response = fileList[i].response
|
|
|
+ if (response.errno && response.errno != '0') {
|
|
|
+ this.$message.error('该文件上传失败,已被移除,请重新上传!')
|
|
|
+ auditFiles.splice(i, 1)
|
|
|
+ } else {
|
|
|
+ const id = fileList[i].response.data.id
|
|
|
+ auditFiles.push(id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.dataForm.auditFileId = auditFiles.join(',')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleRemoveImg(file, fileList, type) {
|
|
|
+ if (type == 'qualifiedFiles') {
|
|
|
+ const qualifiedFiles = []
|
|
|
+ for (const i in fileList) {
|
|
|
+ const id = fileList[i].response.data.id
|
|
|
+ qualifiedFiles.push(id)
|
|
|
+ }
|
|
|
+ this.dataForm.qualifiedFile = qualifiedFiles.join(',')
|
|
|
+ } else {
|
|
|
+ const businessFiles = []
|
|
|
+ for (const i in fileList) {
|
|
|
+ const id = fileList[i].response.data.id
|
|
|
+ businessFiles.push(id)
|
|
|
+ }
|
|
|
+ this.dataForm.businessFile = businessFiles.join(',')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeUploadImg(file) {
|
|
|
+ const isJPGs = file.type === 'image/jpeg'
|
|
|
+ console.log(isJPGs)
|
|
|
+ },
|
|
|
+ handleExceed(files, fileList) {
|
|
|
+ this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件!,共选择了 ${files.length + fileList.length} 个文件`)
|
|
|
+ },
|
|
|
+ handleImgSucess(res, file, fileList, type) {
|
|
|
+ if (type == 'qualifiedFiles') {
|
|
|
+ const qualifiedFiles = []
|
|
|
+ for (const i in fileList) {
|
|
|
+ const response = fileList[i].response
|
|
|
+ if (response.errno && response.errno != '0') {
|
|
|
+ this.$message.error('该图片上传失败,已被移除,请重新上传!')
|
|
|
+ fileList.splice(i, 1)
|
|
|
+ } else {
|
|
|
+ const id = fileList[i].response.data.id
|
|
|
+ qualifiedFiles.push(id)
|
|
|
+ }
|
|
|
}
|
|
|
+ this.dataForm.qualifiedFile = qualifiedFiles.join(',')
|
|
|
+ } else {
|
|
|
+ const businessFiles = []
|
|
|
+ for (const i in fileList) {
|
|
|
+ const response = fileList[i].response
|
|
|
+ if (response.errno && response.errno != '0') {
|
|
|
+ this.$message.error('该图片上传失败,已被移除,请重新上传!')
|
|
|
+ businessFiles.splice(i, 1)
|
|
|
+ } else {
|
|
|
+ const id = fileList[i].response.data.id
|
|
|
+ businessFiles.push(id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.dataForm.businessFile = businessFiles.join(',')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ resetForm() {
|
|
|
+ this.dataForm = {
|
|
|
+ supplierName: undefined,
|
|
|
+ supplierNum: undefined,
|
|
|
+ typeId: undefined,
|
|
|
+ supplierPurchasAddress: undefined,
|
|
|
+ registeredCapital: undefined,
|
|
|
+ bankCardNo: undefined,
|
|
|
+ bankCardName: undefined,
|
|
|
+ nature: undefined,
|
|
|
+ taxrate: undefined,
|
|
|
+ supplierContact: undefined,
|
|
|
+ supplierPhone: undefined,
|
|
|
+ supplierAddress: undefined,
|
|
|
+ responsibleDept: undefined,
|
|
|
+ supplierRemark: undefined,
|
|
|
+ businessName: undefined,
|
|
|
+ businessStartTime: undefined,
|
|
|
+ businessEndTime: undefined,
|
|
|
+ businessFile: undefined,
|
|
|
+ businessFiles: [],
|
|
|
+ financeFileId: undefined,
|
|
|
+ financeFiles: [],
|
|
|
+ auditFileId: undefined,
|
|
|
+ auditFiles: [],
|
|
|
+ qualifiedName: undefined,
|
|
|
+ qualifiedStartTime: undefined,
|
|
|
+ qualifiedEndTime: undefined,
|
|
|
+ qualifiedFile: undefined,
|
|
|
+ qualifiedFiles: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleAdd() {
|
|
|
+ this.activeName = 'first'
|
|
|
+ this.resetForm()
|
|
|
+ this.dialogFormVisible = true
|
|
|
+ this.dialogStatus = 'create'
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs['dataForm'].clearValidate()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ createData() {
|
|
|
+ this.$refs['dataForm'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ createSupplier(this.dataForm).then((response) => {
|
|
|
+ this.getList()
|
|
|
+ this.dialogFormVisible = false
|
|
|
+ this.$notify({ title: '成功', message: '创建成功', type: 'success', duration: 2000 })
|
|
|
+ this.reload()
|
|
|
+ }).catch(() => { })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.activeName = 'first'
|
|
|
+ this.dataForm = Object.assign({}, row)
|
|
|
+ if (this.dataForm.businessFiles) {
|
|
|
+ const files = this.dataForm.businessFiles
|
|
|
+ this.dataForm.businessFiles = []
|
|
|
+ for (const i in files) {
|
|
|
+ this.dataForm.businessFiles.push({
|
|
|
+ name: files[i].oldName,
|
|
|
+ url: files[i].url,
|
|
|
+ response: { error: '0', data: { url: files[i].url, id: files[i].id }}
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (this.dataForm.qualifiedFiles) {
|
|
|
+ const files = this.dataForm.qualifiedFiles
|
|
|
+ this.dataForm.qualifiedFiles = []
|
|
|
+ for (const i in files) {
|
|
|
+ this.dataForm.qualifiedFiles.push({
|
|
|
+ name: files[i].oldName,
|
|
|
+ url: files[i].url,
|
|
|
+ response: { error: '0', data: { url: files[i].url, id: files[i].id }}
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (this.dataForm.financeFiles) {
|
|
|
+ const files = this.dataForm.financeFiles
|
|
|
+ this.dataForm.financeFiles = []
|
|
|
+ for (const i in files) {
|
|
|
+ this.dataForm.financeFiles.push({
|
|
|
+ name: files[i].oldName,
|
|
|
+ url: files[i].url,
|
|
|
+ response: { error: '0', data: { url: files[i].url, id: files[i].id }}
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (this.dataForm.auditFiles) {
|
|
|
+ const files = this.dataForm.auditFiles
|
|
|
+ this.dataForm.auditFiles = []
|
|
|
+ for (const i in files) {
|
|
|
+ this.dataForm.auditFiles.push({
|
|
|
+ name: files[i].oldName,
|
|
|
+ url: files[i].url,
|
|
|
+ response: { error: '0', data: { url: files[i].url, id: files[i].id }}
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.dialogStatus = 'update'
|
|
|
+ this.dialogFormVisible = true
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs['dataForm'].clearValidate()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ updateData() {
|
|
|
+ this.$refs['dataForm'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ updateSupplier(this.dataForm).then(() => {
|
|
|
+ this.dialogFormVisible = false
|
|
|
+ this.$notify({ title: '成功', message: '更新成功', type: 'success', duration: 2000 })
|
|
|
+ this.getList()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleDelete(row) {
|
|
|
+ this.$confirm('确认删除吗?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
|
|
|
+ .then(() => {
|
|
|
+ deleteSupplier({ id: row.id }).then(response => {
|
|
|
+ this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
|
|
|
+ this.getList()
|
|
|
+ })
|
|
|
+ }).catch(() => { })
|
|
|
+ },
|
|
|
+ getTypeList() {
|
|
|
+ typeListSupplier().then(response => {
|
|
|
+ this.brandOptions = response.data.data.map((item) => {
|
|
|
+ return { value: item.typeId, label: item.typeName }
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.brandOptions = []
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getList() {
|
|
|
+ this.listLoading = true
|
|
|
+ listSupplier(this.listQuery).then(response => {
|
|
|
+ this.list = response.data.data.items
|
|
|
+ this.total = response.data.data.total
|
|
|
+ this.listLoading = false
|
|
|
+ }).catch(() => { })
|
|
|
+ },
|
|
|
+ handleQuery() {
|
|
|
+ this.listQuery.page = 1
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ resetQuery() {
|
|
|
+ this.listQuery = {
|
|
|
+ page: 1,
|
|
|
+ limit: 10,
|
|
|
+ supplierName: '',
|
|
|
+ supplierNum: '',
|
|
|
+ typeId: '',
|
|
|
+ responsibleDept: '',
|
|
|
+ isEnable: ''
|
|
|
+ }
|
|
|
+ this.handleQuery()
|
|
|
},
|
|
|
- created() {
|
|
|
- this.getListDept();
|
|
|
- this.getTypeList();
|
|
|
- this.getList();
|
|
|
+ handleSizeChange(val) {
|
|
|
+ this.listQuery.limit = val
|
|
|
+ this.getList()
|
|
|
},
|
|
|
- methods: {
|
|
|
- handleDownLoad() {
|
|
|
- window.location.href = process.env.BASE_API + '/supplier-info/export';
|
|
|
- },
|
|
|
- changeState(id, isEnable) {
|
|
|
- setStateSupplier({ id: id, isEnable: isEnable }).then(response => {
|
|
|
- this.$notify({ title: '成功', message: '状态修改成功', type: 'success', duration: 2000 });
|
|
|
- this.getList();
|
|
|
- });
|
|
|
- },
|
|
|
- getListDept() {
|
|
|
- listDept().then(response => {
|
|
|
- this.categoryOptions = this.handleTree(response.data.data, "deptId");
|
|
|
- });
|
|
|
- },
|
|
|
- normalizer(node) {
|
|
|
- if (node.children && !node.children.length) {
|
|
|
- delete node.children;
|
|
|
- }
|
|
|
- return { id: node.deptId, label: node.deptName, children: node.children };
|
|
|
- },
|
|
|
- handleClick(tab, event) {
|
|
|
- console.log(tab, event);
|
|
|
- },
|
|
|
- handleRemoveFile(file, fileList, type) {
|
|
|
- if (type == "financeFiles") {
|
|
|
- let financeFiles = [];
|
|
|
- for (let i in fileList) {
|
|
|
- let id = fileList[i].response.data.id;
|
|
|
- financeFiles.push(id);
|
|
|
- }
|
|
|
- this.dataForm.financeFileId = financeFiles.join(",");
|
|
|
- } else {
|
|
|
- let auditFiles = [];
|
|
|
- for (let i in fileList) {
|
|
|
- let id = fileList[i].response.data.id;
|
|
|
- auditFiles.push(id);
|
|
|
- }
|
|
|
- this.dataForm.auditFileId = auditFiles.join(",");
|
|
|
- }
|
|
|
- },
|
|
|
- beforeUploadFile(file) {
|
|
|
- const size = file.size / 1024 / 1024;
|
|
|
- if (size > 10) {
|
|
|
- this.$message.error("文件大小不能超过 10MB!");
|
|
|
- return false;
|
|
|
- }
|
|
|
- },
|
|
|
- handleFileSuccess(res, file, fileList, type) {
|
|
|
- if (type == "financeFiles") {
|
|
|
- let financeFiles = [];
|
|
|
- for (let i in fileList) {
|
|
|
- let response = fileList[i].response;
|
|
|
- if (response.errno && response.errno != "0") {
|
|
|
- this.$message.error("该文件上传失败,已被移除,请重新上传!");
|
|
|
- financeFiles.splice(i, 1);
|
|
|
- } else {
|
|
|
- let id = fileList[i].response.data.id;
|
|
|
- financeFiles.push(id);
|
|
|
- }
|
|
|
- }
|
|
|
- this.dataForm.financeFileId = financeFiles.join(",");
|
|
|
- } else {
|
|
|
- let auditFiles = [];
|
|
|
- for (let i in fileList) {
|
|
|
- let response = fileList[i].response;
|
|
|
- if (response.errno && response.errno != "0") {
|
|
|
- this.$message.error("该文件上传失败,已被移除,请重新上传!");
|
|
|
- auditFiles.splice(i, 1);
|
|
|
- } else {
|
|
|
- let id = fileList[i].response.data.id;
|
|
|
- auditFiles.push(id);
|
|
|
- }
|
|
|
- }
|
|
|
- this.dataForm.auditFileId = auditFiles.join(",");
|
|
|
- }
|
|
|
- },
|
|
|
- handleRemoveImg(file, fileList, type) {
|
|
|
- if (type == "qualifiedFiles") {
|
|
|
- let qualifiedFiles = [];
|
|
|
- for (let i in fileList) {
|
|
|
- let id = fileList[i].response.data.id;
|
|
|
- qualifiedFiles.push(id);
|
|
|
- }
|
|
|
- this.dataForm.qualifiedFile = qualifiedFiles.join(",");
|
|
|
- } else {
|
|
|
- let businessFiles = [];
|
|
|
- for (let i in fileList) {
|
|
|
- let id = fileList[i].response.data.id;
|
|
|
- businessFiles.push(id);
|
|
|
- }
|
|
|
- this.dataForm.businessFile = businessFiles.join(",");
|
|
|
- }
|
|
|
- },
|
|
|
- beforeUploadImg(file) {
|
|
|
- const isJPGs = file.type === "image/jpeg";
|
|
|
- console.log(isJPGs);
|
|
|
- },
|
|
|
- handleExceed(files, fileList) {
|
|
|
- this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件!,共选择了 ${files.length + fileList.length} 个文件`);
|
|
|
- },
|
|
|
- handleImgSucess(res, file, fileList, type) {
|
|
|
- if (type == "qualifiedFiles") {
|
|
|
- let qualifiedFiles = [];
|
|
|
- for (let i in fileList) {
|
|
|
- let response = fileList[i].response;
|
|
|
- if (response.errno && response.errno != "0") {
|
|
|
- this.$message.error("该图片上传失败,已被移除,请重新上传!");
|
|
|
- fileList.splice(i, 1);
|
|
|
- } else {
|
|
|
- let id = fileList[i].response.data.id;
|
|
|
- qualifiedFiles.push(id);
|
|
|
- }
|
|
|
- }
|
|
|
- this.dataForm.qualifiedFile = qualifiedFiles.join(",");
|
|
|
- } else {
|
|
|
- let businessFiles = [];
|
|
|
- for (let i in fileList) {
|
|
|
- let response = fileList[i].response;
|
|
|
- if (response.errno && response.errno != "0") {
|
|
|
- this.$message.error("该图片上传失败,已被移除,请重新上传!");
|
|
|
- businessFiles.splice(i, 1);
|
|
|
- } else {
|
|
|
- let id = fileList[i].response.data.id;
|
|
|
- businessFiles.push(id);
|
|
|
- }
|
|
|
- }
|
|
|
- this.dataForm.businessFile = businessFiles.join(",");
|
|
|
- }
|
|
|
- },
|
|
|
- resetForm() {
|
|
|
- this.dataForm = {
|
|
|
- supplierName: undefined,
|
|
|
- supplierNum: undefined,
|
|
|
- typeId: undefined,
|
|
|
- supplierPurchasAddress: undefined,
|
|
|
- registeredCapital: undefined,
|
|
|
- bankCardNo: undefined,
|
|
|
- bankCardName: undefined,
|
|
|
- nature: undefined,
|
|
|
- taxrate: undefined,
|
|
|
- supplierContact: undefined,
|
|
|
- supplierPhone: undefined,
|
|
|
- supplierAddress: undefined,
|
|
|
- responsibleDept: undefined,
|
|
|
- supplierRemark: undefined,
|
|
|
- businessName: undefined,
|
|
|
- businessStartTime: undefined,
|
|
|
- businessEndTime: undefined,
|
|
|
- businessFile: undefined,
|
|
|
- businessFiles: [],
|
|
|
- financeFileId: undefined,
|
|
|
- financeFiles: [],
|
|
|
- auditFileId: undefined,
|
|
|
- auditFiles: [],
|
|
|
- qualifiedName: undefined,
|
|
|
- qualifiedStartTime: undefined,
|
|
|
- qualifiedEndTime: undefined,
|
|
|
- qualifiedFile: undefined,
|
|
|
- qualifiedFiles: [],
|
|
|
- };
|
|
|
- },
|
|
|
- handleAdd() {
|
|
|
- this.activeName = 'first';
|
|
|
- this.resetForm();
|
|
|
- this.dialogFormVisible = true;
|
|
|
- this.dialogStatus = "create";
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs["dataForm"].clearValidate();
|
|
|
- });
|
|
|
- },
|
|
|
- createData() {
|
|
|
- this.$refs["dataForm"].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- createSupplier(this.dataForm).then((response) => {
|
|
|
- this.getList();
|
|
|
- this.dialogFormVisible = false;
|
|
|
- this.$notify({ title: "成功", message: "创建成功", type: "success", duration: 2000 });
|
|
|
- this.reload();
|
|
|
- }).catch(() => { });
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- handleUpdate(row) {
|
|
|
- this.activeName = 'first';
|
|
|
- this.dataForm = Object.assign({}, row);
|
|
|
- if (this.dataForm.businessFiles) {
|
|
|
- let files = this.dataForm.businessFiles;
|
|
|
- this.dataForm.businessFiles = [];
|
|
|
- for (let i in files) {
|
|
|
- this.dataForm.businessFiles.push({
|
|
|
- name: files[i].oldName,
|
|
|
- url: files[i].url,
|
|
|
- response: { error: "0", data: { url: files[i].url, id: files[i].id } },
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- if (this.dataForm.qualifiedFiles) {
|
|
|
- let files = this.dataForm.qualifiedFiles;
|
|
|
- this.dataForm.qualifiedFiles = [];
|
|
|
- for (let i in files) {
|
|
|
- this.dataForm.qualifiedFiles.push({
|
|
|
- name: files[i].oldName,
|
|
|
- url: files[i].url,
|
|
|
- response: { error: "0", data: { url: files[i].url, id: files[i].id } },
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- if (this.dataForm.financeFiles) {
|
|
|
- let files = this.dataForm.financeFiles;
|
|
|
- this.dataForm.financeFiles = [];
|
|
|
- for (let i in files) {
|
|
|
- this.dataForm.financeFiles.push({
|
|
|
- name: files[i].oldName,
|
|
|
- url: files[i].url,
|
|
|
- response: { error: "0", data: { url: files[i].url, id: files[i].id } },
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- if (this.dataForm.auditFiles) {
|
|
|
- let files = this.dataForm.auditFiles;
|
|
|
- this.dataForm.auditFiles = [];
|
|
|
- for (let i in files) {
|
|
|
- this.dataForm.auditFiles.push({
|
|
|
- name: files[i].oldName,
|
|
|
- url: files[i].url,
|
|
|
- response: { error: "0", data: { url: files[i].url, id: files[i].id } },
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- this.dialogStatus = 'update';
|
|
|
- this.dialogFormVisible = true;
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs['dataForm'].clearValidate();
|
|
|
- });
|
|
|
- },
|
|
|
- updateData() {
|
|
|
- this.$refs['dataForm'].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- updateSupplier(this.dataForm).then(() => {
|
|
|
- this.dialogFormVisible = false;
|
|
|
- this.$notify({ title: '成功', message: '更新成功', type: 'success', duration: 2000 });
|
|
|
- this.getList();
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- handleDelete(row) {
|
|
|
- this.$confirm('确认删除吗?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
|
|
|
- .then(() => {
|
|
|
- deleteSupplier({ id: row.id }).then(response => {
|
|
|
- this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 });
|
|
|
- this.getList();
|
|
|
- });
|
|
|
- }).catch(() => { });
|
|
|
- },
|
|
|
- getTypeList() {
|
|
|
- typeListSupplier().then(response => {
|
|
|
- this.brandOptions = response.data.data.map((item) => {
|
|
|
- return { value: item.typeId, label: item.typeName };
|
|
|
- });
|
|
|
- }).catch(() => {
|
|
|
- this.brandOptions = [];
|
|
|
- });
|
|
|
- },
|
|
|
- getList() {
|
|
|
- this.listLoading = true;
|
|
|
- listSupplier(this.listQuery).then(response => {
|
|
|
- this.list = response.data.data.items;
|
|
|
- this.total = response.data.data.total;
|
|
|
- this.listLoading = false;
|
|
|
- }).catch(() => { });
|
|
|
- },
|
|
|
- handleQuery() {
|
|
|
- this.listQuery.page = 1;
|
|
|
- this.getList();
|
|
|
- },
|
|
|
- resetQuery() {
|
|
|
- this.listQuery = {
|
|
|
- page: 1,
|
|
|
- limit: 10,
|
|
|
- supplierName: '',
|
|
|
- supplierNum: '',
|
|
|
- typeId: '',
|
|
|
- responsibleDept: '',
|
|
|
- isEnable: '',
|
|
|
- };
|
|
|
- this.handleQuery();
|
|
|
- },
|
|
|
- handleSizeChange(val) {
|
|
|
- this.listQuery.limit = val;
|
|
|
- this.getList();
|
|
|
- },
|
|
|
- handleCurrentChange(val) {
|
|
|
- this.listQuery.page = val;
|
|
|
- this.getList();
|
|
|
- },
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ this.listQuery.page = val
|
|
|
+ this.getList()
|
|
|
}
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|