haoyahui
2023-11-17 b6a04be0a4cbf5d5a44006a09b83f52a71dfce27
部门管理,仓库管理库管员,库存管理
8个文件已添加
2个文件已删除
20个文件已修改
3048 ■■■■■ 已修改文件
admin-web/src/api/baseSetting/finsystenant.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/api/foudation/store.js 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/api/stock/accessStock.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/api/stock/inventory.js 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/api/system/deptment.js 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/styles/store.scss 201 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/departmentitem/itemdis/distribution/detail.vue 209 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/departmentitem/itemdis/distribution/edit.vue 549 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/departmentitem/itemdis/distribution/index.vue 619 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/foundation/material/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/foundation/store/edit.vue 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/foundation/store/index.vue 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/foundation/store/person.vue 215 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/stock/accessStock/outbound/detail.vue 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/stock/accessStock/outbound/edit.vue 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/stock/inventorycount/inventorytask/edit.vue 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/stock/inventorycount/inventorytask/index.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/stock/procure/purchaseOrder/detail.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/stock/procure/purchaseOrder/edit.vue 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/stock/procure/receiptDetails/edit.vue 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/stock/procure/receiptDetails/index.vue 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/stock/scrap/itemScrapping/detail.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/stock/transfer/transferApplication/edit.vue 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/stock/transfer/transferApplication/index.vue 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/stock/transfer/transferissue/index.vue 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/systemManger/server/user/edit.vue 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/systemManger/server/user/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/systemSetting/department/edit.vue 136 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/systemSetting/department/index.vue 407 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/views/systemSetting/department/items.js 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin-web/src/api/baseSetting/finsystenant.js
@@ -177,4 +177,13 @@
// 物品分类tree
export function getCategorySelectTree(parameter) {
  return request.get(SettingIplatform.apiBaseURL + '/pc/base/category/select/tree', {params: parameter})
}
// 库存
export function warehouseSelectNumber(params) {
  return request({
    url: '/pc/base/warehouse/select/number',
    method: 'get',
    params,
  });
}
admin-web/src/api/foudation/store.js
New file
@@ -0,0 +1,26 @@
import request from '@/utils/request'
import SettingIplatform from '@/utils/settingIplatform';
export function userSelectDepartment(params) {
  return request({
    url: '/pc/fin/sys/tenant/user/select/department',
    method: 'get',
    params
  })
}
// 添加仓库管理员
export function warehouseManagerAdd(data) {
  return request({
    url: '/pc/base/warehouse/manager/add',
    method: 'post',
    data
  })
}
// 查询仓库管理员
export function warehouseManagerList(params) {
  return request({
    url: '/pc/base/warehouse/manager/list',
    method: 'get',
    params
  })
}
admin-web/src/api/stock/accessStock.js
@@ -24,14 +24,6 @@
    params,
  });
}
// 库存
export function outputSelectNumber(params) {
  return request({
    url: '/pc/l/wh/form/output/select/number',
    method: 'get',
    params,
  });
}
// 明细详情
export function outputDtailList(params) {
  return request({
admin-web/src/api/stock/inventory.js
New file
@@ -0,0 +1,42 @@
import request from '@/utils/request';
// 列表
export function inventoryListApi(params) {
  return '/pc/l/wh/form/inventory/list'
}
// 新增
export function inventoryAdd(data) {
  return request({
    url: '/pc/l/wh/form/inventory/add',
    method: 'post',
    data,
  });
}
// 编辑
export function inventoryEdit(data) {
  return request({
    url: '/pc/l/wh/form/inventory/edit',
    method: 'post',
    data,
  });
}
// 删除
export function inventoryDel(data) {
  return request({
    url: '/pc/l/wh/form/inventory/del',
    method: 'post',
    data,
  });
}
// 完成盘点
export function inventoryFinish(data) {
  return request({
    url: '/pc/l/wh/form/inventory/finish',
    method: 'post',
    data,
  });
}
admin-web/src/api/system/deptment.js
New file
@@ -0,0 +1,36 @@
import request from '@/utils/request';
// 部门新增
export function departmentAdd(data) {
  return request({
    url: '/pc/fin/sys/tenant/department/add',
    method: 'post',
    data,
  });
}
// 编辑
export function departmentEdit(data) {
  return request({
    url: '/pc/fin/sys/tenant/department/edit',
    method: 'post',
    data,
  });
}
// 编辑
export function departmentDetail(params) {
  return request({
    url: '/pc/fin/sys/tenant/department/detail',
    method: 'get',
    params,
  });
}
export function departmentListAll(params) {
    return request({
      url: '/pc/fin/sys/tenant/department/list/all',
      method: 'get',
      params,
    });
  }
admin-web/src/styles/store.scss
New file
@@ -0,0 +1,201 @@
.stock-container {
    .ml-20 {
      margin-left: 20px;
    }
    .card,.list-item {
      display: flex;
      flex-wrap: wrap;
      margin: 0px !important;
      width: 100%;
      min-height: 100%;
      .cm-item {
        width: 100%;
      }
      .cm-item .el-card__body {
        padding-bottom: 5px;
      }
    }
    .card-data {
      width: 100%;
      position: relative;
      margin-top: 8px;
      .card-container {
        .card-header {
          height: 48px;
          display: flex;
          align-items: center;
          justify-content: space-between;
          background: #f3f9fe;
          padding: 0 32px 0 15px;
          box-sizing: border-box;
        }
        .card-header-left {
          display: flex;
          align-items: center;
          color: #999999;
          font-family: 'Microsoft YaHei UI';
          font-size: 18px;
          font-weight: 700;
          .value {
            color: #3d3d3d;
          }
          .states {
            width: 54px;
            height: 22px;
            line-height: 22px;
            text-align: center;
            border-radius: 4px;
            border: 1px solid #f9675b99;
            background: rgba($color:#f9675b99,$alpha:0.1);
            font-family: 'Microsoft YaHei';
            color: #f9675b;
            font-size: 13px;
            font-style: normal;
            font-weight: 400;
            margin-left: 8px;
          }
          .states-success {
            border: 1px solid #39ad6199;
            background: rgba($color:#39ad6199,$alpha:0.1);
            color: #39ad61;
          }
          .states-info {
            border: 1px solid #999999;
            background: rgba($color:#999999,$alpha:0.1);
            color: #999999;
          }
          .states-warning {
            border: 1px solid #e6a23c;
            background: rgba($color:#e6a23c,$alpha:0.1);
            color: #e6a23c;
          }
        }
        .one-hed {
          margin-top: 15px;
          padding: 0 32px 0 15px;
          box-sizing: border-box;
          .box {
            display: inline-block;
            margin-right: 20px;
          }
          .span-two {
            color: #83919e;
            font-size: 14px;
          }
        }
        .card-end {
          font-size: 14px;
          color: #3d3d3d;
          margin-top: 15px;
          display: flex;
          flex-wrap: wrap;
          font-family: 'Microsoft YaHei UI';
          padding: 0 16px;
          box-sizing: border-box;
          .item {
            width: 379px;
            height: 60px;
            padding: 8px 12px 9px 12px;
            box-sizing: border-box;
            align-items: center;
            gap: 8px;
            flex-shrink: 0;
            background: #f9f9f9;
            margin-right: 15px;
            margin-bottom: 15px;
            &:last-child {
              margin-right: 0;
            }
            .name {
              height: 22px;
              line-height: 22px;
            }
            .value-box {
              display: flex;
              .value-box-item {
                margin-right: 20px;
                .label {
                  color: #99999999;
                  line-height: 22px;
                }
                .value {
                  color: #ff3131;
                }
              }
            }
          }
        }
      }
    }
  }
  .no-data{
    margin-top: 100px;
    text-align: center;
    color: #909399;
  }
  /*编辑*/
  .stock-edit{
    .main-w {
      width: 88%;
    }
    .goods-card {
      position: relative;
      background: #f6f6f6;
      padding: 20px;
      box-sizing: border-box;
      border-radius: 4px;
      background-color: #f9f9f9;
      margin-top: 20px;
      &:nth-of-type(1) {
        margin-top: 0;
      }
    }
    .btn-group {
      width: 80px;
      position: absolute;
      right: -94px;
      bottom: 0px;
      .el-button {
        margin-bottom: 10px;
        margin-left: 0;
        display: block;
        &:last-child {
          margin-bottom: 0;
        }
      }
    }
  }
  /*详情*/
  .stock-detail{
    .img-row {
      display: flex;
      align-content: center;
    }
    .img-box {
      display: inline-block;
      width: 80px;
      height: 80px;
      background: #f9f9f9;
      margin-right: 20px;
      cursor: pointer;
      .img {
        width: 100%;
      }
    }
    .goods-card {
      position: relative;
      background: #f6f6f6;
      padding: 20px;
      box-sizing: border-box;
      border-radius: 4px;
      background-color: #f9f9f9;
      margin-top: 20px;
      &:nth-of-type(1) {
        margin-top: 0;
      }
    }
  }
admin-web/src/views/departmentitem/itemdis/distribution/detail.vue
New file
@@ -0,0 +1,209 @@
<template>
  <win-md class="stock-detail" :title="setting.title" @close="close" :width="'800px'">
    <el-row :gutter="20">
      <el-col :span="8">
        <span>入库单号:</span>
        <span>{{ detail.businessFormCode }}</span>
      </el-col>
      <el-col :span="8">
        <span>入库仓库:</span>
        <span>{{ detail.warehouseName }}</span>
      </el-col>
      <el-col :span="8">
        <span>所属机构:</span>
        <span>{{ detail.agencyName }}</span>
      </el-col>
    </el-row>
    <el-row :gutter="20" style="margin-top: 20px">
      <el-col :span="8">
        <span>状态:</span>
        <span>{{ detail.states == 1 ? '待入库' : '已入库' }}</span>
      </el-col>
      <el-col :span="8">
        <span>创建人:</span>
        <span>{{ detail.buyerName }}</span>
      </el-col>
      <el-col :span="8">
        <span>入库时间:</span>
        <span>{{ detail.incomeTime | formatTime }}</span>
      </el-col>
    </el-row>
    <el-row :gutter="20" style="margin-top: 20px">
      <el-col class="img-row" :span="12">
        <span>采购类型:</span>
        <span>{{ detail.buyType == 1 ? '集采' : '自采' }}</span>
      </el-col>
    </el-row>
    <el-row :gutter="20" style="margin-top: 20px">
      <el-col class="img-row" :span="24">
        <span>采购手续照片:</span>
        <div class="img-box" v-for="(item, index) in fileList" :key="index" @click="handlePreview(item)">
          <img class="img" :src="getUrl(item.path)" alt="" />
        </div>
      </el-col>
    </el-row>
    <div class="goods-card" v-for="(goodsItem, goodsIndex) in detail.procureGoods" :key="goodsIndex">
      <el-row :gutter="20">
        <el-col :span="8">
          <span>物品分类:</span>
          <span>{{ goodsItem.baseCategoryName }}</span>
        </el-col>
        <el-col :span="8">
          <span>物品名称:</span>
          <span>{{ goodsItem.goodsTemplateName }}</span>
        </el-col>
        <el-col :span="8">
          <span>供货商:</span>
          <span>{{ goodsItem.supplier }}</span>
        </el-col>
      </el-row>
      <el-table :data="goodsItem.models" :stripe="true" style="margin-top: 20px">
        <el-table-column prop="baseGoodsModelsName" label="规格型号" align="center">
          <template slot-scope="scope">
            {{ scope.row.baseGoodsModelsName }}
          </template>
        </el-table-column>
        <el-table-column label="单位" align="center">
          <template slot-scope="scope">
            {{ scope.row.unit }}
          </template>
        </el-table-column>
        <el-table-column prop="price" label="单价" align="center">
          <template slot-scope="scope">
            {{ scope.row.price | formatPrice }}
          </template>
        </el-table-column>
        <el-table-column prop="counts" label="入库数量" align="center">
          <template slot-scope="scope">
            {{ scope.row.counts }}
          </template>
        </el-table-column>
        <el-table-column prop="counts" label="金额" align="center">
          <template slot-scope="scope">
            {{ scope.row.price * scope.row.counts  | formatPrice}}
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div id="uploadPreviewImages" style="display: none">
      <span v-for="(src, index) in fileList" :key="index">
        <img
          v-if="checkImg(src.name)"
          class="v-img"
          :src="src.url"
          :alt="src.name"
          style="width: 100px; height: 100px"
        />
      </span>
    </div>
  </win-md>
</template>
<script>
import { procureDetail } from '@/api/stock/procure/purchaseOrder';
import winMd from '@/components/win/win-md';
import * as DateFormatter from '@/utils/DateFormatter';
import { getDownUrl } from '@/utils/base';
import Viewer from 'viewerjs';
import 'viewerjs/dist/viewer.css';
let viewer = null;
export default {
  components: { winMd },
  props: {
    setting: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    return {
      fileList: [],
      detail: {
        baseCategoryName: '',
        businessFormCode: '',
        goodsTemplateName: '',
        procureDoc: '',
        agencyId: '',
        agencyName: '',
        states: '',
        createName: '',
        time: '',
        procureGoods: [{}, {}],
        fileKey: Math.random(),
      },
    };
  },
  filters: {
    formatTime(time) {
      if (!time) return '-';
      return DateFormatter.LongToDateTime(time);
    },
    formatPrice(price) {
      return price / 100
    }
  },
  created() {
    procureDetail({ id: this.setting.id }).then((res) => {
      this.detail = res;
      this.fileList = this.detail.procureDoc ? JSON.parse(this.detail.procureDoc) : [];
      this.$nextTick(() => {
        this.initPreviewImg();
      });
    });
  },
  methods: {
    initPreviewImg() {
      if (viewer != null) {
        viewer.destroy();
      }
      const ViewerDom = document.querySelector('#uploadPreviewImages');
      viewer = new Viewer(ViewerDom, {});
    },
    handlePreview(file) {
      if (!this.checkImg(file.name)) {
        return false;
      }
      let index = 0;
      for (let i = 0; i < this.fileList.length; i++) {
        const f = this.fileList[i];
        if (this.checkImg(f.name)) {
          if (file.id == f.id) {
            break;
          }
          index++;
        }
      }
      // this.fileList.forEach((f, i) => {
      //   if (file.uid == f.uid) {
      //     index = i
      //   }
      // })
      // document.querySelector('#uploadPreviewImages').children[0].click()
      viewer.view(index);
    },
    checkImg(name) {
      const suffix = name.substring(name.lastIndexOf('.'), name.length);
      const imgArray = ['.jpg', '.jpeg', '.png', '.bmp'];
      if (imgArray.indexOf(suffix) < 0) {
        return false;
      }
      return true;
    },
    getUrl(path) {
      if (path.substr(0, 7).toLowerCase() == 'http://' || path.substr(0, 8).toLowerCase() == 'https://') {
        return path;
      } else {
        return getDownUrl() + path;
      }
    },
    close() {
      this.$emit('close');
    },
  },
};
</script>
<style lang="scss" scoped>
@import url(../../../../styles/store.scss);
</style>
admin-web/src/views/departmentitem/itemdis/distribution/edit.vue
New file
@@ -0,0 +1,549 @@
<template>
  <win-md class="stock-edit" :title="`${setting.title}采购入库`" @close="close" :width="'800px'">
    <el-form class="form" ref="ruleForm" :model="formData" :rules="rules" label-width="120px">
      <div class="main-w">
        <el-row :gutter="24" class="headerHeight">
          <el-col :span="12">
            <el-form-item label="入库仓库" prop="warehouseId">
              <el-select v-model="formData.warehouseId" placeholder="请选择" style="width: 100%">
                <el-option v-for="item in warehouses" :key="item.id" :label="item.warehouseName" :value="item.id" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="采购时间" prop="procureTime">
              <el-date-picker
                v-model="formData.procureTime"
                type="datetime"
                value="yyyy-MM-dd HH:mm:ss"
                value-format="yyyyMMddHHmmss"
                placeholder="请选择日期"
                style="width: 100%"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24" class="headerHeight">
          <el-col :span="12">
            <el-form-item label="采购类型" prop="buyType">
              <el-select v-model="formData.buyType" placeholder="请选择" style="width: 100%">
                <el-option v-for="item in buyTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24" class="headerHeight">
          <el-col :span="24">
            <el-form-item label="采购入库手续" prop="procureDoc">
              <upload ref="uploadRef" :values="fileList" :settings="uploadSettings" @on-change="uploadChange"></upload>
            </el-form-item>
          </el-col>
        </el-row>
        <div class="goods-card" v-for="(goodsItem, goodsIndex) in formData.procureGoods" :key="goodsIndex">
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item
                label="物品分类"
                :prop="`procureGoods[${goodsIndex}].baseCategoryIds`"
                :rules="{
                  required: true,
                  message: '请选择',
                  trigger: 'change',
                }"
              >
                <el-cascader
                  v-model="goodsItem.baseCategoryIds"
                  :options="categoryOptions"
                  :props="{ value: 'id' }"
                  @change="categoryChange($event, goodsIndex)"
                  style="width: 100%"
                ></el-cascader>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item
                label="物品名称"
                :prop="`procureGoods[${goodsIndex}].baseGoodsTemplateId`"
                :rules="rules.baseGoodsTemplateId"
              >
                <el-select
                  v-model="goodsItem.baseGoodsTemplateId"
                  placeholder="请先择物品分类"
                  filterable
                  :disabled="!goodsItem.baseCategoryId"
                  style="width: 100%"
                  @change="goodsTemplateChange($event, goodsIndex)"
                >
                  <el-option
                    v-for="item in goodsItem.goodsOptions"
                    :key="item.id"
                    :label="item.goodsName"
                    :value="item.id"
                  />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="12">
              <el-form-item
                label="规格型号"
                :prop="`procureGoods[${goodsIndex}].modelsIds`"
                :rules="{
                  required: true,
                  message: '请选择',
                  trigger: 'change',
                }"
              >
                <el-select
                  v-model="goodsItem.modelsIds"
                  multiple
                  placeholder="请先择物品名称"
                  :disabled="!goodsItem.baseCategoryId"
                  @change="modelChange($event, goodsIndex)"
                  @remove-tag="modelRemoveTag($event, goodsIndex)"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in goodsItem.modelsOptions"
                    :key="item.id"
                    :label="item.modelName"
                    :value="item.id"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="供货商" prop="supplier">
                <el-input v-model="goodsItem.supplier" clearable maxlength="20" show-word-limit />
              </el-form-item>
            </el-col>
          </el-row>
          <el-table :data="goodsItem.models" :stripe="true">
            <el-table-column prop="baseGoodsModelsId" label="规格型号" align="center">
              <template slot-scope="scope">
                {{ getGoodsModelsName(scope.row.baseGoodsModelsId) }}
              </template>
            </el-table-column>
            <el-table-column label="单位" align="center">
              <template slot-scope="scope">
                {{ scope.row.unit }}
              </template>
            </el-table-column>
            <el-table-column prop="priceYuan" label="单价(元)" align="center">
              <template slot-scope="scope">
                <el-form-item
                  label-width="0"
                  style="margin-bottom: 0"
                  :prop="`procureGoods[${goodsIndex}].models[${scope.$index}].priceYuan`"
                  :rules="rules.priceYuan"
                >
                  <el-input
                    type="number"
                    v-model.number="scope.row.priceYuan"
                    @change="priceChange($event, goodsIndex, scope.$index)"
                  ></el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column prop="counts" label="采购数量" align="center">
              <template slot-scope="scope">
                <el-form-item
                  label-width="0"
                  style="margin-bottom: 0"
                  :prop="`procureGoods[${goodsIndex}].models[${scope.$index}].counts`"
                  :rules="rules.counts"
                >
                  <el-input v-model.number="scope.row.counts"></el-input>
                </el-form-item>
              </template>
            </el-table-column>
          </el-table>
          <div class="btn-group">
            <el-button
              v-if="formData.procureGoods.length > 1"
              name="移除"
              type="danger"
              plain
              size="mini"
              @click="removeGoods(goodsIndex)"
              >移除</el-button
            >
            <el-button
              v-if="formData.procureGoods.length - 1 == goodsIndex"
              name="新增物品"
              type="primary"
              plain
              size="mini"
              @click="addGoods"
              >新增物品</el-button
            >
          </div>
        </div>
      </div>
    </el-form>
    <div slot="footer" align="center" class="dialog-footer">
      <my-button name="取消" site="form" @click="close" />
      <my-button name="保存" site="form" @click="handleSubmit" />
    </div>
  </win-md>
</template>
<script>
import {
  goodsTemplate,
  procureAdd,
  procureEdit,
  selectTenantWarehouse,
  goodsModel,
  procureDetail,
} from '@/api/stock/procure/purchaseOrder';
import { getTree } from '@/api/foudation/classification';
import MyButton from '@/components/myButton/myButton';
import winMd from '@/components/win/win-md';
import upload from '@/components/upload/index';
import { getUploadUrl, getDownUrl } from '@/utils/base';
import { findParentIds } from '@/utils/index';
import { mapGetters } from 'vuex';
export default {
  components: { MyButton, winMd, upload },
  props: {
    setting: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    // 自定义校验
    // 物品重复校验
    var checkGoodsTemplateId = (rule, value, callback) => {
      if (!value) {
        return callback(new Error('请选择'));
      }
      let temp = this.formData.procureGoods.filter((v) => v.baseGoodsTemplateId == value);
      if (!temp || temp.length != 1) {
        return callback(new Error('已选过此物品'));
      }
      callback();
    };
    // 金额校验
    var checkPrice = (rule, value, callback) => {
      console.log(value);
      if (!value) {
        return callback(new Error('请输入'));
      }
      if (value == 0) {
        this.$message.warning('数字值不能为0');
        return callback(new Error('数字值不能为0'));
      }
      callback();
    };
    // 数量校验
    var checkCounts = (rule, value, callback) => {
      console.log(value);
      if (!value) {
        return callback(new Error('请输入'));
      }
      if (!Number.isInteger(value)) {
        this.$message.warning('请输入数字值');
        return callback(new Error('请输入数字值'));
      }
      if (value == 0) {
        this.$message.warning('数字值不能为0');
        return callback(new Error('数字值不能为0'));
      }
      callback();
    };
    return {
      loading: false,
      buyTypeOptions: [
        {
          label: '集采',
          value: '1',
        },
        {
          label: '自采',
          value: '2',
        },
      ],
      fileList: [],
      warehouses: [], // 入库仓库列表
      categoryOptions: [], // 物品分类列表
      modelList: [], //型号列表
      formData: {
        procureDoc: '',
        warehouseId: '', // 入库仓库id
        procureTime: '', // 采购时间
        buyType: '2', // 采购方式(1:集采;2=自采)
        procureGoods: [],
      },
      goodsItem: {
        baseCategoryIds: '', // 分类编号数组
        baseCategoryId: '', // 分类编号
        baseGoodsTemplateId: '', // 物品模版编号
        goodsTemplateName: '', // 物品模版名称
        supplier: '', // 供应商
        sort: '', // 显示顺序
        goodsOptions: [], // 物品列表select
        modelsOptions: [], //规格型号select
        models: [], // 物品名称
        modelsIds: [], //规格型号
      },
      modelsItem: {
        baseGoodsModelsId: '', // 规格型号编号
        priceYuan: null, // 单价(元)
        price: null, // 单价(分 采购需要,调拨不需要)
        counts: null, // 操作数量
        unit: null, //单位
      },
      rules: {
        warehouseId: [{ required: true, message: '请选择', trigger: 'change' }],
        procureTime: [{ required: true, message: '请选择', trigger: 'change' }],
        buyType: [{ required: true, message: '请选择', trigger: 'change' }],
        procureDoc: [{ required: true, message: '请上传', trigger: 'change' }],
        baseCategoryIds: [{ required: true, message: '请选择', trigger: 'change' }],
        baseGoodsTemplateId: [{ validator: checkGoodsTemplateId, trigger: ['blur', 'change'] }],
        modelsIds: [{ required: true, message: '请选择', trigger: 'change' }],
        priceYuan: [{ validator: checkPrice, trigger: 'blur' }],
        counts: [{ validator: checkCounts, trigger: 'blur' }],
      },
      uploadSettings: {
        title: '上传',
        max: 20, // 最大大小,单位M
        num: 10, // 支持上传图片个数
        accept: '.jpg,.png', // 限制格式
        tip: '', // 提示 默认:`只能上传${this.defaultSettings.num}个${this.defaultSettings.accept}文件,且不超过${this.defaultSettings.max}kb`
        uploadUrl: getUploadUrl(), // 上传路径
        multiple: true, // 是否支持批量上传
        disabled: false, // 是否禁用
        type: 'picture', // text/picture
      },
    };
  },
  computed: {
    ...mapGetters(['userInfo']),
  },
  created() {
    this.init();
  },
  methods: {
    async init() {
      this.getWarehouseList();
      this.getgoodsTemplate();
      this.getgoodsModel();
      // 获取物品分类列表
      const treeRes = await getTree();
      this.categoryOptions = this.removeEmptyChildren(treeRes);
      if (this.setting.id) {
        const detail = await procureDetail({ id: this.setting.id });
        this.formData = Object.assign(this.formData, detail);
        if (this.formData.procureDoc) {
          this.fileList = JSON.parse(this.formData.procureDoc);
        }
        this.$set(this.formData, 'buyType', this.formData.buyType.toString());
        this.formData.procureTime = this.formData.procureTime.toString();
        this.formData.procureGoods.map((item, index) => {
          // 根据子集ID拼接物品分类列表
          item.baseCategoryIds = findParentIds(this.categoryOptions, item.baseCategoryId);
          this.$set(
            this.formData.procureGoods[index],
            'modelsIds',
            item.models.map((v) => v.baseGoodsModelsId),
          );
          this.getgoodsTemplate(item.baseCategoryId, index);
          this.getgoodsModel(item.baseGoodsTemplateId, index);
          item.models.forEach((child, childIndex) => {
            this.$set(this.formData.procureGoods[index].models[childIndex], 'priceYuan', child.price / 100);
          });
          return item;
        });
      }
    },
    // 获取入库仓库列表
    getWarehouseList() {
      selectTenantWarehouse({ agencyId: this.userInfo.tenantId })
        .then((res) => {
          this.warehouses = res;
          if (!this.setting.id && res.length) {
            this.formData.procureGoods.push(JSON.parse(JSON.stringify(this.goodsItem)));
          }
          if (this.warehouses.length && !this.formData.warehouseId) {
            // 默认选中第一个仓库
            this.formData.warehouseId = this.warehouses[0].id;
          }
        })
        .catch((err) => {
          console.log('err', err);
        });
    },
    removeEmptyChildren(arr) {
      arr.forEach((item) => {
        if (!item.children || !item.children.length) {
          delete item.children;
        } else {
          this.removeEmptyChildren(item.children);
        }
      });
      return arr;
    },
    // 获取物品名称列表
    getgoodsTemplate(id, index) {
      goodsTemplate({ categoryId: id || '' }).then((res) => {
        if (index || index == 0) {
          this.$set(this.formData.procureGoods[index], 'goodsOptions', res);
        } else {
          this.goodsTemplatelAll = res;
        }
      });
    },
    // 规格型号
    getgoodsModel(id, index) {
      goodsModel({ goodsTemplatesId: id || '' }).then((res) => {
        if (index || index == 0) {
          this.$set(this.formData.procureGoods[index], 'modelsOptions', res);
        } else {
          this.goodsModelAll = res;
        }
      });
    },
    // 根据物品名称id获取名字
    getGoodsTemplateName(id) {
      let item = this.goodsTemplatelAll.find((v) => v.id == id);
      if (item) {
        return item.goodsName;
      }
      return;
    },
    // 根据规格型号id获取名字
    getGoodsModelsName(id) {
      let item = this.goodsModelAll.find((v) => v.id == id);
      if (item) {
        return item.modelName;
      }
      return;
    },
    // 物品分类选择
    categoryChange(e, index) {
      this.formData.procureGoods[index].goodsOptions = [];
      this.formData.procureGoods[index].baseGoodsTemplateId = '';
      this.formData.procureGoods[index].goodsTemplateName = '';
      this.formData.procureGoods[index].modelsOptions = [];
      this.formData.procureGoods[index].modelsIds = [];
      this.formData.procureGoods[index].models = [];
      this.formData.procureGoods[index].baseCategoryId = e[e.length - 1];
      // 根据选中分类请求物品名称列表
      this.getgoodsTemplate(e[e.length - 1], index);
    },
    // 物品名称列表
    goodsTemplateChange(e, index) {
      this.formData.procureGoods[index].modelsOptions = [];
      this.formData.procureGoods[index].modelsIds = [];
      this.formData.procureGoods[index].models = [];
      this.formData.procureGoods[index].goodsTemplateName = this.getGoodsTemplateName(e);
      // 根据选中物品名称id获取规格型号列表
      this.getgoodsModel(e, index);
    },
    // 规格型号选择
    modelChange(e, index) {
      let arr = [...this.formData.procureGoods[index].models];
      let str = JSON.stringify(arr);
      e.forEach((item) => {
        if (str.indexOf(item) == -1) {
          let temp = this.goodsModelAll.find((v) => v.id == item);
          arr.push({ ...this.modelsItem, baseGoodsModelsId: item, unit: temp.unit });
        }
      });
      this.formData.procureGoods[index].models = arr;
    },
    // 规格型号移除
    modelRemoveTag(e, index) {
      let arr = this.formData.procureGoods[index].models;
      let delIndex = arr.findIndex((v) => v.baseGoodsModelsId == e);
      this.formData.procureGoods[index].models.splice(delIndex, 1);
    },
    // 价格input监听 转为分
    priceChange(e, goodsIndex, index) {
      this.formData.procureGoods[goodsIndex].models[index].price = e * 100;
    },
    // 上传
    uploadChange() {
      let arr = this.$refs.uploadRef.fileList;
      this.formData.procureDoc = JSON.stringify(arr);
    },
    // 点击新增物品
    addGoods() {
      this.formData.procureGoods.push(JSON.parse(JSON.stringify(this.goodsItem)));
    },
    // 点击移除
    removeGoods(index) {
      this.formData.procureGoods.splice(index, 1);
    },
    // 提交
    handleSubmit() {
      this.$refs['ruleForm'].validate((valid) => {
        if (valid) {
          console.log('formData', this.formData);
          debugger;
          if (!this.setting.id) {
            procureAdd(this.formData)
              .then((res) => {
                this.$message.success('保存成功!');
                this.close();
                this.$emit('search');
              })
              .catch((err) => {
                console.log('create err', err);
                this.$message.error('保存失败');
              });
          } else {
            procureEdit(this.formData)
              .then((res) => {
                this.$message.success('保存成功!');
                this.close();
                this.$emit('search');
              })
              .catch((err) => {
                console.log('edit err', err);
                this.$message.error('保存失败');
              });
          }
        } else {
          this.$message.error('校验未通过,请检查。');
        }
      });
    },
    close() {
      this.formData = {
        warehouseId: '', // 入库仓库id
        procureTime: '', // 采购时间
        procureGoods: [],
      };
      this.$emit('close');
    },
  },
};
</script>
<style scoped lang="scss">
@import url(../../../../styles/store.scss);
</style>
admin-web/src/views/departmentitem/itemdis/distribution/index.vue
@@ -1,118 +1,109 @@
<template>
  <div class="app-container">
  <div class="app-container stock-container">
    <el-container>
      <el-container>
        <el-card class="box-card" style="width: 100%" shadow="never">
          <!--搜索条件-->
          <div class="filter-container">
            <my-search ref="searchBar" :items="items" @search="fifterForm"></my-search>
          </div>
          <el-row style="margin-top: 15px">
            <el-col>
              <!--列表-->
              <my-button name="新增" @click="addtable" site="form" />
              <div :style="{'overflow-y': 'auto', height:`${clientHeight - 320}px`}">
                    <el-row class="card"
                            :gutter="5">
                        <el-col v-for="(item, index) in proData" :key="index" class="cm-item">
                          <el-card class="card-data">
                            <div class="card-container">
                              <div class="hed-one">出库单号:{{ item.order_no }}</div>
                              <div class="one-hed">
                                <div class="box"><span class="span-two">机构:</span>{{ item.customer_name }}</div>
                                <div class="box"><span class="span-two">操作人:</span>{{ item.customer_name }}</div>
                                <div class="box"><span class="span-two">出库时间:</span>{{ item.customer_name }}</div>
                              </div>
                              <div class="card-end">
                                <div v-for="(just, index) in item.data" class="two-end">
                                  <div class="item"><span>{{ just.order_no }}:</span>{{ just.customer_name }}</div>
                                </div>
                              </div>
                            </div>
                            <div class="card-but">
                              <my-button name="查看详情"   site="form" />
                              <my-button name="导出出库单" site="form" />
                            </div>
                          </el-card>
                        </el-col>
                    </el-row>
              </div>
              <el-pagination
                :small="false"
                :current-page="1"
                :page-sizes="[5, 10, 20, 50, 100, 200, 300, 400, 500]"
                :page-size="10"
                layout="total, sizes, prev, pager, next, jumper"
                :total="0"
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
              />
            </el-col>
          </el-row>
          <!--添加/编辑弹窗-->
          <el-dialog title="新增出库"  :close-on-click-modal="false" :visible.sync="adddialog" width="60%" >
            <el-form ref="ruleForm" :model="formData" class="demo-ruleForm" label-width="100px">
              <el-row :gutter="24" class="headerHeight">
                  <el-col :span="12">
                    <el-form-item label="仓库名称" prop="name">
                      <el-input v-model="formData.name" clearable maxlength="20" show-word-limit style="width: 100%"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="仓库名称" prop="name">
                      <el-input v-model="formData.name" clearable maxlength="20" show-word-limit style="width: 100%"/>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="24" class="headerHeight">
                  <el-col :span="24">
                    <el-form-item label="出库手续" prop="name">
                      仅允许导入xls、xlsx格式文件
                    </el-form-item>
                  </el-col>
                </el-row>
                <div style="position: relative;">
                  <div style="background-color: #F9F9F9;width: 90%;">
                  <el-row :gutter="24" class="">
                    <el-col :span="12">
                      <el-form-item label="仓库名称" prop="name">
                        <el-input v-model="formData.name" clearable maxlength="20" show-word-limit style="width: 100%"/>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="仓库名称" prop="name">
                        <el-input v-model="formData.name" clearable maxlength="20" show-word-limit style="width: 100%"/>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row :gutter="24" class="">
                    <el-col :span="12">
                      <el-form-item label="仓库名称" prop="name">
                        <el-input v-model="formData.name" clearable maxlength="20" show-word-limit style="width: 100%"/>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-table :data="formData.tableData" height="100%"  :stripe="true">
                    <el-table-column prop="projectName" label="规格型号" align="center"> </el-table-column>
                    <el-table-column prop="time1" label="单位"  align="center"> </el-table-column>
                    <el-table-column prop="unit" label="现有库存" align="center"> </el-table-column>
                    <el-table-column prop="time2" label="出库数量"  align="center"> </el-table-column>
                  </el-table>
                  </div>
                  <div style="position: absolute;right: 0;top: 152px;">
                    <my-button style="display: block;margin-left: 10px;margin-bottom: 5px;" name="移除" site="form"/>
                    <my-button name="新增物品" site="form"/>
                  </div>
                </div>
            </el-form>
            <div slot="footer" align="center" class="dialog-footer">
              <my-button name="确定" site="form" />
              <my-button name="取消" site="form" @click="adddialog = false"/>
      <el-card class="box-card" style="width: 100%" shadow="never">
        <!--搜索条件-->
        <div class="filter-container">
          <my-search ref="searchBar" :items="items" @search="fifterForm"></my-search>
        </div>
        <el-row style="margin-top: 15px">
          <el-col>
            <!--列表-->
            <div class="table-tool-bar" style="margin-bottom: 15px">
              <my-button name="新增" @click="handleAdd" site="tools" size="medium" />
              <my-button name="导入" @click="importSetting.dialogShow = true" site="tools" size="medium" />
            </div>
          </el-dialog>
        </el-card>
      </el-container>
            <div :style="{ 'overflow-y': 'auto', height: `${clientHeight - 320}px` }" v-loading="loading">
              <el-row v-if="list.length" class="card" :gutter="5">
                <el-col v-for="(item, index) in list" :key="index" class="cm-item">
                  <el-card class="card-data">
                    <div class="card-container">
                      <div class="card-header">
                        <div class="card-header-left">
                          <span>入库单号:</span>
                          <span class="value">{{ item.businessFormCode }}</span>
                          <div class="states" :class="item.states == 1 ? '' : 'states-success'">
                            {{ item.states == 1 ? '待入库' : '已入库' }}
                          </div>
                        </div>
                        <div class="card-header-right">
                          <template v-if="item.states == 1">
                            <el-button name="编辑" site="form" type="success" size="mini" @click="handleEdit(item)"
                              >编辑</el-button
                            >
                            <el-button name="入库" site="form" type="primary" size="mini" @click="handleIncome(item)"
                              >入库</el-button
                            >
                            <el-button name="删除" site="form" type="danger" size="mini" @click="del(item)"
                              >删除</el-button
                            >
                          </template>
                          <template v-if="item.states != 1">
                            <el-button site="form" type="success" size="mini" @click="handleExport(item)"
                              >导出入库单</el-button
                            >
                          </template>
                          <el-button name="查看详情" site="form" type="info" size="mini" @click="handleDetail(item)"
                            >查看详情</el-button
                          >
                        </div>
                      </div>
                      <div class="one-hed">
                        <div class="box"><span class="span-two">机构:</span>{{ item.agencyId }}</div>
                        <div class="box"><span class="span-two">操作人:</span>{{ item.buyerName }}</div>
                        <div class="box">
                          <span class="span-two">采购时间:</span>{{ item.procureTime | formatTime }}
                        </div>
                        <div class="box">
                          <span class="span-two">入库时间:</span>{{ item.incomeTime | formatTime }}
                        </div>
                      </div>
                      <div class="card-end">
                        <div v-for="(just, index) in item.fromProcureTemplateInfoList" :key="index" class="item">
                          <div class="name">{{ just.goodsTemplateName }}</div>
                          <div class="value-box">
                            <div class="value-box-item">
                              <span class="label">数量:</span>
                              <span class="value">{{ just.count }}</span>
                              <span class="unit">{{ just.unit }}</span>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </el-card>
                </el-col>
              </el-row>
              <div class="no-data" v-else>暂无数据</div>
            </div>
            <el-pagination
              :small="false"
              :current-page="pageNum"
              :page-sizes="[5, 10, 20, 50, 100, 200, 300, 400, 500]"
              :page-size="pageSize"
              layout="total, sizes, prev, pager, next, jumper"
              :total="total"
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
            />
          </el-col>
        </el-row>
      </el-card>
    </el-container>
    <!--添加/编辑弹窗-->
    <edit
      v-if="editSetting.show"
      :setting="editSetting"
      ref="editRef"
      @close="editSetting.show = false"
      @search="refreshData"
    ></edit>
    <detail
      v-if="detailSetting.show"
      :setting="detailSetting"
      @close="detailSetting.show = false"
      ref="detailRef"
    ></detail>
    <my-import
      :import-setting="importSetting"
      :dialog-show="importSetting.dialogShow"
@@ -122,328 +113,178 @@
</template>
<script>
import MyButton from "@/components/myButton/myButton";
import { procureList, procureDel, procureIncome } from '@/api/stock/procure/purchaseOrder';
import MyButton from '@/components/myButton/myButton';
import SettingIplatform from '@/utils/settingIplatform';
import myImport from '@/views/components/myImport'
import {getBaseUrl} from '@/utils/base';
import myImport from '@/views/components/myImport';
import edit from './edit';
import detail from './detail';
import { getBaseUrl } from '@/utils/base';
import listPage from '../../../mixins/listPage'
export default {
  name: "index",
  components: {MyButton, myImport},
  name: 'index',
  mixins: [listPage],
  components: { MyButton, myImport, edit, detail },
  data() {
    return {
      loading: false,
      adddialog: false,
      formData:{
        tableData:[
          {
            projectName:'555'
          },
          {
            projectName:'444'
          }
        ],
      },
      list: [],
      // 搜索框
      items: [
        {
          type: 'text',
          dataIndex: 'name',
          label: '出库单号',
          dataIndex: 'businessFormCode',
          label: '入库单号',
          placeholder: '请输入',
          defaultValue: ''
          defaultValue: '',
        },
        {
          type: 'text',
          dataIndex: 'name',
          dataIndex: 'goodsTemplateName',
          label: '物品名称',
          placeholder: '可模糊搜索',
          defaultValue: ''
          defaultValue: '',
        },
        {
          type: 'cascader',
          dataIndex: 'agencyId',
          label: '机构',
          placeholder: '请选择',
          optionsConfig: { url: '/pc/fin/sys/tenant/select/tree_fin_tenant', props: null },
          defaultValue: '',
          options: [],
        },
        {
          type: 'text',
          dataIndex: 'name',
          dataIndex: 'createName',
          label: '创建人',
          placeholder: '请输入',
          defaultValue: ''
          defaultValue: '',
        },
        {
          type: 'select',
          dataIndex: 'states',
          label: '状态',
          placeholder: '请选择',
          defaultValue: '',
          options: [
            {
              label: '全部',
              value: '',
            },
            {
              label: '待入库',
              value: '1',
            },
            {
              label: '已入库',
              value: '2',
            },
          ],
        },
        {
          type: 'date-picker',
          dataIndex: 'val1',
          label: '出库时间',
          defaultValue: ''
          dataIndex: 'incomeTimeStart',
          label: '入库时间',
          defaultValue: '',
        },
        {
          type: 'date-picker',
          dataIndex: 'val2',
          dataIndex: 'incomeTimeEnd',
          label: '至',
          defaultValue: ''
          defaultValue: '',
        },
        // {
        //   type: 'select',
        //   dataIndex: 'status',
        //   label: '状态',
        //   placeholder: '请选择',
        //   defaultValue: '1',
        //   options: [
        //     {
        //       label: '启用',
        //       value: '1'
        //     },
        //     {
        //       label: '禁用',
        //       value: '0'
        //     }
        //   ]
        // }
      ],
      proData: [
        {
          order_no:'55555',
          customer_name:'666',
          data:[
            {
              order_no:'石勒芬褐色碳粉',
              customer_name:'20件'
            },
            {
              order_no:'石勒芬褐色碳粉',
              customer_name:'666'
            },
          ]
        },
        {
          order_no:'55555',
          customer_name:'666',
          data:[
            {
              order_no:'石勒芬褐色碳粉',
              customer_name:'666'
            },
            {
              order_no:'石勒芬褐色碳粉',
              customer_name:'666'
            },
            {
              order_no:'石勒芬褐色碳粉',
              customer_name:'666'
            },
            {
              order_no:'石勒芬褐色碳粉',
              customer_name:'666'
            },
            {
              order_no:'石勒芬褐色碳粉',
              customer_name:'666'
            },
          ]
        },
        {
          order_no:'55555',
          customer_name:'666',
          data:[
            {
              order_no:'石勒芬褐色碳粉',
              customer_name:'20件'
            },
            {
              order_no:'石勒芬褐色碳粉',
              customer_name:'666'
            },
          ]
        },
        {
          order_no:'55555',
          customer_name:'666',
          data:[
            {
              order_no:'石勒芬褐色碳粉',
              customer_name:'20件'
            },
            {
              order_no:'石勒芬褐色碳粉',
              customer_name:'666'
            },
          ]
        },
        {
          order_no:'55555',
          customer_name:'666',
          data:[
            {
              order_no:'石勒芬褐色碳粉',
              customer_name:'20件'
            },
            {
              order_no:'石勒芬褐色碳粉',
              customer_name:'666'
            },
          ]
        },
        {
          order_no:'55555',
          customer_name:'666',
          data:[
            {
              order_no:'石勒芬褐色碳粉',
              customer_name:'20件'
            },
            {
              order_no:'石勒芬褐色碳粉',
              customer_name:'666'
            },
          ]
        },
        {
          order_no:'55555',
          customer_name:'666',
          data:[
            {
              order_no:'石勒芬褐色碳粉',
              customer_name:'20件'
            },
            {
              order_no:'石勒芬褐色碳粉',
              customer_name:'666'
            },
          ]
        }
      ],
      // 树数据
      treeDataList: [],
      // 搜索条件
      filterFrom: {
        tenantId: null,
        userName: null,
        userPhone: null,
        status: 1
      },
      // 导入
      importSetting: {
          dialogTitle: '导入',
          dialogShow: false,
          fileSettings: {
              data: {},
              uploadUrl: getBaseUrl()+"/pc/fin/sys/tenant/import", // 上传地址
              accept: '.xls', // 格式
              type: 'text', // 回显形式
              loading: false // 导入效果
          },
          /* 模板下载 */
          templateSettings: {
              templateName: '导入模板.xls', // 名称
              templateUrl: SettingIplatform.apiBaseURL + '/pc/fin/sys/tenant/getImportTemplate' // 下载地址
          },
          onSuccess: null
        dialogTitle: '导入',
        dialogShow: false,
        fileSettings: {
          data: {},
          uploadUrl: getBaseUrl() + '/pc/fin/sys/tenant/import', // 上传地址
          accept: '.xls', // 格式
          type: 'text', // 回显形式
          loading: false, // 导入效果
        },
        /* 模板下载 */
        templateSettings: {
          templateName: '导入模板.xls', // 名称
          templateUrl: SettingIplatform.apiBaseURL + '/pc/fin/sys/tenant/getImportTemplate', // 下载地址
        },
        onSuccess: null,
      },
      editSetting: {
        title: '',
        id: '',
        orgId: '',
        show: false,
      },
    }
  },
  computed: {
    clientHeight () {
      return document.documentElement.clientHeight
    },
  },
  created() {
    };
  },
  methods: {
    handleSizeChange(){},
    handleCurrentChange(){},
    fetchData() {
      this.loading = true;
      procureList({
        pageNum: this.pageNum,
        pageSize: this.pageSize,
        ...this.filterFrom,
      }).then((res) => {
        this.list = res.datas;
        this.total = res.totalRows;
        this.loading = false;
        console.log(this.list);
      });
    },
    //导入
    importOrg() {
        this.importSetting.dialogShow = true
        this.importSetting.onSuccess = (response, callBack) => {
            if (response.code===1){
              this.$message.success(response.msg)
              this.search(1)
            }else{
              this.$message.warning(response.msg)
            }
            callBack()
      this.importSetting.dialogShow = true;
      this.importSetting.onSuccess = (response, callBack) => {
        if (response.code === 1) {
          this.$message.success(response.msg);
          this.search(1);
        } else {
          this.$message.warning(response.msg);
        }
        callBack();
      };
    },
    addtable() {
      this.adddialog = true
    // 入库
    handleIncome(row) {
      this.$confirm(`您确定 单号:${row.businessFormCode}  入库吗?`, '采购入库').then(() => {
        procureIncome({ id: row.id })
          .then((res) => {
            this.$message.success('入库成功!');
            this.search();
          })
          .catch(() => {});
      });
    },
    // 查询table列表
    search(pageNum) {
      if (pageNum != undefined) {
        // this.$refs.myTable.search(pageNum)
      } else {
        // this.$refs.myTable.search()
      }
    del(row) {
      this.$modal.confirm('是否确认删除入库单号为"' + row.businessFormCode + '"的数据吗?').then( () => {
        procureDel({ id: row.id })
          .then((res) => {
            this.$message.success('删除成功!');
            this.search();
          })
          .catch(() => {});
      });
    },
    fifterForm(params) {
      console.log(params,'555');
      this.filterFrom = Object.assign(this.filterFrom, params)
      this.search(1)
    }
  }
}
      this.filterFrom = Object.assign(this.filterFrom, params);
      if (this.filterFrom.incomeTimeStart) {
        this.filterFrom.incomeTimeStart = this.filterFrom.incomeTimeStart.replace(/\-/g, '');
      }
      if (this.filterFrom.incomeTimeEnd) {
        this.filterFrom.incomeTimeEnd = this.filterFrom.incomeTimeEnd.replace(/\-/g, '');
      }
      if (this.filterFrom.agencyId && this.filterFrom.agencyId.length) {
        this.filterFrom.agencyId = this.filterFrom.agencyId[this.filterFrom.agencyId.length - 1];
      }
      this.search(1);
    },
  },
};
</script>
<style scoped>
.card {
    display: flex;
    flex-wrap: wrap;
    margin: 0px !important;
    .cm-item {
        width: 100%;
    }
    .cm-item /deep/ .el-card__body {
        padding: 10px;
    }
}
.card-data{
  margin-top: 8px;
  .card-container{
    display: inline-block;
    width: 70%;
    .hed-one{
      color: #2298EE;
      font-size: 18px;
    }
    .one-hed{
      margin-top: 15px;
      .box{
        display: inline-block;
        margin-right: 20px;
      }
    }
    .span-two{
      color: #83919e;
      font-size: 14px;
    }
    .card-end{
      font-size: 14px;
      color: #3d3d3d;
      margin-top: 15px;
      display: flex;
      flex-wrap: wrap;
      .two-end{
        width: calc(33.33% - 20px);
        margin-bottom: 15px;
      }
    }
  }
  .card-but{
    display: inline-block;
  }
  .end{
    display: inline-block;
  }
}
<style scoped lang="scss">
@import url(../../../../styles/store.scss);
</style>
admin-web/src/views/foundation/material/index.vue
@@ -164,7 +164,7 @@
          {title: '分类', field: 'categoryName', align: 'center'},
          {title: '类别', field: 'classification', align: 'center'},
          // {title: '采购类型', field: 'categoryId', align: 'center'},
          {title: '所属机构', field: '', align: 'center'},
          {title: '所属机构', field: 'agencyName', align: 'center'},
          {
            title: '创建时间',
            field: 'createDate',
admin-web/src/views/foundation/store/edit.vue
@@ -41,6 +41,7 @@
import winSm from '@/components/win/win-sm';
import myButton from '@/components/myButton/myButton';
import * as finsystenant from '@/api/baseSetting/finsystenant';
import { findParentIds } from '@/utils/index';
export default {
  components: { winSm, myButton },
@@ -92,7 +93,7 @@
      finsystenant.getTree().then((res) => {
        if (res) {
          this.treeList = res;
          this.$set(this.formData,'agencyIds',this.findParentIds(this.treeList,this.formData.agencyId))
          this.$set(this.formData,'agencyIds',findParentIds(this.treeList,this.formData.agencyId))
        }
      });
    },
@@ -134,41 +135,6 @@
          this.$message.error('校验未通过,请检查。');
        }
      });
    },
    // 通过子集id查到所以相关父级id并返回数组
    findParentIds(dataSource, nodeId) {
      const parentIds = [nodeId]; // 用于存储所有父节点ID的数组
      // 定义一个递归函数,用于遍历整棵树并查找子节点的所有父节点
      function traverse(node, nodeId) {
        if (node.id === nodeId) {
          // 如果当前节点的ID等于子节点的ID,则表示已经找到了子节点,可以开始向上查找父节点
          return true; // 返回true表示已经找到了子节点
        }
        if (node.children) {
          // 如果当前节点有子节点,则继续遍历子节点
          for (const childNode of node.children) {
            if (traverse(childNode, nodeId)) {
              // 如果在子节点中找到了子节点的父节点,则将当前节点的ID添加到父节点ID数组中,并返回true表示已经找到了子节点
              parentIds.unshift(node.id);
              return true;
            }
          }
        }
        return false; // 如果当前节点不是子节点的父节点,则返回false
      }
      // 从根节点开始遍历整棵树,并调用递归函数查找子节点的所有父节点
      for (const node of dataSource) {
        if (traverse(node, nodeId)) {
          // 如果在当前节点的子树中找到了子节点的父节点,则直接退出循环
          break;
        }
      }
      return parentIds; // 返回所有父节点ID的数组
    },
  },
};
admin-web/src/views/foundation/store/index.vue
@@ -15,6 +15,7 @@
          </el-row>
          <!--添加/编辑弹窗-->
          <edit v-if="editSetting.show" :setting="editSetting" @close="editSetting.show = false" @search="search"/>
          <person v-if="personSetting.show" :setting="personSetting" @close="personSetting.show = false" @search="search"/>
        </el-card>
      </el-container>
    </el-container>
