TrackManagement.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889
  1. <template>
  2. <div>
  3. <el-drawer title="跟踪管理记录" :visible.sync="showDrawerTow" direction="btt" class="all-derawer" :before-close="handleClose">
  4. <div class="flex-box" style="height: calc(100vh - 10%);">
  5. <div class="drawer-left scroll-bar">
  6. <div class="draft-content" v-for="(item, index) in actionPlanList" :key="index" v-if="item.index.length > 0">
  7. <div class="drawer-left-title font-flex-word">{{ item.name }}</div>
  8. <div
  9. class="drawer-item flex-box-ce"
  10. :class="[activeDrawerIndex == index + '-' + index2 ? 'active-drawer-item' : '']"
  11. v-for="(item2, index2) in item.index"
  12. :key="index2"
  13. @click="activeItem(index, index2, item2)"
  14. >
  15. <div style="width:200px;" class="font-flex-word">{{ item2.name }}</div>
  16. <div style="padding: 0 10px;" class="blue">({{ item2.mamage_record.length }})</div>
  17. </div>
  18. </div>
  19. </div>
  20. <div class="drawer-right flex-box-v scroll-bar flex-1" style="overflow: auto;background-color: #fff;">
  21. <div class="drawer-right-header">
  22. <div class="drawer-right-title">{{ indexItem.name }}</div>
  23. <div class="yellow" style="margin: 10px 0;">考核标准</div>
  24. <div class="remark">{{ indexItem.per_remark }}</div>
  25. </div>
  26. <div class="drawer-right-main">
  27. <div class="flex-box-ce">
  28. <div class="flex-1" style="font-size: 16px;">跟踪管理记录</div>
  29. <el-button type="primary" size="mini" @click="addPlan()" v-if="!isShowAdd && !isFill && isOperation && isCz && isOperationTwo">新增</el-button>
  30. </div>
  31. </div>
  32. <div class="flex-box flex-1" v-if="indexItem.mamage_record.length > 0">
  33. <div class="plan-left flex-3">
  34. <div
  35. class="plan-left-content"
  36. @click="activePlan(item, index)"
  37. :class="[activePlanIndex == index ? 'active-drawer-item' : '']"
  38. v-for="(item, index) in indexItem.mamage_record"
  39. :key="index"
  40. >
  41. <div class="flex-box-ce">
  42. <div class="plan-right-name flex-1" v-if="item.employee_id">记录人:{{ $getEmployeeList()[item.employee_id].name }}</div>
  43. <i v-if="item.append.length > 0" class="el-icon-paperclip fontColorB" style="font-size: 18px;padding-right: 10px;"></i>
  44. <div class="fontColorB">{{ item.date }}</div>
  45. </div>
  46. <div class="plan-title">{{ item.title }}</div>
  47. </div>
  48. </div>
  49. <div class="plan-right flex-2">
  50. <div class="flex-box-end btns" v-if="isOperation && isCz && isOperationTwo">
  51. <el-button class="dangerBtn" size="mini" round plain @click="deletePlan()">删除</el-button>
  52. <el-button class="primaryBtn" size="mini" round @click="saveActionPlan()">提交</el-button>
  53. </div>
  54. <div class="plan-right-date fontColorB">{{ planData.date }}</div>
  55. <el-input
  56. type="textarea"
  57. @blur="inputBlur"
  58. @focus="inputFocus"
  59. @input="inputText"
  60. class="plan-right-title"
  61. rows="6"
  62. clearable
  63. ref="inputTitle"
  64. placeholder="请输入跟踪管理记录内容"
  65. v-model="planData.title"
  66. maxlength="200"
  67. show-word-limit
  68. ></el-input>
  69. <el-input
  70. ref="inputTitle2"
  71. type="textarea"
  72. @blur="inputBlur"
  73. @focus="inputFocus"
  74. @input="inputText"
  75. class="plan-textarea"
  76. rows="5"
  77. maxlength="500"
  78. show-word-limit
  79. clearable
  80. placeholder="选填,请输入备注"
  81. v-model="planData.remark"
  82. ></el-input>
  83. <div style="margin-bottom: 20px;" class="flex-box-ce fontColorF">
  84. <el-button class="primaryBtn" icon="el-icon-paperclip" plain size="small" @click="uploadOss">附件</el-button>
  85. <div style="padding-left:10px;font-size: 12px;">附件存放在企业钉盘,请确保钉盘有足够空间</div>
  86. </div>
  87. <div class="">
  88. <div v-for="(item, index) in planData.append" style="cursor: pointer;margin-bottom: 5px;" :key="index" class="blue flex-box-ce">
  89. <i class="el-icon-paperclip fontColorB" style="font-size: 18px;padding-right: 10px;"></i>
  90. <div style="width: 400px;" class="font-flex-word" @click="openImg(item)">{{ item.fileName }}</div>
  91. <i class="el-icon-close red" @click="deleteFile(index)" style="font-size: 18px;padding-left: 10px;"></i>
  92. </div>
  93. </div>
  94. <!-- <div style="margin-bottom: 20px;">
  95. <uploadOss
  96. :headers="Xtoken"
  97. class="avatar-uploader"
  98. :action="'https://' + 'integralsys.oss-cn-shenzhen.aliyuncs.com'"
  99. :show-file-list="true"
  100. :file-list="img_fileList"
  101. :on-success="handleFilesSuccess"
  102. :on-preview="onFilePreView"
  103. :before-upload="beforeUpload"
  104. :on-remove="onFileRemove"
  105. :limit="3"
  106. :multiple="true"
  107. >
  108. <el-button class="primaryBtn" icon="el-icon-picture-outline" plain size="small">图片</el-button>
  109. </uploadOss>
  110. </div>
  111. <div>
  112. <uploadOss
  113. class="avatar-uploader"
  114. :headers="Xtoken"
  115. :show-file-list="true"
  116. :multiple="true"
  117. ref="upload"
  118. :limit="1"
  119. :file-list="file_fileList"
  120. :action="'https://' + 'integralsys.oss-cn-shenzhen.aliyuncs.com'"
  121. :on-preview="onFilePreView2"
  122. :on-remove="handleRemove"
  123. :on-success="handleSuccess"
  124. :before-upload="beforeFilesUpload"
  125. >
  126. <el-button class="primaryBtn" icon="el-icon-paperclip" plain size="small">附件</el-button>
  127. </uploadOss>
  128. </div> -->
  129. </div>
  130. </div>
  131. <div v-else style="background-color: #fff;">
  132. <el-alert title="跟踪管理记录用来做什么?" type="info" description show-icon>
  133. <div class="alert-text">
  134. 1、填写工作执行过程的实际情况、表现好坏及奖惩情况
  135. <br />
  136. 2、填写管理指导的过程记录
  137. <br />
  138. 3、填写的内容可以给评分人作为参考
  139. </div>
  140. </el-alert>
  141. <NoData content="暂无跟踪管理记录" imgW="150px" imgH="100px">
  142. <el-button type="primary" round style="width: 100px;margin: 0 auto;margin-top: 10px;" @click="addPlan()" v-if="isOperation && isCz && isOperationTwo">
  143. <i class="el-icon-plus"></i>
  144. 新建
  145. </el-button>
  146. </NoData>
  147. </div>
  148. </div>
  149. </div>
  150. </el-drawer>
  151. <el-dialog title="图片查看" :visible.sync="isShowImg" width="50%">
  152. <img :src="imgUrl" style="width: 100%;" />
  153. <span slot="footer" class="dialog-footer">
  154. <el-button @click="isShowImg = false">取 消</el-button>
  155. <el-button type="primary" @click="isShowImg = false">确 定</el-button>
  156. </span>
  157. </el-dialog>
  158. </div>
  159. </template>
  160. <script>
  161. import uploadOss from '@/components/public/upload';
  162. export default {
  163. components: {
  164. uploadOss
  165. },
  166. name: 'TrackManagement',
  167. props: {
  168. id: {
  169. //员工考核记录的ID
  170. type: Number,
  171. default: 0
  172. },
  173. // 是否显示组件
  174. showDrawer: {
  175. type: Boolean,
  176. default: false
  177. },
  178. //数据源
  179. apList: {
  180. type: Array,
  181. default: () => {
  182. return [];
  183. }
  184. },
  185. //默认显示的指标 [0]:维度下标,[1]:指标下标
  186. planIndex: {
  187. type: Array,
  188. default: () => {
  189. return [];
  190. }
  191. },
  192. //绩效考核的被考核人ID
  193. assessId: {
  194. type: Number,
  195. default: 0
  196. },
  197. // 是否在关闭时刷新外面的表格,和是否可以操作
  198. isCz: {
  199. type: Boolean,
  200. default: true
  201. },
  202. // 指定管理者记录id,目前在我管理记录列表点击填写管理记录才有
  203. recordMemberIds: {
  204. type: Array,
  205. default: () => {
  206. return [];
  207. }
  208. }
  209. },
  210. data() {
  211. return {
  212. drawer: false,
  213. activeDrawerIndex: '0-0',
  214. actionPlanList: [],
  215. indexItem: {
  216. //选中的指标
  217. mamage_record: []
  218. },
  219. activePlanIndex: 0,
  220. planData: {
  221. //执行计划(单个)
  222. title: '',
  223. employee_id: '',
  224. images: [],
  225. append: [], //附件
  226. appendName: '' //附件名称
  227. },
  228. planData2: {}, //备用数据,当不修改时使用
  229. showDrawerTow: false,
  230. isFill: false, //是否填写了
  231. isFill2: false, //添加执行计划时用,判断是要清空添加的,还是还原编辑的数据
  232. isShowAdd: false,
  233. isOperation: false, //判断是否能操作执行计划
  234. selectItemIndex: 0, //维度当前下标
  235. isOperationTwo: true, //管理记录人是否能操作指定指标
  236. // 上传图标与附件
  237. Xtoken: {
  238. 'X-Token': this.$getToken()
  239. },
  240. img_fileList: [], // 图片附件
  241. file_fileList: [], //文件附件
  242. imgs: [],
  243. doc: '',
  244. isShowImg: false,
  245. imgUrl: '',
  246. userData: this.$getUserData(),
  247. spaceId: '' //上传到盯盘的spaceId
  248. };
  249. },
  250. watch: {
  251. showDrawer(val) {
  252. this.showDrawerTow = val;
  253. let isFiltration = true; //是否需要过滤数据源
  254. if (val) {
  255. this.superiorList(this.assessId).then(res => {
  256. if (this.$getRole(3)) {
  257. //如果员工
  258. isFiltration = false;
  259. this.isOperation = false;
  260. }
  261. if (this.recordMemberIds.length > 0) {
  262. //指定管理记录人中包含自己,就可操作
  263. this.recordMemberIds.some(item => {
  264. if (item == this.userData.id) {
  265. isFiltration = true;
  266. this.isOperation = true;
  267. return true;
  268. }
  269. });
  270. }
  271. let superior_list = res.data.data;
  272. superior_list.some(item => {
  273. //判断被考核人的上级是否包含登录者
  274. if (item.id == this.userData.id) {
  275. this.isOperation = true;
  276. isFiltration = false;
  277. return true;
  278. }
  279. });
  280. if (this.$getEmployeeList()[this.userData.id].is_creator == 1) {
  281. //如果是创始人也可以操作
  282. isFiltration = false;
  283. this.isOperation = true;
  284. }
  285. if (this.$isAuthoritys(3)) {
  286. //如果是子管理员并且管理范围权限为“全公司”
  287. isFiltration = false;
  288. this.isOperation = true;
  289. }
  290. if (isFiltration) {
  291. //当只是管理记录人员时设置指定数据
  292. let actionPlanList = JSON.parse(JSON.stringify(this.apList));
  293. actionPlanList.forEach((item, index) => {
  294. item.index.forEach(item2 => {
  295. item2.dimension_xb = index;
  296. item2.isOperation = false;
  297. if (item2.record_ids.indexOf(this.userData.id) >= 0) {
  298. item2.isOperation = true;
  299. }
  300. });
  301. });
  302. this.actionPlanList = actionPlanList;
  303. } else {
  304. this.apList.forEach((item, index) => {
  305. item.index.forEach(item2 => {
  306. item2.dimension_xb = index;
  307. item2.isOperation = true;
  308. });
  309. });
  310. this.actionPlanList = this.apList;
  311. }
  312. this.getShowData();
  313. });
  314. }
  315. }
  316. },
  317. methods: {
  318. openImg(item) {
  319. let corpId = this.$getCache('corpId');
  320. let loading = this.$loading({
  321. lock: true,
  322. text: 'Loading',
  323. spinner: 'el-icon-loading'
  324. // background: 'rgba(0, 0, 0, 0.7)'
  325. });
  326. if (item) {
  327. this.$axios('get', 'api/drive/grant',{file_id:item.fileId}).then(res => {
  328. this.$dd.ready(() => {
  329. this.$dd.biz.cspace.preview({
  330. corpId: corpId,
  331. spaceId: item.spaceId,
  332. fileId: item.fileId,
  333. fileName: item.fileName,
  334. fileSize: item.fileSize,
  335. fileType: item.fileType,
  336. onSuccess: function(res) {
  337. console.log(JSON.stringify(res))
  338. },
  339. onFail: function(err) {
  340. console.log(JSON.stringify(err))
  341. }
  342. });
  343. });
  344. }).finally(()=>{
  345. loading.close();
  346. });
  347. }
  348. },
  349. uploadOss() {
  350. let that = this;
  351. let corpId = this.$getCache('corpId');
  352. this.$axios('get', 'api/drive/info').then(res => {
  353. let spaceId = res.data.data.space_id.toString();
  354. console.log(spaceId,typeof(spaceId))
  355. this.$dd.ready(() => {
  356. this.$dd.biz.util.uploadAttachment({
  357. image: {
  358. multiple: true,
  359. compress: false,
  360. max: 5,
  361. spaceId: spaceId
  362. },
  363. space: {
  364. corpId: corpId,
  365. spaceId: spaceId,
  366. max: 5
  367. },
  368. file: {
  369. spaceId: spaceId,
  370. max: 5
  371. },
  372. compress: true,
  373. multiple: false,
  374. max: 5,
  375. spaceId: spaceId,
  376. types: ['photo', 'file', 'space'], //PC端支持["photo","file","space"]
  377. onSuccess: function(res) {
  378. console.log(JSON.stringify(res))
  379. let data = res.data;
  380. that.planData.append.push(...data);
  381. that.isFill = true;
  382. },
  383. onFail: function(err) {
  384. console.log(JSON.stringify(err))
  385. }
  386. });
  387. });
  388. });
  389. },
  390. //获取上级列表
  391. async superiorList(id) {
  392. return this.$axios('get', '/api/per/user/manager_list', {
  393. id_code: this.$returnCode(id)
  394. });
  395. },
  396. // 图片上传
  397. beforeUpload(file) {
  398. const isJPG = /^image\/(jpeg|png|jpg)$/.test(file.type);
  399. const isLt2M = file.size / 1024 / 1024 < 2;
  400. if (!isJPG) {
  401. this.$message.error('上传图片只能是 jpeg|png|jpg 格式!');
  402. }
  403. if (!isLt2M) {
  404. this.$message.error('上传图片大小不能超过 2MB!');
  405. }
  406. return isJPG && isLt2M;
  407. },
  408. onFilePreView(file) {
  409. if (file.url) {
  410. this.imgUrl = file.url;
  411. this.isShowImg = true;
  412. }
  413. },
  414. onFilePreView2(file) {
  415. window.open(file.url, '_blank');
  416. },
  417. onFileRemove(file, fileList) {
  418. this.img_fileList = fileList;
  419. this.planData.images = [];
  420. let images = [];
  421. fileList.forEach((element, index) => {
  422. images.push({
  423. url: element.url,
  424. name: element.name
  425. });
  426. });
  427. this.planData.images = images;
  428. this.isFill = true;
  429. },
  430. handleFilesSuccess(response, file, fileList) {
  431. this.img_fileList = fileList;
  432. this.planData.images = [];
  433. let images = [];
  434. fileList.forEach((element, index) => {
  435. images.push({
  436. url: element.url,
  437. name: element.name
  438. });
  439. });
  440. this.planData.images = images;
  441. this.isFill = true;
  442. },
  443. handleSuccess(response, file, fileList) {
  444. this.file_fileList = fileList;
  445. this.planData.append = fileList[0].url;
  446. this.planData.append_name = fileList[0].name;
  447. this.isFill = true;
  448. },
  449. handleRemove(file, fileList) {
  450. this.file_fileList = fileList;
  451. this.planData.append = '';
  452. this.planData.append_name = '';
  453. this.isFill = true;
  454. },
  455. beforeFilesUpload(file) {
  456. const $ext_list = ['xlsx', 'xls', 'doc', 'docx', 'pdf'];
  457. const isLt2M = file.size / 1024 / 1024 < 5;
  458. let len = file.name.split('.').length - 1;
  459. const $ext_name = file.name.split('.')[len];
  460. let isFile = $ext_list.indexOf($ext_name) != -1;
  461. if (!isLt2M) {
  462. this.$message.error('文件大小不能超过 5MB!');
  463. }
  464. if (!isFile) {
  465. this.$message.warning('文件格式上传错误,仅支持上传xlsx,xls,doc,docx,pdf)');
  466. }
  467. return isFile && isLt2M;
  468. },
  469. deletePlan() {
  470. this.$confirm('确认删除跟踪记录:' + this.planData.title + '?', {
  471. confirmButtonText: '确定',
  472. cancelButtonText: '取消',
  473. type: 'warning'
  474. })
  475. .then(() => {
  476. let data = {
  477. track_id: this.planData.id ? this.planData.id : '', //执行计划id 编辑的时候要传
  478. package_employee_id: this.id, //员工考核记录信息id
  479. index_id: this.indexItem.id, //指标id
  480. dimension_xb: this.selectItemIndex
  481. };
  482. if (this.planData.id) {
  483. if (this.planData.employee_id != this.userData.id) {
  484. this.$message.error('不能删除其他管理者的管理记录!');
  485. return false;
  486. }
  487. this.$axios('post', 'api/per/package/track/del', data).then(res => {
  488. this.indexItem.mamage_record.splice(this.activePlanIndex, 1);
  489. this.activePlanIndex = 0;
  490. this.planData = this.indexItem.mamage_record[0] ? this.indexItem.mamage_record[0] : [];
  491. this.isFill = false;
  492. this.isFill2 = false;
  493. this.$message.success('删除成功');
  494. });
  495. } else {
  496. this.indexItem.mamage_record.splice(this.activePlanIndex, 1);
  497. this.activePlanIndex = 0;
  498. this.planData = this.indexItem.mamage_record[0] ? this.indexItem.mamage_record[0] : [];
  499. this.isFill = false;
  500. this.isFill2 = false;
  501. this.$message.success('删除成功');
  502. }
  503. })
  504. .catch(() => {});
  505. },
  506. // 添加
  507. addPlan() {
  508. this.img_fileList = []; // 图片附件
  509. this.file_fileList = []; //文件附件
  510. let obj = {
  511. date: this.$moment().format('YYYY-MM-DD'),
  512. title: '',
  513. remark: '',
  514. images: [],
  515. append: [], //附件
  516. appendName: '' //附件名称
  517. };
  518. this.indexItem.mamage_record.unshift(obj);
  519. if (this.indexItem.mamage_record.length == 1) {
  520. this.planData = this.indexItem.mamage_record[0];
  521. this.$nextTick(() => {
  522. this.$refs.inputTitle.focus();
  523. this.isFill = true;
  524. });
  525. } else {
  526. this.activePlanIndex = 0;
  527. this.planData = this.indexItem.mamage_record[0];
  528. this.$nextTick(() => {
  529. this.$refs.inputTitle.focus();
  530. this.isFill = true;
  531. });
  532. }
  533. this.isFill2 = true;
  534. },
  535. deleteFile(index) {
  536. if (this.planData.append.length == 0) {
  537. this.planData.append = [];
  538. return false;
  539. }
  540. this.planData.append.splice(index, 1);
  541. this.isFill = true;
  542. },
  543. // 提交执行计划
  544. saveActionPlan(f = function() {}) {
  545. if (!this.planData.title) {
  546. this.$message.error('请输入跟踪管理记录内容');
  547. return false;
  548. }
  549. if (this.planData.id) {
  550. if (this.planData.employee_id != this.userData.id) {
  551. this.$message.error('不能编辑其他管理者的管理记录!');
  552. return false;
  553. }
  554. }
  555. this.isFill = false;
  556. let data = {
  557. track_id: this.planData.id ? this.planData.id : '', //执行计划id 编辑的时候要传
  558. dimension_xb: this.selectItemIndex,
  559. package_employee_id: this.id, //员工考核记录信息id
  560. index_id: this.indexItem.id, //指标id
  561. title: this.planData.title, //标题
  562. remark: this.planData.remark, //内容
  563. // images: JSON.stringify(this.planData.images),
  564. append: JSON.stringify(this.planData.append)
  565. // append_name: this.planData.append_name
  566. };
  567. // return false;
  568. this.$axios('post', '/api/per/package/track', data).then(res => {
  569. this.$message.success('填写成功');
  570. this.planData.id = res.data.data.id;
  571. this.planData.employee_id = res.data.data.employee_id;
  572. f();
  573. });
  574. },
  575. // 点击执行计划
  576. activePlan(item, index) {
  577. if (this.activePlanIndex == index) {
  578. return false;
  579. }
  580. if (this.isFill) {
  581. this.$confirm('请确认提交跟踪记录:' + this.planData.title + '?', {
  582. confirmButtonText: '确定',
  583. cancelButtonText: '取消',
  584. type: 'warning'
  585. })
  586. .then(() => {
  587. this.saveActionPlan(() => {
  588. this.setActivePlan(item, index);
  589. });
  590. })
  591. .catch(() => {
  592. if (this.isFill2) {
  593. this.indexItem.mamage_record.splice(this.activePlanIndex, 1);
  594. this.setActivePlan(item, index);
  595. } else {
  596. this.indexItem.mamage_record[this.activePlanIndex] = this.planData2;
  597. this.planData = this.planData2;
  598. this.$nextTick(() => {
  599. setTimeout(() => {
  600. this.setActivePlan(item, index);
  601. }, 200);
  602. });
  603. }
  604. });
  605. } else {
  606. this.planData2 = JSON.parse(JSON.stringify(item));
  607. this.setActivePlan(item, index);
  608. }
  609. },
  610. setActivePlan(item, index) {
  611. this.planData = item;
  612. this.setFlie();
  613. this.activePlanIndex = index;
  614. this.isFill = false;
  615. this.isFill2 = false;
  616. },
  617. setActiveItem(index, index2) {
  618. this.getShowData(index, index2);
  619. this.activeDrawerIndex = index + '-' + index2;
  620. this.activePlanIndex = 0;
  621. this.isFill = false;
  622. this.isFill2 = false;
  623. },
  624. // 点击指标
  625. activeItem(index, index2, item) {
  626. this.selectItemIndex = item.dimension_xb;
  627. this.isOperationTwo = item.isOperation;
  628. if (this.activeDrawerIndex == index + '-' + index2) {
  629. return false;
  630. }
  631. if (this.isFill) {
  632. this.$confirm('请确认提交跟踪记录:' + this.planData.title + '?', {
  633. confirmButtonText: '确定',
  634. cancelButtonText: '取消',
  635. type: 'warning'
  636. })
  637. .then(() => {
  638. this.saveActionPlan(() => {
  639. this.setActiveItem(index, index2);
  640. });
  641. })
  642. .catch(() => {
  643. if (this.isFill2) {
  644. this.indexItem.mamage_record.splice(this.activePlanIndex, 1);
  645. this.setActiveItem(index, index2);
  646. } else {
  647. this.indexItem.mamage_record[this.activePlanIndex] = this.planData2;
  648. this.planData = this.planData2;
  649. this.$nextTick(() => {
  650. setTimeout(() => {
  651. this.setActiveItem(index, index2);
  652. }, 200);
  653. });
  654. }
  655. });
  656. } else {
  657. this.setActiveItem(index, index2);
  658. }
  659. },
  660. // 设置选中数据
  661. getShowData(index, index2) {
  662. if (index != undefined) {
  663. this.indexItem = this.actionPlanList[index].index[index2];
  664. this.planData = this.indexItem.mamage_record[0];
  665. // this.setFlie();
  666. this.isOperationTwo = this.indexItem.isOperation;
  667. if (this.planData) {
  668. this.planData2 = JSON.parse(JSON.stringify(this.planData));
  669. }
  670. } else {
  671. if (this.planIndex.length > 0) {
  672. //如果有指定下标展示
  673. this.indexItem = this.actionPlanList[this.planIndex[0]].index[this.planIndex[1]];
  674. this.planData = this.indexItem.mamage_record[0];
  675. // this.setFlie();
  676. this.selectItemIndex = this.planIndex[0];
  677. this.isOperationTwo = this.indexItem.isOperation;
  678. if (this.planData) {
  679. this.planData2 = JSON.parse(JSON.stringify(this.planData));
  680. }
  681. this.activeDrawerIndex = this.planIndex[0] + '-' + this.planIndex[1];
  682. } else {
  683. this.indexItem = this.actionPlanList[0].index[0];
  684. this.planData = this.indexItem.mamage_record[0];
  685. // this.setFlie();
  686. this.isOperationTwo = this.indexItem.isOperation;
  687. if (this.planData) {
  688. this.planData2 = JSON.parse(JSON.stringify(this.planData));
  689. }
  690. }
  691. }
  692. },
  693. setFlie() {
  694. this.img_fileList = [];
  695. this.file_fileList = [];
  696. if (this.planData) {
  697. this.img_fileList = this.planData.images;
  698. if (this.planData.append) {
  699. this.file_fileList = [
  700. {
  701. name: this.planData.append_name,
  702. url: this.planData.append
  703. }
  704. ];
  705. }
  706. }
  707. },
  708. handleClose(done) {
  709. this.$emit('update:showDrawer', false);
  710. if (this.isCz) {
  711. this.$emit('confirm');
  712. }
  713. this.activeDrawerIndex = '0-0';
  714. this.activePlanIndex = 0;
  715. this.showDrawerTow = false;
  716. this.isFill = false; //是否填写了
  717. this.isFill2 = false; //添加执行计划时用,判断是要清空添加的,还是还原编辑的数据
  718. this.isShowAdd = false;
  719. done();
  720. },
  721. // 监听是否填写
  722. inputText(val) {
  723. if (!this.isFill) {
  724. this.isFill = true;
  725. }
  726. },
  727. inputBlur() {
  728. this.isShowAdd = false;
  729. },
  730. inputFocus() {
  731. this.isShowAdd = true;
  732. }
  733. }
  734. };
  735. </script>
  736. <style scoped="scoped">
  737. ::v-deep .el-icon-picture-outline {
  738. }
  739. .all-derawer ::v-deep.el-drawer {
  740. height: 90% !important;
  741. border-radius: 10px 10px 0 0;
  742. background-color: #f5f7fa;
  743. min-width: 1100px !important;
  744. }
  745. .all-derawer ::v-deep.el-drawer__header {
  746. background-color: #f5f7fa;
  747. padding: 12px 20px;
  748. margin-bottom: 0px;
  749. font-size: 16px;
  750. }
  751. ::v-deep .el-upload-list__item-name {
  752. max-width: 250px;
  753. }
  754. ::v-deep :focus {
  755. outline: 0;
  756. }
  757. .btns {
  758. position: absolute;
  759. right: 20px;
  760. top: 16px;
  761. z-index: 999;
  762. }
  763. .plan-right-name {
  764. color: #222;
  765. }
  766. .plan-right {
  767. padding: 20px;
  768. position: relative;
  769. background-color: #f5f7fa;
  770. min-height: 600px;
  771. }
  772. .plan-right-date {
  773. text-align: center;
  774. position: relative;
  775. margin-bottom: 30px;
  776. }
  777. .plan-textarea ::v-deep textarea {
  778. background-color: #f5f7fa;
  779. border: none;
  780. }
  781. .plan-right-title {
  782. border-bottom: 1px solid #f1f1f1;
  783. }
  784. .plan-right-title ::v-deep textarea {
  785. background-color: #f5f7fa;
  786. border: none;
  787. }
  788. .drawer-left {
  789. background-color: #fff;
  790. padding: 0 15px;
  791. width: 280px;
  792. border-right: 1px solid #f1f1f1;
  793. overflow: auto;
  794. padding-bottom: 60px;
  795. }
  796. .drawer-left-title {
  797. padding: 16px 0;
  798. font-weight: 600;
  799. font-size: 16px;
  800. color: #222;
  801. border-bottom: 1px solid #f1f1f1;
  802. }
  803. .drawer-item {
  804. padding: 16px 0;
  805. cursor: pointer;
  806. }
  807. .drawer-item:hover {
  808. background-color: #f5f7fa;
  809. }
  810. .drawer-left .active-drawer-item {
  811. background-color: #f5f7fa;
  812. border-right: 2px solid #409eff;
  813. }
  814. .plan-left-content:hover {
  815. background-color: #f5f7fa;
  816. }
  817. .plan-left .active-drawer-item {
  818. background-color: #f5f7fa;
  819. }
  820. .drawer-right-header {
  821. background-color: #fff;
  822. border-bottom: 1px solid #f1f1f1;
  823. padding: 20px;
  824. }
  825. .drawer-right-main {
  826. padding: 0px 20px;
  827. height: 50px;
  828. line-height: 50px;
  829. background-color: #fff;
  830. border-bottom: 1px solid #f1f1f1;
  831. }
  832. .plan-title {
  833. font-size: 14px;
  834. color: #666666;
  835. margin-top: 5px;
  836. }
  837. .plan-left {
  838. background-color: #fff;
  839. border-right: 1px solid #f1f1f1;
  840. overflow: auto;
  841. }
  842. .remark {
  843. height: 100px;
  844. display: -webkit-box;
  845. -webkit-box-orient: vertical;
  846. -webkit-line-clamp: 6;
  847. overflow: hidden;
  848. }
  849. .plan-left-content {
  850. border-bottom: 1px solid #f1f1f1;
  851. padding: 10px 16px;
  852. cursor: pointer;
  853. width: 100%;
  854. box-sizing: border-box;
  855. }
  856. </style>