taskDetailsPopup.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850
  1. <template>
  2. <div>
  3. <!-- 任务详情弹窗 -->
  4. <el-drawer :visible.sync="Delay_to_open" :with-header="false" :size="'500px'" :before-close="handleClose"
  5. :custom-class="'drawer_details'">
  6. <div class="details_title flex-box-ce">
  7. <span class="flex-1">{{ title }}</span>
  8. <!-- <span><el-button type="primary" v-if=" workDetailData.status==1" size="small" @click.stop="completeBtn()">完成</el-button></span> -->
  9. </div>
  10. <div class="details_content" v-if="workDetailData" v-loading="loading">
  11. <div class="flex-box flex-v-ce">
  12. <userImage class="user_img person_imghead" width="46px" height="46px"
  13. :user_name="workDetailData.employee_name" :img_url="workDetailData.img_url"></userImage>
  14. <div class="d_userMessage">
  15. <div>{{ workDetailData.employee_name }}</div>
  16. <div v-if="detailType != 2 && workDetailData.dept_list[0]">{{
  17. workDetailData.dept_list[0].dept_name }}</div>
  18. </div>
  19. <div style="margin-left: 5px;" class="flex-box flex-v-ce">
  20. <div v-if="workDetailData.point_config.base_point > 0" class="green">+{{
  21. workDetailData.point_config.base_point }}</div>
  22. <div v-else class="red">{{ workDetailData.point_config.base_point }}</div>
  23. <div style="margin-left: 5px;">{{ $getTypsName(workDetailData.pt_id) }}</div>
  24. </div>
  25. <div class="flex-1"></div>
  26. <el-popover v-if="workDetailData.reviews.length>0" placement="bottom-start" trigger="click">
  27. <div class="record" style="margin: 20px 0;width: 400px;">
  28. <div @click="openDetail(item)" v-for="(item, index) in workDetailData.reviews" :key="index"
  29. class="recordList"
  30. :class="[workDetailData.reviews.length - index > 1 ? 'record-list' : '']">
  31. <div class="flex-box-ce record-date fontColorB">
  32. <!-- <div class="record-name">{{ item.reviewer_name }}</div> -->
  33. <div class="flex-1">
  34. <span v-if="item.review_status == 0" class="fontColorB">待审批</span>
  35. <span v-else-if="item.review_status == 1" class="green">已通过</span>
  36. <span v-else class="red">已驳回</span>
  37. </div>
  38. <span class="fontColorC">{{item.review_time}}</span>
  39. </div>
  40. <div class="record-content">
  41. <div class="pre fontColorC">{{ item.remark || '无备注' }}</div>
  42. </div>
  43. </div>
  44. </div>
  45. <div slot="reference" class="blue" style="cursor: pointer;">查看审批记录</div>
  46. </el-popover>
  47. </div>
  48. <ul>
  49. <li class="flex-box">
  50. <div class="label">任务内容</div>
  51. <div class="content_text">{{ workDetailData.task_name }}</div>
  52. </li>
  53. <li class="flex-box">
  54. <div class="label">任务备注</div>
  55. <textarea class="flex-1" disabled="disabled" v-model="workDetailData.task_remark"
  56. style="border: none;height:100px"></textarea>
  57. </li>
  58. <li class="flex-box"
  59. v-if="workDetailData.task_file_list && workDetailData.task_file_list.length > 0">
  60. <div class="label"></div>
  61. <div class="content_text">
  62. <el-image v-for="(item, index) in workDetailData.task_file_list" :key="index"
  63. style="width: 100px; height: 100px;margin-right:8px" :src="item"
  64. :preview-src-list="workDetailData.task_file_list"></el-image>
  65. </div>
  66. </li>
  67. <li class="flex-box">
  68. <div class="label">积分种类</div>
  69. <div class="content_text">{{ workDetailData.pt_name }}</div>
  70. </li>
  71. <li class="flex-box">
  72. <div class="label">任务积分</div>
  73. <div class="content_text">{{ workDetailData.point_config.base_point }}{{ workDetailData.pt_name
  74. }}</div>
  75. </li>
  76. <li class="flex-box" v-if="workDetailData.point_config.review_point">
  77. <div class="label">最终分</div>
  78. <div class="content_text">{{ workDetailData.point_config.review_point }}</div>
  79. </li>
  80. <li class="flex-box">
  81. <div class="label">审批人</div>
  82. <div class="content_text">{{ workDetailData.reviewer_name }}</div>
  83. </li>
  84. <li class="flex-box">
  85. <div class="label">发布人</div>
  86. <div class="content_text">{{ workDetailData.publisher_name }}</div>
  87. </li>
  88. <li class="flex-box" v-if="workDetailData.create_time">
  89. <div class="label">发布时间</div>
  90. <div class="content_text">{{ workDetailData.create_time }}</div>
  91. </li>
  92. <li class="flex-box">
  93. <div class="label">截止时间</div>
  94. <div class="content_text">{{ workDetailData.expire_time }}</div>
  95. </li>
  96. <li class="flex-box" v-if="workDetailData.point_config.ahead_award_point > 0">
  97. <div class="label">提前奖分</div>
  98. <div class="content_text">{{ workDetailData.point_config.ahead_award_point }} B分/天</div>
  99. </li>
  100. <li class="flex-box" v-if="workDetailData.point_config.timeout_deduction_point > 0">
  101. <div class="label">逾期扣分</div>
  102. <div class="content_text">{{ workDetailData.point_config.timeout_deduction_point }} B分/天</div>
  103. </li>
  104. <li class="flex-box" v-if="workDetailData.complete_task && workDetailData.complete_task.time">
  105. <div class="label">完成时间</div>
  106. <div class="content_text">{{$moment(workDetailData.complete_task.time).format('YYYY-MM-DD
  107. HH:mm')}}</div>
  108. </li>
  109. <li class="flex-box" v-if="workDetailData.complete_task && workDetailData.complete_task.remark">
  110. <div class="label">完成备注</div>
  111. <div class="content_text">{{workDetailData.complete_task.remark }}</div>
  112. </li>
  113. <li class="flex-box"
  114. v-if="workDetailData.complete_task && workDetailData.complete_task.files && workDetailData.complete_task.files.length > 0">
  115. <div class="label"></div>
  116. <div class="content_text">
  117. <el-image v-for="(item, index) in workDetailData.complete_task.files" :key="index"
  118. style="width: 100px; height: 100px;margin-right:8px" :src="item"
  119. :preview-src-list="workDetailData.complete_task.files"></el-image>
  120. </div>
  121. </li>
  122. </ul>
  123. <div v-show="workDetailData.point_config && workDetailData.point_config.item_info">
  124. <p class="row_title">规则依据</p>
  125. <el-row :gutter="10" v-if="workDetailData.point_config.rule_info">
  126. <el-col :span="4">规则分类</el-col>
  127. <el-col :span="19">{{ workDetailData.point_config.rule_info.name }}</el-col>
  128. </el-row>
  129. <el-row v-if="workDetailData.point_config.item_info">
  130. <el-col :span="4">积分规则</el-col>
  131. <el-col :span="19">{{ workDetailData.point_config.item_info.remark }}</el-col>
  132. </el-row>
  133. <el-row v-if="workDetailData.point_config.item_info">
  134. <el-col :span="4">积分</el-col>
  135. <el-col :span="19"
  136. v-show="workDetailData.point_config.item_info.min_point == workDetailData.point_config.item_info.max_point">
  137. {{ workDetailData.point_config.item_info.min_point }} {{ workDetailData.pt_name }}
  138. </el-col>
  139. <el-col :span="19"
  140. v-show="workDetailData.point_config.item_info.min_point != workDetailData.point_config.item_info.max_point">
  141. {{ workDetailData.point_config.item_info.min_point }} ~ {{
  142. workDetailData.point_config.item_info.max_point }} {{ workDetailData.pt_name }}
  143. </el-col>
  144. </el-row>
  145. </div>
  146. <div v-show="showWork" style="border-top: 2px solid #f8f8f8;">
  147. <div class="d_progress">
  148. <div class="flex-box ">
  149. <div class="flex-1">工作进度({{ workDetailData.progress }}%)</div>
  150. <div class="addJf blue" @click="sliderShow"
  151. v-if="workDetailData.employee_id == userId && workDetailData.status == 1">+更新进度</div>
  152. </div>
  153. <el-progress :percentage="workDetailData.progress"></el-progress>
  154. </div>
  155. <div>
  156. <el-tabs v-model="activeName">
  157. <el-tab-pane label="工作记录" name="work">
  158. <div class="flex-box">
  159. <div class="flex-1"></div>
  160. <div class="addJf blue" @click="isOne = true"
  161. v-if="workDetailData.employee_id == userId && workDetailData.status < 3">
  162. +记一条工作记录</div>
  163. </div>
  164. <div class="work_box" style="padding-top:10px">
  165. <div class="work_item" v-for="(item, index) in text_list" :key="index"
  166. style="margin: 0 0 15px 0">
  167. <div class="flex-box">
  168. <userImage class="user_img person_imghead" width="40px" height="40px"
  169. :user_name="item.recorder" :img_url="item.img_url"></userImage>
  170. <div style="width: 100%;" class="d_name">
  171. <div class="flex-box flex-d-center">
  172. <div class="flex-1">
  173. {{ item.recorder }}
  174. <span v-if="item.point * 1 > 0">+{{ item.point }}</span>
  175. <span v-if="item.point * 1 < 0">{{ item.point }}</span>
  176. </div>
  177. <div class="d_date fontColorC">
  178. {{ item.time }}
  179. <span class="delete_jfjl"
  180. v-if="item.recorder_id == userId && workDetailData.status < 3"
  181. @click="deletejf_cli(index, 0)">
  182. <i class="el-icon-delete"></i>
  183. </span>
  184. </div>
  185. </div>
  186. <div class="fontColorB" style="margin-top: 5px;word-break: break-all;">
  187. {{ item.remark }}</div>
  188. </div>
  189. </div>
  190. </div>
  191. <div v-if="text_list.length == 0" class="fontColorC" style="text-align: center;">
  192. 暂无工作记录</div>
  193. </div>
  194. </el-tab-pane>
  195. <el-tab-pane label="记分记录" name="participation">
  196. <div class="flex-box" style="padding-bottom: 10px;border-bottom: 1px solid #f1f1f1;">
  197. <div class="flex-1 blue">
  198. <span v-if="point_total > 0">合计:+{{ point_total }}</span>
  199. <span v-else>合计:{{ point_total }}</span>
  200. </div>
  201. <div class="addJf blue" @click="isIntegral = true" v-if="keepTheScore">+记分</div>
  202. </div>
  203. <div class="work_box" style="padding-top:10px">
  204. <div class="work_item" v-for="(item, index) in point_list" :key="index"
  205. style="margin: 0 0 15px 0">
  206. <div class="flex-box">
  207. <userImage class="user_img person_imghead" width="40px" height="40px"
  208. :user_name="item.recorder" :img_url="item.img_url"></userImage>
  209. <div style="width: 100%;" class="d_name">
  210. <div class="flex-box flex-d-center">
  211. <div class="flex-1">
  212. {{ item.recorder }}
  213. <span class="red" v-if="item.point * 1 > 0">+{{ item.point
  214. }}</span>
  215. <span class="green" v-if="item.point * 1 < 0">{{ item.point
  216. }}</span>
  217. </div>
  218. <div class="d_date fontColorC">
  219. {{ item.time }}
  220. <span class="delete_jfjl"
  221. v-if="userId == item.recorder_id && workDetailData.status < 3"
  222. @click="deletejf_cli(index, 1)">
  223. <i class="el-icon-delete"></i>
  224. </span>
  225. </div>
  226. </div>
  227. <div class="fontColorB" style="margin-top: 5px;word-break: break-all;">
  228. {{ item.remark }}</div>
  229. </div>
  230. </div>
  231. </div>
  232. <div v-if="point_list.length == 0" class="fontColorC" style="text-align: center;">
  233. 暂无积分记录</div>
  234. </div>
  235. </el-tab-pane>
  236. </el-tabs>
  237. </div>
  238. </div>
  239. </div>
  240. </el-drawer>
  241. <examinePopup :title="'审核详情'" :id="detail_id" :show.sync="detailShow"></examinePopup>
  242. <!-- 更新进度 -->
  243. <el-dialog title="更新进度" :close-on-click-modal="false" :visible.sync="isSlider" :before-close="publicClose"
  244. width="40%">
  245. <div class="slider">
  246. <div class="fontColorC">拖动滑杆更新进度</div>
  247. <el-slider v-model="progress"></el-slider>
  248. </div>
  249. <span slot="footer">
  250. <el-button @click="publicClose()">取消</el-button>
  251. <el-button type="primary" @click="sliderSend">完成</el-button>
  252. </span>
  253. </el-dialog>
  254. <!-- 记一条 -->
  255. <el-dialog title="记一条" :close-on-click-modal="false" :visible.sync="isOne" destroy-on-close
  256. :before-close="publicClose" width="40%">
  257. <div class="flex-box">
  258. <div style="width: 80px;">工作记录</div>
  259. <el-input type="textarea" :rows="3" placeholder="请输入内容" v-model="textarea"></el-input>
  260. </div>
  261. <span slot="footer">
  262. <el-button @click="publicClose()">取消</el-button>
  263. <el-button type="primary" @click="onerecord">完成</el-button>
  264. </span>
  265. </el-dialog>
  266. <!-- 记分记录 -->
  267. <el-dialog title="记分" :visible.sync="isIntegral" :before-close="publicClose" width="40%" destroy-on-close
  268. :close-on-click-modal="false">
  269. <el-form :model="integral" ref="integral" label-width="80px" :rules="formRules">
  270. <el-form-item label="记录" prop="text" :rules="[{ required: true, message: '记录不能为空' }]">
  271. <el-input type="textarea" :rows="3" v-model="integral.text"></el-input>
  272. </el-form-item>
  273. <!-- 记分不能为空 -->
  274. <el-form-item label="记分" prop="num">
  275. <!-- <el-form-item label="记分" prop="num" :rules="[{ required: false, message: '记分不能为空'},{ type: 'number', message: '积分必须为数字值'}]"> -->
  276. <div class="num" :class="[integral.type == '1' ? 'add' : 'jian']"></div>
  277. <el-input placeholder="请输入内容" type="Number" v-model.number="integral.num" @input="
  278. val => {
  279. integral.num = val.replace(/[^\d]/g, '');
  280. }
  281. ">
  282. <el-select v-model="integral.type" slot="prepend" placeholder="请选择" style="width: 80px;">
  283. <el-option label="奖分" value="1"></el-option>
  284. <el-option label="扣分" value="2"></el-option>
  285. </el-select>
  286. </el-input>
  287. </el-form-item>
  288. </el-form>
  289. <span slot="footer">
  290. <el-button @click="publicClose()">取消</el-button>
  291. <el-button type="primary" @click="integralSend('integral')">完成</el-button>
  292. </span>
  293. </el-dialog>
  294. <el-dialog title="完成任务" :visible.sync="completeShow" :close-on-click-modal="false" destroy-on-close width="50%">
  295. <el-form :model="detail_form" ref="detail_form" label-width="80px">
  296. <el-form-item label="任务备注" prop="remark"
  297. :rules="[{ required: true, message: '请填写任务备注(限200字)', trigger: 'blur' }]">
  298. <el-input v-model="detail_form.remark" type="textarea" :rows="4" maxlength="200"
  299. show-word-limit></el-input>
  300. </el-form-item>
  301. <el-form-item label="图片">
  302. <upload :headers="Xtoken" class="avatar-uploader"
  303. :action="'https://' + 'integralsys.oss-cn-shenzhen.aliyuncs.com'" :show-file-list="true"
  304. :file-list="detail_form.fileList" :on-success="handleFilesSuccess" :on-preview="onFilePreView"
  305. :before-upload="beforeUpload" :on-remove="onFileRemove" :limit="3" accept="image/jpeg,image/png"
  306. :multiple="true" ref="clearPicture">
  307. <el-button size="small" type="primary">点击上传</el-button>
  308. (最多选择3张)
  309. </upload>
  310. </el-form-item>
  311. </el-form>
  312. <div class="flex-box-end">
  313. <el-button @click="resetForm('detail_form')">取消</el-button>
  314. <el-button type="primary" @click="onSubmit('detail_form')">提交</el-button>
  315. </div>
  316. </el-dialog>
  317. </div>
  318. </template>
  319. <script>
  320. const validatorNoZero = (rule, value, callback) => {
  321. //设置记分的验证
  322. if (value === 0) {
  323. return callback(new Error('记分不能为0'));
  324. } else if (value === '') {
  325. return callback(new Error('记分不能为空'));
  326. } else if (isNaN(value)) {
  327. return callback(new Error('积分必须为数字值'));
  328. } else {
  329. callback();
  330. }
  331. };
  332. import examinePopup from '@/components/examinePopup.vue';
  333. import upload from '@/components/upload';
  334. export default {
  335. name: 'taskDetailsPopup',
  336. components: { examinePopup,upload },
  337. props: {
  338. title: {
  339. type: String,
  340. default: ''
  341. },
  342. visible: {
  343. type: Boolean,
  344. default: false
  345. },
  346. id: {
  347. type: Number,
  348. default: 0
  349. },
  350. showWork: {
  351. type: Boolean,
  352. default: true
  353. },
  354. detailType: {
  355. type: String,
  356. default: ''
  357. }
  358. },
  359. data() {
  360. return {
  361. Delay_to_open: false, //打开抽屉
  362. loading: false,
  363. workDetailData: {
  364. reviews: [],
  365. process: [],
  366. dept_list: [],
  367. point_config: {
  368. base_point: '0'
  369. }
  370. },
  371. // itemId: getId,
  372. isOne: false,
  373. text_list: [],
  374. isIntegral: false,
  375. point_total: 0,
  376. point_list: [],
  377. activeName: 'work',
  378. getDataUrl: '/api/integral/work',
  379. params: {},
  380. userId: this.$getUserData().id,
  381. isSlider: false, //更新进度弹窗
  382. progress: 0, //更新进度modus
  383. isOne: false, //记一条
  384. textarea: '', //记录一条内容
  385. isIntegral: false, //记分记录
  386. integral: {
  387. text: '',
  388. num: 0,
  389. type: '1'
  390. },
  391. formRules: {
  392. //记分验证
  393. num: [
  394. {
  395. required: true,
  396. validator: validatorNoZero,
  397. trigger: 'blur'
  398. }
  399. ]
  400. },
  401. keepTheScore: false,
  402. employeeMe: {},
  403. detailShow: false,
  404. detail_id: 0,
  405. detail_form: {
  406. id: '',
  407. remark: '',
  408. fileList: [],
  409. files: [],
  410. },
  411. completeShow:false,
  412. //图片附件
  413. Xtoken: { 'X-Token': this.$getToken() },
  414. };
  415. },
  416. mounted() {
  417. this.detailType == 2 ? (this.getDataUrl = '/api/integral/schedule') : (this.getDataUrl = '/api/integral/work');
  418. this.$nextTick(() => {
  419. this.getData();
  420. this.Delay_to_open = this.visible; //更换打开抽屉时机,避免打开两次
  421. });
  422. },
  423. methods: {
  424. //提交完成任务
  425. onSubmit(formName) {
  426. this.$refs[formName].validate(valid => {
  427. if (valid) {
  428. let data = {
  429. work_id: this.detail_form.id,
  430. progress: '100',
  431. remark: this.detail_form.remark,
  432. state: '1',
  433. files: this.detail_form.files
  434. };
  435. this.$axios('post', '/api/integral/work', data).then(res => {
  436. this.$message.success(res.data.msg);
  437. this.resetForm(formName);
  438. this.getData();
  439. });
  440. }
  441. });
  442. },
  443. //重置表单
  444. resetForm(formName) {
  445. this.$refs[formName].resetFields();
  446. this.completeShow = false;
  447. this.detail_form.fileList = []
  448. this.detail_form.files = []
  449. },
  450. handleFilesSuccess(response, file, fileList) {
  451. let fileListData=fileList.filter(e=>{
  452. return e.url
  453. })
  454. this.fileFun(file, fileList)
  455. },
  456. onFilePreView(file) {
  457. if (file.response) {
  458. window.open(file.response.url, '_blank');
  459. }
  460. },
  461. onFileRemove(file, fileList) {
  462. this.fileFun(file, fileList)
  463. },
  464. fileFun(file, fileList){
  465. this.detail_form.fileList = fileList;
  466. this.detail_form.files = []
  467. fileList.forEach((item, index) => {
  468. this.detail_form.files.push(item.url);
  469. });
  470. },
  471. // 附件上传
  472. beforeUpload(file) {
  473. const isJPG = /^image\/(jpeg|png|jpg)$/.test(file.type);
  474. const isLt2M = file.size / 1024 / 1024 < 5;
  475. if (!isJPG) {
  476. this.$message.error('上传图片只能是 JPEG,PNG,JPG 格式!');
  477. }
  478. if (!isLt2M) {
  479. this.$message.error('上传图片大小不能超过 5MB!');
  480. }
  481. return isJPG && isLt2M;
  482. },
  483. // 点击完成
  484. completeBtn() {
  485. this.detail_form.id = this.workDetailData.id;
  486. this.completeShow = true;
  487. },
  488. openDetail(item) {
  489. this.detailShow = true;
  490. this.detail_id = item.id;
  491. },
  492. employee_me(data) {
  493. let params = {
  494. id: data.employee_id
  495. };
  496. this.$axios('get', '/api/employee/info', params).then(res => {
  497. this.employeeMe = res.data.data;
  498. this.keepTheScore = this.keepThe_score(data);
  499. });
  500. },
  501. keepThe_score(cer) {
  502. if (cer.status > 2) {
  503. return false;
  504. }
  505. if (this.userId == cer.reviewer_id) {
  506. return true;
  507. }
  508. return this.employeeMe.employee_detail.superior_list.some(x => {
  509. if (this.userId == x.id) {
  510. return true;
  511. }
  512. });
  513. },
  514. deletejf_cli(cor, cur) {
  515. this.$confirm('确定永久删除此项?', '提示', {
  516. confirmButtonText: '确定',
  517. cancelButtonText: '取消',
  518. type: 'warning'
  519. })
  520. .then(() => {
  521. let lier = cur == 1 ? this.point_list : this.text_list;
  522. let libf = cur == 1 ? this.text_list : this.point_list;
  523. lier.splice(cor, 1);
  524. let data = {
  525. work_id: this.workDetailData.id,
  526. process: []
  527. };
  528. data.process = lier.concat(libf);
  529. if (data.process.length == 0) {
  530. data.process = '[1]';
  531. } else {
  532. data.process = JSON.stringify(data.process);
  533. }
  534. this.$axios('post', '/api/integral/work', data).then(res => {
  535. if (res.data.code == 1) {
  536. this.getData();
  537. }
  538. });
  539. })
  540. .catch(() => {});
  541. },
  542. //记分记录
  543. integralSend(formName) {
  544. this.$refs[formName].validate(valid => {
  545. if (valid) {
  546. var items = this.workDetailData.process.list || [];
  547. var process = {
  548. img_url: this.$getUserData().img_url,
  549. point: this.integral.type == '1' ? this.integral.num : '-' + this.integral.num,
  550. recorder_id: this.$getUserData().id,
  551. recorder: this.$getUserData().name,
  552. remark: this.integral.text,
  553. time: this.$moment().format('YYYY-MM-DD HH:mm')
  554. };
  555. var data = {
  556. work_id: this.workDetailData.id,
  557. process: []
  558. };
  559. items.unshift(process);
  560. data.process = JSON.stringify(items);
  561. this.$axios('post', '/api/integral/work', data).then(res => {
  562. if (res.data.code == 1) {
  563. this.publicClose();
  564. this.getData();
  565. }
  566. });
  567. }
  568. });
  569. },
  570. //记一条
  571. onerecord() {
  572. if (!this.textarea) {
  573. this.$message.error('请输入备注内容');
  574. return;
  575. }
  576. var items = this.workDetailData.process.list || [];
  577. var process = {
  578. img_url: this.$getUserData().img_url,
  579. point: 0,
  580. recorder_id: this.$getUserData().id,
  581. recorder: this.$getUserData().name,
  582. remark: this.textarea,
  583. time: this.$moment().format('YYYY-MM-DD HH:mm')
  584. };
  585. var data = {
  586. work_id: this.workDetailData.id,
  587. process: []
  588. };
  589. items.unshift(process);
  590. data.process = JSON.stringify(items);
  591. this.$axios('post', '/api/integral/work', data).then(res => {
  592. if (res.data.code == 1) {
  593. this.publicClose();
  594. this.getData();
  595. }
  596. });
  597. },
  598. //更新进度
  599. sliderShow() {
  600. this.progress = this.workDetailData.progress;
  601. this.isSlider = true;
  602. },
  603. sliderSend() {
  604. var self = this;
  605. let data = {
  606. work_id: self.workDetailData.id,
  607. progress: self.progress
  608. };
  609. self.$axios('post', '/api/integral/work', data).then(res => {
  610. if (res.data.code == 1) {
  611. this.getData();
  612. self.isSlider = false;
  613. }
  614. });
  615. },
  616. publicClose() {
  617. this.textarea = '';
  618. this.integral = {
  619. text: '',
  620. num: 0,
  621. type: '1'
  622. };
  623. this.isSlider = false;
  624. this.isOne = false;
  625. this.isIntegral = false;
  626. },
  627. // 关闭弹窗
  628. handleClose() {
  629. this.$emit('update:visible', false);
  630. },
  631. // 获取数据
  632. getData() {
  633. this.loading = true;
  634. let data = this.detailType == 2 ? { schedule_id: this.id } : { work_id: this.id };
  635. this.$axios('get', this.getDataUrl, data, this.detailType == 2 ? '' : 'v2')
  636. .then(res => {
  637. this.workDetailData = res.data.data;
  638. this.employee_me(res.data.data);
  639. let text_list = [];
  640. let point_list = [];
  641. this.point_total = 0;
  642. if (this.workDetailData.process.list && this.workDetailData.process.list.length > 0) {
  643. for (let i in this.workDetailData.process.list) {
  644. this.point_total += this.workDetailData.process.list[i].point * 1;
  645. if (this.workDetailData.process.list[i].point != 0) {
  646. point_list.push(this.workDetailData.process.list[i]);
  647. } else {
  648. if (this.workDetailData.process.list[i].recorder_id == this.workDetailData.employee_id) {
  649. text_list.push(this.workDetailData.process.list[i]);
  650. }
  651. }
  652. }
  653. }
  654. setTimeout(() => {
  655. this.text_list = text_list;
  656. this.point_list = point_list;
  657. }, 500);
  658. })
  659. .finally(() => {
  660. this.loading = false;
  661. });
  662. }
  663. }
  664. };
  665. </script>
  666. <style lang="scss" scoped="scoped">
  667. .recordList {
  668. padding: 10px 0;
  669. cursor: pointer;
  670. border-radius: 5px;
  671. }
  672. .recordList:hover {
  673. // background-color: #F7F8FA;
  674. }
  675. .textarea ::v-deep textarea {
  676. background-color: #f7f8fa;
  677. border: none;
  678. padding: 0;
  679. width: 500px;
  680. color: #222 !important;
  681. }
  682. .record-message {
  683. font-size: 13px;
  684. margin: 5px 60px;
  685. }
  686. .record-list {
  687. position: relative;
  688. }
  689. .record-list::after {
  690. content: '';
  691. position: absolute;
  692. width: 2px;
  693. top: 5px;
  694. left: 3px;
  695. bottom: -15px;
  696. background-color: #ccc;
  697. }
  698. .record-title {
  699. padding: 16px 0;
  700. font-size: 16px;
  701. }
  702. .record-date {
  703. padding-left: 20px;
  704. position: relative;
  705. font-size: 13px;
  706. }
  707. .record-date::after {
  708. content: '';
  709. position: absolute;
  710. width: 8px;
  711. height: 8px;
  712. background-color: #ccc;
  713. left: 0;
  714. top: 50%;
  715. margin-top: -4px;
  716. border-radius: 50%;
  717. z-index: 2;
  718. }
  719. .record-content {
  720. background-color: #f7f8fa;
  721. padding: 6px;
  722. border-radius: 5px;
  723. margin-left: 20px;
  724. margin-top: 10px;
  725. // margin-bottom: 10px;
  726. }
  727. .record-name {
  728. margin-right: 10px;
  729. /* margin-left: 10px; */
  730. color: #141c28;
  731. font-weight: 600;
  732. }
  733. .details_content {
  734. & .d_userMessage {
  735. margin-left: 10px;
  736. }
  737. & .d_userMessage div:nth-child(1) {
  738. font-size: 16px;
  739. }
  740. & .d_userMessage div:nth-child(2) {
  741. font-size: 12px;
  742. color: #909399;
  743. }
  744. & .d_progress {
  745. padding: 12px 0;
  746. border-bottom: 1px solid #f1f1f1;
  747. margin-bottom: 10px;
  748. }
  749. & ul {
  750. padding: 12px 0;
  751. border-bottom: 1px solid #f1f1f1;
  752. & li {
  753. padding: 6px 0;
  754. }
  755. & .label {
  756. width: 80px;
  757. text-align: left;
  758. color: #909399;
  759. }
  760. & .content_text {
  761. flex: 1;
  762. }
  763. }
  764. }
  765. .details_content {
  766. padding: 20px;
  767. height: calc(100vh - 60px);
  768. overflow: auto;
  769. padding-bottom: 100px;
  770. .row_title {
  771. position: relative;
  772. margin: 0 0 20px 0;
  773. padding-top: 12px;
  774. font-size: 16px;
  775. color: #303133;
  776. line-height: 22px;
  777. }
  778. .row_title:before {
  779. position: absolute;
  780. top: 0;
  781. content: ' ';
  782. width: 100%;
  783. border-top: 1px #f8f8f8 solid;
  784. }
  785. .el-row {
  786. margin-bottom: 10px;
  787. font-size: 14px;
  788. .el-col-4 {
  789. color: #606266;
  790. }
  791. }
  792. }
  793. .details_title {
  794. font-size: 18px;
  795. padding: 18px 20px;
  796. border-bottom: 1px #efefef solid;
  797. }
  798. .d_name {
  799. margin-left: 10px;
  800. }
  801. .d_content {
  802. margin-left: 50px;
  803. }
  804. .addJf {
  805. font-size: 13px;
  806. cursor: pointer;
  807. margin-bottom: 5px;
  808. padding: 5px;
  809. transition: all 0.3s;
  810. }
  811. .addJf:hover {
  812. color: #26a2ff !important;
  813. }
  814. .num {
  815. position: absolute;
  816. height: 22px;
  817. width: 20px;
  818. z-index: 999;
  819. left: 85px;
  820. line-height: 40px !important;
  821. }
  822. .add:before {
  823. position: absolute;
  824. content: '+';
  825. color: #f56c6c;
  826. }
  827. .jian:before {
  828. position: absolute;
  829. content: '-';
  830. color: #67c23a;
  831. }
  832. .delete_jfjl {
  833. transition: 0.3s all;
  834. cursor: pointer;
  835. margin: 0 0 0 10px;
  836. }
  837. .delete_jfjl:hover {
  838. color: #26a2ff;
  839. }
  840. </style>