王震
2023-12-07 75e035a10a0faeff6b2ec4b9fcbf98d1536274f2
src/views/technology/completeproductstructure/index.vue
@@ -20,12 +20,13 @@
import {
  fetchList,
  delObj,
  addByStructure
  addByStructure,
} from '@/api/technology/completeproductstructure'
import ttable from '@/views/common/ztt-table.vue'
import { mapGetters } from 'vuex'
import { changeState } from '../../../api/technology/completeproductstructure'
import { remote } from '@/api/admin/dict'
export default {
  data() {
    return {
@@ -34,7 +35,7 @@
      uploadInfo: {
        // 是否展示上传EXCEL以及对应的url
        isShow: true,
        url: 'mes/bom/uploadExcel'
        url: 'mes/bom/uploadExcel',
      },
      prelang: 'completeProductStructure',
      options: {
@@ -49,7 +50,7 @@
        isRefresh: true, // 是否显示刷新按钮
        isShowHide: true, // 是否显示显影按钮
        isSearch: false, // 高级查询按钮
        defaultOrderBy: { column: 'id', direction: 'desc' }
        defaultOrderBy: { column: 'id', direction: 'desc' },
      },
      table: {
        total: 0,
@@ -67,7 +68,7 @@
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text',
            render: { fun: this.addOrUpdateHandle }
            render: { fun: this.addOrUpdateHandle },
          },
          // 零件名称
          {
@@ -77,7 +78,7 @@
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
            searchInfoType: 'text',
          },
          // 零件号
          {
@@ -87,7 +88,7 @@
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
            searchInfoType: 'text',
          },
          // 状态
@@ -112,7 +113,7 @@
                formatVal = '已取消'
              }
              return formatVal
            }
            },
          },
          // 类型
@@ -127,7 +128,7 @@
            formatter: this.formatBomTypeDbType,
            optList: () => {
              return this.bomTypeDbOptions
            }
            },
          },
          // 版本号
          {
@@ -137,61 +138,61 @@
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
            searchInfoType: 'text',
          },
          // 替代号
          {
            minWidth: '120',
            prop: 'alternativeNo',
            label: '替代号',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          // {
          //   minWidth: '120',
          //   prop: 'alternativeNo',
          //   label: '替代号',
          //   sort: true,
          //   isTrue: true,
          //   isSearch: true,
          //   searchInfoType: 'text',
          // },
          // 替代描述
          {
            minWidth: '120',
            prop: 'alternativeDesc',
            label: '替代描述',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          // {
          //   minWidth: '120',
          //   prop: 'alternativeDesc',
          //   label: '替代描述',
          //   sort: true,
          //   isTrue: true,
          //   isSearch: true,
          //   searchInfoType: 'text',
          // },
          // 绝缘颜色
          {
            minWidth: '120',
            prop: 'insulationColor',
            label: '绝缘颜色',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          // {
          //   minWidth: '120',
          //   prop: 'insulationColor',
          //   label: '绝缘颜色',
          //   sort: true,
          //   isTrue: true,
          //   isSearch: true,
          //   searchInfoType: 'text',
          // },
          // 护套颜色
          {
            minWidth: '120',
            prop: 'sheathColor',
            label: '护套颜色',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          // {
          //   minWidth: '120',
          //   prop: 'sheathColor',
          //   label: '护套颜色',
          //   sort: true,
          //   isTrue: true,
          //   isSearch: true,
          //   searchInfoType: 'text',
          // },
          // 特性1
          {
            minWidth: '120',
            prop: 'characteristicOne',
            label: '特性1',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          // {
          //   minWidth: '120',
          //   prop: 'characteristicOne',
          //   label: '特性1',
          //   sort: true,
          //   isTrue: true,
          //   isSearch: true,
          //   searchInfoType: 'text',
          // },
          // 创建人
          {
            minWidth: '120',
@@ -200,7 +201,7 @@
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
            searchInfoType: 'text',
          },
          // 创建时间
          {
@@ -210,8 +211,8 @@
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'datetimerange'
          }
            searchInfoType: 'datetimerange',
          },
        ],
        toolbar: [
          // {
@@ -226,7 +227,7 @@
            text: '产品结构生成BOM',
            fun: this.addByStructureHandle,
            disabled: false,
            permitArr: []
            permitArr: [],
          },
          {
            text: '批准',
@@ -234,7 +235,7 @@
              this.approveHandle('ACCEPT')
            },
            disabled: false,
            permitArr: ['01draft']
            permitArr: ['01draft'],
          },
          {
            text: '撤回',
@@ -242,7 +243,7 @@
              this.approveHandle('REVOKE')
            },
            disabled: false,
            permitArr: ['02accepted']
            permitArr: ['02accepted'],
          },
          {
            text: '拒绝',
@@ -250,7 +251,7 @@
              this.approveHandle('CANCEL')
            },
            disabled: false,
            permitArr: ['02accepted']
            permitArr: ['02accepted'],
          },
          {
            text: '删除',
@@ -258,46 +259,46 @@
              this.deleteAll()
            },
            disabled: false,
            permitArr: []
          }
            permitArr: [],
          },
        ],
        operator: [
          {
            text: '删除',
            type: 'text',
            size: 'small',
            fun: this.deleteHandle
          }
            fun: this.deleteHandle,
          },
        ],
        operatorConfig: {
          fixed: 'right',
          label: '操作',
          width: 100,
          minWidth: 100
        }
          minWidth: 100,
        },
      },
      stateOptionList: [
        {
          value: '01draft',
          label: '草稿'
          label: '草稿',
        },
        {
          value: '02accepted',
          label: '已接受'
          label: '已接受',
        },
        {
          value: '03cancelled',
          label: '已取消'
        }
          label: '已取消',
        },
      ],
      bomTypeDbOptions: []
      bomTypeDbOptions: [],
    }
  },
  components: {
    ttable
    ttable,
  },
  computed: {
    ...mapGetters(['permissions'])
    ...mapGetters(['permissions']),
  },
  activated() {
    this.getData()
@@ -334,16 +335,20 @@
    addOrUpdateHandle(row) {
      this.$router.push({
        name: 'completeProductStructure',
        params: { id: row == null ? null : row.id }
        params: { id: row == null ? null : row.id },
      })
    },
    // 按产品结构生成BOM
    addByStructureHandle() {
      addByStructure()
      this.$message({
        message: '已在后台生成BOM,请执行结束后刷新页面',
        type: 'success'
      addByStructure().then((res) => {
        let result = Array.from(new Set(res.data.data))
        this.$message.success(result.join(','))
        this.getData()
      })
      // this.$message({
      //   message: '已在后台生成BOM,请执行结束后刷新页面',
      //   type: 'success',
      // })
    },
    // 删除
    deleteHandle(row) {
@@ -351,9 +356,9 @@
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        closeOnClickModal: false
        closeOnClickModal: false,
      })
        .then(function() {
        .then(function () {
          const ids = []
          ids.push(row.id)
          return delObj(ids)
@@ -375,9 +380,9 @@
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
          closeOnClickModal: false
          closeOnClickModal: false,
        })
          .then(function() {
          .then(function () {
            const ids = that.multipleSelection.map((item) => {
              return item.id
            })
@@ -428,7 +433,7 @@
    handleSelectionChange(val) {
      // 根据状态,禁用表头按钮
      // 筛选出选中记录的状态
      var stateArr = val.map(function(value, index) {
      var stateArr = val.map(function (value, index) {
        return value.state
      })
      // 选中状态数组元素去重
@@ -458,7 +463,7 @@
    },
    getStateOptionList() {
      return this.stateOptionList
    }
  }
    },
  },
}
</script>