Browse Source

提交资产管理,修复列表横向滚动条

caojunjie 3 years ago
parent
commit
13d6e7b866

+ 26 - 0
src/App.vue

@@ -9,3 +9,29 @@ export default  {
   name:  'App'
 }
 </script>
+
+<style>
+.el-table--scrollable-x .el-table__body-wrapper{
+  overflow-x: auto;
+}
+
+.el-table__body-wrapper::-webkit-scrollbar {
+  width: 8px;
+  height: 8px;
+}
+
+.el-table__body-wrapper::-webkit-scrollbar-thumb {
+  border-radius: 5px;
+  height: 100px;
+  background: #afafaf;
+}
+
+.el-table__body-wrapper::-webkit-scrollbar-track {
+  box-shadow: inset 0 0 5px rgba(255, 255, 255, 1);
+  border-radius: 5px;
+  background: rgba(255, 255, 255, 1);
+}
+.el-table__body-wrapper {
+  background: #ffffff;
+}
+</style>

+ 69 - 0
src/api/assetsManagement/index.js

@@ -0,0 +1,69 @@
+import request from '@/utils/request'
+
+// 查询数据主列表
+export function queryData(query) {
+  return request({
+    url: '/anpin/assets/list',
+    method: 'get',
+    params: query
+  })
+}
+// 查询供应商开票单位付款单位
+export function company(query) {
+  return request({
+    url: '/basicdata/corps/getCorpName',
+    method: 'post',
+    data: {
+      fTypeid:query
+    }
+  })
+}
+// 查询品名数据
+export function productName(query) {
+  return request({
+    url: '/basicdata/fees/list',
+    method: 'get',
+    params:query
+  })
+}
+// 查询项目名称
+export function queryItem(query) {
+  return request({
+    url: '/anpin/project/projectName',
+    method: 'post',
+    data: {
+      projectName:query
+    }
+  })
+}
+// 导入数据
+export function listExport(query) {
+  return request({
+    url: '/anpin/assets/template',
+    method: 'get',
+    params:query
+  })
+}
+// 导入数据
+export function deletionee(id) {
+  return request({
+    url: '/anpin/assets/'+id,
+    method: 'delete'
+  })
+}
+
+// 修改资产
+export function modifyData(data) {
+  return request({
+    url: '/anpin/assets',
+    method: 'put',
+    data:data
+  })
+}
+// 查询资产详情
+export function queryDetails(fId) {
+  return request({
+    url: '/anpin/assets/'+fId,
+    method: 'get'
+  })
+}

+ 28 - 3
src/combination/listComponent.vue

@@ -2,9 +2,21 @@
   <div>
     <div style="width: 100%;height: 40px;">
       <div style="margin: 10px 12px;float: left;">
+        <span v-for="(item,index) in customButton" :key="index">
+          <el-upload
+            v-if="item.upload === true"
+            style="float: left;margin-right: 10px"
+            class="upload-demo"
+            :headers="headers"
+            :action="item.action"
+            :show-file-list="false"
+            :on-success="handleAvatarSuccess"
+            :multiple="false">
+             <el-button :size="item.size" :icon="item.icon" :type="item.type" :disabled="item.disabled" :plain="item.plain?item.plain:false" v-hasPermi="item.hasPermi?item.hasPermi:hasPermi.lookup">点击上传</el-button>
+          </el-upload>
         <el-button
-          v-for="(item,index) in customButton"
-          :key="index"
+          v-else
+          style="float: left;margin-right: 10px"
           :type="item.type"
           :size="item.size"
           :icon="item.icon"
@@ -14,6 +26,7 @@
           @click="buttonList(item)">
           {{ item.name }}
         </el-button>
+        </span>
       </div>
       <div class="tabSetting" style="float: right;margin: 10px 0">
         <div style="margin-left:10px;float: right">
@@ -80,7 +93,7 @@
             <span v-if="item.operation == 1">
               <el-button type="text" @click="viewMethod(scope)" v-hasPermi="hasPermi.lookup">查看</el-button>
 <!--              <el-button type="text" @click="modification(scope)">修改</el-button>-->
