Browse Source

新增页面

lichao 3 years ago
parent
commit
59d473757c

+ 53 - 0
src/api/officeSupplies/purchaseApply.js

@@ -0,0 +1,53 @@
+import request from '@/router/axios';
+
+// 列表查询
+export function getList(params) {
+  return request({
+    url: '/api/trade-purchase/office-order/list',
+    method: 'get',
+    params
+  })
+}
+// 列表删除
+export function deleteList(data) {
+  return request({
+    url: '/api/trade-purchase/office-order/remove',
+    method: 'post',
+    params: {
+      ids:data
+    }
+  })
+}
+// 详情
+export function dataDetail(data) {
+  return request({
+    url: '/api/trade-purchase/office-order/'+data,
+    method: 'get',
+  })
+}
+// 保存&&修改
+export function typeSave(data) {
+  return request({
+    url: '/api/trade-purchase/office-order/save',
+    method: 'post',
+    data
+  })
+}
+// 明细删除
+export function removeGoods(data) {
+  return request({
+    url: '/api/trade-purchase/office-order-item/remove',
+    method: 'post',
+    params: {
+      ids: data
+    }
+  })
+}
+// 请核
+export function pleaseCheck(data) {
+  return request({
+    url: '/api/trade-purchase/office-order/checkOrder',
+    method: 'post',
+    data: data
+  })
+}

+ 44 - 0
src/api/officeSupplies/requisition.js

@@ -0,0 +1,44 @@
+import request from '@/router/axios';
+// 列表查询
+export function getList(params) {
+  return request({
+    url: '/api/trade-purchase/office-order/list',
+    method: 'get',
+    params
+  })
+}
+// 列表删除
+export function deleteList(data) {
+  return request({
+    url: '/api/trade-purchase/office-order/remove',
+    method: 'post',
+    params: {
+      ids:data
+    }
+  })
+}
+// 详情
+export function dataDetail(data) {
+  return request({
+    url: '/api/trade-purchase/office-order/'+data,
+    method: 'get',
+  })
+}
+// 保存&&修改
+export function typeSave(data) {
+  return request({
+    url: '/api/trade-purchase/office-order/save',
+    method: 'post',
+    data
+  })
+}
+// 明细删除
+export function removeGoods(data) {
+  return request({
+    url: '/api/trade-purchase/office-order-item/remove',
+    method: 'post',
+    params: {
+      ids: data
+    }
+  })
+}

+ 44 - 0
src/api/officeSupplies/warehousing.js

@@ -0,0 +1,44 @@
+import request from '@/router/axios';
+// 列表查询
+export function getList(params) {
+  return request({
+    url: '/api/trade-purchase/office-order/list',
+    method: 'get',
+    params
+  })
+}
+// 列表删除
+export function deleteList(data) {
+  return request({
+    url: '/api/trade-purchase/office-order/remove',
+    method: 'post',
+    params: {
+      ids:data
+    }
+  })
+}
+// 详情
+export function dataDetail(data) {
+  return request({
+    url: '/api/trade-purchase/office-order/'+data,
+    method: 'get',
+  })
+}
+// 保存&&修改
+export function typeSave(data) {
+  return request({
+    url: '/api/trade-purchase/office-order/save',
+    method: 'post',
+    data
+  })
+}
+// 明细删除
+export function removeGoods(data) {
+  return request({
+    url: '/api/trade-purchase/office-order-item/remove',
+    method: 'post',
+    params: {
+      ids: data
+    }
+  })
+}

+ 12 - 0
src/enums/column-name.js

