فهرست منبع

申请单参照框

黄梓星 2 سال پیش
والد
کامیت
e46dfab951
3فایلهای تغییر یافته به همراه396 افزوده شده و 68 حذف شده
  1. 8 0
      src/api/requisition/basic.js
  2. 269 0
      src/components/PopDialog/serviceline.vue
  3. 119 68
      src/views/material/requisition/add.vue

+ 8 - 0
src/api/requisition/basic.js

@@ -70,4 +70,12 @@ export function getStaff(data) {
     method: 'post',
     data: data
   })
+}
+// 参照-业务线
+export function getLine(data) {
+  return request({
+    url: `/system/archival/queryServiceline`,
+    method: 'post',
+    data: data
+  })
 }

+ 269 - 0
src/components/PopDialog/serviceline.vue

@@ -0,0 +1,269 @@
+<template>
+  <div>
+    <el-dialog
+      title="业务线选择"
+      width="1000px"
+      :close-on-click-modal="false"
+      :append-to-body="true"
+      v-dialogDrag
+      class="userDialog"
+      :visible.sync="visible"
+    >
+      <el-container style="height: 500px">
+        <el-container>
+          <el-header style="text-align: left; font-size: 12px; height: 30px">
+            <el-form
+              size="small"
+              :inline="true"
+              ref="searchForm"
+              :model="searchForm"
+              @keyup.enter.native="refreshList()"
+              @submit.native.prevent
+            >
+              <el-form-item prop="code">
+                <el-input
+                  size="small"
+                  v-model="searchForm.code"
+                  placeholder="编号"
+                  clearable
+                ></el-input>
+              </el-form-item>
+              <el-form-item prop="name">
+                <el-input
+                  size="small"
+                  v-model="searchForm.name"
+                  placeholder="名称"
+                  clearable
+                ></el-input>
+              </el-form-item>
+              <el-form-item>
+                <el-button
+                  type="primary"
+                  @click="refreshList()"
+                  size="small"
+                  icon="el-icon-search"
+                  >查询</el-button
+                >
+                <el-button
+                  @click="resetSearch()"
+                  size="small"
+                  icon="el-icon-refresh-right"
+                >重置</el-button>
+              </el-form-item>
+            </el-form>
+          </el-header>
+          <el-main>
+            <el-table
+              :data="dataList"
+              v-loading="loading"
+              size="small"
+              border
+              ref="contractTable"
+              @select="handleSelectionChange"
+              height="calc(100% - 40px)"
+              style="width: 100%"
+            >
+              <el-table-column
+                type="selection"
+                header-align="center"
+                align="center"
+                width="50"
+              >
+              </el-table-column>
+              <el-table-column
+                prop="id"
+                header-align="center"
+                align="left"
+                sortable="custom"
+                min-width="90"
+                label="id"
+              >
+              </el-table-column>
+              <el-table-column
+                prop="name"
+                header-align="center"
+                align="left"
+                sortable="custom"
+                min-width="90"
+                label="名称"
+              >
+              </el-table-column>
+              <!-- <el-table-column
+                prop="contractAmount"
+                header-align="center"
+                align="left"
+                sortable="custom"
+                min-width="110"
+                label="合同金额"
+              >
+              </el-table-column>
+              <el-table-column
+                prop="oppositeCompany"
+                header-align="center"
+                align="center"
+                sortable="custom"
+                min-width="110"
+                label="对方单位"
+              >
+              </el-table-column>
+              <el-table-column
+                prop="signDate"
+                header-align="center"
+                align="left"
+                sortable="custom"
+                min-width="110"
+                label="签订时间"
+              >
+              </el-table-column> -->
+            </el-table>
+            <el-pagination
+              @size-change="sizeChangeHandle"
+              @current-change="currentChangeHandle"
+              :current-page="pageNo"
+              :page-sizes="[5, 10, 15, 20]"
+              :page-size="pageSize"
+              :total="total"
+              layout="total, sizes, prev, pager, next, jumper"
+            >
+            </el-pagination>
+          </el-main>
+        </el-container>
+      </el-container>
+      <span slot="footer" class="dialog-footer">
+        <el-button
+          size="small"
+          @click="visible = false"
+          icon="el-icon-circle-close"
+          >关闭</el-button
+        >
+        <el-button
+          size="small"
+          type="primary"
+          icon="el-icon-circle-check"
+          @click="doSubmit()"
+          >确定</el-button
+        >
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { getLine } from '@/api/requisition/basic'
+export default {
+  data() {
+    return {
+      searchForm: {
+        code: '',
+        name: ''
+      },
+      dataListAllSelections: [], // 所有选中的数据包含跨页数据
+      idKey: "id", // 标识列表数据中每一行的唯一键的名称(需要按自己的数据改一下)
+      dataList: [],
+      pageNo: 1,
+      pageSize: 10,
+      total: 0,
+      orders: [],
+      loading: false,
+      visible: false,
+    };
+  },
+  props: {
+    selectData: {
+      type: Array,
+      default: () => {
+        return [];
+      },
+    },
+    // 是否启用单选
+    single: {
+      type: Boolean,
+      default: false
+    }
+  },
+  methods: {
+    init() {
+      this.visible = true;
+      this.$nextTick(() => {
+        this.dataListAllSelections = JSON.parse(JSON.stringify(this.selectData));
+        this.resetSearch();
+      });
+    },
+    // 获取数据列表
+    refreshList() {
+      this.loading = true;
+      getLine({
+        pageNo: 1,
+        size: this.pageSize
+      }).then(({ data }) => {
+        console.log('data',data)
+        this.dataList = data.tableBody;
+        this.total = data.tableBody.length;
+        this.pageNo = data.current;
+        this.loading = false;
+        this.$nextTick(() => {
+          this.setSelectRow();
+        });
+      });
+    },
+    // 每页数
+    sizeChangeHandle(val) {
+      this.pageSize = val;
+      this.pageNo = 1;
+      this.refreshList();
+    },
+    // 当前页
+    currentChangeHandle(val) {
+      this.pageNo = val;
+      this.refreshList();
+    },
+    // 排序
+    resetSearch() {
+      this.$refs.searchForm.resetFields();
+      this.refreshList();
+    },
+    // 选中数据
+    handleSelectionChange(selection, row) {
+      if (this.single && selection.length > 1) {
+        this.$refs.contractTable.clearSelection();
+        this.$refs.contractTable.toggleRowSelection(row);
+      }
+      this.dataListAllSelections = this.single ? [row] : selection
+    },
+    // 设置选中的方法
+    setSelectRow() {
+      this.$refs.contractTable.clearSelection();
+      if (!this.dataListAllSelections || this.dataListAllSelections.length <= 0) {
+        return;
+      }
+      for (let i = 0; i < this.dataList.length; i++) {
+        if (this.dataListAllSelections.some(item => item[this.idKey] == this.dataList[i][this.idKey])) {
+          // 设置选中,记住table组件需要使用ref="table"
+          this.$refs.contractTable.toggleRowSelection(this.dataList[i], true);
+        }
+      }
+    },
+    doSubmit() {
+      this.visible = false;
+      console.log('选择的数据?',this.dataListAllSelections)
+      this.$emit("doSubmit", this.dataListAllSelections);
+    },
+  },
+};
+</script>
+<style lang="scss">
+.userDialog {
+  .el-dialog__body {
+    padding: 10px 0px 0px 10px;
+    color: #606266;
+    font-size: 14px;
+    word-break: break-all;
+  }
+  .el-main {
+    padding: 20px 20px 5px 20px;
+    .el-pagination {
+      margin-top: 5px;
+    }
+  }
+}
+</style>

