Browse Source

内部采购订单完善

黄梓星 1 year ago
parent
commit
12a41612b7

+ 34 - 0
src/api/innerData/order.js

@@ -0,0 +1,34 @@
+import request from '@/utils/request'
+
+// 内部订单列表
+export function orderList(params) {
+  return request({
+    url: `/sip/order/list`,
+    method: 'get',
+    params: params
+  })
+}
+// 内部订单删除(明细删除)
+export function delOrder(data) {
+  return request({
+    url: `/sip/order/remove`,
+    method: 'DELETE',
+    data: data
+  })
+}
+// 新增查询订单
+export function searchList(params) {
+  return request({
+    url: `/sip/order/pu/list`,
+    method: 'get',
+    params: params
+  })
+}
+// 内部订单价格修改
+export function editOrder(data) {
+  return request({
+    url: `/sip/order`,
+    method: 'put',
+    data: data
+  })
+}

+ 27 - 0
src/api/innerData/supplier.js

@@ -0,0 +1,27 @@
+import request from '@/utils/request'
+
+// 查询供应商列表
+export function supplierList(params) {
+  return request({
+    url: `/sip/supplier/list`,
+    method: 'get',
+    params: params
+  })
+}
+
+// 供应商新增
+export function addSupplier(data) {
+  return request({
+    url: `/sip/supplier`,
+    method: 'post',
+    data: data
+  })
+}
+// 供应商材删除(明细删除)
+export function delSupplier(data) {
+  return request({
+    url: `/sip/supplier/remove`,
+    method: 'DELETE',
+    data: data
+  })
+}

+ 184 - 0
src/views/innerData/addOrderInfo.vue

@@ -1,18 +1,96 @@
 <template>
   <div id="addOrderInfo">
     <div>
+      <el-card style="position: relative;">
       <p>新增订单</p>
+
+      <el-form :model="basicForm" :rules="basicRules" ref="basic" label-width="auto" :show-message="false">
+        <el-row :gutter="10">
+          <el-col :span="1.5">
+            <el-form-item label="订单查询">
+              <el-input
+                style="width:200px"
+                clearable
+                :disabled="sonDisable"
+                size="mini"
+                v-model.trim="basicForm.orderCode"
+              >
+              </el-input>
+              <el-button style="margin-left: 10px" size="mini" @click="checkOrder">查询</el-button>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+
+        <el-super-ux-table
+            id="data-table"
+            v-model="tableData"
+            index
+            checkbox
+            :size="size"
+            :dict="dict"
+            :page="pageInfo"
+            :height=500
+            :columns="TableColumns"
+            pagination
+            convenitentOperation
+            storage-key="orderTable"
+            @row-dblclick="useSee"
+            @row-select="useSelect"
+            @selection-change="handleSelectionChange"
+            @row-click="rowSelect"
+            @pagination="useQuery(params, pageInfo)"
+            ref="tables"
+          >
+          <ux-table-column
+            fixed="right"
+            title="内部价格"
+            align="center"
+            width="160"
+            >
+            <template slot-scope="scope">
+              <!-- <el-button type="text" size="mini" v-if="scope.row.status == '1' && scope.row.flowId" @click="reback(scope.row)">收回</el-button> -->
+              <!-- <el-button type="text" size="mini" @click="check(scope.row)">查看</el-button> -->
+              <!-- <el-button type="text" size="mini" @click="delItem(scope.row)">删除</el-button> -->
+              <el-input-number size="mini" controls-position="right" :min="0" v-model="scope.row.sipPrice"></el-input-number>
+            </template>
+          </ux-table-column>
+
+          <ux-table-column
+            fixed="right"
+            title="内部供应商"
+            align="center"
+            width="260"
+            >
+            <template slot-scope="scope">
+              <el-input style="width:200px" clearable :disabled="sonDisable" size="mini" v-model="scope.row.sipSupplierName" @clear="clearHang(scope.rowIndex)">
+                <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.rowIndex,'SIP_SUPPLIER_PARAM',true,'选择内部供应商')"></el-button>
+              </el-input>
+            </template>
+          </ux-table-column>
+        </el-super-ux-table>
+
       <div class="btn_group">
         <el-button type="primary" size="mini"  @click="editPage" v-if="sonPageStu == 'check'">编辑</el-button>
         <el-button type="primary" size="mini"  @click="save" v-if="sonPageStu == 'add' || sonPageStu == 'edit'">保存</el-button>
         <el-button size="mini" plain @click="back">返回</el-button>
       </div>
