index.vue 55 KB

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