|
|
@@ -0,0 +1,288 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <el-table :data="manufacturerList" border size="mini">
|
|
|
+ <el-table-column label="操作" width="150" align="center" fixed>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="primary" plain size="mini" title="编辑" @click="openDialog(scope.row)" :disabled="!canadd">
|
|
|
+ 编辑</el-button>
|
|
|
+ <el-button type="primary" plain size="mini" title="删除" style="margin-left:3px" @click="deletedata(scope.row)"
|
|
|
+ :disabled="!canadd">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="AgentName" label="代理商名称" show-overflow-tooltip></el-table-column>
|
|
|
+
|
|
|
+ <el-table-column prop="FileUrl" label="资质文件" show-overflow-tooltip>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-link :href="scope.row.FileUrl" target="_blank" type="primary">
|
|
|
+ {{scope.row.FileUrl}}
|
|
|
+ </el-link>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column prop="Remark" label="备注" show-overflow-tooltip></el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
|
|
|
+ :page-sizes="[10, 15, 20, 25]" :page-size="size" layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ :total="currentItemCount">
|
|
|
+ </el-pagination>
|
|
|
+
|
|
|
+ <el-dialog :title="Title" :visible.sync="visible">
|
|
|
+ <el-form ref="refPerformance" :model="ManufacturerForm" label-width="110px" :rules="rulesform">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="代理商名称" prop="AgentName">
|
|
|
+ <el-input v-model="ManufacturerForm.AgentName"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="备注信息">
|
|
|
+ <el-input v-model="ManufacturerForm.Remark" type="textarea" :rows=3 placeholder="请输入备注信息"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="资质文件">
|
|
|
+ <el-upload action=""
|
|
|
+ :manufacturerlist="manufacturerList"
|
|
|
+ ref="refuploadattach"
|
|
|
+ :http-request="uploadrequest"
|
|
|
+ class="attach-uploader">
|
|
|
+ <i class="el-icon-plus attach-uploader-icon"></i>
|
|
|
+ </el-upload>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer" style="margin-top:-30px;">
|
|
|
+ <el-button @click="visible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="savedata()">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import axios from 'axios'
|
|
|
+ import uploadajax from '@/assets/js/uploadajax.js'
|
|
|
+ import {
|
|
|
+ mapGetters
|
|
|
+ } from 'vuex'
|
|
|
+ export default {
|
|
|
+ name: 'ManufacturerList',
|
|
|
+ props: {
|
|
|
+ canadd: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ },
|
|
|
+ visible: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters({
|
|
|
+ session: 'session'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ // visible: false,
|
|
|
+ SupplierCertId: '0',
|
|
|
+ manufacturerList: [],
|
|
|
+ manufacturer:[],
|
|
|
+ Title: '',
|
|
|
+ ManufacturerForm:{
|
|
|
+ Id: '',
|
|
|
+ AgentName:'',
|
|
|
+ Remark: '',
|
|
|
+ FileUrl: '',
|
|
|
+ SupplierCertId: '',
|
|
|
+ },
|
|
|
+ currentPage: 1, // 分页
|
|
|
+ size: 10,
|
|
|
+ currentItemCount: 0,
|
|
|
+ rulesform: {
|
|
|
+ AgentName: [{
|
|
|
+ required: true,
|
|
|
+ message: '请输入代理商名称',
|
|
|
+ trigger: 'change'
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+
|
|
|
+ getvalue (certId ) {
|
|
|
+ this.SupplierCertId = certId
|
|
|
+ this.initData()
|
|
|
+ },
|
|
|
+ initData () {
|
|
|
+ let _this = this
|
|
|
+ const params = {
|
|
|
+ SupplierCertId: this.SupplierCertId,
|
|
|
+ _currentPage: this.currentPage,
|
|
|
+ _size: this.size
|
|
|
+ }
|
|
|
+ this.$axios.get('manufacturer/manufacturerlist', {params})
|
|
|
+ .then(res => {
|
|
|
+ _this.manufacturerList = res.data.items
|
|
|
+ _this.currentItemCount = res.data.currentItemCount
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ savedata () {
|
|
|
+ this.$refs['refPerformance'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ if (!this.ManufacturerForm.FileUrl) {
|
|
|
+ this.$message.error('有附件未成功上传!不能保存数据')
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (!this.ManufacturerForm.Id) {
|
|
|
+ this.addManufacturer()
|
|
|
+ } else {
|
|
|
+ this.editManufacturer()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ addManufacturer () {
|
|
|
+ let _this = this
|
|
|
+ _this.ManufacturerForm.SupplierCertId = parseInt(_this.ManufacturerForm.SupplierCertId)
|
|
|
+ _this.$axios.post('/manufacturer/addmanufacturer/', _this.ManufacturerForm)
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ _this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ this.visible = false
|
|
|
+ this.initData()
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ editManufacturer () {
|
|
|
+ let _this = this
|
|
|
+ _this.ManufacturerForm.SupplierCertId = parseInt(_this.ManufacturerForm.SupplierCertId)
|
|
|
+ _this.$axios.put('/manufacturer/editmanufacturer/' + _this.ManufacturerForm.Id, _this.ManufacturerForm)
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ _this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ this.visible = false
|
|
|
+ this.initData()
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ deletedata (val) {
|
|
|
+ let _this = this
|
|
|
+ _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ _this.$axios.delete('manufacturer/manufacturerdelete/' + val.Id, {})
|
|
|
+ .then(function (response) {
|
|
|
+ // response
|
|
|
+ if (response.data.code === 0) {
|
|
|
+ _this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: response.data.message
|
|
|
+ })
|
|
|
+ _this.initData()
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: response.data.message
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(function (error) {
|
|
|
+ console.log(error)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+ },
|
|
|
+
|
|
|
+ uploadrequest (option) {
|
|
|
+ let _this = this
|
|
|
+ if (process.client) {
|
|
|
+ const myDomain = window.location.host
|
|
|
+ axios.post(process.env.upfilehost, {})
|
|
|
+ .then(function (res) {
|
|
|
+ if (res.data && res.data.fid && res.data.fid !== '') {
|
|
|
+ if (res.data.publicUrl.indexOf('/upfile') === 0) {
|
|
|
+ option.action = `http://${myDomain}/${res.data.publicUrl}/${res.data.fid}`
|
|
|
+ } else {
|
|
|
+ option.action = `http://${res.data.publicUrl}/${res.data.fid}`
|
|
|
+ }
|
|
|
+ _this.ManufacturerForm.FileUrl = res.data.publicUrl + '/' + res.data.fid
|
|
|
+ uploadajax(option)
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '未上传成功!请刷新界面重新上传!'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ showDialog () {
|
|
|
+ this.Title = '代理制造商'
|
|
|
+ this.ManufacturerForm.SupplierCertId=this.SupplierCertId
|
|
|
+ this.ManufacturerForm.Id = 0
|
|
|
+ this.ManufacturerForm.AgentName=''
|
|
|
+ this.ManufacturerForm.Remark = ''
|
|
|
+ this.visible = true
|
|
|
+ },
|
|
|
+ openDialog (val) {
|
|
|
+ this.Title = '编辑代理制造商'
|
|
|
+ this.ManufacturerForm.SupplierCertId=val.SupplierCertId
|
|
|
+ this.ManufacturerForm.Id = val.Id
|
|
|
+ this.ManufacturerForm.AgentName=val.AgentName
|
|
|
+ this.ManufacturerForm.Remark = val.Remark
|
|
|
+ this.visible = true
|
|
|
+ },
|
|
|
+
|
|
|
+ handleSizeChange (value) {
|
|
|
+ this.size = value
|
|
|
+ this.currentPage = 1
|
|
|
+ this.initData()
|
|
|
+ },
|
|
|
+ handleCurrentChange (value) {
|
|
|
+ this.currentPage = value
|
|
|
+ this.initData()
|
|
|
+ },
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style>
|
|
|
+
|
|
|
+
|
|
|
+</style>
|