pitfall.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885
  1. <template>
  2. <div>
  3. <el-row class="handle-box" style="margin-bottom: 10px">
  4. <el-col :span="24">
  5. <el-select v-model="search.scene" popper-class="statistic_base" clearable filterable placeholder="专项场景" size="small" @change="handleSearch">
  6. <el-option
  7. v-for="item in dc_data.NOTICE_SCENE"
  8. :key="item.value"
  9. :label="item.label"
  10. :value="item.value"
  11. />
  12. </el-select>
  13. &nbsp;&nbsp;
  14. <el-select v-model="search.area" popper-class="statistic_base" clearable filterable placeholder="行政区划" size="small" @change="handleSearch">
  15. <el-option
  16. v-for="item in AreaDict"
  17. :key="item.code"
  18. :label="item.label"
  19. :value="item.code"
  20. />
  21. </el-select>
  22. &nbsp;&nbsp;
  23. <el-input
  24. v-model="search.name"
  25. class="ch-input ch-input-size"
  26. clearable
  27. placeholder="隐患名称"
  28. size="small"
  29. @keyup.enter.native="handleSearch()"
  30. />
  31. &nbsp;&nbsp;
  32. <el-select v-model="search.type" popper-class="statistic_base" clearable filterable placeholder="隐患类型" size="small" @change="handleSearch">
  33. <el-option
  34. v-for="item in myHIDDEN_TROUBLE_TYPE"
  35. :key="item.value"
  36. :label="item.label"
  37. :value="item.value"
  38. />
  39. </el-select>
  40. &nbsp;&nbsp;
  41. <el-select v-model="search.level" popper-class="statistic_base" clearable filterable placeholder="隐患等级" size="small" @change="handleSearch">
  42. <el-option
  43. v-for="item in dc_data.HIDDEN_TROUBLE_GRADE"
  44. :key="item.value"
  45. :label="item.label"
  46. :value="item.value"
  47. />
  48. </el-select>
  49. &nbsp;&nbsp;
  50. <el-select v-model="search.isOften" popper-class="statistic_base" clearable filterable placeholder="是否高发" size="small" @change="handleSearch">
  51. <el-option
  52. v-for="item in dc_data.IS_OFTEN"
  53. :key="item.value"
  54. :label="item.label"
  55. :value="item.value"
  56. />
  57. </el-select>
  58. &nbsp;&nbsp;
  59. <el-select v-model="search.label" popper-class="statistic_base" clearable filterable placeholder="标签" size="small" @change="handleSearch">
  60. <el-option
  61. v-for="item in tagNameListAll"
  62. :key="item.id"
  63. :label="item.tagName"
  64. :value="item.id"
  65. />
  66. </el-select>
  67. &nbsp;&nbsp;
  68. <el-input
  69. v-model="search.keyword"
  70. class="ch-input ch-input-size"
  71. clearable
  72. placeholder="关键字"
  73. size="small"
  74. @keyup.enter.native="handleSearch()"
  75. />
  76. <el-button class="ch-button" size="small" style="float: right; margin-top: 4px; margin-left: 10px" @click="handleAdd()">
  77. <i class="el-icon-menu" />&nbsp;新增
  78. </el-button>
  79. <el-button
  80. class="ch-button"
  81. size="small"
  82. style="float: right; margin-top: 4px; margin-right: 10px"
  83. @click="showTags2(2)"
  84. ><i class="el-icon-collection-tag" />&nbsp;标签设定
  85. </el-button>
  86. <el-button class="ch-button-warning" size="small" style="float: right; margin-top: 4px;margin-right: 10px;" @click="resetFun()"><i class="el-icon-refresh" />&nbsp;重置</el-button>
  87. <el-button
  88. class="ch-button"
  89. size="small"
  90. style="float: right; margin-top: 4px; margin-right: 10px"
  91. @click="handleSearch()"
  92. >
  93. <i class="el-icon-search" />&nbsp;查询
  94. </el-button>
  95. </el-col>
  96. </el-row>
  97. <el-row class="handle-box">
  98. <el-col :span="24">
  99. <el-table v-loading="loading" :data="AllData" :max-height="tableMax" row-class-name="g_table_row" stripe @selection-change="handleSelectionChange">
  100. <el-table-column type="selection" width="55" />
  101. <el-table-column label="序号" type="index" width="60" />
  102. <el-table-column v-if="false" prop="id" />
  103. <el-table-column label="专项场景" prop="scene" min-width="120" />
  104. <el-table-column label="行政区划" prop="area" min-width="120" />
  105. <el-table-column label="隐患名称" prop="name" min-width="150" />
  106. <el-table-column label="隐患类型" prop="type" min-width="120" />
  107. <el-table-column label="隐患等级" prop="level" min-width="120" />
  108. <el-table-column label="是否高发" prop="isOften" min-width="120" />
  109. <el-table-column label="标签" prop="label" min-width="150" />
  110. <el-table-column label="关键字" prop="keyword" width="430">
  111. <template scope="scope">
  112. <el-tooltip class="item" effect="dark" placement="top-start">
  113. <div slot="content" style="width: 430px">{{ scope.row.keyword }}</div>
  114. <span> {{ scope.row.keyword | ellipsis }}</span>
  115. </el-tooltip>
  116. </template>
  117. </el-table-column>
  118. <el-table-column header-align="center" label="操作" width="130">
  119. <template scope="scope">
  120. <el-link :underline="false" type="primary" @click="handleEdit(scope.row)">修改&nbsp;</el-link>
  121. <el-link :underline="false" type="danger" @click="handleDel(scope.row)">删除&nbsp;</el-link>
  122. <el-link :underline="false" type="primary" @click="handleDownloads(scope.row,downloadMsg,'隐患档案')">下载&nbsp;</el-link>
  123. </template>
  124. </el-table-column>
  125. </el-table>
  126. <div class="table-page">
  127. <el-pagination
  128. :current-page.sync="currentPage"
  129. :page-size="pageSize"
  130. :total="allpage"
  131. background
  132. layout="total, prev, pager, next"
  133. @current-change="handleCurrentChange"
  134. />
  135. </div>
  136. </el-col>
  137. </el-row>
  138. <el-dialog
  139. v-dialogDrag
  140. :append-to-body="true"
  141. :modal-append-to-body="true"
  142. :title="dialogTitle"
  143. :visible.sync="dialogVisible"
  144. class="statistic_base"
  145. style="text-align: left"
  146. top="50px"
  147. width="75%"
  148. @open="dlgOpen"
  149. >
  150. <el-form ref="form" :model="form" :rules="rules" style="width: 100%; padding: 5px">
  151. <el-row>
  152. <el-col style="padding-bottom: 10px">
  153. <!-- <span class="card_title">基本信息</span> -->
  154. <el-card shadow="always" style="padding: 15px 5px 5px 15px">
  155. <el-row>
  156. <el-col :span="3" class="col-txt">
  157. <span class="span_red">*</span>
  158. <span>专项场景</span>
  159. </el-col>
  160. <el-col :span="5" class="col-input">
  161. <el-form-item prop="scene">
  162. <el-select v-model="form.scene" popper-class="statistic_base" clearable filterable placeholder="专项场景">
  163. <el-option
  164. v-for="item in dc_data.NOTICE_SCENE"
  165. :key="item.value"
  166. :label="item.label"
  167. :value="item.value"
  168. />
  169. </el-select>
  170. </el-form-item>
  171. </el-col>
  172. <el-col :span="1" class="col-txt">
  173. <span>&nbsp;</span>
  174. </el-col>
  175. <el-col :span="3" class="col-txt">
  176. <span class="span_red">*</span>
  177. <span>行政区划</span>
  178. </el-col>
  179. <el-col :span="5" class="col-input">
  180. <el-form-item prop="area">
  181. <el-select v-model="form.area" popper-class="statistic_base" clearable filterable placeholder="行政区划">
  182. <el-option
  183. v-for="item in AreaDict"
  184. :key="item.code"
  185. :label="item.label"
  186. :value="item.code"
  187. />
  188. </el-select>
  189. </el-form-item>
  190. </el-col>
  191. </el-row>
  192. <el-row>
  193. <el-col :span="3" class="col-txt">
  194. <span class="span_red">*</span>
  195. <span>隐患名称</span>
  196. </el-col>
  197. <el-col :span="20" class="col-input">
  198. <el-form-item prop="name">
  199. <el-input v-model="form.name" />
  200. </el-form-item>
  201. </el-col>
  202. </el-row>
  203. <el-row>
  204. <el-col :span="3" class="col-txt">
  205. <span class="span_red">*</span>
  206. <span>隐患类型</span>
  207. </el-col>
  208. <el-col :span="5" class="col-input">
  209. <el-form-item prop="type">
  210. <el-select v-model="form.type" popper-class="statistic_base" clearable filterable placeholder="隐患类型">
  211. <el-option
  212. v-for="item in HIDDEN_TROUBLE_TYPE_form"
  213. :key="item.value"
  214. :label="item.label"
  215. :value="item.value"
  216. />
  217. </el-select>
  218. </el-form-item>
  219. </el-col>
  220. <el-col :span="1" class="col-txt">
  221. <span>&nbsp;</span>
  222. </el-col>
  223. <el-col :span="3" class="col-txt">
  224. <span class="span_red">*</span>
  225. <span>隐患等级</span>
  226. </el-col>
  227. <el-col :span="5" class="col-input">
  228. <el-form-item prop="level">
  229. <el-select v-model="form.level" popper-class="statistic_base" clearable filterable placeholder="隐患等级">
  230. <el-option
  231. v-for="item in dc_data.HIDDEN_TROUBLE_GRADE"
  232. :key="item.value"
  233. :label="item.label"
  234. :value="item.value"
  235. />
  236. </el-select>
  237. </el-form-item>
  238. </el-col>
  239. </el-row>
  240. <el-row>
  241. <el-col :span="3" class="col-txt">
  242. <span class="span_red">*</span>
  243. <span>是否高发</span>
  244. </el-col>
  245. <el-col :span="5" class="col-input">
  246. <el-form-item prop="isOften">
  247. <el-select v-model="form.isOften" popper-class="statistic_base" clearable filterable placeholder="是否高发">
  248. <el-option
  249. v-for="item in dc_data.IS_OFTEN"
  250. :key="item.value"
  251. :label="item.label"
  252. :value="item.value"
  253. />
  254. </el-select>
  255. </el-form-item>
  256. </el-col>
  257. </el-row>
  258. <el-row>
  259. <el-col :span="3" class="col-txt">
  260. <span class="span_red">*</span>
  261. <span>标签</span>
  262. </el-col>
  263. <el-col :span="20" class="col-input">
  264. <el-form-item prop="tags">
  265. <div @click="showTags2(1)">
  266. <el-input
  267. v-model="form.tags"
  268. disabled
  269. placeholder="请选择标签(可多选)"
  270. style="pointer-events:none"
  271. />
  272. </div>
  273. </el-form-item>
  274. </el-col>
  275. </el-row>
  276. <el-row>
  277. <el-col :span="3" class="col-txt">
  278. <span class="span_red">*</span>
  279. <span>档案文件</span>
  280. </el-col>
  281. <el-col :span="20" class="col-input">
  282. <el-form-item prop="annex">
  283. <el-input v-show="false" v-model="form.annex" />
  284. <el-upload
  285. :before-remove="beforeRemoveAnnexByUid"
  286. :before-upload="beforeUploadAnnex"
  287. :file-list="annexList"
  288. :http-request="uploadAnnex"
  289. :on-change="handleChangeAnnex"
  290. :on-exceed="handleExceedAnnex"
  291. :on-remove="handleRemoveAnnex"
  292. action="#"
  293. list-type="upload-demo"
  294. style="width: 300px"
  295. >
  296. <el-button size="small" type="primary">上传附件</el-button>
  297. </el-upload>
  298. </el-form-item>
  299. </el-col>
  300. </el-row>
  301. <el-row>
  302. <el-col :span="3" class="col-txt">
  303. <span class="span_red">*</span>
  304. <span>关键字</span>
  305. </el-col>
  306. <el-col :span="20" class="col-input">
  307. <el-form-item prop="keyword">
  308. <el-input v-model="form.keyword" rows="6" type="textarea" />
  309. </el-form-item>
  310. </el-col>
  311. </el-row>
  312. </el-card>
  313. </el-col>
  314. </el-row>
  315. </el-form>
  316. <div slot="footer">
  317. <el-button @click="dialogVisible = false">取 消</el-button>
  318. <el-button type="primary" @click="confirmSubmit()">确 定</el-button>
  319. </div>
  320. </el-dialog>
  321. <el-dialog
  322. v-dialogDrag
  323. :append-to-body="true"
  324. :modal-append-to-body="true"
  325. :visible.sync="dialogYulan"
  326. style="text-align: left"
  327. top="50px"
  328. width="75%"
  329. class="statistic_base"
  330. @open="dlgOpen"
  331. >
  332. <div ref="preview" />
  333. <div slot="footer">
  334. <el-button type="primary" @click="dialogYulan = false">关闭</el-button>
  335. </div>
  336. </el-dialog>
  337. <!-- 标签处理 -->
  338. <el-dialog
  339. v-dialogDrag
  340. :append-to-body="true"
  341. :close-on-click-modal="false"
  342. :close-on-press-escape="false"
  343. :modal-append-to-body="true"
  344. :visible.sync="dialogVisibleTag"
  345. class="statistic_base dialogTag"
  346. style="text-align: left"
  347. title="标签设定"
  348. top="80px"
  349. width="55%"
  350. >
  351. <el-card v-if="dialogVisibleTag" shadow="always" style="padding: 15px 5px 5px 15px">
  352. <el-row class="tag-select">
  353. <el-col :span="3" class="col-txt">
  354. <span>已选择:</span>
  355. </el-col>
  356. <el-col :span="20" class="col-tag">
  357. <el-button
  358. v-for="(item,index) in checkTags"
  359. :key="item"
  360. plain
  361. type="primary"
  362. >
  363. {{ item }}<i class="el-icon-close el-icon--right" @click="tagsDel(index)" />
  364. </el-button>
  365. </el-col>
  366. </el-row>
  367. <div class="bottom">
  368. <div class="left">
  369. <div class="title">标签类别</div>
  370. <el-scrollbar class="scroll">
  371. <div
  372. v-for="(item,index) in tagList"
  373. :class="tagIndex==index?'active':''"
  374. class="item"
  375. @click="choseTag(index)"
  376. >
  377. {{ item.categoryName }}
  378. </div>
  379. </el-scrollbar>
  380. </div>
  381. <div class="right">
  382. <div class="title">标签名称</div>
  383. <div class="content">
  384. <el-row>
  385. <el-col :span="10" class="col-input">
  386. <el-input v-model="tag" placeholder="标签模糊搜索" @change="searchTag" />
  387. </el-col>
  388. <el-button class="tag_search_btn" type="primary" @click="searchTag">查询</el-button>
  389. </el-row>
  390. <el-checkbox-group v-model="checkList" @change="checkChange2">
  391. <el-checkbox v-for="(item) in tagNameList" :key="item.id" :label="item.id">
  392. {{ item.tagName }}
  393. </el-checkbox>
  394. </el-checkbox-group>
  395. </div>
  396. </div>
  397. </div>
  398. </el-card>
  399. <div slot="footer">
  400. <el-button @click="cancelSubmitTag2()">取 消</el-button>
  401. <el-button type="primary" @click="confirmSubmitTag2()">确 定</el-button>
  402. </div>
  403. </el-dialog>
  404. </div>
  405. </template>
  406. <script>
  407. import Base from '@/views/base/base'
  408. import BaseData from '@/views/base/baseData'
  409. import constant from '@/static/utils/constant'
  410. // import { upload } from '@/static/utils/channel'
  411. import '../../assets/drag'
  412. export default {
  413. name: 'Pitfall',
  414. components: {
  415. },
  416. filters: {
  417. ellipsis(value) {
  418. if (!value) return ''
  419. if (value.length > 30) {
  420. return value.slice(0, 30) + '...'
  421. }
  422. return value
  423. }
  424. },
  425. mixins: [Base, BaseData],
  426. data() {
  427. return {
  428. myHIDDEN_TROUBLE_TYPE: [],
  429. HIDDEN_TROUBLE_TYPE_form: [],
  430. dc_key: ['NOTICE_SCENE', 'HIDDEN_TROUBLE_GRADE', '供水_HIDDEN_TROUBLE_TYPE', 'IS_OFTEN', '燃气_RQSSYH_YHLX_DM', '综合管线_JHFXYH_YHLX_DM', '道路_CSDL_TXYHLX_DM'],
  431. // 列表相关
  432. search: {
  433. labelName: '',
  434. label: ''
  435. },
  436. AllData: [],
  437. loading: false,
  438. // 弹框相关
  439. dialogVisible: false,
  440. dialogYulan: false,
  441. dialogTitle: '',
  442. isAdd: true,
  443. form: this.initForm(),
  444. rules: {
  445. scene: [{ required: true, message: '请选择专项场景', trigger: 'change' }],
  446. area: [{ required: true, message: '请选择行政划区', trigger: 'change' }],
  447. name: [{ required: true, message: '请填写隐患名称', trigger: 'blur' }],
  448. type: [{ required: true, message: '请选择隐患类型', trigger: 'change' }],
  449. level: [{ required: true, message: '请选择隐患等级', trigger: 'change' }],
  450. keyword: [{ required: true, message: '请填写关键字', trigger: 'blur' }],
  451. annex: [{ required: true, message: '请上传档案文件', trigger: 'blur' }],
  452. tags: [{ required: true, message: '请选择标签', trigger: 'blur' }],
  453. isOften: [{ required: true, message: '请选择是否高发', trigger: 'blur' }]
  454. },
  455. pageSize: 10,
  456. // 富文本
  457. content: '',
  458. // 图片上传部分
  459. imageList: [],
  460. imageStrList: [],
  461. imageName: '',
  462. imageUrl: '',
  463. imageDesc: '',
  464. // 图片预览部分
  465. dialogImageUrl: '',
  466. imageVisible: false,
  467. // 附件部分
  468. annexList: [],
  469. annexObjList: [],
  470. // 标签部分
  471. dialogVisibleTag: false,
  472. tag: '',
  473. tagList: [],
  474. checkTags: [],
  475. checkList: [],
  476. tagNameList: [],
  477. tagNameListAll: [],
  478. tagIndex: 0,
  479. tagAction: 0, // 0:查询 1:新增和修改 2:批量修改
  480. multipleSelection: [],
  481. updateForm: {},
  482. // 查看图片
  483. dialogShowImage: false,
  484. yulanName: '',
  485. yulanLabel: '',
  486. yulanContent: '',
  487. yulanImageList: [],
  488. yulanAnnex: {},
  489. downloadMsg: '是否下载隐患档案?'
  490. }
  491. },
  492. watch: {
  493. 'search.scene'(val) {
  494. console.log(val)
  495. this.choseScene(val)
  496. },
  497. 'form.scene'(val) {
  498. console.log(val)
  499. this.choseScene2(val)
  500. }
  501. },
  502. mounted() {
  503. this.initDict(this.dc_key)
  504. .then((res) => {
  505. this.initArea().then(() => {
  506. this.loading = true
  507. this.getTagsNameAll()
  508. })
  509. })
  510. },
  511. methods: {
  512. choseScene(val) {
  513. console.log(val)
  514. if (val == 0) {
  515. this.myHIDDEN_TROUBLE_TYPE = this.dc_data['燃气_RQSSYH_YHLX_DM']
  516. } else if (val == 6) {
  517. this.myHIDDEN_TROUBLE_TYPE = this.dc_data['道路_CSDL_TXYHLX_DM']
  518. } else if (val == 4) {
  519. this.myHIDDEN_TROUBLE_TYPE = this.dc_data['综合管线_JHFXYH_YHLX_DM']
  520. } else if (val == 2) {
  521. this.myHIDDEN_TROUBLE_TYPE = this.dc_map['供水_HIDDEN_TROUBLE_TYPE']
  522. } else {
  523. this.myHIDDEN_TROUBLE_TYPE = []
  524. }
  525. this.search.type = ''
  526. },
  527. choseScene2(val) {
  528. console.log(val)
  529. if (val == 0) {
  530. this.HIDDEN_TROUBLE_TYPE_form = this.dc_data['燃气_RQSSYH_YHLX_DM']
  531. } else if (val == 6) {
  532. this.HIDDEN_TROUBLE_TYPE_form = this.dc_data['道路_CSDL_TXYHLX_DM']
  533. } else if (val == 4) {
  534. this.HIDDEN_TROUBLE_TYPE_form = this.dc_data['综合管线_JHFXYH_YHLX_DM']
  535. } else if (val == 2) {
  536. this.HIDDEN_TROUBLE_TYPE_form = this.dc_data['供水_HIDDEN_TROUBLE_TYPE']
  537. } else {
  538. this.HIDDEN_TROUBLE_TYPE_form = []
  539. this.form.type = ''
  540. }
  541. // this.form.hiddenTroubleType=''
  542. },
  543. getData: function() {
  544. const _this = this
  545. _this.loading = true
  546. _this.AllData = []
  547. this.search.pageNum = this.currentPage
  548. this.search.pageSize = this.pageSize
  549. this.baseRequest('pitfallList', this.search)
  550. .then((res) => {
  551. if (res.data.rows) {
  552. res.data.rows.forEach(function(item) {
  553. const json = _this.getItemJson(item)
  554. _this.AllData.push(json)
  555. })
  556. _this.allpage = res.data.total
  557. }
  558. _this.loading = false
  559. })
  560. .catch(() => {
  561. })
  562. // this.initOutData()
  563. },
  564. handleSearch: function() {
  565. this.getData()
  566. },
  567. handleReset: function() {
  568. for (const i in this.search) {
  569. if (i !== 'pageNum' && i !== 'pageSize') {
  570. this.search[i] = ''
  571. }
  572. }
  573. this.handleSearch()
  574. },
  575. initOutData: function() {
  576. const _this = this
  577. this.OutData = []
  578. const title = [
  579. ' 序号',
  580. ' 专项场景',
  581. ' 行政区划',
  582. ' 隐患名称',
  583. ' 隐患类型',
  584. ' 隐患等级',
  585. ' 标签',
  586. ' 关键字'
  587. ]
  588. this.OutData.push(title)
  589. return this.baseRequest('pitfallListAll', this.search)
  590. .then((res) => {
  591. if (res.data) {
  592. res.data.forEach(function(item, index) {
  593. const jsonMap = _this.getItemJson(item)
  594. const jsonArray = []
  595. jsonArray.push(jsonMap.id)
  596. jsonArray.push(jsonMap.scene)
  597. jsonArray.push(jsonMap.area)
  598. jsonArray.push(jsonMap.name)
  599. jsonArray.push(jsonMap.type)
  600. jsonArray.push(jsonMap.level)
  601. jsonArray.push(jsonMap.label)
  602. jsonArray.push(jsonMap.area)
  603. _this.OutData.push(jsonArray)
  604. })
  605. }
  606. })
  607. .catch(() => {
  608. })
  609. },
  610. getItemJson: function(item) {
  611. if (item.scene == 0) {
  612. item.type = this.dc_map['燃气_RQSSYH_YHLX_DM'][item.type]
  613. } else if (item.scene == 6) {
  614. item.type = this.dc_map['道路_CSDL_TXYHLX_DM'][item.type]
  615. } else if (item.scene == 4) {
  616. item.type = this.dc_map['综合管线_JHFXYH_YHLX_DM'][item.type]
  617. } else if (item.scene == 2) {
  618. item.type = this.dc_map['供水_HIDDEN_TROUBLE_TYPE'][item.type]
  619. }
  620. item.scene = this.dc_map.NOTICE_SCENE[item.scene]
  621. item.level = this.dc_map.HIDDEN_TROUBLE_GRADE[item.level]
  622. item.area = this.returnArea(item.area)
  623. // item.type = this.dc_map.HIDDEN_TROUBLE_TYPE[item.type]
  624. if (item.label && item.label !== null && item.label !== '') {
  625. item.label = this.setTagName(item.label).join(',')
  626. }
  627. return item
  628. },
  629. initForm: function() {
  630. return {
  631. scene: '',
  632. image: '',
  633. content: '',
  634. name: '',
  635. label: '',
  636. annex: '',
  637. releaseTime: '',
  638. state: '1',
  639. orderNum: '',
  640. tags: '',
  641. ifOften: ''
  642. }
  643. },
  644. confirmOutput() {
  645. const OutSize = [
  646. { wch: 15 },
  647. { wch: 15 },
  648. { wch: 15 },
  649. { wch: 15 },
  650. { wch: 15 },
  651. { wch: 15 },
  652. { wch: 15 }
  653. ]
  654. const fileName = '隐患档案导出 ' + new Date().Format('yyyyMMddhhmm')
  655. this.initOutData().then(() => {
  656. this.$outputXlsxFile(this.OutData, OutSize, fileName)
  657. })
  658. },
  659. dlgOpen: function() {
  660. const _this = this
  661. if (_this.form.id !== '') {
  662. const postData = {
  663. id: _this.form.id
  664. }
  665. this.baseRequest('getPitfallById', postData)
  666. .then((res) => {
  667. if (res.data) {
  668. _this.form = Object.assign({}, _this.form, res.data)
  669. _this.form.feedbackTime = this.$common.transDateStr(_this.form.feedbackTime, constant.DATE_PATTERN.DATE_TIME_h)
  670. // 处理标签信息
  671. if (_this.form.label && _this.form.label !== null && _this.form.label !== '') {
  672. _this.checkList = _this.form.label.split(',')
  673. _this.checkTags = _this.setTagName(_this.form.label)
  674. _this.form.tags = _this.checkTags.join(',')
  675. }
  676. // 处理附件
  677. _this.annexList = []
  678. _this.annexObjList = []
  679. if (_this.form.annex !== '') {
  680. // 存量数据是一个附件,需求要改成多个附件
  681. if (Array.isArray(JSON.parse(_this.form.annex))) {
  682. _this.annexObjList = Object.values(JSON.parse(_this.form.annex))
  683. _this.annexObjList.forEach(obj => {
  684. if (obj.uid != null && obj.name != null && obj.url != null) {
  685. _this.annexList.push({
  686. uid: obj.uid,
  687. name: obj.name,
  688. url: obj.url
  689. })
  690. }
  691. })
  692. } else {
  693. const annexObj = JSON.parse(_this.form.annex)
  694. if (annexObj.name) {
  695. _this.annexObjList.push({
  696. uid: 0,
  697. name: annexObj.name,
  698. url: annexObj.data.msg
  699. })
  700. _this.annexList.push({
  701. uid: 0,
  702. name: annexObj.name,
  703. url: annexObj.data.msg
  704. })
  705. }
  706. }
  707. }
  708. }
  709. })
  710. .catch(() => {
  711. })
  712. }
  713. },
  714. /* 编辑*/
  715. handleEdit: function(val) {
  716. this.isAdd = false
  717. this.form.id = val.id
  718. this.content = val.content
  719. this.imageList = []
  720. this.imageStrList = []
  721. this.annexList = []
  722. this.annexObjList = []
  723. this.checkTags = []
  724. this.checkList = []
  725. this.tagNameList = []
  726. this.tagIndex = 0
  727. this.dialogVisible = true
  728. this.dialogTitle = '修改隐患档案'
  729. },
  730. /* 新增*/
  731. handleAdd: function() {
  732. this.form = this.initForm()
  733. this.isAdd = true
  734. this.content = ''
  735. this.imageList = []
  736. this.imageStrList = []
  737. this.annexList = []
  738. this.annexObjList = []
  739. this.checkTags = []
  740. this.checkList = []
  741. this.tagNameList = []
  742. this.tagIndex = 0
  743. this.dialogVisible = true
  744. this.dialogTitle = '新增隐患档案'
  745. },
  746. confirmSubmit: function() {
  747. const _this = this
  748. _this.form.annex = JSON.stringify(_this.annexObjList)
  749. this.$refs.form.validate((valid) => {
  750. if (valid) {
  751. let soaUrl = 'editPitfall'
  752. const extraData = {}
  753. const postData = Object.assign({}, _this.form, extraData)
  754. if (this.isAdd) {
  755. soaUrl = 'addPitfall'
  756. }
  757. this.opRecord(postData, soaUrl)
  758. } else {
  759. // //console.log('error submit!!')
  760. return false
  761. }
  762. })
  763. },
  764. baseRequest(opUrl, postData) {
  765. return this.$channel.globeRequest(
  766. 'ArchivesEventController',
  767. opUrl,
  768. postData,
  769. 'project'
  770. )
  771. },
  772. getContent(content) {
  773. this.content = content
  774. this.form.content = content
  775. },
  776. // 删除
  777. handleDel(val) {
  778. const message = '确认要删除该条隐患档案?'
  779. this.confirm(message, '提示', {
  780. confirmButtonText: '确定',
  781. cancelButtonText: '取消',
  782. type: 'warning'
  783. }).then(() => {
  784. this.baseRequest('removePitfall/' + val.id, '')
  785. .then((res) => {
  786. this.getData()
  787. })
  788. .catch(() => {
  789. })
  790. })
  791. },
  792. // 附件部分
  793. uploadAnnex: function(file) {
  794. this.uploadAnnexGetStr(file, '/ArchivesEventController/upload').then(str => {
  795. this.annexObjList.push(str)
  796. })
  797. },
  798. // 标签部分
  799. dealLabel() {
  800. // 批量处理标签
  801. const ids = []
  802. this.multipleSelection.forEach((item) => {
  803. ids.push(item.id)
  804. })
  805. const postData = {
  806. ids: ids.join(','),
  807. tags: this.updateForm.label
  808. }
  809. this.baseRequest('updatePitfallTag', postData)
  810. .then((res) => {
  811. this.getData()
  812. })
  813. }
  814. }
  815. }
  816. </script>
  817. <style scoped>
  818. span.span_red {
  819. color: red;
  820. }
  821. .ch-input .el-input__inner {
  822. border-color: #32323a;
  823. }
  824. .ch-input-size {
  825. width: 150px;
  826. }
  827. .ch-button {
  828. border-color: #32323a;
  829. background-color: #32323a;
  830. color: #fff;
  831. }
  832. .ch-button-warning {
  833. margin-left: 10px;
  834. border-color: #e6a23c;
  835. background-color: #e6a23c;
  836. color: #fff;
  837. }
  838. .ch-button-export {
  839. margin-left: 10px;
  840. border-color: #98cc1f;
  841. background-color: #98cc1f;
  842. color: #fff;
  843. }
  844. /deep/ .el-dialog__header {
  845. padding: 20px 30px 0px 30px;
  846. text-align: left;
  847. }
  848. /deep/ .el-dialog__body {
  849. padding: 10px 20px;
  850. }
  851. </style>