123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540 |
- <template>
- <el-dialog
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- :title="dialogTitle"
- :visible.sync="dialogVisible"
- top="50px"
- width="75%"
- :before-close="beforeClose"
- >
- <div class="tabsdom">
- <el-tabs v-model="activeName" @tab-click="handleClick">
- <el-tab-pane label="报支申请" name="first">
- <el-form
- ref="elformData"
- :model="form"
- :rules="rules"
- class="cost_form"
- label-width="125px"
- style="width: 100%;padding: 5px"
- >
- <el-card shadow="always" style="padding: 15px 5px 5px 15px">
- <el-row :gutter="10">
- <el-col :span="24">
- <el-form-item label="关联项目" prop="proId">
- <el-select v-model="form.proId" filterable placeholder="关联项目名称">
- <el-option
- v-for="item in ProjectData"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- <span style="float: left">{{ item.label }}</span>
- <span style="float: right; color: #8492a6; font-size: 13px">{{
- item.custname
- }}</span>
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-card class="pdtopbottom16 mb25 pdtop16px">
- <span class="moneydetails">
- <!-- <span style="color: red">*</span>-->
- 费用明细
- </span>
- <el-row :gutter="10" class="eltype">
- <el-col :span="4" class="col-txt txtc"><span>费用类型</span></el-col>
- <el-col :span="4" class="col-txt txtc">
- 金额(元)
- </el-col>
- <el-col :span="4" class="col-txt txtc">
- 发票号
- </el-col>
- <el-col :span="10" class="col-txt txtc">
- 单据
- </el-col>
- </el-row>
- <el-row
- v-for="(item,index) in form.applyUseMoneyDetailListString"
- :gutter="10"
- class="eltype"
- >
- <el-col :span="4">
- <el-select
- size="small"
- v-model="item.feeType"
- filterable placeholder="请选择"
- style="width: 100%"
- >
- <el-option
- v-for="item in dc_data.BUDGET_FY"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-col>
- <el-col :span="4">
- <el-input-number
- v-model="item.feeMoney"
- :controls="false"
- size="small"
- controls-position="right"
- placeholder="请填写金额,如0.1"
- style="width: 100%"
- />
- </el-col>
- <el-col :span="4">
- <el-input
- v-model="item.fileNumber"
- :controls="false"
- size="small"
- :disabled="item.fileList==0"
- controls-position="right"
- placeholder="请输入发票号(需上传发票)"
- style="width: 100%"
- />
- </el-col>
- <el-col :span="10" class="col-input">
- <!-- {{ item.fileList }}-->
- <el-upload
- :action="$constant.BASE_URI+'/FileController/upload'"
- :file-list="item.fileList"
- :http-request="(params)=>{uploadFile(params,index)}"
- :limit="5"
- :multiple="false"
- :show-file-list="false"
- class="upload-demo"
- style="width: 30%;float: left;margin-left: 42px"
- >
- <el-button size="small" style="font-size: 14px" type="text">
- 上传发票
- <img
- src="./fapiaoicon.png"
- style="margin-left: 5px;position: absolute;top: 13.5px;"
- width="24px"
- />
- </el-button>
- </el-upload>
- <el-radio-group
- v-model="item.fileType"
- style="margin-left: 30px;"
- @input="changeFileType($event,index)"
- >
- <el-radio v-if="false" :label="1">上传发票</el-radio>
- <el-radio :label="2">发票后补</el-radio>
- <el-radio :label="3">无发票</el-radio>
- </el-radio-group>
- </el-col>
- <el-col :span="1" class="col-txt txtc">
-
- <el-button
- v-if="index!=0"
- circle
- icon="el-icon-minus"
- @click="deleteRow(index)"
- />
- </el-col>
- <el-col :span="1" class="col-txt txtc">
- <el-button
- v-if="index==form.applyUseMoneyDetailListString.length-1"
- circle
- icon="el-icon-plus"
- type="primary"
- @click="addListRow()"
- />
- </el-col>
- <el-col :span="13"> </el-col>
- <el-col :span="11">
- <div v-for="(file,i) in item.fileList" v-if="item.fileList.length>0"
- style="margin: 0 0px 0px 45px;"
- >
- <div>
- <a :href="file.url">{{ file.name }}</a>
- <span class="el-upload-list__item-actions">
- <i class="el-icon-delete" @click="handlePictureRemove(i,file,item.fileList)"/>
- </span>
- </div>
- </div>
- </el-col>
- </el-row>
- <div class="feeMoneyTotal">
- <div style="float: right">共计金额(元):{{ feeMoneyTotal() }}</div>
- </div>
- </el-card>
- <el-row :gutter="10">
- <el-col :span="24">
- <el-form-item label="用途" prop="useReasons">
- <el-input v-model="form.useReasons" type="textarea"/>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="收款单位(人)" prop="payeeName">
- <el-input v-model="form.payeeName"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="开户银行">
- <el-input v-model="form.bankName"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="银行账户" label-width="125px">
- <el-input v-model="form.bankAccountNum" filterable placeholder="请输入银行账户"/>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="抄送">
- <user-select
- :default-select="selectList"
- :multiple="true"
- class="cclist"
- @selectValue="parentMethod"
- />
- </el-form-item>
- </el-col>
- </el-row>
- </el-card>
- </el-form>
- </el-tab-pane>
- <el-tab-pane label="流程图 " name="second">
- <costCanvas ref="costCanvas"/>
- </el-tab-pane>
- </el-tabs>
- </div>
- <div slot="footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button :loading="loading" type="primary" @click="confirmSubmit()">确 定</el-button>
- </div>
- </el-dialog>
- </template>
- <script>
- import { upload } from '@/static/utils/channel'
- import Base from '@/views/base/base'
- import BaseData from '@/views/base/baseData'
- import UserSelect from '@/views/components/UserSelect'
- import costCanvas from '@/views/workflow/components/myProcess/costCanvas.vue'
- export default {
- name: 'ApplyPay',
- mixins: [Base, BaseData],
- components: {
- upload, UserSelect, costCanvas
- },
- data() {
- return {
- row: {},
- rules: {
- proId: [{ required: true, message: '请选择关联项目', trigger: 'change' }],
- useReasons: [{ required: true, message: '请输入费用报支用途', trigger: 'blur' }],
- payeeName: [{ required: true, message: '请输入收款单位(人)', trigger: 'blur' }],
- password: [{ required: true, message: '请输入密码', trigger: 'blur' }]
- },
- selectList: [],
- loading: false,
- dc_key: ['ORDER_STATUS', 'PAY_TYPE', 'BUDGET_FY'],
- ProjectData: [],
- dialogTitle: '费用报支申请-重新发起',
- dialogVisible: false,
- form: {
- applyUseMoneyDetailListString: [{ fileList: [], fileType: 1 }]
- },
- activeName: 'first'
- }
- },
- mounted() {
- this.initDict(this.dc_key).then((res) => {
- this.initProject({ /* signstatus: '2,3'*/ })
- })
- },
- methods: {
- handleClick(tab, event) {
- this.canVasStatus = false
- if (this.activeName == 'second') {
- this.canVasStatus = true
- this.$nextTick(() => {
- this.$refs.costCanvas.createNodeCanvas(this.row)
- })
- }
- },
- beforeClose() {
- this.form = {
- applyUseMoneyDetailListString: []
- }
- this.dialogVisible = false
- this.activeName = 'first'
- this.$forceUpdate()
- },
- feeMoneyTotal() {
- let feeMoneyTotal = 0
- for (let i = 0; i < this.form.applyUseMoneyDetailListString.length; i++) {
- feeMoneyTotal += this.form.applyUseMoneyDetailListString[i].feeMoney
- }
- this.form.feeMoneyTotal = feeMoneyTotal
- return feeMoneyTotal.toFixed(2)
- },
- changeFileType(e, i) {
- if (e != 1) {
- this.form.applyUseMoneyDetailListString[i].fileList = []
- }
- this.$forceUpdate()
- },
- parentMethod(val) {
- if (val.length > 0) {
- this.form.ccList = val.join(',')
- }
- },
- handlePictureRemove(i, file, fileList) {
- fileList.splice(i, 1)
- let copyFileList = [...fileList]
- fileList = copyFileList
- this.form.applyUseMoneyDetailListString = this.form.applyUseMoneyDetailListString.map((e) => {
- return e
- })
- },
- uploadFile(params, i) {
- upload(params, true).then((res) => {
- this.form.applyUseMoneyDetailListString[i].fileList.push(res)
- this.form.applyUseMoneyDetailListString[i].fileType = 1
- this.$message.success('上传成功')
- this.$forceUpdate()
- })
- },
- baseRequest1(prefix, opUrl, postData) {
- return this.$channel.globleRequest(prefix, opUrl, postData, 'project task')
- },
- async confirmSubmit() {
- for (let i = 0; i < this.form.applyUseMoneyDetailListString.length; i++) {
- if (this.form.applyUseMoneyDetailListString[i].fileType == 1
- &&
- (!this.form.applyUseMoneyDetailListString[i].fileList
- ||
- this.form.applyUseMoneyDetailListString[i].fileList.length == 0)) {
- this.$message.warning(`请上传费用明细中第${i + 1}行的发票文件`)
- return
- }
- if (this.form.applyUseMoneyDetailListString[i].fileType == 1 && this.form.applyUseMoneyDetailListString[i].fileNumber.length == 0) {
- this.$message.warning(`请检查费用明细中第${i + 1}行,并输入发票号`)
- return
- }
- }
- this.$refs.elformData.validate(async(valid) => {
- if (valid) {
- let formData = { ...this.form }
- formData.applyUseMoneyDetailListString.forEach((e) => {
- if (e.fileList) {
- e.fileDataIds = e.fileList.map((e) => {
- return e.data
- }).join()
- }
- })
- let params = formData.applyUseMoneyDetailListString.map((e) => {
- return {
- fileType: e.fileType,
- fileDataIds: e.fileDataIds,
- feeMoney: e.feeMoney,
- feeType: e.feeType,
- fileNumber: e.fileNumber
- }
- })
- let submitData = { ...formData, applyUseMoneyDetailListString: JSON.stringify(params) }
- this.loading = true
- const { data } = await this.baseRequest1('ApplyUseMoneyController', 'addApplyUseMoneyAgain', submitData)
- this.loading = false
- if (data.code == 200) {
- this.form = { applyUseMoneyDetailListString: [{ fileType: 1, fileList: [] }] }
- this.dialogVisible = false
- this.$refs.elformData.clearValidate()
- this.$message.success('流程发起成功')
- this.$emit('getData')
- }
- }
- })
- },
- async setVisible(status, row) {
- this.row = row
- this.activeName = 'first'
- const { data } = await this.baseRequest1('ApplyUseMoneyController', 'getInfoByFlowMainId', { flowMainId: row.id })
- this.form = data
- this.form.applyUseMoneyDetailListString = data.applyUseMoneyDetailList
- for (const e of this.form.applyUseMoneyDetailListString) {
- if (e.fileDataIds.length > 0) {
- // e.fileList = e.fileDataIds.split(',')
- const { data: fileTaoTaoList } = await this.baseRequest1('FileZtController', 'findFileInfoByIds/' + e.fileDataIds, '')
- e.fileList = fileTaoTaoList.data.map((file) => {
- return {
- url: this.$constant.BASE_URI + '/FileController/download/' + file.id,
- name: file.fileName,
- data: file.id,
- uid: new Date().getTime()
- }
- })
- } else {
- e.fileList = []
- }
- }
- // $constant.BASE_URI+'/FileController/download/'
- this.selectList = data.flowMainCcList.map((e) => {
- return e.ccUser
- })
- console.log(this.selectList)
- this.dialogVisible = status
- this.row = row
- delete this.form.flowMainCcList
- delete this.form.applyUseMoneyDetailList
- },
- addListRow() {
- const _this = this
- _this.form.applyUseMoneyDetailListString.push({
- feeType: this.dc_data.BUDGET_FY[0].value,
- fileList: [],
- fileType: 1,
- feeMoney: 0,
- fileNumber: ''
- })
- },
- deleteRow(index) {
- this.form.applyUseMoneyDetailListString.splice(index, 1)
- }
- }
- }
- </script>
- <style lang="scss">
- .cclist {
- .col-input {
- padding: 0;
- }
- }
- .mb25 {
- margin-bottom: 25px;
- }
- .pdtopbottom16 {
- padding: 0px 16px;
- }
- .pdtop16px {
- padding-top: 16px;
- }
- .cost_form {
- .col-input {
- font-weight: 400;
- }
- .el-form-item__label .moneydetails {
- text-align: right;
- font-size: 16px;
- font-family: 微软雅黑;
- padding-right: 10px;
- line-height: 40px;
- word-break: keep-all;
- white-space: nowrap;
- color: #606266;
- text-rendering: optimizeLegibility;
- font-weight: 400;
- }
- .moneydetails {
- text-align: right;
- font-size: 16px;
- font-family: 微软雅黑;
- padding-right: 10px;
- word-break: keep-all;
- white-space: nowrap;
- color: #606266;
- text-rendering: optimizeLegibility;
- font-weight: 400;
- }
- .moneydetails:before {
- content: "*";
- color: #ff4949;
- }
- }
- .txtc {
- text-align: center
- }
- .ml5 {
- margin-left: 5px;
- }
- .eltype {
- margin-bottom: 5px;
- }
- .tabsdom {
- .el-tabs__header {
- text-align: center !important;
- width: 139px !important;
- text-align: center !important;
- display: block !important;
- margin: auto !important;
- margin-bottom: 15px !important;
- }
- .el-tabs__nav-wrap::after {
- display: none;
- }
- .el-upload {
- width: 100%;
- }
- }
- .feeMoneyTotal {
- width: 100%;
- height: 14px;
- font-size: 14px;
- font-weight: 400;
- color: #1890FF;
- margin-top: 31px;
- margin-bottom: 13px;
- }
- </style>
|