detailsPage.vue 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613
  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 == 4" size="small" v-model="row.second" placeholder="请选择"
  132. 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 == 4 ? 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. ]
  687. },
  688. pgIndex:0
  689. };
  690. },
  691. async created() {
  692. this.optionTable = await this.getColumnData(this.getColumnName(56), option);
  693. getDeptTree("096359").then(res => {
  694. this.optionTable.column.forEach(item => {
  695. if (item.prop === "deptid") {
  696. item.dicData = res.data.data;
  697. }
  698. })
  699. })
  700. //承揽人 责任人 默认20条数据
  701. getUserList().then(res => {
  702. res.data.data.map((item, index) => {
  703. if (index <= 20) {
  704. this.corpAttnDic.push(item)
  705. this.salesNameDic.push(item)
  706. }
  707. })
  708. })
  709. if (this.detailData.id) {
  710. this.id = this.detailData.id;//字符串转数字 超长用BigInt
  711. projectDetail(this.id, "0,1,2,3,4,5").then(res => {
  712. this.afterEcho(res.data.data)
  713. })
  714. } else if (this.detailData.data) {
  715. getGoodsDescList().then(res => {
  716. this.goodsDescList = res.data.data
  717. let form = this.detailData.data
  718. this.form.corpId = form.corpId
  719. this.form.corpName = form.corpName
  720. form.itemList.forEach(e => {
  721. this.goodsDescList.forEach(item => {
  722. if (e.spId == item.id) {
  723. this.data.push({
  724. strStatus: "录入",
  725. pname: item.cname,
  726. remarks: item.remarks,
  727. price: item.price,
  728. unit: item.unit,
  729. secondDisable: this.secondDisable,
  730. frequency: item.rate,
  731. projectType: this.secondDisable,
  732. $cellEdit: true
  733. });
  734. }
  735. })
  736. })
  737. })
  738. } else {
  739. //责任人 承揽人 默认当前登录人
  740. this.$set(this.formTwo, "corpAttn", this.$store.getters.userInfo.user_name)
  741. this.$set(this.formTwo, "salesName", this.$store.getters.userInfo.user_name)
  742. this.$set(this.formTwo, "debitAmount", 0)
  743. this.$set(this.formTwo, "advanceAmount", 0)
  744. this.$set(this.formTwo, "settlmentAmount", 0)
  745. this.$set(this.formTwo, "balanceAmount", 0)
  746. this.$set(this.formTwo, "createUserName", this.$store.getters.userInfo.user_name)
  747. let date = new Date();
  748. let strDate = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
  749. this.$set(this.formTwo, "createTime", strDate)
  750. //备注格式
  751. let remark = "收入:\n" +
  752. "1、业务名称:\n" +
  753. "2、费用明细:\n" +
  754. "3、业务负责人:\n" +
  755. "4、优惠合计:\n" +
  756. "5、实际收费:\n" +
  757. "6、付款人:\n" +
  758. "7、收款时间:\n" +
  759. "8、收款人:\n" +
  760. "9、收款方式:\n" +
  761. "10、备注/特别说明:";
  762. this.$nextTick(() => {
  763. this.$set(this.form, "remark", remark)
  764. })
  765. }
  766. if (this.$route.query.itemId) {
  767. this.id = this.$route.query.itemId
  768. projectDetail(this.id, "0,1,2,3,4,5").then(res => {
  769. this.afterEcho(res.data.data)
  770. })
  771. }
  772. //字典值
  773. this.getWorkDicts("source_Business").then(res => {
  774. this.sourceBusinessDic = res.data.data;
  775. })
  776. this.getWorkDicts("frequency").then(res => {
  777. this.frequencyList = res.data.data;
  778. this.findObject(this.optionTable.column, "frequency").dicData = res.data.data
  779. this.findObject(this.optionTable.column, "frequency").change = (data) => {
  780. this.frequencyChange(data.row)
  781. }
  782. });
  783. this.getWorkDicts("second").then(res => {
  784. this.secondList = res.data.data;
  785. });
  786. },
  787. mounted() {
  788. },
  789. methods: {
  790. //明细切换tab
  791. async handleClick(tab) {
  792. if (tab.name == "first") {
  793. this.tab1 = true;
  794. this.tab2 = false;
  795. this.tab3 = false;
  796. if (this.secondDisable === 1) {
  797. this.data_two = this.data
  798. }
  799. if (this.secondDisable === 2) {
  800. this.data_three = this.data
  801. }
  802. this.secondDisable = 0
  803. await this.switchTab("first")
  804. this.data = this.data_one //切换数据
  805. getDeptTree("096359").then(res => {
  806. this.optionTable.column.forEach(item => {
  807. if (item.prop === "deptid") {
  808. item.dicData = res.data.data;
  809. }
  810. })
  811. })
  812. } else if (tab.name == "second") {
  813. this.tab1 = false;
  814. this.tab2 = true;
  815. this.tab3 = false;
  816. if (this.secondDisable === 0) {
  817. this.data_one = this.data
  818. }
  819. if (this.secondDisable === 2) {
  820. this.data_three = this.data
  821. }
  822. this.secondDisable = 1
  823. await this.switchTab("second")
  824. this.data = this.data_two
  825. } else if (tab.name == "three") {
  826. this.tab1 = false;
  827. this.tab2 = false;
  828. this.tab3 = true;
  829. if (this.secondDisable === 0) {
  830. this.data_one = this.data
  831. }
  832. if (this.secondDisable === 1) {
  833. this.data_two = this.data
  834. }
  835. this.secondDisable = 2
  836. await this.switchTab("three")
  837. this.data = this.data_three
  838. }
  839. },
  840. switchTab(val) { //换option
  841. if (val === 'first') {
  842. this.optionTable = option
  843. } else if (val === 'second') {
  844. this.optionTable = optionAdd
  845. } else if (val === 'three') {
  846. this.optionTable = optionReturn
  847. }
  848. },
  849. //责任人 远程
  850. corpAttnRemoteMethod(val) {
  851. getUserList({ realName: val }).then(res => {
  852. this.corpAttnDic = res.data.data
  853. })
  854. },
  855. //承揽人 远程
  856. salesNameRemoteMethod(val) {
  857. getUserList({ realName: val }).then(res => {
  858. this.salesNameDic = res.data.data
  859. })
  860. },
  861. value(value, row) {
  862. if (value) {
  863. row.userid = value.id
  864. row.deptid = value.deptId
  865. }
  866. },
  867. //合计
  868. totalChange(row, type) {
  869. //明细列表金额合计
  870. if (this.secondDisable === 0) {
  871. this.data_one = this.data
  872. }
  873. let amountList = this.data_one.map(item => {
  874. if (item.amount) {
  875. return parseFloat(item.amount);
  876. } else return 0
  877. });
  878. //明细列表服务费合计
  879. let serviceChargeList = this.data.map(item => {
  880. if (item.serviceCharge) {
  881. return parseFloat(item.serviceCharge);
  882. } else return 0
  883. });
  884. //明细列表成本合计
  885. let matMoneyList = this.data.map(item => {
  886. if (item.matMoney) {
  887. return parseFloat(item.matMoney);
  888. } else return 0
  889. });
  890. if (type === '金额') {
  891. if (this.formTwo.debitAmount) {
  892. if (this.formTwo.debitAmount < amountList.reduce((n, m) => n + m)) {
  893. this.$message.error("明细列表合同金额不能大于总金额!")
  894. }
  895. }
  896. }
  897. // if(type==='服务'){
  898. // this.formTwo.serviceCharge = serviceChargeList.reduce((n,m) => n + m)
  899. // }
  900. // if(type==='代垫'){
  901. // this.formTwo.matMoney = matMoneyList.reduce((n,m) => n + m)
  902. // }
  903. if (row.serviceCharge && row.matMoney && row.otheramt && row.amount) {
  904. if (row.amount < (parseFloat(row.serviceCharge) + parseFloat(row.matMoney) + parseFloat(row.otheramt))) {
  905. this.$message.error("费用之和不能超过合计金额!")
  906. row.serviceCharge = 0;
  907. row.matMoney = 0;
  908. }
  909. }
  910. },
  911. //费用计算计算
  912. costCount(row) {
  913. if (this.activeName === 'first') {
  914. if (row.serviceCharge && row.matMoney && row.otheramt) {
  915. row.amount = parseFloat(row.serviceCharge) + parseFloat(row.matMoney) + parseFloat(row.otheramt)
  916. }
  917. } else {
  918. if (row.serviceCharge && row.matMoney) {
  919. row.amount = parseFloat(row.serviceCharge) + parseFloat(row.matMoney)
  920. }
  921. }
  922. },
  923. //删除列表后面的删除按钮触发触发(row, index, done)
  924. rowDel(row, index) {
  925. this.$confirm("确定将此明细删除?", {
  926. confirmButtonText: "确定",
  927. cancelButtonText: "取消",
  928. type: "warning"
  929. }).then(() => {
  930. this.data.splice(index, 1)
  931. });
  932. },
  933. // 合同金额
  934. debitChange(val) {
  935. if (val) {
  936. if (!this.formTwo.settlmentAmount) {
  937. this.$set(this.formTwo, "balanceAmount", val)
  938. }
  939. }
  940. },
  941. //打开结算窗口
  942. beforeCloseAccount(row) {
  943. if (this.verificationData()) {
  944. this.account = row;
  945. this.accountDialog = true;
  946. }
  947. },
  948. dispatch(row, index) {
  949. if (row.id) {
  950. this.pgList = []
  951. if (row.frequency == 4 && row.second) {
  952. for (let i = 0; i < row.second; i++) {
  953. this.pgList.push({
  954. ...row,
  955. beginTime: "",
  956. jine: row.amount / row.second,
  957. $cellEdit: true
  958. })
  959. }
  960. } else {
  961. this.pgList.push({
  962. ...row,
  963. beginTime: "",
  964. jine: row.amount,
  965. $cellEdit: true
  966. })
  967. }
  968. }
  969. this.pgIndex = index
  970. this.pgDialog = true
  971. },
  972. pgConfirm() {
  973. for (let i = 0; i < this.pgList.length; i++) {
  974. if (!this.pgList[i].beginTime) {
  975. return this.$message.error('请完善开始日期')
  976. }
  977. }
  978. let projectItemDateList = []
  979. this.pgList.forEach((e, index) => {
  980. projectItemDateList.push({
  981. beginTime: e.beginTime,
  982. reminderDay: e.reminderDay
  983. })
  984. })
  985. this.data[this.pgIndex].projectItemDateList = projectItemDateList
  986. const params = {
  987. ...this.form,
  988. ...this.formTwo,
  989. itemList:this.data,
  990. filesList: this.upLoadData
  991. }
  992. dispatch(params).then(res => {
  993. if (res.data.success) {
  994. this.$message({
  995. type: "success",
  996. message: "操作成功!"
  997. });
  998. this.pgDialog = false;
  999. this.getProjectDetail();
  1000. }
  1001. })
  1002. },
  1003. //结算
  1004. closeAccount(form) {
  1005. this.$refs[form].validate((valid) => {
  1006. if (valid) {
  1007. settleAccounts(this.account.id, 5,
  1008. this.accountFormData.accountName,
  1009. this.accountFormData.payTime).then(res => {
  1010. if (res.data.success) {
  1011. this.$message({
  1012. type: "success",
  1013. message: "操作成功!"
  1014. });
  1015. this.accountFormData = {},
  1016. this.accountDialog = false;
  1017. this.getProjectDetail();
  1018. }
  1019. })
  1020. }
  1021. })
  1022. },
  1023. cancelCloseAccount(row) {
  1024. this.$confirm("确认取消结算此明细?", {
  1025. confirmButtonText: "确定",
  1026. cancelButtonText: "取消",
  1027. type: "warning"
  1028. }).then(() => {
  1029. settleAccounts(row.id, 6).then(res => {
  1030. if (res.data.success) {
  1031. this.$message({
  1032. type: "success",
  1033. message: "操作成功!"
  1034. });
  1035. this.getProjectDetail();
  1036. }
  1037. })
  1038. });
  1039. },
  1040. //请核
  1041. mainCheck() {
  1042. if (this.verificationData()) {
  1043. this.detailsCollection()
  1044. for (let i = 0; i < this.dataList.length; i++) {
  1045. if (this.dataList[i].strStatus !== "结算完成") {
  1046. return this.$message.error(`明细列表存在未结算数据,请检查!`);
  1047. }
  1048. }
  1049. masterCheck(this.form.id).then(res => {
  1050. if (res.data.success) {
  1051. this.$message.success("操作成功!")
  1052. this.getProjectDetail();
  1053. }
  1054. })
  1055. }
  1056. //
  1057. },
  1058. // 发送消息
  1059. postMessage() {
  1060. this.messageVisble = true
  1061. this.$nextTick(() => {
  1062. this.$refs.messagePost.init()
  1063. })
  1064. },
  1065. closeDialog() {
  1066. this.messageVisble = false
  1067. },
  1068. getProjectDetail() {
  1069. projectDetail(this.id, "0,1,2,3,4,5").then(res => {
  1070. this.afterEcho(res.data.data)
  1071. })
  1072. },
  1073. //新增 修改
  1074. editMainProject(type) {
  1075. this.$refs["form"].validate((valid) => {
  1076. if (valid) {
  1077. this.detailsCollection()
  1078. for (let i = 0; i < this.dataList.length; i++) {
  1079. if (this.dataList[i].deptid === (null || "")) {
  1080. return this.$message.error(`请输入明细列表第${i + 1}行的任务部门`);
  1081. }
  1082. if (this.dataList[i].beginTime === (null || "")) {
  1083. return this.$message.error(`请输入明细列表第${i + 1}行的开始日期`);
  1084. }
  1085. if (this.dataList[i].actualDate === (null || "")) {
  1086. return this.$message.error(`请输入明细列表第${i + 1}行的结束`);
  1087. }
  1088. }
  1089. this.buttonLoading = true
  1090. const params = {
  1091. ...this.form,
  1092. ...this.formTwo,
  1093. itemList: this.dataList,
  1094. filesList: this.upLoadData
  1095. }
  1096. editMianProject(params).then(res => {
  1097. if (res.data.success) {
  1098. this.id = res.data.data
  1099. this.$message.success("操作成功!")
  1100. projectDetail(res.data.data, "0,1,2,3,4,5").then(res => {
  1101. this.afterEcho(res.data.data)
  1102. })
  1103. }
  1104. }).finally(() => {
  1105. this.buttonLoading = false
  1106. })
  1107. if (type === true) {
  1108. this.$emit("goBack");
  1109. }
  1110. }
  1111. })
  1112. },
  1113. copyData() {
  1114. if (this.verificationData()) {
  1115. delete this.form.id
  1116. delete this.formTwo.id
  1117. }
  1118. },
  1119. createData() {
  1120. if (this.verificationData()) {
  1121. this.$confirm("确定创建新的单据吗?", "提示", {
  1122. confirmButtonText: "保存",
  1123. cancelButtonText: "取消",
  1124. type: "warning",
  1125. }).then(() => {
  1126. this.form = {}
  1127. this.oldForm = {}
  1128. this.formTwo = {}
  1129. this.oldFormTwo = {}
  1130. this.dataList = []
  1131. this.oldData = []
  1132. this.upLoadData = []
  1133. this.oldUpLoadData = []
  1134. this.$set(this.formTwo, "corpAttn", this.$store.getters.userInfo.user_name)
  1135. this.$set(this.formTwo, "salesName", this.$store.getters.userInfo.user_name)
  1136. this.$set(this.formTwo, "debitAmount", 0)
  1137. this.$set(this.formTwo, "advanceAmount", 0)
  1138. this.$set(this.formTwo, "settlmentAmount", 0)
  1139. this.$set(this.formTwo, "balanceAmount", 0)
  1140. this.$set(this.formTwo, "createUserName", this.$store.getters.userInfo.user_name)
  1141. let date = new Date();
  1142. let strDate = date.getFullYear() + "-" + (date.getsecond() + 1) + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
  1143. this.$set(this.formTwo, "createTime", strDate)
  1144. })
  1145. }
  1146. },
  1147. //明细合集
  1148. detailsCollection() {
  1149. if (this.secondDisable === 0) {
  1150. this.data = this.data_one
  1151. }
  1152. if (this.secondDisable === 1) {
  1153. this.data = this.data_two
  1154. }
  1155. if (this.secondDisable === 2) {
  1156. this.data = this.data_three
  1157. }
  1158. this.dataList = []
  1159. this.dataList.push(...this.data_one, ...this.data_two, ...this.data_three)
  1160. },
  1161. afterEcho(data) {
  1162. this.form = data;
  1163. this.viewDisabled = this.form.status !== 0 ? true : false
  1164. this.option.column.forEach(item => {
  1165. if (item.prop == "cname") {
  1166. this.$set(item, "disabled", this.viewDisabled)
  1167. }
  1168. })
  1169. this.formTwo = Object.assign({}, data);
  1170. delete this.formTwo.cname;
  1171. delete this.formTwo.corpId;
  1172. delete this.formTwo.corpAttn;
  1173. delete this.formTwo.salesName;
  1174. delete this.formTwo.sourceBusiness;
  1175. delete this.formTwo.remark;
  1176. this.oldForm = Object.assign({}, data);
  1177. this.oldFormTwo = Object.assign({}, data);
  1178. if (data.itemList) {
  1179. this.dataList = data.itemList;
  1180. this.oldData = this.deepClone(data.itemList)
  1181. //根据状态区分三种明细
  1182. this.data_one = this.dataList.filter(item => item.projectType === 0)
  1183. this.data_two = this.dataList.filter(item => item.projectType === 1)
  1184. this.data_three = this.dataList.filter(item => item.projectType === 2)
  1185. //判断当前所处哪个明细下 给data赋值
  1186. if (this.secondDisable === 0) {
  1187. this.data = this.data_one
  1188. }
  1189. if (this.secondDisable === 1) {
  1190. this.data = this.data_two
  1191. }
  1192. if (this.secondDisable === 2) {
  1193. this.data = this.data_three
  1194. }
  1195. }
  1196. if (data.filesList) {
  1197. this.upLoadData = data.filesList
  1198. this.oldUpLoadData = this.deepClone(data.filesList)
  1199. }
  1200. },
  1201. verificationData() {
  1202. this.detailsCollection()
  1203. if (contrastObj(this.form, this.oldForm) || contrastObj(this.formTwo, this.oldFormTwo) || contrastList2(this.dataList, this.oldData)
  1204. || contrastList2(this.upLoadData, this.oldUpLoadData)
  1205. ) {
  1206. this.$confirm("数据发生变化,请先提交保存!", "提示", {
  1207. confirmButtonText: "保存",
  1208. cancelButtonText: "取消",
  1209. type: "warning",
  1210. }).then(() => {
  1211. this.editMainProject()
  1212. }).catch(() => {
  1213. return false
  1214. })
  1215. } else {
  1216. return true
  1217. }
  1218. },
  1219. //点击修改或保存时触发
  1220. rowCellTwo(row, index) {
  1221. this.$refs.crud.rowCell(row, index);
  1222. },
  1223. //选择时
  1224. selectionChange(row) {
  1225. this.crudSelection = row;
  1226. },
  1227. //新增修改时保存触发
  1228. rowSave(row, done, loading) {
  1229. done()
  1230. },
  1231. rowUpdate(row, index, done, loading) {
  1232. done(row)
  1233. },
  1234. searchChange(params, done) {
  1235. this.getList(this.page, params);
  1236. done();
  1237. },
  1238. sizeChange(val) {
  1239. this.page.pageSize = val;
  1240. this.getList();
  1241. },
  1242. currentChange(val) {
  1243. this.page.currentPage = val;
  1244. this.getList();
  1245. },
  1246. frequencyChange(row) {
  1247. row.second = null
  1248. },
  1249. //上传文件保存
  1250. upLoadSave(row, done, loading) {
  1251. this.upLoadData.push(row)
  1252. done()
  1253. },
  1254. //修改附件上传触发
  1255. upLoadUpdate(row, done) {
  1256. done(row);
  1257. },
  1258. //删除附件上传触发
  1259. upLoadDel(row, index,) {
  1260. this.$confirm("确定将选择数据删除?", {
  1261. confirmButtonText: "确定",
  1262. cancelButtonText: "取消",
  1263. type: "warning"
  1264. }).then(() => {
  1265. if (row.id) {
  1266. corpsbank(row.id).then(res => {
  1267. if (res.data.success) {
  1268. this.$message({
  1269. type: "success",
  1270. message: "操作成功!"
  1271. });
  1272. this.bankOfDepositData.splice(index, 1);
  1273. }
  1274. })
  1275. } else {
  1276. this.$message({
  1277. type: "success",
  1278. message: "操作成功!"
  1279. });
  1280. this.bankOfDepositData.splice(index, 1);
  1281. }
  1282. })
  1283. },
  1284. //服务窗口事件
  1285. serviceNodeClick(data) {
  1286. this.serviceTreeDeptId = data.id;
  1287. this.serviceOnLoad(this.servicePage);
  1288. },
  1289. serviceRefreshChange() {
  1290. this.serviceOnLoad(this.servicePage, this.serviceSearch)
  1291. },
  1292. serviceSearchChange(params, done) {
  1293. this.serviceOnLoad(this.servicePage, params)
  1294. done();
  1295. },
  1296. serviceSelectionChange(row) {
  1297. this.serviceSelectList = row;
  1298. },
  1299. serviceOnLoad(page, params = {}) {
  1300. this.serviceLoading = true;
  1301. getServiceProjectList(page.currentPage, page.pageSize, params, this.serviceTreeDeptId).then(res => {
  1302. this.serviceData = res.data.data.records
  1303. this.servicePage.total = res.data.data.total
  1304. this.serviceLoading = false
  1305. })
  1306. },
  1307. serviceConfirm() {
  1308. if (this.serviceSelectList.length != 0) {
  1309. this.serviceSelectList.forEach((item) => {
  1310. const params = {
  1311. strStatus: "录入",
  1312. pname: item.cname,
  1313. remarks: item.remarks,
  1314. price: item.price,
  1315. unit: item.unit,
  1316. secondDisable: this.secondDisable,
  1317. frequency: item.rate,
  1318. projectType: this.secondDisable
  1319. }
  1320. this.$refs.crud.rowCellAdd(params);
  1321. this.$refs.crud.rowCell(item, this.optionFrom.length - 1)
  1322. })
  1323. }
  1324. this.serviceSelectList = []
  1325. this.serviceDialog = false
  1326. this.$message({
  1327. type: "success",
  1328. message: "导入成功!"
  1329. });
  1330. },
  1331. //用户窗口事件
  1332. selectUser(row) {
  1333. this.userDialog = true
  1334. this.detailsSelect = row.$index;
  1335. },
  1336. userSearchChange(params, done) {
  1337. this.userOnLoad(this.userPage, params);
  1338. done()
  1339. },
  1340. userSearchReset() {
  1341. },
  1342. userRefreshChange() {
  1343. this.userOnLoad(this.userPage)
  1344. },
  1345. userSelectionChange(row) {
  1346. this.userSelection = row;
  1347. },
  1348. userOnLoad(page, params = {}) {
  1349. this.userLoading = true;
  1350. getList(page.currentPage, page.pageSize, params, this.userTreeDeptId).then(res => {
  1351. this.userDataList = res.data.data.records
  1352. this.userPage.total = res.data.data.total
  1353. this.userLoading = false;
  1354. });
  1355. },
  1356. userNodeClick(data) {
  1357. this.userTreeDeptId = data.id;
  1358. this.userOnLoad(this.userPage);
  1359. },
  1360. //确定
  1361. userConfirm() {
  1362. if (this.userSelection) {
  1363. this.data[this.detailsSelect].userid = this.userSelection[0].id;
  1364. this.$set(this.data[this.detailsSelect], 'userName', this.userSelection[0].realName)
  1365. this.userDialog = !this.userDialog
  1366. }
  1367. },
  1368. dialogProcessClose() {
  1369. this.processDialog = false
  1370. this.getProjectDetail()
  1371. },
  1372. //返回主营项目列表
  1373. backToList() {
  1374. this.detailsCollection()
  1375. if (contrastObj(this.form, this.oldForm) || contrastObj(this.formTwo, this.oldFormTwo) || contrastList2(this.dataList, this.oldData)
  1376. || contrastList2(this.upLoadData, this.oldUpLoadData)
  1377. ) {
  1378. this.$confirm("当前页面有未保存数据,是否保存数据?", "提示", {
  1379. confirmButtonText: "保存",
  1380. cancelButtonText: "取消",
  1381. type: "warning",
  1382. }).then(() => {
  1383. this.editMainProject(true)
  1384. }).catch(() => {
  1385. this.$emit("goBack");
  1386. })
  1387. } else {
  1388. this.$emit("goBack");
  1389. }
  1390. },
  1391. //列保存触发
  1392. async saveColumn() {
  1393. const inSave = await this.saveColumnData(
  1394. this.getColumnName(56),
  1395. this.optionTable
  1396. );
  1397. if (inSave) {
  1398. this.$message.success("保存成功");
  1399. //关闭窗口
  1400. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1401. }
  1402. },
  1403. async resetColumn() {
  1404. const inSave = await this.delColumnData(
  1405. this.getColumnName(56),
  1406. option
  1407. );
  1408. if (inSave) {
  1409. this.$message.success("重置成功");
  1410. this.optionTable = option;
  1411. //关闭窗口
  1412. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1413. }
  1414. },
  1415. //1.0版本注释内容
  1416. // operationDetailList(itemList){
  1417. // this.data = itemList;
  1418. // this.oldData = this.deepClone(itemList)
  1419. // let status = [];
  1420. // this.data.forEach(item =>{
  1421. // item.status == 0 ? status.push(true) : status.push(false)
  1422. // })
  1423. // //如果 明细列表存在 请核之后的状态 禁止编辑一些输入框
  1424. // if(status.findIndex(item => item == false) == 0){
  1425. // this.basicData.column.forEach(item =>{
  1426. // if(item.prop == "code" || item.prop == "cname" || item.prop == "corpId" || item.prop == "debitAmount"){
  1427. // item.disabled = true
  1428. // this.configuration.disabled = true
  1429. // }
  1430. // })
  1431. // }else{
  1432. // this.basicData.column.forEach(item =>{
  1433. // if(item.prop == "code" || item.prop == "cname" || item.prop == "corpId" || item.prop == "debitAmount"){
  1434. // item.disabled = false
  1435. // this.configuration.disabled = false
  1436. // }
  1437. // })
  1438. // }
  1439. // },
  1440. // openPleaseCheckDialog(){
  1441. // this.processDialog = true;
  1442. // this.itemId = this.crudSelection[0].id //记得不能写死
  1443. // },
  1444. // //请核之前
  1445. // beforePleaseCheck(){
  1446. // if(this.crudSelection){
  1447. // let id = [];
  1448. // let result = [];
  1449. // this.crudSelection.forEach(item=>{
  1450. // // 新录入状态下 才可提交审核
  1451. // item.id ? id.push(true) : id.push(false) //如果没有id并且为新录入 提示保存
  1452. // item.strStatus === "录入" ? result.push(true) : result.push(false) //判断所有的是否为录入状态
  1453. // })
  1454. // if(id.findIndex(item => item != true) == -1){
  1455. // if(result.findIndex(item => item != true) == -1){
  1456. // if(contrastObj(this.form,this.oldForm) || contrastList2(this.data,this.oldData)){ //判断是否改动过此页面
  1457. // this.$confirm("您已改动此页面,请先保存之后在请核?", "提示", {
  1458. // confirmButtonText: "保存",
  1459. // cancelButtonText: "取消",
  1460. // type: "warning",
  1461. // }).then(() => {
  1462. // this.editMainProject();
  1463. // }).catch(()=>{
  1464. // return
  1465. // })
  1466. // }else{
  1467. // this.pleaseCheck()
  1468. // // this.openPleaseCheckDialog();
  1469. // }
  1470. // }else{
  1471. // this.$message({
  1472. // type: "error",
  1473. // message: "请核数据中存在已请核数据!"
  1474. // });
  1475. // return
  1476. // }
  1477. // }else{
  1478. // this.$confirm("列表内存在新录入数据,是否先保存此数据?", {
  1479. // confirmButtonText: "确定",
  1480. // cancelButtonText: "取消",
  1481. // type: "warning"
  1482. // }).then(() => {
  1483. // this.editMainProject();
  1484. // })
  1485. // }
  1486. // }
  1487. // },
  1488. // //请核
  1489. // pleaseCheck(){
  1490. // this.crudSelection.forEach(item =>{
  1491. // updateItemStatus(this.data[item.$index].id,1).then(res =>{
  1492. //
  1493. // })
  1494. // this.$message({
  1495. // type: "success",
  1496. // message: "请核成功!"
  1497. // });
  1498. // //刷新列表
  1499. // this.getProjectDetail();
  1500. // })
  1501. // },
  1502. },
  1503. filters: {
  1504. frequencyFormat(val, list) {
  1505. let name;
  1506. list.forEach(e => {
  1507. if (e.dictKey == val) {
  1508. name = e.dictValue
  1509. }
  1510. })
  1511. return name;
  1512. }
  1513. },
  1514. watch: {
  1515. dataList: function (list) {
  1516. }
  1517. }
  1518. };
  1519. </script>
  1520. <style scoped lang="scss">
  1521. .main-head {
  1522. position: fixed;
  1523. top: 105px;
  1524. width: 100%;
  1525. margin-left: -10px;
  1526. height: 62px;
  1527. background: #ffffff;
  1528. box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  1529. z-index: 999;
  1530. }
  1531. .upper_right_button {
  1532. display: flex;
  1533. position: fixed;
  1534. right: 12px;
  1535. top: 47px;
  1536. }
  1537. .main-back {
  1538. cursor: pointer;
  1539. line-height: 62px;
  1540. font-size: 16px;
  1541. color: #323233;
  1542. font-weight: 400;
  1543. }
  1544. .required_fields {
  1545. color: #F56C6C;
  1546. display: inline-block;
  1547. width: 7%
  1548. }
  1549. .avue-tree {
  1550. overflow: hidden;
  1551. max-height: 660px;
  1552. }
  1553. ::v-deep .el-form-item {
  1554. margin-bottom: 0;
  1555. }
  1556. ::v-deep .el-form-item__content {
  1557. line-height: 32px;
  1558. }
  1559. .trading-form ::v-deep .el-form-item {
  1560. margin-bottom: 8px !important;
  1561. }
  1562. .landConFrom-input {
  1563. display: flex;
  1564. justify-content: center;
  1565. }
  1566. </style>