approvalTurn.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <template>
  2. <div class="approvalTurn_box">
  3. <div class="approvalTurn_container">
  4. <!-- 转正申请 -->
  5. <div class="card_cont">
  6. <h3 style="marginRight:18px;fontSize:16px;">
  7. 申请信息
  8. <el-button size="mini" type="primary" @click="isOpenCustomDtl=true" style="marginLeft:10px;">客户信息</el-button>
  9. </h3>
  10. <div class="history_item">
  11. <span>待审批内容:试用转正式</span> <span class="contract_type_hint">{{contractInfo.SourceTag}}</span>
  12. <ul class="detail_item">
  13. <li>
  14. <span>合同类型: {{contractInfo.ContractType}}</span>
  15. </li>
  16. <li>
  17. <span style="min-width:450px;marginRight:260px;display:inline-block;">合同期限:{{ContractTermTxt}}</span>
  18. <span>合同金额:{{contractInfo.Money}}</span>
  19. </li>
  20. <li>
  21. <span style="min-width:450px;marginRight:260px;display:inline-block;">付款方式:{{contractInfo.PayMethod}}</span>
  22. <span>付款渠道:{{contractInfo.PayChannel}}</span>
  23. </li>
  24. <li v-if="contractInfo.PackageType">
  25. <p style="min-width:320px;marginRight:260px;display:inline-block;">套餐类型:<span class="setmeal-bg">{{contractInfo.PackageType==1 ?'大套餐':'小套餐'}}</span></p>
  26. </li>
  27. <li class="textarea_item" style="width:97%;">
  28. <label style="display:block;marginBottom:20px;fontSize:16px;position:relative;">
  29. 权限设置
  30. </label>
  31. <ul class="menu_lists">
  32. <template v-for="item in authList" >
  33. <li class="menu_item" v-if="item.CheckList.length" :key="item.ClassifyName">
  34. <el-checkbox :indeterminate="item.isIndeterminate" v-model="item.checkAll" disabled style="marginRight:30px;fontWeight:bold;">{{item.ClassifyName+':'}}</el-checkbox>
  35. <el-checkbox-group v-model="item.CheckList" disabled>
  36. <el-checkbox v-for="list in item.Items" :label="list.ChartPermissionId" :key="list.ChartPermissionId" class="list_item">{{list.PermissionName}}</el-checkbox>
  37. </el-checkbox-group>
  38. </li>
  39. </template>
  40. </ul>
  41. </li>
  42. <li class="textarea_item" style="width:97%;display:flex">
  43. <label style="marginRight:17px;fontSize:16px;position:relative;width:112px;">
  44. 查看合同附件
  45. </label>
  46. <ul class="img_cont">
  47. <li v-for="(img,index) in imglist" :key="img" class="img_item">
  48. <el-image :src="require('@/assets/img/constract/word-icon.png')" style="width:240px;height:180px;" v-if="img.indexOf('.doc')!=-1||img.indexOf('.docx')!=-1" @click.native="preview('img'+index,index,img)"></el-image>
  49. <pdf ref="pdf" :src="img" style="width:240px;height:180px;overflow:hidden" v-else-if="img.indexOf('.pdf')!=-1" @click.native="preview('img'+index,index,img)"></pdf>
  50. <el-image :src="img" alt="" style="background:#aaa;width:240px;height:180px;" :id="'img'+index" v-else @click.native="preview('img'+index,index,img)"/>
  51. <i class="el-icon-zoom-in" style="position:absolute;right:12px;top:12px;color:#fff;" @click="preview('img'+index,index,img)"></i>
  52. </li>
  53. </ul>
  54. </li>
  55. <li style="marginBottom:20px;">
  56. <label style="marginRight:40px;fontSize:16px;position:relative;padding-left:18px;">
  57. <i style="color:#f00;fontSize:20px;position:absolute;left:0;top:2px;">*</i>
  58. 审批状态
  59. </label>
  60. <el-radio-group v-model="status" size="medium" :disabled="isLook">
  61. <el-radio label="通过"></el-radio>
  62. <el-radio label="驳回" style="marginLeft:0;"></el-radio>
  63. </el-radio-group>
  64. </li>
  65. <li v-if="status=='驳回'">
  66. <label style="display:block;marginBottom:10px;fontSize:16px;position:relative;padding-left:18px;">
  67. <i style="color:#f00;fontSize:20px;position:absolute;left:0;top:2px;">*</i>
  68. 驳回理由
  69. </label>
  70. <el-input type="textarea" v-model="reason" rows="4" style="width:97%;" placeholder="输入理由" :disabled="isLook"></el-input>
  71. </li>
  72. <li style="display:flex;justify-content:center;margin:60px 0 0;" v-if="!isLook">
  73. <el-button type="primary" style="width:80px;marginRight:24px;" @click="ensureHandle">确定</el-button>
  74. <el-button type="primary" plain style="width:80px;" @click="cancelHandle">取消</el-button>
  75. </li>
  76. </ul>
  77. </div>
  78. </div>
  79. </div>
  80. <Ctimeline :id="companyId"></Ctimeline>
  81. <!-- 图片预览 -->
  82. <imgPreview
  83. :isShowToggle="isShowToggle"
  84. :isPreview="isPreviewimg"
  85. :arr="imglist"
  86. :actIndex="preAct"
  87. @close="closePreview"
  88. @togglePre="togglePre"></imgPreview>
  89. <!-- 客户基本信息弹窗 -->
  90. <CustomDtlDialog
  91. :isOpenCustomDtl="isOpenCustomDtl"
  92. :companyInfo="companyInfo"
  93. @cancelHandle="isOpenCustomDtl=false"
  94. />
  95. </div>
  96. </template>
  97. <script>
  98. import { customInterence } from '@/api/api.js'
  99. import { filterMoney } from '@/common/js/util'
  100. import Ctimeline from './compontents/Ctimeline.vue'
  101. import imgPreview from '@/components/imgPreview.vue'
  102. import CustomDtlDialog from './compontents/CustomDtlDialog.vue'
  103. import pdf from 'vue-pdf'
  104. import {CalculationDate} from '@/utils/CalculationDate'
  105. export default {
  106. name:'',
  107. components: { Ctimeline,pdf,imgPreview,CustomDtlDialog },
  108. filters:{
  109. //计算多少年 X年X个月X天
  110. formateYear(s,e) {
  111. return `有效期为${CalculationDate(s,e)}`
  112. },
  113. },
  114. data () {
  115. return {
  116. companyId:this.$route.query.id,
  117. contractId:this.$route.query.contractId,
  118. companyInfo:JSON.parse(sessionStorage.getItem('companyInfo')) || {},//客户基本信息
  119. contractInfo:{},//合同信息
  120. authList:[],//权限列表
  121. imglist:[],//合同列表图片
  122. status:'通过',
  123. reason:'',
  124. diff_time:'',
  125. isLook:this.$route.query.isLook || false,
  126. isPreviewimg:false,
  127. preAct:"",
  128. isShowToggle:false,//是否显示切换
  129. /* 客户信息弹窗 */
  130. isOpenCustomDtl:false,
  131. ProductId:0,
  132. };
  133. },
  134. methods: {
  135. /* 获取详情 */
  136. getCompanyInfo() {
  137. customInterence.approvalDetail({
  138. CompanyId:this.companyId,
  139. CompanyContractId:Number(this.contractId)
  140. }).then(res => {
  141. if(res.Ret === 200) {
  142. this.ProductId=res.Data.Item.ProductId
  143. /* 处理合同期限 截取一位小数剔除.0 */
  144. this.diff_time = Number(
  145. Number((
  146. (new Date(res.Data.Item.EndDate).getTime())
  147. -(new Date(res.Data.Item.StartDate).getTime())
  148. )/(1000*60*60*24*365))
  149. .toFixed(1).replace(/.0/,''));
  150. res.Data.Item.StartDate = res.Data.Item.StartDate.replace(/-/g,'.');
  151. res.Data.Item.EndDate = res.Data.Item.EndDate.replace(/-/g,'.');
  152. res.Data.Item.Money = filterMoney(res.Data.Item.Money);
  153. this.contractInfo = res.Data.Item;
  154. this.imglist = res.Data.Item.ImgUrl.split('#');//合同图片
  155. /* 权限 */
  156. let auth = [];
  157. res.Data.Item.PermissionList.forEach(item=> {
  158. let obj = {
  159. checkAll:item.CheckList&&item.CheckList.length===item.Items.length?true:false,
  160. isIndeterminate:item.CheckList&&item.CheckList.length>0 && item.CheckList.length<item.Items.length,
  161. ...item,
  162. }
  163. auth.push(obj)
  164. })
  165. this.authList = auth;
  166. }
  167. })
  168. },
  169. /* 确定 */
  170. ensureHandle() {
  171. if(this.status == '驳回' && !this.reason) {
  172. this.$message.warning('请填写驳回理由!');
  173. }else {
  174. customInterence.Approval({
  175. CompanyId:parseInt(this.companyId),
  176. Remark:this.reason,
  177. Status:this.status=='通过'?1:2,
  178. ProductId:this.ProductId,
  179. }).then(res => {
  180. if(res.Ret === 200) {
  181. this.$message.success(res.Msg);
  182. this.$router.go(-1);
  183. }
  184. })
  185. }
  186. },
  187. /* 取消 */
  188. cancelHandle() {
  189. this.$router.go(-1);
  190. },
  191. /* 选择全选或取消全选 */
  192. handleCheckAll(item) {
  193. // 取到所有的子菜单id
  194. let ids = item.Items.map(item =>{
  195. return item.ChartPermissionId
  196. })
  197. item.CheckList = item.checkAll ? ids : [];
  198. item.isIndeterminate = false;
  199. },
  200. /* 复选框組选中时 */
  201. handleChecked(item) {
  202. let len = item.CheckList.length;
  203. item.checkAll = len === item.Items.length;
  204. item.isIndeterminate = len > 0 && len < item.Items.length;
  205. },
  206. /* 预览 */
  207. preview(id,index,img) {
  208. // $('#'+id).click()
  209. if(img.indexOf('.pdf')!=-1){
  210. window.open(img);
  211. }else if(img.indexOf('.doc')!=-1||img.indexOf('.docx')!=-1){
  212. window.open('https://view.officeapps.live.com/op/view.aspx?src='+img,'_blank');
  213. }else{
  214. let bol = this.imglist.some(item => {
  215. return item.indexOf('.pdf') != -1
  216. })
  217. // 有pdf或图片只有一张
  218. if(bol || this.imglist.length<=1) {
  219. this.isShowToggle = false
  220. }else {
  221. this.isShowToggle = true
  222. }
  223. this.isPreviewimg = true;
  224. }
  225. // if(img.indexOf('.pdf') == -1) {
  226. // this.preAct = index;
  227. // /* 是否显示左右切换 */
  228. // let bol = this.imglist.some(item => {
  229. // return item.indexOf('.pdf') != -1
  230. // })
  231. // // 有pdf或图片只有一张
  232. // if(bol || this.imglist.length<=1) {
  233. // this.isShowToggle = false
  234. // }else {
  235. // this.isShowToggle = true
  236. // }
  237. // this.isPreviewimg = true;
  238. // }else {
  239. // window.open(img);
  240. // }
  241. },
  242. closePreview() {
  243. this.isPreviewimg = false;
  244. },
  245. togglePre(type) {
  246. if(type==1) {
  247. this.preAct--;
  248. if(this.preAct < 0) {
  249. this.preAct = this.formData.imglist.length-1;
  250. }
  251. }else {
  252. this.preAct++;
  253. if(this.preAct > this.formData.imglist.length-1) {
  254. this.preAct = 0;
  255. }
  256. }
  257. }
  258. },
  259. created() {},
  260. mounted() {
  261. /* 查看审批 */
  262. if(this.isLook) {
  263. this.status = this.companyInfo.ApproveStatus=='已审批'?'通过':this.companyInfo.ApproveStatus;
  264. this.reason = this.companyInfo.ApproveRemark;
  265. }
  266. this.getCompanyInfo()
  267. },
  268. computed:{
  269. ContractTermTxt(){
  270. let date = `${this.contractInfo.StartDate}-${this.contractInfo.EndDate}`;
  271. let calculation = CalculationDate(this.contractInfo.StartDate,this.contractInfo.EndDate);
  272. let str = this.contractInfo.Quarter ? this.contractInfo.Quarter + `(${date})` : date + `(${calculation})`;
  273. return str
  274. }
  275. },
  276. }
  277. </script>
  278. <style lang='scss'>
  279. .approvalTurn_box {
  280. display: flex;
  281. }
  282. .approvalTurn_container {
  283. flex: 1;
  284. margin-right: 20px;
  285. *{
  286. box-sizing: border-box;
  287. }
  288. /* reset */
  289. .el-collapse {
  290. border: none;
  291. }
  292. .el-collapse-item__header {
  293. display: block;
  294. border: none;
  295. font-size: 16px;
  296. color: #333;
  297. font-weight: bold;
  298. position: relative;
  299. }
  300. .el-collapse-item__content {
  301. padding-left: 30px;
  302. }
  303. .el-collapse-item__wrap {
  304. border: none;
  305. margin-top: 20px;
  306. }
  307. .el-form-item {
  308. margin-bottom: 40px;
  309. }
  310. .update_dialog .el-checkbox-group {
  311. height: 40px;
  312. }
  313. .textarea_item .el-form-item__content {
  314. width: 100%;
  315. }
  316. /* */
  317. .card_cont {
  318. margin-bottom: 20px;
  319. border: 1px solid #ECECEC;
  320. padding: 30px;
  321. background: #fff;
  322. border-radius: 4px;
  323. box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
  324. .btn_top {
  325. display: flex;
  326. justify-content: flex-end;
  327. }
  328. .info {
  329. margin-top: 10px;
  330. font-size: 16px;
  331. color: #666;
  332. .tit {
  333. color: #333;
  334. font-size: 16px;
  335. margin-bottom: 30px;
  336. }
  337. .info_list {
  338. display: flex;
  339. flex-wrap: wrap;
  340. padding-left: 30px;
  341. padding-bottom: 20px;
  342. li {
  343. margin-right: 113px;
  344. margin-bottom: 20px;
  345. min-width: 250px;
  346. }
  347. }
  348. }
  349. .history_item {
  350. margin-bottom: 60px;
  351. margin-top: 30px;
  352. padding-left: 30px;
  353. font-size: 16px;
  354. color: #666;
  355. &:last-child {
  356. margin-bottom: 0;
  357. }
  358. .contract_type_hint{
  359. font-size: 14px;
  360. color:#f59a23;
  361. border: solid 1px #f59a23;
  362. padding: 2px 6px;
  363. margin-left: 12px;
  364. }
  365. .detail_item {
  366. font-size: 16px;
  367. color: #666;
  368. margin-top: 30px;
  369. li {
  370. margin-bottom: 30px;
  371. &:last-child {
  372. margin-bottom: 0;
  373. }
  374. }
  375. }
  376. }
  377. }
  378. .menu_lists {
  379. padding: 40px 18px;
  380. border: 1px dashed #AAB4CC;
  381. border-radius: 4px;
  382. .menu_item {
  383. display: flex;
  384. // align-items: center;
  385. margin-bottom: 40px;
  386. &:last-child {
  387. margin-bottom: 0;
  388. }
  389. .list_item {
  390. margin-right: 30px;
  391. &:last-child {
  392. margin-right: 0;
  393. }
  394. }
  395. }
  396. }
  397. .textarea_item {
  398. .img_cont {
  399. width: 100%;
  400. display: flex;
  401. flex-wrap: wrap;
  402. .img_item {
  403. position: relative;
  404. margin-right: 15px;
  405. &:last-child {
  406. margin-right: 0;
  407. }
  408. }
  409. }
  410. }
  411. .setmeal-bg {
  412. background-color: #dcecfc;
  413. padding: 5px 15px;
  414. border-radius: 5px;
  415. color:#3994fb;
  416. }
  417. }
  418. </style>