detailsPage.vue 55 KB

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