index.vue 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="作业单位" prop="workUnit">
  5. <el-input
  6. v-model="queryParams.workUnit"
  7. placeholder="请输入作业单位"
  8. clearable
  9. size="small"
  10. @input="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="作业区域" prop="workArea">
  14. <el-select v-model="queryParams.workArea" placeholder="请选择作业区域" clearable size="small" @change="handleQuery">
  15. <el-option
  16. v-for="dict in workAreaOptions"
  17. :key="dict.id"
  18. :label="dict"
  19. :value="dict"
  20. ></el-option>
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item label="楼层位置" prop="floorLocation">
  24. <el-select v-model="queryParams.floorLocation" placeholder="请选择楼层位置" clearable size="small" @change="handleQuery">
  25. <el-option
  26. v-for="dict in floorLocationOptions"
  27. :key="dict.dictValue"
  28. :label="dict.dictLabel"
  29. :value="parseInt(dict.dictValue)"
  30. ></el-option>
  31. </el-select>
  32. </el-form-item>
  33. <el-form-item label=" 作业开始时间" prop="workStartTime">
  34. <el-date-picker clearable size="small" style="width: 200px"
  35. v-model="queryParams.workStartTime"
  36. type="date"
  37. value-format="yyyy-MM-dd"
  38. placeholder="选择 作业开始时间"
  39. @input="handleQuery">
  40. </el-date-picker>
  41. </el-form-item>
  42. <el-form-item label="作业结束时间" prop="workEndTime">
  43. <el-date-picker clearable size="small" style="width: 200px"
  44. v-model="queryParams.workEndTime"
  45. type="date"
  46. value-format="yyyy-MM-dd"
  47. placeholder="选择作业结束时间"
  48. @input="handleQuery">
  49. </el-date-picker>
  50. </el-form-item>
  51. <el-form-item label="作业创建时间" prop="createdate">
  52. <el-date-picker clearable size="small" style="width: 200px"
  53. v-model="queryParams.createdate"
  54. type="date"
  55. value-format="yyyy-MM-dd"
  56. placeholder="选择作业创建时间"
  57. @input="handleQuery">
  58. </el-date-picker>
  59. </el-form-item>
  60. <el-form-item label="作业类型" prop="workType">
  61. <el-select v-model="queryParams.workType" placeholder="请选择作业类型" clearable size="small" @change="handleQuery">
  62. <el-option
  63. v-for="dict in workTypeOptions"
  64. :key="dict.dictValue"
  65. :label="dict.dictLabel"
  66. :value="parseInt(dict.dictValue)"
  67. />
  68. </el-select>
  69. </el-form-item>
  70. <el-form-item label="联系人" prop="contact">
  71. <el-input
  72. v-model="queryParams.contact"
  73. placeholder="请输入联系人"
  74. clearable
  75. size="small"
  76. @input="handleQuery"
  77. />
  78. </el-form-item>
  79. <el-form-item label="联系方式" prop="phonenumber">
  80. <el-input
  81. v-model="queryParams.phonenumber"
  82. placeholder="请输入联系方式"
  83. clearable
  84. size="small"
  85. @input="handleQuery"
  86. />
  87. </el-form-item>
  88. <el-form-item>
  89. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  90. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  91. </el-form-item>
  92. </el-form>
  93. <el-row :gutter="10" class="mb8">
  94. <el-col :span="1.5">
  95. <el-button
  96. type="primary"
  97. icon="el-icon-plus"
  98. size="mini"
  99. @click="handleAdd"
  100. v-hasPermi="['invoice:bookingworkticket:add']"
  101. >新增</el-button>
  102. </el-col>
  103. <el-col :span="1.5">
  104. <el-button
  105. type="warning"
  106. icon="el-icon-download"
  107. size="mini"
  108. @click="handleExport"
  109. v-hasPermi="['invoice:bookingworkticket:export']"
  110. >导出</el-button>
  111. </el-col>
  112. <el-col :span="1.5">
  113. <el-button
  114. type="success"
  115. icon="el-icon-copy-document"
  116. size="mini"
  117. :disabled="multiple"
  118. @click="tickedStatis"
  119. v-hasPermi="['ehs:jobticket:add']"
  120. >作业票统计</el-button>
  121. </el-col>
  122. <right-toolbar :showSearch.sync="showSearch" @queryTable="cancelQuery"></right-toolbar>
  123. </el-row>
  124. <el-table v-loading="loading" :data="bookingworkticketList" ref="multipleTable" class="table-fixed" :span-method="mergeMethod" @selection-change="handleSelectionChange" :height="clientHeight" border :row-key="getRowKey" >
  125. <el-table-column type="selection" width="55" align="center" :reserve-selection="true"/>
  126. <el-table-column label="作业单位" align="center" prop="bookingworkticket.workUnit" width="80" :show-overflow-tooltip="true"/>
  127. <el-table-column label="作业区域单元" align="center" prop="bookingworkticket.workArea" width="100" :show-overflow-tooltip="true"/>
  128. <el-table-column label="楼层位置" align="center" prop="bookingworkticket.floorLocation" width="100" :formatter="floorLocationFormat"/>
  129. <el-table-column label=" 作业开始时间" align="center" prop="workStartTime" width="90">
  130. <template slot-scope="scope">
  131. <span>{{ parseTime(scope.row.bookingworkticket.workStartTime, '{y}-{m}-{d}') }}</span>
  132. </template>
  133. </el-table-column>
  134. <el-table-column label="作业结束时间" align="center" prop="workEndTime" width="90">
  135. <template slot-scope="scope">
  136. <span>{{ parseTime(scope.row.bookingworkticket.workEndTime, '{y}-{m}-{d}') }}</span>
  137. </template>
  138. </el-table-column>
  139. <el-table-column label="作业类型" align="center" prop="workType" width="110" :formatter="workTypeFormat"/>
  140. <el-table-column label="风险等级" align="center" prop="riskLevel" width="60" :formatter="riskLevelFormat"/>
  141. <el-table-column label="作业内容描述" align="center" prop="workDescription" width="160":show-overflow-tooltip="true"/>
  142. <el-table-column label="作业人员数" align="center" prop="workPeopleNumber" width="70" :show-overflow-tooltip="true"/>
  143. <el-table-column label="预计作业时间" align="center" prop="estimateWorktime" width="70" :show-overflow-tooltip="true"/>
  144. <el-table-column label="联系人" align="center" prop="bookingworkticket.contact" width="80" :show-overflow-tooltip="true"/>
  145. <el-table-column label="联系方式" align="center" prop="bookingworkticket.phonenumber" width="100" :show-overflow-tooltip="true"/>
  146. <el-table-column label="创建时间" align="center" prop="createdate" width="90">
  147. <template slot-scope="scope">
  148. <span>{{ parseTime(scope.row.createdate, '{y}-{m}-{d}') }}</span>
  149. </template>
  150. </el-table-column>
  151. <el-table-column label="状态" align="center" prop="bookingworkticket.status" :formatter="statusFormat" />
  152. <el-table-column label="票号" align="center" prop="reservationNumber" >
  153. <template slot-scope="scope">
  154. <span> {{scope.row.reservationNumber}}</span>
  155. <el-button
  156. v-if="scope.row.bookingworkticket.status== 3"
  157. size="mini"
  158. type="text"
  159. icon="el-icon-edit"
  160. @click="association(scope.row)"
  161. v-hasPermi="['invoice:bookingworkticket:edit','invoice:bookingworkticket:query']"
  162. ></el-button>
  163. </template>
  164. </el-table-column>
  165. <el-table-column label="危害工作许可证号" align="center" prop="whgzxkzh" :show-overflow-tooltip="true"/>
  166. <el-table-column label="动火作业许可证号" align="center" prop="dhzyxkzh" :show-overflow-tooltip="true"/>
  167. <el-table-column label="火票级别" align="center" prop="hpjb" :formatter="hpjbFormat"/>
  168. <el-table-column label="限制空间许可证号" align="center" prop="xzkjxkzh" :show-overflow-tooltip="true"/>
  169. <el-table-column label="盲板作业许可证号" align="center" prop="mbzyxkzh" :show-overflow-tooltip="true"/>
  170. <el-table-column label="高处作业许可证号" align="center" prop="gczyxkzh" :show-overflow-tooltip="true"/>
  171. <el-table-column label="高处作业级别" align="center" prop="gczyjb" :formatter="gczyjbFormat"/>
  172. <el-table-column label="操作" align="center" fixed="right" width="180" class-name="small-padding fixed-width">
  173. <template slot-scope="scope">
  174. <el-button
  175. v-if="scope.row.bookingworkticket.status== 0"
  176. size="mini"
  177. type="text"
  178. icon="el-icon-edit"
  179. @click="handleUpdate(scope.row)"
  180. v-hasPermi="['invoice:bookingworkticket:edit']"
  181. >修改</el-button>
  182. <el-button
  183. v-if="scope.row.bookingworkticket.status== 0"
  184. size="mini"
  185. type="text"
  186. icon="el-icon-delete"
  187. @click="handleDelete(scope.row)"
  188. >删除</el-button>
  189. <el-button
  190. v-if="scope.row.bookingworkticket.status== 3"
  191. size="mini"
  192. type="text"
  193. icon="el-icon-view"
  194. @click="billSee(scope.row)"
  195. > {{ $t('票据预览') }}</el-button>
  196. <el-button
  197. v-if="scope.row.bookingworkticket.status== 3"
  198. size="mini"
  199. type="text"
  200. icon="el-icon-download"
  201. @click="handleDownload(scope.row)"
  202. >{{$t('下载申请单')}}</el-button>
  203. </template>
  204. </el-table-column>
  205. </el-table>
  206. <pagination
  207. v-show="total>0"
  208. :total="total"
  209. :page.sync="queryParams.pageNum"
  210. :limit.sync="queryParams.pageSize"
  211. @pagination="getList"
  212. />
  213. <!-- 添加或修改预约作业票台账对话框 -->
  214. <el-dialog :title="title" :visible.sync="open" width="1200px" append-to-bod :before-close="cancel">
  215. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  216. <el-row>
  217. <el-col :span="8">
  218. <el-form-item label="承包商" prop="workUnit">
  219. <el-input v-model="form.workUnit" placeholder="请输入作业单位" :disabled="edit"/>
  220. </el-form-item>
  221. </el-col>
  222. <el-col :span="8">
  223. <el-form-item label="作业区域" prop="workArea">
  224. <el-select v-model="form.workArea" placeholder="请选择作业区域">
  225. <el-option
  226. v-for="dict in workAreaOptions"
  227. :key="dict.id"
  228. :label="dict"
  229. :value="dict"
  230. ></el-option>
  231. </el-select>
  232. </el-form-item>
  233. </el-col>
  234. <el-col :span="8">
  235. <el-form-item label="归属部门" prop="deptId">
  236. <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
  237. </el-form-item>
  238. </el-col>
  239. </el-row>
  240. <el-row>
  241. <el-col :span="12">
  242. </el-col>
  243. <el-col :span="12">
  244. <el-form-item label="楼层位置" prop="floorLocation">
  245. <el-select v-model="form.floorLocation" multiple placeholder="请选择楼层位置">
  246. <el-option
  247. v-for="dict in floorLocationOptions"
  248. :key="dict.dictValue"
  249. :label="dict.dictLabel"
  250. :value="parseInt(dict.dictValue)"
  251. ></el-option>
  252. </el-select>
  253. </el-form-item>
  254. </el-col>
  255. </el-row>
  256. <el-row>
  257. <el-col :span="12">
  258. <el-form-item label=" 作业开始" prop="workStartTime">
  259. <el-date-picker clearable size="small" style="width: 190px"
  260. v-model="form.workStartTime"
  261. type="date"
  262. value-format="yyyy-MM-dd"
  263. placeholder="选择 作业开始时间">
  264. </el-date-picker>
  265. </el-form-item>
  266. </el-col>
  267. <el-col :span="12">
  268. <el-form-item label="作业结束" prop="workEndTime">
  269. <el-date-picker clearable size="small" style="width: 190px"
  270. v-model="form.workEndTime"
  271. type="date"
  272. value-format="yyyy-MM-dd"
  273. placeholder="选择作业结束时间">
  274. </el-date-picker>
  275. </el-form-item>
  276. </el-col>
  277. </el-row>
  278. <el-row>
  279. <el-col :span="12">
  280. <el-form-item label="用户单位" prop="userUnit">
  281. <el-select v-model="form.userUnit" placeholder="请选择用户单位" @change="checkCategoryPromotionUpdate(form.userUnit)">
  282. <el-option
  283. v-for="dict in userUnitOptions"
  284. :key="dict.dictValue"
  285. :label="dict.dictLabel"
  286. :value="parseInt(dict.dictValue)"
  287. ></el-option>
  288. </el-select>
  289. </el-form-item>
  290. </el-col>
  291. <el-col :span="12">
  292. <el-form-item label="用户主管" prop="userMg">
  293. <el-select v-model="form.userMg" placeholder="请先选择好用户单位">
  294. <el-option
  295. v-for="dict in userMgOptions"
  296. :key="dict.userId"
  297. :label="dict.nickName"
  298. :value="dict.userId"
  299. ></el-option>
  300. </el-select>
  301. </el-form-item>
  302. </el-col>
  303. </el-row>
  304. </el-form>
  305. <el-card v-for="(ruleForm, index) in ruleForm" :key="index" shadow="always">
  306. <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
  307. <el-row>
  308. <el-col :span="18">
  309. <el-form-item label="作业内容描述" prop="workDescription" >
  310. <el-input type="text" v-model="ruleForm.workDescription" ></el-input>
  311. </el-form-item>
  312. </el-col>
  313. <el-col :span="3">
  314. <el-button type="success" plain @click.prevent="addDomain(ruleForm)" style="float: right;">拷贝</el-button>
  315. </el-col>
  316. <el-col :span="3">
  317. <el-button type="info" plain @click.prevent="removeDomain(ruleForm)" style="float: right;" >删除</el-button>
  318. </el-col>
  319. </el-row>
  320. <el-row>
  321. <el-col :span="6">
  322. <el-form-item label="作业类型" prop="workType">
  323. <el-select v-model="ruleForm.workType" placeholder="请选择作业类型" multiple clearable size="small">
  324. <el-option
  325. v-for="dict in workTypeOptions"
  326. :key="dict.dictValue"
  327. :label="dict.dictLabel"
  328. :value="parseInt(dict.dictValue)"
  329. />
  330. </el-select>
  331. </el-form-item>
  332. </el-col>
  333. <el-col :span="6">
  334. <el-form-item label="风险等级" prop="riskLevel">
  335. <el-select v-model="ruleForm.riskLevel" placeholder="请选择风险等级" clearable size="small">
  336. <el-option
  337. v-for="dict in riskLevelOptions"
  338. :key="dict.dictValue"
  339. :label="dict.dictLabel"
  340. :value="parseInt(dict.dictValue)"
  341. />
  342. </el-select>
  343. </el-form-item>
  344. </el-col>
  345. <el-col :span="6">
  346. <el-form-item label="作业人数" prop="workPeopleNumber">
  347. <el-input v-model="ruleForm.workPeopleNumber"></el-input>
  348. </el-form-item>
  349. </el-col>
  350. <el-col :span="6">
  351. <el-form-item label="预计作业时间" prop="estimateWorktime">
  352. <el-input v-model="ruleForm.estimateWorktime" ></el-input>
  353. </el-form-item>
  354. </el-col>
  355. </el-row>
  356. </el-form>
  357. </el-card>
  358. <el-button @click="resetForm1()">重置</el-button>
  359. <el-button @click="add">新增一条</el-button>
  360. <el-button @click="reduce" :disabled="flag">移除一条</el-button>
  361. <div slot="footer" class="dialog-footer">
  362. <el-button type="primary" @click="submitForm">确 定</el-button>
  363. <el-button @click="cancel">取 消</el-button>
  364. </div>
  365. </el-dialog>
  366. <!-- 报告附件对话框 -->
  367. <el-dialog v-loading="loadingFlash" element-loading-background="rgba(0,0,0,0.2)" v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px" height="800px" :center="true" append-to-body >
  368. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  369. <el-button size="mini" type="text" @click="openPdf">{{$t('新页面预览')}}</el-button>
  370. </div>
  371. <div style="margin-top: -30px" >
  372. <iframe id="iFrame" class="iframe-html" :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px" v-if="ppt"></iframe>
  373. </div>
  374. </el-dialog>
  375. <el-dialog title="关联票号" :visible.sync="guanlianVisible" width="30%" center>
  376. <el-form :model="licenseForm" :rules="rules" ref="licenseForm" label-width="100px" class="demo-ruleForm">
  377. <el-form-item label="危害工作许可证号" prop="whgzxkzh">
  378. <el-input v-model="licenseForm.whgzxkzh" placeholder="请输入危害工作许可证号" />
  379. </el-form-item>
  380. <el-form-item label="动火作业许可证号" prop="dhzyxkzh">
  381. <el-input v-model="licenseForm.dhzyxkzh" placeholder="请输入动火作业许可证号" />
  382. </el-form-item>
  383. <el-form-item label="火票级别" prop="hpjb">
  384. <el-select v-model="licenseForm.hpjb" clearable placeholder="请选择火票级别">
  385. <el-option
  386. v-for="dict in hpjbOptions"
  387. :key="dict.dictValue"
  388. :label="dict.dictLabel"
  389. :value="dict.dictValue"
  390. ></el-option>
  391. </el-select>
  392. </el-form-item>
  393. <el-form-item label="限制空间许可证号" prop="xzkjxkzh">
  394. <el-input v-model="licenseForm.xzkjxkzh" placeholder="请输入限制空间许可证号" />
  395. </el-form-item>
  396. <el-form-item label="盲板作业许可证号" prop="mbzyxkzh">
  397. <el-input v-model="licenseForm.mbzyxkzh" placeholder="请输入盲板作业许可证号" />
  398. </el-form-item>
  399. <el-form-item label="高处作业许可证号" prop="gczyxkzh">
  400. <el-input v-model="licenseForm.gczyxkzh" placeholder="请输入高处作业许可证号" />
  401. </el-form-item>
  402. <el-form-item label="高处作业级别" prop="gczyjb">
  403. <el-select v-model="licenseForm.gczyjb" clearable placeholder="请选择高处作业级别">
  404. <el-option
  405. v-for="dict in gczyjbOptions"
  406. :key="dict.dictValue"
  407. :label="dict.dictLabel"
  408. :value="dict.dictValue"
  409. ></el-option>
  410. </el-select>
  411. </el-form-item>
  412. </el-form>
  413. <div slot="footer" class="dialog-footer">
  414. <el-button @click="guanlianVisible=false">取 消</el-button>
  415. <el-button type="primary" v-hasPermi="['invoice:bookingworkticket:edit']" @click="submitassociation">确 定</el-button>
  416. </div>
  417. </el-dialog>
  418. <add-approve v-if="addAprroveVisible" ref="addApprove" @refreshDataList="getList"></add-approve>
  419. </div>
  420. </template>
  421. <script>
  422. import { listBookingworkticket, getBookingworkticket, delBookingworkticket, addBookingworkticket, updateBookingworkticket, exportBookingworkticket, importTemplate, seeBookingworkticket,assion} from "@/api/invoice/bookingworkticket";
  423. import { listWorkcontent, getWorkcontent, delWorkcontent, addWorkcontent, updateWorkcontent, exportWorkcontent,getWorkcontentBybookingticketId} from "@/api/invoice/workcontent";
  424. import { listDevice, getDevice, delDevice, updateDevice, exportDevice, selectDevice} from "@/api/invoice/device";
  425. import { listUnit, getUnit, delUnit, addUnit, updateUnit, exportUnit,getUserByUnit} from "@/api/invoice/unit";
  426. import { listUser, getUser, delUser, addUser, updateUser, exportUser, resetUserPwd, changeUserStatus,userDataScope,getUserByUserName } from "@/api/system/user";
  427. import { listJobticket, getJobticket, delJobticket, addJobticket, updateJobticket, exportJobticket,batchAddJobticket } from "@/api/ehs/jobticket";
  428. import { treeselect } from "@/api/system/dept";
  429. import { getToken } from "@/utils/auth";
  430. import Treeselect from "@riophae/vue-treeselect";
  431. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  432. import AddApprove from "../approveinvoice/index"
  433. import {addInvoice} from "@/api/invoice/invoice";
  434. export default {
  435. name: "Bookingworkticket",
  436. components: { Treeselect,AddApprove},
  437. data() {
  438. var validatePass2 = (rule, value, callback) => {
  439. if (value === ''|| value===null) {
  440. callback(new Error('请至少输入一项'));
  441. } else {
  442. callback();
  443. }
  444. };
  445. return {
  446. //关联票号
  447. associationParams:{},
  448. reservationNumber:"",
  449. guanlianVisible:false,
  450. //禁用
  451. edit:true,
  452. ppt:false,
  453. pptView:false,
  454. imgs:[],
  455. tInvoiceWorkcontentList:[],
  456. addAprroveVisible: false,
  457. hisAprroveVisible: false,
  458. // 遮罩层
  459. loading: true,
  460. loadingFlash: false,
  461. // 选中数组
  462. ids: [],
  463. // 非单个禁用
  464. single: true,
  465. // 非多个禁用
  466. multiple: true,
  467. // 显示搜索条件
  468. showSearch: false,
  469. // 总条数
  470. total: 0,
  471. // 预约作业票台账表格数据
  472. bookingworkticketList: [],
  473. // 弹出层标题
  474. title: "",
  475. // 部门树选项
  476. deptOptions: undefined,
  477. clientHeight:300,
  478. // 状态字典
  479. statusOptions: [],
  480. // 作业区域字典
  481. workAreaOptions: [],
  482. // 楼层字典
  483. floorLocationOptions: [],
  484. // 用户单位字典
  485. userUnitOptions: [],
  486. // 用户主管字典
  487. userMgOptions: [],
  488. // 作业类型字典
  489. workTypeOptions: [],
  490. // 风险等级字典
  491. riskLevelOptions: [],
  492. // 火票级别字典
  493. hpjbOptions: [],
  494. // 高处作业级别字典
  495. gczyjbOptions: [],
  496. // 是否显示弹出层
  497. open: false,
  498. // 用户导入参数
  499. upload: {
  500. // 是否显示弹出层(用户导入)
  501. open: false,
  502. // 弹出层标题(用户导入)
  503. title: "",
  504. // 是否禁用上传
  505. isUploading: false,
  506. // 是否更新已经存在的用户数据
  507. updateSupport: 0,
  508. // 设置上传的请求头部
  509. headers: { Authorization: "Bearer " + getToken() },
  510. // 上传的地址
  511. url: process.env.VUE_APP_BASE_API + "/invoice/bookingworkticket/importData"
  512. },
  513. pdf : {
  514. title: '',
  515. pdfUrl: '',
  516. numPages: null,
  517. open: false,
  518. pageNum: 1,
  519. pageTotalNum: 1,
  520. loadedRatio: 0,
  521. },
  522. // 查询参数
  523. queryParams: {
  524. pageNum: 1,
  525. pageSize: 20,
  526. workUnit: null,
  527. workArea: null,
  528. unitNumber: null,
  529. floorLocation: null,
  530. workStartTime: null,
  531. workEndTime: null,
  532. createrCode: null,
  533. createdate: null,
  534. updaterCode: null,
  535. updatedate: null,
  536. contact: null,
  537. phonenumber: null,
  538. status: null,
  539. deptId: null,
  540. userMg: null,
  541. userUnit: null
  542. },
  543. //申请的参数
  544. approveForm:{},
  545. // 表单参数
  546. form: { },
  547. //预约票参数
  548. ruleForm: [{} ],
  549. //许可证表单参数
  550. licenseForm:{},
  551. flag: true,
  552. // 表单校验
  553. rules: {
  554. workArea: [
  555. { required: true, message: "作业区域不能为空", trigger: "blur" }
  556. ],
  557. floorLocation: [
  558. { required: true, message: "楼层位置不能为空", trigger: "blur" }
  559. ],
  560. workStartTime: [
  561. { required: true, message: "作业开始时间不能为空", trigger: "blur" }
  562. ],
  563. workEndTime: [
  564. { required: true, message: "作业结束时间不能为空", trigger: "blur" }
  565. ],
  566. userMg: [
  567. { required: true, message: "用户主管不能为空", trigger: "blur" }
  568. ],
  569. userUnit: [
  570. { required: true, message: "用户单位不能为空", trigger: "blur" }
  571. ],
  572. workType: [
  573. { required: true, message: "作业类型不能为空", trigger: "blur" }
  574. ],
  575. workDescription: [
  576. { required: true, message: "作业内容不能为空", trigger: "change" }
  577. ],
  578. riskLevel: [
  579. { required: true, message: "风险等级不能为空", trigger: "change" }
  580. ],
  581. workPeopleNumber: [
  582. { required: true, message: "作业人数不能为空", trigger: "change" }
  583. ],
  584. estimateWorktime: [
  585. { required: true, message: "预计作业时间不能为空", trigger: "change" }
  586. ],
  587. gczyxkzh: [
  588. { validator: validatePass2, trigger: 'blur' }
  589. ],
  590. }
  591. };
  592. },
  593. watch: {
  594. // 根据名称筛选部门树
  595. deptName(val) {
  596. this.$refs.tree.filter(val);
  597. },
  598. },
  599. created() {
  600. //设置表格高度对应屏幕高度
  601. this.$nextTick(() => {
  602. this.clientHeight = document.body.clientHeight -250
  603. })
  604. this.getNowFormatDate()
  605. this.getList();
  606. this.getTreeselect();
  607. //初始化作业区域、 初始化用户单位下拉框
  608. this.getDeviceup();
  609. this.getDicts("booking_work_status").then(response => {
  610. this.statusOptions = response.data;
  611. });
  612. this.getDicts("book_floor_location").then(response => {
  613. this.floorLocationOptions = response.data;
  614. });
  615. this.getDicts("book_user_unit").then(response => {
  616. this.userUnitOptions = response.data;
  617. });
  618. this.getDicts("book_work_type").then(response => {
  619. this.workTypeOptions = response.data;
  620. });
  621. this.getDicts("book_risk_level").then(response => {
  622. this.riskLevelOptions = response.data;
  623. });
  624. this.getDicts("HPJB").then(response => {
  625. this.hpjbOptions = response.data;
  626. });
  627. this.getDicts("GCZYJB").then(response => {
  628. this.gczyjbOptions = response.data;
  629. });
  630. },
  631. methods: {
  632. //得到行key
  633. getRowKey(row) {
  634. return row.guid;
  635. },
  636. //作业票统计
  637. tickedStatis(){
  638. let putData=this.$refs.multipleTable.selection
  639. batchAddJobticket(putData).then(response => {
  640. this.msgSuccess(this.$t('带入数据到工作票统计页面成功'));
  641. });
  642. },
  643. //根据用户单位 查询对应选择的用户主管 根据用户单位 字段 查找对应的多个主管 返回 Sysuser的集合(id,name)
  644. checkCategoryPromotion(oneId){
  645. getUserByUnit(oneId).then(response => {
  646. // this.form.userMg=null;
  647. this.userMgOptions = response.data;
  648. // let arr= response.data.userIds.split(',');
  649. });
  650. },
  651. //修改用户单位时,级联的用户主管下拉数据应清空,否则会造成用户修改了用户单位,但未重新选择相应的用户主管
  652. checkCategoryPromotionUpdate(oneId){
  653. this.form.userMg=null;
  654. getUserByUnit(oneId).then(response => {
  655. // this.form.userMg=null;
  656. this.userMgOptions = response.data;
  657. // let arr= response.data.userIds.split(',');
  658. });
  659. },
  660. //得到区域下拉框
  661. getDeviceup(){
  662. const queryForm= {
  663. pageNum: 1,
  664. pageSize: 20,
  665. devName: null,
  666. workArea: null,
  667. regionalHead: null,
  668. createrCode: null,
  669. createdate: null,
  670. updaterCode: null,
  671. updatedate: null,
  672. deptId: null,
  673. remarks: null
  674. };
  675. selectDevice(queryForm).then(response => {
  676. this.workAreaOptions=response.data
  677. });
  678. // console.log(this.workAreaOptions)
  679. },
  680. addAprrove(row) {
  681. this.reset();
  682. var rows = row ? [row] : this.bookingworkticketList.map(item => {
  683. return item
  684. })
  685. for (let i = 0; i < rows.length; i++) {
  686. if(rows[i].status ===3){
  687. this.$alert(this.$t('预约已确认,无法重复申请'), this.$t('提示'), {
  688. type: 'warning'
  689. })
  690. return
  691. }else if (rows[i].status != 0&&rows[i].status != 5) {
  692. this.$alert(this.$t('预约正在申请中,无法重复申请'), this.$t('提示'), {
  693. type: 'warning'
  694. })
  695. return
  696. }
  697. }
  698. this.$nextTick(() => {
  699. this.approveForm.invoiceId=row.bookingticketId;
  700. this.approveForm.userSupId=row.bookingworkticket.userMg;
  701. addInvoice(this.approveForm).then(response => {
  702. this.msgSuccess(this.$t('预约成功'));
  703. // this.visible = false;
  704. // this.getList();
  705. })
  706. })
  707. this.addAprroveVisible = true
  708. },
  709. //拷贝
  710. addDomain(domain) {
  711. let arr={}
  712. arr.workType=domain.workType;
  713. arr.workDescription=domain.workDescription;
  714. arr.riskLevel=domain.riskLevel;
  715. arr.workPeopleNumber=domain.workPeopleNumber;
  716. arr.estimateWorktime=domain.estimateWorktime;
  717. this.ruleForm.push(
  718. arr
  719. );
  720. this.flags()
  721. },
  722. //删除自身
  723. removeDomain(item) {
  724. //如果子类大于1 可点击删除按钮
  725. if(this.ruleForm.length>1){
  726. var index = this.ruleForm.indexOf(item)
  727. if (index !== -1) {
  728. this.ruleForm.splice(index, 1)
  729. }
  730. }
  731. this.flags()
  732. },
  733. // 表单添加一行
  734. add() {
  735. var arr = { }
  736. this.ruleForm.push(arr)
  737. this.flags()
  738. },
  739. // 表单减少一行
  740. reduce() {
  741. this.ruleForm.length = this.ruleForm.length - 1
  742. this.flags()
  743. },
  744. // 判断数组长度
  745. flags() {
  746. //如果小于1则自动补一栏 如果大于5则提示
  747. if (this.ruleForm.length <2){
  748. this.flag = true
  749. }else if(this.ruleForm.length<1){
  750. this.ruleForm.push({});
  751. }else if(this.ruleForm.length>5){
  752. this.ruleForm.length = this.ruleForm.length-1;
  753. this.msgSuccess("最多只能添加5条相关作业内容,若需要请重新预约");
  754. } else {
  755. //先赋值为true再赋为false, 不然会没反应
  756. this.flag=true
  757. this.flag = false
  758. }
  759. },
  760. //时间
  761. getNowFormatDate() {
  762. var date = new Date();
  763. var seperator1 = "-";
  764. var year = date.getFullYear();
  765. var month = date.getMonth() + 1;
  766. var strDate = date.getDate();
  767. if (month >= 1 && month <= 9) {
  768. month = "0" + month;
  769. }
  770. if (strDate >= 0 && strDate <= 9) {
  771. strDate = "0" + strDate;
  772. }
  773. var currentdate = year + seperator1 + month + seperator1 + strDate;
  774. this.queryParams.createdate=currentdate
  775. return currentdate;
  776. },
  777. // 重置方法
  778. resetForm1() {
  779. this.ruleForm = [{}]
  780. },
  781. /** 查询预约作业票台账列表 */
  782. getList() {
  783. this.loading = true;
  784. //得到用户名-承包商名称
  785. listBookingworkticket(this.queryParams).then(response => {
  786. this.bookingworkticketList=response.rows;
  787. this.total = response.total;
  788. this.loading = false;
  789. });
  790. },
  791. /** 查询部门下拉树结构 */
  792. getTreeselect() {
  793. treeselect().then(response => {
  794. this.deptOptions = response.data;
  795. });
  796. },
  797. // 预约票状态字典翻译
  798. statusFormat(row, column) {
  799. return this.selectDictLabel(this.statusOptions, row.bookingworkticket.status);
  800. },
  801. // 工作区域字典翻译
  802. workAreaFormat(row, column) {
  803. return this.selectDictLabel(this.workAreaOptions, row.bookingworkticket.workArea);
  804. },
  805. // 楼层位置字典翻译
  806. floorLocationFormat(row, column) {
  807. return this.selectDictLabels(this.floorLocationOptions, row.bookingworkticket.floorLocation);
  808. },
  809. // 用户主管字典翻译
  810. userMgFormat(row, column) {
  811. return this.selectDictLabel(this.userMgOptions, row.userMg);
  812. },
  813. // 用户单位字典翻译
  814. userUnitFormat(row, column) {
  815. return this.selectDictLabel(this.userUnitOptions, row.userUnit);
  816. },
  817. // 作业类型字典翻译
  818. workTypeFormat(row, column) {
  819. return this.selectDictLabels(this.workTypeOptions, row.workType);
  820. },
  821. // 风险等级字典翻译
  822. riskLevelFormat(row, column) {
  823. return this.selectDictLabel(this.riskLevelOptions, row.riskLevel);
  824. },
  825. // 火票级别字典翻译
  826. hpjbFormat(row, column) {
  827. return this.selectDictLabel(this.hpjbOptions, row.hpjb);
  828. },
  829. // 高处作业级别字典翻译
  830. gczyjbFormat(row, column) {
  831. return this.selectDictLabel(this.gczyjbOptions, row.gczyjb);
  832. },
  833. // 取消按钮
  834. cancel() {
  835. this.open = false;
  836. this.reset();
  837. this.$nextTick(()=>{
  838. this.$refs.ruleForm[0].resetFields();
  839. if(this.$refs.ruleForm[1]!=null){
  840. this.$refs.ruleForm[1].resetFields();
  841. }
  842. if(this.$refs.ruleForm[2]!=null){
  843. this.$refs.ruleForm[2].resetFields();
  844. }
  845. if(this.$refs.ruleForm[3]!=null){
  846. this.$refs.ruleForm[3].resetFields();
  847. }
  848. if(this.$refs.ruleForm[4]!=null){
  849. this.$refs.ruleForm[4].resetFields();
  850. }
  851. })
  852. },
  853. // 表单重置
  854. reset() {
  855. this.form = {
  856. id: null,
  857. workUnit: null,
  858. workArea: null,
  859. unitNumber: null,
  860. floorLocation: null,
  861. workStartTime: null,
  862. workEndTime: null,
  863. delFlag: null,
  864. createrCode: null,
  865. createdate: null,
  866. updaterCode: null,
  867. updatedate: null,
  868. contact: null,
  869. phonenumber: null,
  870. status: 0,
  871. deptId: null,
  872. userMg: null,
  873. userUnit:null
  874. };
  875. this.resetForm("form");
  876. },
  877. /** 搜索按钮操作 */
  878. handleQuery() {
  879. this.queryParams.pageNum = 1;
  880. this.getList();
  881. },
  882. /** 重置按钮操作 */
  883. resetQuery() {
  884. this.resetForm("queryForm");
  885. this.queryParams.createdate=null
  886. this.handleQuery();
  887. },
  888. //取消搜索
  889. cancelQuery() {
  890. this.resetForm("queryForm");
  891. this.getNowFormatDate()
  892. this.getList()
  893. },
  894. // 多选框选中数据
  895. handleSelectionChange(selection) {
  896. this.ids = selection.map(item => item.bookingticketId)
  897. this.single = selection.length!==1
  898. this.multiple = !selection.length
  899. // console.log(selection)
  900. },
  901. /** 新增按钮操作 */
  902. handleAdd() {
  903. this.reset();
  904. this.resetForm1();
  905. var names =this.$store.state.user.name
  906. //查询用户归属的部门名称
  907. getUserByUserName(names).then(response => {
  908. this.form.workUnit=response.data.dept.deptName;
  909. //默认是用户自己的部门
  910. this.form.deptId=response.data.dept.deptId;
  911. });
  912. this.open = true;
  913. this.title = "添加预约作业票台账";
  914. },
  915. /** 修改按钮操作 */
  916. handleUpdate(row) {
  917. this.reset();
  918. const id = row.bookingticketId || this.ids
  919. getBookingworkticket(id).then(response => {
  920. this.form = response.data;
  921. this.open = true;
  922. this.title = "修改预约作业票台账";
  923. this.ruleForm=response.data.tInvoiceWorkcontentList
  924. // 回显用户主管
  925. this.checkCategoryPromotion(this.form.userUnit);
  926. // console.log(row.floorLocation) 将后台的字符串数组重新转换为el-select要的数组格式
  927. let arr=row.bookingworkticket.floorLocation.split(",")
  928. let st=[]
  929. // 将字符串数组的每一项转换成Number,生成一个新的数组
  930. for (var arrInt in arr) {
  931. st.push(parseInt(arr[arrInt]))
  932. }
  933. this.form.floorLocation=st
  934. //作业类型也要多选 同楼层
  935. for(let j=0;j<this.ruleForm.length;j++){
  936. let arr1=this.ruleForm[j].workType.split(",")
  937. let st1=[]
  938. // 将字符串数组的每一项转换成Number,生成一个新的数组
  939. for (var arrInt in arr1) {
  940. st1.push(parseInt(arr1[arrInt]))
  941. }
  942. this.ruleForm[j].workType=st1
  943. }
  944. this.ruleForm.length=response.data.tInvoiceWorkcontentList.length
  945. });
  946. },
  947. //校验
  948. getFormPromise(formDone) {
  949. return new Promise(resolve => {
  950. formDone.validate(res => {
  951. resolve(res);
  952. });
  953. });
  954. },
  955. /** 提交按钮 */
  956. submitForm() {
  957. let arr=[]
  958. const basicForm = this.$refs.form;
  959. arr.push(basicForm)
  960. const genForm = this.$refs.ruleForm[0];
  961. arr.push(genForm)
  962. if(this.$refs.ruleForm[1]!=null){
  963. const genForm1 = this.$refs.ruleForm[1];
  964. arr.push(genForm1)
  965. }
  966. if(this.$refs.ruleForm[2]!=null){
  967. const genForm2 = this.$refs.ruleForm[2];
  968. arr.push(genForm2)
  969. }
  970. if(this.$refs.ruleForm[3]!=null){
  971. const genForm3 = this.$refs.ruleForm[3];
  972. arr.push(genForm3)
  973. }
  974. if(this.$refs.ruleForm[4]!=null){
  975. const genForm4= this.$refs.ruleForm[4];
  976. arr.push(genForm4)
  977. }
  978. //多重校验
  979. Promise.all(arr.map(this.getFormPromise)).then(res => {
  980. const validateResult = res.every(item => !!item);
  981. if (validateResult) {
  982. if (this.form.id != null) {
  983. this.form.tInvoiceWorkcontentList=this.ruleForm
  984. this.form.floorLocation=this.form.floorLocation.join(',')
  985. for(let b=0;b<this.ruleForm.length;b++){
  986. this.ruleForm[b].workType=this.ruleForm[b].workType.join(',')
  987. }
  988. updateBookingworkticket(this.form).then(response => {
  989. this.msgSuccess("修改成功");
  990. this.open = false;
  991. this.getList();
  992. });
  993. } else {
  994. this.form.tInvoiceWorkcontentList=this.ruleForm
  995. this.form.floorLocation=this.form.floorLocation.join(',')
  996. for(let b=0;b<this.ruleForm.length;b++){
  997. this.ruleForm[b].workType=this.ruleForm[b].workType.join(',')
  998. }
  999. addBookingworkticket(this.form).then(response => {
  1000. // console.log(this.form)
  1001. // console.log(this.ruleForm)
  1002. this.approveForm.invoiceId=response.data
  1003. this.approveForm.userSupId=this.form.userMg
  1004. addInvoice(this.approveForm).then(response => {
  1005. this.msgSuccess("已提交申请");
  1006. })
  1007. this.msgSuccess("新增成功");
  1008. // console.log(this.queryParams.createdate)
  1009. this.open = false;
  1010. this.getList();
  1011. this.resetForm1();
  1012. this.cancel();
  1013. });
  1014. }
  1015. } else {
  1016. this.msgError("表单校验未通过,每项申请内容都必填");
  1017. }
  1018. });
  1019. },
  1020. /** 删除按钮操作 */
  1021. handleDelete(row) {
  1022. const ids = row.bookingticketId || this.ids;
  1023. this.$confirm('是否确认删除?', "警告", {
  1024. confirmButtonText: "确定",
  1025. cancelButtonText: "取消",
  1026. type: "warning"
  1027. }).then(function() {
  1028. return delBookingworkticket(ids);
  1029. }).then(() => {
  1030. this.getList();
  1031. this.msgSuccess("删除成功");
  1032. })
  1033. },
  1034. /** 导出按钮操作 */
  1035. handleExport() {
  1036. const queryParams = this.queryParams;
  1037. this.$confirm('是否确认导出所有预约作业票台账数据项?', "警告", {
  1038. confirmButtonText: "确定",
  1039. cancelButtonText: "取消",
  1040. type: "warning"
  1041. }).then(function() {
  1042. return exportBookingworkticket(queryParams);
  1043. }).then(response => {
  1044. this.download(response.msg);
  1045. })
  1046. },
  1047. //关联票号
  1048. association(row){
  1049. this.guanlianVisible=true
  1050. this.associationParams=row
  1051. getWorkcontent(row.id).then(response => {
  1052. this.licenseForm=response.data
  1053. });
  1054. },
  1055. //提交票号
  1056. submitassociation(){
  1057. this.guanlianVisible=false
  1058. const putData={}
  1059. if(this.licenseForm.whgzxkzh!=null
  1060. ||this.licenseForm.whgzxkzh!=''
  1061. ||this.licenseForm.dhzyxkzh!=null
  1062. ||this.licenseForm.dhzyxkzh!=''
  1063. ||this.licenseForm.xzkjxkzh!=null
  1064. ||this.licenseForm.xzkjxkzh!=''
  1065. ||this.licenseForm.mbzyxkzh!=null
  1066. ||this.licenseForm.mbzyxkzh!=''
  1067. ||this.licenseForm.gczyxkzh!=null||this.licenseForm.gczyxkzh!=''){
  1068. putData.id=this.associationParams.id
  1069. putData.whgzxkzh=this.licenseForm.whgzxkzh
  1070. putData.hpjb=this.licenseForm.hpjb
  1071. putData.dhzyxkzh=this.licenseForm.dhzyxkzh
  1072. putData.xzkjxkzh=this.licenseForm.xzkjxkzh
  1073. putData.mbzyxkzh=this.licenseForm.mbzyxkzh
  1074. putData.gczyxkzh=this.licenseForm.gczyxkzh
  1075. putData.gczyjb=this.licenseForm.gczyjb
  1076. }else{
  1077. return this.msgError("请至少关联一张许可证号");
  1078. }
  1079. updateWorkcontent(putData).then(response => {
  1080. // console.log(response.row)
  1081. });
  1082. assion(this.associationParams.bookingticketId).then(response => {
  1083. this.getList()
  1084. });
  1085. this.msgSuccess("请求成功");
  1086. },
  1087. //校验表单中作业内容是否重复
  1088. //合并单元格
  1089. mergeMethod({ row, column, rowIndex, columnIndex }) {
  1090. // console.log(row)
  1091. if (columnIndex === 1) {
  1092. const _row = this.setTable(this.bookingworkticketList).merge[rowIndex];
  1093. const _col = _row > 0 ? 1 : 0;
  1094. return {
  1095. rowspan: _row,
  1096. colspan: _col
  1097. };
  1098. }
  1099. if (columnIndex === 2) {
  1100. const _row = this.setTable(this.bookingworkticketList).merge[rowIndex];
  1101. const _col = _row > 0 ? 1 : 0;
  1102. return {
  1103. rowspan: _row,
  1104. colspan: _col
  1105. };
  1106. }
  1107. if (columnIndex === 3) {
  1108. const _row = this.setTable(this.bookingworkticketList).merge[rowIndex];
  1109. const _col = _row > 0 ? 1 : 0;
  1110. return {
  1111. rowspan: _row,
  1112. colspan: _col
  1113. };
  1114. }
  1115. if (columnIndex === 4) {
  1116. const _row = this.setTable(this.bookingworkticketList).merge[rowIndex];
  1117. const _col = _row > 0 ? 1 : 0;
  1118. return {
  1119. rowspan: _row,
  1120. colspan: _col
  1121. };
  1122. }
  1123. if (columnIndex === 5) {
  1124. const _row = this.setTable(this.bookingworkticketList).merge[rowIndex];
  1125. const _col = _row > 0 ? 1 : 0;
  1126. return {
  1127. rowspan: _row,
  1128. colspan: _col
  1129. };
  1130. }
  1131. if (columnIndex === 11) {
  1132. const _row = this.setTable(this.bookingworkticketList).merge[rowIndex];
  1133. const _col = _row > 0 ? 1 : 0;
  1134. return {
  1135. rowspan: _row,
  1136. colspan: _col
  1137. };
  1138. }
  1139. if (columnIndex === 12) {
  1140. const _row = this.setTable(this.bookingworkticketList).merge[rowIndex];
  1141. const _col = _row > 0 ? 1 : 0;
  1142. return {
  1143. rowspan: _row,
  1144. colspan: _col
  1145. };
  1146. }
  1147. if (columnIndex === 13) {
  1148. const _row = this.setTable(this.bookingworkticketList).merge[rowIndex];
  1149. const _col = _row > 0 ? 1 : 0;
  1150. return {
  1151. rowspan: _row,
  1152. colspan: _col
  1153. };
  1154. }
  1155. if (columnIndex === 14) {
  1156. const _row = this.setTable(this.bookingworkticketList).merge[rowIndex];
  1157. const _col = _row > 0 ? 1 : 0;
  1158. return {
  1159. rowspan: _row,
  1160. colspan: _col
  1161. };
  1162. }
  1163. if (columnIndex === 23) {
  1164. const _row = this.setTable(this.bookingworkticketList).merge[rowIndex];
  1165. const _col = _row > 0 ? 1 : 0;
  1166. return {
  1167. rowspan: _row,
  1168. colspan: _col
  1169. };
  1170. }
  1171. },
  1172. //单元格整理
  1173. setTable(tableData) {
  1174. // console.log(tableData)
  1175. let spanArr = [],
  1176. concat = 0;
  1177. tableData.forEach((item, index) => {
  1178. if (index === 0) {
  1179. spanArr.push(1);
  1180. } else {
  1181. if (item.bookingticketId === tableData[index - 1].bookingticketId) {
  1182. //第一列需合并相同内容的判断条件
  1183. spanArr[concat] += 1;
  1184. spanArr.push(0);
  1185. } else {
  1186. spanArr.push(1);
  1187. concat = index;
  1188. }
  1189. }
  1190. });
  1191. this.$nextTick(() => {
  1192. this.$refs.multipleTable.doLayout();
  1193. // table加ref="multipleTable" 表格不会错位 不对齐
  1194. });
  1195. return {
  1196. merge: spanArr
  1197. };
  1198. },
  1199. //票据预览的
  1200. billSee(row){
  1201. //office预览
  1202. console.log(row.bookingworkticket.filename)
  1203. this.loadingFlash=true
  1204. this.pdf.open =true
  1205. this.pdf.title = row.bookingworkticket.filename
  1206. this.pdf.pdfUrl =""
  1207. this.ppt=true
  1208. //如果是PDF等直接可以打开的就不调接口,否则调用接口
  1209. if(row.bookingworkticket.filename.endsWith('pdf')){
  1210. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + '/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
  1211. this.loadingFlash=false
  1212. }
  1213. else{
  1214. const formatDate =new FormData();
  1215. formatDate.append("filepath",row.bookingworkticket.filename)
  1216. //调用文件预览api
  1217. let res= this.officeConvert.bookConvertCommon(formatDate)
  1218. //查看接受的全局方法的返回结果 console.log(res)
  1219. //利用.then方法接受Promise对象
  1220. res.then((result)=>{
  1221. //关闭加载中
  1222. this.loadingFlash=false
  1223. if(result.msg.includes("csv")){
  1224. this.pdf.pdfUrl =process.env.VUE_APP_BASE_API+ result.data
  1225. this.$alert(result.msg, this.$t('检查乱码'), { dangerouslyUseHTMLString: true });
  1226. // this.$message({message: result.msg, center: true,type:'warning', offset:400, });
  1227. }else if(result.msg.includes("不存在")){
  1228. //文件不存在时提示
  1229. this.pdf.pdfUrl =""
  1230. this.$alert(result.msg, this.$t('预览失败'), { dangerouslyUseHTMLString: true });
  1231. // this.$message({message: result.msg, center: true,type:'warning', offset:400, });
  1232. this.pdf.open =false
  1233. }else if(result.msg.includes("不支持此格式")){
  1234. this.pdf.pdfUrl =""
  1235. this.$alert(result.msg, this.$t('预览失败'), { dangerouslyUseHTMLString: true });
  1236. // this.$message({message: result.msg, center: true,type:'warning', offset:400, });
  1237. this.pdf.open =false
  1238. } else{
  1239. //成功时直接给地址
  1240. this.pdf.pdfUrl =process.env.VUE_APP_BASE_API+ result.data
  1241. console.log( this.pdf.pdfUrl)
  1242. }
  1243. // this.$nextTick(() => {
  1244. // const iframe = window.frames['iFrame']
  1245. // const handleLoad = () => {
  1246. // setTimeout(() => {
  1247. // const Do = (iframe.contentWindow || iframe.contentDocument)
  1248. // console.log(Do.document.getElementsByTagName('table')[0])
  1249. // Do.document.getElementsByTagName('table')[0].style.width = "100%"
  1250. // Do.document.getElementsByTagName('table')[0].setAttribute("class","table")
  1251. // }, 500)
  1252. // }
  1253. // iframe.addEventListener('load', handleLoad, true)
  1254. // })
  1255. }).catch(result => {
  1256. //请求失败,关闭loading,pdf地址直接为为空,不显示
  1257. this.pdf.pdfUrl =""
  1258. this.loadingFlash = false;
  1259. })
  1260. }
  1261. },
  1262. //文件预览
  1263. openPdf(){
  1264. //ppt就跳路由预览,office就直接打开文件新页面
  1265. const didi={ imgs:this.imgs}
  1266. if( this.pptView==true&&this.ppt==false){
  1267. let routeUrl = this.$router.resolve({
  1268. path: "/cpms/index.html#/pptyulan",
  1269. query:didi
  1270. });
  1271. window.open("/cpms/index.html#/pptyulan?id=" + this.pdf.pdfUrl, '_blank')
  1272. console.log(this.imgs)
  1273. }else {
  1274. window.open(this.pdf.pdfUrl)
  1275. }
  1276. },
  1277. // 文件下载处理
  1278. handleDownload(row) {
  1279. console.log(row)
  1280. var name = row.bookingworkticket.filename;
  1281. var url = row.bookingworkticket.filename;
  1282. var suffix = url.substring(url.lastIndexOf("."), url.length);
  1283. console.log(url)
  1284. const a = document.createElement('a')
  1285. a.setAttribute('download', name)
  1286. a.setAttribute('target', '_blank')
  1287. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  1288. a.click()
  1289. },
  1290. }
  1291. };
  1292. </script>
  1293. <style lang="scss" scoped>
  1294. .table-fixed {
  1295. /deep/ .el-table__fixed-right {
  1296. height: 100% !important; //设置高优先,以覆盖内联样式
  1297. }
  1298. /deep/ .el-table__fixed {
  1299. height: 100% !important; //设置高优先,以覆盖内联样式
  1300. }
  1301. }
  1302. </style>