石广澎
2023-12-13 db5f18c8d02881bbf8b8b43d45236bc59bd2f958
admin-web/src/views/foundation/material/specs/list.vue
@@ -1,7 +1,7 @@
<template>
  <win-md title="规格型号" @close="close" :width="'800px'">
    <!--列表-->
    <my-table-v2 ref="myTable" :table="table"/>
    <my-table-v2 ref="myTable" :filter="{goodsTemplatesId: setting.goodsTemplatesId}" :table="table"/>
    <div slot="footer" align="center" class="dialog-footer">
      <my-button name="取消" site="form" @click="close"/>
    </div>
@@ -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,9 +37,11 @@
      },
      // 表格数据
      table: {
        autoLoad: false,
        showIndex: true, // 是否显示序号
        expand: false, // 是否显示详情数据
        url: SettingIplatform.apiBaseURL + '/pc/base/goods/template/list', // 请求地址
        dataIndex: 'goodsTemplatesId',
        url: SettingIplatform.apiBaseURL + '/pc/base/goods/models/query/goodsModel', // 请求地址
        // 工具条
        tools: {
          columnsCtrl: {// 列控制按钮
@@ -60,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: '状态',
@@ -104,7 +106,7 @@
          ],
        },
        paging: {
          show: true, // 显示分页
          show: false, // 显示分页
          // 分页信息
          page: {
            small: false,
@@ -119,23 +121,45 @@
  computed: {
    ...mapGetters(['userInfo'])
  },
  created() {
  mounted() {
    this.$nextTick(() => {
      this.search()
    })
  },
  methods: {
    showAdd(){
      this.specsSetting.mid = this.setting.id;//物品ID
    showAdd() {
      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) => {});
          delSpecs({id: row.id}).then((res) => {
          });
        })
        .then((res) => {
          this.$message.success('删除成功!');this.$refs.myTable.search();
          this.$message.success('删除成功!');
          this.$refs.myTable.search();
        })
        .catch(() => {});
        .catch(() => {
        });
    },
    close() {
      this.$emit('close')