|
|
@@ -0,0 +1,331 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <el-card class="box-card">
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <span style="font-weight: bold">准入范围</span>
|
|
|
+ <span style="float: right;">
|
|
|
+ <el-button style="float: right; padding: 3px 0" type="text" @click="showDialog" v-if="canadd">添加
|
|
|
+ </el-button>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <el-table :data="goodsList" border style="height: calc(100vh - 435px);">
|
|
|
+ <el-table-column label="操作" width="90" align="center" fixed>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <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="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>
|
|
|
+ <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-card>
|
|
|
+
|
|
|
+ <el-dialog title="基建类业务列表" :visible.sync="goodsDialog" top="5vh">
|
|
|
+ <el-row :gutter="20" style="height: calc(100vh - 545px); overflow: auto;">
|
|
|
+ <el-col :span="20">
|
|
|
+ <el-tree highlight-current :expand-on-click-node="true" node-key="id" :data="orgtreelist"
|
|
|
+ :props="orgtreeprops" ref="orgmanagetree" show-checkbox @check-change="getChildrens">
|
|
|
+ </el-tree>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import {
|
|
|
+ mapGetters
|
|
|
+ } from 'vuex'
|
|
|
+
|
|
|
+ export default {
|
|
|
+ name: 'GoodsList',
|
|
|
+ components: {},
|
|
|
+ props: {
|
|
|
+ canadd: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.initData()
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters({
|
|
|
+ session: 'session'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ SupplierId: 0,
|
|
|
+ SupplierTypeCode: '',
|
|
|
+ SupplierCertId: 0,
|
|
|
+
|
|
|
+ Title: '',
|
|
|
+ goodsList: [],
|
|
|
+ goodsDialog: false,
|
|
|
+ orgtreelist: [],
|
|
|
+ orgtreeprops: {
|
|
|
+ value: 'Id',
|
|
|
+ label: 'Name',
|
|
|
+ children: 'children'
|
|
|
+ },
|
|
|
+
|
|
|
+ BusinessForm: {
|
|
|
+ Id: '',
|
|
|
+ SupplierId: '',
|
|
|
+ SupplierCertId: '',
|
|
|
+ SupplierTypeCode: '',
|
|
|
+ SubClassId: '',
|
|
|
+ Code: '',
|
|
|
+ Name: '',
|
|
|
+ Remark: '',
|
|
|
+ IsDelete: 0
|
|
|
+ },
|
|
|
+ visible: false,
|
|
|
+ selfVisible: this.visible, // 避免vue双向绑定警告
|
|
|
+ currentPage: 1, // 分页
|
|
|
+ size: 10,
|
|
|
+ currentItemCount: 0,
|
|
|
+ flagId: 0 //标记是否第一次点击
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getvalue(SupplierId, SupplierTypeCode, certId) {
|
|
|
+ this.SupplierId = SupplierId
|
|
|
+ this.SupplierTypeCode = SupplierTypeCode
|
|
|
+ this.SupplierCertId = certId
|
|
|
+ this.initData()
|
|
|
+ },
|
|
|
+ initData() {
|
|
|
+ let _this = this
|
|
|
+ const params = {
|
|
|
+ SupplierCertId: this.SupplierCertId,
|
|
|
+ SupplierTypeCode: this.SupplierTypeCode,
|
|
|
+ _currentPage: this.currentPage,
|
|
|
+ _size: this.size
|
|
|
+ }
|
|
|
+ this.$axios.get('suppliercertsub/list', {
|
|
|
+ params
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ _this.goodsList = res.data.items
|
|
|
+ _this.currentItemCount = res.data.currentItemCount
|
|
|
+ _this.$emit('close')
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ savedata() {
|
|
|
+ if (this.Title === '新增准入范围') {
|
|
|
+ this.addGoodsBus()
|
|
|
+ } else if (this.Title === '编辑准入范围') {
|
|
|
+ this.editBusiness()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ addGoodsBus() {
|
|
|
+ let _this = this
|
|
|
+ let arr = []
|
|
|
+ arr = _this.$refs['cascader'].currentLabels
|
|
|
+ _this.BusinessForm.Name = arr[arr.length - 1]
|
|
|
+ _this.BusinessForm.SupplierId = parseInt(_this.BusinessForm.SupplierId)
|
|
|
+ _this.BusinessForm.SupplierCertId = parseInt(_this.BusinessForm.SupplierCertId)
|
|
|
+ _this.BusinessForm.SubClassId = parseInt(_this.BusinessForm.SubClassId)
|
|
|
+ //因为表单验证不能用,所以采用提示验证
|
|
|
+ if (_this.selectedOptList.length < 1) {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '名称不能为空,请选择分类!'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ _this.$axios.post('/suppliercertsub/addbusiness/', _this.BusinessForm)
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ _this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ _this.BusinessForm.Id = res.data.item + ''
|
|
|
+ _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('suppliercertsub/businessdelete/' + val.Id, {})
|
|
|
+ .then(function (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(() => {})
|
|
|
+ },
|
|
|
+ showDialog() {
|
|
|
+ this.getorgtreelist()
|
|
|
+ this.goodsDialog = true
|
|
|
+ },
|
|
|
+ getorgtreelist() {
|
|
|
+ let _this = this
|
|
|
+ this.$axios.get('goodsaptitude/goodsparentlist', {})
|
|
|
+ .then(res => {
|
|
|
+ _this.orgtreelist = window.toolfun_gettreejson(res.data.items, 'Id', 'ParentId', 'Id,Name')
|
|
|
+ _this.orgtreelist.forEach((item, index) => {
|
|
|
+ _this.$set(this.orgtreelist[index], 'children', [])
|
|
|
+ })
|
|
|
+ console.log("-----------------", _this.orgtreelist)
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //获取下一级所有分类
|
|
|
+ getChildrens(val) {
|
|
|
+ let _this = this
|
|
|
+ let Id = val.id
|
|
|
+ if (Id != _this.flagId) { //判断是否是第一次,若不相等则为第一次
|
|
|
+ this.$axios.get('goodsaptitudeclass/getchildlist/' + Id, {})
|
|
|
+ .then(res => {
|
|
|
+ //获取下一级所有级联数据
|
|
|
+ if (res.data.items) { //判断是否有数据
|
|
|
+ let tempList = []
|
|
|
+ tempList = window.toolfun_gettreejson(res.data.items, 'Id', 'ParentId', 'Id,Name')
|
|
|
+ console.log("-j0000090------------------",this.orgtreelist)
|
|
|
+ //添加到上一级对应的选项中
|
|
|
+ console.log("-j111111111111111111----",Id)
|
|
|
+ for (let i = 0; i < _this.orgtreelist.length; i++) {
|
|
|
+ if (_this.orgtreelist[i].id === Id) {
|
|
|
+ console.log("--oooooooooooooooooo-")
|
|
|
+ _this.$set(_this.orgtreelist[i], 'children', tempList)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log("-3333333333333333333333333---", _this.orgtreelist)
|
|
|
+ } else {
|
|
|
+ //修改上一级的children属性
|
|
|
+ for (let i = 0; i < _this.orgtreelist.length; i++) {
|
|
|
+ if (_this.orgtreelist[i].id === Id) {
|
|
|
+ _this.$set(_this.orgtreelist[i], 'children', '')
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //做标记
|
|
|
+ _this.flagId = Id
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //获取分类级联Id
|
|
|
+ getGoodsCode(item) {
|
|
|
+ this.getCodeById(item[item.length - 1]) //根据分类Id获取Code
|
|
|
+ },
|
|
|
+ //根据分类Id获取Code
|
|
|
+ getCodeById(Id) {
|
|
|
+ let _this = this
|
|
|
+ this.$axios.get('goodsaptitudeclass/getcode/' + Id, {})
|
|
|
+ .then(res => {
|
|
|
+ _this.BusinessForm.SubClassId = Id
|
|
|
+ _this.BusinessForm.Code = res.data.items[0].Code
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // getCode() {
|
|
|
+ // this.ClassId = this.selectedorg[this.selectedorg.length - 1]
|
|
|
+ // for (var i = 0; i < this.techList.length; i++) {
|
|
|
+ // if (this.selectedorg[this.selectedorg.length - 1] === this.techList[i].Id) {
|
|
|
+ // this.BusinessForm.SubClassId = this.techList[i].Id
|
|
|
+ // this.BusinessForm.Name = this.techList[i].Name
|
|
|
+ // this.BusinessForm.Code = this.techList[i].Code
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // getChooseCode(val) {
|
|
|
+ // this.ClassId = val.Id
|
|
|
+ // this.BusinessForm.SubClassId = val.Id
|
|
|
+ // this.BusinessForm.Code = val.Code
|
|
|
+ // this.BusinessForm.Name = val.Name
|
|
|
+ // // this.basicDialog = false
|
|
|
+ // },
|
|
|
+
|
|
|
+ handleSizeChange(value) {
|
|
|
+ this.size = value
|
|
|
+ this.currentPage = 1
|
|
|
+ this.initData()
|
|
|
+ },
|
|
|
+ handleCurrentChange(value) {
|
|
|
+ this.currentPage = value
|
|
|
+ this.initData()
|
|
|
+ },
|
|
|
+ // HandleSizeChange(value) {
|
|
|
+ // this.Size = value
|
|
|
+ // this.CurrentPage = 1
|
|
|
+ // this.getbusiness()
|
|
|
+ // },
|
|
|
+ // HandleCurrentChange(value) {
|
|
|
+ // this.CurrentPage = value
|
|
|
+ // this.getbusiness()
|
|
|
+ // },
|
|
|
+ seachdata() {
|
|
|
+ this.CurrentPage = -1
|
|
|
+ this.getbusiness()
|
|
|
+ },
|
|
|
+ jstimehandle(val) {
|
|
|
+ if (val === '') {
|
|
|
+ return '----'
|
|
|
+ } else if (val === '0001-01-01T08:00:00+08:00') {
|
|
|
+ return '----'
|
|
|
+ } else if (val === '5000-01-01T23:59:59+08:00') {
|
|
|
+ return '永久'
|
|
|
+ } else {
|
|
|
+ val = val.replace('T', ' ')
|
|
|
+ return val.substring(0, 10)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+</script>
|
|
|
+
|
|
|
+<style>
|
|
|
+
|
|
|
+
|
|
|
+</style>
|