qymljy 2 лет назад
Родитель
Сommit
2fb8fe07be

+ 252 - 0
src/Form/accountsOverdueAdjustment/add.vue

@@ -0,0 +1,252 @@
+<template>
+  <div>
+    <el-button size="small" type="primary" @click="addShow(dialogVisible = true)">新建</el-button>
+    <el-drawer
+        title="新建应收账款逾期调整单"
+        :visible.sync="dialogVisible"
+        size="75%"
+        direction="rtl"
+        :show-close="false"
+        append-to-body
+        @close="onClose(dialogVisible = false)">
+      <div class="drawer__panel">
+        <el-row :gutter="20">
+          <el-form :model="form" :rules="rules" ref="form" label-width="90px" label-position="right" size="mini">
+            <el-col :span="12">
+              <el-form-item label="客户:" prop="sys_enterpriseid">
+                <el-popover
+                    placement="bottom"
+                    width="700"
+                    trigger="click"
+                    v-model="customer.show"
+                    @show="customerList">
+                  <tableTemplate ref="customer" :param="customer.param" :layout="customer.tablecols" height="280px" :custom="true" :width="true" @rowClick="customerSelect">
+                    <template v-slot:customcol="scope">
+                      <p>{{scope.column.data[scope.column.columnname]}}</p>
+                    </template>
+                  </tableTemplate>
+                  <el-input slot="reference" :readonly="true" v-model="enterprisename" autocomplete="off" placeholder="请选择客户" ></el-input>
+                </el-popover>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="订单:" prop="sa_orderid">
+                <el-popover
+                    placement="bottom"
+                    width="700"
+                    trigger="click"
+                    v-model="order.show"
+                    @show="orderList">
+                  <tableTemplate ref="order" :param="order.param" :layout="order.tablecols" height="280px" :custom="true" :width="true" @rowClick="orderSelect">
+                    <template v-slot:customcol="scope">
+                      <p>{{scope.column.data[scope.column.columnname]}}</p>
+                    </template>
+                  </tableTemplate>
+                  <el-input slot="reference" :readonly="true" v-model="sonum" autocomplete="off" placeholder="请选择客户" ></el-input>
+                </el-popover>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="订单行" prop="orderRow">
+                <tableTemplate :checkbox="true" ref="orderRow" :param="orderRow.param" :layout="orderRow.tablecols" height="280px" :custom="true" :width="true" @selectionChange="orderRowSelect">
+                  <template v-slot:customcol="scope">
+                    <div v-if="scope.column.columnname === 'amount'">
+                      <el-input  v-model="scope.column.data.amount" autocomplete="off" placeholder="请输入" @change="orderRowChange(scope.column.data)"></el-input>
+                    </div>
+                    <div v-else-if="scope.column.columnname === 'intoaccountdate'">
+                      <el-date-picker
+                          style="width: 100%"
+                          v-model="scope.column.data.intoaccountdate"
+                          value-format="yyyy-MM-dd"
+                          format="yyyy-MM-dd"
+                          type="date"
+                          @change="orderRowChange(scope.column.data)"
+                          placeholder="选择日期">
+                      </el-date-picker>
+                    </div>
+                    <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
+                  </template>
+                </tableTemplate>
+              </el-form-item>
+            </el-col>
+          </el-form>
+        </el-row>
+      </div>
+      <div class="fixed__btn__panel">
+        <el-button size="small" @click="dialogVisible = false" class="normal-btn-width">取 消</el-button>
+        <el-button size="small" type="primary" @click="onSubmit" :loading="loading" class="normal-btn-width">确 定</el-button>
+      </div>
+    </el-drawer>
+  </div>
+</template>
+
+<script>
+import tableTemplate from '@/template/tableTemplate/index'
+export default {
+  name: "add",
+  components:{tableTemplate},
+  data(){
+    return {
+      dialogVisible:false,
+      enterprisename:'',
+      sonum:'',
+      customer:{
+        show:false,
+        tablecols:[],
+        param:{
+          "id": 20240320140704,
+          "content": {
+            "pageSize": 20,
+            "pageNumber": 1,
+            "where": {
+              "condition": "",
+            }
+          }
+        }
+      },
+      order:{
+        show:false,
+        param:{
+          "id": 20240306135104,
+          "content": {
+            "pageNumber": 1,
+            "pageSize": 20,
+            "sys_enterpriseid": '',
+            "where": {
+              "condition": ""
+            }
+          }
+        }
+      },
+      orderRow:{
+        show:false,
+        param:{
+          "id": 20240319155104,
+          "content": {
+            "sa_orderid": "",
+            "pageNumber": 1,
+            "pageSize": 20,
+            "where": {
+              "condition": ""
+            }
+          }
+        }
+      },
+      form:{
+        "sys_enterpriseid": "",
+        "sa_overdueadjustid": 0,
+        "sa_orderid": '',
+        "orderRow":[]
+      },
+      rules:{
+        sys_enterpriseid:[
+          { required: true, message: '请选择客户', trigger: 'change'},
+        ],
+        sa_orderid:[
+          { required: true, message: '请选择订单', trigger: 'change'},
+        ],
+        orderRow:[
+          { required: true, message: '请选择订单行', trigger: 'change'},
+        ],
+      },
+      orderInfo:[],
+      loading:false
+    }
+  },
+  methods:{
+    addShow(){
+    },
+    /*可选客户*/
+    async customerList(){
+      this.$refs.customer.listData()
+    },
+    customerSelect(item){
+      this.form.sys_enterpriseid = item.sys_enterpriseid
+      this.enterprisename = item.enterprisename
+      this.customer.show = false
+    },
+    /*可选订单*/
+    orderList(){
+      this.order.param.content.sys_enterpriseid = this.form.sys_enterpriseid
+      this.$refs.order.listData()
+    },
+    orderSelect(item){
+      this.form.sa_orderid = item.sa_orderid
+      this.sonum = item.sonum
+      this.order.show = false
+      this.orderRow.param.content.sa_orderid = item.sa_orderid
+      this.$refs.orderRow.listData()
+    },
+    /*可选订单行*/
+    orderRowSelect(item){
+      console.log(item)
+      this.form.orderRow = item
+      this.orderInfo = []
+      this.orderInfo = this.form.orderRow.map(item=>{
+        return {
+          "sa_orderitemsid": item.sa_orderitemsid,
+          "sa_overdueadjustitemsid": "0",
+          "oldintoaccountdate": item.oldintoaccountdate,
+          "point": item.point,
+          "intoaccountdate": item.intoaccountdate,
+          "ownertable": item.ownertable,
+          "ownerid": item.ownerid,
+          "amount": item.amount,
+          "rowindex":item.rowindex
+        }
+      })
+      console.log(this.orderInfo,'orderInfo')
+    },
+    orderRowChange(item){
+      this.orderInfo.forEach(row=>{
+        if (row.rowindex === item.rowindex){
+          row.amount = item.amount
+          row.intoaccountdate = item.intoaccountdate
+        }
+      })
+    },
+    onSubmit(){
+      this.$refs.form.validate(async (valid)=>{
+        if (!valid) return false
+        const res = await this.$api.requested({
+          "id": 20240306134804,
+          "content": {
+            "sys_enterpriseid": this.form.sys_enterpriseid,
+            "sa_overdueadjustid": 0,
+            "sa_orderid": this.form.sa_orderid
+          }
+        })
+        if (res.code != 0){
+          const res1 = await this.$api.requested({
+            "id": "20240319154904",
+            "content": {
+              "sa_overdueadjustid": res.data.sa_overdueadjustid,
+              "overdueadjustitems": this.orderInfo
+            }
+          })
+          this.tool.showMessage(res1,()=>{
+            this.$refs.form.resetFields()
+            this.orderInfo = []
+            this.enterprisename = ''
+            this.sonum = ''
+            this.$store.dispatch('changeDetailDrawer',true)
+            this.$router.push({path:'/overdueAdjustmentDetail',query:{id:res.data.sa_overdueadjustid,rowindex:res.data.rowindex}})
+          })
+        }else {
+          this.$message.error(res.msg)
+        }
+      })
+    },
+    onClose(){}
+  },
+  created() {
+    this.customer.tablecols = this.tool.tabelCol(this.$route.name).customerTable.tablecols
+    this.order.tablecols = this.tool.tabelCol(this.$route.name).orderTable.tablecols
+    this.orderRow.tablecols = this.tool.tabelCol(this.$route.name).orderRowTable.tablecols
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 6 - 2
src/SDrpManagement/accountsOverdueAdjustment/index.vue

@@ -3,15 +3,19 @@
     <basicLayout
         ref="basicLayout"
         tableName="overdueAdjustmentTable"
+        formPath="accountsOverdueAdjustment"
         idName="sa_overdueadjustid"
         :apiId="{query:20240306134604}"
         :isExport="false"
-        :oldFormPath="{add:'SDrpManagement/agentOrder/modules'}"
         :detailPath="{
           path:'/overdueAdjustmentDetail'
         }"
        >
-
+      <template v-slot:tbList="scope">
+        <div>
+          {{scope.data.column.data[[scope.data.column.columnname]]}}
+        </div>
+      </template>
     </basicLayout>
   </div>
 </template>

+ 111 - 0
src/template/tableTemplate/index.vue

@@ -0,0 +1,111 @@
+<template>
+  <div>
+    <!-- :header-cell-style="{background:'#EEEEEE',color:'#333'}" -->
+    <el-table ref="table" :row-class-name="tableClassName" highlight-current-row :data="list"  size="mini" :height="height ? height : list.length <= 5?'280px':'calc(100vh - 268px)'"  @row-click="rowClick" style="width:100%;" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
+              :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}" border @selection-change="selectionChange">
+      <el-table-column
+          type="selection"
+          width="35" fixed v-if="checkbox">
+      </el-table-column>
+      <el-table-column show-overflow-tooltip v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="width ? col.width : 150" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false">
+        <template v-slot:header="{ column,$index }" v-if="customHeader">
+          <slot name="header" :data="column"></slot>
+        </template>
+        <template slot-scope="scope">
+          <div class="table-panel">
+            <!-- 自定义表格显示内容 -->
+            <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>
+            <!-- 否则就是默认 -->
+            <span v-else>{{scope.row[col.columnname]}}</span>
+            <!-- 操作结构内容 -->
+            <slot v-if="col.columnname === 'operation'" name="opreation" :data="scope.row"></slot>
+          </div>
+        </template>
+      </el-table-column>
+    </el-table>
+    <div class="container normal-panel" style="text-align:right">
+      <el-pagination
+          background
+          @size-change="handleSizeChange"
+          @current-change="handleCurrentChange"
+          :current-page="currentPage"
+          :page-sizes="[20, 50, 100, 200]"
+          :page-size="20"
+          layout="total,sizes, prev, pager, next, jumper"
+          :total="total">
+      </el-pagination>
+    </div>
+  </div>
+</template>
+
+<script>
+import {mapGetters} from "vuex"
+export default {
+  name: "index",
+  /*
+  layout:表结构数据;
+  data:表渲染数据;
+  custom:是否启用自定义结构;
+  opwidth:操作列宽度
+*/
+  props:['layout','custom','param','height','fixedName','width','checkbox','redirect','customHeader'],
+  data () {
+    return {
+      list:[],
+      currentPage:0,
+      total:0
+    }
+  },
+  computed:{
+    ...mapGetters({
+      loading:'loading'
+    })
+  },
+  watch:{
+    data(val){
+      this.doLayout()
+    }
+  },
+  methods:{
+    async listData(){
+      const res = await this.$api.requested(this.param)
+      this.list = res.data
+      this.total = res.total
+      this.currentPage = res.pageNumber
+    },
+    rowClick (row) {
+      console.log(row,'row')
+      this.$emit('rowClick',row)
+    },
+    tableClassName ({row,rowIndex}) {
+      row.index = rowIndex
+    },
+    selectionChange(row){
+      this.$emit('selectionChange',row)
+    },
+    doLayout(){
+      if (this.$refs.table){
+        this.$nextTick(()=>{
+          this.$refs.table.doLayout()
+        })
+      }
+    },
+    handleSizeChange(val) {
+      // console.log(`每页 ${val} 条`);
+      this.param.content.pageSize = val
+      this.listData()
+    },
+    handleCurrentChange(val) {
+      // console.log(`当前页: ${val}`);
+      this.param.content.pageNumber = val
+      this.listData()
+    },
+  },
+  mounted () {
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 2 - 2
vue.config.js

@@ -14,8 +14,8 @@ module.exports = {
       port: 8000,
       proxy: {
         '/apis': {
-          target: 'http://61.164.207.46:8000',  // target host*/
-          // target: 'http://192.168.3.13:8080',  // target host*!
+          // target: 'http://61.164.207.46:8000',  // target host*/
+          target: 'http://192.168.3.13:8080',  // target host*!
           // target: 'http://192.168.3.9:8090',  // target host*!
           // target: 'https://oms.idcgroup.com.cn:8079/',  // target host
           // target: 'localhost:8080',  // target host