+ 119 - 68
src/views/material/requisition/add.vue

@@ -449,9 +449,23 @@
             </el-col>
             <el-col :span="8">
               <el-form-item label="业务线" prop="businessLine">
-                <el-input :disabled="disable" v-model="basicForm.businessLine">
+                <el-select
+                    ref="lines"
+                    v-model="basicForm.businessLine"
+                    placeholder="业务线"
+                    :disabled="disable"
+                    @focus="chooseLine"
+                  >
+                    <el-option
+                      v-for="item in lineOptions"
+                      :key="item.id"
+                      :label="item.name"
+                      :value="item.id"
+                    />
+                </el-select>
+                <!-- <el-input :disabled="disable" v-model="basicForm.businessLine">
                   <el-button :disabled="disable" slot="append" icon="el-icon-more" @click="test01"></el-button>
-                </el-input>
+                </el-input> -->
               </el-form-item>
             </el-col>
           </el-row>
@@ -773,6 +787,13 @@
       :selectData="selectData7"
       :single="true"
     />
+
+    <serviceline
+      ref="line"
+      @doSubmit="acceptLine"
+      :selectData="selectData8"
+      :single="true"
+    />
   </div>
 </template>
 
@@ -784,13 +805,14 @@ import unit from '@/components/PopDialog/unit.vue'
 import place from '@/components/PopDialog/place.vue'
 import tax from '@/components/PopDialog/tax.vue'
 import staff from '@/components/PopDialog/staff.vue'
