石广澎
2023-12-13 3c9c1a4f8ccbf765c35e44b21c790ef428e12868
admin-web/src/views/foundation/material/specs/list.vue
@@ -12,7 +12,7 @@
<script>
import winMd from '@/components/win/win-md'
import myButton from '@/components/myButton/myButton'
import {delSpecs} from "@/api/foudation/material";
import {delSpecs, updSpecsStatus} from "@/api/foudation/material";
import specsAdd from "@/views/foundation/material/specs/specsAdd.vue";
import {mapGetters} from 'vuex'
import MyTableV2 from "@/components/myTable/myTableV2.vue";
@@ -37,6 +37,7 @@
      },
      // 表格数据
      table: {
        autoLoad: false,
        showIndex: true, // 是否显示序号
        expand: false, // 是否显示详情数据
        dataIndex: 'goodsTemplatesId',
@@ -61,8 +62,8 @@
        },
        // 列信息
        columns: [
          {title: '规格型号', field: 'goodsCode', align: 'left', minWidth: 120},
          {title: '单位', field: 'classification', align: 'center', width: 100},
          {title: '规格型号', field: 'modelName', align: 'left', minWidth: 120},
          {title: '单位', field: 'unit', align: 'center', width: 100},
          {
            field: 'states',
            title: '状态',
@@ -105,7 +106,7 @@
          ],
        },
        paging: {
          show: true, // 显示分页
          show: false, // 显示分页
          // 分页信息
          page: {
            small: false,
@@ -120,16 +121,35 @@
  computed: {
    ...mapGetters(['userInfo'])
  },
  created() {
  mounted() {
    this.$nextTick(()=>{
      this.search()
    })
  },
  methods: {
    showAdd(){
      this.specsSetting.mid = this.setting.id;//物品ID
      this.specsSetting.goodsTemplatesId = this.setting.goodsTemplatesId;//物品ID
      this.specsSetting.show = true;
    },
    updState(row) {
      let vm = this
      let text = row.states == 0 ? "启用" : "禁用";
      vm.$modal.confirm('确认要' + text + '"' + row.modelName + '"规格吗?').then(function () {
        let params = Object.assign({}, row)
        params.states = row.states == 1 ? 0 : 1
        updSpecsStatus(params).then(res => {
          if (res) {
            row.states = row.states === 1 ? 0 : 1
            vm.$modal.msgSuccess(text + "成功");
            vm.search()
          }
        })
      })
    },
    del(row) {
      this.$modal
        .confirm('是否确认删除名称为"' + row.categoryName + '"的机构吗?')
        .confirm('是否确认删除名称为"' + row.modelName + '"的规格吗?')
        .then(function () {
          delSpecs({ id: row.id }).then((res) => {});
        })
@@ -143,7 +163,7 @@
    },
    // 查询table列表
    search() {
      this.$refs.myTable.search()
      this.$refs.myTable.search({goodsTemplatesId:this.specsSetting.goodsTemplatesId})
    },
  }