detailsPage.vue 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720
  1. <template>
  2. <div class="borderless">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList">返回列表
  7. </el-button>
  8. <div class="upper_right_button">
  9. <!-- <el-button type="success"-->
  10. <!-- size="small"-->
  11. <!-- class="el-button&#45;&#45;small-yh "-->
  12. <!-- :loading="buttonLoading"-->
  13. <!-- :disabled="!form.id || viewDisabled"-->
  14. <!-- @click.stop="mainCheck">-->
  15. <!-- 请核-->
  16. <!-- </el-button>-->
  17. <!-- <el-dropdown style="padding: 0 8px;line-height: 0">-->
  18. <!-- <el-button-->
  19. <!-- type="success"-->
  20. <!-- :loading="buttonLoading"-->
  21. <!-- :disabled="!form.id || viewDisabled"-->
  22. <!-- size="small"-->
  23. <!-- >-->
  24. <!-- 业务处理<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
  25. <!-- </el-button>-->
  26. <!-- <el-dropdown-menu slot="dropdown">-->
  27. <!-- <el-dropdown-item-->
  28. <!-- :loading="buttonLoading"-->
  29. <!-- :disabled="!form.id"-->
  30. <!-- @click.native="createData()">创建单据-->
  31. <!-- </el-dropdown-item>-->
  32. <!-- <el-dropdown-item-->
  33. <!-- :loading="buttonLoading"-->
  34. <!-- :disabled="!form.id"-->
  35. <!-- @click.native="copyData()">复制单据-->
  36. <!-- </el-dropdown-item>-->
  37. <!-- </el-dropdown-menu>-->
  38. <!-- </el-dropdown>-->
  39. <el-button type="primary" size="small" :disabled="buttonLoading" @click="postMessage">发送消息
  40. </el-button>
  41. <el-button type="primary" :loading="buttonLoading" @click.stop="editMainProject" size="small">保存数据
  42. </el-button>
  43. </div>
  44. </div>
  45. </div>
  46. <div class="customer-main">
  47. <trade-card title="基础信息">
  48. <avue-form class="trading-form" ref="form" v-model="form" :option="option">
  49. <template slot="corpId">
  50. <crop-select v-model="form.corpId" corpType="KG" :disabled="viewDisabled" style="width: 100%"></crop-select>
  51. </template>
  52. <template slot="corpAttn">
  53. <el-select v-model="form.corpAttn" :disabled="viewDisabled" icon="el-icon-edit" remote filterable clearable
  54. :remote-method="corpAttnRemoteMethod">
  55. <el-option v-for="item in corpAttnDic" :key="item.value" :label="item.realName" :value="item.realName">
  56. </el-option>
  57. </el-select>
  58. </template>
  59. <template slot="salesName">
  60. <el-select v-model="form.salesName" :disabled="viewDisabled" remote filterable clearable
  61. :remote-method="salesNameRemoteMethod">
  62. <el-option v-for="item in salesNameDic" :key="item.value" :label="item.realName" :value="item.realName">
  63. </el-option>
  64. </el-select>
  65. </template>
  66. <template slot="sourceBusiness">
  67. <el-select v-model="form.sourceBusiness" :disabled="viewDisabled" filterable clearable>
  68. <el-option v-for="(item, index) in sourceBusinessDic" :key="index" :label="item.dictValue"
  69. :value="item.dictValue">
  70. </el-option>
  71. </el-select>
  72. </template>
  73. <template slot="remark">
  74. <el-input type="textarea" v-model="form.remark" size="small" rows="6" autocomplete="off" placeholder="">
  75. </el-input>
  76. </template>
  77. </avue-form>
  78. </trade-card>
  79. <containerTitle title="明细列表"></containerTitle>
  80. <basic-container>
  81. <avue-crud ref="crud" :data="data" :option="optionTable" :table-loading="loading" v-model="optionFrom"
  82. @row-del="rowDel" @row-save="rowSave" @row-update="rowUpdate" @size-change="sizeChange"
  83. @current-change="currentChange" @selection-change="selectionChange" @search-change="searchChange"
  84. @saveColumn="saveColumn" @resetColumn="resetColumn">
  85. <template slot="menuLeft">
  86. <el-tabs v-model="activeName" @tab-click="handleClick">
  87. <el-tab-pane label="原始数据" name="first" :key="'first'">
  88. </el-tab-pane>
  89. <el-tab-pane label="追加" name="second" :key="'second'">
  90. </el-tab-pane>
  91. <el-tab-pane label="退款" name="three" :key="'three'">
  92. </el-tab-pane>
  93. </el-tabs>
  94. <el-button type="primary" size="small" icon="el-icon-plus" :disabled="viewDisabled"
  95. @click="serviceDialog = true">录入明细
  96. </el-button>
  97. </template>
  98. <!-- <el-button type="info"-->
  99. <!-- size="small"-->
  100. <!-- v-if="false"-->
  101. <!-- :disabled="crudSelection == 0"-->
  102. <!-- @click.stop="beforePleaseCheck()">请 核-->
  103. <!-- </el-button>-->
  104. <!-- </template>-->
  105. <template slot-scope="{row,index}" slot="menu">
  106. <el-button v-if="row.status !== 5" type="text" size="small" @click="beforeCloseAccount(row)">结算</el-button>
  107. <el-button v-if="row.status === 5" type="text" size="small" :disabled="viewDisabled"
  108. @click="cancelCloseAccount(row)">取消结算</el-button>
  109. <el-button :disabled="row.taskStatus != 10" type="text" size="small" @click="dispatch(row, index)">派工
  110. </el-button>
  111. <el-button type="text" size="small" @click="rowCellTwo(row, index)"
  112. :disabled="row.strStatus == '结算完成' || viewDisabled">{{ row.$cellEdit ? '修改完成' : '修改' }}</el-button>
  113. <el-button type="text" size="small" @click="rowDel(row, index)"
  114. :disabled="row.strStatus == '结算完成' || viewDisabled">删除</el-button>
  115. </template>
  116. <template slot="userid" slot-scope="{row,index}">
  117. <user-select v-if="row.$cellEdit" v-model="row.userName" @value="(values) => value(values, row)"
  118. :configuration="UConfiguration">
  119. </user-select>
  120. <span v-else>{{ row.userName }}</span>
  121. </template>
  122. <template slot="frequency" slot-scope="{ row }">
  123. <el-select v-if="row.$cellEdit" size="small" v-model="row.frequency" placeholder="请选择"
  124. @change="frequencyChange(row)" clearable>
  125. <el-option v-for="item in frequencyList" :key="item.id" :label="item.dictValue" :value="item.dictKey">
  126. </el-option>
  127. </el-select>
  128. <span v-else>{{ row.frequency | frequencyFormat(frequencyList) }}</span>
  129. </template>
  130. <template slot="second" slot-scope="{ row }">
  131. <el-select v-if="row.$cellEdit && row.frequency >= 1 && row.frequency < 5" size="small" v-model="row.second"
  132. placeholder="请选择" clearable>
  133. <el-option v-for="item in secondList" :key="item.id" :label="item.dictValue" :value="item.dictKey">
  134. </el-option>
  135. </el-select>
  136. <span v-else>{{ row.frequency != 5 ? row.second : '-' }}</span>
  137. </template>
  138. <template slot="amount" slot-scope="{ row }">
  139. <el-input v-if="row.$cellEdit" v-model="row.amount" placeholder="请输入" size="small"
  140. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  141. @change="totalChange(row, '金额')"></el-input>
  142. <span v-else>{{ row.amount }}</span>
  143. </template>
  144. <template slot="serviceCharge" slot-scope="{ row }">
  145. <el-input v-if="row.$cellEdit" v-model="row.serviceCharge" placeholder="请输入" size="small"
  146. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  147. @input="costCount(row)" @change="totalChange(row, '服务')"></el-input>
  148. <span v-else>{{ row.serviceCharge }}</span>
  149. </template>
  150. <template slot="matMoney" slot-scope="{ row }">
  151. <el-input v-if="row.$cellEdit" v-model="row.matMoney" placeholder="请输入" size="small"
  152. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  153. @input="costCount(row)" @change="totalChange(row, '代垫')"></el-input>
  154. <span v-else>{{ row.matMoney }}</span>
  155. </template>
  156. <template slot="taskStatus" slot-scope="{ row }">
  157. <span v-if="row.taskStatus == 10">暂存</span>
  158. <span v-if="row.taskStatus == 20">进行中</span>
  159. <span v-if="row.taskStatus == 30">完成</span>
  160. </template>
  161. <template slot="otheramt" slot-scope="{ row }">
  162. <el-input v-if="row.$cellEdit" v-model="row.otheramt" placeholder="请输入" size="small"
  163. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  164. @input="costCount(row)"></el-input>
  165. <span v-else>{{ row.otheramt }}</span>
  166. </template>
  167. </avue-crud>
  168. </basic-container>
  169. <containerTitle title="补充信息"></containerTitle>
  170. <basic-container>
  171. <el-form :model="formTwo" ref="formTwo" label-width="100px" class="demo-ruleForm">
  172. <el-row>
  173. <el-col v-for="(item, index) in basicData.column" :span="item.span ? item.span : 6" :key="index">
  174. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  175. <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="formTwo[item.prop]"
  176. size="small" type="datetime" :disabled="item.disabled ? true : false || viewDisabled"
  177. placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" />
  178. <el-date-picker v-else-if="item.type === 'date'" style="width: 100%;" v-model="formTwo[item.prop]"
  179. size="small" type="date" :disabled="viewDisabled" placeholder="选择日期" value-format="yyyy-MM-dd" />
  180. <el-input type="textarea" v-else-if="(item.prop === 'remark')" v-model="formTwo[item.prop]"
  181. :disabled="viewDisabled" size="small" autocomplete="off" placeholder="请输入"></el-input>
  182. <el-input type="age" v-else-if="item.prop === 'debitAmount'" v-model="formTwo[item.prop]"
  183. @change="debitChange" :disabled="item.disabled ? true : false || viewDisabled" size="small"
  184. autocomplete="off" placeholder="请输入">
  185. <template slot="append">元</template>
  186. </el-input>
  187. <el-input type="age" v-else-if="item.type === 'unit'" v-model="formTwo[item.prop]"
  188. :disabled="item.disabled ? true : false || viewDisabled" size="small" autocomplete="off"
  189. placeholder="请输入">
  190. <template slot="append">元</template>
  191. </el-input>
  192. <el-input type="age" v-else v-model="formTwo[item.prop]"
  193. :disabled="item.disabled ? true : false || viewDisabled" size="small" value="0" autocomplete="off"
  194. placeholder="请输入">
  195. <template
  196. v-if="item.prop === 'advanceAmount' || item.prop === 'settlmentAmount' || item.prop === 'balanceAmount'"
  197. slot="append">元</template>
  198. </el-input>
  199. </el-form-item>
  200. </el-col>
  201. </el-row>
  202. </el-form>
  203. </basic-container>
  204. <containerTitle title="附件上传"></containerTitle>
  205. <basic-container style="margin-bottom: 40px">
  206. <avue-crud :option="upLoadOption" v-model="upLoadForm" :data="upLoadData" @row-save="upLoadSave"
  207. @row-update="upLoadUpdate" @row-del="projectFilesfun"></avue-crud>
  208. </basic-container>
  209. </div>
  210. <messagePost v-if="messageVisble" ref="messagePost" @closeDialog="closeDialog"></messagePost>
  211. <el-dialog title="导入服务项目" append-to-body class="el-dialogDeep" :visible.sync="serviceDialog" width="70%"
  212. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false">
  213. <el-row style="height: 0;">
  214. <el-col :span="5">
  215. <div>
  216. <el-scrollbar>
  217. <basic-container>
  218. <avue-tree :option="serviceTreeOption" @node-click="serviceNodeClick" />
  219. </basic-container>
  220. </el-scrollbar>
  221. </div>
  222. </el-col>
  223. <el-col :span="19">
  224. <basic-container>
  225. <avue-crud ref="serviceCrud" :page.sync="servicePage" :search.sync="serviceSearch" :option="serviceOption"
  226. :table-loading="serviceLoading" :data="serviceData" @refresh-change="serviceRefreshChange"
  227. @selection-change="serviceSelectionChange" @search-change="serviceSearchChange" @on-load="serviceOnLoad">
  228. </avue-crud>
  229. </basic-container>
  230. </el-col>
  231. </el-row>
  232. <span slot="footer" class="dialog-footer">
  233. <el-button type="primary" @click="serviceConfirm()" :disabled="this.serviceSelectList.length == 0">导 入
  234. </el-button>
  235. <el-button @click="serviceDialog = false">取 消</el-button>
  236. </span>
  237. </el-dialog>
  238. <el-dialog title="导入用户" :visible.sync="userDialog" class="el-dialogDeep" append-to-body width="80%">
  239. <el-row style="margin-top: -5px;height: 0">
  240. <el-col :span="5">
  241. <div class="box">
  242. <el-scrollbar>
  243. <basic-container>
  244. <avue-tree :option="userTreeOption" :data="userTreeData" @node-click="userNodeClick" />
  245. </basic-container>
  246. </el-scrollbar>
  247. </div>
  248. </el-col>
  249. <el-col :span="19">
  250. <basic-container>
  251. <avue-crud ref="userCrud" :option="userOption" :data="userDataList" :table-loading="userLoading"
  252. :page.sync="userPage" v-model="userForm" @search-change="userSearchChange" @search-reset="userSearchReset"
  253. @refresh-change="userRefreshChange" @selection-change="userSelectionChange" @on-load="userOnLoad">
  254. </avue-crud>
  255. </basic-container>
  256. </el-col>
  257. </el-row>
  258. <span slot="footer" class="dialog-footer">
  259. <el-button @click="userDialog = false">取 消</el-button>
  260. <el-button type="primary" :disabled="this.userSelection.length == 1 ? false : true" @click="userConfirm">确 定
  261. </el-button>
  262. </span>
  263. </el-dialog>
  264. <el-dialog title="流程" append-to-body class="el-dialogDeep" :visible.sync="processDialog" width="60%"
  265. :close-on-click-modal="false" :destroy-on-close="true" :modal-append-to-body='false'
  266. :close-on-press-escape="false" v-dialog-drag>
  267. <examine-approve :itemId="itemId" :closeFun="dialogProcessClose">
  268. </examine-approve>
  269. </el-dialog>
  270. <el-dialog title="结算" append-to-body class="el-dialogDeep" :visible.sync="accountDialog" width="25%"
  271. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false">
  272. <el-form :model="accountFormData" ref="accountFormData">
  273. <el-form-item label="账户名称" class="landConFrom-input" prop="accountName" :rules="rules">
  274. <!-- <el-input v-model="accountFormData.accountName" style="width: 220px;" size="small" clearable-->
  275. <!-- placeholder="请输入"></el-input>-->
  276. <el-select v-model="accountFormData.accountName" style="width: 220px;" size="small" placeholder="请选择">
  277. <el-option
  278. v-for="item in primaryServiceAccountTitle"
  279. :key="item.dictKey"
  280. :label="item.dictValue"
  281. :value="item.dictKey">
  282. </el-option>
  283. </el-select>
  284. </el-form-item>
  285. <el-form-item label="结算日期" class="landConFrom-input" prop="payTime" :rules="rules">
  286. <el-date-picker type="date" v-model="accountFormData.payTime" value-format="yyyy-MM-dd HH:mm:ss" size="small"
  287. clearable placeholder="日期"></el-date-picker>
  288. </el-form-item>
  289. </el-form>
  290. <span slot="footer" style="display: flex; justify-content: center">
  291. <el-button @click.stop="accountDialog = false, accountFormData = {}" size="small">取 消</el-button>
  292. <el-button type="primary" size="small" @click="closeAccount('accountFormData')">结算</el-button>
  293. </span>
  294. </el-dialog>
  295. <el-dialog title="派工" append-to-body class="el-dialogDeep" :visible.sync="pgDialog" width="50%"
  296. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false">
  297. <span>
  298. <avue-crud :data="pgList" :option="pgOption"></avue-crud>
  299. </span>
  300. <span slot="footer" class="dialog-footer">
  301. <el-button @click="pgDialog = false" size="small">取 消</el-button>
  302. <el-button type="primary" size="small" @click="pgConfirm">派 工
  303. </el-button>
  304. </span>
  305. </el-dialog>
  306. </div>
  307. </template>
  308. <script>
  309. import option from "./configuration/detailsPage.json";
  310. import startOption from "./configuration/startDialog.json";
  311. import { projectDetail, editMianProject, settleAccounts, getSysNo, masterCheck, dispatch } from "@/api/workManagement/mainProject";
  312. //上传文件json
  313. import upLoadOption from "../../exportTrade/purchaseContract/config/uploadList.json"
  314. //服务列表接口
  315. import { getServiceProjectList, getServiceTypeTree, } from "@/api/workManagement/serviceProject";
  316. import serviceOption from "./configuration/serviceDialogList.json";
  317. //用户组件
  318. import userOption from "./configuration/userList.json";
  319. import { getList } from "@/api/system/user";
  320. import { getDeptLazyTree } from "@/api/system/dept";
  321. //上传附件删除
  322. import {corpsbank, projectFiles} from "@/api/basicData/configuration"
  323. //事务
  324. import examineApprove from "@/components/examineApprove/index";
  325. // 字典
  326. import { getWorkDicts } from "@/api/system/dictbiz";
  327. //对象数组比较
  328. import { contrastObj, contrastList2 } from "@/util/contrastData";
  329. import _ from "lodash";
  330. import { getUserList } from "@/api/workManagement/mainProject";
  331. import optionAdd from "../receipt/configuration/settleAccountsDetailsADD.json";
  332. import optionReturn from "../receipt/configuration/settleAccountsDetailsReturn.json";
  333. import { getDeptTree } from "@/api/system/dept";
  334. import messagePost from "@/components/messageSend/main"
  335. import clientOption from "../performanceAnalysis/config/clientList.json";
  336. import { getGoodsDescList } from "@/api/standAlone/saleLeads";
  337. export default {
  338. props: {
  339. detailData: {
  340. type: Object
  341. }
  342. },
  343. components: {
  344. examineApprove,
  345. messagePost
  346. },
  347. data() {
  348. return {
  349. // 客户名称字典
  350. primaryServiceAccountTitle: [],
  351. pgList: [],
  352. pgDialog: false,
  353. goodsDescList: [],
  354. secondList: [],
  355. frequencyList: [],
  356. id: '',
  357. loading: false,
  358. form: {},
  359. formTwo: {},
  360. optionFrom: {},
  361. account: {},
  362. data: [],
  363. dataList: [],
  364. crudSelection: [],
  365. corpAttnDic: [],
  366. salesNameDic: [],
  367. sourceBusinessDic: [],
  368. buttonLoading: false,
  369. messageVisble: false,
  370. viewDisabled: false,
  371. deptDicData: [],//任务部门数据
  372. serviceDialog: false,//服务导入窗口
  373. userDialog: false,//用户导入窗口
  374. accountDialog: false,//结算窗口
  375. //客户组件配置控制
  376. UConfiguration: {
  377. multipleChoices: false,
  378. multiple: false,
  379. disabled: false,
  380. searchShow: true,
  381. collapseTags: false,
  382. placeholder: '请点击右边按钮选择',
  383. dicData: []
  384. },
  385. detailsSelect: {},
  386. //顶部from数据
  387. option: {
  388. menuBtn: false,
  389. labelWidth: 100,
  390. column: [
  391. {
  392. label: '项目名称',
  393. prop: 'cname',
  394. span: 12,
  395. rules: [
  396. {
  397. required: true,
  398. message: ' ',
  399. trigger: 'blur'
  400. }
  401. ]
  402. },
  403. {
  404. label: '客户名称',
  405. prop: 'corpId',
  406. span: 12,
  407. rules: [
  408. {
  409. required: true,
  410. message: ' ',
  411. trigger: 'blur'
  412. }
  413. ]
  414. },
  415. {
  416. label: '责任人',
  417. prop: 'corpAttn',
  418. span: 6,
  419. rules: [
  420. {
  421. required: true,
  422. message: ' ',
  423. trigger: 'blur'
  424. }
  425. ]
  426. },
  427. {
  428. label: '承揽人',
  429. prop: 'salesName',
  430. span: 6,
  431. rules: [
  432. {
  433. required: true,
  434. message: ' ',
  435. trigger: 'blur'
  436. }
  437. ]
  438. },
  439. {
  440. label: '业务来源',
  441. prop: 'sourceBusiness',
  442. span: 6,
  443. rules: [
  444. {
  445. required: true,
  446. message: ' ',
  447. trigger: 'blur'
  448. }
  449. ]
  450. },
  451. {
  452. label: '备注',
  453. span: 24,
  454. minRows: 6,
  455. prop: 'remark'
  456. }
  457. ],
  458. },
  459. basicData: {
  460. column: [
  461. {
  462. label: '合同金额',
  463. prop: 'debitAmount',
  464. rules: [
  465. {
  466. required: false,
  467. message: ' ',
  468. trigger: 'blur'
  469. },
  470. {
  471. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  472. message: ' ',
  473. trigger: 'blur'
  474. },
  475. ]
  476. },
  477. {
  478. label: '首付金额',
  479. prop: 'advanceAmount',
  480. type: 'unit',
  481. rules: [
  482. {
  483. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  484. message: ' ',
  485. trigger: 'blur'
  486. }
  487. ]
  488. },
  489. {
  490. label: '已收金额',
  491. prop: 'settlmentAmount',
  492. disabled: true,
  493. type: 'unit',
  494. },
  495. {
  496. label: '未收金额',
  497. type: 'unit',
  498. prop: 'balanceAmount',
  499. disabled: true,
  500. },
  501. {
  502. label: '总服务费',
  503. prop: 'serviceCharge',
  504. type: 'unit',
  505. disabled: true,
  506. rules: [
  507. {
  508. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  509. message: ' ',
  510. trigger: 'blur'
  511. }
  512. ]
  513. },
  514. {
  515. label: '总成本',
  516. prop: 'matMoney',
  517. type: 'unit',
  518. disabled: true,
  519. rules: [
  520. {
  521. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  522. message: ' ',
  523. trigger: 'blur'
  524. }
  525. ]
  526. },
  527. {
  528. label: '制单人',
  529. prop: 'createUserName',
  530. disabled: true
  531. }, {
  532. label: '制单日期',
  533. prop: 'createTime',
  534. type: 'datetime',
  535. valueFormat: "yyyy-MM-dd HH:mm:ss",
  536. format: "yyyy-MM-dd",
  537. disabled: true
  538. },
  539. {
  540. label: '电话',
  541. prop: 'corpTel',
  542. },
  543. {
  544. label: '收款方式',
  545. prop: 'paymentType',
  546. width: 120,
  547. },
  548. {
  549. label: '开始日期',
  550. prop: 'beginTime',
  551. valueFormat: "yyyy-MM-dd HH:mm:ss",
  552. format: "yyyy-MM-dd",
  553. type: 'datetime',
  554. },
  555. {
  556. label: '结束日期',
  557. prop: 'endTime',
  558. valueFormat: "yyyy-MM-dd HH:mm:ss",
  559. format: "yyyy-MM-dd",
  560. type: 'datetime',
  561. }
  562. ],
  563. },
  564. optionTable: {},
  565. //结算
  566. accountFormData: {},
  567. rules: [{
  568. required: true,
  569. message: ' ',
  570. trigger: 'blur'
  571. }
  572. ],
  573. //上传文件
  574. upLoadOption: upLoadOption,
  575. upLoadData: [],
  576. upLoadForm: {},
  577. //服务窗口定义
  578. serviceTreeOption: {
  579. nodeKey: 'id',
  580. lazy: true,
  581. treeLoad: function (node, resolve) {
  582. const parentId = node.level === 0 ? 0 : node.data.id;
  583. getServiceTypeTree(parentId).then(res => {
  584. resolve(
  585. res.data.data.map(item => {
  586. return {
  587. ...item,
  588. leaf: !item.hasChildren
  589. };
  590. })
  591. );
  592. });
  593. },
  594. addBtn: false,
  595. menu: false,
  596. size: 'small',
  597. props: {
  598. labelText: '标题',
  599. label: 'title',
  600. value: 'value',
  601. children: 'children'
  602. }
  603. },
  604. serviceOption: serviceOption,
  605. serviceLoading: false,
  606. serviceData: [],
  607. servicePage: {
  608. currentPage: 1,
  609. total: 0,
  610. pageSize: 10
  611. },
  612. serviceSearch: {},
  613. serviceTreeDeptId: "",
  614. serviceSelectList: [],
  615. //用户窗口定义
  616. userTreeOption: {
  617. nodeKey: 'id',
  618. lazy: true,
  619. treeLoad: function (node, resolve) {
  620. const parentId = (node.level === 0) ? 0 : node.data.id;
  621. getDeptLazyTree(parentId).then(res => {
  622. resolve(res.data.data.map(item => {
  623. return {
  624. ...item,
  625. leaf: !item.hasChildren
  626. }
  627. }))
  628. });
  629. },
  630. addBtn: false,
  631. menu: false,
  632. size: 'small',
  633. props: {
  634. labelText: '标题',
  635. label: 'title',
  636. value: 'value',
  637. children: 'children'
  638. }
  639. },
  640. userTreeData: [],
  641. userOption: userOption,
  642. userLoading: false,
  643. userDataList: [],
  644. userSelection: [],
  645. userTreeDeptId: "",
  646. userForm: {},
  647. userPage: {
  648. currentPage: 1,
  649. total: 0,
  650. pageSize: 10
  651. },
  652. itemId: '',
  653. //请核窗口定义
  654. processDialog: false,
  655. pleaseCheckContact: startOption,
  656. pleaseCheckLoading: false,
  657. pleaseCheckData: [],
  658. pleaseCheckPage: {
  659. pageSize: 10,
  660. currentPage: 1,
  661. total: 0
  662. },
  663. activeName: "first",
  664. tab1: true,
  665. tab2: false,
  666. tab3: false,
  667. secondDisable: 0,
  668. data_one: [],
  669. data_two: [],
  670. data_three: [],
  671. //新旧数据比较
  672. oldData: [],
  673. oldUpLoadData: [],
  674. oldForm: {},
  675. oldFormTwo: {},
  676. pgOption: {
  677. border: true,
  678. align: 'center',
  679. menuAlign: 'center',
  680. menu: false,
  681. header: false,
  682. height: 400,
  683. column: [
  684. {
  685. label: '承做人',
  686. prop: 'userName'
  687. }, {
  688. label: '金额',
  689. prop: 'jine'
  690. }, {
  691. label: '开始日期',
  692. prop: 'beginTime',
  693. cell: true,
  694. type: "date",
  695. format: 'yyyy-MM-dd',
  696. valueFormat: 'yyyy-MM-dd 00:00:00'
  697. }, {
  698. label: '提醒日期',
  699. prop: 'reminderDay',
  700. cell: true,
  701. type: "date",
  702. format: 'yyyy-MM-dd',
  703. valueFormat: 'yyyy-MM-dd 00:00:00'
  704. }
  705. ]
  706. },
  707. pgIndex: 0
  708. };
  709. },
  710. async created() {
  711. this.optionTable = await this.getColumnData(this.getColumnName(56), option);
  712. getDeptTree("096359").then(res => {
  713. this.optionTable.column.forEach(item => {
  714. if (item.prop === "deptid") {
  715. item.dicData = res.data.data;
  716. }
  717. })
  718. })
  719. //承揽人 责任人 默认20条数据
  720. getUserList().then(res => {
  721. res.data.data.map((item, index) => {
  722. if (index <= 20) {
  723. this.corpAttnDic.push(item)
  724. this.salesNameDic.push(item)
  725. }
  726. })
  727. })
  728. if (this.detailData.id) {
  729. this.id = this.detailData.id;//字符串转数字 超长用BigInt
  730. projectDetail(this.id, "0,1,2,3,4,5").then(res => {
  731. this.afterEcho(res.data.data)
  732. })
  733. } else if (this.detailData.data) {
  734. this.$set(this.formTwo, "debitAmount", 0)
  735. this.$set(this.formTwo, "advanceAmount", 0)
  736. this.$set(this.formTwo, "settlmentAmount", 0)
  737. this.$set(this.formTwo, "balanceAmount", 0)
  738. getGoodsDescList().then(res => {
  739. this.goodsDescList = res.data.data
  740. let form = this.detailData.data
  741. this.form.corpId = form.corpId
  742. this.form.remark = form.remarks
  743. this.form.cname = form.bizContent
  744. // this.form.corpName = form.corpName
  745. form.itemList.forEach(e => {
  746. this.goodsDescList.forEach(item => {
  747. if (e.spId == item.id) {
  748. this.data.push({
  749. strStatus: "录入",
  750. pname: item.cname,
  751. remarks: item.remarks,
  752. price: item.price,
  753. unit: item.unit,
  754. secondDisable: this.secondDisable,
  755. frequency: item.rate,
  756. projectType: this.secondDisable,
  757. $cellEdit: true
  758. });
  759. }
  760. })
  761. })
  762. })
  763. //备注格式
  764. let remark = "收入:\n" +
  765. "1、业务名称:\n" +
  766. "2、费用明细:\n" +
  767. "3、业务负责人:\n" +
  768. "4、优惠合计:\n" +
  769. "5、实际收费:\n" +
  770. "6、付款人:\n" +
  771. "7、收款时间:\n" +
  772. "8、收款人:\n" +
  773. "9、收款方式:\n" +
  774. "10、备注/特别说明:";
  775. this.$nextTick(() => {
  776. this.$set(this.form, "remark", remark)
  777. })
  778. } else {
  779. //责任人 承揽人 默认当前登录人
  780. this.$set(this.formTwo, "corpAttn", this.$store.getters.userInfo.user_name)
  781. this.$set(this.formTwo, "salesName", this.$store.getters.userInfo.user_name)
  782. this.$set(this.formTwo, "debitAmount", 0)
  783. this.$set(this.formTwo, "advanceAmount", 0)
  784. this.$set(this.formTwo, "settlmentAmount", 0)
  785. this.$set(this.formTwo, "balanceAmount", 0)
  786. this.$set(this.formTwo, "createUserName", this.$store.getters.userInfo.user_name)
  787. let date = new Date();
  788. let strDate = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
  789. this.$set(this.formTwo, "createTime", strDate)
  790. //备注格式
  791. let remark = "收入:\n" +
  792. "1、业务名称:\n" +
  793. "2、费用明细:\n" +
  794. "3、业务负责人:\n" +
  795. "4、优惠合计:\n" +
  796. "5、实际收费:\n" +
  797. "6、付款人:\n" +
  798. "7、收款时间:\n" +
  799. "8、收款人:\n" +
  800. "9、收款方式:\n" +
  801. "10、备注/特别说明:";
  802. this.$nextTick(() => {
  803. this.$set(this.form, "remark", remark)
  804. })
  805. }
  806. if (this.$route.query.itemId) {
  807. this.id = this.$route.query.itemId
  808. projectDetail(this.id, "0,1,2,3,4,5").then(res => {
  809. this.afterEcho(res.data.data)
  810. })
  811. }
  812. //字典值
  813. this.getWorkDicts("source_Business").then(res => {
  814. this.sourceBusinessDic = res.data.data;
  815. })
  816. this.getWorkDicts("frequency").then(res => {
  817. this.frequencyList = res.data.data;
  818. this.findObject(this.optionTable.column, "frequency").dicData = res.data.data
  819. this.findObject(this.optionTable.column, "frequency").change = (data) => {
  820. this.frequencyChange(data.row)
  821. }
  822. });
  823. this.getWorkDicts("second").then(res => {
  824. this.secondList = res.data.data;
  825. });
  826. },
  827. mounted() {
  828. },
  829. methods: {
  830. //明细切换tab
  831. async handleClick(tab) {
  832. if (tab.name == "first") {
  833. this.tab1 = true;
  834. this.tab2 = false;
  835. this.tab3 = false;
  836. if (this.secondDisable === 1) {
  837. this.data_two = this.data
  838. }
  839. if (this.secondDisable === 2) {
  840. this.data_three = this.data
  841. }
  842. this.secondDisable = 0
  843. await this.switchTab("first")
  844. this.data = this.data_one //切换数据
  845. getDeptTree("096359").then(res => {
  846. this.optionTable.column.forEach(item => {
  847. if (item.prop === "deptid") {
  848. item.dicData = res.data.data;
  849. }
  850. })
  851. })
  852. } else if (tab.name == "second") {
  853. this.tab1 = false;
  854. this.tab2 = true;
  855. this.tab3 = false;
  856. if (this.secondDisable === 0) {
  857. this.data_one = this.data
  858. }
  859. if (this.secondDisable === 2) {
  860. this.data_three = this.data
  861. }
  862. this.secondDisable = 1
  863. await this.switchTab("second")
  864. this.data = this.data_two
  865. } else if (tab.name == "three") {
  866. this.tab1 = false;
  867. this.tab2 = false;
  868. this.tab3 = true;
  869. if (this.secondDisable === 0) {
  870. this.data_one = this.data
  871. }
  872. if (this.secondDisable === 1) {
  873. this.data_two = this.data
  874. }
  875. this.secondDisable = 2
  876. await this.switchTab("three")
  877. this.data = this.data_three
  878. }
  879. },
  880. switchTab(val) { //换option
  881. if (val === 'first') {
  882. this.optionTable = option
  883. } else if (val === 'second') {
  884. this.optionTable = optionAdd
  885. } else if (val === 'three') {
  886. this.optionTable = optionReturn
  887. }
  888. },
  889. //责任人 远程
  890. corpAttnRemoteMethod(val) {
  891. getUserList({ realName: val }).then(res => {
  892. this.corpAttnDic = res.data.data
  893. })
  894. },
  895. //承揽人 远程
  896. salesNameRemoteMethod(val) {
  897. getUserList({ realName: val }).then(res => {
  898. this.salesNameDic = res.data.data
  899. })
  900. },
  901. value(value, row) {
  902. if (value) {
  903. row.userid = value.id
  904. row.deptid = value.deptId
  905. }
  906. },
  907. //合计
  908. totalChange(row, type) {
  909. //明细列表金额合计
  910. if (this.secondDisable === 0) {
  911. this.data_one = this.data
  912. }
  913. let amountList = this.data_one.map(item => {
  914. if (item.amount) {
  915. return parseFloat(item.amount);
  916. } else return 0
  917. });
  918. //明细列表服务费合计
  919. let serviceChargeList = this.data.map(item => {
  920. if (item.serviceCharge) {
  921. return parseFloat(item.serviceCharge);
  922. } else return 0
  923. });
  924. //明细列表成本合计
  925. let matMoneyList = this.data.map(item => {
  926. if (item.matMoney) {
  927. return parseFloat(item.matMoney);
  928. } else return 0
  929. });
  930. if (type === '金额') {
  931. if (this.formTwo.debitAmount) {
  932. if (this.formTwo.debitAmount < amountList.reduce((n, m) => n + m)) {
  933. this.$message.error("明细列表合同金额不能大于总金额!")
  934. }
  935. }
  936. }
  937. // if(type==='服务'){
  938. // this.formTwo.serviceCharge = serviceChargeList.reduce((n,m) => n + m)
  939. // }
  940. // if(type==='代垫'){
  941. // this.formTwo.matMoney = matMoneyList.reduce((n,m) => n + m)
  942. // }
  943. if (row.serviceCharge && row.matMoney && row.otheramt && row.amount) {
  944. if (row.amount < (parseFloat(row.serviceCharge) + parseFloat(row.matMoney) + parseFloat(row.otheramt))) {
  945. this.$message.error("费用之和不能超过合计金额!")
  946. row.serviceCharge = 0;
  947. row.matMoney = 0;
  948. }
  949. }
  950. },
  951. //费用计算计算
  952. costCount(row) {
  953. if (this.activeName === 'first') {
  954. if (row.serviceCharge && row.matMoney && row.otheramt) {
  955. row.amount = parseFloat(row.serviceCharge) + parseFloat(row.matMoney) + parseFloat(row.otheramt)
  956. }
  957. } else {
  958. if (row.serviceCharge && row.matMoney) {
  959. row.amount = parseFloat(row.serviceCharge) + parseFloat(row.matMoney)
  960. }
  961. }
  962. },
  963. //删除列表后面的删除按钮触发触发(row, index, done)
  964. rowDel(row, index) {
  965. this.$confirm("确定将此明细删除?", {
  966. confirmButtonText: "确定",
  967. cancelButtonText: "取消",
  968. type: "warning"
  969. }).then(() => {
  970. this.data.splice(index, 1)
  971. });
  972. },
  973. // 合同金额
  974. debitChange(val) {
  975. if (val) {
  976. if (!this.formTwo.settlmentAmount) {
  977. this.$set(this.formTwo, "balanceAmount", val)
  978. }
  979. }
  980. },
  981. //打开结算窗口
  982. beforeCloseAccount(row) {
  983. if (this.verificationData()) {
  984. this.account = row;
  985. getWorkDicts("primary_service_account_title").then(res => {
  986. this.primaryServiceAccountTitle = res.data.data;
  987. this.accountDialog = true;
  988. })
  989. }
  990. },
  991. dispatch(row, index) {
  992. if (row.id) {
  993. this.pgList = []
  994. if (row.second > 1) {
  995. for (let i = 0; i < row.second; i++) {
  996. this.pgList.push({
  997. ...row,
  998. beginTime: "",
  999. reminderDay: "",
  1000. jine: row.amount / row.second,
  1001. $cellEdit: true
  1002. })
  1003. }
  1004. } else {
  1005. this.pgList.push({
  1006. ...row,
  1007. beginTime: "",
  1008. reminderDay: "",
  1009. jine: row.amount,
  1010. $cellEdit: true
  1011. })
  1012. }
  1013. }
  1014. this.pgIndex = index
  1015. this.pgDialog = true
  1016. },
  1017. pgConfirm() {
  1018. for (let i = 0; i < this.pgList.length; i++) {
  1019. if (!this.pgList[i].beginTime) {
  1020. return this.$message.error('请完善开始日期')
  1021. }
  1022. }
  1023. let projectItemDateList = []
  1024. this.pgList.forEach((e, index) => {
  1025. projectItemDateList.push({
  1026. beginTime: e.beginTime,
  1027. reminderDay: e.reminderDay
  1028. })
  1029. })
  1030. this.data[this.pgIndex].projectItemDateList = projectItemDateList
  1031. const params = {
  1032. ...this.form,
  1033. ...this.formTwo,
  1034. itemList: this.data.filter((e, index) => index == this.pgIndex),
  1035. filesList: this.upLoadData
  1036. }
  1037. dispatch(params).then(res => {
  1038. if (res.data.success) {
  1039. this.$message({
  1040. type: "success",
  1041. message: "操作成功!"
  1042. });
  1043. this.pgDialog = false;
  1044. this.getProjectDetail();
  1045. }
  1046. })
  1047. },
  1048. //结算
  1049. closeAccount(form) {
  1050. this.$refs[form].validate((valid) => {
  1051. if (valid) {
  1052. settleAccounts(this.account.id, 5,
  1053. this.accountFormData.accountName,
  1054. this.accountFormData.payTime).then(res => {
  1055. if (res.data.success) {
  1056. this.$message({
  1057. type: "success",
  1058. message: "操作成功!"
  1059. });
  1060. this.accountFormData = {},
  1061. this.accountDialog = false;
  1062. this.getProjectDetail();
  1063. }
  1064. })
  1065. }
  1066. })
  1067. },
  1068. cancelCloseAccount(row) {
  1069. this.$confirm("确认取消结算此明细?", {
  1070. confirmButtonText: "确定",
  1071. cancelButtonText: "取消",
  1072. type: "warning"
  1073. }).then(() => {
  1074. settleAccounts(row.id, 6).then(res => {
  1075. if (res.data.success) {
  1076. this.$message({
  1077. type: "success",
  1078. message: "操作成功!"
  1079. });
  1080. this.getProjectDetail();
  1081. }
  1082. })
  1083. });
  1084. },
  1085. //请核
  1086. mainCheck() {
  1087. if (this.verificationData()) {
  1088. this.detailsCollection()
  1089. for (let i = 0; i < this.dataList.length; i++) {
  1090. if (this.dataList[i].strStatus !== "结算完成") {
  1091. return this.$message.error(`明细列表存在未结算数据,请检查!`);
  1092. }
  1093. }
  1094. masterCheck(this.form.id).then(res => {
  1095. if (res.data.success) {
  1096. this.$message.success("操作成功!")
  1097. this.getProjectDetail();
  1098. }
  1099. })
  1100. }
  1101. //
  1102. },
  1103. // 发送消息
  1104. postMessage() {
  1105. this.messageVisble = true
  1106. this.$nextTick(() => {
  1107. this.$refs.messagePost.init()
  1108. })
  1109. },
  1110. closeDialog() {
  1111. this.messageVisble = false
  1112. },
  1113. getProjectDetail() {
  1114. projectDetail(this.id, "0,1,2,3,4,5").then(res => {
  1115. this.afterEcho(res.data.data)
  1116. })
  1117. },
  1118. //新增 修改
  1119. editMainProject(type) {
  1120. this.$refs["form"].validate((valid) => {
  1121. if (valid) {
  1122. this.detailsCollection()
  1123. for (let i = 0; i < this.dataList.length; i++) {
  1124. if (this.dataList[i].deptid === (null || "")) {
  1125. return this.$message.error(`请输入明细列表中的任务部门`);
  1126. }
  1127. if (this.dataList[i].beginTime === (null || "") && this.dataList[i].projectType != 0) {
  1128. return this.$message.error(`请输入明细列表中的开始日期`);
  1129. }
  1130. if (this.dataList[i].actualDate === (null || "") && this.dataList[i].projectType != 0) {
  1131. return this.$message.error(`请输入明细列表中的结束日期`);
  1132. }
  1133. if (this.dataList[i].frequency === (null || "") && this.dataList[i].projectType == 0) {
  1134. return this.$message.error(`请输入明细列表中的频率`);
  1135. }
  1136. }
  1137. this.buttonLoading = true
  1138. const params = {
  1139. ...this.form,
  1140. ...this.formTwo,
  1141. corpName: null,
  1142. itemList: this.dataList,
  1143. filesList: this.upLoadData
  1144. }
  1145. editMianProject(params).then(res => {
  1146. if (res.data.success) {
  1147. this.id = res.data.data
  1148. this.$message.success("操作成功!")
  1149. projectDetail(res.data.data, "0,1,2,3,4,5").then(res => {
  1150. this.afterEcho(res.data.data)
  1151. })
  1152. }
  1153. }).finally(() => {
  1154. this.buttonLoading = false
  1155. })
  1156. if (type === true) {
  1157. this.$emit("goBack");
  1158. }
  1159. }
  1160. })
  1161. },
  1162. copyData() {
  1163. if (this.verificationData()) {
  1164. delete this.form.id
  1165. delete this.formTwo.id
  1166. }
  1167. },
  1168. createData() {
  1169. if (this.verificationData()) {
  1170. this.$confirm("确定创建新的单据吗?", "提示", {
  1171. confirmButtonText: "保存",
  1172. cancelButtonText: "取消",
  1173. type: "warning",
  1174. }).then(() => {
  1175. this.form = {}
  1176. this.oldForm = {}
  1177. this.formTwo = {}
  1178. this.oldFormTwo = {}
  1179. this.dataList = []
  1180. this.oldData = []
  1181. this.upLoadData = []
  1182. this.oldUpLoadData = []
  1183. this.$set(this.formTwo, "corpAttn", this.$store.getters.userInfo.user_name)
  1184. this.$set(this.formTwo, "salesName", this.$store.getters.userInfo.user_name)
  1185. this.$set(this.formTwo, "debitAmount", 0)
  1186. this.$set(this.formTwo, "advanceAmount", 0)
  1187. this.$set(this.formTwo, "settlmentAmount", 0)
  1188. this.$set(this.formTwo, "balanceAmount", 0)
  1189. this.$set(this.formTwo, "createUserName", this.$store.getters.userInfo.user_name)
  1190. let date = new Date();
  1191. let strDate = date.getFullYear() + "-" + (date.getsecond() + 1) + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
  1192. this.$set(this.formTwo, "createTime", strDate)
  1193. })
  1194. }
  1195. },
  1196. //明细合集
  1197. detailsCollection() {
  1198. if (this.secondDisable === 0) {
  1199. this.data = this.data_one
  1200. }
  1201. if (this.secondDisable === 1) {
  1202. this.data = this.data_two
  1203. }
  1204. if (this.secondDisable === 2) {
  1205. this.data = this.data_three
  1206. }
  1207. this.dataList = []
  1208. this.dataList.push(...this.data_one, ...this.data_two, ...this.data_three)
  1209. },
  1210. afterEcho(data) {
  1211. this.form = data;
  1212. this.viewDisabled = this.form.status !== 0 ? true : false
  1213. this.option.column.forEach(item => {
  1214. if (item.prop == "cname") {
  1215. this.$set(item, "disabled", this.viewDisabled)
  1216. }
  1217. })
  1218. this.formTwo = Object.assign({}, data);
  1219. delete this.formTwo.cname;
  1220. delete this.formTwo.corpId;
  1221. delete this.formTwo.corpAttn;
  1222. delete this.formTwo.salesName;
  1223. delete this.formTwo.sourceBusiness;
  1224. delete this.formTwo.remark;
  1225. this.oldForm = Object.assign({}, data);
  1226. this.oldFormTwo = Object.assign({}, data);
  1227. if (data.itemList) {
  1228. this.dataList = data.itemList;
  1229. this.oldData = this.deepClone(data.itemList)
  1230. //根据状态区分三种明细
  1231. this.data_one = this.dataList.filter(item => item.projectType === 0)
  1232. this.data_two = this.dataList.filter(item => item.projectType === 1)
  1233. this.data_three = this.dataList.filter(item => item.projectType === 2)
  1234. //判断当前所处哪个明细下 给data赋值
  1235. if (this.secondDisable === 0) {
  1236. this.data = this.data_one
  1237. }
  1238. if (this.secondDisable === 1) {
  1239. this.data = this.data_two
  1240. }
  1241. if (this.secondDisable === 2) {
  1242. this.data = this.data_three
  1243. }
  1244. }
  1245. if (data.filesList) {
  1246. this.upLoadData = data.filesList
  1247. this.oldUpLoadData = this.deepClone(data.filesList)
  1248. }
  1249. },
  1250. verificationData() {
  1251. this.detailsCollection()
  1252. if (contrastObj(this.form, this.oldForm) || contrastObj(this.formTwo, this.oldFormTwo) || contrastList2(this.dataList, this.oldData)
  1253. || contrastList2(this.upLoadData, this.oldUpLoadData)
  1254. ) {
  1255. this.$confirm("数据发生变化,请先提交保存!", "提示", {
  1256. confirmButtonText: "保存",
  1257. cancelButtonText: "取消",
  1258. type: "warning",
  1259. }).then(() => {
  1260. this.editMainProject()
  1261. }).catch(() => {
  1262. return false
  1263. })
  1264. } else {
  1265. return true
  1266. }
  1267. },
  1268. //点击修改或保存时触发
  1269. rowCellTwo(row, index) {
  1270. if (row.$cellEdit) {
  1271. if (this.activeName == "first") {
  1272. } else if (this.activeName == "second") {
  1273. } else if (this.activeName == "three") {
  1274. if (row.serviceCharge != 0) {
  1275. row.serviceCharge = -Math.abs(row.serviceCharge);
  1276. }
  1277. if (row.matMoney != 0) {
  1278. row.matMoney = -Math.abs(row.matMoney);
  1279. }
  1280. if (row.amount != 0) {
  1281. row.amount = -Math.abs(row.amount);
  1282. }
  1283. }
  1284. }
  1285. this.$refs.crud.rowCell(row, index);
  1286. },
  1287. //选择时
  1288. selectionChange(row) {
  1289. this.crudSelection = row;
  1290. },
  1291. //新增修改时保存触发
  1292. rowSave(row, done, loading) {
  1293. done()
  1294. },
  1295. rowUpdate(row, index, done, loading) {
  1296. done(row)
  1297. },
  1298. searchChange(params, done) {
  1299. this.getList(this.page, params);
  1300. done();
  1301. },
  1302. sizeChange(val) {
  1303. this.page.pageSize = val;
  1304. this.getList();
  1305. },
  1306. currentChange(val) {
  1307. this.page.currentPage = val;
  1308. this.getList();
  1309. },
  1310. frequencyChange(row) {
  1311. this.$set(row, 'second', null)
  1312. // row.second = null
  1313. },
  1314. //上传文件保存
  1315. upLoadSave(row, done, loading) {
  1316. this.upLoadData.push(row)
  1317. done()
  1318. },
  1319. //修改附件上传触发
  1320. upLoadUpdate(row, done) {
  1321. done(row);
  1322. },
  1323. //删除附件上传触发
  1324. upLoadDel(row, index,) {
  1325. this.$confirm("确定将选择数据删除?", {
  1326. confirmButtonText: "确定",
  1327. cancelButtonText: "取消",
  1328. type: "warning"
  1329. }).then(() => {
  1330. if (row.id) {
  1331. corpsbank(row.id).then(res => {
  1332. if (res.data.success) {
  1333. this.$message({
  1334. type: "success",
  1335. message: "操作成功!"
  1336. });
  1337. this.bankOfDepositData.splice(index, 1);
  1338. }
  1339. })
  1340. } else {
  1341. this.$message({
  1342. type: "success",
  1343. message: "操作成功!"
  1344. });
  1345. this.bankOfDepositData.splice(index, 1);
  1346. }
  1347. })
  1348. },
  1349. // 附件删除
  1350. projectFilesfun(row, index){
  1351. console.log(row,index,1354)
  1352. this.$confirm("确定将选择数据删除?", {
  1353. confirmButtonText: "确定",
  1354. cancelButtonText: "取消",
  1355. type: "warning"
  1356. }).then(() => {
  1357. if (row.id) {
  1358. projectFiles(row.id).then(res => {
  1359. if (res.data.success) {
  1360. this.$message({
  1361. type: "success",
  1362. message: "操作成功!"
  1363. });
  1364. this.upLoadData.splice(index, 1);
  1365. }
  1366. })
  1367. } else {
  1368. this.$message({
  1369. type: "success",
  1370. message: "操作成功!"
  1371. });
  1372. this.upLoadData.splice(index, 1);
  1373. }
  1374. })
  1375. },
  1376. //服务窗口事件
  1377. serviceNodeClick(data) {
  1378. this.serviceTreeDeptId = data.id;
  1379. this.serviceOnLoad(this.servicePage);
  1380. },
  1381. serviceRefreshChange() {
  1382. this.serviceOnLoad(this.servicePage, this.serviceSearch)
  1383. },
  1384. serviceSearchChange(params, done) {
  1385. this.serviceOnLoad(this.servicePage, params)
  1386. done();
  1387. },
  1388. serviceSelectionChange(row) {
  1389. this.serviceSelectList = row;
  1390. },
  1391. serviceOnLoad(page, params = {}) {
  1392. this.serviceLoading = true;
  1393. getServiceProjectList(page.currentPage, page.pageSize, params, this.serviceTreeDeptId).then(res => {
  1394. this.serviceData = res.data.data.records
  1395. this.servicePage.total = res.data.data.total
  1396. this.serviceLoading = false
  1397. })
  1398. },
  1399. serviceConfirm() {
  1400. if (this.serviceSelectList.length != 0) {
  1401. this.serviceSelectList.forEach((item) => {
  1402. const params = {
  1403. strStatus: "录入",
  1404. pname: item.cname,
  1405. remarks: item.remarks,
  1406. price: item.price,
  1407. unit: item.unit,
  1408. secondDisable: this.secondDisable,
  1409. frequency: item.rate,
  1410. projectType: this.secondDisable,
  1411. commission: item.commission,
  1412. serviceCharge: 0,
  1413. matMoney: 0,
  1414. amount: 0
  1415. }
  1416. this.$refs.crud.rowCellAdd(params);
  1417. this.$refs.crud.rowCell(item, this.optionFrom.length - 1)
  1418. })
  1419. }
  1420. this.serviceSelectList = []
  1421. this.serviceDialog = false
  1422. this.$message({
  1423. type: "success",
  1424. message: "导入成功!"
  1425. });
  1426. },
  1427. //用户窗口事件
  1428. selectUser(row) {
  1429. this.userDialog = true
  1430. this.detailsSelect = row.$index;
  1431. },
  1432. userSearchChange(params, done) {
  1433. this.userOnLoad(this.userPage, params);
  1434. done()
  1435. },
  1436. userSearchReset() {
  1437. },
  1438. userRefreshChange() {
  1439. this.userOnLoad(this.userPage)
  1440. },
  1441. userSelectionChange(row) {
  1442. this.userSelection = row;
  1443. },
  1444. userOnLoad(page, params = {}) {
  1445. this.userLoading = true;
  1446. getList(page.currentPage, page.pageSize, params, this.userTreeDeptId).then(res => {
  1447. this.userDataList = res.data.data.records
  1448. this.userPage.total = res.data.data.total
  1449. this.userLoading = false;
  1450. });
  1451. },
  1452. userNodeClick(data) {
  1453. this.userTreeDeptId = data.id;
  1454. this.userOnLoad(this.userPage);
  1455. },
  1456. //确定
  1457. userConfirm() {
  1458. if (this.userSelection) {
  1459. this.data[this.detailsSelect].userid = this.userSelection[0].id;
  1460. this.$set(this.data[this.detailsSelect], 'userName', this.userSelection[0].realName)
  1461. this.userDialog = !this.userDialog
  1462. }
  1463. },
  1464. dialogProcessClose() {
  1465. this.processDialog = false
  1466. this.getProjectDetail()
  1467. },
  1468. //返回主营项目列表
  1469. backToList() {
  1470. this.detailsCollection()
  1471. if (contrastObj(this.form, this.oldForm) || contrastObj(this.formTwo, this.oldFormTwo) || contrastList2(this.dataList, this.oldData)
  1472. || contrastList2(this.upLoadData, this.oldUpLoadData)
  1473. ) {
  1474. this.$confirm("当前页面有未保存数据,是否保存数据?", "提示", {
  1475. confirmButtonText: "保存",
  1476. cancelButtonText: "取消",
  1477. type: "warning",
  1478. }).then(() => {
  1479. this.editMainProject(true)
  1480. }).catch(() => {
  1481. this.$emit("goBack");
  1482. })
  1483. } else {
  1484. this.$emit("goBack");
  1485. }
  1486. },
  1487. //列保存触发
  1488. async saveColumn() {
  1489. const inSave = await this.saveColumnData(
  1490. this.getColumnName(56),
  1491. this.optionTable
  1492. );
  1493. if (inSave) {
  1494. this.$message.success("保存成功");
  1495. //关闭窗口
  1496. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1497. }
  1498. },
  1499. async resetColumn() {
  1500. const inSave = await this.delColumnData(
  1501. this.getColumnName(56),
  1502. option
  1503. );
  1504. if (inSave) {
  1505. this.$message.success("重置成功");
  1506. this.optionTable = option;
  1507. //关闭窗口
  1508. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1509. }
  1510. },
  1511. //1.0版本注释内容
  1512. // operationDetailList(itemList){
  1513. // this.data = itemList;
  1514. // this.oldData = this.deepClone(itemList)
  1515. // let status = [];
  1516. // this.data.forEach(item =>{
  1517. // item.status == 0 ? status.push(true) : status.push(false)
  1518. // })
  1519. // //如果 明细列表存在 请核之后的状态 禁止编辑一些输入框
  1520. // if(status.findIndex(item => item == false) == 0){
  1521. // this.basicData.column.forEach(item =>{
  1522. // if(item.prop == "code" || item.prop == "cname" || item.prop == "corpId" || item.prop == "debitAmount"){
  1523. // item.disabled = true
  1524. // this.configuration.disabled = true
  1525. // }
  1526. // })
  1527. // }else{
  1528. // this.basicData.column.forEach(item =>{
  1529. // if(item.prop == "code" || item.prop == "cname" || item.prop == "corpId" || item.prop == "debitAmount"){
  1530. // item.disabled = false
  1531. // this.configuration.disabled = false
  1532. // }
  1533. // })
  1534. // }
  1535. // },
  1536. // openPleaseCheckDialog(){
  1537. // this.processDialog = true;
  1538. // this.itemId = this.crudSelection[0].id //记得不能写死
  1539. // },
  1540. // //请核之前
  1541. // beforePleaseCheck(){
  1542. // if(this.crudSelection){
  1543. // let id = [];
  1544. // let result = [];
  1545. // this.crudSelection.forEach(item=>{
  1546. // // 新录入状态下 才可提交审核
  1547. // item.id ? id.push(true) : id.push(false) //如果没有id并且为新录入 提示保存
  1548. // item.strStatus === "录入" ? result.push(true) : result.push(false) //判断所有的是否为录入状态
  1549. // })
  1550. // if(id.findIndex(item => item != true) == -1){
  1551. // if(result.findIndex(item => item != true) == -1){
  1552. // if(contrastObj(this.form,this.oldForm) || contrastList2(this.data,this.oldData)){ //判断是否改动过此页面
  1553. // this.$confirm("您已改动此页面,请先保存之后在请核?", "提示", {
  1554. // confirmButtonText: "保存",
  1555. // cancelButtonText: "取消",
  1556. // type: "warning",
  1557. // }).then(() => {
  1558. // this.editMainProject();
  1559. // }).catch(()=>{
  1560. // return
  1561. // })
  1562. // }else{
  1563. // this.pleaseCheck()
  1564. // // this.openPleaseCheckDialog();
  1565. // }
  1566. // }else{
  1567. // this.$message({
  1568. // type: "error",
  1569. // message: "请核数据中存在已请核数据!"
  1570. // });
  1571. // return
  1572. // }
  1573. // }else{
  1574. // this.$confirm("列表内存在新录入数据,是否先保存此数据?", {
  1575. // confirmButtonText: "确定",
  1576. // cancelButtonText: "取消",
  1577. // type: "warning"
  1578. // }).then(() => {
  1579. // this.editMainProject();
  1580. // })
  1581. // }
  1582. // }
  1583. // },
  1584. // //请核
  1585. // pleaseCheck(){
  1586. // this.crudSelection.forEach(item =>{
  1587. // updateItemStatus(this.data[item.$index].id,1).then(res =>{
  1588. //
  1589. // })
  1590. // this.$message({
  1591. // type: "success",
  1592. // message: "请核成功!"
  1593. // });
  1594. // //刷新列表
  1595. // this.getProjectDetail();
  1596. // })
  1597. // },
  1598. },
  1599. filters: {
  1600. frequencyFormat(val, list) {
  1601. let name;
  1602. list.forEach(e => {
  1603. if (e.dictKey == val) {
  1604. name = e.dictValue
  1605. }
  1606. })
  1607. return name;
  1608. }
  1609. },
  1610. watch: {
  1611. dataList: function (list) {
  1612. }
  1613. }
  1614. };
  1615. </script>
  1616. <style scoped lang="scss">
  1617. .main-head {
  1618. position: fixed;
  1619. top: 105px;
  1620. width: 100%;
  1621. margin-left: -10px;
  1622. height: 62px;
  1623. background: #ffffff;
  1624. box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  1625. z-index: 999;
  1626. }
  1627. .upper_right_button {
  1628. display: flex;
  1629. position: fixed;
  1630. right: 12px;
  1631. top: 47px;
  1632. }
  1633. .main-back {
  1634. cursor: pointer;
  1635. line-height: 62px;
  1636. font-size: 16px;
  1637. color: #323233;
  1638. font-weight: 400;
  1639. }
  1640. .required_fields {
  1641. color: #F56C6C;
  1642. display: inline-block;
  1643. width: 7%
  1644. }
  1645. .avue-tree {
  1646. overflow: hidden;
  1647. max-height: 660px;
  1648. }
  1649. ::v-deep .el-form-item {
  1650. margin-bottom: 0;
  1651. }
  1652. ::v-deep .el-form-item__content {
  1653. line-height: 32px;
  1654. }
  1655. .trading-form ::v-deep .el-form-item {
  1656. margin-bottom: 8px !important;
  1657. }
  1658. .landConFrom-input {
  1659. display: flex;
  1660. justify-content: center;
  1661. }
  1662. </style>