+
+      </el-card>
     </div>
+
+    <Refers ref="refer" @doSubmit="selectionsToInput" :single="true" />
   </div>
 </template>
 
 <script>
+import { searchList, editOrder } from '@/api/innerData/order.js'
 export default {
+  dicts: [],
+  components: {
+    Refers: () => import("@/components/Refers/refers.vue"),
+    ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
+  },
   props: ['pageStu','row', 'disable'],
   model: {
     prop: 'isList',
@@ -23,6 +101,51 @@ export default {
       // 不能直接改变props传来的值
       sonPageStu: this.pageStu,
       sonDisable: this.disable,
+      basicForm: {
+        orderCode: ''
+      },
+      basicRules: {},
+      size: "mini",
+      pageInfo: {
+        pageNum: 1,
+        pageSize: 20,
+        total: 0
+      },
+      tableData: [],
+      selectData: [],
+      // SearchColumns: SearchColumns,
+      TableColumns: [
+        { item: { key: "puOrgName", title: "采购组织" }, attr: {} },
+        { item: { key: "billTypeName", title: "订单类型" }, attr: {} },
+        { item: { key: "supplierName", title: "供应商" }, attr: {} },
+        { item: { key: "orderCode", title: "订单编号" }, attr: {} },
+        { item: { key: "taxPrice", title: "价税合计" }, attr: {} },
+        { item: { key: "buyerName", title: "采购员" }, attr: {} },
+        { item: { key: "materialName", title: "物料名称" }, attr: {} },
+        { item: { key: "materialCode", title: "物料编码" }, attr: {} },
+        { item: { key: "specification", title: "规格" }, attr: {} },
+        { item: { key: "model", title: "型号" }, attr: {} },
+        { item: { key: "manufacturerName", title: "生产厂家/代理人" }, attr: {} },
+        { item: { key: "unitName", title: "单位" }, attr: {} },
+        { item: { key: "qty", title: "数量" }, attr: {} },
+        { item: { key: "money", title: "含税单价" }, attr: {} },
+      ].map(({ item, attr }) => ({
+      attr,
+      item: {
+        ...item,
+        sortabled: true,
+        fixedabled: true,
+        filterabled: true,
+        hiddenabled: true,
+      },
+      })),
+      ids: [],
+      referCondition: {
+        type: "",
+        isPage: true,
+        title: "",
+      },
+      tableIndex: null,
     }
   },
   methods: {
@@ -31,11 +154,72 @@ export default {
       this.sonDisable = false
     },
     async save() {
+      if (this.tableData.length !== 0 ) {
+        editOrder(this.tableData).then(res => {
+          if( res.code === 200 ) {
+            this.$modal.notifySuccess("新增保存成功");
+            this.back()
+          }
+        })
+      } else {
+        this.$modal.notifyWarning("新增数据不能为空");
+      }
+      // console.log(this.tableData)
     },
     back() {
       this.$emit('jugislist', true)
       this.$emit('refresh')
     },
+    checkOrder() {
+      if (this.basicForm.orderCode) {
+      let params = {orderCode: this.basicForm.orderCode}
+        searchList(params).then(res => {
+          if( res.code === 200 ) {
+            this.tableData = res.rows
+            this.pageInfo.total = res.total
+          }
+        })
+      } else {
+        this.$modal.notifyWarning("请输入订单编号查询");
+      }
+    },
+    useSee() {},
+    useSelect() {},
+    handleSelectionChange(selection) {
+      console.log('选中', selection)
+      this.ids = selection.map(item => item.id)
+      console.log('选中数组', this.ids)
+    },
+    rowSelect(row) {
+      this.$refs.tables.toggleRowSelection([{row: row}]);
+    },
+    // 加载列表
+    async useQuery(prop, page) {
+      // let params = {...prop, ...page}
+      // await orderList(params).then(res => {
+      //   if( res.code === 200 ) {
+      //     this.tableData = res.rows
+      //     this.pageInfo.total = res.total
+      //   }
+      // })
+    },
+    clearHang(index) {
+      this.tableData[index].sipSupplierName = ''
+      this.tableData[index].sipSupplier = ''
+    },
+    selectionsToInput(selection) {
+      if ( this.referCondition.type == "SIP_SUPPLIER_PARAM") {
+        this.tableData[this.tableIndex].sipSupplierName = selection[0].name;
+        this.tableData[this.tableIndex].sipSupplier = selection[0].id;
+      }
+    },
+    chooseDept(index, type, isPage, title) {
+      this.tableIndex = index;
+      this.referCondition.type = type;
+      this.referCondition.isPage = isPage;
+      this.referCondition.title = title;
+      this.$refs.refer.init(this.referCondition);
+    },
   }
 }
 </script>