-              <el-button type="text" @click="deletion(scope)" v-if="scope.row.fBillstatus < 4" v-hasPermi="hasPermi.disappear">删除</el-button>
+              <el-button type="text" @click="deletion(scope)" v-if="scope.row.fBillstatus < 4 || !scope.row.fBillstatus" v-hasPermi="hasPermi.disappear">删除</el-button>
             </span>
             <span v-if="item.operation == 2">
               <el-button type="text" @click="deleteRow(scope.$index, tableData)" :disabled="item.disabled">移除</el-button>
@@ -170,6 +183,7 @@
 <script>
 import { addSet, resetModule } from "@/api/system/set";
 import Cookies from "js-cookie";
+import { getToken } from '@/utils/auth'
 export default {
   name: 'listComponent',
   props: ['tableData', 'listStyle','queryList','customButton','arrow','setRowList','isItHidden','tatolLabel','listData','hasPermi'],
@@ -177,6 +191,9 @@ export default {
     return {
       showSetting: false,
       allCheck: false,
+      headers: {
+        Authorization: "Bearer " + getToken()
+      },
     }
   },
   watch:{
@@ -288,6 +305,14 @@ export default {
     showSearch(){
       this.$emit('showSearch')
     },
+    handleAvatarSuccess(response, file, fileList){
+      console.log()
+      if (response.code == 200){
+        this.$emit('handleAvatarSuccess')
+      }else {
+        this.$message.error(response.msg);
+      }
+    },
     //刷新按钮
     getList(){
       this.$emit('getList')

+ 551 - 0
src/views/assetsManagement/index.vue

@@ -0,0 +1,551 @@
+<template>
+  <div class="app-container">
+    <formComponent
+      :formOption="formOption"
+      :dataList="dataList"
+      :inDex="inDex"
+      ref="avatar"
+      @submitForm="submitForm"
+      @returnToForm="returnToForm"
+    />
+    <listComponent
+      :tableData="tableData"
+      @modify="modification"
+      @deletion="deletion"
+      @buttonList="buttonList"
+      @showSearch="showSearch"
+      @feedback="feedback"
+      @getList="getList"
+      @handleAvatarSuccess="handleAvatarSuccess"
+      @see="viewMethod"
+      :hasPermi="hasPermi"
+      :isItHidden="isItHidden"
+      :customButton="customButton"
+      :listStyle="listStyle"
+      :queryList="queryList"
+      :setRowList="setRowList"
+      :tatolLabel="tatolLabel"
+    />
+    <div style="float: right;margin-bottom: 10px">
+      <pagination
+        v-show="total > 0"
+        :total="total"
+        :page.sync="formDataList.pageNum"
+        :limit.sync="formDataList.pageSize"
+        :page-sizes="[10,100,200,500,1000]"
+        @pagination="getList"
+      />
+    </div>
+    <el-dialog
+      title="资产明细"
+      :visible.sync="dialogVisible"
+      width="80%"
+      :before-close="handleClose">
+      <el-form :model="numberValidateForm" ref="numberValidateForm" label-width="100px" class="demo-ruleForm">
+        <el-row :gutter="24">
+          <el-col :span="8">
+            <el-form-item
+              prop="email"
+              label-width="100px"
+              label="资产存放部门">
+              <el-input style="width: 170px;" v-model="numberValidateForm.fDept"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item
+              prop="email"
+              label-width="80px"
+              label="资产名称">
+              <el-input style="width: 200px;" v-model="numberValidateForm.fName"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item
+              prop="email"
+              label-width="80px"
+              label="规格型号">
+              <el-input style="width: 200px;" v-model="numberValidateForm.fSpec"></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="24">
+          <el-col :span="8">
+            <el-form-item
+              prop="email"
+              label-width="100px"
+              label="单位台/套/张">
+              <el-input style="width: 170px;" v-model="numberValidateForm.fUnit"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item
+              prop="email"
+              label-width="80px"
+              label="数量">
+              <el-input style="width: 200px;" v-model="numberValidateForm.fNumber"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item
+              prop="email"
+              label-width="80px"
+              label="金额">
+              <el-input style="width: 200px;" v-model="numberValidateForm.fAmount"></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="24">
+          <el-col :span="16">
+            <el-form-item
+              prop="email"
+              label-width="100px"
+              label="备注">
+              <el-input style="width: 470px;" v-model="numberValidateForm.remark"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item
+              prop="email"
+              label-width="80px"
+              label="资产编码">
+              <el-input style="width: 200px;" v-model="numberValidateForm.fCode"></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-form-item
+          prop="email"
+          label="图片">
+          <el-upload
+            :action="action"
+            :headers="headers"
+            list-type="picture-card"
+            :on-success="onSuccess"
+            :file-list="fileList"
+            :on-preview="handlePictureCardPreview"
+            :on-remove="handleRemove">
+            <i class="el-icon-plus"></i>
+          </el-upload>
+          <el-dialog :visible.sync="dialogVisibleTwo" append-to-body>
+            <img width="100%" :src="dialogImageUrl" alt="">
+          </el-dialog>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="submitQForm('numberValidateForm')">修 改</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { deletionee, listExport, modifyData, productName, queryData, queryDetails } from '@/api/assetsManagement'
+import { company } from '@/api/purchaseRequest'
+import Cookies from 'js-cookie'
+import { select } from '@/api/system/set'
+import moment from 'moment'
+import { getName } from '@/api/purchaseIssue'
+import { getToken } from '@/utils/auth'
+
+export default {
+  name: 'index',
+  data(){
+    return{
+      tableData:[],
+      action:process.env.VUE_APP_BASE_API + "/common/upload",
+      headers: {
+        Authorization: "Bearer " + getToken()
+      },
+      dialogImageUrl:'',
+      dialogVisible:false,
+      dialogVisibleTwo:false,
+      numberValidateForm:{
+        fImage:[]
+      },
+      fileList:[],
+      total:0,
+      hasPermi: {
+        lookup: ["anpin:stockControl:query"],
+        disappear: ["anpin:stockControl:remove"],
+      },
+      isItHidden: true,
+      formDataList:{
+        pageSize:10,
+        pageNum:1,
+      },
+      listStyle: [{
+          surface: '1',
+          label: 'serialNumber',
+          name: '序号',
+          checked: 0,
+          width: 130,
+          onabort: ''
+        },{
+          surface: '2',
+          label: 'fDept',
+          name: '资产存放部门',
+          checked: 0,
+          width: 130,
+          onabort: ''
+        },{
+          surface: '3',
+          label: 'fName',
+          name: '资产名称',
+          checked: 0,
+          width: 100,
+          onabort: ''
+        },
+        {
+          surface: '4',
+          label: 'fSpec',
+          name: '规格型号',
+          checked: 0,
+          width: 100,
+          onabort: ''
+        },{
+          surface: '5',
+          label: 'fUnit',
+          name: '单位台/套/张',
+          checked: 0,
+          width: 120,
+          onabort: ''
+        },{
+          surface: '6',
+          label: 'fNumber',
+          name: '数量',
+          checked: 0,
+          width: 100,
+          onabort: ''
+        },{
+          surface: '7',
+          label: 'fAmount',
+          name: '金额',
+          checked: 0,
+          width: 100,
+          onabort: ''
+        },
+        // {
+        //   surface: '8',
+        //   label: 'fImage',
+        //   name: '图片',
+        //   checked: 0,
+        //   width: 100,
+        //   onabort: ''
+        // },
+        {
+          surface: '9',
+          label: 'remark',
+          name: '备注',
+          checked: 0,
+          width: 100,
+          onabort: ''
+        },{
+          surface: '10',
+          label: 'fCode',
+          name: '资产编码',
+          checked: 0,
+          width: 100,
+          onabort: ''
+        },{
+          surface: "11",
+          label: "operation",
+          name: "操作",
+          checked: 0,
+          width: 160,
+          fixed: "right",
+          operation: "1",
+          onabort: "",
+        }
+      ],
+      setRowList:[],
+      tatolLabel:['数量','金额'],
+      queryList: {
+        tableName: '资产管理',
+        columnList: []
+      },
+      customButton: [
+        {
+          type: 'primary',
+          upload:true,
+          action:process.env.VUE_APP_BASE_API + '/anpin/assets/import',
+          size: 'mini',
+          icon: 'el-icon-edit',
+          name: '导入',
+          disabled: false,
+          hasPermi:['warehouse:assets:add']
+        },{
+          type: 'primary',
+          size: 'mini',
+          icon: 'el-icon-edit',
+          name: '下载模板',
+          disabled: false,
+        }],
+      inDex: 4,
+      dataList:{
+      },
+      formOption:[
+        {
+          span: 6,
+          label: 'fDept',
+          name: '资产存放部门',
+          inputType: 2,
+          width: 200,
+          labelSize: '100',
+          rules: [{ required: false, message: ' ' }]
+        },{
+          span: 6,
+          label: 'fName',
+          name: '资产名称',
+          inputType: 2,
+          width: 200,
+          labelSize: '80',
+          multiple:true,
+          rules: [{ required: false, message: ' ' }]
+        },
+        {
+          span: 6,
+          label: 'fCode',
+          name: '资产编码',
+          inputType: 2,
+          width: 200,
+          labelSize: '80',
+          rules: [{ required: false, message: ' ' }]
+        }
+      ]
+    }
+  },
+  created() {
+    this.queryList.columnList = this.listStyle
+    this.setRowList = this.listStyle
+    // company(1).then(res => {
+    //   for (let item in res.data) {
+    //     this.dataList.fDept.push({
+    //       label: res.data[item].fName,
+    //       value: res.data[item].fId
+    //     })
+    //   }
+    // })
+    // this.getDicts("data_cost_attribute").then((response) => {
+    //   for(let item in response.data){
+    //     this.dataList.fFeeTypeList.push({
+    //       value: response.data[item].dictValue,
+    //       label:response.data[item].dictLabel
+    //     })
+    //   }
+    // });
+    // productName().then(res => {
+    //   console.log(res)
+    //   if (res.code === 200) {
+    //     for (let item in res.rows) {
+    //       this.dataList.fFeeid.push({
+    //         label: res.rows[item].fName,
+    //         value: res.rows[item].fId,
+    //       })
+    //     }
+    //   }
+    // })
+    this.getList()
+    let data = {
+      tableName: this.queryList.tableName,
+      userId: Cookies.get('userName')
+    }
+    // company(2).then(res => {
+    //   console.log(res)
+    //   this.dataList.fSbu = []
+    //   for (let item in res.data) {
+    //     this.dataList.fSbu.push({
+    //       label: res.data[item].fName,
+    //       value: res.data[item].fId
+    //     })
+    //   }
+    // })
+    this.getRow(data,'S')
+
+  },
+  methods:{
+    handleRemove(file, fileList) {
+      this.numberValidateForm.fImage = []
+      for (let item in fileList){
+        this.numberValidateForm.fImage.push({
+          name:fileList[item].name,
+          url:fileList[item].url
+        })
+      }
+    },
+    handlePictureCardPreview(file) {
+      this.dialogImageUrl = file.url;
+      this.dialogVisibleTwo = true;
+    },
+    onSuccess(response, file, fileList){
+      console.log(fileList)
+      this.numberValidateForm.fImage = []
+      for (let item in fileList){
+        if(fileList[item].response){
+          this.numberValidateForm.fImage.push({
+            name:fileList[item].response.fileName,
+            url:fileList[item].response.url
+          })
+        }else {
+          this.numberValidateForm.fImage.push({
+            name:fileList[item].name,
+            url:fileList[item].url
+          })
+        }
+      }
+    },
+    //修改确认触发
+    submitQForm(formName){
+      // this.numberValidateForm.fImage = JSON.stringify(this.numberValidateForm.fImage)
+      let data = this.numberValidateForm
+      data.fImage = JSON.stringify(data.fImage)
+      modifyData(data).then(res=>{
+        this.dialogVisible = false
+        this.$message.success('修改成功');
+      })
+      // this.$refs[formName].validate((valid) => {
+      //   if (valid) {
+      //     alert('submit!');
+      //   } else {
+      //     console.log('error submit!!');
+      //     return false;
+      //   }
+      // });
+    },
+    //弹窗X关闭时触发
+    handleClose(done) {
+      this.$confirm('确认关闭?')
+        .then(_ => {
+          done();
+        })
+        .catch(_ => {});
+    },
+    //列查询
+    getRow(data,list) {
+      select(data).then((res) => {
+        if (res.data.length != 0) {
+          this.queryList.columnList = res.data.filter((e) => e.checked == 0)
+          this.queryList.columnList = res.data
+          this.setRowList = res.data
+          this.queryList.columnList = this.queryList.columnList.filter((e) => e.checked == 0)
+          // this.waitFor = true
+        } else {
+          this.$set(this.queryList, 'columnList', this.$options.data().listStyle)
+          this.setRowList = this.$options.data().listStyle
+        }
+        this.isItHidden = true
+        // this.inDex = this.formOption.length
+        this.inDex = 4
+        if (list == 'S'){
+          this.$set(this.$refs.avatar.form,'groupDate',1)
+        }
+        this.$refs.avatar.form = this.formDataList
+        this.$set(this.$refs.avatar.form,'groupDate',0)
+      })
+    },
+    submitForm(res) {
+      this.getList()
+    },
+    returnToForm(row) {
+      console.log(row, 111)
+    },
+    //修改
+    modification(scope) {
+      console.log(scope)
+    },
+    //删除
+    deletion(scope){
+      deletionee(scope.row.fId).then(res=>{
+        if(res.code == 200){
+          this.$message.success('删除成功');
+        }
+      })
+    },
+    //查看
+    viewMethod(scope, res, i){
+      this.numberValidateForm = {}
+      this.fileList = []
+      queryDetails(scope.row.fId).then(res=>{
+        this.numberValidateForm = res.data
+        if (!this.numberValidateForm.fImage){
+          this.numberValidateForm.fImage = []
+        }else {
+          this.numberValidateForm.fImage = JSON.parse(this.numberValidateForm.fImage)
+          this.fileList = this.numberValidateForm.fImage
+        }
+      })
+
+      // numberValidateForm
+      this.dialogVisible = true
+    },
+    // 显示搜索条件、点击后会调用此方法
+    showSearch() {
+      // console.log('到我了')
+      this.searchWhether = !this.searchWhether
+    },
+    //点击刷新会调用此方法
+    getList() {
+      queryData(this.formDataList).then(res=>{
+        this.tableData = res.rows
+        this.total = res.total
+      })
+      console.log(this.formDataList.pageSize)
+    },
+    handleAvatarSuccess(){
+      this.formDataList = {
+        pageSize:10,
+        pageNum:1,
+      }
+      this.getList()
+    },
+    //搜索、重置、展开
+    feedback(res) {
+      console.log(res)
+      if (res == '展开') {
+        if (this.inDex == 4) {
+          this.inDex = this.formOption.length
+        } else {
+          this.inDex = 4
+        }
+      } else if (res == '搜索') {
+        this.formDataList = this.$refs.avatar.form
+        this.formDataList.pageNum = 1
+        this.formDataList.pageSize = 10
+        this.$refs.avatar.submitForm(1)
+      } else if (res == '重置') {
+        let list ={
+          pageNum:this.formDataList.pageNum,
+          pageSize:this.formDataList.pageSize
+        }
+        this.$refs.avatar.form = {}
+        this.$refs.avatar.form = this.formDataList = list
+        console.log(this.formDataList,this.$refs.avatar.form)
+        this.$refs.avatar.submitForm(2)
+      }
+    },
+    //所有按钮
+    buttonList(row){
+      console.log(row)
+      switch (row.name){
+        case '下载模板':
+          const queryParams = this.formDataList;
+          this.$confirm("是否确认下载模板?", "警告", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning",
+          }).then(function () {
+              return listExport(queryParams);
+            }).then((response) => {
+              this.download(response.msg);
+            });
+          break
+        case '导入':
+          break
+      }
+    },
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 1 - 1
src/views/reportAnalysis/purchaseRequest.vue

@@ -97,7 +97,7 @@ export default {
         {
           surface: '1',
           label: 'serialNumber',
-          name: '序1号',
+          name: '序号',
           checked: 0,
           width: 100,
           onabort: ''