haoyahui
2023-11-16 94de1745b4b69eeeb1ac8c5d3508ce87258afc25
admin-web/src/views/stock/accessStock/outbound/index.vue
@@ -32,15 +32,15 @@
                        </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.agencyName }}</div>
                        <div class="box"><span class="span-two">操作人:</span>{{ item.operatorName }}</div>
                        <div class="box">
                          <span class="span-two">出库时间:</span>{{ item.procureTime | formatTime }}
                          <span class="span-two">出库时间:</span>{{ item.dealTime | 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 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>
@@ -72,32 +72,24 @@
    </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'
export default {
  name: 'index',
  mixins: [listPage],
  components: { MyButton, myImport, edit, detail },
  data() {
    return {
      loading: false,
      adddialog: false,
      list: [],
      // 搜索框
      items: [
@@ -110,7 +102,7 @@
        },
        {
          type: 'text',
          dataIndex: 'goodsTemplateName',
          dataIndex: 'goodsName',
          label: '物品名称',
          placeholder: '可模糊搜索',
          defaultValue: '',
@@ -126,81 +118,25 @@
        },
        {
          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();
  },
  methods: {
    fetchData() {
@@ -213,101 +149,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);
    },
  },
};