index.vue 55 KB

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