石广澎
2023-11-29 20913c80c3f5fc8e533cb92b90e6f20bcd68e032
admin-web/src/views/stock/accessStock/outbound/index.vue
@@ -12,50 +12,53 @@
            <div class="table-tool-bar" style="margin-bottom: 15px;">
              <my-button name="新增" @click="handleAdd" site="tools" size="medium" />
            </div>
            <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>
                        <div class="card-header-right">
            <div>
              <div :style="{ 'overflow-y': 'auto', height: 'calc(100vh - 352px)' }" 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>
                          <div class="card-header-right">
                            <el-button site="form" type="success" size="mini" @click="handleExport(item)"
                              >导出出库单</el-button
                            >导出出库单</el-button
                            >
                          <el-button name="查看详情" site="form" type="info" size="mini" @click="handleDetail(item)"
                            <el-button name="查看详情" site="form" type="info" size="mini" @click="handleDetail(item)"
                            >查看详情</el-button
                          >
                            >
                          </div>
                        </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 class="one-hed">
                          <div class="box"><span class="span-two">机构:</span>{{ item.agencyName }}</div>
                          <div class="box"><span class="span-two">操作人:</span>{{ item.operatorName }}</div>
                          <div class="box">
                            <span class="span-two">出库时间:</span>{{ item.dealTime | formatTime }}
                          </div>
                        </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 class="card-end">
                          <div v-for="(just, index) in item.formOutputTemplateInfoList" :key="index" class="item">
                            <div class="name">{{ just.goodsName }}</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>
                    </div>
                  </el-card>
                </el-col>
              </el-row>
              <div class="no-data" v-else>暂无数据</div>
                    </el-card>
                  </el-col>
                </el-row>
                <el-empty v-else description="暂无数据"></el-empty>
              </div>
            </div>
            <el-pagination
              :small="false"
              :current-page="pageNum"
@@ -72,32 +75,25 @@
    </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="editSetting.show=false" ref="detailRef"></detail>
    <my-import
      :import-setting="importSetting"
      :dialog-show="importSetting.dialogShow"
      :dialog-title="importSetting.dialogTitle"
    />
    <detail v-if="detailSetting.show" :setting="detailSetting" @close="detailSetting.show=false" ref="detailRef"></detail>
  </div>