+ 36 - 2
src/views/innerData/addSupplier.vue

@@ -8,11 +8,12 @@
           <el-col :span="1.5">
             <el-form-item label="供应商" prop="supplierName">
               <el-input
+                style="width:200px"
                 clearable
                 :disabled="sonDisable"
                 size="mini"
                 v-model="basicForm.supplierName"
-                @clear="clearHang('供应商')"
+                @clear="clearHang()"
               >
                 <el-button
                   size="mini"
@@ -31,6 +32,22 @@
             </el-form-item>
           </el-col>
         </el-row>
+
+        <el-row :gutter="10">
+          <el-col :span="1.5">
+            <el-form-item label="备注" prop="remark">
+              <el-input
+                style="width:200px"
+                clearable
+                :disabled="sonDisable"
+                size="mini"
+                v-model="basicForm.remark"
+              >
+              </el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+  
       </el-form>
 
       <div class="btn_group">
@@ -48,6 +65,7 @@
 </template>
 
 <script>
+import { addSupplier } from '@/api/innerData/supplier.js'
 export default {
   components: {
     Refers: () => import("@/components/Refers/refers.vue"),
@@ -66,6 +84,7 @@ export default {
         supplierName: '',
         supplierId: '',
         supplierCode: '',
+        remark:''
       },
       basicRules: {},
       referCondition: {
@@ -81,6 +100,16 @@ export default {
       this.sonDisable = false
     },
     async save() {
+      if(this.basicForm.supplierName == '') {
+        this.$modal.notifyWarning("供应商不能为空");
+      } else {
+        await addSupplier(this.basicForm).then(res => {
+          if(res.code === 200) {
+            this.$modal.notifySuccess("新增保存成功");
+            this.back()
+          }
+        })
+      }
     },
     back() {
       this.$emit('jugislist', true)
@@ -97,9 +126,14 @@ export default {
       if ( this.referCondition.type == "SUPPLIER_PARAM") {
         this.basicForm.supplierId = selection[0].id;
         this.basicForm.supplierName = selection[0].name;
+        this.basicForm.supplierCode = selection[0].code;
       }
     },
-    clearHang() {}
+    clearHang() {
+        this.basicForm.supplierId = ''
+        this.basicForm.supplierName = ''
+        this.basicForm.supplierCode = ''
+    }
   }
 }
 </script>

+ 128 - 7
src/views/innerData/orderInfoIndex.vue

@@ -1,11 +1,47 @@
 <template>
   <div id="orderInfoIndex">
     <div v-if="isList">
-      <p>采购订单信息列表</p>
-      <div class="btn_grooup">
-        <el-button type="primary" size="mini" @click="addDivision">新增</el-button>
-        <el-button type="primary" size="mini" @click="delItems">删除</el-button>
-      </div>
+      <el-card v-loading="loading" style="position: relative;">
+        <p>采购订单信息列表</p>
+        <div class="btn_grooup">
+          <el-button type="primary" size="mini" @click="addDivision">新增</el-button>
+          <el-button type="primary" size="mini" @click="delItems">删除</el-button>
+        </div>
+
+        <el-super-ux-table
+            id="data-table"
+            v-model="tableData"
+            index
+            checkbox
+            :size="size"
+            :dict="dict"
+            :page="pageInfo"
+            :height=500
+            :columns="TableColumns"
+            pagination
+            convenitentOperation
+            storage-key="orderTable"
+            @row-dblclick="useSee"
+            @row-select="useSelect"
+            @selection-change="handleSelectionChange"
+            @row-click="rowSelect"
+            @pagination="useQuery(params, pageInfo)"
+            ref="tables"
+          >
+            <ux-table-column
+              fixed="right"
+              title="操作"
+              align="center"
+              width="100"
+              >
+              <template slot-scope="scope">
+                <!-- <el-button type="text" size="mini" v-if="scope.row.status == '1' && scope.row.flowId" @click="reback(scope.row)">收回</el-button> -->
+                <!-- <el-button type="text" size="mini" @click="check(scope.row)">查看</el-button> -->
+                <el-button type="text" size="mini" @click="delItem(scope.row)">删除</el-button>
+              </template>
+            </ux-table-column>
+        </el-super-ux-table>
+      </el-card>
     </div>
 
     <Add v-model="isList" v-if="!isList" :pageStu="page" :disable="disable" :row="rowDetail" @refresh="searchList"/>
@@ -13,9 +49,12 @@
 </template>
 
 <script>
+import { orderList, delOrder } from '@/api/innerData/order.js'
 export default {
+  dicts: [],
   components: {
     Add: () => import("./addOrderInfo.vue"),
+    ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
   },
   data () {
     return {
@@ -25,8 +64,50 @@ export default {
       page: '',
       disable: false,
       rowDetail: {},
+      size: "mini",
+      loading: false,
+      params: {},
+      pageInfo: {
+        pageNum: 1,
+        pageSize: 20,
+        total: 0
+      },
+      tableData: [],
+      selectData: [],
+      // SearchColumns: SearchColumns,
+      TableColumns: [
+        { item: { key: "puOrgName", title: "采购组织" }, attr: {} },
+        { item: { key: "billTypeName", title: "订单类型" }, attr: {} },
+        { item: { key: "supplierName", title: "供应商" }, attr: {} },
+        { item: { key: "orderCode", title: "订单编号" }, attr: {} },
+        { item: { key: "taxPrice", title: "价税合计" }, attr: {} },
+        { item: { key: "buyerName", title: "采购员" }, attr: {} },
+        { item: { key: "materialName", title: "物料名称" }, attr: {} },
+        { item: { key: "materialCode", title: "物料编码" }, attr: {} },
+        { item: { key: "specification", title: "规格" }, attr: {} },
+        { item: { key: "model", title: "型号" }, attr: {} },
+        { item: { key: "manufacturerName", title: "生产厂家/代理人" }, attr: {} },
+        { item: { key: "unitName", title: "单位" }, attr: {} },
+        { item: { key: "qty", title: "数量" }, attr: {} },
+        { item: { key: "money", title: "含税单价" }, attr: {} },
+        { item: { key: "sipPrice", title: "内部价格" }, attr: {} },
+        { item: { key: "sipSupplierName", title: "内部供应商" }, attr: {} },
+      ].map(({ item, attr }) => ({
+      attr,
+      item: {
+        ...item,
+        sortabled: true,
+        fixedabled: true,
+        filterabled: true,
+        hiddenabled: true,
+      },
+      })),
+      ids: []
     }
   },
+  created() {
+    this.useQuery(this.params, this.pageInfo)
+  },
   methods: {
     // 新增
     addDivision() {
@@ -34,9 +115,49 @@ export default {
       this.page = 'add'
       this.disable = false
     },
-    delItems() {},
+    delItems() {
+      if (this.ids.length <= 0) {
+        this.$modal.notifyWarning("至少勾选一条数据");
+      } else {
+        delOrder(this.ids).then(res => {
+          if(res.code === 200) {
+            this.$modal.notifySuccess("删除成功");
+            this.useQuery(this.params, this.pageInfo)
+          }
+       })
+      }
+    },
     searchList() {
-      // this.useQuery(this.params, this.pageInfo)
+      this.useQuery(this.params, this.pageInfo)
+    },
+    useSee() {},
+    useSelect() {},
+    handleSelectionChange(selection) {
+      console.log('选中', selection)
+      this.ids = selection.map(item => item.id)
+      console.log('选中数组', this.ids)
+    },
+    rowSelect(row) {
+      this.$refs.tables.toggleRowSelection([{row: row}]);
+    },
+    // 加载列表
+    async useQuery(prop, page) {
+      let params = {...prop, ...page}
+      await orderList(params).then(res => {
+        if( res.code === 200 ) {
+          this.tableData = res.rows
+          this.pageInfo.total = res.total
+        }
+      })
+    },
+    delItem(row) {
+      const param = [row.id]
+      delOrder(param).then(res => {
+        if(res.code === 200) {
+          this.$modal.notifySuccess("删除成功");
+          this.useQuery(this.params, this.pageInfo)
+        }
+      })
     },
   }
 }

+ 38 - 11
src/views/innerData/supplierIndex.vue

@@ -36,7 +36,7 @@
             >
             <template slot-scope="scope">
               <!-- <el-button type="text" size="mini" v-if="scope.row.status == '1' && scope.row.flowId" @click="reback(scope.row)">收回</el-button> -->
-              <el-button type="text" size="mini" @click="check(scope.row)">查看</el-button>
+              <!-- <el-button type="text" size="mini" @click="check(scope.row)">查看</el-button> -->
               <el-button type="text" size="mini" @click="delItem(scope.row)">删除</el-button>
             </template>
           </ux-table-column>
@@ -50,6 +50,7 @@
 </template>
 
 <script>
+import { supplierList, delSupplier } from '@/api/innerData/supplier.js'
 export default {
   dicts: [],
   components: {
@@ -66,6 +67,9 @@ export default {
       rowDetail: {},
       size: "mini",
       loading: false,
+      params: {
+
+      },
       pageInfo: {
         pageNum: 1,
         pageSize: 20,
@@ -75,8 +79,8 @@ export default {
       selectData: [],
       // SearchColumns: SearchColumns,
       TableColumns: [
-        { item: { key: "supplierName", title: "供应商" }, attr: {} },
-        { item: { key: "registrationName", title: "xxx" }, attr: {} },
+        { item: { key: "supplierName", title: "供应商名称" }, attr: {} },
+        { item: { key: "supplierCode", title: "供应商编码" }, attr: {} },
         { item: { key: "remark", title: "备注"}, attr: {} },
       ].map(({ item, attr }) => ({
       attr,
@@ -91,6 +95,9 @@ export default {
       ids: []
     }
   },
+  created() {
+    this.useQuery(this.params, this.pageInfo)
+  },
   methods: {
     // 新增
     addDivision() {
@@ -98,9 +105,20 @@ export default {
       this.page = 'add'
       this.disable = false
     },
-    delItems() {},
+    delItems() {
+      if (this.ids.length <= 0) {
+        this.$modal.notifyWarning("至少勾选一条数据");
+      } else {
+        delSupplier(this.ids).then(res => {
+          if(res.code === 200) {
+            this.$modal.notifySuccess("删除成功");
+            this.useQuery(this.params, this.pageInfo)
+          }
+       })
+      }
+    },
     searchList() {
-      // this.useQuery(this.params, this.pageInfo)
+      this.useQuery(this.params, this.pageInfo)
     },
     useSee() {},
     useSelect() {},
@@ -115,12 +133,21 @@ export default {
     // 加载列表
     async useQuery(prop, page) {
       let params = {...prop, ...page}
-      // await getEquipmentDataList(params).then(res => {
-      //   if( res.code === 200 ) {
-      //     this.tableData = res.rows
-      //     this.pageInfo.total = res.total
-      //   }
-      // })
+      await supplierList(params).then(res => {
+        if( res.code === 200 ) {
+          this.tableData = res.rows
+          this.pageInfo.total = res.total
+        }
+      })
+    },
+    delItem(row) {
+      const param = [row.id]
+      delSupplier(param).then(res => {
+        if(res.code === 200) {
+          this.$modal.notifySuccess("删除成功");
+          this.useQuery(this.params, this.pageInfo)
+        }
+      })
     },
   }
 }