index.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940
  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 responsibleOptions"
  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 { 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. principalOptions: [],
  320. // 弹出层标题
  321. title: "",
  322. // 部门树选项
  323. deptOptions: undefined,
  324. clientHeight:300,
  325. // 是否显示弹出层
  326. open: false,
  327. // 用户导入参数
  328. upload: {
  329. // 是否显示弹出层(用户导入)
  330. open: false,
  331. // 弹出层标题(用户导入)
  332. title: "",
  333. // 是否禁用上传
  334. isUploading: false,
  335. // 是否更新已经存在的用户数据
  336. updateSupport: 0,
  337. // 设置上传的请求头部
  338. headers: { Authorization: "Bearer " + getToken() },
  339. // 上传的地址
  340. url: process.env.VUE_APP_BASE_API + "/plant/targetmeasures/importData"
  341. },
  342. // 报告附件参数
  343. doc: {
  344. file: "",
  345. // 是否显示弹出层(报告附件)
  346. open: false,
  347. // 弹出层标题(报告附件)
  348. title: this.$t('附件'),
  349. // 是否禁用上传
  350. isUploading: false,
  351. // 是否更新已经存在的用户数据
  352. updateSupport: 0,
  353. // 报告附件上传位置编号
  354. ids: 0,
  355. // 设置上传的请求头部
  356. headers: { Authorization: "Bearer " + getToken() },
  357. // 上传的地址
  358. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  359. commonfileList: null,
  360. queryParams: {
  361. pId: null,
  362. pType: ''
  363. },
  364. pType: '',
  365. pId: null,
  366. form: {}
  367. },
  368. pdf : {
  369. title: '',
  370. pdfUrl: '',
  371. numPages: null,
  372. open: false,
  373. pageNum: 1,
  374. pageTotalNum: 1,
  375. loadedRatio: 0,
  376. },
  377. // 查询参数
  378. queryParams: {
  379. pageNum: 1,
  380. pageSize: 20
  381. },
  382. //人员表查询参数
  383. staffmgrQueryParams: {
  384. actualposts: "12,14,16,18,20,24,26"
  385. },
  386. staffmgrPrincipal: {
  387. actualposts: null
  388. },
  389. // 表单参数
  390. form: {},
  391. // 表单校验
  392. rules: {
  393. measures: [
  394. { required: true, message: this.$t('方案/行动计划/措施') + this.$t('不能为空'), trigger: "blur" }
  395. ],
  396. expectedDate: [
  397. { required: true, message: this.$t('计划完成日期') + this.$t('不能为空'), trigger: "blur" }
  398. ],
  399. deptId: [
  400. { required: true, message: this.$t('部门编号') +this.$t('不能为空'), trigger: "blur" }
  401. ]
  402. },
  403. //下载按钮参数
  404. download: {
  405. // 是否显示弹出层(用户导入)
  406. open: false,
  407. // 弹出层标题(用户导入)
  408. title: "",
  409. },
  410. //下载参数
  411. downloadForm: {
  412. year: '',
  413. },
  414. downloadAction: process.env.VUE_APP_BASE_API +'/plant/targetmeasures/exportPDF',
  415. };
  416. },
  417. watch: {
  418. // 根据名称筛选部门树
  419. deptName(val) {
  420. this.$refs.tree.filter(val);
  421. }
  422. },
  423. created() {
  424. //设置表格高度对应屏幕高度
  425. this.$nextTick(() => {
  426. this.clientHeight = document.body.clientHeight -250
  427. })
  428. this.getResponsible();
  429. this.getPrincipal();
  430. this.getTreeselect();
  431. },
  432. methods: {
  433. /** 查询目标措施列表 */
  434. getList() {
  435. let _this = this
  436. this.loading = true;
  437. listMeasures(this.queryParams).then(response => {
  438. response.rows.forEach(function (value,key,arr) {
  439. var responsiblesName = null;
  440. if (value.responsible != null) {
  441. let responsibles = value.responsible.split(",");
  442. responsibles.forEach(function (id, index) {
  443. _this.responsibleOptions.forEach(function (item) {
  444. if (item.staffid === id) {
  445. if (index === 0) {
  446. responsiblesName = item.name
  447. }else {
  448. responsiblesName = responsiblesName + "," + item.name
  449. }
  450. }
  451. });
  452. });
  453. }
  454. response.rows[key].responsible = responsiblesName;
  455. });
  456. this.targetlistList = response.rows;
  457. this.total = response.total;
  458. this.loading = false;
  459. });
  460. },
  461. /** 查询部门下拉树结构 */
  462. getTreeselect() {
  463. treeselect().then(response => {
  464. this.deptOptions = response.data;
  465. });
  466. },
  467. getResponsible() {
  468. listStaffmgr(this.staffmgrQueryParams).then(response => {
  469. this.responsibleOptions = response.rows;
  470. this.getList();
  471. });
  472. },
  473. getPrincipal() {
  474. listStaffmgr(this.staffmgrPrincipal).then(response => {
  475. this.principalOptions = response.rows;
  476. });
  477. },
  478. // 取消按钮
  479. cancel() {
  480. this.open = false;
  481. this.reset();
  482. },
  483. // 表单重置
  484. reset() {
  485. this.form = {
  486. id: null,
  487. targetlistId: null,
  488. item: null,
  489. description: null,
  490. targets: null,
  491. year: null,
  492. measures: null,
  493. responsible: null,
  494. expectedDate: null,
  495. firstquarter: null,
  496. halfyear: null,
  497. threequarter: null,
  498. annual: null,
  499. firstquarterStatus: null,
  500. halfyearStatus: null,
  501. threequarterStatus: null,
  502. annualStatus: null,
  503. firstChecker: null,
  504. secondChecker: null,
  505. threeChecker: null,
  506. annualChecker: null,
  507. delFlag: null,
  508. createrCode: null,
  509. createdate: null,
  510. updaterCode: null,
  511. updatedate: null,
  512. deptId: null,
  513. remarks: null
  514. };
  515. this.resetForm("form");
  516. },
  517. /** 搜索按钮操作 */
  518. handleQuery() {
  519. this.queryParams.pageNum = 1;
  520. this.getList();
  521. },
  522. /** 重置按钮操作 */
  523. resetQuery() {
  524. this.resetForm("queryForm");
  525. this.handleQuery();
  526. },
  527. // 多选框选中数据
  528. handleSelectionChange(selection) {
  529. this.ids = selection.map(item => item.id)
  530. this.single = selection.length!==1
  531. this.multiple = !selection.length
  532. },
  533. /** 新增按钮操作 */
  534. handleAdd(row) {
  535. this.reset();
  536. const id = row.id || this.ids
  537. getTargetlist(id).then(response => {
  538. this.form.year = response.data.year;
  539. this.form.item = response.data.item;
  540. this.form.description = response.data.description;
  541. this.form.targets = response.data.targets;
  542. this.form.targetlistId = response.data.id;
  543. this.responsibles = [];
  544. this.open = true;
  545. this.title = this.$t('添加')+this.$t('目标措施');
  546. });
  547. },
  548. /** 修改按钮操作 */
  549. handleUpdate(row) {
  550. this.reset();
  551. const id = row.id || this.ids
  552. const measuresId = row.measuresId;
  553. getTargetmeasures(measuresId).then(response => {
  554. this.form = response.data;
  555. if (this.form.responsible != null) {
  556. this.responsibles = this.form.responsible.split(',');
  557. }else {
  558. this.responsibles = [];
  559. }
  560. getTargetlist(id).then(response => {
  561. this.form.year = response.data.year;
  562. this.form.item = response.data.item;
  563. this.form.description = response.data.description;
  564. this.form.targets = response.data.targets;
  565. this.open = true;
  566. this.title = this.$t('修改')+this.$t('目标措施');
  567. });
  568. });
  569. },
  570. /** 提交按钮 */
  571. submitForm() {
  572. var responsibleId = null;
  573. this.responsibles.forEach(function (value,key,arr) {
  574. if (key != 0) {
  575. responsibleId = responsibleId + "," + value;
  576. }else if (key == 0) {
  577. responsibleId = value;
  578. }
  579. })
  580. this.form.responsible = responsibleId;
  581. this.$refs["form"].validate(valid => {
  582. if (valid) {
  583. if (this.form.id != null) {
  584. updateTargetmeasures(this.form).then(response => {
  585. this.msgSuccess(this.$t('修改成功'));
  586. this.open = false;
  587. this.getList();
  588. });
  589. } else {
  590. addTargetmeasures(this.form).then(response => {
  591. this.msgSuccess(this.$t('新增成功'));
  592. this.open = false;
  593. this.getList();
  594. });
  595. }
  596. }
  597. });
  598. },
  599. /** 删除按钮操作 */
  600. handleDelete(row) {
  601. const ids = row.measuresId
  602. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  603. confirmButtonText: this.$t('确定'),
  604. cancelButtonText: this.$t('取消'),
  605. type: "warning"
  606. }).then(function() {
  607. return delTargetmeasures(ids);
  608. }).then(() => {
  609. this.getList();
  610. this.msgSuccess(this.$t('删除成功'));
  611. })
  612. },
  613. /** 导出按钮操作 */
  614. handleExport() {
  615. this.download.open = true;
  616. this.download.title = this.$t('导出目标跟踪表');
  617. },
  618. /** 下载按钮操作 */
  619. downloadOperate() {
  620. if (this.queryParams.year == null) {
  621. this.msgError(this.$t('请选择')+this.$t('年份'));
  622. }else {
  623. this.downloadForm.year = this.queryParams.year;
  624. this.$nextTick(() => {
  625. this.$refs['downloadForm'].submit()
  626. this.resetForm("queryForm");
  627. })
  628. }
  629. },
  630. /** 导入按钮操作 */
  631. handleImport() {
  632. this.upload.title = this.$t('用户导入');
  633. this.upload.open = true;
  634. },
  635. /** 下载模板操作 */
  636. importTemplate() {
  637. importTemplate().then(response => {
  638. this.download(response.msg);
  639. });
  640. },
  641. // 文件上传中处理
  642. handleFileUploadProgress(event, file, fileList) {
  643. this.upload.isUploading = true;
  644. },
  645. // 文件上传成功处理
  646. handleFileSuccess(response, file, fileList) {
  647. this.upload.open = false;
  648. this.upload.isUploading = false;
  649. this.$refs.upload.clearFiles();
  650. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  651. this.getList();
  652. },
  653. // 提交上传文件
  654. submitFileForm() {
  655. this.$refs.upload.submit();
  656. },
  657. //合并单元格
  658. mergeMethod({ row, column, rowIndex, columnIndex }) {
  659. if (columnIndex === 0) {
  660. const _row = this.setTable(this.targetlistList).merge[rowIndex];
  661. const _col = _row > 0 ? 1 : 0;
  662. return {
  663. rowspan: _row,
  664. colspan: _col
  665. };
  666. }
  667. if (columnIndex === 1) {
  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 === 2) {
  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 === 3 ) {
  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 === 4 ) {
  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 === 5 ) {
  700. const _row = this.setTableTwo(this.targetlistList).merge[rowIndex];
  701. const _col = _row > 0 ? 1 : 0;
  702. return {
  703. rowspan: _row,
  704. colspan: _col
  705. };
  706. }
  707. if (columnIndex === 6 ) {
  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 === 7 ) {
  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 === 8 ) {
  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 === 9 ) {
  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 === 10 ) {
  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 === 11 ) {
  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 === 12 ) {
  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 === 13 ) {
  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 === 14 ) {
  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 === 15 ) {
  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 === 20 ) {
  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. },
  796. setTable(tableData) {
  797. let spanArr = [],
  798. concat = 0;
  799. tableData.forEach((item, index) => {
  800. if (index === 0) {
  801. spanArr.push(1);
  802. } else {
  803. if (item.item === tableData[index - 1].item) {
  804. //第一列需合并相同内容的判断条件
  805. spanArr[concat] += 1;
  806. spanArr.push(0);
  807. } else {
  808. spanArr.push(1);
  809. concat = index;
  810. }
  811. }
  812. });
  813. return {
  814. merge: spanArr
  815. };
  816. },
  817. setTableTwo(tableData) {
  818. let spanArr = [],
  819. concat = 0;
  820. tableData.forEach((item, index) => {
  821. if (index === 0) {
  822. spanArr.push(1);
  823. } else {
  824. if (item.measures === tableData[index - 1].measures) {
  825. //第一列需合并相同内容的判断条件
  826. spanArr[concat] += 1;
  827. spanArr.push(0);
  828. } else {
  829. spanArr.push(1);
  830. concat = index;
  831. }
  832. }
  833. });
  834. return {
  835. merge: spanArr
  836. };
  837. },
  838. /** 报告附件按钮操作 */
  839. handleDoc(row , fileType) {
  840. this.doc.pType = fileType
  841. this.doc.queryParams.pType = fileType
  842. this.doc.id = row.id;
  843. var titleType = '';
  844. if (fileType === 'targetMeasures-first') {
  845. titleType = this.$t('第一季度')+' '+this.$t('附件')
  846. }else if (fileType === 'targetMeasures-second') {
  847. titleType = this.$t('第二季度')+' '+this.$t('附件')
  848. }else if (fileType === 'targetMeasures-third') {
  849. titleType = this.$t('第三季度')+' '+this.$t('附件')
  850. }else {
  851. titleType = this.$t('第四季度')+' '+this.$t('附件')
  852. }
  853. this.doc.title = titleType;
  854. this.doc.open = true;
  855. this.doc.queryParams.pId = row.id
  856. this.doc.pId = row.id
  857. this.getFileList()
  858. this.$nextTick(() => {
  859. this.$refs.doc.clearFiles()
  860. })
  861. },
  862. getFileList (){
  863. allFileList(this.doc.queryParams).then(response => {
  864. response.forEach(element => {
  865. element["isEdit"] = false
  866. });
  867. response.forEach(element => {
  868. element["isAdd"] = false
  869. });
  870. this.doc.commonfileList = response;
  871. });
  872. },
  873. //附件上传中处理
  874. handleFileDocProgress(event, file, fileList) {
  875. this.doc.file = file;
  876. this.doc.isUploading = true;
  877. },
  878. //附件上传成功处理
  879. handleFileDocSuccess(response, file, fileList) {
  880. this.doc.isUploading = false;
  881. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  882. this.getFileList()
  883. },
  884. // 文件下载处理
  885. handleDownload(row) {
  886. var name = row.fileName;
  887. var url = row.fileUrl;
  888. var suffix = url.substring(url.lastIndexOf("."), url.length);
  889. const a = document.createElement('a')
  890. a.setAttribute('download', name)
  891. a.setAttribute('target', '_blank')
  892. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  893. a.click()
  894. },
  895. /** 删除按钮操作 */
  896. handleDeleteDoc(row) {
  897. const ids = row.id || this.ids;
  898. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  899. confirmButtonText: this.$t('确定'),
  900. cancelButtonText: this.$t('取消'),
  901. type: "warning"
  902. }).then(function() {
  903. return delCommonfile(ids);
  904. }).then(() => {
  905. this.getFileList()
  906. this.msgSuccess(this.$t('删除成功'));
  907. })
  908. },
  909. //pdf预览
  910. openPdf(){
  911. window.open(this.pdf.pdfUrl);//path是文件的全路径地址
  912. },
  913. handleSee (row){
  914. this.pdf.open =true
  915. this.pdf.title = row.fileName
  916. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
  917. },
  918. }
  919. };
  920. </script>
  921. <style scoped>
  922. /deep/.el-input.is-disabled .el-input__inner{
  923. background-color: #F5F7FA;
  924. border-color: #ecedf0;
  925. color: #636363;
  926. cursor: not-allowed;
  927. }
  928. </style>