</template>
<script>
import { outputList, procureDel, procureIncome } from '@/api/stock/accessStock';
import {outputList} from '@/api/stock/accessStock';
import MyButton from '@/components/myButton/myButton';
import SettingIplatform from '@/utils/settingIplatform';
import myImport from '@/views/components/myImport';
import edit from './edit';
import detail from './detail';
import { getBaseUrl } from '@/utils/base';
import * as DateFormatter from '@/utils/DateFormatter';
import listPage from '../../../mixins/listPage'
import SettingIplatform from '@/utils/settingIplatform';
export default {
  name: 'index',
  mixins: [listPage],
  components: { MyButton, myImport, edit, detail },
  data() {
    return {
      loading: false,
      adddialog: false,
      list: [],
      // 搜索框
      items: [
@@ -109,11 +105,17 @@
          defaultValue: '',
        },
        {
          type: 'text',
          dataIndex: 'goodsTemplateName',
          type: 'select',
          dataIndex: 'goodsTemplateId',
          label: '物品名称',
          placeholder: '可模糊搜索',
          placeholder: '请输入',
          defaultValue: '',
          options: [],
          optionsConfig: {
            label: 'goodsName',
            value: 'id',
            url: SettingIplatform.apiBaseURL + '/pc/base/goods/template/query/goodsTemplate',
          },
        },
        {
          type: 'cascader',
@@ -126,81 +128,28 @@
        },
        {
          type: 'text',
          dataIndex: 'buyerName',
          dataIndex: 'createName',
          label: '创建人',
          placeholder: '请输入',
          defaultValue: '',
        },
        {
          type: 'date-picker',
          dataIndex: 'val1',
          dataIndex: 'startTime',
          label: '出库时间',
          defaultValue: '',
        },
        {
          type: 'date-picker',
          dataIndex: 'val2',
          dataIndex: 'endTime',
          label: '至',
          defaultValue: '',
        },
      ],
      // 树数据
      treeDataList: [],
      // 搜索条件
      filterFrom: {
        tenantId: null,
        userName: null,
        userPhone: null,
        states: null,
      },
      // 导入
      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,
      },
      editSetting: {
        title: '',
        id: '',
        orgId: '',
        show: false,
      },
      detailSetting: {
        title: '详情',
        id: '',
        show: false,
      },
      pageNum: 1,
      pageSize: 10,
      total: 0,
    };
  },
  computed: {
    clientHeight() {
      return document.documentElement.clientHeight;
    },
  },
  filters: {
    formatTime(time) {
      if (!time) return;
      return DateFormatter.LongToDateTime(time);
    },
  },
  created() {
    this.fetchData();
  created(){
    this.fetchData()
  },
  methods: {
    fetchData() {
@@ -213,101 +162,20 @@
        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();
      };
    },
    // 导出
    handleExport() {},
    // 新增
    handleAdd() {
      this.editSetting.id = null;
      this.editSetting.info = null;
      this.editSetting.title = '新增';
      this.editSetting.show = true;
    },
    // 编辑
    handleEdit(row) {
      this.editSetting.id = row.id;
      this.editSetting.info = null;
      this.editSetting.title = '编辑';
      this.editSetting.show = true;
    },
    // 详情
    handleDetail(row) {
      this.detailSetting.id = row.id;
      this.detailSetting.info = JSON.stringify(row);
      this.detailSetting.title = '详情';
      this.detailSetting.show = true;
    },
    // 出库
    handleIncome(row) {
      this.$confirm(`您确定 单号:${row.businessFormCode}  出库吗?`, '出库出库')
        .then(function () {
          procureIncome({ id: row.id }).then((res) => {
            this.$message.success('出库成功!');
            this.search();
          });
        })
        .catch(() => {});
    },
    del(row) {
      this.$modal
        .confirm('是否确认删除出库单号为"' + row.businessFormCode + '"的数据吗?')
        .then(function () {
          procureDel({ id: row.id }).then((res) => {});
        })
        .then((res) => {
          this.$message.success('删除成功!');
          this.search();
        })
        .catch(() => {});
    },
    // 分页
    handleSizeChange(pageSize) {
      this.pageSize = pageSize;
      this.search({ pageNum: 1 });
    },
    handleCurrentChange(pageNum) {
      this.pageNum = pageNum;
      this.search();
    },
    // 查询table列表
    search(pageNum) {
      if(pageNum){
        this.pageNum = pageNum
      }
      this.fetchData();
    },
    refreshData() {
      this.pageNum = 1;
      this.pageSize = 10;
      this.search();
    },
    fifterForm(params) {
      this.filterFrom = Object.assign(this.filterFrom, params);
      if (this.filterFrom.incomeTimeStart) {
        this.filterFrom.incomeTimeStart = this.filterFrom.incomeTimeStart.replace(/\-/g, '');
      if (this.filterFrom.startTime) {
        this.filterFrom.startTime = this.filterFrom.startTime.replace(/\-/g, '');
      }
      if (this.filterFrom.incomeTimeEnd) {
        this.filterFrom.incomeTimeEnd = this.filterFrom.incomeTimeEnd.replace(/\-/g, '');
      if (this.filterFrom.endTime) {
        this.filterFrom.endTime = this.filterFrom.endTime.replace(/\-/g, '');
      }
      if (this.filterFrom.agencyId.length) {
      if (this.filterFrom.agencyId&&this.filterFrom.agencyId.length) {
        this.filterFrom.agencyId = this.filterFrom.agencyId[this.filterFrom.agencyId.length - 1];
      }
      this.search({ pageNum: 1 });
      this.search(1);
    },
  },
};