| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885 |
- <template>
- <div>
- <el-row class="handle-box" style="margin-bottom: 10px">
- <el-col :span="24">
- <el-select v-model="search.scene" popper-class="statistic_base" clearable filterable placeholder="专项场景" size="small" @change="handleSearch">
- <el-option
- v-for="item in dc_data.NOTICE_SCENE"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
-
- <el-select v-model="search.area" popper-class="statistic_base" clearable filterable placeholder="行政区划" size="small" @change="handleSearch">
- <el-option
- v-for="item in AreaDict"
- :key="item.code"
- :label="item.label"
- :value="item.code"
- />
- </el-select>
-
- <el-input
- v-model="search.name"
- class="ch-input ch-input-size"
- clearable
- placeholder="隐患名称"
- size="small"
- @keyup.enter.native="handleSearch()"
- />
-
- <el-select v-model="search.type" popper-class="statistic_base" clearable filterable placeholder="隐患类型" size="small" @change="handleSearch">
- <el-option
- v-for="item in myHIDDEN_TROUBLE_TYPE"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
-
- <el-select v-model="search.level" popper-class="statistic_base" clearable filterable placeholder="隐患等级" size="small" @change="handleSearch">
- <el-option
- v-for="item in dc_data.HIDDEN_TROUBLE_GRADE"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
-
- <el-select v-model="search.isOften" popper-class="statistic_base" clearable filterable placeholder="是否高发" size="small" @change="handleSearch">
- <el-option
- v-for="item in dc_data.IS_OFTEN"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
-
- <el-select v-model="search.label" popper-class="statistic_base" clearable filterable placeholder="标签" size="small" @change="handleSearch">
- <el-option
- v-for="item in tagNameListAll"
- :key="item.id"
- :label="item.tagName"
- :value="item.id"
- />
- </el-select>
-
- <el-input
- v-model="search.keyword"
- class="ch-input ch-input-size"
- clearable
- placeholder="关键字"
- size="small"
- @keyup.enter.native="handleSearch()"
- />
- <el-button class="ch-button" size="small" style="float: right; margin-top: 4px; margin-left: 10px" @click="handleAdd()">
- <i class="el-icon-menu" /> 新增
- </el-button>
- <el-button
- class="ch-button"
- size="small"
- style="float: right; margin-top: 4px; margin-right: 10px"
- @click="showTags2(2)"
- ><i class="el-icon-collection-tag" /> 标签设定
- </el-button>
- <el-button class="ch-button-warning" size="small" style="float: right; margin-top: 4px;margin-right: 10px;" @click="resetFun()"><i class="el-icon-refresh" /> 重置</el-button>
- <el-button
- class="ch-button"
- size="small"
- style="float: right; margin-top: 4px; margin-right: 10px"
- @click="handleSearch()"
- >
- <i class="el-icon-search" /> 查询
- </el-button>
- </el-col>
- </el-row>
- <el-row class="handle-box">
- <el-col :span="24">
- <el-table v-loading="loading" :data="AllData" :max-height="tableMax" row-class-name="g_table_row" stripe @selection-change="handleSelectionChange">
- <el-table-column type="selection" width="55" />
- <el-table-column label="序号" type="index" width="60" />
- <el-table-column v-if="false" prop="id" />
- <el-table-column label="专项场景" prop="scene" min-width="120" />
- <el-table-column label="行政区划" prop="area" min-width="120" />
- <el-table-column label="隐患名称" prop="name" min-width="150" />
- <el-table-column label="隐患类型" prop="type" min-width="120" />
- <el-table-column label="隐患等级" prop="level" min-width="120" />
- <el-table-column label="是否高发" prop="isOften" min-width="120" />
- <el-table-column label="标签" prop="label" min-width="150" />
- <el-table-column label="关键字" prop="keyword" width="430">
- <template scope="scope">
- <el-tooltip class="item" effect="dark" placement="top-start">
- <div slot="content" style="width: 430px">{{ scope.row.keyword }}</div>
- <span> {{ scope.row.keyword | ellipsis }}</span>
- </el-tooltip>
- </template>
- </el-table-column>
- <el-table-column header-align="center" label="操作" width="130">
- <template scope="scope">
- <el-link :underline="false" type="primary" @click="handleEdit(scope.row)">修改 </el-link>
- <el-link :underline="false" type="danger" @click="handleDel(scope.row)">删除 </el-link>
- <el-link :underline="false" type="primary" @click="handleDownloads(scope.row,downloadMsg,'隐患档案')">下载 </el-link>
- </template>
- </el-table-column>
- </el-table>
- <div class="table-page">
- <el-pagination
- :current-page.sync="currentPage"
- :page-size="pageSize"
- :total="allpage"
- background
- layout="total, prev, pager, next"
- @current-change="handleCurrentChange"
- />
- </div>
- </el-col>
- </el-row>
- <el-dialog
- v-dialogDrag
- :append-to-body="true"
- :modal-append-to-body="true"
- :title="dialogTitle"
- :visible.sync="dialogVisible"
- class="statistic_base"
- style="text-align: left"
- top="50px"
- width="75%"
- @open="dlgOpen"
- >
- <el-form ref="form" :model="form" :rules="rules" style="width: 100%; padding: 5px">
- <el-row>
- <el-col style="padding-bottom: 10px">
- <!-- <span class="card_title">基本信息</span> -->
- <el-card shadow="always" style="padding: 15px 5px 5px 15px">
- <el-row>
- <el-col :span="3" class="col-txt">
- <span class="span_red">*</span>
- <span>专项场景</span>
- </el-col>
- <el-col :span="5" class="col-input">
- <el-form-item prop="scene">
- <el-select v-model="form.scene" popper-class="statistic_base" clearable filterable placeholder="专项场景">
- <el-option
- v-for="item in dc_data.NOTICE_SCENE"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1" class="col-txt">
- <span> </span>
- </el-col>
- <el-col :span="3" class="col-txt">
- <span class="span_red">*</span>
- <span>行政区划</span>
- </el-col>
- <el-col :span="5" class="col-input">
- <el-form-item prop="area">
- <el-select v-model="form.area" popper-class="statistic_base" clearable filterable placeholder="行政区划">
- <el-option
- v-for="item in AreaDict"
- :key="item.code"
- :label="item.label"
- :value="item.code"
- />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="3" class="col-txt">
- <span class="span_red">*</span>
- <span>隐患名称</span>
- </el-col>
- <el-col :span="20" class="col-input">
- <el-form-item prop="name">
- <el-input v-model="form.name" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="3" class="col-txt">
- <span class="span_red">*</span>
- <span>隐患类型</span>
- </el-col>
- <el-col :span="5" class="col-input">
- <el-form-item prop="type">
- <el-select v-model="form.type" popper-class="statistic_base" clearable filterable placeholder="隐患类型">
- <el-option
- v-for="item in HIDDEN_TROUBLE_TYPE_form"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1" class="col-txt">
- <span> </span>
- </el-col>
- <el-col :span="3" class="col-txt">
- <span class="span_red">*</span>
- <span>隐患等级</span>
- </el-col>
- <el-col :span="5" class="col-input">
- <el-form-item prop="level">
- <el-select v-model="form.level" popper-class="statistic_base" clearable filterable placeholder="隐患等级">
- <el-option
- v-for="item in dc_data.HIDDEN_TROUBLE_GRADE"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="3" class="col-txt">
- <span class="span_red">*</span>
- <span>是否高发</span>
- </el-col>
- <el-col :span="5" class="col-input">
- <el-form-item prop="isOften">
- <el-select v-model="form.isOften" popper-class="statistic_base" clearable filterable placeholder="是否高发">
- <el-option
- v-for="item in dc_data.IS_OFTEN"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="3" class="col-txt">
- <span class="span_red">*</span>
- <span>标签</span>
- </el-col>
- <el-col :span="20" class="col-input">
- <el-form-item prop="tags">
- <div @click="showTags2(1)">
- <el-input
- v-model="form.tags"
- disabled
- placeholder="请选择标签(可多选)"
- style="pointer-events:none"
- />
- </div>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="3" class="col-txt">
- <span class="span_red">*</span>
- <span>档案文件</span>
- </el-col>
- <el-col :span="20" class="col-input">
- <el-form-item prop="annex">
- <el-input v-show="false" v-model="form.annex" />
- <el-upload
- :before-remove="beforeRemoveAnnexByUid"
- :before-upload="beforeUploadAnnex"
- :file-list="annexList"
- :http-request="uploadAnnex"
- :on-change="handleChangeAnnex"
- :on-exceed="handleExceedAnnex"
- :on-remove="handleRemoveAnnex"
- action="#"
- list-type="upload-demo"
- style="width: 300px"
- >
- <el-button size="small" type="primary">上传附件</el-button>
- </el-upload>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="3" class="col-txt">
- <span class="span_red">*</span>
- <span>关键字</span>
- </el-col>
- <el-col :span="20" class="col-input">
- <el-form-item prop="keyword">
- <el-input v-model="form.keyword" rows="6" type="textarea" />
- </el-form-item>
- </el-col>
- </el-row>
- </el-card>
- </el-col>
- </el-row>
- </el-form>
- <div slot="footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="confirmSubmit()">确 定</el-button>
- </div>
- </el-dialog>
- <el-dialog
- v-dialogDrag
- :append-to-body="true"
- :modal-append-to-body="true"
- :visible.sync="dialogYulan"
- style="text-align: left"
- top="50px"
- width="75%"
- class="statistic_base"
- @open="dlgOpen"
- >
- <div ref="preview" />
- <div slot="footer">
- <el-button type="primary" @click="dialogYulan = false">关闭</el-button>
- </div>
- </el-dialog>
- <!-- 标签处理 -->
- <el-dialog
- v-dialogDrag
- :append-to-body="true"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- :modal-append-to-body="true"
- :visible.sync="dialogVisibleTag"
- class="statistic_base dialogTag"
- style="text-align: left"
- title="标签设定"
- top="80px"
- width="55%"
- >
- <el-card v-if="dialogVisibleTag" shadow="always" style="padding: 15px 5px 5px 15px">
- <el-row class="tag-select">
- <el-col :span="3" class="col-txt">
- <span>已选择:</span>
- </el-col>
- <el-col :span="20" class="col-tag">
- <el-button
- v-for="(item,index) in checkTags"
- :key="item"
- plain
- type="primary"
- >
- {{ item }}<i class="el-icon-close el-icon--right" @click="tagsDel(index)" />
- </el-button>
- </el-col>
- </el-row>
- <div class="bottom">
- <div class="left">
- <div class="title">标签类别</div>
- <el-scrollbar class="scroll">
- <div
- v-for="(item,index) in tagList"
- :class="tagIndex==index?'active':''"
- class="item"
- @click="choseTag(index)"
- >
- {{ item.categoryName }}
- </div>
- </el-scrollbar>
- </div>
- <div class="right">
- <div class="title">标签名称</div>
- <div class="content">
- <el-row>
- <el-col :span="10" class="col-input">
- <el-input v-model="tag" placeholder="标签模糊搜索" @change="searchTag" />
- </el-col>
- <el-button class="tag_search_btn" type="primary" @click="searchTag">查询</el-button>
- </el-row>
- <el-checkbox-group v-model="checkList" @change="checkChange2">
- <el-checkbox v-for="(item) in tagNameList" :key="item.id" :label="item.id">
- {{ item.tagName }}
- </el-checkbox>
- </el-checkbox-group>
- </div>
- </div>
- </div>
- </el-card>
- <div slot="footer">
- <el-button @click="cancelSubmitTag2()">取 消</el-button>
- <el-button type="primary" @click="confirmSubmitTag2()">确 定</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import Base from '@/views/base/base'
- import BaseData from '@/views/base/baseData'
- import constant from '@/static/utils/constant'
- // import { upload } from '@/static/utils/channel'
- import '../../assets/drag'
- export default {
- name: 'Pitfall',
- components: {
- },
- filters: {
- ellipsis(value) {
- if (!value) return ''
- if (value.length > 30) {
- return value.slice(0, 30) + '...'
- }
- return value
- }
- },
- mixins: [Base, BaseData],
- data() {
- return {
- myHIDDEN_TROUBLE_TYPE: [],
- HIDDEN_TROUBLE_TYPE_form: [],
- dc_key: ['NOTICE_SCENE', 'HIDDEN_TROUBLE_GRADE', '供水_HIDDEN_TROUBLE_TYPE', 'IS_OFTEN', '燃气_RQSSYH_YHLX_DM', '综合管线_JHFXYH_YHLX_DM', '道路_CSDL_TXYHLX_DM'],
- // 列表相关
- search: {
- labelName: '',
- label: ''
- },
- AllData: [],
- loading: false,
- // 弹框相关
- dialogVisible: false,
- dialogYulan: false,
- dialogTitle: '',
- isAdd: true,
- form: this.initForm(),
- rules: {
- scene: [{ required: true, message: '请选择专项场景', trigger: 'change' }],
- area: [{ required: true, message: '请选择行政划区', trigger: 'change' }],
- name: [{ required: true, message: '请填写隐患名称', trigger: 'blur' }],
- type: [{ required: true, message: '请选择隐患类型', trigger: 'change' }],
- level: [{ required: true, message: '请选择隐患等级', trigger: 'change' }],
- keyword: [{ required: true, message: '请填写关键字', trigger: 'blur' }],
- annex: [{ required: true, message: '请上传档案文件', trigger: 'blur' }],
- tags: [{ required: true, message: '请选择标签', trigger: 'blur' }],
- isOften: [{ required: true, message: '请选择是否高发', trigger: 'blur' }]
- },
- pageSize: 10,
- // 富文本
- content: '',
- // 图片上传部分
- imageList: [],
- imageStrList: [],
- imageName: '',
- imageUrl: '',
- imageDesc: '',
- // 图片预览部分
- dialogImageUrl: '',
- imageVisible: false,
- // 附件部分
- annexList: [],
- annexObjList: [],
- // 标签部分
- dialogVisibleTag: false,
- tag: '',
- tagList: [],
- checkTags: [],
- checkList: [],
- tagNameList: [],
- tagNameListAll: [],
- tagIndex: 0,
- tagAction: 0, // 0:查询 1:新增和修改 2:批量修改
- multipleSelection: [],
- updateForm: {},
- // 查看图片
- dialogShowImage: false,
- yulanName: '',
- yulanLabel: '',
- yulanContent: '',
- yulanImageList: [],
- yulanAnnex: {},
- downloadMsg: '是否下载隐患档案?'
- }
- },
- watch: {
- 'search.scene'(val) {
- console.log(val)
- this.choseScene(val)
- },
- 'form.scene'(val) {
- console.log(val)
- this.choseScene2(val)
- }
- },
- mounted() {
- this.initDict(this.dc_key)
- .then((res) => {
- this.initArea().then(() => {
- this.loading = true
- this.getTagsNameAll()
- })
- })
- },
- methods: {
- choseScene(val) {
- console.log(val)
- if (val == 0) {
- this.myHIDDEN_TROUBLE_TYPE = this.dc_data['燃气_RQSSYH_YHLX_DM']
- } else if (val == 6) {
- this.myHIDDEN_TROUBLE_TYPE = this.dc_data['道路_CSDL_TXYHLX_DM']
- } else if (val == 4) {
- this.myHIDDEN_TROUBLE_TYPE = this.dc_data['综合管线_JHFXYH_YHLX_DM']
- } else if (val == 2) {
- this.myHIDDEN_TROUBLE_TYPE = this.dc_map['供水_HIDDEN_TROUBLE_TYPE']
- } else {
- this.myHIDDEN_TROUBLE_TYPE = []
- }
- this.search.type = ''
- },
- choseScene2(val) {
- console.log(val)
- if (val == 0) {
- this.HIDDEN_TROUBLE_TYPE_form = this.dc_data['燃气_RQSSYH_YHLX_DM']
- } else if (val == 6) {
- this.HIDDEN_TROUBLE_TYPE_form = this.dc_data['道路_CSDL_TXYHLX_DM']
- } else if (val == 4) {
- this.HIDDEN_TROUBLE_TYPE_form = this.dc_data['综合管线_JHFXYH_YHLX_DM']
- } else if (val == 2) {
- this.HIDDEN_TROUBLE_TYPE_form = this.dc_data['供水_HIDDEN_TROUBLE_TYPE']
- } else {
- this.HIDDEN_TROUBLE_TYPE_form = []
- this.form.type = ''
- }
- // this.form.hiddenTroubleType=''
- },
- getData: function() {
- const _this = this
- _this.loading = true
- _this.AllData = []
- this.search.pageNum = this.currentPage
- this.search.pageSize = this.pageSize
- this.baseRequest('pitfallList', this.search)
- .then((res) => {
- if (res.data.rows) {
- res.data.rows.forEach(function(item) {
- const json = _this.getItemJson(item)
- _this.AllData.push(json)
- })
- _this.allpage = res.data.total
- }
- _this.loading = false
- })
- .catch(() => {
- })
- // this.initOutData()
- },
- handleSearch: function() {
- this.getData()
- },
- handleReset: function() {
- for (const i in this.search) {
- if (i !== 'pageNum' && i !== 'pageSize') {
- this.search[i] = ''
- }
- }
- this.handleSearch()
- },
- initOutData: function() {
- const _this = this
- this.OutData = []
- const title = [
- ' 序号',
- ' 专项场景',
- ' 行政区划',
- ' 隐患名称',
- ' 隐患类型',
- ' 隐患等级',
- ' 标签',
- ' 关键字'
- ]
- this.OutData.push(title)
- return this.baseRequest('pitfallListAll', this.search)
- .then((res) => {
- if (res.data) {
- res.data.forEach(function(item, index) {
- const jsonMap = _this.getItemJson(item)
- const jsonArray = []
- jsonArray.push(jsonMap.id)
- jsonArray.push(jsonMap.scene)
- jsonArray.push(jsonMap.area)
- jsonArray.push(jsonMap.name)
- jsonArray.push(jsonMap.type)
- jsonArray.push(jsonMap.level)
- jsonArray.push(jsonMap.label)
- jsonArray.push(jsonMap.area)
- _this.OutData.push(jsonArray)
- })
- }
- })
- .catch(() => {
- })
- },
- getItemJson: function(item) {
- if (item.scene == 0) {
- item.type = this.dc_map['燃气_RQSSYH_YHLX_DM'][item.type]
- } else if (item.scene == 6) {
- item.type = this.dc_map['道路_CSDL_TXYHLX_DM'][item.type]
- } else if (item.scene == 4) {
- item.type = this.dc_map['综合管线_JHFXYH_YHLX_DM'][item.type]
- } else if (item.scene == 2) {
- item.type = this.dc_map['供水_HIDDEN_TROUBLE_TYPE'][item.type]
- }
- item.scene = this.dc_map.NOTICE_SCENE[item.scene]
- item.level = this.dc_map.HIDDEN_TROUBLE_GRADE[item.level]
- item.area = this.returnArea(item.area)
- // item.type = this.dc_map.HIDDEN_TROUBLE_TYPE[item.type]
- if (item.label && item.label !== null && item.label !== '') {
- item.label = this.setTagName(item.label).join(',')
- }
- return item
- },
- initForm: function() {
- return {
- scene: '',
- image: '',
- content: '',
- name: '',
- label: '',
- annex: '',
- releaseTime: '',
- state: '1',
- orderNum: '',
- tags: '',
- ifOften: ''
- }
- },
- confirmOutput() {
- const OutSize = [
- { wch: 15 },
- { wch: 15 },
- { wch: 15 },
- { wch: 15 },
- { wch: 15 },
- { wch: 15 },
- { wch: 15 }
- ]
- const fileName = '隐患档案导出 ' + new Date().Format('yyyyMMddhhmm')
- this.initOutData().then(() => {
- this.$outputXlsxFile(this.OutData, OutSize, fileName)
- })
- },
- dlgOpen: function() {
- const _this = this
- if (_this.form.id !== '') {
- const postData = {
- id: _this.form.id
- }
- this.baseRequest('getPitfallById', postData)
- .then((res) => {
- if (res.data) {
- _this.form = Object.assign({}, _this.form, res.data)
- _this.form.feedbackTime = this.$common.transDateStr(_this.form.feedbackTime, constant.DATE_PATTERN.DATE_TIME_h)
- // 处理标签信息
- if (_this.form.label && _this.form.label !== null && _this.form.label !== '') {
- _this.checkList = _this.form.label.split(',')
- _this.checkTags = _this.setTagName(_this.form.label)
- _this.form.tags = _this.checkTags.join(',')
- }
- // 处理附件
- _this.annexList = []
- _this.annexObjList = []
- if (_this.form.annex !== '') {
- // 存量数据是一个附件,需求要改成多个附件
- if (Array.isArray(JSON.parse(_this.form.annex))) {
- _this.annexObjList = Object.values(JSON.parse(_this.form.annex))
- _this.annexObjList.forEach(obj => {
- if (obj.uid != null && obj.name != null && obj.url != null) {
- _this.annexList.push({
- uid: obj.uid,
- name: obj.name,
- url: obj.url
- })
- }
- })
- } else {
- const annexObj = JSON.parse(_this.form.annex)
- if (annexObj.name) {
- _this.annexObjList.push({
- uid: 0,
- name: annexObj.name,
- url: annexObj.data.msg
- })
- _this.annexList.push({
- uid: 0,
- name: annexObj.name,
- url: annexObj.data.msg
- })
- }
- }
- }
- }
- })
- .catch(() => {
- })
- }
- },
- /* 编辑*/
- handleEdit: function(val) {
- this.isAdd = false
- this.form.id = val.id
- this.content = val.content
- this.imageList = []
- this.imageStrList = []
- this.annexList = []
- this.annexObjList = []
- this.checkTags = []
- this.checkList = []
- this.tagNameList = []
- this.tagIndex = 0
- this.dialogVisible = true
- this.dialogTitle = '修改隐患档案'
- },
- /* 新增*/
- handleAdd: function() {
- this.form = this.initForm()
- this.isAdd = true
- this.content = ''
- this.imageList = []
- this.imageStrList = []
- this.annexList = []
- this.annexObjList = []
- this.checkTags = []
- this.checkList = []
- this.tagNameList = []
- this.tagIndex = 0
- this.dialogVisible = true
- this.dialogTitle = '新增隐患档案'
- },
- confirmSubmit: function() {
- const _this = this
- _this.form.annex = JSON.stringify(_this.annexObjList)
- this.$refs.form.validate((valid) => {
- if (valid) {
- let soaUrl = 'editPitfall'
- const extraData = {}
- const postData = Object.assign({}, _this.form, extraData)
- if (this.isAdd) {
- soaUrl = 'addPitfall'
- }
- this.opRecord(postData, soaUrl)
- } else {
- // //console.log('error submit!!')
- return false
- }
- })
- },
- baseRequest(opUrl, postData) {
- return this.$channel.globeRequest(
- 'ArchivesEventController',
- opUrl,
- postData,
- 'project'
- )
- },
- getContent(content) {
- this.content = content
- this.form.content = content
- },
- // 删除
- handleDel(val) {
- const message = '确认要删除该条隐患档案?'
- this.confirm(message, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.baseRequest('removePitfall/' + val.id, '')
- .then((res) => {
- this.getData()
- })
- .catch(() => {
- })
- })
- },
- // 附件部分
- uploadAnnex: function(file) {
- this.uploadAnnexGetStr(file, '/ArchivesEventController/upload').then(str => {
- this.annexObjList.push(str)
- })
- },
- // 标签部分
- dealLabel() {
- // 批量处理标签
- const ids = []
- this.multipleSelection.forEach((item) => {
- ids.push(item.id)
- })
- const postData = {
- ids: ids.join(','),
- tags: this.updateForm.label
- }
- this.baseRequest('updatePitfallTag', postData)
- .then((res) => {
- this.getData()
- })
- }
- }
- }
- </script>
- <style scoped>
- span.span_red {
- color: red;
- }
- .ch-input .el-input__inner {
- border-color: #32323a;
- }
- .ch-input-size {
- width: 150px;
- }
- .ch-button {
- border-color: #32323a;
- background-color: #32323a;
- color: #fff;
- }
- .ch-button-warning {
- margin-left: 10px;
- border-color: #e6a23c;
- background-color: #e6a23c;
- color: #fff;
- }
- .ch-button-export {
- margin-left: 10px;
- border-color: #98cc1f;
- background-color: #98cc1f;
- color: #fff;
- }
- /deep/ .el-dialog__header {
- padding: 20px 30px 0px 30px;
- text-align: left;
- }
- /deep/ .el-dialog__body {
- padding: 10px 20px;
- }
- </style>
|