123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576 |
- <template>
- <div style="width: 100%;height: 100%;padding: 5px">
- <el-form ref="auditForm" :model="auditForm" style="width: 100%;padding: 5px" :rules="auditRules">
- <el-row v-if="auditTarget == 'Project'">
- <el-col style="padding-bottom: 10px">
- <span class="card_title">基本信息</span>
- <el-card shadow="always">
- <el-row>
- <el-col :span="3" class="col-txt"><span>项目名称</span></el-col>
- <el-col :span="8" class="col-words">
- <span>{{ auditForm.proname }}</span>
- </el-col>
- <el-col :span="4" class="col-txt"><span>项目类型</span></el-col>
- <el-col :span="8" class="col-words">
- <span>{{ auditForm.protype }}</span>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="3" class="col-txt"><span>储备项目状态</span></el-col>
- <el-col :span="8" class="col-words">
- <span>{{ auditForm.prostatus }}</span>
- </el-col>
- <el-col :span="4" class="col-txt"><span>销售金额</span></el-col>
- <el-col :span="8" class="col-words">
- <span>{{ auditForm.presales }}</span>
- </el-col>
- </el-row>
- </el-card>
- </el-col>
- </el-row>
- <el-row v-if="transForm.default.formType == 'Contract'">
- <el-col style="padding-bottom: 10px">
- <span class="card_title">表单内容</span>
- <el-card shadow="always">
- <contract-detail ref="contract" :trans-form="transForm?transForm.default:null" :renewal="renewal" />
- </el-card>
- </el-col>
- </el-row>
- <el-row v-if="transForm.default.formType == 'AccPay'">
- <el-col style="padding-bottom: 10px">
- <span class="card_title">表单内容</span>
- <el-card shadow="always">
- <acc-pay ref="accPay" step="add" @baseRefresh="baseRefresh" />
- </el-card>
- </el-col>
- </el-row>
- <el-row v-if="transForm.default.formType == 'RealApproval'">
- <el-col style="padding-bottom: 10px">
- <span class="card_title">表单内容</span>
- <el-card shadow="always">
- <approval-form ref="realApprove" :trans-form="transForm?transForm.default:null" :renewal="renewal" />
- </el-card>
- </el-col>
- </el-row>
- <el-row>
- <el-col style="padding-bottom: 10px">
- <span class="card_title">申请内容</span>
- <el-card shadow="always" style="padding: 15px 5px 5px 15px">
- <el-row>
- <el-col :span="3" class="col-txt"><span>申请理由</span></el-col>
- <el-col :span="20" class="col-input">
- <el-form-item prop="reason">
- <el-input v-model="auditForm.reason" type="textarea" :rows="1">
- 启动储备项目
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="3" class="col-txt"><span>备注说明</span></el-col>
- <el-col :span="20" class="col-input">
- <el-form-item>
- <el-input v-model="auditForm.comment" type="textarea" :rows="2" />
- </el-form-item>
- </el-col>
- </el-row>
- </el-card>
- </el-col>
- </el-row>
- <el-row>
- <el-col style="padding-bottom: 10px">
- <span class="card_title">审核相关</span>
- <el-card shadow="always" style="padding: 15px 5px 5px 15px">
- <el-row>
- <el-col :span="3" class="col-txt"><span>下一步审核人</span></el-col>
- <el-col :span="20" class="col-input">
- <el-form-item prop="currAuditBy">
- <user-select :default-select="selectList" :multiple="false" width="700" @selectValue="parentMethod" />
- <!-- <el-select v-model="auditForm.currAuditBy" placeholder="审核人">
- <el-option
- v-for="item in UserData"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>-->
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="3" class="col-txt"><span>创建日期</span></el-col>
- <el-col :span="8" class="col-input">
- <el-form-item>
- <el-input v-model="auditForm.applytimeStr" disabled />
- </el-form-item>
- </el-col>
- <el-col :span="3" class="col-txt"><span>创建人</span></el-col>
- <el-col :span="9" class="col-input">
- <el-form-item>
- <el-input v-model="auditForm.applyname" disabled />
- </el-form-item>
- </el-col>
- </el-row>
- </el-card>
- </el-col>
- </el-row>
- </el-form>
- <div class="el-dialog__footer">
- <el-button @click="handleClose()">取 消</el-button>
- <el-button type="primary" @click="handleCommit()">确 定</el-button>
- </div>
- </div>
- </template>
- <script>
- import channel from '../../../static/utils/channel'
- import Constant from '../../../static/utils/constant'
- import UserSelect from '@/views/components/UserSelect'
- import ContractDetail from '../../form/ctrForm'
- import ApprovalForm from '../../project/proApprovalForm'
- import AccPay from '../../form/apForm'
- import Base from '@/views/base/base'
- import BaseData from '@/views/base/baseData'
- export default {
- name: 'AuditApplyNew',
- components: {
- ContractDetail,
- AccPay,
- UserSelect,
- ApprovalForm
- },
- mixins: [Base, BaseData],
- props: {
- referenceId: {
- type: String,
- default: ''
- },
- auditTarget: {
- type: String,
- default: 'Project'
- },
- auditType: {
- type: Object,
- default: null
- },
- formType: {
- type: String,
- default: ''
- },
- // 续签标记(1:为续签)
- renewal: {
- type: String,
- default: ''
- }
- },
- data() {
- return {
- dc_key: ['PRO_TYPE'],
- enableStatus: '2',
- dc_project_status: Constant.dc_project_status,
- UserData: [],
- selectList: [],
- UserMap: {},
- auditForm: this.getProjectForm(),
- auditRules: {
- reason: [{ required: true, trigger: 'blur', message: '请输入申请原因' }],
- currAuditBy: [{ required: true, trigger: 'blur', message: '请选择下一步审核人' }]
- },
- transForm: this.getAuditForm(this.referenceId, this.auditType, true)
- }
- },
- watch: {
- referenceId: {
- deep: true,
- handler(val) {
- this.getData(val)
- }
- },
- // formType: {
- // deep: true,
- // handler(val) {
- // this.getData(this.referenceId)
- // }
- // },
- auditType: {
- deep: true,
- handler(val) {
- this.initForm(val)
- }
- }
- },
- mounted() {
- this.generateDcMap()
- this.initProType().then((res) => {
- this.$nextTick(() => {
- this.initUser().then(() => {
- this.getData(this.referenceId)
- this.initForm(this.auditType)
- })
- })
- })
- },
- methods: {
- parentMethod: function(val) {
- if (val.length > 0) {
- this.auditForm.currAuditBy = val.join(',')
- }
- },
- baseRefresh: function(val) {
- console.log(val)
- if (this.auditForm && val) {
- this.auditForm.proname = val.proName
- this.auditForm.custname = val.custName
- }
- },
- getData: function(val) {
- if (this.auditTarget === 'Project') {
- const postData = {
- id: val
- }
- channel.globleRequest('ProMainController', 'getById', postData, 'Project').then((res) => {
- if (res.data) {
- this.auditForm = this.getProjectForm(res.data)
- console.log(this.auditForm)
- }
- }).catch(() => {
- })
- } else if (this.auditTarget === 'OutSource') {
- this.auditForm = this.getAccPayForm()
- }
- },
- initForm: function(_auditType) {
- this.transForm = this.getAuditForm(this.referenceId, _auditType, true)
- },
- handleClose: function() {
- this.$emit('handleApplyClose')
- },
- /* 申请立项*/
- handleCommit: function() {
- this.$refs.auditForm.validate(valid => {
- if (valid) {
- // @Todo 流程启动,表单及类型
- this.auditApplyAdd(this.auditForm, this.auditType)
- } else {
- return false
- }
- })
- },
- auditApplyAdd: function(_val, _auditType) {
- const _this = this
- // 构建子表单数据
- const form = this.getAuditForm(_val.id, _auditType, false)
- // 构建目标表单数据
- let tId = _val.id
- if (this.auditTarget === 'OutSource') {
- tId = form.default.id
- }
- const target = this.getTarget(tId, _auditType)
- target.protype = _val.protype
- // 通用信息项
- const content = {
- proName: _val.proname,
- cusName: _val.custname
- }
- // 审批信息项
- const auditData = {
- auditType: _auditType.key,
- auditName: _auditType.name,
- auditTarget: this.$common.castString(target),
- auditForm: this.$common.castString(form),
- referenceId: _val.id,
- referenceContent: this.$common.castString(content),
- applyBy: _val.applyBy,
- currAuditBy: _val.currAuditBy,
- auditStatus: '0'
- }
- // 审批过程子项
- const auditDetailData = {
- reason: _val.reason,
- comment: _val.comment,
- auditedBy: _val.applyBy,
- nextTo: _val.currAuditBy,
- auditResult: '0'
- }
- channel.globleRequest('FlowAuditController', 'add', auditData, 'audit').then((res) => {
- if (res.data.auditId) {
- auditDetailData.auditId = res.data.auditId
- channel.globleRequest('FlowAuditDetailController', 'add', auditDetailData, 'audit detail')
- if (_this.transForm.default.formType === 'Contract') {
- _this.$refs.contract.addContract(form.default.id)
- } else if (_this.transForm.default.formType === 'AccPay') {
- _this.$refs.accPay.addAP(form.default.id)
- } else if (_this.transForm.default.formType === 'RealApproval') {
- _this.$refs.realApprove.addApproval(form.default.id)
- }
- if (target.processData) {
- channel.globleRequest(target.target, target.op, target.processData, target.target).then((res) => {
- _this.$emit('handleApplyCommit')
- })
- } else {
- _this.$emit('handleApplyCommit')
- }
- }
- }).catch(() => {
- _this.$emit('handleApplyCommit')
- })
- },
- getTarget: function(_id, _auditType) {
- const target = {
- id: _id
- }
- if (this.auditTarget === 'Project') {
- target.target = 'ProMainController'
- target.op = 'edit'
- if (_auditType.key === Constant.AUDIT_TYPE.PRO_APPROVE.key) {
- target.processData = {
- id: _id,
- validstatus: '1'
- }
- target.passData = {
- id: _id,
- validstatus: '2',
- validat: true
- }
- target.refuseData = {
- id: _id,
- validstatus: '3',
- validat: false
- }
- } else if (_auditType.key === Constant.AUDIT_TYPE.SIGN.key) {
- target.processData = {
- id: _id,
- signstatus: '1'
- }
- target.passData = {
- id: _id,
- signstatus: '3',
- signat: true
- }
- target.refuseData = {
- id: _id,
- signstatus: '0'
- }
- } else if (_auditType.key === Constant.AUDIT_TYPE.PRIOR_UP.key) {
- target.processData = {
- id: _id,
- signstatus: '1'
- }
- target.passData = {
- id: _id,
- signstatus: '2',
- signat: true
- }
- target.refuseData = {
- id: _id,
- signstatus: '0'
- }
- } else if (_auditType.key === Constant.AUDIT_TYPE.TENDER.key) {
- target.processData = {
- id: _id,
- bidstatus: '1'
- }
- target.passData = {
- id: _id,
- bidstatus: '2',
- bidat: true
- }
- target.refuseData = {
- id: _id,
- bidstatus: '0'
- }
- } else if (_auditType.key === Constant.AUDIT_TYPE.ENDING.key) {
- target.processData = {
- id: _id,
- enablestatus: '1'
- }
- target.passData = {
- id: _id,
- enablestatus: '2',
- endingat: true
- }
- target.refuseData = {
- id: _id,
- enablestatus: '0'
- }
- } else if (_auditType.key === Constant.AUDIT_TYPE.PRO_REAL_APPROVE.key) {
- target.processData = {
- id: _id,
- validstatus: '1'
- }
- target.passData = {
- id: _id,
- validstatus: '2',
- validat: true
- }
- target.refuseData = {
- id: _id,
- validstatus: '3',
- validat: false
- }
- }
- } else if (this.auditTarget === 'OutSource') {
- target.target = 'AccPayableController'
- target.op = 'edit'
- if (_auditType.key === Constant.AUDIT_TYPE.ACC_PAY.key) {
- target.passData = {
- id: _id,
- apStatus: '1'
- }
- target.refuseData = {
- id: _id,
- apStatus: '3'
- }
- }
- }
- return target
- },
- getAuditForm: function(_referenceId, _auditType, isAdd) {
- const form = {
- default: {
- referenceId: _referenceId,
- referenceType: this.auditTarget,
- isAdd: isAdd
- }
- }
- if (_auditType.key === Constant.AUDIT_TYPE.PRO_APPROVE.key) {
- form.default.controller = ''
- form.default.opQuery = ''
- form.default.formType = 'Approve'
- } else if (_auditType.key === Constant.AUDIT_TYPE.SIGN.key) {
- form.default.id = 'cid-' + String(new Date().getTime())
- form.default.controller = 'CtrMainController'
- form.default.opQuery = 'getById/' + form.default.id
- form.default.formType = 'Contract'
- form.default.opUpdate = 'edit'
- form.default.updateData = {
- valid: '1'
- }
- } else if (_auditType.key === Constant.AUDIT_TYPE.PRIOR_UP.key) {
- form.default.controller = ''
- form.default.opQuery = ''
- form.default.formType = 'Prior'
- } else if (_auditType.key === Constant.AUDIT_TYPE.TENDER.key) {
- form.default.controller = ''
- form.default.opQuery = ''
- form.default.formType = 'Tender'
- } else if (_auditType.key === Constant.AUDIT_TYPE.ENDING.key) {
- form.default.controller = ''
- form.default.opQuery = ''
- form.default.formType = 'Ending'
- } else if (_auditType.key === Constant.AUDIT_TYPE.ACC_PAY.key) {
- form.default.id = 'aid-' + String(new Date().getTime())
- form.default.controller = 'AccPayableController'
- form.default.opQuery = 'getById/' + form.default.id
- form.default.formType = 'AccPay'
- form.default.opUpdate = 'edit'
- form.default.updateData = {
- apStatus: '1'
- }
- } else if (_auditType.key === Constant.AUDIT_TYPE.PRO_REAL_APPROVE.key) {
- form.default.id = 'cid-' + String(new Date().getTime())
- form.default.controller = 'ProApprovalController'
- form.default.opQuery = 'getById/' + form.default.id
- form.default.formType = 'RealApproval'
- form.default.opUpdate = 'edit'
- form.default.updateData = {
- valid: '1'
- }
- }
- return form
- },
- getProjectForm: function(obj) {
- const currUser = this.$common.currUser()
- return {
- id: obj ? obj.id : '',
- proname: obj ? obj.proname : '',
- custname: obj ? obj.custname : '',
- protype: obj ? this.ProTypeMap[obj.protype] : '',
- prostatus: obj ? this.dc_map.dc_project_status[obj.prostatus] : '',
- presales: obj ? obj.presales : '',
- reason: '',
- comment: '',
- currAuditBy: '',
- applyBy: currUser ? currUser.id : '',
- applyname: currUser ? currUser.truename : '',
- applytimeStr: this.$common.transDate(new Date().getTime())
- }
- },
- getAccPayForm: function(obj) {
- const currUser = this.$common.currUser()
- return {
- id: '',
- proname: '',
- custname: '',
- reason: '',
- comment: '',
- currAuditBy: '',
- applyBy: currUser ? currUser.id : '',
- applyname: currUser ? currUser.truename : '',
- applytimeStr: this.$common.transDate(new Date().getTime())
- }
- },
- generateDcMap: function() {
- this.dc_map['dc_project_status'] = this.$common.transDcMap(Constant.dc_project_status)
- },
- /* 辅助相关*/
- initUser: function() {
- const _this = this
- this.UserData = []
- this.UserMap = {}
- return channel.globleRequest('SysUserExtendController', 'listAll', { status: '1' }, 'Pending Audit get user').then((res) => {
- if (res.data) {
- res.data.forEach(function(item) {
- const json = {
- label: item.truename,
- value: item.id
- }
- _this.UserData.push(json)
- _this.UserMap[json.value] = json.label
- })
- }
- }).catch(() => {
- })
- }
- }
- }
- </script>
- <style scoped>
- .audit-card {
- width: 70%;
- }
- .self {
- background: #95ec69;
- }
- .title {
- line-height: 28px;
- }
- .comment{
- line-height: 24px;
- }
- .text {
- font-size: 14px;
- }
- </style>
- <style>
- .el-card__header {
- padding: 10px 20px;
- }
- .el-card__body {
- padding: 10px 20px;
- }
- </style>
|