石广澎
2024-01-05 b2429057ae17e9f5b357435b0bff5f6cc0040b69
admin-web/src/views/foundation/material/index.vue
@@ -13,11 +13,13 @@
              <my-table-v2 ref="myTable" :filter="filterFrom" :table="table"/>
            </el-col>
          </el-row>
          <!--添加/编辑弹窗-->
          <edit v-if="editSetting.show" :setting="editSetting" @close="editSetting.show = false" @search="search"/>
        </el-card>
      </el-container>
    </el-container>
    <!--添加/编辑弹窗-->
    <edit v-if="editSetting.show" :setting="editSetting" @close="editSetting.show = false" @search="search"/>
    <!--规格-->
    <specs v-if="specsSetting.show" :setting="specsSetting" @close="specsSetting.show = false" @search="search"></specs>
    <my-import
      :import-setting="importSetting"
      :dialog-show="importSetting.dialogShow"
@@ -33,13 +35,14 @@
import MyButton from "@/components/myButton/myButton";
import SettingIplatform from '@/utils/settingIplatform';
import edit from './edit'
import * as finsystenant from '@/api/baseSetting/finsystenant'
import {updStatus,delGoods} from '@/api/foudation/material'
import myImport from '@/views/components/myImport'
import {getBaseUrl} from '@/utils/base';
import Specs from "@/views/foundation/material/specs/list.vue";
export default {
  name: "index",
  components: {MyButton, MyTableV2, edit, myTree, myImport},
  components: {Specs, MyButton, MyTableV2, edit, myTree, myImport},
  data() {
    return {
      // 搜索框
@@ -110,7 +113,7 @@
          dialogShow: false,
          fileSettings: {
              data: {},
              uploadUrl: getBaseUrl()+"/pc/fin/sys/tenant/import", // 上传地址
              uploadUrl: getBaseUrl()+"/pc/base/goods/template/import", // 上传地址
              accept: '.xls', // 格式
              type: 'text', // 回显形式
              loading: false // 导入效果
@@ -118,7 +121,7 @@
          /* 模板下载 */
          templateSettings: {
              templateName: '导入模板.xls', // 名称
              templateUrl: SettingIplatform.apiBaseURL + '/pc/fin/sys/tenant/getImportTemplate' // 下载地址
              templateUrl: SettingIplatform.apiBaseURL + '/pc/fin/sys/tenant/getImportTemplate?type=goods' // 下载地址
          },
          onSuccess: null
      },
@@ -126,6 +129,11 @@
        title: '',
        id: '',
        orgId: '',
        show: false,
      },
      specsSetting: {
        title: '',
        id: '',
        show: false,
      },
      // 表格数据
@@ -159,12 +167,12 @@
        },
        // 列信息
        columns: [
          {title: '物品编号', field: 'goodsCode', align: 'center'},
          {title: '物品名称', field: 'goodsName', align: 'center'},
          {title: '分类', field: 'categoryName', align: 'center'},
          {title: '类别', field: 'classification', align: 'center'},
          {title: '物品编号', field: 'goodsCode', align: 'center', width: 120},
          {title: '物品名称', field: 'goodsName', align: 'left', minWidth: 140},
          {title: '分类', field: 'categoryName', align: 'left', minWidth: 140},
          {title: '类别', field: 'classification', align: 'center', width: 80},
          // {title: '采购类型', field: 'categoryId', align: 'center'},
          {title: '所属机构', field: 'agencyName', align: 'center'},
          {title: '所属机构', field: 'agencyName', align: 'left', minWidth: 140},
          {
            title: '创建时间',
            field: 'createDate',
@@ -205,12 +213,12 @@
        // 操作信息
        operation: {
          show: true, // 显示操作列
          width: '250', // 列宽
          width: 250, // 列宽
          attr: [
            {
              title: '编辑',
              events: (row) => {
                this.showAudit(row);
                this.showAdd(row.id);
              },
            },
            {
@@ -219,12 +227,13 @@
                this.del(row);
              },
            },
            // {
            //   title: '规格型号',
            //   events: (row) => {
            //     this.showAudit(row);
            //   },
            // },
            {
              title: '规格型号',
              type: 'primary',
              events: (row) => {
                this.showSpecs(row);
              },
            },
          ],
        },
        paging: {
@@ -259,10 +268,10 @@
    updState(row) {
      let vm = this
      let text = row.states == 0 ? "启用" : "禁用";
      vm.$modal.confirm('确认要' + text + '"' + row.goodsName + '"吗?').then(function () {
      vm.$modal.confirm('确认要' + text + '"' + row.goodsName + '"物品吗?').then(function () {
        let params = Object.assign({}, row)
        params.states = row.states == 1 ? 0 : 1
        finsystenant.upcode(params).then(res => {
        updStatus(params).then(res => {
          if (res) {
            row.states = row.states === 1 ? 0 : 1
            vm.$modal.msgSuccess(text + "成功");
@@ -273,9 +282,9 @@
    },
    del(row) {
      this.$modal
        .confirm('是否确认删除名称为"' + row.goodsName + '"的机构吗?')
        .confirm('是否确认删除名称为"' + row.goodsName + '"的物品吗?')
        .then(function () {
          finsystenant.delCode({id: row.id}).then((res) => {
          delGoods({id: row.id}).then((res) => {
          });
        })
        .then((res) => {
@@ -285,29 +294,19 @@
        .catch(() => {
        });
    },
    showAdd() {
      // if (!this.editSetting.orgId) {
      //   this.$message.warning('请先选择左侧机构')
      // } else {
        this.editSetting.id = null;
        this.editSetting.info = null;
        this.editSetting.title = '新增';
        this.editSetting.show = true;
      // }
    showAdd(id) {
      this.editSetting.id = id;
      this.editSetting.title = id?'编辑':'新增';
      this.editSetting.show = true;
    },
    showAudit(row) {
      finsystenant.editmaterial(row.id).then(res => {
        // console.log(res,'res');
        this.editSetting.id = res.id;
        this.editSetting.info = JSON.stringify(res);
        this.editSetting.title = '编辑';
        this.editSetting.show = true;
      })
    showSpecs(row) {
      this.specsSetting.goodsTemplatesId = row.id;
      this.specsSetting.show = true;
    },
    // 查询table列表
    search(pageNum) {
      if (pageNum != undefined) {
        this.$refs.myTable.search(pageNum)
        this.$refs.myTable.search({pageNum})
      } else {
        this.$refs.myTable.search()
      }