|
|
@@ -8,9 +8,15 @@
|
|
|
@click="deletedata(scope.row)"></el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="Code" label="分类编码" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="Name" label="分类名称" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="Remark" label="备注" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="NeedFileType" label="文件分类" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="NeedFileCode" label="分类编码" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="EffectDate" label="有效日期" show-overflow-tooltip>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ jstimehandle(scope.row.EffectDate+'') }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="OtherRemark" label="其他信息" show-overflow-tooltip></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"
|
|
|
@@ -18,22 +24,62 @@
|
|
|
</el-pagination>
|
|
|
|
|
|
<el-dialog :title="Title" :visible.sync="visible" top="5vh">
|
|
|
- <el-form :model="BusinessForm" label-width="100px">
|
|
|
+ <el-form :model="SubfileForm" label-width="100px">
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="名称" required>
|
|
|
- <el-cascader :options="techTreeList" :props="orgtreeprops" change-on-select :show-all-levels="false"
|
|
|
- v-model="selectedorg" placeholder="请选择菜单" @change="getCode()"></el-cascader>
|
|
|
+ <el-form-item label="文件分类" required>
|
|
|
+ <el-select ref="refSupplierCertSub" v-model="SubfileForm.SupplierCertSubId" style="width:100%"
|
|
|
+ placeholder="请选择文件分类" @change="getCode()">
|
|
|
+ <el-option v-for="item in businessList" :label="item.Name" :value="item.Id" :key="item.Code">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="编码" required>
|
|
|
- <el-input v-model="BusinessForm.Code" placeholder="请输入编码"></el-input>
|
|
|
+ <el-form-item label="分类编码" required>
|
|
|
+ <el-input v-model="SubfileForm.NeedFileCode" placeholder="请输入编码"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="有效日期" required>
|
|
|
+ <el-date-picker style="width: 100%" v-model="SubfileForm.EffectDate" type="date" placeholder="请选择有效日期">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="其他信息">
|
|
|
+ <el-input v-model="SubfileForm.OtherRemark" type="textarea" :rows=3 placeholder="请输入备注信息"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="备注信息">
|
|
|
- <el-input v-model="BusinessForm.Remark" type="textarea" :rows=3 placeholder="请输入备注信息"></el-input>
|
|
|
+ <el-input v-model="SubfileForm.Remark" type="textarea" :rows=3 placeholder="请输入备注信息"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="文档上传">
|
|
|
+ <el-upload style="margin-top: 10px;" multiple action="" :limit="1" ref="refuploadattach"
|
|
|
+ :http-request="uploadrequest" class="attach-uploader" :show-file-list="true"
|
|
|
+ :before-upload="beforeAvatarUpload">
|
|
|
+ <i class="el-icon-plus attach-uploader-icon"></i>
|
|
|
+ </el-upload>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item class="maintainlog" label="" label-width="120px">
|
|
|
+ <div style="overflow: auto;">
|
|
|
+ <template>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24" v-for="(v,K) in doclist" :key="v">
|
|
|
+ <span>
|
|
|
+ <el-button size="small" type="text" icon="el-icon-delete" title="删除" @click="deletefile(K)">
|
|
|
+ </el-button>
|
|
|
+ </span>
|
|
|
+ <a style="margin-left:10px" @click="clickachment(v.url)">{{ v.name }}</a>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
@@ -51,25 +97,22 @@
|
|
|
import {
|
|
|
mapGetters
|
|
|
} from 'vuex'
|
|
|
+ import axios from 'axios'
|
|
|
+ import uploadajax from '../../assets/js/uploadajax.js'
|
|
|
export default {
|
|
|
- name: 'EquipmentList',
|
|
|
+ name: 'SubfileList',
|
|
|
props: {
|
|
|
- SupplierCertId: {
|
|
|
+ SupplierCertSubId: {
|
|
|
type: String,
|
|
|
default: '0'
|
|
|
},
|
|
|
- SupplierId: {
|
|
|
- type: String,
|
|
|
- default: '0'
|
|
|
+ businessList: {
|
|
|
+ type: Array,
|
|
|
+ default: []
|
|
|
},
|
|
|
- SubClassId: {
|
|
|
- type: String,
|
|
|
- default: '0'
|
|
|
- }
|
|
|
},
|
|
|
created() {
|
|
|
this.initData()
|
|
|
- this.getbusiness()
|
|
|
},
|
|
|
computed: {
|
|
|
...mapGetters({
|
|
|
@@ -89,13 +132,17 @@
|
|
|
selectedorg: [],
|
|
|
|
|
|
Title: '',
|
|
|
- BusinessForm: {
|
|
|
+ SubfileForm: {
|
|
|
Id: '',
|
|
|
- SupplierId: '',
|
|
|
- SupplierCertId: '',
|
|
|
- SubClassId: '',
|
|
|
- Code: '',
|
|
|
- Name: '',
|
|
|
+ AppendClassId: '',
|
|
|
+ SupplierCertSubId: '',
|
|
|
+ NeedFileType: '',
|
|
|
+ NeedFileCode: '',
|
|
|
+ FileExt: '',
|
|
|
+ FileSize: '',
|
|
|
+ EffectDate: new Date(),
|
|
|
+ FileUrl: '',
|
|
|
+ OtherRemark: '',
|
|
|
Remark: '',
|
|
|
IsDelete: 0
|
|
|
},
|
|
|
@@ -104,18 +151,20 @@
|
|
|
currentPage: 1, // 分页
|
|
|
size: 10,
|
|
|
currentItemCount: 0,
|
|
|
+
|
|
|
+ waituploads: [], // 等待上传的附件列表
|
|
|
+ doclist: [],
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
initData() {
|
|
|
let _this = this
|
|
|
const params = {
|
|
|
- SupplierCertId: this.SupplierCertId,
|
|
|
- SubClassId: this.SubClassId,
|
|
|
+ SupplierCertSubId: this.SupplierCertSubId,
|
|
|
_currentPage: this.currentPage,
|
|
|
_size: this.size,
|
|
|
}
|
|
|
- this.$axios.get('suppliercertsub/list', {
|
|
|
+ this.$axios.get('supplierfile/filelist', {
|
|
|
params
|
|
|
})
|
|
|
.then(res => {
|
|
|
@@ -127,39 +176,35 @@
|
|
|
console.error(err)
|
|
|
})
|
|
|
},
|
|
|
- getbusiness() {
|
|
|
- let _this = this
|
|
|
- this.$axios.get('technologyservice/businesslist', {})
|
|
|
- .then(res => {
|
|
|
- _this.techList = res.data.items
|
|
|
- _this.techTreeList = window.toolfun_gettreejson(res.data.items, 'Id', 'ParentId', 'Id,Name')
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- // handle error
|
|
|
- console.error(err)
|
|
|
- })
|
|
|
- },
|
|
|
getCode() {
|
|
|
- for (var i = 0; i < this.techList.length; i++) {
|
|
|
- if (this.selectedorg[this.selectedorg.length - 1] == this.techList[i].Id) {
|
|
|
- this.BusinessForm.Name = this.techList[i].Name
|
|
|
- this.BusinessForm.Code = this.techList[i].Code
|
|
|
+ if (this.businessList && this.businessList.length > 0) {
|
|
|
+ for (var i = 0; i < this.businessList.length; i++) {
|
|
|
+ if (this.SubfileForm.SupplierCertSubId == this.businessList[i].Id) {
|
|
|
+ this.SubfileForm.NeedFileType = this.businessList[i].Name
|
|
|
+ this.SubfileForm.NeedFileCode = this.businessList[i].Code
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
savedata() {
|
|
|
- if (this.Title == '新增准入范围') {
|
|
|
- this.addBusiness()
|
|
|
- } else if (this.Title == '编辑准入范围') {
|
|
|
- this.editBusiness()
|
|
|
+ if (this.$refs.refuploadattach.uploadFiles && this.$refs.refuploadattach.uploadFiles.length > 0) {
|
|
|
+ // 上传附件是否完成判断
|
|
|
+ if (!this.attachissuccess()) {
|
|
|
+ this.$message.error('有附件未成功上传!不能保存数据')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.getattachissuccess()
|
|
|
+ if (this.Title == '新增文件') {
|
|
|
+ this.addSubfile()
|
|
|
+ } else if (this.Title == '编辑文件') {
|
|
|
+ this.editSubfile()
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
- addBusiness() {
|
|
|
+ addSubfile() {
|
|
|
let _this = this
|
|
|
- _this.BusinessForm.SupplierId = parseInt(_this.BusinessForm.SupplierId)
|
|
|
- _this.BusinessForm.SupplierCertId = parseInt(_this.BusinessForm.SupplierCertId)
|
|
|
- _this.BusinessForm.SubClassId = parseInt(_this.BusinessForm.SubClassId)
|
|
|
- _this.$axios.post('/suppliercertsub/addbusiness/', _this.BusinessForm)
|
|
|
+ _this.SubfileForm.AppendClassId = parseInt(_this.SubfileForm.AppendClassId)
|
|
|
+ _this.$axios.post('/supplierfile/addsubfile/', _this.SubfileForm)
|
|
|
.then(res => {
|
|
|
if (res.data.code === 0) {
|
|
|
_this.$message({
|
|
|
@@ -179,12 +224,10 @@
|
|
|
console.error(err)
|
|
|
})
|
|
|
},
|
|
|
- editBusiness() {
|
|
|
+ editSubfile() {
|
|
|
let _this = this
|
|
|
- _this.BusinessForm.SupplierId = parseInt(_this.BusinessForm.SupplierId)
|
|
|
- _this.BusinessForm.SupplierCertId = parseInt(_this.BusinessForm.SupplierCertId)
|
|
|
- _this.BusinessForm.SubClassId = parseInt(_this.BusinessForm.SubClassId)
|
|
|
- _this.$axios.put('/suppliercertsub/editbusiness/' + _this.BusinessForm.Id, _this.BusinessForm)
|
|
|
+ _this.SubfileForm.AppendClassId = parseInt(_this.SubfileForm.AppendClassId)
|
|
|
+ _this.$axios.put('/supplierfile/editsubfile/' + _this.SubfileForm.Id, _this.SubfileForm)
|
|
|
.then(res => {
|
|
|
if (res.data.code === 0) {
|
|
|
_this.$message({
|
|
|
@@ -212,7 +255,7 @@
|
|
|
type: "warning"
|
|
|
})
|
|
|
.then(() => {
|
|
|
- _this.$axios.delete('suppliercertsub/businessdelete/' + val.Id, {})
|
|
|
+ _this.$axios.delete('supplierfile/subfiledelete/' + val.Id, {})
|
|
|
.then(function (response) {
|
|
|
// response
|
|
|
if (response.data.code === 0) {
|
|
|
@@ -235,28 +278,128 @@
|
|
|
.catch(() => {});
|
|
|
},
|
|
|
showDialog() {
|
|
|
- this.Title = '新增准入范围'
|
|
|
- this.BusinessForm.SupplierId = this.SupplierId
|
|
|
- this.BusinessForm.SupplierCertId = this.SupplierCertId
|
|
|
- this.BusinessForm.SubClassId = this.SubClassId
|
|
|
- this.BusinessForm.Code = ''
|
|
|
- this.BusinessForm.Name = ''
|
|
|
- this.BusinessForm.Remark = ''
|
|
|
- this.BusinessForm.IsDelete = 0
|
|
|
+ this.Title = '新增文件'
|
|
|
+ this.SubfileForm.Id = ''
|
|
|
+ this.SubfileForm.AppendClassId = ''
|
|
|
+ this.SubfileForm.SupplierCertSubId = ''
|
|
|
+ this.SubfileForm.NeedFileType = ''
|
|
|
+ this.SubfileForm.NeedFileCode = ''
|
|
|
+ this.SubfileForm.FileExt = ''
|
|
|
+ this.SubfileForm.FileSize = ''
|
|
|
+ this.SubfileForm.EffectDate = new Date()
|
|
|
+ this.SubfileForm.FileUrl = ''
|
|
|
+ this.SubfileForm.OtherRemark = ''
|
|
|
+ this.SubfileForm.Remark = ''
|
|
|
+ this.SubfileForm.IsDelete = 0
|
|
|
this.visible = true
|
|
|
},
|
|
|
openDialog(val) {
|
|
|
- this.Title = '编辑准入范围'
|
|
|
- this.BusinessForm.Id = val.Id
|
|
|
- this.BusinessForm.SupplierId = val.SupplierId
|
|
|
- this.BusinessForm.SupplierCertId = val.SupplierCertId
|
|
|
- this.BusinessForm.SubClassId = val.SubClassId
|
|
|
- this.BusinessForm.Code = val.Code
|
|
|
- this.BusinessForm.Name = val.Name
|
|
|
- this.BusinessForm.Remark = val.Remark
|
|
|
- this.BusinessForm.IsDelete = val.IsDelete
|
|
|
+ this.Title = '编辑文件'
|
|
|
+ this.SubfileForm.Id = val.Id
|
|
|
+ this.SubfileForm.AppendClassId = val.AppendClassId
|
|
|
+ this.SubfileForm.SupplierCertSubId = val.SupplierCertSubId
|
|
|
+ this.SubfileForm.NeedFileType = val.NeedFileType
|
|
|
+ this.SubfileForm.NeedFileCode = val.NeedFileCode
|
|
|
+ this.SubfileForm.FileExt = val.FileExt
|
|
|
+ this.SubfileForm.FileSize = val.FileSize
|
|
|
+ this.SubfileForm.EffectDate = new Date(val.EffectDate)
|
|
|
+ this.SubfileForm.OtherRemark = val.OtherRemark
|
|
|
+ if (val.FileUrl != '') {
|
|
|
+ this.getwendanginfo(val.FileUrl)
|
|
|
+ }
|
|
|
+ this.SubfileForm.Remark = val.Remark
|
|
|
+ this.SubfileForm.IsDelete = val.IsDelete
|
|
|
this.visible = true
|
|
|
},
|
|
|
+ //文档列表
|
|
|
+ getwendanginfo(iUrl) {
|
|
|
+ let _this = this
|
|
|
+ _this.doclist = []
|
|
|
+ let exArr = iUrl.split('|')
|
|
|
+ let params = {
|
|
|
+ name: exArr[1],
|
|
|
+ url: exArr[0]
|
|
|
+ }
|
|
|
+ _this.doclist.push(params)
|
|
|
+ },
|
|
|
+
|
|
|
+ beforeAvatarUpload(file) {
|
|
|
+ let isLt50m = file.size / 1024 / 1024 / 50 < 1
|
|
|
+ if (!isLt50m) {
|
|
|
+ this.$message.error('上传文件大小不能超过 50MB!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ },
|
|
|
+ uploadrequest(option) {
|
|
|
+ let _this = this
|
|
|
+ axios.post(process.env.upfilehost, {})
|
|
|
+ .then(function (res) {
|
|
|
+ if (res.data && res.data.fid && res.data.fid !== '') {
|
|
|
+ option.action = `http://${res.data.url}/${res.data.fid}`
|
|
|
+ _this.waituploads.push({
|
|
|
+ uid: option.file.uid,
|
|
|
+ url: res.data.publicUrl,
|
|
|
+ fid: res.data.fid
|
|
|
+ })
|
|
|
+ uploadajax(option)
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '未上传成功!请刷新界面重新上传!'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(function (error) {
|
|
|
+ console.log(error)
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '未上传成功!请重新上传!'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 判断附件是否上传成功
|
|
|
+ attachissuccess() {
|
|
|
+ if (this.$refs.refuploadattach.uploadFiles && this.$refs.refuploadattach.uploadFiles.length > 0) {
|
|
|
+ for (let i = 0; i < this.$refs.refuploadattach.uploadFiles.length; i++) {
|
|
|
+ if (this.$refs.refuploadattach.uploadFiles[i].status !== 'success') {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ },
|
|
|
+ getattachissuccess() {
|
|
|
+ this.SubfileForm.FileUrl = ''
|
|
|
+ if (this.$refs.refuploadattach.uploadFiles && this.$refs.refuploadattach.uploadFiles.length > 0) {
|
|
|
+ for (let i = 0; i < this.$refs.refuploadattach.uploadFiles.length; i++) {
|
|
|
+ if (this.$refs.refuploadattach.uploadFiles[i].status === 'success') {
|
|
|
+ for (let j = 0; j < this.waituploads.length; j++) {
|
|
|
+ if (this.waituploads[j].uid === this.$refs.refuploadattach.uploadFiles[i].uid) {
|
|
|
+ this.SubfileForm.FileUrl =
|
|
|
+ `${this.waituploads[j].url}/${this.waituploads[j].fid}|${this.$refs.refuploadattach.uploadFiles[i].name}`
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ clickachment(url, uid) {
|
|
|
+ window.open(`http://${url}`)
|
|
|
+ },
|
|
|
+ deletefile() {
|
|
|
+ let _this = this
|
|
|
+ _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ _this.doclist = []
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+ },
|
|
|
+
|
|
|
seachdata() {
|
|
|
this.initData()
|
|
|
},
|
|
|
@@ -286,7 +429,30 @@
|
|
|
|
|
|
</script>
|
|
|
|
|
|
-<style>
|
|
|
+<style lang='scss'>
|
|
|
+ .attach-uploader .el-upload {
|
|
|
+ border: 1px dashed #63B8FF;
|
|
|
+ cursor: pointer;
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+ margin-bottom: -17px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .attach-uploader .el-upload:hover {
|
|
|
+ border-color: #228B22;
|
|
|
+ }
|
|
|
+
|
|
|
+ .attach-uploader-icon {
|
|
|
+ font-size: 25px;
|
|
|
+ color: #63B8FF;
|
|
|
+ width: 50px;
|
|
|
+ height: 50px;
|
|
|
+ line-height: 50px;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
|
|
|
+ .attach-uploader-icon:hover {
|
|
|
+ color: #228B22;
|
|
|
+ }
|
|
|
|
|
|
</style>
|