@@ -380,6 +380,18 @@ const columnName = [{
     code: 102,
     name: '销售机会明细'
   },
+  {
+    code: 103,
+    name: '事务交接单列表'
+  },
+  {
+    code: 104,
+    name: '事务交接单明细'
+  },
+  {
+    code: 105,
+    name: '办公用品库存列表'
+  },
 ]
 export const getColumnName = (key) => {
   for (let index = 0; index < columnName.length; index++) {

+ 3 - 0
src/page/index/tags.vue

@@ -363,6 +363,9 @@ export default {
         if (tag.label == "销售订单(I)") {
           this.$store.commit("XSACE_OUT_DETAIL");
         }
+        if (tag.label == "采购申请") {
+          this.$store.commit('OFFICEPUR_OUT_DETAIL');
+        }
         this.$store.commit("DEL_TAG", tag);
         if (tag.value === this.tag.value) {
           tag = this.tagList[key === 0 ? key : key - 1]; //如果关闭本标签让前推一个

+ 1 - 0
src/store/getters.js

@@ -46,5 +46,6 @@ const getters = {
   entranceXsStatus: state => state.ifdetail.entranceXsStatus,
   xsStatus: state => state.ifdetail.xsStatus,
   bjStatus: state => state.ifdetail.bjStatus,
+  officePurchaseStatus: state => state.ifdetail.officePurchaseStatus,
 }
 export default getters

+ 12 - 1
src/store/modules/ifdetail.js

@@ -19,7 +19,8 @@ const ifdetail = {
     entranceCgStatus: false, //进口采购
     entranceXsStatus: false, //进口销售,
     xsStatus: false, //出口销售
-    bjStatus: false //出口报价
+    bjStatus: false, //出口报价
+    officePurchaseStatus: false, // 办公采购
   },
   actions: {},
   mutations: {
@@ -180,6 +181,13 @@ const ifdetail = {
     XSACE_OUT_DETAIL(state) {
       state.entranceXsStatus = false;
     },
+    // 办公采购
+    OFFICEPUR_IN_DETAIL(state) {
+      state.officePurchaseStatus = true;
+    },
+    OFFICEPUR_OUT_DETAIL(state) {
+      state.officePurchaseStatus = false;
+    },
     //关闭所有
     DEL_ALL_DETAIL(state) {
       for (let item in state) {
@@ -251,6 +259,9 @@ const ifdetail = {
       if (tag.label == '销售订单(I)') {
         state.entranceXsStatus = true
       }
+      if (tag.label == '采购申请') {
+        state.officePurchaseStatus = true
+      }
     }
   }
 

+ 51 - 0
src/views/workManagement/handoverSheet/config/customerContact.json

@@ -0,0 +1,51 @@
+{
+  "stripe": true,
+  "searchShow": true,
+  "border": true,
+  "index": true,
+  "viewBtn": false,
+  "editBtn": false,
+  "addBtn": false,
+  "delBtn": false,
+  "align": "center",
+  "menuWidth": 120,
+  "refreshBtn": false,
+  "showSummary": true,
+  "summaryText": "合计",
+  "sumColumnList": [
+  ],
+  "column": [
+    {
+      "label": "证件、票据(种类)名称",
+      "prop": "cname",
+      "index": 1,
+      "width": 200,
+      "cell": true,
+      "overHidden": true
+    },
+    {
+      "label": "数量",
+      "prop": "num",
+      "index": 2,
+      "width": 200,
+      "cell": true,
+      "overHidden": true
+    },
+    {
+      "label": "金额",
+      "prop": "amount",
+      "index": 3,
+      "width": 120,
+      "cell": true,
+      "overHidden": true
+    },
+    {
+      "label": "备注",
+      "prop": "remarks",
+      "index": 4,
+      "width": 120,
+      "cell": true,
+      "overHidden": true
+    }
+  ]
+}

+ 51 - 0
src/views/workManagement/handoverSheet/config/mainList.json

@@ -0,0 +1,51 @@
+{
+  "stripe": true,
+  "height": "auto",
+  "searchShow": true,
+  "border": true,
+  "index": true,
+  "viewBtn": false,
+  "editBtn": false,
+  "delBtn": false,
+  "addBtn": false,
+  "align": "center",
+  "menuWidth": "70",
+  "searchIcon": true,
+  "searchIndex": 2,
+  "selection": true,
+  "tip": false,
+  "searchSpan": 8,
+  "showSummary": true,
+  "summaryText": "合计",
+  "sumColumnList": [],
+  "column": [
+    {
+      "label": "NO.",
+      "prop": "sysNo",
+      "search": true,
+      "index": 1,
+      "minWidth": 80,
+      "overHidden": true
+    },
+    {
+      "label": "客户名称",
+      "prop": "corpName",
+      "search": true,
+      "index": 1,
+      "minWidth": 80,
+      "overHidden": true
+    },
+    {
+      "label": "业务日期",
+      "prop": "b",
+      "type": "date",
+      "overHidden": true,
+      "minWidth": 200,
+      "format": "yyyy-MM-dd",
+      "valueFormat": "yyyy-MM-dd",
+      "unlinkPanels": true,
+      "searchRange": true,
+      "search": true
+    }
+  ]
+}

+ 349 - 0
src/views/workManagement/handoverSheet/detail.vue

@@ -0,0 +1,349 @@
+<template>
+  <div class="borderless" v-loading="pageLoading">
+    <div class="customer-head">
+      <div class="customer-back">
+        <el-button
+          type="danger"
+          style="border: none;background: none;color: red"
+          icon="el-icon-arrow-left"
+          @click="backToList"
+          :loading="btnLoading"
+        >返回列表</el-button>
+      </div>
+      <div class="add-customer-btn">
+        <el-button
+          type="primary"
+          size="small"
+          class="el-button--small-yh"
+          @click.stop="openEdit"
+        >编 辑</el-button>
+        <el-button
+          type="success"
+          :disabled="!form.id"
+          size="small"
+          @click="copyDoc"
+          :loading="btnLoading"
+        >复制单据</el-button>
+        <el-button
+          type="primary"
+          @click="editCustomer"
+          size="small"
+          :loading="btnLoading"
+        >保存数据</el-button>
+      </div>
+    </div>
+    <div class="customer-main">
+      <containerTitle title="基础信息"/>
+      <basic-container :showBtn="true">
+        <avue-form
+          ref="form"
+          class="trading-form"
+          v-model="form"
+          :option="option"
+        >
+          <template slot="corpId">
+            <crop-select
+              v-model="form.corpId"
+              @getCorpData="getKHData"
+              corpType="KH"
+            />
+          </template>
+          <template slot="createUser">
+            <el-select
+              v-model="form.createUser"
+              filterable
+              clearable
+              size="small"
+            >
+              <el-option
+                v-for="(item,index) in userList"
+                :key="index"
+                :label="item.realName"
+                :value="item.realName"
+              ></el-option>
+            </el-select>
+          </template>
+          <template slot="oppositePerson">
+            <el-select
+              v-model="form.oppositePerson"
+              filterable
+              clearable
+              size="small"
+            >
+              <el-option
+                v-for="(item,index) in userList"
+                :key="index"
+                :label="item.realName"
+                :value="item.realName"
+              ></el-option>
+            </el-select>
+          </template>
+        </avue-form>
+      </basic-container>
+      <containerTitle title="详情内容"/>
+      <basic-container>
+        <avue-crud
+          ref="crud"
+          :data="dataList"
+          :option="tableOption"
+          :cell-style="cellStyle"
+          @saveColumn="saveColumn"
+          @resetColumn="resetColumn"
+        >
+          <template slot="menuLeft">
+            <el-button
+              type="primary"
+              icon="el-icon-plus"
+              size="small"
+              @click.stop="newDetails"
+            >录入明细</el-button>
+            <el-button
+              type="info"
+              icon="el-icon-printer"
+              size="small"
+            >报 表</el-button>
+          </template>
+          <template slot="menu" slot-scope="{ row, index }">
+            <el-button
+              size="small"
+              icon="el-icon-edit"
+              type="text"
+              @click="rowCell(row, index)"
+            >{{ row.$cellEdit ? "保存" : "修改" }}</el-button>
+            <el-button
+              size="small"
+              icon="el-icon-delete"
+              type="text"
+              @click="rowDel(row, index)"
+            >删除</el-button>
+          </template>
+        </avue-crud>
+      </basic-container>
+    </div>
+  </div>
+</template>
+
+<script>
+import tableOption from "./config/customerContact.json";
+import {
+  isDiscount,
+  isPercentage,
+  micrometerFormat,
+  IntegerFormat
+} from "@/util/validate";
+import { gainUser } from "@/api/basicData/customerInquiry";
+import {getUserInfo} from "@/api/system/user";
+import {getDeptTree} from "@/api/system/dept";
+import { getCurrentDate } from "@/util/date";
+
+export default {
+  name: "detail",
+  data() {
+    return {
+      pageLoading: false,
+      btnLoading: false,
+      form: {},
+      option: {
+        menuBtn: false,
+        labelWidth: 100,
+        column: [
+          {
+            label: "客户名称",
+            prop: "corpId",
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "change"
+              }
+            ],
+            span: 8,
+            slot: true,
+          },
+          {
+            label: "交接日期",
+            prop: "b",
+            span: 8,
+            type: "date",
+            format: "yyyy-MM-dd",
+            valueFormat: "yyyy-MM-dd 00:00:00",
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "blur"
+              }
+            ]
+          },
+          {
+            label: "NO.",
+            prop: "sysNo",
+            disabled:true,
+            span: 8,
+          },
+          {
+            label: "交接备注",
+            prop: "orderRemark",
+            type: "textarea",
+            minRows: 2,
+            span: 24,
+          },
+        ],
+      },
+      dataList: [],
+      tableOption: {},
+      goodsoptions: [],
+      unitOption: [],
+      selectionList: [],
+      search: {},
+      treeStyle: "height:" + (window.innerHeight - 315) + "px",
+      goodsOption: {},
+      loading: false,
+      switchDialog: false, // 报表弹窗控制
+      userList: [],
+      dic: [],
+      loginUser: '', // 登录人
+    }
+  },
+  async created() {
+    this.$set(this.form, 'b', getCurrentDate()); // 默认当前日期
+    this.tableOption = await this.getColumnData(
+      this.getColumnName(104),
+      tableOption
+    );
+    gainUser().then(res => {
+      this.userList = res.data.data;
+    });
+    getUserInfo().then(res => {
+      this.$set(this.form, 'createUser', res.data.data.realName);
+      this.$set(this.form, 'oppositePerson', res.data.data.realName);
+      this.loginUser = res.data.data.realName;
+    })
+    getDeptTree().then(res => {
+      this.dic = res.data.data
+    })
+    this.getWorkDicts('unit').then(res => {
+      this.unitOption = res.data.data;
+    })
+  },
+  filters: {
+    IntegerFormat(num) {
+      return IntegerFormat(num);
+    },
+    decimalFormat(num) {
+      return num ? Number(num).toFixed(2) : "0.00";
+    }
+  },
+  methods: {
+    //返回列表
+    backToList() {
+      this.$emit("goBack");
+    },
+    // 编辑按钮触发
+    openEdit() {},
+    // 复制
+    copyDoc() {
+      this.$emit("copyOrder", this.form.id);
+    },
+    //修改提交触发
+    editCustomer(status) {
+      this.$refs["form"].validate((valid, done) => {
+        done();
+        if (valid) {
+          // this.btnLoading = true;
+          // typeSave(this.form).then(res => {
+          //   this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
+          //   this.queryData(res.data.data.id);
+          // }).finally(() => {
+          //   this.btnLoading = false;
+          // })
+        } else {
+          return false
+        }
+      })
+    },
+    cellStyle() {
+      return "padding:0;height:40px;";
+    },
+    async saveColumn() {
+      const inSave = await this.saveColumnData(
+        this.getColumnName(104),
+        this.tableOption
+      );
+      if (inSave) {
+        this.$message.success("保存成功");
+        //关闭窗口
+        this.$refs.crud.$refs.dialogColumn.columnBox = false;
+        this.$nextTick(() => {
+          this.$refs.crud.doLayout()
+        })
+      }
+    },
+    async resetColumn() {
+      this.tableOption = tableOption;
+      const inSave = await this.delColumnData(
+        this.getColumnName(104),
+        tableOption
+      );
+      if (inSave) {
+        this.$nextTick(() => {
+          this.$refs.crud.doLayout()
+        })
+        this.$message.success("重置成功");
+        //关闭窗口
+        setTimeout(() => {
+          this.$refs.crud.$refs.dialogColumn.columnBox = false;
+        }, 1000);
+      }
+    },
+    //录入明细
+    newDetails() {
+      this.$refs["form"].validate((valid, done) => {
+        done()
+        if (valid) {
+          this.dataList.push({
+            createTime: getCurrentDate('date'),
+            createUser: this.loginUser,
+            $cellEdit: true,
+          })
+        }
+      })
+    },
+    rowCell(row, index) {
+      if (row.$cellEdit == true) {
+        this.$set(row, "$cellEdit", false);
+      } else {
+        this.$set(row, "$cellEdit", true);
+      }
+    },
+    rowDel(row, index) {
+      this.$confirm("确定删除数据?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        if (row.id) {
+          // removeGoods(row.id).then(res => {
+          //   this.$message({
+          //     type: 'success',
+          //     message: '删除成功!'
+          //   })
+          //   this.dataList.splice(row.$index, 1);
+          // })
+        } else {
+          this.$message({
+            type: "success",
+            message: "删除成功!"
+          });
+          this.dataList.splice(row.$index, 1);
+        }
+      });
+    },
+    getKHData(row) {},
+  },
+}
+</script>
+
+<style scoped>
+
+</style>

+ 249 - 0
src/views/workManagement/handoverSheet/index.vue

@@ -0,0 +1,249 @@
+<template>
+  <div>
+    <basic-container v-show="show" class="page-crad">
+      <avue-crud
+        ref="crud"
+        :option="option"
+        :data="dataList"
+        v-model="form"
+        :page.sync="page"
+        :search.sync="search"
+        :table-loading="loading"
+        :cell-style="cellStyle"
+        @selection-change="selectionChange"
+        @search-change="searchChange"
+        @current-change="currentChange"
+        @size-change="sizeChange"
+        @refresh-change="refreshChange"
+        @on-load="onLoad"
+        @search-criteria-switch="searchCriteriaSwitch"
+        @saveColumn="saveColumn"
+        @resetColumn="resetColumn"
+      >
+        <template slot="menuLeft">
+          <el-button
+            type="primary"
+            icon="el-icon-plus"
+            size="small"
+            @click.stop="newAdd()"
+          >创建单据</el-button>
+          <el-button
+            type="success"
+            size="small"
+            icon="el-icon-plus"
+            @click.stop="copyDoc()"
+            :disabled="selection.length != 1"
+          >复制单据</el-button>
+        </template>
+        <template slot-scope="scope" slot="menu">
+          <el-button
+            type="text"
+            icon="el-icon-delete"
+            size="small"
+            @click.stop="rowDel(scope.row, scope.index)"
+            :disabled="scope.row.status == 3"
+          >删除
+          </el-button>
+        </template>
+        <template slot="corpNameSearch">
+          <crop-select
+            v-model="search.corpId"
+            corpType="KH"
+          ></crop-select>
+        </template>
+        <template slot="createUserSearch">
+          <el-select
+            v-model="search.createUser"
+            filterable
+            clearable
+            placeholder="请选择 承揽人"
+          >
+            <el-option
+              v-for="(item, index) in contractorOption"
+              :key="index"
+              :value="item.realName"
+              :label="item.realName"
+            ></el-option>
+          </el-select>
+        </template>
+        <template slot="oppositePersonSearch">
+          <el-select
+            v-model="search.oppositePerson"
+            filterable
+            clearable
+            placeholder="请选择 承揽人"
+          >
+            <el-option
+              v-for="(item, index) in oppositePersonOption"
+              :key="index"
+              :value="item.realName"
+              :label="item.realName"
+            ></el-option>
+          </el-select>
+        </template>
+      </avue-crud>
+    </basic-container>
+    <detail-page
+      @goBack="goBack"
+      @copyOrder="copyOrder"
+      :detailData="detailData"
+      v-if="!show"
+    />
+  </div>
+</template>
+
+<script>
+import option from "./config/mainList.json";
+import detailPage from "./detail";
+import { gainUser } from "@/api/basicData/customerInquiry";
+
+export default {
+  name: "index",
+  components: {
+    detailPage,
+  },
+  data() {
+    return {
+      option: {},
+      dataList: [],
+      form: {},
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0,
+        pageSizes: [10, 50, 100, 200, 300, 400, 500]
+      },
+      search: {},
+      show: true,
+      loading: false,
+      selection: [],
+      detailData: {},
+      contractorOption: [],
+      oppositePersonOption: [],
+    }
+  },
+  async created() {
+    this.option = await this.getColumnData(this.getColumnName(103), option);
+    gainUser().then(res => {
+      this.contractorOption = res.data.data;
+      this.oppositePersonOption = res.data.data;
+    })
+  },
+  methods: {
+    searchCriteriaSwitch(type) {
+      // if (type){
+      //   this.option.height =  this.option.height - 90
+      // }else {
+      //   this.option.height =  this.option.height + 90
+      // }
+      // this.$refs.crud.getTableHeight()
+    },
+    newAdd() {
+      this.show = false;
+    },
+    onLoad(page, params) {
+      // 重置掉展开
+      this.dataList.forEach(item => {
+        this.$refs.crud.toggleRowExpansion(item, false)
+      })
+      let queryParams = Object.assign({}, params, {
+        size: page.pageSize,
+        current: page.currentPage,
+      })
+      // this.loading = true;
+      // getSalesList(queryParams).then(res => {
+      //   this.dataList = res.data.data.records;
+      //   this.page.total = res.data.data.total;
+      //   this.option.height = window.innerHeight - 240;
+      //   this.$nextTick(() => {
+      //     this.$refs.crud.doLayout()
+      //   })
+      // }).finally(() => {
+      //   this.loading = false;
+      // })
+    },
+    async saveColumn() {
+      const inSave = await this.saveColumnData(
+        this.getColumnName(103),
+        this.option
+      );
+      if (inSave) {
+        this.$message.success("保存成功");
+        //关闭窗口
+        this.$refs.crud.$refs.dialogColumn.columnBox = false;
+        this.$nextTick(() => {
+          this.$refs.crud.doLayout()
+        })
+      }
+    },
+    async resetColumn() {
+      this.option = option;
+      const inSave = await this.delColumnData(this.getColumnName(103), option);
+      if (inSave) {
+        this.$nextTick(() => {
+          this.$refs.crud.doLayout()
+        })
+        this.$message.success("重置成功");
+        this.$refs.crud.$refs.dialogColumn.columnBox = false;
+      }
+    },
+    //点击搜索按钮触发
+    searchChange(params, done) {
+      this.onLoad(this.page, params);
+      done();
+    },
+    currentChange(val) {
+      this.page.currentPage = val;
+    },
+    sizeChange(val) {
+      this.page.currentPage = 1;
+      this.page.pageSize = val;
+    },
+    refreshChange() {
+      this.onLoad(this.page, this.search);
+    },
+    cellStyle() {
+      return "padding:0;height:40px;";
+    },
+    copyDoc() {},
+    selectionChange(list) {
+      this.selection = list;
+    },
+    goBack() {
+      if (this.$route.query.id) {
+        this.$router.$avueRouter.closeTag(this.$route.fullPath);
+        this.$router.push({
+          path: "/dealer/sales/index"
+        });
+      }
+      this.detailData = this.$options.data().detailData;
+      this.show = true;
+      this.onLoad(this.page, this.search);
+    },
+    copyOrder(id) {
+      this.show = true;
+      this.detailData = {
+        id: id,
+        status: "copy"
+      };
+      this.$nextTick(() => {
+        this.show = false;
+      });
+    },
+    contractorRemoteMethod(name) {
+      gainUser({realName: name}).then(res => {
+        this.contractorOption = res.data.data;
+      })
+    },
+    oppositePersonRemoteMethod(name) {
+      gainUser({realName: name}).then(res => {
+        this.oppositePerson = res.data.data;
+      })
+    },
+  },
+}
+</script>
+
+<style scoped>
+
+</style>