@@ -31,13 +32,14 @@
import MyButton from "@/components/myButton/myButton";
import SettingIplatform from '@/utils/settingIplatform';
import edit from './edit'
import person from './person'
import * as finsystenant from '@/api/baseSetting/finsystenant'
import myImport from '@/views/components/myImport'
import {getBaseUrl} from '@/utils/base';
export default {
  name: "index",
  components: {MyButton, MyTableV2, edit, myImport},
  components: {MyButton, MyTableV2, edit, myImport, person},
  data() {
    return {
      // 搜索框
@@ -95,6 +97,12 @@
          onSuccess: null
      },
      editSetting: {
        title: '',
        id: '',
        orgId: '',
        show: false,
      },
      personSetting: {
        title: '',
        id: '',
        orgId: '',
@@ -161,7 +169,7 @@
        // 操作信息
        operation: {
          show: true, // 显示操作列
          width: '150', // 列宽
          width: '250', // 列宽
          attr: [
            {
              title: '编辑',
@@ -175,12 +183,13 @@
                this.del(row);
              },
            },
            // {
            //   title: '仓库员',
            //   events: (row) => {
            //     this.showAudit(row);
            //   },
            // }
            {
              title: '库管员',
              type:'primary',
              events: (row) => {
                this.showPerson(row);
              },
            }
          ],
        },
        paging: {
@@ -270,6 +279,12 @@
      this.editSetting.title = '编辑';
      this.editSetting.show = true;
    },
    showPerson(row) {
      this.personSetting.id = row.id;
      this.personSetting.info = JSON.stringify(row);
      this.personSetting.title = '选择库管员';
      this.personSetting.show = true;
    },
    nodeClick(param) {
      param = param || {}
      this.p = Object.assign({}, {
admin-web/src/views/foundation/store/person.vue
New file
@@ -0,0 +1,215 @@
<template>
  <win-md :title="setting.title" @close="close" :width="'800px'">
    <div class="section-container">
      <div class="section-left">
        <div class="header-row"><span class="title">选择人员:</span></div>
        <div class="section-body">
          <el-tree ref="tree" :data="treeData" node-key="id" :props="defaultProps" default-expand-all>
            <template slot-scope="{ node, data }">
              <div v-if="data.type != 'user'">{{ data.name }}</div>
              <div v-else class="leaf-node" :class="data.checked ? 'checked' : ''" @click="handleCheckItem(node, data)">
                {{ data.name }}
              </div>
            </template>
          </el-tree>
        </div>
      </div>
      <div class="section-right">
        <div class="header-row">
          <span class="title">已选:</span>
          <span class="btn" @click="handleClear">清空</span>
        </div>
        <div class="section-body">
          <div class="section-item" v-for="(item, index) in selectdSections" :key="index">
            <span class="label">{{ item.name }}</span>
            <span class="btn del-btn" @click="handleDel(item)">删除</span>
          </div>
        </div>
      </div>
    </div>
    <div slot="footer" align="center" class="dialog-footer">
      <my-button name="取消" site="form" @click="close" />
      <my-button name="保存" site="form" @click="save" />
    </div>
  </win-md>
</template>
<script>
import { departmentListAll } from '@/api/system/deptment';
import { userSelectDepartment, warehouseManagerAdd, warehouseManagerList } from '@/api/foudation/store';
import winMd from '@/components/win/win-md';
import myButton from '@/components/myButton/myButton';
import * as finsystenant from '@/api/baseSetting/finsystenant';
export default {
  name: 'person',
  components: { winMd, myButton },
  props: {
    setting: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    return {
      selectdSections: [],
      treeData: [],
      formData: {},
      defaultProps: {
        children: 'children',
        label: 'name',
      },
    };
  },
  computed: {
    checkedKeys() {
      return this.selectdSections.map((v) => v.id);
    },
  },
  created() {
    console.log(this.setting);
    if (this.setting.info) {
      this.formData = Object.assign({}, JSON.parse(this.setting.info));
    }
    this.initTree();
    warehouseManagerList({ warehouseId: this.formData.id }).then((res) => {
      console.log(res);
    });
  },
  methods: {
    initTree() {
      userSelectDepartment({ agencyId: this.formData.agencyId }).then((res) => {
        this.treeData = [res];
      });
    },
    handleCheckItem(node, data) {
      this.selectdSections = [];
      this.treeData[0].children.forEach((item, index) => {
        if (item.children) {
          item.children.forEach((child, childIndex) => {
            if (child.id == data.id) {
              this.$set(this.treeData[0].children[index].children[childIndex], 'checked', !child.checked);
            }
            if (child.checked) {
              this.selectdSections.push(child);
            }
          });
        }
      });
      console.log(this.treeData);
    },
    handleDel(item) {
      this.handleCheckItem({}, item);
    },
    handleClear() {
      this.selectdSections.forEach((item) => {
        this.handleCheckItem({}, item);
      });
      this.selectdSections = [];
    },
    close() {
      this.$emit('close');
    },
    save() {
      let params = [];
      this.selectdSections.forEach((item) => {
        params.push({
          managerId: item.id,
          managerName: item.name,
          baseWarehouseId: this.setting.id,
        });
      });
      debugger;
      warehouseManagerAdd(params).then((res) => {
        if (res) {
          this.$message.success('保存成功!');
          this.close();
          this.$emit('search');
        } else {
          this.$message.error('保存失败');
        }
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.section-container {
  height: 400px;
  display: flex;
  justify-content: space-between;
  ::v-deep {
    .el-tree-node__expand-icon.is-leaf {
      display: none;
    }
  }
}
.section-left,
.section-right {
  width: calc((100% - 20px) / 2);
  height: 100%;
  border: 1px solid #dcdfe6;
  padding: 10px;
  box-sizing: border-box;
  border-radius: 4px;
  overflow-y: auto;
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  .title {
    color: #3d3d3d;
    font-size: 14px;
    font-style: normal;
    font-weight: 400;
  }
}
.section-body {
  margin-top: 20px;
}
.section-right {
  .btn {
    display: inline-block;
    width: 44px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    flex-shrink: 0;
    border-radius: 4px;
    color: #0d997c;
    border: 1px solid #0d997c;
    background: rgba($color: #0d997c, $alpha: 0.1);
    cursor: pointer;
  }
  .del-btn {
    color: #f9675b;
    border: 1px solid #f9675b;
    background: rgba($color: #f9675b, $alpha: 0.1);
  }
  .section-item {
    width: 44%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
  }
}
.leaf-node {
  width: 100%;
  height: 26px;
  line-height: 26px;
  padding-left: 10px;
  &:hover {
    background: #f5f7fa;
  }
}
.checked {
  width: 100%;
  background: #f5f7fa;
  height: 26px;
  line-height: 26px;
  box-sizing: border-box;
}
</style>
admin-web/src/views/stock/accessStock/outbound/detail.vue
@@ -59,7 +59,7 @@
        </el-table-column>
        <el-table-column prop="counts" label="金额" align="center">
          <template slot-scope="scope">
            {{ (scope.row.price * scope.row.counts).toFixed(2) }}
            {{ scope.row.price * scope.row.counts | formatPrice}}
          </template>
        </el-table-column>
      </el-table>
@@ -99,6 +99,9 @@
      if (!time) return;
      return DateFormatter.LongToDateTime(time);
    },
    formatPrice(price) {
      return price / 100
    }
  },
  created() {
    outputDetail({ id: this.setting.id }).then((res) => {
admin-web/src/views/stock/accessStock/outbound/edit.vue
@@ -1,12 +1,17 @@
<template>
  <win-md class="stock-edit" :title="`${setting.title}出库出库`" @close="close" :width="'800px'">
  <win-md class="stock-edit" :title="`${setting.title}出库`" @close="close" :width="'800px'">
    <el-form class="form" ref="ruleForm" :model="formData" :rules="rules" label-width="120px">
      <div class="main-w">
        <el-row :gutter="24" class="headerHeight">
          <el-col :span="12">
            <el-form-item label="出库仓库" prop="warehouseId">
              <el-select v-model="formData.warehouseId" placeholder="请选择" style="width: 100%">
                <el-option v-for="item in warehouseOptions" :key="item.id" :label="item.warehouseName" :value="item.id" />
                <el-option
                  v-for="item in warehouseOptions"
                  :key="item.id"
                  :label="item.warehouseName"
                  :value="item.id"
                />
              </el-select>
            </el-form-item>
          </el-col>
@@ -118,7 +123,7 @@
              </template>
            </el-table-column>
            <el-table-column prop="price" label="现有库存" align="center">
              <template slot-scope="scope">{{  }}
              <template slot-scope="scope">
                {{ scope.row.worehouseCount }}
              </template>
            </el-table-column>
@@ -130,11 +135,11 @@
                  :prop="`goods[${goodsIndex}].models[${scope.$index}].counts`"
                  :rules="rules.counts"
                >
                <el-input
                  type="number"
                  v-model="scope.row.counts"
                  @change="countsChange($event, goodsIndex,scope.$index)"
                ></el-input>
                  <el-input
                    type="number"
                    v-model="scope.row.counts"
                    @change="countsChange($event, goodsIndex, scope.$index)"
                  ></el-input>
                </el-form-item>
              </template>
            </el-table-column>
@@ -173,17 +178,15 @@
  goodsTemplate,
  goodsModel,
  selectTenantWarehouse,
  warehouseSelectNumber,
} from '@/api/baseSetting/finsystenant';
import {
  outputAdd,
  outputSelectNumber
} from '@/api/stock/accessStock';
import { outputAdd } from '@/api/stock/accessStock';
import { getTree } from '@/api/foudation/classification';
import MyButton from '@/components/myButton/myButton';
import winMd from '@/components/win/win-md';
import upload from '@/components/upload/index';
import { getUploadUrl } from '@/utils/base';
import {mapGetters} from 'vuex'
import { mapGetters } from 'vuex';
export default {
  components: { MyButton, winMd, upload },
@@ -201,7 +204,7 @@
        return callback(new Error('请选择'));
      }
      let temp = this.formData.goods.filter((v) => v.baseGoodsTemplateId == value);
      if (!temp || temp.length!=1) {
      if (!temp || temp.length != 1) {
        return callback(new Error('已选过此物品'));
      }
      callback();
@@ -257,8 +260,8 @@
      },
    };
  },
  computed:{
    ...mapGetters(['userInfo'])
  computed: {
    ...mapGetters(['userInfo']),
  },
  created() {
    this.init();
@@ -275,10 +278,10 @@
    // 获取出库仓库列表
    getWarehouseList() {
      selectTenantWarehouse({agencyId:this.userInfo.tenantId})
      selectTenantWarehouse({ agencyId: this.userInfo.tenantId })
        .then((res) => {
          this.warehouseOptions = res
          if(res.length) {
          this.warehouseOptions = res;
          if (res.length) {
            this.formData.goods.push(JSON.parse(JSON.stringify(this.goodsItem)));
          }
          if (this.warehouseOptions.length && !this.formData.warehouseId) {
@@ -371,12 +374,18 @@
    async modelChange(e, index) {
      let arr = [...this.formData.goods[index].models];
      let str = JSON.stringify(arr);
      for(let item of e) {
      for (let item of e) {
        if (str.indexOf(item) == -1) {
          let temp = this.goodsModelAll.find((v) => v.id == item);
          // 获取库存
          let num = await outputSelectNumber({warehouseId:this.formData.warehouseId,baseGoodsModelsId:item})
          arr.push({ ...this.modelsItem, baseGoodsModelsId: item, unit: temp.unit,worehouseCount: num});
          let num = await warehouseSelectNumber({
            warehouseId: this.formData.warehouseId,
            baseGoodsModelsId: item,
            warehouseType: 0,
            states: 1,
            buyType: null,
          });
          arr.push({ ...this.modelsItem, baseGoodsModelsId: item, unit: temp.unit, worehouseCount: num });
        }
      }
      this.formData.goods[index].models = arr;
@@ -391,8 +400,8 @@
    // 上传
    uploadChange() {
      let arr = this.$refs.uploadRef.fileList
      this.formData.procureDoc = JSON.stringify(arr)
      let arr = this.$refs.uploadRef.fileList;
      this.formData.procureDoc = JSON.stringify(arr);
    },
    // 点击新增物品
@@ -406,16 +415,16 @@
    },
    // 出库数量校验
    countsChange(e, goodsIndex,index) {
      const curItem = this.formData.goods[goodsIndex].models[index]
      const worehouseCount = curItem.worehouseCount
    countsChange(e, goodsIndex, index) {
      const curItem = this.formData.goods[goodsIndex].models[index];
      const worehouseCount = curItem.worehouseCount;
      if (e == 0) {
        this.$message.warning('数额不能为0');
        curItem.counts = null
        curItem.counts = null;
      }
      if (e > worehouseCount) {
        this.$message.warning('数额超过现有库存');
        curItem.counts = worehouseCount > 0 ? worehouseCount : null
        curItem.counts = worehouseCount > 0 ? worehouseCount : null;
      }
    },
@@ -424,16 +433,16 @@
      this.$refs['ruleForm'].validate((valid) => {
        if (valid) {
          console.log('this.formData', this.formData);
            outputAdd(this.formData)
              .then((res) => {
                this.$message.success('保存成功!');
                this.close();
                this.$emit('search');
              })
              .catch((err) => {
                console.log('edit err', err);
                this.$message.error('保存失败');
              });
          outputAdd(this.formData)
            .then((res) => {
              this.$message.success('保存成功!');
              this.close();
              this.$emit('search');
            })
            .catch((err) => {
              console.log('edit err', err);
              this.$message.error('保存失败');
            });
        } else {
          this.$message.error('校验未通过,请检查。');
        }
admin-web/src/views/stock/inventorycount/inventorytask/edit.vue
@@ -3,26 +3,25 @@
    <el-form ref="ruleForm" :model="formData" :rules="rules" class="demo-ruleForm" label-width="100px">
      <el-form-item label="盘点单名" prop="businessFormName">
        <el-input
          disabled
          v-model="formData.businessFormName"
          clearable
          maxlength="20"
          show-word-limit
          style="width: 100%"
          placeholder="请输入"
        />
      </el-form-item>
      <el-form-item label="盘点仓库" prop="warehouseName">
      <el-form-item label="盘点仓库" prop="warehouseId">
        <el-select v-model="formData.warehouseId" placeholder="请选择" style="width: 100%">
          <el-option v-for="item in warehouseOptions" :key="item.id" :label="item.warehouseName" :value="item.id" />
        </el-select>
      </el-form-item>
      <el-form-item label="盘点人" prop="operatorName">
        <el-select v-model="formData.warehouseId" placeholder="请选择" style="width: 100%">
      <el-form-item label="盘点人" prop="operatorId">
        <el-select v-model="formData.operatorId" placeholder="请选择" style="width: 100%">
          <el-option v-for="item in operatorOptions" :key="item.id" :label="item.warehouseName" :value="item.id" />
        </el-select>
      </el-form-item>
      <el-form-item label="监盘人" prop="operatorName2">
        <el-select v-model="formData.warehouseId" placeholder="请选择" style="width: 100%">
      <el-form-item label="监盘人" prop="operatorId2">
        <el-select v-model="formData.operatorId2" placeholder="请选择" style="width: 100%">
          <el-option v-for="item in operatorOptions" :key="item.id" :label="item.warehouseName" :value="item.id" />
        </el-select>
      </el-form-item>
@@ -46,9 +45,10 @@
<script>
import { selectTenantWarehouse } from '@/api/baseSetting/finsystenant';
import { inventoryAdd, inventoryEdit } from '@/api/stock/inventory';
import winSm from '@/components/win/win-sm';
import myButton from '@/components/myButton/myButton';
import * as finsystenant from '@/api/baseSetting/finsystenant';
import {formatDate} from '@/utils/DateFormatter'
export default {
  components: { winSm, myButton },
@@ -64,25 +64,25 @@
      checkedList: [],
      warehouseOptions: [], // 仓库列表
      operatorOptions:[],
      formData: {
        code: '',
        name: '',
        status: true,
        summary: '',
      },
      formData: {},
      rules: {
        businessFormName: [{ required: true, message: '请输入机构编号', trigger: 'blur' }],
        warehouseName: [{ required: true, message: '请选择', trigger: 'blur' }],
        operatorName: [{ required: true, message: '请选择', trigger: 'blur' }],
        operatorName2: [{ required: true, message: '请选择', trigger: 'blur' }],
        businessFormName: [{ required: true, message: '请输入', trigger: 'blur' }],
        warehouseId: [{ required: true, message: '请选择', trigger: 'blur' }],
        operatorId: [{ required: true, message: '请选择', trigger: 'blur' }],
        operatorId2: [{ required: true, message: '请选择', trigger: 'blur' }],
      },
    };
  },
  created() {
    if (this.setting.info) {
      this.formData = Object.assign({}, JSON.parse(this.setting.info));
    }else {
      this.formData.businessFormName = formatDate(new Date(),'yyyy年MM月份盘点')
    }
    this.handleSelectTenantWarehouse();
    let temp =
    this.formData.operatorId = '1109327915216504'
    this.formData.operatorId2 = '10990356630810'
  },
  methods: {
    // 获取仓库列表
@@ -101,7 +101,7 @@
          const params = Object.assign({}, this.formData);
          if (this.setting.id) {
            // 编辑接口
            finsystenant.edit(params).then((res) => {
            inventoryEdit(params).then((res) => {
              if (res) {
                this.$message.success('保存成功!');
                this.close();
@@ -111,8 +111,7 @@
              }
            });
          } else {
            params.orgId = this.setting.orgId;
            finsystenant.add(params).then((res) => {
            inventoryAdd(params).then((res) => {
              if (res) {
                this.$message.success('保存成功!');
                this.close();
admin-web/src/views/stock/inventorycount/inventorytask/index.vue
@@ -42,6 +42,7 @@
import myImport from '@/views/components/myImport';
import { getBaseUrl } from '@/utils/base';
import { selectTenantWarehouse } from '@/api/baseSetting/finsystenant';
import {inventoryListApi} from '@/api/stock/inventory'
export default {
  name: 'index',
@@ -128,7 +129,7 @@
      table: {
        showIndex: true, // 是否显示序号
        expand: false, // 是否显示详情数据
        url: SettingIplatform.apiBaseURL + '/pc/fin/sys/tenant/select/list', // 请求地址
        url: SettingIplatform.apiBaseURL + inventoryListApi(), // 请求地址
        // 工具条
        tools: {
          columnsCtrl: {
admin-web/src/views/stock/procure/purchaseOrder/detail.vue
@@ -70,7 +70,7 @@
        </el-table-column>
        <el-table-column prop="price" label="单价" align="center">
          <template slot-scope="scope">
            {{ scope.row.price }}
            {{ scope.row.price | formatPrice }}
          </template>
        </el-table-column>
        <el-table-column prop="counts" label="入库数量" align="center">
@@ -80,7 +80,7 @@
        </el-table-column>
        <el-table-column prop="counts" label="金额" align="center">
          <template slot-scope="scope">
            {{ (scope.row.price * scope.row.counts).toFixed(2) }}
            {{ scope.row.price * scope.row.counts  | formatPrice}}
          </template>
        </el-table-column>
      </el-table>
@@ -140,6 +140,9 @@
      if (!time) return '-';
      return DateFormatter.LongToDateTime(time);
    },
    formatPrice(price) {
      return price / 100
    }
  },
  created() {
    procureDetail({ id: this.setting.id }).then((res) => {
@@ -203,10 +206,4 @@
</script>
<style lang="scss" scoped>
@import url(../../index.scss);
.el-dialog {
  z-index: 1100 !important;
}
>>> .el-dialog {
  z-index: 1100 !important;
}
</style>
admin-web/src/views/stock/procure/purchaseOrder/edit.vue
@@ -68,7 +68,7 @@
                :rules="rules.baseGoodsTemplateId"
              >
                <el-select
                 v-model="goodsItem.baseGoodsTemplateId"
                  v-model="goodsItem.baseGoodsTemplateId"
                  placeholder="请先择物品分类"
                  filterable
                  :disabled="!goodsItem.baseCategoryId"
@@ -131,15 +131,19 @@
                {{ scope.row.unit }}
              </template>
            </el-table-column>
            <el-table-column prop="price" label="单价(元)" align="center">
            <el-table-column prop="priceYuan" label="单价(元)" align="center">
              <template slot-scope="scope">
                <el-form-item
                  label-width="0"
                  style="margin-bottom: 0"
                  :prop="`procureGoods[${goodsIndex}].models[${scope.$index}].price`"
                  :rules="rules.price"
                  :prop="`procureGoods[${goodsIndex}].models[${scope.$index}].priceYuan`"
                  :rules="rules.priceYuan"
                >
                  <el-input type="number" v-model.number="scope.row.price"></el-input>
                  <el-input
                    type="number"
                    v-model.number="scope.row.priceYuan"
                    @change="priceChange($event, goodsIndex, scope.$index)"
                  ></el-input>
                </el-form-item>
              </template>
            </el-table-column>
@@ -218,13 +222,14 @@
        return callback(new Error('请选择'));
      }
      let temp = this.formData.procureGoods.filter((v) => v.baseGoodsTemplateId == value);
      if (!temp || temp.length!=1) {
      if (!temp || temp.length != 1) {
        return callback(new Error('已选过此物品'));
      }
      callback();
    };
    // 金额校验
    var checkPrice = (rule, value, callback) => {
      console.log(value);
      if (!value) {
        return callback(new Error('请输入'));
      }
@@ -236,7 +241,7 @@
    };
    // 数量校验
    var checkCounts = (rule, value, callback) => {
      console.log(value)
      console.log(value);
      if (!value) {
        return callback(new Error('请输入'));
      }
@@ -287,7 +292,8 @@
      },
      modelsItem: {
        baseGoodsModelsId: '', // 规格型号编号
        price: null, // 单价(采购需要,调拨不需要)
        priceYuan: null, // 单价(元)
        price: null, // 单价(分 采购需要,调拨不需要)
        counts: null, // 操作数量
        unit: null, //单位
      },
@@ -300,7 +306,7 @@
        baseCategoryIds: [{ required: true, message: '请选择', trigger: 'change' }],
        baseGoodsTemplateId: [{ validator: checkGoodsTemplateId, trigger: ['blur', 'change'] }],
        modelsIds: [{ required: true, message: '请选择', trigger: 'change' }],
        price: [{ validator: checkPrice, trigger: 'blur' }],
        priceYuan: [{ validator: checkPrice, trigger: 'blur' }],
        counts: [{ validator: checkCounts, trigger: 'blur' }],
      },
@@ -349,6 +355,9 @@
          );
          this.getgoodsTemplate(item.baseCategoryId, index);
          this.getgoodsModel(item.baseGoodsTemplateId, index);
          item.models.forEach((child, childIndex) => {
            this.$set(this.formData.procureGoods[index].models[childIndex], 'priceYuan', child.price / 100);
          });
          return item;
        });
      }
@@ -468,6 +477,11 @@
      this.formData.procureGoods[index].models.splice(delIndex, 1);
    },
    // 价格input监听 转为分
    priceChange(e, goodsIndex, index) {
      this.formData.procureGoods[goodsIndex].models[index].price = e * 100;
    },
    // 上传
    uploadChange() {
      let arr = this.$refs.uploadRef.fileList;
@@ -488,7 +502,8 @@
    handleSubmit() {
      this.$refs['ruleForm'].validate((valid) => {
        if (valid) {
          console.log('this.formData', this.formData);
          console.log('formData', this.formData);
          debugger;
          if (!this.setting.id) {
            procureAdd(this.formData)
              .then((res) => {
admin-web/src/views/stock/procure/receiptDetails/edit.vue
File was deleted
admin-web/src/views/stock/procure/receiptDetails/index.vue
@@ -33,7 +33,7 @@
import SettingIplatform from '@/utils/settingIplatform';
import detail from '../purchaseOrder/detail';
import * as finsystenant from '@/api/baseSetting/finsystenant';
import {goodsModel} from '@/api/stock/procure/purchaseOrder';
import { goodsModel } from '@/api/stock/procure/purchaseOrder';
import myImport from '@/views/components/myImport';
import { getBaseUrl } from '@/utils/base';
@@ -64,7 +64,7 @@
          label: '规格型号',
          placeholder: '请选择',
          defaultValue: '',
          options:[]
          options: [],
        },
        {
          type: 'cascader',
@@ -100,7 +100,7 @@
      // 搜索条件
      filterFrom: {
        tenantId: null,
        agencyId:[],
        agencyId: [],
        status: 1,
      },
      // 导入
@@ -150,9 +150,23 @@
          { title: '单号', field: 'businessFormCode', align: 'center' },
          { title: '物品名称', field: 'goodsTemplateName', align: 'center' },
          { title: '规格型号', field: 'baseGoodsModelsName', align: 'center' },
          { title: '单价', field: 'price', align: 'center' },
          {
            title: '单价',
            field: 'price',
            align: 'center',
            formatter: (row) => {
              return { value: row.price / 100 };
            },
          },
          { title: '入库数量', field: 'counts', align: 'center' },
          { title: '金额', field: 'amount', align: 'center' },
          {
            title: '金额',
            field: 'amount',
            align: 'center',
            formatter: (row) => {
              return { value: row.price / 100 };
            },
          },
          { title: '所属机构', field: 'agencyName', align: 'center' },
          { title: '创建人', field: 'buyerName', align: 'center' },
          {
@@ -193,17 +207,16 @@
  },
  created() {
    // 搜索框规格型号
    goodsModel().then(res=>{
      this.items.forEach(v=>{
        if(v.label=='规格型号'){
          v.options = res.map(item=>{
            item.label = item.modelName,
            item.value = item.id
            return item
          })
    goodsModel().then((res) => {
      this.items.forEach((v) => {
        if (v.label == '规格型号') {
          v.options = res.map((item) => {
            (item.label = item.modelName), (item.value = item.id);
            return item;
          });
        }
      })
    })
      });
    });
  },
  methods: {
    //导入
@@ -247,9 +260,9 @@
        .catch(() => {});
    },
    showDetail(row) {
      this.detailSetting.id=row.businessId
      this.detailSetting.title='详情'
      this.detailSetting.show=true
      this.detailSetting.id = row.businessId;
      this.detailSetting.title = '详情';
      this.detailSetting.show = true;
    },
    // 查询table列表
    search(pageNum) {
@@ -267,7 +280,7 @@
      if (this.filterFrom.incomeTimeEnd) {
        this.filterFrom.incomeTimeEnd = this.filterFrom.incomeTimeEnd.replace(/\-/g, '');
      }
      if (params.agencyId&&params.agencyId.length) {
      if (params.agencyId && params.agencyId.length) {
        this.filterFrom.agencyId = params.agencyId[params.agencyId.length - 1];
      }
      this.search(1);
admin-web/src/views/stock/scrap/itemScrapping/detail.vue
@@ -203,10 +203,4 @@
</script>
<style lang="scss" scoped>
@import url(../../index.scss);
.el-dialog {
  z-index: 1100 !important;
}
>>> .el-dialog {
  z-index: 1100 !important;
}
</style>
admin-web/src/views/stock/transfer/transferApplication/edit.vue
@@ -174,8 +174,8 @@
</template>
<script>
import { transferAdd } from '@/api/stock/transfer';
import { getCategorySelectTree, getTree, goodsTemplate, goodsModel } from '@/api/baseSetting/finsystenant';
import { getParentTenant,queryWarehouseGoods } from '@/api/stock/transfer';
import { getCategorySelectTree, goodsModel, warehouseSelectNumber } from '@/api/baseSetting/finsystenant';
import { getParentTenant, queryWarehouseGoods } from '@/api/stock/transfer';
import MyButton from '@/components/myButton/myButton';
import winMd from '@/components/win/win-md';
import upload from '@/components/upload/index';
@@ -219,7 +219,7 @@
        unit: null, //单位
      },
      rules: {
        warehouseId: [{ required: true, message: '请选择', trigger: 'change' }],
        outAgencyId: [{ required: true, message: '请选择', trigger: 'change' }],
        createTime: [{ required: true, message: '请选择', trigger: 'change' }],
        baseCategoryIds: [{ required: true, message: '请选择', trigger: 'change' }],
@@ -256,14 +256,18 @@
      this.getgoodsTemplate();
      this.getgoodsModel();
      this.getCategoryTree();
      this.formData.transferGoods.push(JSON.parse(JSON.stringify(this.goodsItem)));
    },
    // 获取上级机构
    handegetParentTenant() {
      getParentTenant().then((res) => {
        this.agencyOptions = [res];
        this.formData.outAgencyId = res.id;
        if (res.id != this.userInfo.tenantId) {
          this.agencyOptions = [res];
          this.formData.outAgencyId = res.id;
          this.formData.transferGoods.push(JSON.parse(JSON.stringify(this.goodsItem)));
        }else{
          this.$message.warning('无上级机构')
        }
      });
    },
@@ -340,12 +344,12 @@
    // 物品名称列表选择
    goodsTemplateChange(e, index) {
      let temp = this.formData.transferGoods.find(v=>v.baseGoodsTemplateId==e)
      if(temp) {
        this.$message.warning('已选过此物品')
        return
      }else{
        this.formData.transferGoods[index].baseGoodsTemplateId = e
      let temp = this.formData.transferGoods.find((v) => v.baseGoodsTemplateId == e);
      if (temp) {
        this.$message.warning('已选过此物品');
        return;
      } else {
        this.formData.transferGoods[index].baseGoodsTemplateId = e;
      }
      this.formData.transferGoods[index].modelsOptions = [];
      this.formData.transferGoods[index].modelsIds = [];
@@ -357,15 +361,22 @@
    },
    // 规格型号选择
    modelChange(e, index) {
    async modelChange(e, index) {
      let arr = [...this.formData.transferGoods[index].models];
      let str = JSON.stringify(arr);
      e.forEach((item) => {
      for (let item of e) {
        if (str.indexOf(item) == -1) {
          let temp = this.goodsModelAll.find((v) => v.id == item);
          arr.push({ ...this.modelsItem, baseGoodsModelsId: item, unit: temp.unit });
          let num = await warehouseSelectNumber({
            baseGoodsModelsId: item,
            warehouseType: 0,
            states: 1,
            buyType: 1,
            agencyId: this.formData.outAgencyId,
          });
          arr.push({ ...this.modelsItem, baseGoodsModelsId: item, unit: temp.unit, worehouseCount: num });
        }
      });
      }
      this.formData.transferGoods[index].models = arr;
    },
@@ -395,9 +406,9 @@
    countsChange(e, goodsIndex, index) {
      const curItem = this.formData.transferGoods[goodsIndex].models[index];
      const worehouseCount = curItem.worehouseCount;
      if(e==0) {
      if (e == 0) {
        this.$message.warning('数量不能为0');
        curItem.counts = null
        curItem.counts = null;
      }
      if (e > worehouseCount) {
        this.$message.warning('数量超过现有库存');
@@ -427,11 +438,6 @@
    },
    close() {
      this.formData = {
        warehouseId: '', // 调拨仓库id
        procureTime: '', // 调拨时间
        transferGoods: [],
      };
      this.$emit('close');
    },
  },
admin-web/src/views/stock/transfer/transferApplication/index.vue
@@ -62,9 +62,7 @@
                        <div class="box">
                          <span class="span-two">申请调拨时间:</span>{{ item.createTime | formatTime }}
                        </div>
                        <div class="box">
                          <span class="span-two">接收时间:</span>{{ item.inTime | formatTime }}
                        </div>
                        <div class="box"><span class="span-two">接收时间:</span>{{ item.inTime | formatTime }}</div>
                      </div>
                      <div class="one-hed">
                        <div class="box"><span class="span-two">调拨机构:</span>{{ item.outAgencyName }}</div>
@@ -158,24 +156,6 @@
          defaultValue: '',
        },
        {
          type: 'cascader',
          dataIndex: 'outAgencyId',
          label: '调拨机构',
          placeholder: '请选择',
          optionsConfig: { url: commonsApi.cascader_tree_fin_tenant, props: null },
          defaultValue: '',
          options: [],
        },
        {
          type: 'cascader',
          dataIndex: 'inAgencyId',
          label: '接收机构',
          placeholder: '请选择',
          optionsConfig: { url: commonsApi.cascader_tree_fin_tenant, props: null },
          defaultValue: '',
          options: [],
        },
        {
          type: 'select',
          dataIndex: 'states',
          label: '状态',
@@ -208,14 +188,13 @@
          defaultValue: '',
        },
      ],
      filterFrom:{
      }
      filterFrom: {},
    };
  },
  created() {
    this.filterFrom = {
      operatorId:this.userInfo.id
    }
      inAgencyId: this.userInfo.tenantId,
    };
    this.fetchData();
    this.items.map((v) => {
      if (v.label == '状态') {
@@ -238,33 +217,29 @@
        console.log(this.list);
      });
    },
    // 入库
    handleIncome(row) {
      this.$confirm(`您确定 单号:${row.businessFormCode}  调拨出库吗?`, '调拨出库').then(() => {
        transfeIncome({ id: row.id })
          .then((res) => {
            this.$message.success('调拨出库成功!');
            this.search(1);
          })
        transfeIncome({ id: row.id }).then((res) => {
          this.$message.success('调拨出库成功!');
          this.search(1);
        });
      });
    },
    // 导出
    handleExport(row) {
      transferExport({id:row.id}).then(res=>{
      })
      transferExport({ id: row.id }).then((res) => {});
    },
    // 撤销
    handleRevoke(row) {
      this.$confirm(`您确定撤销单号为"${row.businessFormCode}"  的数据吗?`, '撤销').then(() => {
        transferUpdStatus({ id: row.id })
          .then((res) => {
            this.$message.success('撤销成功!');
            this.search(1);
          })
        transferUpdStatus({ id: row.id }).then((res) => {
          this.$message.success('撤销成功!');
          this.search(1);
        });
      });
    },
    fifterForm(params) {
admin-web/src/views/stock/transfer/transferissue/index.vue
@@ -145,15 +145,6 @@
        },
        {
          type: 'cascader',
          dataIndex: 'outAgencyId',
          label: '调拨机构',
          placeholder: '请选择',
          optionsConfig: { url: commonsApi.cascader_tree_fin_tenant, props: null },
          defaultValue: '',
          options: [],
        },
        {
          type: 'cascader',
          dataIndex: 'inAgencyId',
          label: '接收机构',
          placeholder: '请选择',
@@ -197,6 +188,9 @@
    };
  },
  created() {
    this.filterFrom = {
      outAgencyId: this.userInfo.tenantId,
    };
    this.fetchData();
    this.items.map((v) => {
      if (v.label == '状态') {
admin-web/src/views/systemManger/server/user/edit.vue
@@ -11,6 +11,11 @@
      <el-form-item label="当前机构">
        <el-input v-model="setting.tenantName" disabled style="width: 250px"/>
      </el-form-item>
      <el-form-item label="部门" prop="sysDeptId">
        <el-select v-model="formData.sysDeptId">
            <el-option v-for="(item,index) in deptmentOptions" :key="index" :label="item.name" :value="item.id"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="人员姓名" prop="userName">
        <el-input v-model="formData.userName" clearable maxlength="20" show-word-limit style="width: 250px"/>
      </el-form-item>
@@ -66,6 +71,7 @@
    import * as DateFormatter from '@/utils/DateFormatter'
    import * as role from "@/api/system/role";
    import * as user from "@/api/user";
    import {departmentListAll} from "@/api/system/deptment";
    export default {
        components: {winSm, myButton},
@@ -103,6 +109,7 @@
                    label: 'name',
                },
                formData: {
                    sysDeptId:'',
                    userName: '',
                    userCode: '',
                    userPhone: '',
@@ -112,6 +119,9 @@
                    seq: null,
                },
                rules: {
                    sysDeptId: [
                        {required: true, message: '请输入', trigger: 'blur'}
                    ],
                    userName: [
                        {required: true, message: '请输入人员姓名', trigger: 'blur'}
                    ],
@@ -133,6 +143,7 @@
        created() {
            this.getInfo()
            this.getAllRole()
            this.getDeptmentOptions()
        },
        methods: {
            // 获取所有角色
@@ -158,6 +169,11 @@
                    }
                );
            },
            getDeptmentOptions(){
                departmentListAll({tenantId:this.setting.tenantId}).then(res=>{
                    this.deptmentOptions = res
                })
            },
            handleCheckAllChange(val) {
                if (val) {
                    this.checkedList = this.roleOptions.map(x => {
admin-web/src/views/systemManger/server/user/index.vue
@@ -111,7 +111,7 @@
          { title: '用户姓名', field: 'userName', align: 'left' },
          { title: '登录名', field: 'userPhone', align: 'center' },
          { title: '所属机构', field: 'userPhone', align: 'center', width: 150 },
          { title: '部门', field: 'userPhone', align: 'center' },
          { title: '部门', field: 'sysDeptName', align: 'center' },
          {
            field: 'status',
            title: '状态',
admin-web/src/views/systemSetting/department/edit.vue
New file
@@ -0,0 +1,136 @@
<template>
  <win-sm :title="setting.title" @close="close">
    <el-form ref="ruleForm" :model="formData" :rules="rules" class="demo-ruleForm" label-width="100px">
      <el-form-item label="所属机构" prop="tenantIds">
        <el-cascader
          v-model="formData.tenantIds"
          disabled
          :options="treeList"
          :props="{ checkStrictly: true,value: 'id' }"
          style="width: 100%"
        ></el-cascader>
      </el-form-item>
      <el-form-item label="部门名称" prop="name">
        <el-input v-model="formData.name" clearable maxlength="20" show-word-limit style="width: 100%" />
      </el-form-item>
      <el-form-item label="编号" prop="code">
        <el-input v-model="formData.code" clearable maxlength="20" show-word-limit style="width: 100%" />
      </el-form-item>
      <el-form-item label="状态" prop="status">
        <el-radio-group v-model="formData.status">
          <el-radio :label="0">正常</el-radio>
          <el-radio :label="1">禁用</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="顺序" prop="orderNum">
        <el-input-number v-model="formData.orderNum" controls-position="right" :min="0" />
      </el-form-item>
      <el-form-item label="备注" prop="summary">
        <el-input
          type="textarea"
          v-model="formData.summary"
          clearable
          maxlength="20"
          show-word-limit
          style="width: 100%"
        />
      </el-form-item>
    </el-form>
    <div slot="footer" align="center" class="dialog-footer">
      <my-button name="取消" site="form" @click="close" />
      <my-button name="保存" site="form" @click="save" />
    </div>
  </win-sm>
</template>
<script>
import { departmentAdd, departmentEdit, departmentDetail } from '@/api/system/deptment';
import winSm from '@/components/win/win-sm';
import myButton from '@/components/myButton/myButton';
import * as finsystenant from '@/api/baseSetting/finsystenant';
import { findParentIds } from '@/utils/index';
import { mapGetters } from 'vuex';
export default {
  components: { winSm, myButton },
  props: {
    setting: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    return {
      treeList: [],
      formData: {
        tenantIds:[],
        tenantId:'',
        name:'',
        code:'',
        status:0,
        orderNum:1
      },
      rules: {
        name: [{ required: true, message: '请输入', trigger: 'blur' }],
        code: [{ required: true, message: '请输入', trigger: 'blur' }],
      },
    };
  },
  created() {
    console.log(this.setting)
    if (this.setting.info) {
        departmentDetail({id:this.setting.id}).then(res=>{
            this.formData = res
        })
    } else {
      this.formData.tenantId = this.setting.tenantId;
    }
    this.tree_List();
  },
  methods: {
    tree_List() {
      finsystenant.getTree().then((res) => {
        if (res) {
          this.treeList = res;
          this.$set(this.formData, 'tenantIds', findParentIds(this.treeList, this.formData.tenantId));
          console.log(this.formData)
        }
      });
    },
    close() {
      this.$emit('close');
    },
    save() {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          const params = Object.assign({}, this.formData);
          if (this.setting.id) {
            // 编辑接口
            departmentEdit(params).then((res) => {
              if (res) {
                this.$message.success('保存成功!');
                this.close();
                this.$emit('search');
              } else {
                this.$message.error('保存失败');
              }
            });
          } else {
            departmentAdd(params).then((res) => {
              if (res) {
                this.$message.success('保存成功!');
                this.close();
                this.$emit('search');
              } else {
                this.$message.error('保存失败');
              }
            });
          }
        } else {
          this.$message.error('校验未通过,请检查。');
        }
      });
    },
  },
};
</script>
admin-web/src/views/systemSetting/department/index.vue
@@ -2,88 +2,14 @@
  <div class="app-container">
    <!--左侧树形开始-->
    <el-col :span="5">
        <el-card class="box-card" shadow="never">
          <my-tree ref="searchTree" :tree-list="treeDataList" @setNode="nodeClick" @search="search"></my-tree>
        </el-card>
      </el-col>
      <!--左侧树形结束-->
      <!--右侧列表开始-->
      <el-card class="box-card" shadow="never">
        <my-tree ref="searchTree" :tree-list="treeDataList" @setNode="nodeClick" @search="search"></my-tree>
      </el-card>
    </el-col>
    <!--左侧树形结束-->
    <!--右侧列表开始-->
    <el-container>
      <el-card class="box-card" style="width: 100%" shadow="never">
<!--      <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">-->
<!--        <el-form-item label="字典名称" prop="dictName">-->
<!--          <el-input-->
<!--            v-model="queryParams.dictName"-->
<!--            placeholder="请输入"-->
<!--            clearable-->
<!--            style="width: 150px"-->
<!--            @keyup.enter.native="handleQuery"-->
<!--          />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="状态" prop="status">-->
<!--          <el-select-->
<!--            v-model="queryParams.status"-->
<!--            placeholder="请选择"-->
<!--            clearable-->
<!--            style="width: 150px"-->
<!--          >-->
<!--            <el-option-->
<!--              v-for="item in constants.normalOrDisabled"-->
<!--              :key="item.value"-->
<!--              :label="item.label"-->
<!--              :value="item.value"-->
<!--            />-->
<!--          </el-select>-->
<!--        </el-form-item>-->
<!--        <el-form-item>-->
<!--          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>-->
<!--          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>-->
<!--        </el-form-item>-->
<!--      </el-form>-->
<!--      <el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">-->
<!--        <el-table-column type="selection" width="55" align="center" />-->
<!--        <el-table-column label="字典编号" align="center" prop="dict_id" />-->
<!--        <el-table-column label="字典名称" align="center" prop="dict_name" :show-overflow-tooltip="true" />-->
<!--        <el-table-column label="字典类型" align="center" :show-overflow-tooltip="true">-->
<!--          <template slot-scope="scope">-->
<!--            <router-link :to="'/systemSetting/dictdata/data/' + scope.row.dict_id" class="link-type">-->
<!--              <span>{{ scope.row.dict_type }}</span>-->
<!--            </router-link>-->
<!--          </template>-->
<!--        </el-table-column>-->
<!--        <el-table-column label="状态" align="center" prop="status">-->
<!--          <template slot-scope="scope">-->
<!--            <span>{{ scope.row.status == 0? '正常':'禁用' }}</span>-->
<!--          </template>-->
<!--        </el-table-column>-->
<!--        <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />-->
<!--        <el-table-column label="创建时间" align="center" prop="create_time" width="180">-->
<!--          <template slot-scope="scope">-->
<!--            <span>{{ dateTo(scope.row.create_time) }}</span>-->
<!--          </template>-->
<!--          &lt;!&ndash;        <template slot-scope="scope">&ndash;&gt;-->
<!--          &lt;!&ndash;          <span>{{ parseTime(scope.row.create_time) }}</span>&ndash;&gt;-->
<!--          &lt;!&ndash;        </template>&ndash;&gt;-->
<!--        </el-table-column>-->
<!--        <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">-->
<!--          <template slot-scope="scope">-->
<!--            <el-button-->
<!--              size="mini"-->
<!--              type="text"-->
<!--              icon="el-icon-edit"-->
<!--              @click="handleUpdate(scope.row)"-->
<!--              v-hasPermi="['system:dict:edit']"-->
<!--            >修改</el-button>-->
<!--  &lt;!&ndash;          <el-button-->
<!--              size="mini"-->
<!--              type="text"-->
<!--              icon="el-icon-delete"-->
<!--              @click="handleDelete(scope.row)"-->
<!--              v-hasPermi="['system:dict:remove']"-->
<!--            >删除</el-button>&ndash;&gt;-->
<!--          </template>-->
<!--        </el-table-column>-->
<!--      </el-table>-->
        <!--搜索条件-->
        <div class="filter-container">
          <my-search ref="searchBar" :items="items" @search="fifterForm"></my-search>
@@ -91,52 +17,28 @@
        <el-row style="margin-top: 8px">
          <el-col>
            <!--列表-->
            <my-table-v2 ref="myTable" :filter="queryParams" :table="table"/>
            <my-table-v2 ref="myTable" :filter="filterFrom" :table="table" />
          </el-col>
        </el-row>
      </el-card>
    </el-container>
    <!-- 添加或修改参数配置对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="字典名称" prop="dictName">
          <el-input v-model="form.dictName" placeholder="请输入字典名称" />
        </el-form-item>
        <el-form-item label="字典类型" prop="dictType">
          <el-input v-model="form.dictType" placeholder="请输入字典类型" />
        </el-form-item>
        <el-form-item label="状态" prop="status">
          <el-radio-group v-model="form.status">
            <el-radio
              v-for="item in constants.normalOrDisabled"
              :key="item.value"
              :label="item.value"
            >{{item.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <edit v-if="editSetting.show" :setting="editSetting" @close="editSetting.show = false" @search="search()" />
  </div>
</template>
<script>
import myTree from '@/components/myTree/index';
import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type";
import * as DateFormatter from "@/utils/DateFormatter";
import MyTableV2 from "@/components/myTable/myTableV2";
import { listType, getType, delType, addType, updateType, refreshCache } from '@/api/system/dict/type';
import * as DateFormatter from '@/utils/DateFormatter';
import MyTableV2 from '@/components/myTable/myTableV2';
import SettingIplatform from '@/utils/settingIplatform';
import items from './items'
import edit from './edit';
import * as finsystenant from '@/api/baseSetting/finsystenant';
export default {
  name: "Dict",
  components: { MyTableV2, myTree },
  name: 'Dict',
  components: { MyTableV2, myTree, edit },
  data() {
    return {
      // 树数据
@@ -157,75 +59,103 @@
      // 字典表格数据
      typeList: [],
      // 弹出层标题
      title: "",
      title: '',
      // 是否显示弹出层
      open: false,
      // 日期范围
      dateRange: [],
      // 查询参数
      queryParams: {
        dictName: undefined,
        dictType: undefined,
        status: 0
      editSetting: {
        title: '',
        id: '',
        show: false,
      },
      items:items,
      filterFrom: {},
      items: [
        {
          type: 'text',
          dataIndex: 'name',
          label: '部门名称',
          placeholder: '请输入',
          defaultValue: '',
        },
        {
          type: 'text',
          dataIndex: 'code',
          label: '编号',
          placeholder: '请输入',
          defaultValue: '',
        },
        {
          type: 'select',
          dataIndex: 'status',
          label: '状态',
          placeholder: '请选择',
          defaultValue: '0',
          options: [
            {
              value: '0',
              label: '启用',
            },
            {
              value: '1',
              label: '禁用',
            },
          ],
        },
      ],
      table: {
        showIndex: true, // 是否显示序号
        expand: false, // 是否显示详情数据
        url: SettingIplatform.apiBaseURL + '/system/dict/type/list', // 请求地址
        url: SettingIplatform.apiBaseURL + '/pc/fin/sys/tenant/department/list', // 请求地址
        // 工具条
        tools: {
          columnsCtrl: {// 列控制按钮
            show: false
          columnsCtrl: {
            // 列控制按钮
            show: false,
          },
          generalExport: {// 通用导出按钮
            show: false
          generalExport: {
            // 通用导出按钮
            show: false,
          },
          // 自定义工具条按钮
          custom: [
          {
            {
              name: '新增',
              click: () => {
                this.showAdd(null);
                this.handleAdd(null);
              },
            },
          ]
          ],
        },
        // 列信息
        columns: [
          {title: '编号', field: 'dict_id', align: 'center', width: '100px'},
          {title: '部门', field: 'dict_name', align: 'left'},
          {title: '顺序号', field: 'dict_name', align: 'left'},
          {title: '备注', field: 'remark', align: 'left', width: '200px'},
          { title: '编号', field: 'code', align: 'center', width: '100px' },
          { title: '部门', field: 'name', align: 'left' },
          { title: '顺序号', field: 'orderNum', align: 'left' },
          { title: '备注', field: 'remark', align: 'left', width: '200px' },
          {
            title: '状态', field: 'status', align: 'center', width: '180px',
            formatter: row => {
              return { value: row.status=== 0? '启用':'禁用'  }
            }
            title: '状态',
            field: 'status',
            align: 'center',
            width: '180px',
            formatter: (row) => {
              return { value: row.status === 0 ? '启用' : '禁用' };
            },
          },
        ],
        // 操作信息
        operation: {
          // width: 150,
          width: 150,
          align: 'center',
          show: false, // 显示操作列
          show: true, // 显示操作列
          attr: [
            // 分类下有正在进行中的项目时,给出提示不允许禁用和删除。且禁用一级分类前需要先禁用下面的所有二级,有启用的二级时不允许禁用一级
            {
              // checkPermission:'system:role:edit',
              title: '修改',
              events: row => {
                this.handleUpdate(row)
              }
              title: '编辑',
              events: (row) => {
                this.showEdit(row);
              },
            },
            // {
            //   // checkPermission: 'system:role:remove',
            //   title: '删除',
            //   events: row => {
            //     this.handleDelete(row)
            //   }
            // },
          ]
          ],
        },
        paging: {
          show: true, // 显示分页
@@ -234,25 +164,14 @@
            small: false,
            pageNum: 1,
            pageSize: 10,
            total: 0
          }
        }
            total: 0,
          },
        },
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        dictName: [
          { required: true, message: "字典名称不能为空", trigger: "blur" }
        ],
        dictType: [
          { required: true, message: "字典类型不能为空", trigger: "blur" }
        ]
      }
    };
  },
  created() {
    this.initTreeData()
    this.initTreeData();
  },
  methods: {
    // 左侧树初始化
@@ -269,137 +188,53 @@
      });
    },
    nodeClick(param) {
      console.log(param,'param');
      this.search(1)
      console.log(param, 'param');
      this.p = Object.assign(
        {},
        {
          id: param.id,
          name: param.name,
        },
      );
      if (this.p.id) {
        this.filterFrom.tenantId = this.p.id;
        this.editSetting.tenantId = this.p.id;
      } else {
        this.filterFrom.tenantId = null;
        this.editSetting.tenantId = null;
      }
      this.search(1);
    },
    fifterForm(params) {
      this.queryParams = Object.assign(this.queryParams, params)
      this.search(1)
      this.filterFrom = Object.assign(this.filterFrom, params);
      this.search(1);
    },
    // 查询table列表
    search(pageNum) {
      if (pageNum != undefined) {
        this.$refs.myTable.search(pageNum)
        this.$refs.myTable.search(pageNum);
      } else {
        this.$refs.myTable.search()
        this.$refs.myTable.search();
      }
    },
    dateTo(val) {
      return DateFormatter.LongToDateTime(val);
    },
    changeSize(e){
      this.queryParams.pageSize = e
      this.getList()
    },
    changePage(e){
      this.queryParams.pageNum = e
      this.getList()
    },
    /** 查询字典类型列表 */
    getList() {
      this.loading = true;
      listType(this.queryParams).then(response => {
          // this.typeList = response.rows;
          this.typeList = response.datas;
          this.total = response.totalRows;
          this.loading = false;
        }
      );
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        dictId: undefined,
        dictName: undefined,
        dictType: undefined,
        status: "0",
        remark: undefined
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加字典类型";
      if (this.editSetting.tenantId) {
        this.editSetting.id = null;
        this.editSetting.info = null;
        this.editSetting.title = '新增';
        this.editSetting.show = true;
      } else {
        this.$message.warning('请先选择左侧机构');
      }
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.dictId)
      this.single = selection.length!=1
      this.multiple = !selection.length
    showEdit(row) {
      console.log(row);
      this.editSetting.id = row.id;
      this.editSetting.info = row;
      this.editSetting.title = '编辑';
      this.editSetting.show = true;
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const dictId = row.dict_id || this.ids
      getType(dictId).then(response => {
        this.form = response;
        this.form.dictName = this.form.dict_name
        this.form.dictType = this.form.dict_type
        this.open = true;
        this.title = "修改字典类型";
      });
    },
    /** 提交按钮 */
    submitForm: function() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.dictId != undefined) {
            updateType(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addType(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const dictIds = row.dictId || this.ids;
      this.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?').then(function() {
        return delType(dictIds);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/dict/type/export', {
        ...this.queryParams
      }, `type_${new Date().getTime()}.xlsx`)
    },
    /** 刷新缓存按钮操作 */
    handleRefreshCache() {
      refreshCache().then(() => {
        this.$modal.msgSuccess("刷新成功");
        this.$store.dispatch('dict/cleanDict');
      });
    }
  }
  },
};
</script>
admin-web/src/views/systemSetting/department/items.js
File was deleted