index.vue 60 KB

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