detailsPage.vue 55 KB

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