index.vue 58 KB

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