index.vue 55 KB

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