12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094 |
- <template>
- <div class="borderless">
- <div class="customer-head">
- <div class="customer-back">
- <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
- @click="backToList">返回列表
- </el-button>
- <div class="upper_right_button">
- <el-button type="success"
- size="small"
- class="el-button--small-yh "
- :disabled="true"
- @click.stop="addMainProject">复制新单
- </el-button>
- <el-button class="el-button--small-yh "
- type="primary"
- @click.stop="editMainProject"
- size="small"
- >{{this.id?"确认修改" :"确认新增"}}
- </el-button>
- </div>
- </div>
- </div>
- <div class="customer-main">
- <containerTitle title="基础信息"></containerTitle>
- <basic-container>
- <el-form :model="form" ref="form" label-width="100px" class="demo-ruleForm">
- <el-row>
- <el-col v-for="(item, index) in basicData.column" :span="item.span?item.span:6" :key="index">
- <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
- <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]" size="small" type="datetime" :disabled="item.disabled?true:false" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss"/>
- <el-date-picker v-else-if="item.type === 'date'" style="width: 100%;" v-model="form[item.prop]" size="small" type="date" placeholder="选择日期" value-format="yyyy-MM-dd"/>
- <el-select v-else-if="item.prop === 'paymentType'" style="width: 100%" v-model="form[item.prop]" size="small" placeholder="请选择" clearable filterable>
- <el-option v-for="(item,index) in paymentTerm" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
- </el-select>
- <selectComponent v-else-if="item.prop === 'corpId'" v-model="form[item.prop]" :configuration="configuration"/>
- <el-input type="textarea" v-else-if="(item.prop === 'remark')" v-model="form[item.prop]" size="small" autocomplete="off" placeholder="请输入"></el-input>
- <el-input type="age" v-else-if="item.type === 'unit'" v-model="form[item.prop]" @change="debitChange" :disabled="item.disabled?true:false" size="small" autocomplete="off" placeholder="请输入">
- <template slot="append">元</template>
- </el-input>
- <el-input type="age" v-else v-model="form[item.prop]" :disabled="item.disabled?true:false" size="small" value="0" autocomplete="off" placeholder="请输入">
- <template v-if="item.prop === 'advanceAmount'||item.prop === 'settlmentAmount'||item.prop === 'balanceAmount'" slot="append">元</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </basic-container>
- <containerTitle title="明细列表"></containerTitle>
- <basic-container>
- <avue-crud
- ref="crud"
- :data="data"
- :option="optionTable"
- :page.sync="page"
- :table-loading="loading"
- v-model="optionFrom"
- @row-del="rowDel"
- @row-save="rowSave"
- @row-update="rowUpdate"
- @size-change="sizeChange"
- @current-change="currentChange"
- @selection-change="selectionChange"
- @search-change="searchChange"
- @saveColumn="saveColumn"
- >
- <template slot-scope="scope" slot="menuLeft">
- <el-button type="primary"
- size="small"
- icon="el-icon-plus"
- @click="serviceDialog = true">录入明细
- </el-button>
- <el-button type="info"
- size="small"
- :disabled="crudSelection == 0"
- @click.stop="beforePleaseCheck()">请 核
- </el-button>
- </template>
- <template slot="menuRight">
- <el-button
- size="small"
- type="info"
- @click.stop="openReport()"
- >导出报表
- </el-button>
- </template>
- <template slot-scope="{row,index}" slot="menu">
- <el-button
- type="text"
- size="small"
- @click="rowCellTwo(row,index)"
- :disabled="row.strStatus !== '录入'"
- >{{row.$cellEdit?'修改完成':'修改'}}</el-button>
- <el-button
- type="text"
- size="small"
- @click="rowDel(row,index)"
- :disabled="row.strStatus == '结算完成'"
- >删除</el-button>
- </template>
- <template slot="userid" slot-scope="{row,index}">
- <span v-if="row.$cellEdit" style="float: left;color: #F56C6C;">*</span>
- <span style="margin-left: 12px;padding-top: 2px">{{ row.userName }}</span>
- <el-button v-if="row.$cellEdit" type="text" size="mini" style="float: right" @click="selectUser(row)">选择</el-button>
- </template>
- <template slot="amount" slot-scope="{ row }">
- <el-input
- v-if="row.$cellEdit"
- v-model="row.amount"
- placeholder="请输入"
- size="small"
- oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
- @change="totalChange(row,'金额')"
- ></el-input>
- <span v-else>{{ row.amount }}</span>
- </template>
- <template slot="serviceCharge" slot-scope="{ row }">
- <el-input
- v-if="row.$cellEdit"
- v-model="row.serviceCharge"
- placeholder="请输入"
- size="small"
- oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
- @change="totalChange(row,'服务')"
- ></el-input>
- <span v-else>{{ row.serviceCharge }}</span>
- </template>
- <template slot="matMoney" slot-scope="{ row }">
- <el-input
- v-if="row.$cellEdit"
- v-model="row.matMoney"
- placeholder="请输入"
- size="small"
- oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
- @change="totalChange(row,'代垫')"
- ></el-input>
- <span v-else>{{ row.matMoney }}</span>
- </template>
- </avue-crud>
- </basic-container>
- <containerTitle title="附件上传"></containerTitle>
- <basic-container style="margin-bottom: 40px">
- <avue-crud
- :option="upLoadOption"
- v-model="upLoadForm"
- :data="upLoadData"
- @row-save="upLoadSave"
- @row-update="upLoadUpdate"
- @row-del="upLoadDel"
- ></avue-crud>
- </basic-container>
- </div>
- <el-dialog
- title="导入服务项目"
- append-to-body
- class="el-dialogDeep"
- :visible.sync="serviceDialog"
- width="70%"
- :close-on-click-modal="false"
- :destroy-on-close="true"
- :close-on-press-escape="false">
- <el-row style="height: 0;">
- <el-col :span="5" >
- <div>
- <el-scrollbar>
- <basic-container>
- <avue-tree :option="serviceTreeOption" @node-click="serviceNodeClick"/>
- </basic-container>
- </el-scrollbar>
- </div>
- </el-col>
- <el-col :span="19">
- <basic-container>
- <avue-crud ref="serviceCrud"
- :page.sync="servicePage"
- :search.sync="serviceSearch"
- :option="serviceOption"
- :table-loading="serviceLoading"
- :data="serviceData"
- @refresh-change="serviceRefreshChange"
- @selection-change="serviceSelectionChange"
- @search-change="serviceSearchChange"
- @on-load="serviceOnLoad">
- </avue-crud>
- </basic-container>
- </el-col>
- </el-row>
- <span slot="footer" class="dialog-footer">
- <el-button type="primary" @click="serviceConfirm()" :disabled="this.serviceSelectList.length == 0">导 入</el-button>
- <el-button @click="serviceDialog = false">取 消</el-button>
- </span>
- </el-dialog>
- <el-dialog
- title="导入用户"
- :visible.sync="userDialog"
- class="el-dialogDeep"
- append-to-body
- width="80%">
- <el-row style="margin-top: -5px;height: 0">
- <el-col :span="5">
- <div class="box">
- <el-scrollbar>
- <basic-container>
- <avue-tree :option="userTreeOption" :data="userTreeData" @node-click="userNodeClick"/>
- </basic-container>
- </el-scrollbar>
- </div>
- </el-col>
- <el-col :span="19">
- <basic-container>
- <avue-crud ref="userCrud"
- :option="userOption"
- :data="userDataList"
- :table-loading="userLoading"
- :page.sync="userPage"
- v-model="userForm"
- @search-change="userSearchChange"
- @search-reset="userSearchReset"
- @refresh-change="userRefreshChange"
- @selection-change="userSelectionChange"
- @on-load="userOnLoad"
- >
- </avue-crud>
- </basic-container>
- </el-col>
- </el-row>
- <span slot="footer" class="dialog-footer">
- <el-button @click="userDialog = false">取 消</el-button>
- <el-button type="primary" :disabled="this.userSelection.length == 1 ? false:true" @click="userConfirm" >确 定</el-button>
- </span>
- </el-dialog>
- <el-dialog
- title="流程"
- append-to-body
- class="el-dialogDeep"
- :visible.sync="processDialog"
- width="60%"
- :close-on-click-modal="false"
- :destroy-on-close="true"
- :modal-append-to-body='false'
- :close-on-press-escape="false"
- v-dialog-drag
- >
- <examine-approve
- :itemId ="itemId"
- :closeFun="dialogProcessClose"
- >
- </examine-approve>
- </el-dialog>
- </div>
- </template>
- <script>
- import option from "./configuration/detailsPage.json";
- import startOption from "./configuration/startDialog.json";
- import { projectDetail,editMianProject,updateItemStatus,getSysNo,getPidByItemId} from "@/api/workManagement/mainProject";
- //上传文件json
- import upLoadOption from "../../exportTrade/purchaseContract/config/uploadList.json"
- //服务列表接口
- import {getServiceProjectList,getServiceTypeTree,} from "@/api/workManagement/serviceProject";
- import serviceOption from "./configuration/serviceDialogList.json";
- //业务字典
- import { getDictionary } from "@/api/system/dictbiz";
- // 当前登录人
- import { getUserInfo } from "@/api/system/user";
- //用户组件
- import userOption from "./configuration/userList.json";
- import { getList } from "@/api/system/user";
- import { getDeptLazyTree} from "@/api/system/dept";
- //上传附件删除
- import { corpsbank } from "@/api/basicData/configuration"
- //事务
- import examineApprove from "@/components/examineApprove/index";
- //对象数组比较
- import { contrastObj,contrastList } from "@/util/contrastData";
- import _ from "lodash";
- export default {
- data() {
- return {
- id:'',
- loading: false,
- form:{},
- optionFrom:{},
- data: [],
- crudSelection:[],
- deptDicData:[],//任务部门数据
- serviceDialog:false,//服务导入窗口
- userDialog:false,//用户导入窗口
- //客户组件配置控制
- configuration:{
- multipleChoices:false,
- multiple:false,
- disabled:false,
- searchShow:true,
- collapseTags:false,
- placeholder:'请点击右边按钮选择',
- dicData:[]
- },
- page: {
- currentPage: 1,
- total: 0,
- pageSize: 10
- },
- detailsSelect: {},
- paymentTerm:[],
- //顶部from数据
- basicData: {
- column: [
- {
- label: '系统编号',
- prop: 'sysNo',
- disabled: true,
- rules: [
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- }, {
- label: '项目编码',
- prop: 'code',
- rules: [
- {
- required: true,
- message: ' ',
- trigger: 'blur'
- }
- ]
- }, {
- label: '项目名称',
- prop: 'cname',
- rules: [
- {
- required: true,
- message: ' ',
- trigger: 'blur'
- }
- ]
- }, {
- label: '客户名称',
- prop: 'corpId',
- },{
- label: '合同金额',
- prop: 'debitAmount',
- type:'unit',
- rules: [
- {
- required: true,
- message: ' ',
- trigger: 'blur'
- },
- {
- pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
- message: ' ',
- trigger: 'blur'
- },
- ]
- },
- {
- label: '首付金额',
- prop: 'advanceAmount',
- type:'unit',
- rules: [
- {
- pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '已收金额',
- prop: 'settlmentAmount',
- disabled: true,
- type:'unit',
- rules: [
- {
- pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '未收金额',
- type:'unit',
- prop: 'balanceAmount',
- disabled: true,
- rules: [
- {
- pattern:/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '总服务费',
- prop: 'serviceCharge',
- type:'unit',
- disabled: true,
- rules: [
- {
- pattern:/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '总代垫费',
- prop: 'matMoney',
- type:'unit',
- disabled: true,
- rules: [
- {
- pattern:/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '责任人',
- prop: 'corpAttn',
- }, {
- label: '承揽人',
- prop: 'salesName',
- },
- {
- label: '制单人',
- prop: 'createUserName',
- disabled: true
- }, {
- label: '制单日期',
- prop: 'createTime',
- type: 'datetime',
- valueFormat:"yyyy-MM-dd HH:mm:ss",
- format:"yyyy-MM-dd",
- disabled: true
- },
- {
- label: '电话',
- prop: 'corpTel',
- },
- {
- label: '收款方式',
- prop: 'paymentType',
- type:'select',
- dataType: "number",
- width: 120,
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=affair_payment_term",
- props: {
- label: "dictValue",
- value: "dictKey"
- },
- },
- {
- label: '开始日期',
- prop: 'beginTime',
- valueFormat:"yyyy-MM-dd HH:mm:ss",
- format:"yyyy-MM-dd",
- type:'datetime',
- },
- {
- label: '结束日期',
- prop: 'endTime',
- valueFormat:"yyyy-MM-dd HH:mm:ss",
- format:"yyyy-MM-dd",
- type:'datetime',
- },
- {
- label: '备注',
- span: 24,
- prop: 'remark'
- }
- ],
- },
- optionTable: option,
- //上传文件
- upLoadOption: upLoadOption,
- upLoadData:[],
- upLoadForm:{},
- //服务窗口定义
- serviceTreeOption: {
- nodeKey: 'id',
- lazy: true,
- treeLoad: function(node, resolve) {
- const parentId = node.level === 0 ? 0 : node.data.id;
- getServiceTypeTree(parentId).then(res => {
- resolve(
- res.data.data.map(item => {
- return {
- ...item,
- leaf: !item.hasChildren
- };
- })
- );
- });
- },
- addBtn: false,
- menu: false,
- size: 'small',
- props: {
- labelText: '标题',
- label: 'title',
- value: 'value',
- children: 'children'
- }
- },
- serviceOption:serviceOption,
- serviceLoading:false,
- serviceData:[],
- servicePage:{
- currentPage: 1,
- total: 0,
- pageSize: 10
- },
- serviceSearch:{},
- serviceTreeDeptId:"",
- serviceSelectList:[],
- //用户窗口定义
- userTreeOption: {
- nodeKey: 'id',
- lazy: true,
- treeLoad: function (node, resolve) {
- const parentId = (node.level === 0) ? 0 : node.data.id;
- getDeptLazyTree(parentId).then(res => {
- resolve(res.data.data.map(item => {
- return {
- ...item,
- leaf: !item.hasChildren
- }
- }))
- });
- },
- addBtn: false,
- menu: false,
- size: 'small',
- props: {
- labelText: '标题',
- label: 'title',
- value: 'value',
- children: 'children'
- }
- },
- userTreeData:[],
- userOption:userOption,
- userLoading:false,
- userDataList:[],
- userSelection:[],
- userTreeDeptId:"",
- userForm:{},
- userPage:{
- currentPage: 1,
- total: 0,
- pageSize: 10
- },
- itemId:'',
- //请核窗口定义
- processDialog:false,
- pleaseCheckContact:startOption,
- pleaseCheckLoading:false,
- pleaseCheckData:[],
- pleaseCheckPage:{
- pageSize: 10,
- currentPage: 1,
- total: 0
- },
- //新旧数据比较
- oldData:[],
- oldUpLoadData:[],
- oldForm:{}
- };
- },
- created() {
- // 表格行编辑 输入框change事件
- //单价
- this.optionTable.column[5].change = function (val) {
- val.row.amount = val.row.quantity*val.value;
- }
- //数量
- this.optionTable.column[7].change = function (val) {
- val.row.amount = val.row.price*val.value;
- }
- this.$set(this.form,"debitAmount",0)
- this.$set(this.form,"advanceAmount",0)
- this.$set(this.form,"settlmentAmount",0)
- this.$set(this.form,"balanceAmount",0)
- if(this.$route.query.id){
- this.id = BigInt(this.$route.query.id);//字符串转数字 超长用BigInt
- this.getProjectDetail();
- }
- if(this.$route.query.itemId){
- getPidByItemId(this.$route.query.itemId).then((res)=>{
- this.id = res.data.data;
- this.getProjectDetail();
- })
- }
- const params = {
- code : "affair_payment_term"
- }
- getDictionary(params).then(res =>{
- this.paymentTerm = res.data.data;
- })
- },
- components:{
- examineApprove
- },
- mounted() {
- },
- methods: {
- //合计
- totalChange(row,type){
- let amountList = this.data.map(item => {
- if(item.amount){
- return parseFloat(item.amount);
- }else return 0
- });
- let serviceChargeList = this.data.map(item => {
- if(item.serviceCharge){
- return parseFloat(item.serviceCharge);
- }else return 0
- });
- let matMoneyList = this.data.map(item => {
- if(item.matMoney){
- return parseFloat(item.matMoney);
- }else return 0
- });
- if(type==='金额'){
- if(this.form.debitAmount){
- if(this.form.debitAmount < amountList.reduce((n,m) => n + m)){
- this.$message.error("明细列表合同金额不能大于总金额!")
- }
- }
- }
- if(type==='服务'){
- this.form.serviceCharge = serviceChargeList.reduce((n,m) => n + m)
- }
- if(type==='代垫'){
- this.form.matMoney = matMoneyList.reduce((n,m) => n + m)
- }
- if(row.serviceCharge && row.matMoney){
- if(row.amount < _.add(parseFloat(row.serviceCharge),parseFloat(row.matMoney))){
- this.$message.error("服务费代垫费不能超过合同金额!")
- row.serviceCharge = 0;
- row.matMoney = 0;
- }
- }
- },
- //查询明细
- getProjectDetail(pleaseCheck){
- if(this.id){
- projectDetail(this.id,"0,1,2,3,4,5").then(res =>{
- this.form = res.data.data;
- this.oldForm = Object.assign({},res.data.data);
- console.log(res.data.data.corpName)
- this.configuration.dicData = this.form.corpName;
- // this.configuration.dicData = res.data.data.corpName; //给客户名称赋值
- if(res.data.data.itemList){
- this.operationDetailList(res.data.data.itemList);
- }
- if(res.data.data.filesList){
- this.upLoadData = res.data.data.filesList
- this.oldUpLoadData = this.deepClone(res.data.data.filesList)
- }
- })
- }else{
- getSysNo().then(res =>{
- this.$set(this.form,"sysNo", res.data.data)
- let date = new Date();
- let strDate = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
- this.$set(this.form,"createTime",strDate)
- });
- getUserInfo().then(res =>{
- this.$set(this.form,"createUserName", res.data.data.name)
- })
- }
- },
- operationDetailList(itemList){
- this.data = itemList;
- this.oldData = this.deepClone(itemList)
- let status = [];
- this.data.forEach(item =>{
- item.status == 0 ? status.push(true) : status.push(false)
- })
- //如果 明细列表存在 请核之后的状态 禁止编辑一些输入框
- if(status.findIndex(item => item == false) == 0){
- this.basicData.column.forEach(item =>{
- if(item.prop == "code" || item.prop == "cname" || item.prop == "corpId" || item.prop == "debitAmount"){
- item.disabled = true
- this.configuration.disabled = true
- }
- })
- }else{
- this.basicData.column.forEach(item =>{
- if(item.prop == "code" || item.prop == "cname" || item.prop == "corpId" || item.prop == "debitAmount"){
- item.disabled = false
- this.configuration.disabled = false
- }
- })
- }
- },
- //删除列表后面的删除按钮触发触发(row, index, done)
- rowDel(row, index) {
- this.$confirm("确定将此明细删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- this.data.splice(index,1)
- });
- },
- // 合同金额
- debitChange(val){
- if(val){
- if(!this.form.settlmentAmount){
- this.$set(this.form,"balanceAmount",val)
- }
- }
- // if(this.form.debitAmount){
- // if(this.form.serviceCharge && parseFloat(this.form.serviceCharge) > parseFloat(this.form.debitAmount)){
- // this.$message.warning('服务费不得大于合同金额!')
- // this.$set(this.form,"serviceCharge","");
- // return
- // }
- // if(this.form.matMoney && parseFloat(this.form.matMoney) > parseFloat(this.form.debitAmount)){
- // this.$message.warning('代垫费费不得大于合同金额!')
- // this.$set(this.form,"matMoney","");
- // return
- // }
- // if(this.form.serviceCharge && this.form.matMoney){
- // if(_.add(parseFloat(this.form.serviceCharge),parseFloat(this.form.matMoney))> parseFloat(this.form.debitAmount)){
- // this.$message.warning('服务费代垫费总和不得大于合同金额!')
- // this.$set(this.form,"serviceCharge","");
- // this.$set(this.form,"matMoney","");
- // }
- // }
- // }
- },
- //新单
- addMainProject(){
- this.$confirm("需先将此单据保存", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(()=>{
- this.editMainProject(10010);
- })
- },
- openPleaseCheckDialog(){
- this.processDialog = true;
- this.itemId = this.crudSelection[0].id //记得不能写死
- },
- //请核之前
- beforePleaseCheck(){
- if(this.crudSelection){
- let id = [];
- let result = [];
- this.crudSelection.forEach(item=>{
- // 新录入状态下 才可提交审核
- item.id ? id.push(true) : id.push(false) //如果没有id并且为新录入 提示保存
- item.strStatus === "录入" ? result.push(true) : result.push(false) //判断所有的是否为录入状态
- })
- if(id.findIndex(item => item != true) == -1){
- if(result.findIndex(item => item != true) == -1){
- if(contrastObj(this.form,this.oldForm) || contrastList(this.data,this.oldData)){ //判断是否改动过此页面
- this.$confirm("您已改动此页面,请先保存之后在请核?", "提示", {
- confirmButtonText: "保存",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- this.editMainProject();
- }).catch(()=>{
- return
- })
- }else{
- this.pleaseCheck()
- // this.openPleaseCheckDialog();
- }
- }else{
- this.$message({
- type: "error",
- message: "请核数据中存在已请核数据!"
- });
- return
- }
- }else{
- this.$confirm("列表内存在新录入数据,是否先保存此数据?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- this.editMainProject();
- })
- }
- }
- },
- //新增 修改
- editMainProject(pleaseCheck){
- this.$refs["form"].validate((valid) => {
- //校验明细列表
- let valids = true;
- if(this.data.length !=0){
- this.data.forEach((item) =>{
- if((item.userid =="" || !item.deptid) && valids){
- this.$message({
- type: "warning",
- message: "请检查明细列表第 "+(item.$index +1 )+" 行必填项"
- });
- valids = false;
- }
- })
- }
- if(valid && valids){
- const params = {
- ...this.form,
- itemList:this.data,
- filesList:this.upLoadData
- }
- editMianProject(params).then(res =>{
- this.id = res.data.data
- if(pleaseCheck === 10010){ //复制新单新单
- this.$router.push({
- path: "/mainItems_detailsPage",
- query: {id: ''},
- });
- //清空关键信息
- this.form = {}
- this.data = []
- this.upLoadData = []
- this.id = ''
- }else if(pleaseCheck === 10001){ //返回列表保存数据
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.goBackPage();
- }else{
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.getProjectDetail()
- }
- })
- }
- })
- },
- //请核
- pleaseCheck(){
- this.crudSelection.forEach(item =>{
- updateItemStatus(this.data[item.$index].id,1).then(res =>{
- if(res.data.success){
- }
- })
- this.$message({
- type: "success",
- message: "请核成功!"
- });
- //刷新列表
- this.getProjectDetail();
- })
- },
- //返回主营项目列表
- backToList(){
- if(contrastObj(this.form,this.oldForm) || contrastList(this.data,this.oldData)
- || contrastList(this.upLoadData,this.oldUpLoadData)
- ){
- this.$confirm("是否保存当前页面?", "提示", {
- confirmButtonText: "保存",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- this.editMainProject(10001)
- }).catch(()=>{
- this.goBackPage();
- })
- }else{
- this.goBackPage();
- }
- },
- //返回列表判断返回那一个
- goBackPage(){
- if(this.$route.query.itemId){ //如果是从统计列表跳转过来的 那么在调回去
- this.$router.push({
- path: '/statistical_List',
- query: {}
- });
- }else{
- this.$router.$avueRouter.closeTag();
- this.$router.push({
- path: '/workManagement/main-items/list',
- query: {}
- });
- }
- },
- //点击修改或保存时触发
- rowCellTwo(row,index){
- this.$refs.crud.rowCell(row, index);
- },
- //选择时
- selectionChange(row){
- this.crudSelection = row;
- },
- //新增修改时保存触发
- rowSave(row, done, loading) {
- done()
- },
- rowUpdate(row, index, done, loading) {
- done(row)
- },
- searchChange(params, done) {
- this.getList(this.page, params);
- done();
- },
- sizeChange(val) {
- this.page.pageSize = val;
- this.getList();
- },
- currentChange(val) {
- this.page.currentPage = val;
- this.getList();
- },
- saveColumn(row, column) {
- console.log(row, column);
- },
- //上传文件保存
- upLoadSave(row, done, loading){
- this.upLoadData.push(row)
- done()
- },
- //修改附件上传触发
- upLoadUpdate(row, done){
- done(row);
- },
- //删除附件上传触发
- upLoadDel(row, index,){
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- if (row.id){
- corpsbank(row.id).then(res=>{
- if(res.data.success){
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.bankOfDepositData.splice(index, 1);
- }
- })
- }else {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.bankOfDepositData.splice(index, 1);
- }
- })
- },
- //服务窗口事件
- serviceNodeClick(data) {
- this.serviceTreeDeptId = data.id;
- this.serviceOnLoad(this.servicePage);
- },
- serviceRefreshChange(){
- this.serviceOnLoad(this.servicePage, this.serviceSearch)
- },
- serviceSearchChange(params, done){
- this.serviceOnLoad(this.servicePage, params)
- done();
- },
- serviceSelectionChange(row){
- this.serviceSelectList = row;
- },
- serviceOnLoad(page, params = {}) {
- this.serviceLoading = true;
- getServiceProjectList(page.currentPage, page.pageSize, params, this.serviceTreeDeptId).then(res => {
- this.serviceData = res.data.data.records
- this.servicePage.total = res.data.data.total
- this.serviceLoading = false
- })
- },
- serviceConfirm(){
- if(this.serviceSelectList.length != 0){
- this.serviceSelectList.forEach((item)=>{
- const params = {
- strStatus:"录入",
- pname:item.cname,
- remarks:item.remarks,
- price:item.price,
- unit:item.unit,
- frequency:item.rate,
- }
- this.$refs.crud.rowCellAdd(params);
- this.$refs.crud.rowCell(item, this.optionFrom.length-1)
- })
- }
- this.serviceSelectList = []
- this.serviceDialog = false
- this.$message({
- type: "success",
- message: "导入成功!"
- });
- },
- //用户窗口事件
- selectUser(row){
- this.userDialog = true
- this.detailsSelect = row.$index;
- },
- userSearchChange(params, done){
- this.userOnLoad(this.userPage, params);
- done()
- },
- userSearchReset(){
- },
- userRefreshChange(){
- this.userOnLoad(this.userPage)
- },
- userSelectionChange(row){
- this.userSelection = row;
- },
- userOnLoad(page,params={}){
- this.userLoading = true;
- getList(page.currentPage, page.pageSize, params, this.userTreeDeptId).then(res => {
- this.userDataList = res.data.data.records
- this.userPage.total = res.data.data.total
- this.userLoading = false;
- });
- },
- userNodeClick(data){
- this.userTreeDeptId = data.id;
- this.userOnLoad(this.userPage);
- },
- //确定
- userConfirm(){
- if(this.userSelection){
- this.data[this.detailsSelect].userid = this.userSelection[0].id;
- this.$set(this.data[this.detailsSelect],'userName',this.userSelection[0].realName)
- this.userDialog = !this.userDialog
- }
- },
- dialogProcessClose(){
- this.processDialog = false
- this.getProjectDetail()
- },
- },
- };
- </script>
- <style scoped lang="scss">
- .main-head {
- position: fixed;
- top: 105px;
- width: 100%;
- margin-left: -10px;
- height: 62px;
- background: #ffffff;
- box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
- z-index: 999;
- }
- .upper_right_button{
- display: flex;
- position: fixed;
- right: 12px;
- top: 47px;
- }
- .main-back {
- cursor: pointer;
- line-height: 62px;
- font-size: 16px;
- color: #323233;
- font-weight: 400;
- }
- .avue-tree {
- overflow: hidden;
- max-height: 660px;
- }
- ::v-deep .el-form-item {
- margin-bottom: 0;
- }
- ::v-deep .el-form-item__content{
- line-height: 32px;
- }
- </style>
|