index.vue 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862
  1. <template>
  2. <div>
  3. <div v-if="pageDisplay" class="app-container">
  4. <formComponent
  5. v-if="searchWhether"
  6. :formOption="formOption"
  7. :dataList="dataList"
  8. :inDex="inDex"
  9. ref="avatar"
  10. @submitForm="submitForm"
  11. @returnToForm="returnToForm"
  12. />
  13. <listComponent
  14. :tableData="tableData"
  15. @selectionbox="selectionbox"
  16. @see="viewMethod"
  17. @modify="modification"
  18. @deletion="deletion"
  19. @buttonList="buttonList"
  20. @showSearch="showSearch"
  21. @feedback="feedback"
  22. @getList="getList"
  23. :tatolLabel="['金额合计']"
  24. :hasPermi="hasPermi"
  25. :isItHidden="isItHidden"
  26. :customButton="customButton"
  27. :listStyle="listStyle"
  28. :queryList="queryList"
  29. :setRowList="setRowList"
  30. />
  31. <!-- <el-pagination-->
  32. <!-- style="float: right;margin-top: 10px"-->
  33. <!-- @size-change="handleSizeChange"-->
  34. <!-- @current-change="handleCurrentChange"-->
  35. <!-- :page-sizes="[10, 20, 30, 50]"-->
  36. <!-- :page-size="this.formDataList.pageSize"-->
  37. <!-- background-->
  38. <!-- layout="sizes, prev, pager, next"-->
  39. <!-- :total="total">-->
  40. <!-- </el-pagination>-->
  41. <div style="float: right;margin-bottom: 10px">
  42. <pagination
  43. v-show="total > 0"
  44. :total="total"
  45. :page.sync="formDataList.pageNum"
  46. :limit.sync="formDataList.pageSize"
  47. :page-sizes="[10,100,200,500,1000]"
  48. @pagination="feedback('搜索')"
  49. />
  50. </div>
  51. </div>
  52. <div v-else class="app-container">
  53. <div style="display: flex;margin-bottom: 10px">
  54. <el-breadcrumb>
  55. <el-breadcrumb-item>
  56. <el-button
  57. size="mini"
  58. type="danger" plain
  59. @click="backToList"
  60. icon="el-icon-arrow-left"
  61. >
  62. 返回列表
  63. </el-button>
  64. </el-breadcrumb-item>
  65. <!-- <el-breadcrumb-item style="font-weight: 700">-->
  66. <!-- <el-button-group>-->
  67. <!-- <el-button type="primary" size="mini" icon="el-icon-arrow-left" :disabled="forward" @click="sequence(true)">向前</el-button>-->
  68. <!-- <el-button type="primary" size="mini" :disabled="backward" @click="sequence(true)">向后<i class="el-icon-arrow-right el-icon&#45;&#45;right"></i></el-button>-->
  69. <!-- </el-button-group>-->
  70. <!-- </el-breadcrumb-item>-->
  71. </el-breadcrumb>
  72. </div>
  73. <h1 style="text-align: center;margin-top: -42px">费用管理</h1>
  74. <formComponent
  75. v-if="searchWhether"
  76. :formOption="contentOption"
  77. :dataList="dataList"
  78. :inDex="inDex"
  79. ref="avatar"
  80. @writeOff="writeOff"
  81. @submitForm="submitForm"
  82. @returnToForm="returnToForm"
  83. @submitAndSave="submitAndSave"
  84. @selectTrigger="selectTrigger"
  85. />
  86. <listComponent
  87. ref="listComponent"
  88. :tableData="contentList"
  89. @selectionbox="selectionbox"
  90. @see="viewMethod"
  91. @modify="modification"
  92. @deletion="deletion"
  93. @buttonList="buttonList"
  94. @showSearch="showSearch"
  95. @feedback="feedback"
  96. @getList="getList"
  97. @deletRows="deletRows"
  98. @totalAmount="totalAmount"
  99. @change="change"
  100. :hasPermi="hasPermi"
  101. :tatolLabel="tatolLabel"
  102. :isItHidden="isItHidden"
  103. :customButton="contentButton"
  104. :listStyle="contentStyle"
  105. :queryList="purchaseList"
  106. :setRowList="setRowList"
  107. :listData="listData"
  108. />
  109. <el-collapse>
  110. <el-collapse-item title="附件管理" name="1">
  111. <div style="padding-right: 10px">
  112. <c-upload :list="tEnclosure" ref="cUpload" :disabled="disabled"></c-upload>
  113. </div>
  114. </el-collapse-item>
  115. </el-collapse>
  116. </div>
  117. <add-or-update
  118. v-if="addOrUpdateVisible"
  119. ref="addOrUpdate"
  120. @refreshDataList="getDataList"
  121. ></add-or-update>
  122. <approval-comments
  123. v-if="addOrUpdateVisib"
  124. ref="ApprovalComments"
  125. @refreshDataList="returnData"
  126. ></approval-comments>
  127. <el-dialog
  128. :title="`打印${reverse}`"
  129. :visible.sync="dialogVisible"
  130. :fullscreen="true"
  131. style="padding: 0;margin:0"
  132. width="70%"
  133. >
  134. <div ref="print">
  135. <div style="margin-bottom: 5px">
  136. 标题切换:
  137. <el-radio-group v-model="reverse">
  138. <el-radio label="报销单">报销单</el-radio>
  139. <el-radio label="付款单">付款单</el-radio>
  140. </el-radio-group>
  141. </div>
  142. <table class="table table-striped table-bordered" align="center" valign="center">
  143. <tr>
  144. <td style="font-size: 24px;font-weight:bold" class="column" colspan="11">{{ reverse }}</td>
  145. </tr>
  146. <tr>
  147. <td class="column" style="width: 6%;">部门</td>
  148. <td class="column" colspan="2" style="width: 19%;">{{ formList.deptName }}</td>
  149. <td class="column" style="width: 9%;">报销方式</td>
  150. <td class="column" style="width: 9%;">{{ formList.expenseTypeName }}</td>
  151. <td class="column" style="width: 9.5%;">业务类型</td>
  152. <td class="column" style="width: 9.5%;">{{ formList.businessTypeName }}</td>
  153. <td class="column" style="width: 9.5%;">制单人</td>
  154. <td class="column" style="width: 9.5%;">{{ formList.createBy }}</td>
  155. <td class="column" style="width: 9.5%;">制单日期</td>
  156. <td class="column" style="width: 9.5%;">{{ formList.createTime ? formList.createTime.slice(0, 10) : '' }}
  157. </td>
  158. </tr>
  159. <tr>
  160. <td class="column">户头</td>
  161. <td class="column" colspan="3">{{ formList.account }}</td>
  162. <td class="column">开户行</td>
  163. <td class="column" colspan="3">{{ formList.openingBank }}</td>
  164. <td class="column">账号</td>
  165. <td class="column" colspan="2">{{ formList.openingBankAccount }}</td>
  166. </tr>
  167. <tr>
  168. <td class="column">备注</td>
  169. <td class="column" colspan="10" style="text-align: left">{{ formList.remark }}</td>
  170. </tr>
  171. </table>
  172. <table class="table table-striped table-bordered" align="center" valign="center">
  173. <tr>
  174. <td class="column" style="border-top: none;width: 6%">序号</td>
  175. <td class="column" style="border-top: none;width: 9.5%;">费用名称</td>
  176. <td class="column" style="border-top: none;width: 9.5%;">金额</td>
  177. <td class="column" style="border-top: none;width: 18%;">项目</td>
  178. <td class="column" style="border-top: none;width: 9.5%;">所属人员</td>
  179. <td class="column" style="border-top: none;width: 19%;" colspan="2">所属部门</td>
  180. <td class="column" style="border-top: none;width: 9.5%;">物料</td>
  181. <td class="column" style="border-top: none;width: 19%;" colspan="2">备注</td>
  182. </tr>
  183. <tr v-for="(item,index) in contentList" :key="index">
  184. <td class="column">{{ Number(index) + 1 }}</td>
  185. <td class="column">{{ item.expenseName }}</td>
  186. <td class="column">{{ item.amount ? Number(item.amount).toFixed(2) : item.amount }}</td>
  187. <td class="column">{{ item.belongsProjectName }}</td>
  188. <td class="column">{{ item.personnelName }}</td>
  189. <td class="column" colspan="2">{{ item.departmentName }}</td>
  190. <td class="column">{{ item.matterName }}</td>
  191. <td class="column" colspan="2">{{ item.remark }}</td>
  192. </tr>
  193. <tr>
  194. <td class="column" colspan="2" style="width: 15.5%;border-top: none">金额合计(小写):</td>
  195. <td class="column" colspan="2" style="text-align: left;border-top: none;">
  196. {{ formList.totalAmount ? formList.totalAmount.toFixed(2) : '' }}
  197. </td>
  198. <td class="column" colspan="3" style="width: 15%;border-top: none">金额合计(大写):</td>
  199. <td class="column" colspan="3" style="text-align: left;border-top: none;">
  200. {{ formList.totalAmount ? dealBigMoney(formList.totalAmount) : '' }}
  201. </td>
  202. </tr>
  203. </table>
  204. <table class="table table-striped table-bordered" align="center" valign="center">
  205. <tr>
  206. <td class="column" style="width: 15%;border: none">提交人:{{ formList.presenterName }}</td>
  207. <td class="column" colspan="2" style="text-align: left;border: none;width: 18%"></td>
  208. <td class="column" style="width: 15%;border: none">财务经理:{{ formList.firstLevelReviewerName }}</td>
  209. <td class="column" colspan="2" style="text-align: left;border: none;width: 18%"></td>
  210. <td class="column" style="width: 15%;border: none">总经理:{{ formList.secondaryReviewerName }}</td>
  211. <td class="column" colspan="2" style="text-align: left;border: none;width: 18%"></td>
  212. </tr>
  213. </table>
  214. </div>
  215. <span slot="footer" class="dialog-footer">
  216. <el-button @click="dialogVisible = false">取 消</el-button>
  217. <el-button type="primary" @click="Printing">打印</el-button>
  218. </span>
  219. </el-dialog>
  220. </div>
  221. </template>
  222. <script>
  223. import { select } from '@/api/system/set'
  224. import {
  225. listQuery,
  226. submit,
  227. viewSingle,
  228. deleteQuery,
  229. productName,
  230. queryItem,
  231. company,
  232. warehouse,
  233. listDelete,
  234. tableDeleteQuery,
  235. confirmDeletion,
  236. pleaseCheck,
  237. copyNew,
  238. revoke,
  239. withdrawBy,
  240. getName,
  241. queryUserVal, feesList, corpsList
  242. } from '@/api/costManagement/index'
  243. import Cookies from 'js-cookie'
  244. import Global from '@/layout/components/global'
  245. import moment from 'moment'
  246. import { listDept, treeselect } from '@/api/system/dept'
  247. import { getliable } from '@/api/project'
  248. import cUpload from '@/components/cUpload/index.vue'
  249. export default {
  250. name: 'index',
  251. components: {
  252. cUpload
  253. },
  254. data() {
  255. return {
  256. reverse: '报销单',
  257. before: '',
  258. lander: '',
  259. operator: '',
  260. disabled: true,
  261. forward: false,
  262. backward: false,
  263. addOrUpdateVisible: false,
  264. addOrUpdateVisib: false,
  265. total: 0,
  266. selection: [],
  267. formDataList: {
  268. fBilltype: 'FY',
  269. pageSize: 10,
  270. pageNum: 1
  271. },
  272. formList: {},
  273. tatolLabel: ['金额'],
  274. dialogVisible: false,
  275. listData: {
  276. itemExpenseId: [],
  277. businessType: [],
  278. expenseType: [],
  279. expenseId: [],
  280. belongsProjectId: [],
  281. departmentId: [],
  282. personnelId: []
  283. },
  284. hasPermi: {
  285. lookup: ['anpin:management:query'],
  286. disappear: ['anpin:management:remove']
  287. },
  288. setTimeout: '',
  289. searchWhether: true,
  290. pageDisplay: true,
  291. dataList: {
  292. itemExpenseId: [],
  293. businessType: [],
  294. expenseType: [],
  295. createDept: [],
  296. itemPersonnel: [],
  297. createById: [],
  298. itemDepartment: [],
  299. itemBelongsProjectId: []
  300. },
  301. tEnclosure: [],
  302. contentList: [],
  303. inDex: 4,
  304. tableData: [],
  305. tableList: [],
  306. isItHidden: true,
  307. listStyle: [
  308. {
  309. surface: '1',
  310. label: 'serialNumber',
  311. name: '序号',
  312. checked: 0,
  313. width: 100,
  314. onabort: ''
  315. }, {
  316. surface: '2',
  317. label: 'deptName',
  318. name: '部门',
  319. checked: 0,
  320. width: 100,
  321. onabort: ''
  322. }, {
  323. surface: '3',
  324. label: 'createBy',
  325. name: '制单人',
  326. checked: 0,
  327. width: 100,
  328. onabort: ''
  329. }, {
  330. surface: '4',
  331. label: 'createDeptName',
  332. name: '制单部门',
  333. checked: 0,
  334. width: 100,
  335. onabort: ''
  336. }, {
  337. surface: '5',
  338. label: 'businessTime',
  339. name: '业务日期',
  340. checked: 0,
  341. width: 100,
  342. onabort: ''
  343. }, {
  344. surface: '6',
  345. label: 'createTime',
  346. name: '制单日期',
  347. checked: 0,
  348. width: 100,
  349. onabort: ''
  350. }, {
  351. surface: '7',
  352. label: 'totalAmount',
  353. name: '金额合计',
  354. checked: 0,
  355. width: 100,
  356. onabort: ''
  357. },
  358. {
  359. surface: '8',
  360. label: 'remark',
  361. name: '备注',
  362. checked: 0,
  363. width: 100,
  364. onabort: ''
  365. },
  366. {
  367. surface: '9',
  368. label: 'applicantName',
  369. name: '申请人',
  370. checked: 0,
  371. width: 200,
  372. operation: 1
  373. },
  374. {
  375. surface: '10',
  376. label: 'fStatusName',
  377. name: '状态',
  378. checked: 0,
  379. width: 200,
  380. operation: 1
  381. },
  382. {
  383. surface: '11',
  384. label: 'fReviewDate',
  385. name: '审核日期',
  386. checked: 0,
  387. width: 200,
  388. operation: 1
  389. },
  390. {
  391. surface: '12',
  392. label: 'operation',
  393. name: '操作',
  394. checked: 0,
  395. width: 160,
  396. fixed: 'right',
  397. operation: '1',
  398. onabort: ''
  399. }
  400. ],
  401. contentStyle: [
  402. {
  403. surface: '1',
  404. label: 'serialNumber',
  405. name: '序号',
  406. checked: 0,
  407. width: 100,
  408. disabled: false,
  409. onabort: ''
  410. }, {
  411. surface: '2',
  412. label: 'expenseId',
  413. name: '费用名称',
  414. checked: 0,
  415. width: 160,
  416. onabort: '',
  417. disabled: false,
  418. changeable: 1
  419. }, {
  420. surface: '3',
  421. label: 'amount',
  422. name: '金额',
  423. checked: 0,
  424. width: 120,
  425. disabled: false,
  426. onabort: 'this.value=this.value.replace(/[^\\-?\\d.]/g,"").replace(/^(\\-)*(\\d+)\\.(\\d\\d).*$/, "$1$2.$3")',
  427. changeable: 2
  428. }, {
  429. surface: '4',
  430. label: 'belongsProjectId',
  431. name: '项目',
  432. checked: 0,
  433. width: 200,
  434. onabort: '',
  435. disabled: false,
  436. changeable: 1
  437. }, {
  438. surface: '5',
  439. label: 'personnelId',
  440. name: '所属人员',
  441. checked: 0,
  442. width: 120,
  443. onabort: 'this.value=this.value.replace(/[^\\-?\\d.]/g,"").replace(/^(\\-)*(\\d+)\\.(\\d\\d).*$/, "$1$2.$3")',
  444. disabled: false,
  445. changeable: 1
  446. }, {
  447. surface: '6',
  448. label: 'departmentId',
  449. name: '所属部门',
  450. checked: 0,
  451. width: 200,
  452. onabort: '',
  453. disabled: false,
  454. changeable: 1
  455. }, {
  456. surface: '7',
  457. label: 'matterName',
  458. name: '物料',
  459. checked: 0,
  460. width: 100,
  461. disabled: false,
  462. changeable: 2
  463. }, {
  464. surface: '8',
  465. label: 'remark',
  466. name: '备注',
  467. checked: 0,
  468. width: 100,
  469. onabort: '',
  470. disabled: false,
  471. changeable: 2
  472. }, {
  473. surface: '9',
  474. label: 'operation',
  475. name: '操作',
  476. checked: 0,
  477. disabled: false,
  478. width: 160,
  479. fixed: 'right',
  480. operation: '2',
  481. onabort: ''
  482. }
  483. ],
  484. queryList: {
  485. tableName: '费用管理',
  486. columnList: []
  487. },
  488. purchaseList: {
  489. tableName: '费用管理详情',
  490. columnList: []
  491. },
  492. setRowList: [],
  493. customButton: [
  494. {
  495. type: 'primary',
  496. size: 'mini',
  497. icon: 'el-icon-edit',
  498. name: '新单',
  499. disabled: false
  500. },
  501. // {
  502. // type:'warning',
  503. // size:'mini',
  504. // icon:'el-icon-edit',
  505. // name:'立即修改',
  506. // disabled:false,
  507. // },
  508. //主页列表按钮
  509. // {
  510. // type: 'warning',
  511. // size: 'mini',
  512. // icon: 'el-icon-upload2',
  513. // name: '导出',
  514. // disabled: false,
  515. // hasPermi: ['anpin:stockControl:export']
  516. // },
  517. {
  518. type: 'success',
  519. size: 'mini',
  520. icon: 'el-icon-c-scale-to-original',
  521. name: '复制新单',
  522. disabled: false
  523. }
  524. ],
  525. contentButton: [
  526. {
  527. type: 'primary',
  528. size: 'mini',
  529. icon: 'el-icon-plus',
  530. name: '录入明细',
  531. disabled: false
  532. }, {
  533. type: 'primary',
  534. size: 'mini',
  535. icon: 'el-icon-check',
  536. name: '保存',
  537. plain: true,
  538. disabled: false
  539. }
  540. , {
  541. type: 'primary',
  542. size: 'mini',
  543. icon: 'el-icon-edit-outline',
  544. name: '请核',
  545. disabled: false
  546. }
  547. , {
  548. type: 'primary',
  549. size: 'mini',
  550. icon: 'el-icon-plus',
  551. name: '新单',
  552. nameTwo: '详情页',
  553. plain: true,
  554. disabled: false
  555. }, {
  556. type: 'primary',
  557. size: 'mini',
  558. icon: 'el-icon-plus',
  559. name: '复制新单',
  560. nameTwo: '详情页',
  561. plain: true,
  562. disabled: false
  563. }, {
  564. type: 'success',
  565. size: 'mini',
  566. icon: 'el-icon-edit',
  567. name: '修改',
  568. disabled: false
  569. }
  570. // , {
  571. // type: 'warning',
  572. // size: 'mini',
  573. // icon: 'el-icon-download',
  574. // name: '导出',
  575. // disabled: false
  576. // }
  577. , {
  578. type: 'info',
  579. size: 'mini',
  580. icon: 'el-icon-edit-outline',
  581. name: '打印',
  582. disabled: false
  583. }, {
  584. type: 'primary',
  585. size: 'mini',
  586. icon: 'el-icon-edit-outline',
  587. name: '查看审批',
  588. disabled: false
  589. }
  590. ],
  591. formOption: [
  592. {
  593. span: 6,
  594. label: 'deptId',
  595. name: '部门',
  596. inputType: 8,
  597. width: 200,
  598. labelSize: '80',
  599. rules: [{ required: false, message: ' ' }]
  600. }, {
  601. span: 6,
  602. label: 'businessTimeList',
  603. name: '业务日期',
  604. inputType: 3,
  605. width: 300,
  606. labelSize: '80',
  607. rules: [{ required: false, message: ' ' }]
  608. }, {
  609. span: 6,
  610. label: 'createDept',
  611. name: '制单部门',
  612. inputType: 1,
  613. width: 200,
  614. labelSize: '80',
  615. rules: [{ required: false, message: ' ' }]
  616. }, {
  617. span: 6,
  618. label: 'createById',
  619. name: '制单人',
  620. inputType: 1,
  621. width: 200,
  622. labelSize: '80',
  623. rules: [{ required: false, message: ' ' }]
  624. }, {
  625. span: 6,
  626. label: 'itemBelongsProjectId',
  627. name: '项目',
  628. inputType: 1,
  629. width: 200,
  630. labelSize: '80',
  631. rules: [{ required: false, message: ' ' }]
  632. }, {
  633. span: 6,
  634. label: 'itemExpenseId',
  635. name: '费用名称',
  636. inputType: 1,
  637. width: 200,
  638. labelSize: '80',
  639. rules: [{ required: false, message: ' ' }]
  640. }, {
  641. span: 6,
  642. label: 'itemDepartment',
  643. name: '所属部门',
  644. inputType: 1,
  645. width: 200,
  646. labelSize: '80',
  647. rules: [{ required: false, message: ' ' }]
  648. }, {
  649. span: 6,
  650. label: 'itemPersonnel',
  651. name: '所属人员',
  652. inputType: 1,
  653. width: 200,
  654. labelSize: '80',
  655. rules: [{ required: false, message: ' ' }]
  656. }, {
  657. span: 6,
  658. label: 'itemMatterName',
  659. name: '物料',
  660. inputType: 2,
  661. width: 200,
  662. labelSize: '80',
  663. rules: [{ required: false, message: ' ' }]
  664. }, {
  665. span: 6,
  666. label: 'remark',
  667. name: '备注',
  668. inputType: 4,
  669. width: 200,
  670. labelSize: '80',
  671. rules: [{ required: false, message: ' ' }]
  672. }
  673. ],
  674. contentOption: [
  675. {
  676. index: '1',
  677. span: 6,
  678. label: 'deptId',
  679. name: '部门',
  680. inputType: 8,
  681. width: 200,
  682. disabled: true,
  683. labelSize: '80',
  684. rules: [{ required: true, message: ' ' }]
  685. }, {
  686. index: '2',
  687. span: 6,
  688. label: 'businessTime',
  689. name: '业务日期',
  690. inputType: 6,
  691. width: 200,
  692. disabled: true,
  693. labelSize: '80',
  694. rules: [{ required: true, message: ' ' }]
  695. }, {
  696. index: '3',
  697. span: 6,
  698. label: 'businessType',
  699. name: '业务类型',
  700. inputType: 1,
  701. width: 200,
  702. disabled: true,
  703. labelSize: '80',
  704. rules: [{ required: true, message: ' ' }]
  705. }, {
  706. index: '4',
  707. span: 6,
  708. label: 'expenseType',
  709. name: '报销方式',
  710. inputType: 1,
  711. width: 200,
  712. disabled: true,
  713. labelSize: '80',
  714. rules: [{ required: true, message: ' ' }]
  715. }, {
  716. index: '5',
  717. span: 6,
  718. label: 'createBy',
  719. name: '制单人',
  720. inputType: 2,
  721. width: 200,
  722. labelSize: '80',
  723. disabled: true
  724. }, {
  725. index: '6',
  726. span: 6,
  727. label: 'createDeptName',
  728. name: '制单部门',
  729. inputType: 2,
  730. width: 200,
  731. disabled: true,
  732. labelSize: '80'
  733. }, {
  734. index: '7',
  735. span: 6,
  736. label: 'createTime',
  737. name: '制单日期',
  738. inputType: 6,
  739. width: 200,
  740. disabled: true,
  741. labelSize: '80'
  742. }, {
  743. index: '8',
  744. span: 6,
  745. label: 'totalAmount',
  746. name: '金额合计',
  747. inputType: 2,
  748. width: 200,
  749. disabled: true,
  750. labelSize: '80'
  751. },
  752. {
  753. index: '9',
  754. span: 6,
  755. label: 'remark',
  756. name: '备注',
  757. inputType: 4,
  758. width: 200,
  759. disabled: true,
  760. labelSize: '80'
  761. }
  762. ],
  763. pushList: [{
  764. index: '10',
  765. span: 6,
  766. label: 'account',
  767. name: '户头',
  768. inputType: 2,
  769. width: 200,
  770. disabled: false,
  771. labelSize: '80'
  772. }, {
  773. index: '11',
  774. span: 6,
  775. label: 'openingBank',
  776. name: '开户行',
  777. inputType: 2,
  778. width: 200,
  779. disabled: false,
  780. labelSize: '80'
  781. }, {
  782. index: '12',
  783. span: 6,
  784. label: 'openingBankAccount',
  785. name: '账号',
  786. inputType: 2,
  787. width: 200,
  788. disabled: false,
  789. labelSize: '80'
  790. }],
  791. pendingPage: ''
  792. }
  793. },
  794. activated() {
  795. if (this.$route.query.list) {
  796. this.pendingPage = JSON.parse(this.$route.query.list)
  797. this.homePage()
  798. }
  799. },
  800. created() {
  801. //获取登陆人
  802. queryUserVal().then((response) => {
  803. this.lander = response.user.userName
  804. })
  805. let data = {
  806. tableName: this.queryList.tableName,
  807. userId: Cookies.get('userName')
  808. }
  809. let y = moment(Date.parse(new Date())).format('YYYY-MM-DD')
  810. // this.$set(this.formDataList, 'timeInterval', [y + ' 00:00:00', y + ' 23:59:59'])
  811. this.getRow(data)
  812. this.query(this.formDataList)
  813. treeselect().then(response => {
  814. this.dataList.deptId = response.data
  815. })
  816. listDept().then(res => {
  817. for (let item in res.data) {
  818. this.listData.departmentId.push({
  819. label: res.data[item].deptName,
  820. value: JSON.parse(res.data[item].deptId)
  821. })
  822. this.dataList.createDept.push({
  823. label: res.data[item].deptName,
  824. value: JSON.parse(res.data[item].deptId)
  825. })
  826. this.dataList.itemDepartment.push({
  827. label: res.data[item].deptName,
  828. value: JSON.parse(res.data[item].deptId)
  829. })
  830. }
  831. })
  832. getliable().then((res) => {
  833. for (let item in res.rows) {
  834. this.listData.personnelId.push({
  835. label: res.rows[item].userName,
  836. value: res.rows[item].userId
  837. })
  838. this.dataList.itemPersonnel.push({
  839. label: res.rows[item].userName,
  840. value: res.rows[item].userId
  841. })
  842. this.dataList.createById.push({
  843. label: res.rows[item].userName,
  844. value: res.rows[item].userId
  845. })
  846. }
  847. })
  848. corpsList({ fTypeid: 205 }).then(res => {
  849. for (let item in res.rows) {
  850. this.listData.belongsProjectId.push({
  851. label: res.rows[item].fName,
  852. value: JSON.parse(res.rows[item].fId)
  853. })
  854. this.dataList.itemBelongsProjectId.push({
  855. label: res.rows[item].fName,
  856. value: JSON.parse(res.rows[item].fId)
  857. })
  858. }
  859. })
  860. feesList().then(res => {
  861. for (let item in res.data) {
  862. this.listData.expenseId.push({
  863. label: res.data[item].fName,
  864. value: JSON.parse(res.data[item].fId)
  865. })
  866. this.dataList.itemExpenseId.push({
  867. label: res.data[item].fName,
  868. value: JSON.parse(res.data[item].fId)
  869. })
  870. }
  871. })
  872. this.getDicts('expense_business_type').then(res => {
  873. for (let item in res.data) {
  874. this.dataList.businessType.push({
  875. label: res.data[item].dictLabel,
  876. value: res.data[item].dictValue
  877. })
  878. }
  879. })
  880. this.getDicts('reimbursement_method').then(res => {
  881. for (let item in res.data) {
  882. this.dataList.expenseType.push({
  883. label: res.data[item].dictLabel,
  884. value: res.data[item].dictValue
  885. })
  886. }
  887. })
  888. },
  889. methods: {
  890. /** 数字金额大写转换(可以处理整数,小数,负数) */
  891. dealBigMoney(n) {
  892. let fraction = ['角', '分']
  893. let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖']
  894. let unit = [['元', '万', '亿'], ['', '拾', '佰', '仟']]
  895. let head = n < 0 ? '欠' : ''
  896. n = Math.abs(n)
  897. let s = ''
  898. for (let i = 0; i < fraction.length; i++) {
  899. s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '')
  900. }
  901. s = s || '整'
  902. n = Math.floor(n)
  903. for (let i = 0; i < unit[0].length && n > 0; i++) {
  904. let p = ''
  905. for (let j = 0; j < unit[1].length && n > 0; j++) {
  906. p = digit[n % 10] + unit[1][j] + p
  907. n = Math.floor(n / 10)
  908. }
  909. s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s
  910. }
  911. return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整')
  912. },
  913. change(scope) {
  914. for (let item in this.contentList) {
  915. for (let li in this.listData.fFeeid) {
  916. if (this.contentList[item].fFeeid == this.listData.fFeeid[li].value) {
  917. this.$set(this.contentList[item], 'fFeeunitid', this.listData.fFeeid[li].fFeeunitid)
  918. this.$set(this.contentList[item], 'fCurrencyName', this.listData.fFeeid[li].fCurrency)
  919. }
  920. }
  921. }
  922. },
  923. homePage() {
  924. let date = this.$route.query
  925. if (this.$route.query.list) {
  926. // this.contentButton = this.$options.data().contentButton
  927. // this.contentButton.push(JSON.parse(this.$route.query.list))
  928. let scope = {
  929. row: {
  930. fId: JSON.parse(this.$route.query.data).billId
  931. }
  932. }
  933. this.viewMethod(scope)
  934. } else {
  935. this.pageDisplay = true
  936. }
  937. },
  938. // 查看审批流
  939. getDataList() {
  940. this.addOrUpdateVisible = false
  941. },
  942. returnData() {
  943. this.addOrUpdateVisib = false
  944. this.open = false
  945. this.cancelTwo()
  946. },
  947. sequence(res) {
  948. // let i = 0
  949. // for ( i ; i <= this.tableData.length;i++){
  950. // if (this.$refs.avatar.form.fId == this.tableData[i].fId) {
  951. // console.log(i)
  952. // if (i >= 0) this.forward = true
  953. // if (this.tableData.length != Number(i+1)) this.backward = false
  954. // if (i !== 0){
  955. // console.log(this.tableData[--i].fId)
  956. // }
  957. // return
  958. // }
  959. // }
  960. // if (res === true){
  961. //
  962. // }
  963. },
  964. addOrUpdateHandle() {
  965. this.addOrUpdateVisible = true
  966. this.$nextTick(() => {
  967. this.$refs.addOrUpdate.init(this.$refs.avatar.form.fId, 560)
  968. })
  969. },
  970. addOrUpdateHand() {
  971. this.addOrUpdateVisib = true
  972. this.$nextTick(() => {
  973. this.$refs.ApprovalComments.init(this.$refs.avatar.form.fId, 560)
  974. })
  975. },
  976. //首页审批跳转关闭返回首页
  977. cancelTwo() {
  978. let view = {}
  979. if (this.pendingPage.pendingPage) {
  980. view = {
  981. fullPath: '/morePage/stock?open=true',
  982. hash: '',
  983. matched: Array(2),
  984. meta: Object,
  985. name: 'MorePage/stock',
  986. params: Object,
  987. path: '/morePage/stock',
  988. query: Object,
  989. title: '待审数据'
  990. }
  991. this.$router.push({ path: '/morePage/stock' })
  992. } else {
  993. view = {
  994. fullPath: '/purchaseRequest',
  995. hash: '',
  996. matched: Array(2),
  997. meta: Object,
  998. name: 'PurchaseRequest',
  999. params: Object,
  1000. path: '/purchaseRequest',
  1001. query: Object,
  1002. title: '采购申请'
  1003. }
  1004. this.$router.push({ path: '/index' })
  1005. }
  1006. this.$store
  1007. .dispatch('tagsView/delView', view)
  1008. .then(({ visitedViews }) => {
  1009. if (this.isActive(view)) {
  1010. this.toLastView(visitedViews, view)
  1011. }
  1012. })
  1013. Global.$emit('removeCache', 'closeSelectedTag', view)
  1014. },
  1015. //分页
  1016. handleSizeChange(val) {
  1017. // console.log(`每页 ${val} 条`);
  1018. this.formDataList.pageSize = val
  1019. this.query(this.formDataList)
  1020. },
  1021. handleCurrentChange(val) {
  1022. // console.log(`当前页: ${val}`);
  1023. this.formDataList.pageNum = val
  1024. this.query(this.formDataList)
  1025. },
  1026. //计算金额
  1027. totalAmount(scope, item, data) {
  1028. if (item.label === 'amount') {
  1029. let amount = 0
  1030. for (let item of data) {
  1031. amount += item.amount ? Number(item.amount) : 0
  1032. }
  1033. this.$set(this.$refs.avatar.form, 'totalAmount', amount.toFixed(2))
  1034. }
  1035. },
  1036. //查询主页列数据
  1037. query(data) {
  1038. console.log(data)
  1039. listQuery(data).then(res => {
  1040. this.tableData = res.rows
  1041. this.total = res.total
  1042. })
  1043. this.tEnclosure = []
  1044. this.disabled = true
  1045. },
  1046. //查询列数据
  1047. getRow(data, list, add, i) {
  1048. console.log(data, list, add)
  1049. for (let item in this.contentOption) {
  1050. for (let li in this.pushList) {
  1051. if (this.contentOption[item].label === this.pushList[li].label) {
  1052. this.contentOption.splice(item, 1)
  1053. }
  1054. }
  1055. }
  1056. select(data).then((res) => {
  1057. this.$refs.avatar.form = {}
  1058. if (data.tableName === '费用管理详情') {
  1059. if (res.data.length != 0) {
  1060. this.purchaseList.columnList = res.data.filter((e) => e.checked == 0)
  1061. this.purchaseList.columnList = res.data
  1062. this.setRowList = res.data
  1063. this.purchaseList.columnList = this.purchaseList.columnList.filter((e) => e.checked == 0)
  1064. // this.waitFor = true
  1065. } else {
  1066. this.$set(this.purchaseList, 'columnList', this.$options.data().contentStyle)
  1067. this.setRowList = this.$options.data().contentStyle
  1068. }
  1069. if (add) {
  1070. this.purchaseList.columnList.forEach(item => item.disabled = false)
  1071. this.disabled = false
  1072. } else {
  1073. this.purchaseList.columnList.forEach(item => item.disabled = true)
  1074. }
  1075. this.pageDisplay = false
  1076. this.isItHidden = false
  1077. this.inDex = this.contentOption.length
  1078. } else {
  1079. if (res.data.length != 0) {
  1080. this.queryList.columnList = res.data.filter((e) => e.checked == 0)
  1081. this.queryList.columnList = res.data
  1082. this.setRowList = res.data
  1083. this.queryList.columnList = this.queryList.columnList.filter((e) => e.checked == 0)
  1084. // this.waitFor = true
  1085. } else {
  1086. this.$set(this.queryList, 'columnList', this.$options.data().listStyle)
  1087. this.setRowList = this.$options.data().listStyle
  1088. }
  1089. this.pageDisplay = true
  1090. this.isItHidden = true
  1091. this.inDex = 4
  1092. this.$refs.avatar.assignmentTime(this.formDataList)
  1093. }
  1094. if (list) {
  1095. this.$refs.avatar.form = list.tCostManagement
  1096. this.contentList = list.tCostManagementItem
  1097. this.contentButton = this.$options.data().contentButton
  1098. this.tEnclosure = list.tEnclosure
  1099. if (this.pendingPage.name) {
  1100. this.contentButton.push(JSON.parse(this.$route.query.list))
  1101. if (JSON.parse(this.$route.query.list)) this.$router.push({ query: {} })
  1102. }
  1103. if (this.$refs.avatar.form.expenseType == 0) {
  1104. let dataTwo = []
  1105. for (let item of this.pushList) {
  1106. dataTwo.push({
  1107. ...item,
  1108. disabled: true
  1109. })
  1110. }
  1111. let item = this.contentOption.find(item => {
  1112. return item.name == '户头'
  1113. })
  1114. if (!item) {
  1115. this.contentOption = [...this.contentOption, ...dataTwo]
  1116. }
  1117. this.inDex = this.contentOption.length
  1118. } else {
  1119. for (let item in this.contentOption) {
  1120. for (let li in this.pushList) {
  1121. if (this.contentOption[item].label === this.pushList[li].label) {
  1122. this.contentOption.splice(item, 1)
  1123. }
  1124. }
  1125. }
  1126. }
  1127. let data = {
  1128. actId: 560,
  1129. id: this.$refs.avatar.form.fId
  1130. }
  1131. getName(data).then(response => {
  1132. console.log(response)
  1133. if (response.data.length != 0) {
  1134. this.before = response.data[0].userName
  1135. if (this.$refs.avatar.form.fBillstatus === 6 && this.before == this.lander) {
  1136. // this.contentButton.forEach(item =>{
  1137. // if (item.name === '审批'){
  1138. //
  1139. // }
  1140. // })
  1141. // this.contentButton.push({
  1142. // type: 'danger',
  1143. // size: 'mini',
  1144. // icon: 'el-icon-edit-outline',
  1145. // name: '撤销采购',
  1146. // disabled: false
  1147. // })
  1148. }
  1149. }
  1150. })
  1151. let operator = this.$refs.avatar.form.createBy
  1152. if (this.$refs.avatar.form.fStatus > 0 && (this.lander === operator || this.lander === 'admin')) {
  1153. this.contentButton.push({
  1154. type: 'danger',
  1155. size: 'mini',
  1156. icon: 'el-icon-edit-outline',
  1157. name: '撤销审批',
  1158. disabled: false
  1159. })
  1160. }
  1161. this.contentButton.forEach(item => {
  1162. if (this.$refs.avatar.form.fBillstatus < 4) {
  1163. if (item.name == '录入明细' || item.name == '保存') {
  1164. item.disabled = true
  1165. } else {
  1166. item.disabled = false
  1167. }
  1168. } else {
  1169. if (item.name == '修改' || item.name == '打印' || item.name == '审批') {
  1170. item.disabled = false
  1171. } else {
  1172. item.disabled = true
  1173. }
  1174. }
  1175. })
  1176. }
  1177. if (i == 1) this.submitAnd()
  1178. })
  1179. },
  1180. returnToForm(row) {
  1181. console.log(row, 111)
  1182. },
  1183. //查看-列表
  1184. viewMethod(scope, res, i) {
  1185. if (res) {
  1186. this.contentButton.forEach(item => {
  1187. item.disabled = false
  1188. this.purchaseList.columnList.forEach(item => item.disabled = false)
  1189. this.contentStyle.forEach(item => item.disabled = false)
  1190. this.contentOption.forEach(item => {
  1191. if (item.label == 'createDeptName' || item.label == 'createBy' || item.label == 'createTime' || item.label == 'totalAmount') {
  1192. item.disabled = true
  1193. } else {
  1194. item.disabled = false
  1195. }
  1196. })
  1197. })
  1198. } else {
  1199. this.contentOption.forEach(item => item.disabled = true)
  1200. this.contentStyle.forEach(item => item.disabled = true)
  1201. }
  1202. viewSingle(scope.row.fId).then(res => {
  1203. if (res.code === 200) {
  1204. let data = {
  1205. tableName: this.purchaseList.tableName,
  1206. userId: Cookies.get('userName')
  1207. }
  1208. let list = {
  1209. tCostManagement: res.data.tCostManagement,
  1210. tCostManagementItem: res.data.tCostManagementItem,
  1211. tEnclosure: res.data.tEnclosure
  1212. }
  1213. // this.$refs.avatar.form = {}
  1214. this.getRow(data, list, '', i)
  1215. }
  1216. })
  1217. },
  1218. submitAnd() {
  1219. this.$refs.avatar.form.fId = ''
  1220. this.$refs.avatar.form.fBillno = ''
  1221. this.$refs.avatar.form.fCreateLog = ''
  1222. this.$refs.avatar.form.fPrintLog = ''
  1223. this.$refs.avatar.form.fReviewDate = ''
  1224. this.$refs.avatar.form.fBillstatus = 2
  1225. this.$refs.avatar.form.fPrint = 0
  1226. this.contentList.forEach(item => item.fId = '')
  1227. this.contentOption.forEach(item => {
  1228. if (item.label == 'createDeptName' || item.label == 'createBy' || item.label == 'createTime' || item.label == 'totalAmount') {
  1229. item.disabled = true
  1230. } else {
  1231. item.disabled = false
  1232. }
  1233. })
  1234. this.purchaseList.columnList.forEach(item => item.disabled = false)
  1235. this.contentButton.forEach(item => item.disabled = false)
  1236. this.contentStyle.forEach(item => item.disabled = false)
  1237. },
  1238. //修改
  1239. modification(scope) {
  1240. console.log(scope)
  1241. },
  1242. //删除
  1243. deletion(scope) {
  1244. console.log(scope.row.fId)
  1245. // tableDeleteQuery(scope.row.fId).then(res => {
  1246. //
  1247. // })
  1248. // this.$confirm(res.msg == 1 ? '主表数据为空' : (res.msg == 2 ? '主表有数据' : '未知状态') + '是否永久删除该条数据?', '提示', {
  1249. this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  1250. confirmButtonText: '确定',
  1251. cancelButtonText: '取消',
  1252. type: 'warning'
  1253. }).then(() => {
  1254. confirmDeletion(scope.row.fId).then(data => {
  1255. this.$message({
  1256. type: 'success',
  1257. message: '删除成功!'
  1258. })
  1259. this.query(this.formDataList)
  1260. })
  1261. }).catch(() => {
  1262. this.$message({
  1263. type: 'info',
  1264. message: '已取消删除'
  1265. })
  1266. })
  1267. },
  1268. //选择框
  1269. selectionbox(selection) {
  1270. if (selection.length > 1) {
  1271. this.customButton.forEach(item => {
  1272. if (item.name === '复制新单') {
  1273. item.disabled = true
  1274. } else {
  1275. item.disabled = false
  1276. }
  1277. })
  1278. } else {
  1279. this.customButton.forEach(item => item.disabled = false)
  1280. this.selection = selection
  1281. }
  1282. },
  1283. //详情内容保存
  1284. submitAndSave(item, res) {
  1285. // if (this.$refs.avatar.form.fBillstatus <= 4 || this.$refs.avatar.form.fBillstatus > 5 || !this.$refs.avatar.form.fBillstatus) {
  1286. let formData = new window.FormData()
  1287. this.$refs.avatar.form.fMoney = 0
  1288. this.contentList.forEach(item => this.$refs.avatar.form.fMoney += Number(item.fAmount))
  1289. formData.append('tCostManagement', JSON.stringify(this.$refs.avatar.form))
  1290. formData.append('tCostManagementItem', JSON.stringify(this.contentList))
  1291. formData.append('tEnclosure', JSON.stringify(this.tEnclosure))
  1292. formData.append('fBilltype', 'FY')
  1293. if (item === 3) {
  1294. this.$refs.avatar.form.fId = ''
  1295. this.$refs.avatar.form.fBillno = ''
  1296. this.$refs.avatar.form.fCreateLog = ''
  1297. this.$refs.avatar.form.fPrintLog = ''
  1298. this.$refs.avatar.form.fBillstatus = 2
  1299. this.$refs.avatar.form.fPrint = 0
  1300. this.contentList.forEach(item => item.fId = '')
  1301. this.tEnclosure = []
  1302. this.contentOption.forEach(item => {
  1303. if (item.label == 'createDeptName' || item.label == 'createBy' || item.label == 'createTime' || item.label == 'totalAmount') {
  1304. item.disabled = true
  1305. } else {
  1306. item.disabled = false
  1307. }
  1308. })
  1309. this.disabled = false
  1310. this.$message.success('操作成功')
  1311. this.purchaseList.columnList.forEach(item => item.disabled = false)
  1312. this.contentButton.forEach(item => item.disabled = false)
  1313. this.contentStyle.forEach(item => item.disabled = false)
  1314. } else {
  1315. submit(formData).then(res => {
  1316. if (res.code == 200) {
  1317. if (res) {
  1318. this.$refs.avatar.form = res.data.tCostManagement
  1319. }
  1320. this.contentList = res.data.tCostManagementItem
  1321. this.tEnclosure = res.data.tEnclosure
  1322. this.$message.success('保存成功')
  1323. viewSingle(this.$refs.avatar.form.fId).then(res => {
  1324. if (res.code === 200) {
  1325. let list = {
  1326. tCostManagement: res.data.tCostManagement,
  1327. tCostManagementItem: res.data.tCostManagementItem,
  1328. tEnclosure: res.data.tEnclosure
  1329. }
  1330. this.$refs.avatar.form = list.tCostManagement
  1331. this.contentList = list.tCostManagementItem
  1332. this.tEnclosure = list.tEnclosure
  1333. }
  1334. })
  1335. }
  1336. })
  1337. }
  1338. // }
  1339. if (item == 1) {
  1340. this.dialogVisible = true
  1341. } else if (item === 2) {
  1342. let data = {
  1343. tableName: this.queryList.tableName,
  1344. userId: Cookies.get('userName')
  1345. }
  1346. this.getRow(data)
  1347. this.query(this.formDataList)
  1348. }
  1349. if (item === 3 && this.$refs.avatar.form.fBillstatus > 3) {
  1350. this.$refs.avatar.form.fId = ''
  1351. this.$refs.avatar.form.fBillno = ''
  1352. this.$refs.avatar.form.fCreateLog = ''
  1353. this.$refs.avatar.form.fReviewDate = ''
  1354. this.$refs.avatar.form.fReviewDate = ''
  1355. this.$refs.avatar.form.fPrintLog = ''
  1356. this.$refs.avatar.form.fBillstatus = 2
  1357. this.$refs.avatar.form.fPrint = 0
  1358. this.contentList.forEach(item => item.fId = '')
  1359. this.contentOption.forEach(item => {
  1360. if (item.label == 'createDeptName' || item.label == 'createBy' || item.label == 'createTime' || item.label == 'totalAmount') {
  1361. item.disabled = true
  1362. } else {
  1363. item.disabled = false
  1364. }
  1365. })
  1366. this.purchaseList.columnList.forEach(item => item.disabled = false)
  1367. this.contentButton.forEach(item => item.disabled = false)
  1368. this.contentStyle.forEach(item => item.disabled = false)
  1369. // let datae = {
  1370. // fId:this.$refs.avatar.form.fId,
  1371. // fBilltype:'FY'
  1372. // }
  1373. // copyNew(datae).then(res=> {
  1374. // this.$message({
  1375. // message: '复制新单成功',
  1376. // type: 'success',
  1377. // showClose: true
  1378. // });
  1379. // let scope = {
  1380. // row: {
  1381. // fId: res.data
  1382. // }
  1383. // }
  1384. // this.query(this.formDataList)
  1385. // this.viewMethod(scope,res)
  1386. // })
  1387. }
  1388. },
  1389. //表单选中后触发
  1390. selectTrigger(name, list, id) {
  1391. console.log(name, list, id)
  1392. if (name == 'fGoodsid') {
  1393. for (let item in list) {
  1394. if (list[item].value == id) {
  1395. this.$refs.avatar.form.personNaem = list[item].personNaem
  1396. this.$refs.avatar.form.corpsName = list[item].corpsName
  1397. }
  1398. }
  1399. }
  1400. if (name === 'expenseType') {
  1401. if (id == 0) {
  1402. let item = this.contentOption.find(item => {
  1403. return item.name == '户头'
  1404. })
  1405. if (!item) {
  1406. this.contentOption = [...this.contentOption, ...this.pushList]
  1407. }
  1408. this.inDex = this.contentOption.length
  1409. } else {
  1410. for (let item in this.contentOption) {
  1411. for (let li in this.pushList) {
  1412. if (this.contentOption[item].label === this.pushList[li].label) {
  1413. this.contentOption.splice(item, 1)
  1414. }
  1415. }
  1416. }
  1417. this.inDex = this.contentOption.length
  1418. }
  1419. }
  1420. },
  1421. //确认打印
  1422. Printing() {
  1423. this.$print(this.$refs.print)
  1424. },
  1425. //返回列表
  1426. backToList() {
  1427. let data
  1428. if (!this.$refs.avatar.form.fId && this.contentList !== 0 || this.$refs.avatar.form.fBillstatus > 3 && !this.$route.query.data) {
  1429. data = {
  1430. tableName: this.queryList.tableName,
  1431. userId: Cookies.get('userName')
  1432. }
  1433. this.getRow(data)
  1434. this.query(this.formDataList)
  1435. } else if (this.$route.query.data) {
  1436. this.cancelTwo()
  1437. // this.$router.push({path:'/index'})
  1438. } else {
  1439. this.$confirm('当前数据是否保存?', '提示', {
  1440. confirmButtonText: '保存',
  1441. cancelButtonText: '取消',
  1442. type: 'warning'
  1443. }).then(() => {
  1444. this.submitAndSave(2, 1)
  1445. }).catch(() => {
  1446. data = {
  1447. tableName: this.queryList.tableName,
  1448. userId: Cookies.get('userName')
  1449. }
  1450. this.getRow(data)
  1451. this.query(this.formDataList)
  1452. })
  1453. }
  1454. },
  1455. //所有按钮
  1456. buttonList(row) {
  1457. console.log(row)
  1458. let data
  1459. switch (row.name) {
  1460. case '新单':
  1461. if (row.nameTwo == '详情页') {
  1462. if (this.$refs.avatar.form.fId) {
  1463. this.contentList = []
  1464. data = {
  1465. tableName: this.purchaseList.tableName,
  1466. userId: Cookies.get('userName')
  1467. }
  1468. this.$refs.avatar.form = {}
  1469. this.getRow(data, '', 1)
  1470. this.contentOption.forEach(item => {
  1471. if (item.label == 'createDeptName' || item.label == 'createBy' || item.label == 'createTime' || item.label == 'totalAmount') {
  1472. item.disabled = true
  1473. } else {
  1474. item.disabled = false
  1475. }
  1476. })
  1477. this.contentButton.forEach(item => item.disabled = false)
  1478. this.contentStyle.forEach(item => item.disabled = false)
  1479. this.tEnclosure = []
  1480. // this.$set(this,'tEnclosure',[])
  1481. this.$refs.avatar.clearVerification()
  1482. this.$refs.avatar.form.createBy = Cookies.get('userName')
  1483. } else {
  1484. this.$message.error('当前数据未保存,请先保存')
  1485. }
  1486. } else {
  1487. this.contentList = []
  1488. data = {
  1489. tableName: this.purchaseList.tableName,
  1490. userId: Cookies.get('userName')
  1491. }
  1492. this.$refs.avatar.form = {}
  1493. this.getRow(data, '', 1)
  1494. //点击列表新单控制主表是否需要禁用项
  1495. this.contentOption.forEach(item => {
  1496. if (item.label == 'createDeptName' || item.label == 'createBy' || item.label == 'createTime' || item.label == 'totalAmount') {
  1497. item.disabled = true
  1498. } else {
  1499. item.disabled = false
  1500. }
  1501. })
  1502. this.contentButton.forEach(item => item.disabled = false)
  1503. this.contentStyle.forEach(item => item.disabled = false)
  1504. this.tEnclosure = []
  1505. this.$refs.avatar.clearVerification()
  1506. this.$refs.avatar.form.createBy = Cookies.get('userName')
  1507. }
  1508. break
  1509. case '保存':
  1510. this.$refs.avatar.submitForm('submit')
  1511. break
  1512. case '打印':
  1513. if (this.$refs.avatar.fStatus >= 3) {
  1514. for (let item in this.contentList) {
  1515. for (let li in this.listData.fFeeid) {
  1516. if (this.contentList[item].fFeeid == this.listData.fFeeid[li].value) {
  1517. this.contentList[item].feeName = this.listData.fFeeid[li].label
  1518. }
  1519. }
  1520. for (let i in this.listData.fFeeunitid) {
  1521. if (this.contentList[item].fFeeunitid == this.listData.fFeeunitid[i].value) {
  1522. this.contentList[item].fFeeunitName = this.listData.fFeeunitid[i].label
  1523. }
  1524. }
  1525. }
  1526. if (!this.$refs.avatar.form.fId) {
  1527. this.$message.error('未保存,不允许打印')
  1528. } else if (this.$refs.avatar.form.fBillstatus >= 4) {
  1529. this.formList = this.$refs.avatar.form
  1530. this.dialogVisible = true
  1531. } else {
  1532. this.formList = this.$refs.avatar.form
  1533. console.log(this.$refs.avatar.form.fBillstatus)
  1534. this.submitAndSave(1)
  1535. }
  1536. } else {
  1537. this.$message.warning('未审核或未通过审核')
  1538. }
  1539. break
  1540. case '修改':
  1541. this.contentButton.forEach(item => {
  1542. // if (this.$refs.avatar.form.fBillstatus == 6) {
  1543. // if (item.name === '返回列表' || item.name == '打印' || item.name === '修改' || item.name === '查看审批' || item.name === '审批' || item.name === '撤销采购' || item.name === '撤销审批' || item.name === '保存') {
  1544. // item.disabled = false
  1545. // } else {
  1546. // item.disabled = true
  1547. // }
  1548. // this.contentStyle.forEach(item => {
  1549. // if (item.label == 'fUnitprice' || item.label == 'fQty' || item.label == 'fAmount' || item.label == 'remark') {
  1550. // item.disabled = false
  1551. // } else {
  1552. // item.disabled = true
  1553. // }
  1554. // })
  1555. // this.purchaseList.columnList.forEach(item => {
  1556. // if (item.label == 'fUnitprice' || item.label == 'fQty' || item.label == 'fAmount' || item.label == 'remark') {
  1557. // item.disabled = false
  1558. // } else {
  1559. // item.disabled = true
  1560. // }
  1561. // })
  1562. // } else if (this.$refs.avatar.form.fBillstatus >= 4) {
  1563. // if (item.name === '返回列表' || item.name == '打印' || item.name === '修改' || item.name === '查看审批' || item.name === '审批' || item.name === '撤销采购' || item.name === '撤销审批' || item.name === '保存') {
  1564. // item.disabled = false
  1565. // } else {
  1566. // item.disabled = true
  1567. // }
  1568. // } else
  1569. if (this.$refs.avatar.form.fStatus > 0) {
  1570. if (item.name === '返回列表' || item.name == '打印' || item.name === '修改' || item.name === '查看审批' || item.name === '审批' || item.name === '撤销采购' || item.name === '撤销审批' || item.name === '保存') {
  1571. item.disabled = false
  1572. } else {
  1573. item.disabled = true
  1574. }
  1575. this.disabled = true
  1576. } else {
  1577. item.disabled = false
  1578. this.purchaseList.columnList.forEach(item => item.disabled = false)
  1579. this.contentStyle.forEach(item => item.disabled = false)
  1580. this.contentOption.forEach(item => {
  1581. if (item.label == 'createDeptName' || item.label == 'createBy' || item.label == 'createTime' || item.label == 'totalAmount') {
  1582. item.disabled = true
  1583. } else {
  1584. item.disabled = false
  1585. }
  1586. })
  1587. this.disabled = false
  1588. }
  1589. })
  1590. break
  1591. case '录入明细':
  1592. this.contentList.push({
  1593. fFeeid: '',
  1594. fPurchase: '',
  1595. fFeeunitid: '',
  1596. fStltypeid: '',
  1597. remark: '',
  1598. createTime: 0,
  1599. fAmount: 0,
  1600. fQty: 0,
  1601. fUnitprice: 0,
  1602. createBy: Cookies.get('userName'),
  1603. fReviewDate: '',
  1604. operation: ''
  1605. })
  1606. break
  1607. case '查看审批':
  1608. this.addOrUpdateHandle()
  1609. break
  1610. case '审批':
  1611. this.addOrUpdateHand()
  1612. break
  1613. case '请核':
  1614. if (this.$refs.avatar.form.fStatus < 1) {
  1615. this.$refs.avatar.submitForm('check')
  1616. } else {
  1617. this.$message.error('请先保存')
  1618. }
  1619. break
  1620. case '复制新单':
  1621. if (row.nameTwo === '详情页') {
  1622. this.$refs.avatar.submitForm('submit', 3)
  1623. } else {
  1624. if (this.selection.length > 0) {
  1625. let scope = {
  1626. row: {
  1627. fId: this.selection[0].fId
  1628. }
  1629. }
  1630. this.query(this.formDataList)
  1631. this.viewMethod(scope, '', 1)
  1632. } else {
  1633. this.$message.warning('未选择列表,请选择后再点击')
  1634. }
  1635. }
  1636. break
  1637. case '撤销审批':
  1638. let date = new Date()
  1639. let y = date.getFullYear()
  1640. let m = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1)
  1641. let d = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate())
  1642. data = {
  1643. actId: 560,
  1644. id: this.$refs.avatar.form.fId,
  1645. billId: this.$refs.avatar.form.fId,
  1646. auditItem: y + '-' + m + '-' + d
  1647. }
  1648. console.log(data)
  1649. revoke(data).then(res => {
  1650. if (res.code === 200) {
  1651. this.$message({
  1652. showClose: true,
  1653. message: '撤销成功',
  1654. type: 'success'
  1655. })
  1656. data = {
  1657. tableName: this.queryList.tableName,
  1658. userId: Cookies.get('userName')
  1659. }
  1660. this.getRow(data)
  1661. this.query(this.formDataList)
  1662. }
  1663. })
  1664. break
  1665. case '撤销采购':
  1666. if (this.$refs.avatar.form.fTakeOrders == 2) {
  1667. this.$confirm('该订单已接单, 是否继续?', '提示', {
  1668. confirmButtonText: '确定',
  1669. cancelButtonText: '取消',
  1670. type: 'warning'
  1671. }).then(() => {
  1672. withdrawBy(this.$refs.avatar.form.fId).then(res => {
  1673. if (res.code === 200) {
  1674. this.$message({
  1675. showClose: true,
  1676. message: '撤销成功',
  1677. type: 'success'
  1678. })
  1679. data = {
  1680. tableName: this.queryList.tableName,
  1681. userId: Cookies.get('userName')
  1682. }
  1683. this.getRow(data)
  1684. this.query(this.formDataList)
  1685. }
  1686. })
  1687. }).catch(() => {
  1688. this.$message({
  1689. type: 'info',
  1690. message: '已取消删除'
  1691. })
  1692. })
  1693. } else {
  1694. withdrawBy(this.$refs.avatar.form.fId).then(res => {
  1695. if (res.code === 200) {
  1696. this.$message({
  1697. showClose: true,
  1698. message: '撤销成功',
  1699. type: 'success'
  1700. })
  1701. data = {
  1702. tableName: this.queryList.tableName,
  1703. userId: Cookies.get('userName')
  1704. }
  1705. this.getRow(data)
  1706. this.query(this.formDataList)
  1707. }
  1708. })
  1709. }
  1710. break
  1711. default:
  1712. this.$message.error('该按钮暂无功能')
  1713. }
  1714. },
  1715. //请核
  1716. writeOff() {
  1717. let formData = new window.FormData()
  1718. formData.append('tCostManagement', JSON.stringify(this.$refs.avatar.form))
  1719. formData.append('tCostManagementItem', JSON.stringify(this.contentList))
  1720. formData.append('tEnclosure', JSON.stringify(this.tEnclosure))
  1721. formData.append('fBilltype', 'FY')
  1722. pleaseCheck(formData).then(res => {
  1723. if (res.code == 200) {
  1724. this.$message.success('请核成功')
  1725. this.contentOption.forEach(item => item.disabled = true)
  1726. this.contentStyle.forEach(item => item.disabled = true)
  1727. this.contentButton.forEach(item => {
  1728. if (item.name == '返回列表' || item.name == '修改' || item.name == '打印') {
  1729. item.disabled = false
  1730. } else {
  1731. item.disabled = true
  1732. }
  1733. })
  1734. // this.$refs.avatar.form = res.data.warehouseBills
  1735. // this.contentList = res.data.tWarehousebillsCntrs
  1736. let data = {
  1737. tableName: this.queryList.tableName,
  1738. userId: Cookies.get('userName')
  1739. }
  1740. this.getRow(data)
  1741. this.query(this.formDataList)
  1742. }
  1743. })
  1744. },
  1745. // 显示搜索条件、点击后会调用此方法
  1746. showSearch() {
  1747. console.log('到我了')
  1748. this.searchWhether = !this.searchWhether
  1749. },
  1750. //搜索、重置、展开
  1751. feedback(res) {
  1752. console.log(res)
  1753. if (res == '展开') {
  1754. if (this.inDex == 4) {
  1755. this.inDex = this.formOption.length
  1756. } else {
  1757. this.inDex = 4
  1758. }
  1759. } else if (res == '搜索') {
  1760. this.$refs.avatar.submitForm()
  1761. } else if (res == '重置') {
  1762. this.formDataList = {
  1763. pageNum: 1,
  1764. pageSize: 10,
  1765. timeInterval: null,
  1766. fBilltype: 'FY'
  1767. }
  1768. this.$refs.avatar.assignmentTime(this.formDataList)
  1769. this.$refs.avatar.submitForm()
  1770. }
  1771. },
  1772. //表单验证通过执行搜索
  1773. submitForm() {
  1774. let list = this.formDataList
  1775. // console.log(this.$refs.avatar.form)
  1776. this.formDataList = this.$refs.avatar.form
  1777. this.formDataList.fBilltype = list.fBilltype
  1778. this.formDataList.pageSize = list.pageSize
  1779. this.formDataList.pageNum = list.pageNum
  1780. // this.formDataList.timeInterval = list.timeInterval
  1781. this.query(this.formDataList)
  1782. },
  1783. //点击刷新会调用此方法
  1784. getList() {
  1785. this.feedback('重置')
  1786. this.submitForm()
  1787. console.log('到我了2')
  1788. },
  1789. //详情表内容移出
  1790. deletRows(index, rows) {
  1791. this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  1792. confirmButtonText: '确定',
  1793. cancelButtonText: '取消',
  1794. type: 'warning'
  1795. }).then(() => {
  1796. if (rows[index].fId) {
  1797. listDelete(rows[index].fId).then(data => {
  1798. rows.splice(index, 1)
  1799. let amount = 0
  1800. for (let item of rows) {
  1801. amount += item.amount ? Number(item.amount) : 0
  1802. }
  1803. this.$set(this.$refs.avatar.form, 'totalAmount', amount.toFixed(2))
  1804. this.$message({
  1805. type: 'success',
  1806. message: '删除成功!'
  1807. })
  1808. })
  1809. } else {
  1810. rows.splice(index, 1)
  1811. let amount = 0
  1812. for (let item of rows) {
  1813. amount += item.amount ? Number(item.amount) : 0
  1814. }
  1815. this.$set(this.$refs.avatar.form, 'totalAmount', amount.toFixed(2))
  1816. this.$message({
  1817. type: 'success',
  1818. message: '删除成功!'
  1819. })
  1820. }
  1821. }).catch(() => {
  1822. this.$message({
  1823. type: 'info',
  1824. message: '已取消删除'
  1825. })
  1826. })
  1827. }
  1828. }
  1829. }
  1830. </script>
  1831. <style scoped>
  1832. .table {
  1833. border-collapse: collapse;
  1834. border-spacing: 0;
  1835. background-color: transparent;
  1836. display: table;
  1837. width: 100%;
  1838. max-width: 100%;
  1839. margin: 0 auto;
  1840. }
  1841. .table td {
  1842. text-align: center;
  1843. vertical-align: middle;
  1844. font-size: 14px;
  1845. color: #000000;
  1846. padding: 8px 12px;
  1847. }
  1848. .column {
  1849. border: 1px solid #000;
  1850. }
  1851. .app-container >>> .el-form-item {
  1852. margin-bottom: 0;
  1853. }
  1854. </style>