+import serviceline from '@/components/PopDialog/serviceline.vue'
 import { addReq, getReqDetail, editReq } from '@/api/requisition/basic'
 // 调用物料分类详情接口用于数据回显
 import { getDetail } from '@/api/classify/basic';
 // 生产厂商/代理人调用用于回显
 import { getProductFactory } from '@/api/changeApply/basic'
 // 计量单位,产地调用用于回显
-import { getUnit, getPlace, getTax, getStaff} from '@/api/requisition/basic'
+import { getUnit, getPlace, getTax, getStaff, getLine} from '@/api/requisition/basic'
 
 export default {
   name: 'requisition_add',
@@ -802,7 +824,8 @@ export default {
     unit,
     place,
     tax,
-    staff
+    staff,
+    serviceline
   },
   props: ['pageStu', 'row', 'disable'],
   model: {
@@ -817,6 +840,7 @@ export default {
       placeOptions: [],
       taxOptions: [],
       staffOptions: [],
+      lineOptions: [],
       tabValue: 'first',
       basicForm: {
         billCode: '',
@@ -919,7 +943,8 @@ export default {
       selectData4: [],
       selectData5: [],
       selectData6: [],
-      selectData7: []
+      selectData7: [],
+      selectData8: []
     }
   },
   // watch: {
@@ -948,71 +973,77 @@ export default {
   //   }
   // },
   mounted() {
-    this.$nextTick(() => {
       // console.log('页面状态',this.pageStu)
-      if(this.pageStu == 'check') {
-        // alert('详情页面:')
-        console.log('页面状态',this.pageStu)
-        console.log('数据', this.row)
-        this.getDetails(this.row)
-        // 获取树形详情
-        if (this.row.classifyId) {
-          this.getTreeDetails(this.row.classifyId)
-        }
-        // 生产厂家代理人用于回显
-        if (this.row.manufacturerId) {
-          this.getFactoryDetails(this.row.manufacturerId)
-        }
-        // 计量单位回显
-        if (this.row.unitId) {
-          this.getUnitDetails(this.row.unitId)
-        }
-        // 产地回显
-        if (this.row.originPlace) {
-          this.getPlaceDetails(this.row.originPlace)
-        }
-        // 物料税类回显
-        if (this.row.materialRate) {
-          this.getTaxDetails(this.row.materialRate)
-        }
-        // 物料税类回显
-        if (this.row.puPersonnelId) {
-          this.getStaffDetails(this.row.puPersonnelId)
-        }
-      } else if (this.pageStu == 'edit') {
-        // alert('修改页面')
-        console.log('页面状态',this.pageStu)
-        console.log('数据', this.row)
-        this.getDetails(this.row)
-        // 获取树形详情
-        if (this.row.classifyId) {
-          this.getTreeDetails(this.row.classifyId)
-        }
-        // 生产厂家代理人用于回显
-        if (this.row.manufacturerId) {
-          this.getFactoryDetails(this.row.manufacturerId)
-        }
-        // 计量单位回显
-        if (this.row.unitId) {
-          this.getUnitDetails(this.row.unitId)
-        }
-        // 产地回显
-        if (this.row.originPlace) {
-          this.getPlaceDetails(this.row.originPlace)
-        }
-        // 物料税类回显
-        if (this.row.materialRate) {
-          this.getTaxDetails(this.row.materialRate)
-        }
-        // 物料税类回显
-        if (this.row.puPersonnelId) {
-          this.getStaffDetails(this.row.puPersonnelId)
-        }
-      } else if(this.pageStu == 'add') {
-        // alert('新增页面')
-        console.log('页面状态',this.pageStu)
+    if(this.pageStu == 'check') {
+      // alert('详情页面:')
+      console.log('页面状态',this.pageStu)
+      console.log('数据', this.row)
+      this.getDetails(this.row)
+      // 获取树形详情
+      if (this.row.classifyId) {
+        this.getTreeDetails(this.row.classifyId)
+      }
+      // 生产厂家代理人用于回显
+      if (this.row.manufacturerId) {
+        this.getFactoryDetails(this.row.manufacturerId)
+      }
+      // 计量单位回显
+      if (this.row.unitId) {
+        this.getUnitDetails(this.row.unitId)
+      }
+      // 产地回显
+      if (this.row.originPlace) {
+        this.getPlaceDetails(this.row.originPlace)
+      }
+      // 物料税类回显
+      if (this.row.materialRate) {
+        this.getTaxDetails(this.row.materialRate)
+      }
+      // 物料税类回显
+      if (this.row.puPersonnelId) {
+        this.getStaffDetails(this.row.puPersonnelId)
+      }
+      // 业务线回显
+      if (this.row.businessLine) {
+        this.getLineDetails(this.row.businessLine)
+      }
+    } else if (this.pageStu == 'edit') {
+      // alert('修改页面')
+      console.log('页面状态',this.pageStu)
+      console.log('数据', this.row)
+      this.getDetails(this.row)
+      // 获取树形详情
+      if (this.row.classifyId) {
+        this.getTreeDetails(this.row.classifyId)
+      }
+      // 生产厂家代理人用于回显
+      if (this.row.manufacturerId) {
+        this.getFactoryDetails(this.row.manufacturerId)
+      }
+      // 计量单位回显
+      if (this.row.unitId) {
+        this.getUnitDetails(this.row.unitId)
       }
-    })
+      // 产地回显
+      if (this.row.originPlace) {
+        this.getPlaceDetails(this.row.originPlace)
+      }
+      // 物料税类回显
+      if (this.row.materialRate) {
+        this.getTaxDetails(this.row.materialRate)
+      }
+      // 物料税类回显
+      if (this.row.puPersonnelId) {
+        this.getStaffDetails(this.row.puPersonnelId)
+      }
+      // 业务线回显
+      if (this.row.businessLine) {
+        this.getLineDetails(this.row.businessLine)
+      }
+    } else if(this.pageStu == 'add') {
+      // alert('新增页面')
+      console.log('页面状态',this.pageStu)
+    }
   },
   methods: {
     handleClick(tab, event) {
@@ -1075,6 +1106,15 @@ export default {
         }
       })
     },
+    // 业务线回显
+    getLineDetails(id) {
+      getLine({id:id}).then(res => {
+        console.log('业务线', res)
+        if (res.code === 200 ) {
+          this.lineOptions = res.data.tableBody
+        }
+      })
+    },
     // 如果是详情进入,则调用详情接口
     getDetails(row) {
       getReqDetail(row.id).then(res => {
@@ -1288,6 +1328,17 @@ export default {
       this.$refs.staffs.blur()
       this.$refs.staff.init()
     },
+    // 选择业务线
+    acceptLine (selections) {
+      this.lineOptions = selections
+      this.basicForm.businessLine = selections[0].id
+      this.getLineDetails(selections[0].id)
+    },
+    // 业务线显示列表
+    chooseLine () {
+      this.$refs.lines.blur()
+      this.$refs.line.init()
+    },
   }
 }
 </script>