+ 2 - 2
src/views/workManagement/purchaseApply/config/customerContact.json

@@ -78,7 +78,7 @@
     },
     {
       "label": "制单人",
-      "prop": "createUser",
+      "prop": "createUserName",
       "index": 8,
       "width": 100,
       "overHidden": true
@@ -92,7 +92,7 @@
     },
     {
       "label": "更新人",
-      "prop": "updateUser",
+      "prop": "updateUserName",
       "index": 10,
       "width": 100,
       "overHidden": true

+ 15 - 3
src/views/workManagement/purchaseApply/config/mainList.json

@@ -21,7 +21,7 @@
   "column": [
     {
       "label": "申请人",
-      "prop": "createUser",
+      "prop": "applyUserName",
       "search": true,
       "index": 1,
       "minWidth": 80,
@@ -29,12 +29,24 @@
     },
     {
       "label": "申请部门",
-      "prop": "a",
+      "prop": "applyDeptName",
       "overHidden": true,
       "minWidth": 100,
       "search": false
     },
     {
+      "label": "申请日期",
+      "prop": "applyTime",
+      "type": "date",
+      "overHidden": true,
+      "minWidth": 200,
+      "format": "yyyy-MM-dd",
+      "valueFormat": "yyyy-MM-dd",
+      "unlinkPanels": true,
+      "searchRange": true,
+      "search": true
+    },
+    {
       "label": "制单日期",
       "prop": "createTime",
       "type": "date",
@@ -44,7 +56,7 @@
       "valueFormat": "yyyy-MM-dd",
       "unlinkPanels": true,
       "searchRange": true,
-      "search": true
+      "search": false
     },
     {
       "label": "系统编号",

+ 114 - 27
src/views/workManagement/purchaseApply/detail.vue

@@ -18,6 +18,13 @@
           @click.stop="openEdit"
         >编 辑</el-button>
         <el-button
+          type="primary"
+          :disabled="!form.id"
+          size="small"
+          @click="pleaseCheck"
+          :loading="btnLoading"
+        >请核</el-button>
+        <el-button
           type="success"
           :disabled="!form.id"
           size="small"
@@ -41,9 +48,9 @@
           v-model="form"
           :option="option"
         >
-          <template slot="createUser">
+          <template slot="applyUser">
             <el-select
-              v-model="form.createUser"
+              v-model="form.applyUser"
               filterable
               clearable
               size="small"
@@ -52,17 +59,17 @@
                 v-for="(item,index) in userList"
                 :key="index"
                 :label="item.realName"
-                :value="item.realName"
+                :value="item.id"
               ></el-option>
             </el-select>
           </template>
-          <template slot="deptId">
+          <template slot="applyDept">
             <avue-input-tree
               leaf-only
               style="width: 100%;"
               size="small"
               :props="{ label: 'title' }"
-              v-model="form.deptId"
+              v-model="form.applyDept"
               placeholder=" "
               type="tree"
               :dic="dic"
@@ -322,9 +329,16 @@ import { gainUser } from "@/api/basicData/customerInquiry";
 import {getUserInfo} from "@/api/system/user";
 import {getDeptTree} from "@/api/system/dept";
 import { getCurrentDate } from "@/util/date";
+import {dataDetail, typeSave, removeGoods, pleaseCheck} from "@/api/officeSupplies/purchaseApply";
+import { contrastObj, contrastList } from "@/util/contrastData";
 
 export default {
   name: "detail",
+  props: {
+    detailData: {
+      type: Object
+    }
+  },
   data() {
     return {
       pageLoading: false,
@@ -336,7 +350,7 @@ export default {
         column: [
           {
             label: "申请人",
-            prop: "createUser",
+            prop: "applyUser",
             rules: [
               {
                 required: true,
@@ -349,7 +363,7 @@ export default {
           },
           {
             label: "申请部门",
-            prop: "deptId",
+            prop: "applyDept",
             rules: [
               {
                 required: true,
@@ -362,7 +376,7 @@ export default {
           },
           {
             label: "申请时间",
-            prop: "b",
+            prop: "applyTime",
             span: 8,
             type: "date",
             format: "yyyy-MM-dd",
@@ -446,6 +460,8 @@ export default {
         total: 0
       },
       dic: [],
+      oldForm: {},
+      oldDataList: [],
     }
   },
   async created() {
@@ -457,15 +473,24 @@ export default {
       this.getColumnName(90),
       goodsOption
     );
-    getGoods(1, 500).then(res => {
-      this.goodsoptions = res.data.data.records;
+    getGoods(1, 10).then(res => {
+      if (res.data.data.total > 0) {
+        this.goodsoptions = res.data.data.records;
+        if (Math.ceil(res.data.data.total / 10) > 1) {
+          for (let i = 2; i <= Math.ceil(res.data.data.total / 10); i++) {
+            getGoods(i, 10).then(e => {
+              this.goodsoptions = this.goodsoptions.concat(e.data.data.records);
+            });
+          }
+        }
+      }
     });
     gainUser().then(res => {
       this.userList = res.data.data;
     });
     getUserInfo().then(res => {
-      this.$set(this.form, 'createUser', res.data.data.realName);
-      this.$set(this.form, 'deptId', res.data.data.deptId);
+      this.$set(this.form, 'applyUser', res.data.data.id);
+      this.$set(this.form, 'applyDept', res.data.data.deptId);
     })
     getDeptTree().then(res => {
       this.dic = res.data.data
@@ -473,7 +498,14 @@ export default {
     this.getWorkDicts('unit').then(res => {
       this.unitOption = res.data.data;
     })
-    this.$set(this.form, 'b', getCurrentDate()); // 默认当前日期
+    this.$set(this.form, 'applyTime', getCurrentDate()); // 默认当前日期
+    if (this.detailData.query) {
+      this.disabled = true;
+      // this.option.column.map(e => {
+      //   this.$set(e, 'disabled', true)
+      // })
+      this.queryData(this.detailData.id);
+    }
   },
   filters: {
     IntegerFormat(num) {
@@ -484,6 +516,19 @@ export default {
     }
   },
   methods: {
+    // 查询
+    queryData(id) {
+      this.pageLoading = true;
+      dataDetail(id).then(res => {
+        this.form = res.data.data;
+        this.dataList = this.form.orderItemsList? this.form.orderItemsList: [];
+        this.oldForm = {...this.form};
+        this.oldDataList = [...this.dataList];
+        delete this.form.orderItemsList;
+      }).finally(() => {
+        this.pageLoading = false;
+      })
+    },
     //返回列表
     backToList() {
       this.$emit("goBack");
@@ -499,13 +544,16 @@ export default {
       this.$refs["form"].validate((valid, done) => {
         done();
         if (valid) {
-          // this.btnLoading = true;
-          // typeSave(this.form).then(res => {
-          //   this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
-          //   this.queryData(res.data.data.id);
-          // }).finally(() => {
-          //   this.btnLoading = false;
-          // })
+          this.btnLoading = true;
+          this.form.billType = 'CG';
+          this.form.tradeType = 'OCG';
+          this.$set(this.form, 'orderItemsList', this.dataList);
+          typeSave(this.form).then(res => {
+            this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
+            this.queryData(res.data.data);
+          }).finally(() => {
+            this.btnLoading = false;
+          })
         } else {
           return false
         }
@@ -567,13 +615,13 @@ export default {
         type: "warning"
       }).then(() => {
         if (row.id) {
-          // removeGoods(row.id).then(res => {
-          //   this.$message({
-          //     type: 'success',
-          //     message: '删除成功!'
-          //   })
-          //   this.dataList.splice(row.$index, 1);
-          // })
+          removeGoods(row.id).then(res => {
+            this.$message({
+              type: 'success',
+              message: '删除成功!'
+            })
+            this.dataList.splice(row.$index, 1);
+          })
         } else {
           this.$message({
             type: "success",
@@ -773,6 +821,45 @@ export default {
       }
       this.dialogVisible = false;
     },
+    // 请核
+    pleaseCheck() {
+      if (this.verification()) {
+        const data = {
+          id : this.form.id,
+          checkType: 'bgyp',
+          url: '/workManagement/purchaseApply/index',
+          pageStatus:"this.$store.getters.officePurchaseStatus",
+          pageLabel:"采购申请",
+          checkFlag: 1,
+        }
+        this.btnLoading = true;
+        pleaseCheck(data).then(res => {
+          this.$message.success('请核成功')
+          this.queryData(this.form.id)
+        }).catch(() => {
+          this.$message.error('请核失败')
+        }).finally(() => {
+          this.btnLoading = false;
+        })
+      }
+    },
+    // 验证新旧值对比
+    verification() {
+      if (contrastObj(this.form, this.oldForm) ||
+        contrastList(this.dataList, this.oldDataList)) {
+        this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.editCustomer();
+        }).catch(() => {
+          return false;   //取消改动数据
+        })
+      } else {
+        return false;
+      }
+    },
   },
 }
 </script>

+ 86 - 12
src/views/workManagement/purchaseApply/index.vue

@@ -45,6 +45,24 @@
           >删除
           </el-button>
         </template>
+        <template slot="applyUserNameSearch">
+          <el-select
+            v-model="search.applyUser"
+            filterable
+            clearable
+            size="small"
+          >
+            <el-option
+              v-for="(item,index) in userList"
+              :key="index"
+              :label="item.realName"
+              :value="item.id"
+            ></el-option>
+          </el-select>
+        </template>
+        <template slot="applyUserName" slot-scope="scope">
+          <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.applyUserName }}</span>
+        </template>
       </avue-crud>
     </basic-container>
     <detail-page
@@ -59,6 +77,8 @@
 <script>
 import option from "./config/mainList.json";
 import detailPage from "./detail";
+import { gainUser } from "@/api/basicData/customerInquiry";
+import {getList, deleteList} from "@/api/officeSupplies/purchaseApply";
 
 export default {
   name: "index",
@@ -81,10 +101,34 @@ export default {
       loading: false,
       selection: [],
       detailData: {},
+      userList: [],
     }
   },
   async created() {
     this.option = await this.getColumnData(this.getColumnName(91), option);
+    gainUser().then(res => {
+      this.userList = res.data.data;
+    });
+    let i = 0;
+    this.option.column.forEach(item => {
+      if (item.search) i++
+    })
+    if (i % 3 !== 0){
+      const num = 3 - Number(i % 3)
+      this.option.searchMenuSpan = num * 8;
+      this.option.searchMenuPosition = "right";
+    }
+  },
+  filters: {
+    userFormat(row, userList) {
+      let name;
+      userList.map(e => {
+        if (row == e.id) {
+          name = e.realName
+        }
+      })
+      return name;
+    },
   },
   methods: {
     searchCriteriaSwitch(type) {
@@ -97,6 +141,7 @@ export default {
     },
     newAdd() {
       this.show = false;
+      this.$store.commit("OFFICEPUR_IN_DETAIL");
     },
     onLoad(page, params) {
       // 重置掉展开
@@ -106,18 +151,19 @@ export default {
       let queryParams = Object.assign({}, params, {
         size: page.pageSize,
         current: page.currentPage,
+        tradeType: 'OCG',
+      })
+      this.loading = true;
+      getList(queryParams).then(res => {
+        this.dataList = res.data.data.records;
+        this.page.total = res.data.data.total;
+        this.option.height = window.innerHeight - 240;
+        this.$nextTick(() => {
+          this.$refs.crud.doLayout()
+        })
+      }).finally(() => {
+        this.loading = false;
       })
-      // this.loading = true;
-      // getSalesList(queryParams).then(res => {
-      //   this.dataList = res.data.data.records;
-      //   this.page.total = res.data.data.total;
-      //   this.option.height = window.innerHeight - 240;
-      //   this.$nextTick(() => {
-      //     this.$refs.crud.doLayout()
-      //   })
-      // }).finally(() => {
-      //   this.loading = false;
-      // })
     },
     async saveColumn() {
       const inSave = await this.saveColumnData(
@@ -170,7 +216,7 @@ export default {
       if (this.$route.query.id) {
         this.$router.$avueRouter.closeTag(this.$route.fullPath);
         this.$router.push({
-          path: "/dealer/sales/index"
+          path: "/workManagement/purchaseApply/index"
         });
       }
       this.detailData = this.$options.data().detailData;
@@ -186,6 +232,34 @@ export default {
       this.$nextTick(() => {
         this.show = false;
       });
+      this.$store.commit("OFFICEPUR_IN_DETAIL");
+    },
+    //删除列表后面的删除按钮触发触发(row, index, done)
+    rowDel(row, index, done) {
+      this.$confirm("确定删除数据?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(res => {
+        return deleteList(row.id)
+      }).then(() => {
+        this.dataList.splice(row.$index, 1)
+        this.$message({
+          type: "success",
+          message: "删除成功!"
+        });
+        this.page.currentPage = 1;
+        this.onLoad(this.page)
+      })
+    },
+    // 详情打开
+    beforeOpenPage(row, index) {
+      this.show = false;
+      this.detailData = {
+        id: row.id,
+        query: true, // 表示只是查询
+      };
+      this.$store.commit("OFFICEPUR_IN_DETAIL");
     },
   },
 }

+ 112 - 0
src/views/workManagement/stock/config/mainList.json

@@ -0,0 +1,112 @@
+{
+  "stripe": true,
+  "height": "auto",
+  "searchShow": true,
+  "border": true,
+  "index": true,
+  "viewBtn": false,
+  "editBtn": false,
+  "delBtn": false,
+  "addBtn": false,
+  "align": "center",
+  "menu": false,
+  "menuWidth": "70",
+  "searchIcon": true,
+  "searchIndex": 2,
+  "selection": true,
+  "tip": false,
+  "searchSpan": 8,
+  "showSummary": true,
+  "summaryText": "合计",
+  "expand": true,
+  "expandWidth": 38,
+  "sumColumnList": [
+  ],
+  "column": [
+    {
+      "label": "日期",
+      "prop": "date",
+      "index": 1,
+      "minWidth": 80,
+      "overHidden": true,
+      "format": "yyyy-MM",
+      "valueFormat": "yyyy-MM",
+      "unlinkPanels": true,
+      "searchRange": true,
+      "search": true,
+      "type": "month"
+    },
+    {
+      "label": "物料名称",
+      "prop": "cname",
+      "search": true,
+      "index": 2,
+      "minWidth": 80,
+      "overHidden": true
+    },
+    {
+      "label": "物料编号",
+      "prop": "code",
+      "search": false,
+      "index": 3,
+      "minWidth": 80,
+      "overHidden": true
+    },
+    {
+      "label": "期初",
+      "prop": "cname",
+      "search": false,
+      "index": 4,
+      "minWidth": 80,
+      "overHidden": true
+    },
+    {
+      "label": "入库",
+      "prop": "cname",
+      "search": false,
+      "index": 5,
+      "minWidth": 80,
+      "overHidden": true
+    },
+    {
+      "label": "出库",
+      "prop": "cname",
+      "search": false,
+      "index": 6,
+      "minWidth": 80,
+      "overHidden": true
+    },
+    {
+      "label": "结余",
+      "prop": "cname",
+      "search": false,
+      "index": 7,
+      "minWidth": 80,
+      "overHidden": true
+    },
+    {
+      "label": "数量",
+      "prop": "cname",
+      "search": false,
+      "index": 8,
+      "minWidth": 80,
+      "overHidden": true
+    },
+    {
+      "label": "单价",
+      "prop": "price",
+      "search": false,
+      "index": 9,
+      "minWidth": 80,
+      "overHidden": true
+    },
+    {
+      "label": "金额",
+      "prop": "amount",
+      "search": false,
+      "index": 10,
+      "minWidth": 80,
+      "overHidden": true
+    }
+  ]
+}

+ 187 - 0
src/views/workManagement/stock/index.vue

@@ -0,0 +1,187 @@
+<template>
+  <div>
+    <basic-container v-show="show" class="page-crad">
+      <avue-crud
+        ref="crud"
+        :option="option"
+        :data="dataList"
+        v-model="form"
+        :page.sync="page"
+        :search.sync="search"
+        :table-loading="loading"
+        :cell-style="cellStyle"
+        @selection-change="selectionChange"
+        @search-change="searchChange"
+        @current-change="currentChange"
+        @size-change="sizeChange"
+        @refresh-change="refreshChange"
+        @on-load="onLoad"
+        @search-criteria-switch="searchCriteriaSwitch"
+        @saveColumn="saveColumn"
+        @resetColumn="resetColumn"
+      >
+        <template slot="cnameSearch">
+          <el-select
+            v-model="search.itemId"
+            filterable
+            clearable
+            remote
+            :remote-method="cnameMethod"
+            @clear="cnameClear"
+          >
+            <el-option
+              v-for="(item, index) in goodsOption"
+              :label="item.cname"
+              :value="item.id"
+              :key="index"
+            ></el-option>
+          </el-select>
+        </template>
+      </avue-crud>
+    </basic-container>
+  </div>
+</template>
+
+<script>
+import option from "./config/mainList.json";
+import {getList as goodsSelect} from "@/api/basicData/commodityType";
+
+export default {
+  name: "index",
+  data() {
+    return {
+      option: {},
+      dataList: [],
+      form: {},
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0,
+        pageSizes: [10, 50, 100, 200, 300, 400, 500]
+      },
+      search: {},
+      show: true,
+      loading: false,
+      selection: [],
+      goodsOption: [],
+    }
+  },
+  async created() {
+    this.option = await this.getColumnData(this.getColumnName(105), option);
+    goodsSelect(1, 10).then(res => {
+      // console.log(res.data.data.records)
+      this.goodsOption = res.data.data.records;
+    })
+    let i = 0;
+    this.option.column.forEach(item => {
+      if (item.search) i++
+    })
+    if (i % 3 !== 0){
+      const num = 3 - Number(i % 3)
+      this.option.searchMenuSpan = num * 8;
+      this.option.searchMenuPosition = "right";
+    }
+  },
+  methods: {
+    searchCriteriaSwitch(type) {
+      // if (type){
+      //   this.option.height =  this.option.height - 90
+      // }else {
+      //   this.option.height =  this.option.height + 90
+      // }
+      // this.$refs.crud.getTableHeight()
+    },
+    newAdd() {
+      this.show = false;
+    },
+    onLoad(page, params) {
+      // 重置掉展开
+      this.dataList.forEach(item => {
+        this.$refs.crud.toggleRowExpansion(item, false)
+      })
+      let queryParams = Object.assign({}, params, {
+        size: page.pageSize,
+        current: page.currentPage,
+      })
+      // this.loading = true;
+      // getSalesList(queryParams).then(res => {
+      //   this.dataList = res.data.data.records;
+      //   this.page.total = res.data.data.total;
+      //   this.option.height = window.innerHeight - 240;
+      //   this.$nextTick(() => {
+      //     this.$refs.crud.doLayout()
+      //   })
+      // }).finally(() => {
+      //   this.loading = false;
+      // })
+    },
+    async saveColumn() {
+      const inSave = await this.saveColumnData(
+        this.getColumnName(105),
+        this.option
+      );
+      if (inSave) {
+        this.$message.success("保存成功");
+        //关闭窗口
+        this.$refs.crud.$refs.dialogColumn.columnBox = false;
+        this.$nextTick(() => {
+          this.$refs.crud.doLayout()
+        })
+      }
+    },
+    async resetColumn() {
+      this.option = option;
+      const inSave = await this.delColumnData(this.getColumnName(105), option);
+      if (inSave) {
+        this.$nextTick(() => {
+          this.$refs.crud.doLayout()
+        })
+        this.$message.success("重置成功");
+        this.$refs.crud.$refs.dialogColumn.columnBox = false;
+      }
+    },
+    //点击搜索按钮触发
+    searchChange(params, done) {
+      this.onLoad(this.page, params);
+      done();
+    },
+    currentChange(val) {
+      this.page.currentPage = val;
+    },
+    sizeChange(val) {
+      this.page.currentPage = 1;
+      this.page.pageSize = val;
+    },
+    refreshChange() {
+      this.onLoad(this.page, this.search);
+    },
+    cellStyle() {
+      return "padding:0;height:40px;";
+    },
+    copyDoc() {},
+    selectionChange(list) {
+      this.selection = list;
+    },
+    cnameMethod(name) {
+      if (name) {
+        goodsSelect(1, 20, {cname: name}).then(res => {
+          this.goodsOption = res.data.data.records;
+        })
+      } else {
+        goodsSelect(1, 10).then(res => {
+          this.goodsOption = res.data.data.records;
+        })
+      }
+    },
+    cnameClear() {
+      goodsSelect(1, 10).then(res => {
+        this.goodsOption = res.data.data.records;
+      })
+    },
+  },
+}
+</script>
+
+<style scoped>
+
+</style>

+ 3 - 3
src/views/workManagement/warehousing/config/mainList.json

@@ -21,7 +21,7 @@
   "column": [
     {
       "label": "库管人",
-      "prop": "createUser",
+      "prop": "stockUserName",
       "search": true,
       "index": 1,
       "minWidth": 80,
@@ -29,14 +29,14 @@
     },
     {
       "label": "部门",
-      "prop": "a",
+      "prop": "stockDept",
       "overHidden": true,
       "minWidth": 100,
       "search": false
     },
     {
       "label": "入库时间",
-      "prop": "createTime",
+      "prop": "stockTime",
       "type": "date",
       "overHidden": true,
       "minWidth": 200,

+ 85 - 29
src/views/workManagement/warehousing/detail.vue

@@ -41,9 +41,9 @@
           v-model="form"
           :option="option"
         >
-          <template slot="createUser">
+          <template slot="stockUser">
             <el-select
-              v-model="form.createUser"
+              v-model="form.stockUser"
               filterable
               clearable
               size="small"
@@ -52,17 +52,17 @@
                 v-for="(item,index) in userList"
                 :key="index"
                 :label="item.realName"
-                :value="item.realName"
+                :value="item.id"
               ></el-option>
             </el-select>
           </template>
-          <template slot="deptId">
+          <template slot="stockDept">
             <avue-input-tree
               leaf-only
               style="width: 100%;"
               size="small"
               :props="{ label: 'title' }"
-              v-model="form.deptId"
+              v-model="form.stockDept"
               placeholder=" "
               type="tree"
               :dic="dic"
@@ -322,6 +322,8 @@ import { gainUser } from "@/api/basicData/customerInquiry";
 import {getUserInfo} from "@/api/system/user";
 import {getDeptTree} from "@/api/system/dept";
 import { getCurrentDate } from "@/util/date";
+import {dataDetail, typeSave, removeGoods} from "@/api/officeSupplies/warehousing";
+import { contrastObj, contrastList } from "@/util/contrastData";
 
 export default {
   name: "detail",
@@ -336,7 +338,7 @@ export default {
         column: [
           {
             label: "库管人",
-            prop: "createUser",
+            prop: "stockUser",
             rules: [
               {
                 required: true,
@@ -349,7 +351,7 @@ export default {
           },
           {
             label: "部门",
-            prop: "deptId",
+            prop: "stockDept",
             rules: [
               {
                 required: true,
@@ -362,7 +364,7 @@ export default {
           },
           {
             label: "入库时间",
-            prop: "b",
+            prop: "stockTime",
             span: 8,
             type: "date",
             format: "yyyy-MM-dd",
@@ -446,6 +448,8 @@ export default {
         total: 0
       },
       dic: [],
+      oldForm: {},
+      oldDataList: [],
     }
   },
   async created() {
@@ -457,23 +461,35 @@ export default {
       this.getColumnName(96),
       goodsOption
     );
-    getGoods(1, 500).then(res => {
-      this.goodsoptions = res.data.data.records;
+    getGoods(1, 10).then(res => {
+      if (res.data.data.total > 0) {
+        this.goodsoptions = res.data.data.records;
+        if (Math.ceil(res.data.data.total / 10) > 1) {
+          for (let i = 2; i <= Math.ceil(res.data.data.total / 10); i++) {
+            getGoods(i, 10).then(e => {
+              this.goodsoptions = this.goodsoptions.concat(e.data.data.records);
+            });
+          }
+        }
+      }
     });
     gainUser().then(res => {
       this.userList = res.data.data;
     });
-    getUserInfo().then(res => {
-      this.$set(this.form, 'createUser', res.data.data.realName);
-      this.$set(this.form, 'deptId', res.data.data.deptId);
-    })
     getDeptTree().then(res => {
       this.dic = res.data.data
     })
     this.getWorkDicts('unit').then(res => {
       this.unitOption = res.data.data;
     })
-    this.$set(this.form, 'b', getCurrentDate()); // 默认当前日期
+
+    if (this.detailData.query) {
+      this.disabled = true;
+      // this.option.column.map(e => {
+      //   this.$set(e, 'disabled', true)
+      // })
+      this.queryData(this.detailData.id);
+    }
   },
   filters: {
     IntegerFormat(num) {
@@ -484,6 +500,26 @@ export default {
     }
   },
   methods: {
+    // 查询
+    queryData(id) {
+      this.pageLoading = true;
+      dataDetail(id).then(res => {
+        this.form = res.data.data;
+        this.dataList = this.form.orderItemsList? this.form.orderItemsList: [];
+        this.oldForm = {...this.form};
+        this.oldDataList = [...this.dataList];
+        delete this.form.orderItemsList;
+        if (!this.form.stockUser) {
+          getUserInfo().then(res => {
+            this.$set(this.form, 'stockUser', res.data.data.id);
+            this.$set(this.form, 'stockDept', res.data.data.deptId);
+          })
+          this.$set(this.form, 'stockTime', getCurrentDate()); // 默认当前日期
+        }
+      }).finally(() => {
+        this.pageLoading = false;
+      })
+    },
     //返回列表
     backToList() {
       this.$emit("goBack");
@@ -499,13 +535,16 @@ export default {
       this.$refs["form"].validate((valid, done) => {
         done();
         if (valid) {
-          // this.btnLoading = true;
-          // typeSave(this.form).then(res => {
-          //   this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
-          //   this.queryData(res.data.data.id);
-          // }).finally(() => {
-          //   this.btnLoading = false;
-          // })
+          this.btnLoading = true;
+          this.form.billType = 'ORK';
+          this.form.tradeType = 'ORK';
+          this.$set(this.form, 'orderItemsList', this.dataList);
+          typeSave(this.form).then(res => {
+            this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
+            this.queryData(res.data.data.id);
+          }).finally(() => {
+            this.btnLoading = false;
+          })
         } else {
           return false
         }
@@ -567,13 +606,13 @@ export default {
         type: "warning"
       }).then(() => {
         if (row.id) {
-          // removeGoods(row.id).then(res => {
-          //   this.$message({
-          //     type: 'success',
-          //     message: '删除成功!'
-          //   })
-          //   this.dataList.splice(row.$index, 1);
-          // })
+          removeGoods(row.id).then(res => {
+            this.$message({
+              type: 'success',
+              message: '删除成功!'
+            })
+            this.dataList.splice(row.$index, 1);
+          })
         } else {
           this.$message({
             type: "success",
@@ -773,6 +812,23 @@ export default {
       }
       this.dialogVisible = false;
     },
+    // 验证新旧值对比
+    verification() {
+      if (contrastObj(this.form, this.oldForm) ||
+        contrastList(this.dataList, this.oldDataList)) {
+        this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.editCustomer();
+        }).catch(() => {
+          return false;   //取消改动数据
+        })
+      } else {
+        return false;
+      }
+    },
   },
 }
 </script>

+ 54 - 25
src/views/workManagement/warehousing/index.vue

@@ -21,19 +21,19 @@
         @resetColumn="resetColumn"
       >
         <template slot="menuLeft">
-          <el-button
-            type="primary"
-            icon="el-icon-plus"
-            size="small"
-            @click.stop="newAdd()"
-          >创建单据</el-button>
-          <el-button
-            type="success"
-            size="small"
-            icon="el-icon-plus"
-            @click.stop="copyDoc()"
-            :disabled="selection.length != 1"
-          >复制单据</el-button>
+<!--          <el-button-->
+<!--            type="primary"-->
+<!--            icon="el-icon-plus"-->
+<!--            size="small"-->
+<!--            @click.stop="newAdd()"-->
+<!--          >创建单据</el-button>-->
+<!--          <el-button-->
+<!--            type="success"-->
+<!--            size="small"-->
+<!--            icon="el-icon-plus"-->
+<!--            @click.stop="copyDoc()"-->
+<!--            :disabled="selection.length != 1"-->
+<!--          >复制单据</el-button>-->
         </template>
         <template slot-scope="scope" slot="menu">
           <el-button
@@ -59,6 +59,7 @@
 <script>
 import option from "./config/mainList.json";
 import detailPage from "./detail";
+import {getList, deleteList} from "@/api/officeSupplies/warehousing";
 
 export default {
   name: "index",
@@ -85,6 +86,15 @@ export default {
   },
   async created() {
     this.option = await this.getColumnData(this.getColumnName(97), option);
+    let i = 0;
+    this.option.column.forEach(item => {
+      if (item.search) i++
+    })
+    if (i % 3 !== 0){
+      const num = 3 - Number(i % 3)
+      this.option.searchMenuSpan = num * 8;
+      this.option.searchMenuPosition = "right";
+    }
   },
   methods: {
     searchCriteriaSwitch(type) {
@@ -106,18 +116,19 @@ export default {
       let queryParams = Object.assign({}, params, {
         size: page.pageSize,
         current: page.currentPage,
+        tradeType: 'ORK',
+      })
+      this.loading = true;
+      getList(queryParams).then(res => {
+        this.dataList = res.data.data.records;
+        this.page.total = res.data.data.total;
+        this.option.height = window.innerHeight - 240;
+        this.$nextTick(() => {
+          this.$refs.crud.doLayout()
+        })
+      }).finally(() => {
+        this.loading = false;
       })
-      // this.loading = true;
-      // getSalesList(queryParams).then(res => {
-      //   this.dataList = res.data.data.records;
-      //   this.page.total = res.data.data.total;
-      //   this.option.height = window.innerHeight - 240;
-      //   this.$nextTick(() => {
-      //     this.$refs.crud.doLayout()
-      //   })
-      // }).finally(() => {
-      //   this.loading = false;
-      // })
     },
     async saveColumn() {
       const inSave = await this.saveColumnData(
@@ -145,7 +156,7 @@ export default {
       }
     },
     //点击搜索按钮触发
-    searchChange(params, done) {
+    searchChanonLoadge(params, done) {
       this.onLoad(this.page, params);
       done();
     },
@@ -187,6 +198,24 @@ export default {
         this.show = false;
       });
     },
+    //删除列表后面的删除按钮触发触发(row, index, done)
+    rowDel(row, index, done) {
+      this.$confirm("确定删除数据?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(res => {
+        return deleteList(row.id)
+      }).then(() => {
+        this.dataList.splice(row.$index, 1)
+        this.$message({
+          type: "success",
+          message: "删除成功!"
+        });
+        this.page.currentPage = 1;
+        this.onLoad(this.page)
+      })
+    },
   },
 }
 </script>