index.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948
  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="$t('年份')" prop="year">
  5. <el-date-picker clearable size="small" style="width: 200px"
  6. v-model="queryParams.year"
  7. type="year"
  8. value-format="yyyy"
  9. :placeholder="$t('请选择')+$t('年份')">
  10. </el-date-picker>
  11. </el-form-item>
  12. <el-form-item :label="$t('负责人')" prop="responsible">
  13. <el-select v-model="queryParams.responsible" filterable :placeholder="$t('请选择')+$t('负责人')">
  14. <el-option
  15. v-for="dict in responsibleOptions2"
  16. :key="dict.staffid"
  17. :label="dict.name"
  18. :value="dict.staffid">
  19. <span style="float: left">{{ dict.name }}</span>
  20. <span style="float: right; color: #8492a6; font-size: 13px">{{ dict.staffid }}</span>
  21. </el-option>
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item>
  25. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('搜索') }}</el-button>
  26. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('重置') }}</el-button>
  27. </el-form-item>
  28. </el-form>
  29. <el-row :gutter="10" class="mb8">
  30. <el-col :span="1.5">
  31. <el-button
  32. type="primary"
  33. icon="el-icon-plus"
  34. size="mini"
  35. @click="handleAdd"
  36. :disabled="single"
  37. v-hasPermi="['plant:targetmeasures:add']"
  38. >{{ $t('新增') }}</el-button>
  39. </el-col>
  40. <el-col :span="1.5">
  41. <el-button
  42. type="warning"
  43. icon="el-icon-download"
  44. size="mini"
  45. @click="handleExport"
  46. v-hasPermi="['plant:targetmeasures:export']"
  47. >{{ $t('导出目标跟踪表') }}</el-button>
  48. </el-col>
  49. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  50. </el-row>
  51. <el-table v-loading="loading" :data="targetlistList" :span-method="mergeMethod" @selection-change="handleSelectionChange" :cell-class-name="tableCellClassName" :height="clientHeight" border>
  52. <el-table-column type="selection" width="50" align="center" />
  53. <el-table-column :label="$t('年份')" align="center" prop="year" width="50" />
  54. <el-table-column :label="$t('序号')" align="center" prop="item" width="50" />
  55. <el-table-column :label="$t('内容')" align="center" prop="description" width="270"/>
  56. <el-table-column :label="$t('目标')" align="center" prop="targets" />
  57. <el-table-column :label="$t('方案/行动计划/措施')" align="center" prop="measures" width="600" />
  58. <el-table-column :label="$t('负责人')" align="center" prop="responsible" width="200"/>
  59. <el-table-column :label="$t('计划完成日期')" align="center" prop="expectedDate" width="100">
  60. <template slot-scope="scope">
  61. <span>{{ parseTime(scope.row.expectedDate, '{y}-{m}-{d}') }}</span>
  62. </template>
  63. </el-table-column>
  64. <el-table-column :label="$t('操作')" align="center" fixed="right" width="110" class-name="small-padding fixed-width">
  65. <template slot-scope="scope">
  66. <el-button
  67. size="mini"
  68. type="text"
  69. icon="el-icon-edit"
  70. @click="handleUpdate(scope.row)"
  71. v-hasPermi="['plant:targetlist:edit']"
  72. v-if="scope.row.measures!=null"
  73. >{{ $t('修改') }}</el-button>
  74. <el-button
  75. size="mini"
  76. type="text"
  77. icon="el-icon-delete"
  78. @click="handleDelete(scope.row)"
  79. v-hasPermi="['plant:targetlist:remove']"
  80. v-if="scope.row.measures!=null"
  81. >{{ $t('删除') }}</el-button>
  82. </template>
  83. </el-table-column>
  84. </el-table>
  85. <pagination
  86. v-show="total>0"
  87. :total="total"
  88. :page.sync="queryParams.pageNum"
  89. :limit.sync="queryParams.pageSize"
  90. @pagination="getList"
  91. />
  92. <!-- 添加或修改目标措施对话框 -->
  93. <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
  94. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  95. <el-form-item :label="$t('年份')" prop="year">
  96. <el-input v-model="form.year" disabled />
  97. </el-form-item>
  98. <el-form-item :label="$t('序号')" prop="item">
  99. <el-input v-model="form.item" disabled />
  100. </el-form-item>
  101. <el-form-item :label="$t('内容')" prop="description">
  102. <el-input v-model="form.description" disabled />
  103. </el-form-item>
  104. <el-form-item :label="$t('目标')" prop="targets">
  105. <el-input v-model="form.targets" disabled />
  106. </el-form-item>
  107. <el-form-item :label="$t('方案/行动计划/措施')" prop="measures" label-width="150px">
  108. <el-input v-model="form.measures" :placeholder="$t('请输入') + $t('方案/行动计划/措施')" />
  109. </el-form-item>
  110. <el-row>
  111. <el-col :span="12">
  112. <el-form-item :label="$t('负责人')" prop="responsible">
  113. <el-select v-model="responsibles" filterable multiple :placeholder="$t('请选择') + $t('负责人')">
  114. <el-option
  115. v-for="dict in responsibleOptions"
  116. :key="dict.staffid"
  117. :label="dict.name"
  118. :value="dict.staffid">
  119. <span style="float: left">{{ dict.name }}</span>
  120. <span style="float: right; color: #8492a6; font-size: 13px">{{ dict.staffid }}</span>
  121. </el-option>
  122. </el-select>
  123. </el-form-item>
  124. </el-col>
  125. <el-col :span="12">
  126. <el-form-item :label="$t('计划完成日期')" prop="expectedDate" label-width="110px">
  127. <el-date-picker clearable size="small" style="width: 200px"
  128. v-model="form.expectedDate"
  129. type="date"
  130. value-format="yyyy-MM-dd"
  131. :placeholder="$t('请选择') + $t('计划完成日期')">
  132. </el-date-picker>
  133. </el-form-item>
  134. </el-col>
  135. </el-row>
  136. <el-row>
  137. <el-col :span="12">
  138. <el-form-item :label="$t('备注')" prop="remarks">
  139. <el-input v-model="form.remarks" :placeholder="$t('请输入') + $t('第四季度')" />
  140. </el-form-item>
  141. </el-col>
  142. <el-col :span="12">
  143. <el-form-item :label="$t('归属部门')" prop="deptId" label-width="110px">
  144. <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" :placeholder="$t('请选择') + $t('归属部门')" />
  145. </el-form-item>
  146. </el-col>
  147. </el-row>
  148. </el-form>
  149. <div slot="footer" class="dialog-footer">
  150. <el-button type="primary" @click="submitForm">{{ $t('确 定') }}</el-button>
  151. <el-button @click="cancel">{{ $t('取 消') }}</el-button>
  152. </div>
  153. </el-dialog>
  154. <!-- 用户导入对话框 -->
  155. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  156. <el-upload
  157. ref="upload"
  158. :limit="1"
  159. accept=".xlsx, .xls"
  160. :headers="upload.headers"
  161. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  162. :disabled="upload.isUploading"
  163. :on-progress="handleFileUploadProgress"
  164. :on-success="handleFileSuccess"
  165. :auto-upload="false"
  166. drag
  167. >
  168. <i class="el-icon-upload"></i>
  169. <div class="el-upload__text">
  170. {{ $t('将文件拖到此处,或') }}
  171. <em>{{ $t('点击上传') }}</em>
  172. </div>
  173. <div class="el-upload__tip" slot="tip">
  174. <el-checkbox v-model="upload.updateSupport" />{{ $t('是否更新已经存在的用户数据') }}
  175. <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
  176. </div>
  177. <div class="el-upload__tip" style="color:#ff0000" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
  178. </el-upload>
  179. <div slot="footer" class="dialog-footer">
  180. <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>
  181. <el-button @click="upload.open = false">{{ $t('取 消') }}</el-button>
  182. </div>
  183. </el-dialog>
  184. <!-- 下载对话框 -->
  185. <el-dialog v-dialogDrag :title="download.title" :visible.sync="download.open" width="400px" append-to-body>
  186. <el-form :model="queryParams" ref="queryForm" label-width="68px">
  187. <el-form-item :label="$t('年份')" prop="year">
  188. <el-date-picker clearable size="small" style="width: 200px"
  189. v-model="queryParams.year"
  190. type="year"
  191. value-format="yyyy"
  192. :placeholder="$t('请选择') + $t('年份')">
  193. </el-date-picker>
  194. </el-form-item>
  195. <el-form-item>
  196. <el-button type="cyan" icon="el-icon-download" size="mini" @click="downloadOperate">{{ $t('下载') }}</el-button>
  197. </el-form-item>
  198. </el-form>
  199. <form ref="downloadForm" :action="downloadAction" target="FORMSUBMIT">
  200. <input name="year" v-model="downloadForm.year" hidden />
  201. </form>
  202. </el-dialog>
  203. <!-- 报告附件对话框 -->
  204. <el-dialog v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="1000px" append-to-body >
  205. <el-upload
  206. ref="doc"
  207. :limit="50"
  208. :headers="doc.headers"
  209. :action="doc.url + '?pType=' + doc.pType + '&pId=' + doc.pId"
  210. :disabled="doc.isUploading"
  211. :on-progress="handleFileDocProgress"
  212. :on-success="handleFileDocSuccess"
  213. :auto-upload="true"
  214. drag
  215. >
  216. <i class="el-icon-upload"></i>
  217. <div class="el-upload__text">
  218. {{ $t('将文件拖到此处,或') }}
  219. <em>{{ $t('点击上传') }}</em>
  220. </div>
  221. </el-upload>
  222. <el-table :data="doc.commonfileList" border>
  223. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  224. <template slot-scope="scope">
  225. <a class="link-type" @click="handleDownload(scope.row)">
  226. <span>{{ scope.row.fileName }}</span>
  227. </a>
  228. </template>
  229. </el-table-column>
  230. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
  231. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  232. <el-table-column :label="$t('培训日期')" align="center" prop="pDate" width="150">
  233. <template slot-scope="scope">
  234. <el-date-picker
  235. v-if="scope.row.isEdit"
  236. v-model="scope.row.pDate"
  237. type="date"
  238. value-format="yyyy-MM-dd"
  239. :placeholder="$t('日期')">
  240. </el-date-picker>
  241. <span v-else>{{ parseTime(scope.row.pDate, '{y}-{m}-{d}') }}</span>
  242. </template>
  243. </el-table-column>
  244. <el-table-column :label="$t('操作')" align="center" width="220" class-name="small-padding fixed-width">
  245. <template slot-scope="scope">
  246. <el-button
  247. v-if="scope.row.fileName.endsWith('pdf')"
  248. size="mini"
  249. type="text"
  250. icon="el-icon-view"
  251. @click="handleSee(scope.row)"
  252. >{{ $t('预览') }}</el-button>
  253. <el-button
  254. size="mini"
  255. type="text"
  256. icon="el-icon-download"
  257. @click="handleDownload(scope.row)"
  258. >{{ $t('下载') }}</el-button>
  259. <el-button
  260. size="mini"
  261. type="text"
  262. icon="el-icon-delete"
  263. @click="handleDeleteDoc(scope.row)"
  264. v-hasPermi="['training:trainingrecords:file']"
  265. >{{ $t('删除') }}</el-button>
  266. </template>
  267. </el-table-column>
  268. </el-table>
  269. <el-dialog v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px" append-to-body>
  270. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  271. <el-button size="mini" type="text" @click="openPdf">{{$t('新页面打开PDF')}}</el-button></div>
  272. <div style="margin-top: -30px">
  273. <iframe :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
  274. </div>
  275. </el-dialog>
  276. <div slot="footer" class="dialog-footer">
  277. <!-- <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>-->
  278. <el-button @click="doc.open = false">{{ $t('返 回') }}</el-button>
  279. </div>
  280. </el-dialog>
  281. </div>
  282. </template>
  283. <script>
  284. import { getTargetmeasures, delTargetmeasures, addTargetmeasures, updateTargetmeasures, exportTargetmeasures, importTemplate} from "@/api/plant/targetmeasures";
  285. import { listMeasures, getTargetlist } from "@/api/plant/targetlist";
  286. import {listAllStaffmgr, listStaffmgr} from "@/api/plant/staffmgr";
  287. import { treeselect } from "@/api/system/dept";
  288. import { getToken } from "@/utils/auth";
  289. import {allFileList, delCommonfile } from "@/api/common/commonfile";
  290. import Treeselect from "@riophae/vue-treeselect";
  291. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  292. export default {
  293. name: "Targetmeasures",
  294. components: { Treeselect },
  295. data() {
  296. return {
  297. // 遮罩层
  298. loading: true,
  299. // 选中数组
  300. ids: [],
  301. // 非单个禁用
  302. single: true,
  303. // 非多个禁用
  304. multiple: true,
  305. // 显示搜索条件
  306. showSearch: false,
  307. // 总条数
  308. total: 0,
  309. //负责人多选
  310. responsibles: [],
  311. // 目标措施表格数据
  312. targetmeasuresList: [],
  313. // 目标录入表格数据
  314. targetlistList: [],
  315. //行动项表格数据
  316. targetactionList: [],
  317. // 人员字典
  318. responsibleOptions: [],
  319. responsibleOptions2: [],
  320. principalOptions: [],
  321. // 弹出层标题
  322. title: "",
  323. // 部门树选项
  324. deptOptions: undefined,
  325. clientHeight:300,
  326. // 是否显示弹出层
  327. open: false,
  328. // 用户导入参数
  329. upload: {
  330. // 是否显示弹出层(用户导入)
  331. open: false,
  332. // 弹出层标题(用户导入)
  333. title: "",
  334. // 是否禁用上传
  335. isUploading: false,
  336. // 是否更新已经存在的用户数据
  337. updateSupport: 0,
  338. // 设置上传的请求头部
  339. headers: { Authorization: "Bearer " + getToken() },
  340. // 上传的地址
  341. url: process.env.VUE_APP_BASE_API + "/plant/targetmeasures/importData"
  342. },
  343. // 报告附件参数
  344. doc: {
  345. file: "",
  346. // 是否显示弹出层(报告附件)
  347. open: false,
  348. // 弹出层标题(报告附件)
  349. title: this.$t('附件'),
  350. // 是否禁用上传
  351. isUploading: false,
  352. // 是否更新已经存在的用户数据
  353. updateSupport: 0,
  354. // 报告附件上传位置编号
  355. ids: 0,
  356. // 设置上传的请求头部
  357. headers: { Authorization: "Bearer " + getToken() },
  358. // 上传的地址
  359. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  360. commonfileList: null,
  361. queryParams: {
  362. pId: null,
  363. pType: ''
  364. },
  365. pType: '',
  366. pId: null,
  367. form: {}
  368. },
  369. pdf : {
  370. title: '',
  371. pdfUrl: '',
  372. numPages: null,
  373. open: false,
  374. pageNum: 1,
  375. pageTotalNum: 1,
  376. loadedRatio: 0,
  377. },
  378. // 查询参数
  379. queryParams: {
  380. pageNum: 1,
  381. pageSize: 20
  382. },
  383. //人员表查询参数
  384. staffmgrQueryParams: {
  385. actualposts: "12,14,16,18,20,24,26"
  386. },
  387. staffmgrPrincipal: {
  388. actualposts: null
  389. },
  390. // 表单参数
  391. form: {},
  392. // 表单校验
  393. rules: {
  394. measures: [
  395. { required: true, message: this.$t('方案/行动计划/措施') + this.$t('不能为空'), trigger: "blur" }
  396. ],
  397. expectedDate: [
  398. { required: true, message: this.$t('计划完成日期') + this.$t('不能为空'), trigger: "blur" }
  399. ],
  400. deptId: [
  401. { required: true, message: this.$t('部门编号') +this.$t('不能为空'), trigger: "blur" }
  402. ]
  403. },
  404. //下载按钮参数
  405. download: {
  406. // 是否显示弹出层(用户导入)
  407. open: false,
  408. // 弹出层标题(用户导入)
  409. title: "",
  410. },
  411. //下载参数
  412. downloadForm: {
  413. year: '',
  414. },
  415. downloadAction: process.env.VUE_APP_BASE_API +'/plant/targetmeasures/exportPDF',
  416. };
  417. },
  418. watch: {
  419. // 根据名称筛选部门树
  420. deptName(val) {
  421. this.$refs.tree.filter(val);
  422. }
  423. },
  424. created() {
  425. //设置表格高度对应屏幕高度
  426. this.$nextTick(() => {
  427. this.clientHeight = document.body.clientHeight -250
  428. })
  429. this.getResponsible();
  430. this.getResponsible2();
  431. this.getPrincipal();
  432. this.getTreeselect();
  433. },
  434. methods: {
  435. /** 查询目标措施列表 */
  436. getList() {
  437. let _this = this
  438. this.loading = true;
  439. listMeasures(this.queryParams).then(response => {
  440. response.rows.forEach(function (value,key,arr) {
  441. var responsiblesName = null;
  442. if (value.responsible != null) {
  443. let responsibles = value.responsible.split(",");
  444. responsibles.forEach(function (id, index) {
  445. _this.responsibleOptions2.forEach(function (item) {
  446. if (item.staffid === id) {
  447. if (index === 0) {
  448. responsiblesName = item.name
  449. }else {
  450. responsiblesName = responsiblesName + "," + item.name
  451. }
  452. }
  453. });
  454. });
  455. }
  456. response.rows[key].responsible = responsiblesName;
  457. });
  458. this.targetlistList = response.rows;
  459. this.total = response.total;
  460. this.loading = false;
  461. });
  462. },
  463. /** 查询部门下拉树结构 */
  464. getTreeselect() {
  465. treeselect().then(response => {
  466. this.deptOptions = response.data;
  467. });
  468. },
  469. getResponsible() {
  470. listStaffmgr(this.staffmgrQueryParams).then(response => {
  471. this.responsibleOptions = response.rows;
  472. this.getList();
  473. });
  474. },
  475. getResponsible2() {
  476. listAllStaffmgr(this.staffmgrQueryParams).then(response => {
  477. this.responsibleOptions2 = response.rows;
  478. this.getList();
  479. });
  480. },
  481. getPrincipal() {
  482. listStaffmgr(this.staffmgrPrincipal).then(response => {
  483. this.principalOptions = response.rows;
  484. });
  485. },
  486. // 取消按钮
  487. cancel() {
  488. this.open = false;
  489. this.reset();
  490. },
  491. // 表单重置
  492. reset() {
  493. this.form = {
  494. id: null,
  495. targetlistId: null,
  496. item: null,
  497. description: null,
  498. targets: null,
  499. year: null,
  500. measures: null,
  501. responsible: null,
  502. expectedDate: null,
  503. firstquarter: null,
  504. halfyear: null,
  505. threequarter: null,
  506. annual: null,
  507. firstquarterStatus: null,
  508. halfyearStatus: null,
  509. threequarterStatus: null,
  510. annualStatus: null,
  511. firstChecker: null,
  512. secondChecker: null,
  513. threeChecker: null,
  514. annualChecker: null,
  515. delFlag: null,
  516. createrCode: null,
  517. createdate: null,
  518. updaterCode: null,
  519. updatedate: null,
  520. deptId: null,
  521. remarks: null
  522. };
  523. this.resetForm("form");
  524. },
  525. /** 搜索按钮操作 */
  526. handleQuery() {
  527. this.queryParams.pageNum = 1;
  528. this.getList();
  529. },
  530. /** 重置按钮操作 */
  531. resetQuery() {
  532. this.resetForm("queryForm");
  533. this.handleQuery();
  534. },
  535. // 多选框选中数据
  536. handleSelectionChange(selection) {
  537. this.ids = selection.map(item => item.id)
  538. this.single = selection.length!==1
  539. this.multiple = !selection.length
  540. },
  541. /** 新增按钮操作 */
  542. handleAdd(row) {
  543. this.reset();
  544. const id = row.id || this.ids
  545. getTargetlist(id).then(response => {
  546. this.form.year = response.data.year;
  547. this.form.item = response.data.item;
  548. this.form.description = response.data.description;
  549. this.form.targets = response.data.targets;
  550. this.form.targetlistId = response.data.id;
  551. this.responsibles = [];
  552. this.open = true;
  553. this.title = this.$t('添加')+this.$t('目标措施');
  554. });
  555. },
  556. /** 修改按钮操作 */
  557. handleUpdate(row) {
  558. this.reset();
  559. const id = row.id || this.ids
  560. const measuresId = row.measuresId;
  561. getTargetmeasures(measuresId).then(response => {
  562. this.form = response.data;
  563. if (this.form.responsible != null) {
  564. this.responsibles = this.form.responsible.split(',');
  565. }else {
  566. this.responsibles = [];
  567. }
  568. getTargetlist(id).then(response => {
  569. this.form.year = response.data.year;
  570. this.form.item = response.data.item;
  571. this.form.description = response.data.description;
  572. this.form.targets = response.data.targets;
  573. this.open = true;
  574. this.title = this.$t('修改')+this.$t('目标措施');
  575. });
  576. });
  577. },
  578. /** 提交按钮 */
  579. submitForm() {
  580. var responsibleId = null;
  581. this.responsibles.forEach(function (value,key,arr) {
  582. if (key != 0) {
  583. responsibleId = responsibleId + "," + value;
  584. }else if (key == 0) {
  585. responsibleId = value;
  586. }
  587. })
  588. this.form.responsible = responsibleId;
  589. this.$refs["form"].validate(valid => {
  590. if (valid) {
  591. if (this.form.id != null) {
  592. updateTargetmeasures(this.form).then(response => {
  593. this.msgSuccess(this.$t('修改成功'));
  594. this.open = false;
  595. this.getList();
  596. });
  597. } else {
  598. addTargetmeasures(this.form).then(response => {
  599. this.msgSuccess(this.$t('新增成功'));
  600. this.open = false;
  601. this.getList();
  602. });
  603. }
  604. }
  605. });
  606. },
  607. /** 删除按钮操作 */
  608. handleDelete(row) {
  609. const ids = row.measuresId
  610. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  611. confirmButtonText: this.$t('确定'),
  612. cancelButtonText: this.$t('取消'),
  613. type: "warning"
  614. }).then(function() {
  615. return delTargetmeasures(ids);
  616. }).then(() => {
  617. this.getList();
  618. this.msgSuccess(this.$t('删除成功'));
  619. })
  620. },
  621. /** 导出按钮操作 */
  622. handleExport() {
  623. this.download.open = true;
  624. this.download.title = this.$t('导出目标跟踪表');
  625. },
  626. /** 下载按钮操作 */
  627. downloadOperate() {
  628. if (this.queryParams.year == null) {
  629. this.msgError(this.$t('请选择')+this.$t('年份'));
  630. }else {
  631. this.downloadForm.year = this.queryParams.year;
  632. this.$nextTick(() => {
  633. this.$refs['downloadForm'].submit()
  634. this.resetForm("queryForm");
  635. })
  636. }
  637. },
  638. /** 导入按钮操作 */
  639. handleImport() {
  640. this.upload.title = this.$t('用户导入');
  641. this.upload.open = true;
  642. },
  643. /** 下载模板操作 */
  644. importTemplate() {
  645. importTemplate().then(response => {
  646. this.download(response.msg);
  647. });
  648. },
  649. // 文件上传中处理
  650. handleFileUploadProgress(event, file, fileList) {
  651. this.upload.isUploading = true;
  652. },
  653. // 文件上传成功处理
  654. handleFileSuccess(response, file, fileList) {
  655. this.upload.open = false;
  656. this.upload.isUploading = false;
  657. this.$refs.upload.clearFiles();
  658. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  659. this.getList();
  660. },
  661. // 提交上传文件
  662. submitFileForm() {
  663. this.$refs.upload.submit();
  664. },
  665. //合并单元格
  666. mergeMethod({ row, column, rowIndex, columnIndex }) {
  667. if (columnIndex === 0) {
  668. const _row = this.setTable(this.targetlistList).merge[rowIndex];
  669. const _col = _row > 0 ? 1 : 0;
  670. return {
  671. rowspan: _row,
  672. colspan: _col
  673. };
  674. }
  675. if (columnIndex === 1) {
  676. const _row = this.setTable(this.targetlistList).merge[rowIndex];
  677. const _col = _row > 0 ? 1 : 0;
  678. return {
  679. rowspan: _row,
  680. colspan: _col
  681. };
  682. }
  683. if (columnIndex === 2) {
  684. const _row = this.setTable(this.targetlistList).merge[rowIndex];
  685. const _col = _row > 0 ? 1 : 0;
  686. return {
  687. rowspan: _row,
  688. colspan: _col
  689. };
  690. }
  691. if (columnIndex === 3 ) {
  692. const _row = this.setTable(this.targetlistList).merge[rowIndex];
  693. const _col = _row > 0 ? 1 : 0;
  694. return {
  695. rowspan: _row,
  696. colspan: _col
  697. };
  698. }
  699. if (columnIndex === 4 ) {
  700. const _row = this.setTable(this.targetlistList).merge[rowIndex];
  701. const _col = _row > 0 ? 1 : 0;
  702. return {
  703. rowspan: _row,
  704. colspan: _col
  705. };
  706. }
  707. if (columnIndex === 5 ) {
  708. const _row = this.setTableTwo(this.targetlistList).merge[rowIndex];
  709. const _col = _row > 0 ? 1 : 0;
  710. return {
  711. rowspan: _row,
  712. colspan: _col
  713. };
  714. }
  715. if (columnIndex === 6 ) {
  716. const _row = this.setTableTwo(this.targetlistList).merge[rowIndex];
  717. const _col = _row > 0 ? 1 : 0;
  718. return {
  719. rowspan: _row,
  720. colspan: _col
  721. };
  722. }
  723. if (columnIndex === 7 ) {
  724. const _row = this.setTableTwo(this.targetlistList).merge[rowIndex];
  725. const _col = _row > 0 ? 1 : 0;
  726. return {
  727. rowspan: _row,
  728. colspan: _col
  729. };
  730. }
  731. if (columnIndex === 8 ) {
  732. const _row = this.setTableTwo(this.targetlistList).merge[rowIndex];
  733. const _col = _row > 0 ? 1 : 0;
  734. return {
  735. rowspan: _row,
  736. colspan: _col
  737. };
  738. }
  739. if (columnIndex === 9 ) {
  740. const _row = this.setTableTwo(this.targetlistList).merge[rowIndex];
  741. const _col = _row > 0 ? 1 : 0;
  742. return {
  743. rowspan: _row,
  744. colspan: _col
  745. };
  746. }
  747. if (columnIndex === 10 ) {
  748. const _row = this.setTableTwo(this.targetlistList).merge[rowIndex];
  749. const _col = _row > 0 ? 1 : 0;
  750. return {
  751. rowspan: _row,
  752. colspan: _col
  753. };
  754. }
  755. if (columnIndex === 11 ) {
  756. const _row = this.setTableTwo(this.targetlistList).merge[rowIndex];
  757. const _col = _row > 0 ? 1 : 0;
  758. return {
  759. rowspan: _row,
  760. colspan: _col
  761. };
  762. }
  763. if (columnIndex === 12 ) {
  764. const _row = this.setTableTwo(this.targetlistList).merge[rowIndex];
  765. const _col = _row > 0 ? 1 : 0;
  766. return {
  767. rowspan: _row,
  768. colspan: _col
  769. };
  770. }
  771. if (columnIndex === 13 ) {
  772. const _row = this.setTableTwo(this.targetlistList).merge[rowIndex];
  773. const _col = _row > 0 ? 1 : 0;
  774. return {
  775. rowspan: _row,
  776. colspan: _col
  777. };
  778. }
  779. if (columnIndex === 14 ) {
  780. const _row = this.setTableTwo(this.targetlistList).merge[rowIndex];
  781. const _col = _row > 0 ? 1 : 0;
  782. return {
  783. rowspan: _row,
  784. colspan: _col
  785. };
  786. }
  787. if (columnIndex === 15 ) {
  788. const _row = this.setTableTwo(this.targetlistList).merge[rowIndex];
  789. const _col = _row > 0 ? 1 : 0;
  790. return {
  791. rowspan: _row,
  792. colspan: _col
  793. };
  794. }
  795. if (columnIndex === 20 ) {
  796. const _row = this.setTableTwo(this.targetlistList).merge[rowIndex];
  797. const _col = _row > 0 ? 1 : 0;
  798. return {
  799. rowspan: _row,
  800. colspan: _col
  801. };
  802. }
  803. },
  804. setTable(tableData) {
  805. let spanArr = [],
  806. concat = 0;
  807. tableData.forEach((item, index) => {
  808. if (index === 0) {
  809. spanArr.push(1);
  810. } else {
  811. if (item.item === tableData[index - 1].item) {
  812. //第一列需合并相同内容的判断条件
  813. spanArr[concat] += 1;
  814. spanArr.push(0);
  815. } else {
  816. spanArr.push(1);
  817. concat = index;
  818. }
  819. }
  820. });
  821. return {
  822. merge: spanArr
  823. };
  824. },
  825. setTableTwo(tableData) {
  826. let spanArr = [],
  827. concat = 0;
  828. tableData.forEach((item, index) => {
  829. if (index === 0) {
  830. spanArr.push(1);
  831. } else {
  832. if (item.measures === tableData[index - 1].measures) {
  833. //第一列需合并相同内容的判断条件
  834. spanArr[concat] += 1;
  835. spanArr.push(0);
  836. } else {
  837. spanArr.push(1);
  838. concat = index;
  839. }
  840. }
  841. });
  842. return {
  843. merge: spanArr
  844. };
  845. },
  846. /** 报告附件按钮操作 */
  847. handleDoc(row , fileType) {
  848. this.doc.pType = fileType
  849. this.doc.queryParams.pType = fileType
  850. this.doc.id = row.id;
  851. var titleType = '';
  852. if (fileType === 'targetMeasures-first') {
  853. titleType = this.$t('第一季度')+' '+this.$t('附件')
  854. }else if (fileType === 'targetMeasures-second') {
  855. titleType = this.$t('第二季度')+' '+this.$t('附件')
  856. }else if (fileType === 'targetMeasures-third') {
  857. titleType = this.$t('第三季度')+' '+this.$t('附件')
  858. }else {
  859. titleType = this.$t('第四季度')+' '+this.$t('附件')
  860. }
  861. this.doc.title = titleType;
  862. this.doc.open = true;
  863. this.doc.queryParams.pId = row.id
  864. this.doc.pId = row.id
  865. this.getFileList()
  866. this.$nextTick(() => {
  867. this.$refs.doc.clearFiles()
  868. })
  869. },
  870. getFileList (){
  871. allFileList(this.doc.queryParams).then(response => {
  872. response.forEach(element => {
  873. element["isEdit"] = false
  874. });
  875. response.forEach(element => {
  876. element["isAdd"] = false
  877. });
  878. this.doc.commonfileList = response;
  879. });
  880. },
  881. //附件上传中处理
  882. handleFileDocProgress(event, file, fileList) {
  883. this.doc.file = file;
  884. this.doc.isUploading = true;
  885. },
  886. //附件上传成功处理
  887. handleFileDocSuccess(response, file, fileList) {
  888. this.doc.isUploading = false;
  889. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  890. this.getFileList()
  891. },
  892. // 文件下载处理
  893. handleDownload(row) {
  894. var name = row.fileName;
  895. var url = row.fileUrl;
  896. var suffix = url.substring(url.lastIndexOf("."), url.length);
  897. const a = document.createElement('a')
  898. a.setAttribute('download', name)
  899. a.setAttribute('target', '_blank')
  900. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  901. a.click()
  902. },
  903. /** 删除按钮操作 */
  904. handleDeleteDoc(row) {
  905. const ids = row.id || this.ids;
  906. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  907. confirmButtonText: this.$t('确定'),
  908. cancelButtonText: this.$t('取消'),
  909. type: "warning"
  910. }).then(function() {
  911. return delCommonfile(ids);
  912. }).then(() => {
  913. this.getFileList()
  914. this.msgSuccess(this.$t('删除成功'));
  915. })
  916. },
  917. //pdf预览
  918. openPdf(){
  919. window.open(this.pdf.pdfUrl);//path是文件的全路径地址
  920. },
  921. handleSee (row){
  922. this.pdf.open =true
  923. this.pdf.title = row.fileName
  924. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
  925. },
  926. }
  927. };
  928. </script>
  929. <style scoped>
  930. /deep/.el-input.is-disabled .el-input__inner{
  931. background-color: #F5F7FA;
  932. border-color: #ecedf0;
  933. color: #636363;
  934. cursor: not-allowed;
  935. }
  936. </style>