zzSupplierExDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <template>
  2. <view>
  3. <view style="margin:8px;position: fixed;z-index: 50;opacity:0.7;" >
  4. <button type="default" style="border-radius: 5px;" class="mini-btn" size="mini" @click="modify" v-show="entity.state==0">修改</button>
  5. <button type="default" style="border-radius: 5px;margin-left:15px;" class="mini-btn" size="mini" @click="delSupplier" v-show="entity.state==0">删除</button>
  6. <button type="default" style="border-radius: 5px;margin-left:15px;" class="mini-btn" size="mini" @click="submit" v-show="entity.state==0">提交</button>
  7. <button type="default" style="border-radius: 5px;margin-left:15px;" class="mini-btn" size="mini" @click="pass" v-show="entity.state==1">通过</button>
  8. <button type="default" style="border-radius: 5px;margin-left:15px;" class="mini-btn" size="mini" @click="back" v-show="entity.state==1">退回</button>
  9. </view>
  10. <uni-list style="padding-top:30px;">
  11. <uni-list-item >
  12. <view slot="body" class="slot-box">
  13. <view class="row">
  14. <view class="column-left">编号:</view>
  15. <view class="column-right section-title">{{entity.id}}</view>
  16. </view>
  17. <view class="row">
  18. <view class="column-left">标题:</view>
  19. <view class="column-right">{{entity.title}}</view>
  20. </view>
  21. <view class="row">
  22. <view class="column-left">状态:</view>
  23. <view class="column-right">{{entity.stateName}}</view>
  24. </view>
  25. <view class="row">
  26. <view class="column-left">申请日期:</view>
  27. <view class="column-right">{{entity.createDateStr}}</view>
  28. </view>
  29. <view class="row">
  30. <view class="column-left">项目:</view>
  31. <view class="column-right">{{entity.projectName}}</view>
  32. </view>
  33. <view class="row">
  34. <view class="column-left">原因:</view>
  35. <view class="column-right">{{entity.reason}}</view>
  36. </view>
  37. <view class="row">
  38. <view class="column-left">附件:</view>
  39. <view class="column-right">
  40. <view v-for="(item,index) in attachments" :key="index">
  41. <a :href="'/api/common/ShowImg?code='+item.attachMentCode">{{item.fileName}}</a>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="row">
  46. <view class="column-left">转签证:</view>
  47. <view class="column-right"><router-link :to="'/pages/template/requisitionadd/requisitionadd?type=0&zzSupplierExid='+$util.getQuery('id')">转签证申请单</router-link></view>
  48. </view>
  49. </view>
  50. </uni-list-item>
  51. </uni-list>
  52. <view class="uni-form-item uni-column" v-show="isUpload">
  53. <view class="title" style="background-color: #efefef;"><text class="uni-form-item__title">上传文件</text></view>
  54. <view class="content">
  55. <g-upfile ref='gUpfile' :mode="imgList" @chooseFile='chooseFile' @imgDelete='imgDelete' :control='control'
  56. :columnNum="columnNum" :maxCount="maxCount" @limitFileSizeList='limitFileSizeList' @limitFileTypeList='limitFileTypeList' :maxFileSize="20000"></g-upfile>
  57. </view>
  58. </view>
  59. <view class="uni-btn-v uni-column" v-show="isUpload">
  60. <button type="primary" form-type="submit" style="border-radius: 15px;" @click="upload">上传附件</button>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. import {
  66. GetzzSupplierEx,DeletezzSupplierEx,SubmitzzSupplierEx,AuditzzSupplierEx
  67. } from "@/common/api/requisitionApi.js";
  68. import {
  69. showImage
  70. } from "@/common/api/commonApi.js";
  71. export default {
  72. data() {
  73. return {
  74. entity: {}, //申请单
  75. attachments: [], //附件
  76. unitCodeName: '',
  77. procedureName:"",
  78. isShow:false, //修改按钮是否显示
  79. isWorkFlow:false, //流程审核按钮是否显示
  80. isUpload:false, //是否显示上传组件及上传按钮
  81. control: true,
  82. columnNum: 3,
  83. imgList: [],
  84. urlList:[],
  85. maxCount:5,
  86. imageList: [],
  87. countIndex: 5,
  88. count: [1, 2, 3, 4, 5],
  89. }
  90. },
  91. onLoad(event) {
  92. if (this.$store == null || this.$store.state == null) {
  93. uni.navigateTo({
  94. url: '../../LoginSupplier/LoginSupplier'
  95. });
  96. //console
  97. return;
  98. }
  99. console.info("当前登录状态:" + this.$store.state.isLogin);
  100. //console.info(this);
  101. this.$util.persistLogin(this);
  102. },
  103. created: function() {
  104. if(this.$store.state.user.userCode!=undefined)
  105. {
  106. uni.setNavigationBarTitle({
  107. title:"供应商申请明细"
  108. });
  109. }
  110. else{
  111. uni.setNavigationBarTitle({
  112. title:"我的申请明细"
  113. });
  114. }
  115. let id = this.$util.getQuery('id');
  116. if (!id) {
  117. uni.navigateTo({
  118. url: '../SupplierList/SupplierList'
  119. })
  120. return;
  121. }
  122. this.getDetail(id);
  123. },
  124. computed:function(){
  125. },
  126. methods: {
  127. getDetail(id) {
  128. let that = this;
  129. GetzzSupplierEx(id).then((res) => {
  130. console.info('GetzzSupplierEx res', res);
  131. if(typeof res!='string')
  132. {
  133. that.entity = res.entity;
  134. res.attachments.forEach(function(item, index, arr) {
  135. that.$set(that.attachments, index, item);
  136. });
  137. if(that.entity.state>=1&&that.$store.state.user.userCode==undefined)
  138. {
  139. that.isUpload=true;
  140. }
  141. else{
  142. that.isUpload=false;
  143. }
  144. }
  145. else{
  146. uni.showModal({
  147. content:res,
  148. });
  149. return;
  150. }
  151. });
  152. },
  153. /* 显示部门 */
  154. GetDepartment: function(unitcode) {
  155. let that = this;
  156. GetUserDepartment(unitcode).then((res) => {
  157. console.info(res);
  158. that.unitCodeName = res;
  159. });
  160. },
  161. /* 流程审核按钮点击事件处理 */
  162. workFlow:function(){
  163. let url="../GetWorkFlowProcedureList/GetWorkFlowProcedureList?procedureName="+this.procedureName+"&applicationCode="+this.$util.getQuery("id");
  164. uni.navigateTo({ //跳转到流程控制列表页面
  165. url:url
  166. });
  167. },
  168. showImage: function(code) {
  169. console.info('showimage', code);
  170. uni.navigateTo({
  171. url: '/api/common/ShowImg?code=' + code
  172. })
  173. },
  174. modify: function() { //跳转到修改页面
  175. let id = this.$util.getQuery("id");
  176. uni.navigateTo({
  177. url: '/pages/template/UpdatezzSupplierEx/UpdatezzSupplierEx?id=' + id
  178. });
  179. },
  180. delSupplier: function() { //删除
  181. let id = this.$util.getQuery("id");
  182. let supplierCode=this.$store.state.user.supplierCode;
  183. DeletezzSupplierEx(supplierCode,id).then((res)=>{
  184. console.info("删除结果",res);
  185. if(res=="success"){
  186. uni.navigateTo({
  187. url:'/pages/template/SupplierList/SupplierList'
  188. })
  189. }
  190. else{
  191. uni.showToast({
  192. title:res,
  193. icon:'none',
  194. duration:3000
  195. })
  196. }
  197. });
  198. },
  199. submit: function() { //提交审核
  200. let id = this.$util.getQuery("id")-0;
  201. var dto={id:id,projectCode:this.entity.projectCode,supplierCode:this.entity.supplierCode,state:1};
  202. console.info('提交dto',dto);
  203. SubmitzzSupplierEx(dto).then((res)=>{
  204. console.info("提交结果",res);
  205. if(res=="success"){
  206. uni.navigateTo({
  207. url:'/pages/template/SupplierList/SupplierList'
  208. })
  209. }
  210. else{
  211. uni.showToast({
  212. title:res,
  213. icon:'none',
  214. duration:3000
  215. })
  216. }
  217. });
  218. },
  219. pass: function() { //审核通过
  220. let id = this.$util.getQuery("id")-0;
  221. var dto={id:id,projectCode:this.entity.projectCode,supplierCode:this.entity.supplierCode,state:2};
  222. console.info('通过dto',dto);
  223. AuditzzSupplierEx(dto).then((res)=>{
  224. console.info("审核结果",res);
  225. if(res=="success"){
  226. if(this.$store.state.user.userCode!=undefined){
  227. uni.navigateTo({
  228. url:'/pages/template/SupplierList/SupplierList?projectCode='+this.$store.state.projectCode
  229. })
  230. }
  231. else{
  232. uni.navigateTo({
  233. url:'/pages/template/SupplierList/SupplierList'
  234. })
  235. }
  236. }
  237. else{
  238. uni.showToast({
  239. title:res,
  240. icon:'none',
  241. duration:3000
  242. })
  243. }
  244. });
  245. },
  246. back: function() { //审核退回
  247. let id = this.$util.getQuery("id")-0;
  248. var dto={id:id,projectCode:this.entity.projectCode,supplierCode:this.entity.supplierCode,state:0};
  249. console.info('退回dto',dto);
  250. AuditzzSupplierEx(dto).then((res)=>{
  251. console.info("审核结果",res);
  252. if(res=="success"){
  253. if(this.$store.state.user.userCode!=undefined){
  254. uni.navigateTo({
  255. url:'/pages/template/SupplierList/SupplierList?projectCode='+this.$store.state.projectCode
  256. })
  257. console.info("aa");
  258. }
  259. else{
  260. uni.navigateTo({
  261. url:'/pages/template/SupplierList/SupplierList'
  262. })
  263. }
  264. }
  265. else{
  266. uni.showToast({
  267. title:res,
  268. icon:'none',
  269. duration:3000
  270. })
  271. }
  272. });
  273. },
  274. /*
  275. 上传后返回的值:
  276. list:上传后图片数组
  277. v:返回当前上传图片的临时路径
  278. */
  279. chooseFile(list, v) {
  280. console.log("上传图片_list:", list)
  281. console.log("上传图片_v:", v);
  282. this.urlList=list;
  283. console.info("urlList",this.urlList);
  284. },
  285. /*
  286. 删除图片:
  287. list:删除返回删除后剩余的图片数组
  288. eq:返回删除的数组
  289. */
  290. imgDelete(list, eq) {
  291. console.log("删除图片_list:", list);
  292. console.log("删除图片_eq:", eq);
  293. this.urlList=list;
  294. console.info("urlList",this.urlList);
  295. },
  296. /*限制文件大小列表*/
  297. limitFileSizeList(list){
  298. console.info('limitFileSizeList:',list);
  299. if(list){
  300. if(list.length>0){
  301. uni.showModal({
  302. title:'警告',
  303. content: list.join()+' 文件大小超过2000KB',
  304. showCancel:false
  305. });
  306. }
  307. }
  308. },
  309. /*限制文件类型列表*/
  310. limitFileTypeList(list,allowFileType){
  311. console.info('limitFileTypeList:',list);
  312. console.info('limitFileTypeList:',allowFileType);
  313. if(list){
  314. if(list.length>0){
  315. uni.showModal({
  316. title:'警告',
  317. content: list.join()+' 文件类型必须是'+allowFileType.join(),
  318. showCancel:false
  319. });
  320. }
  321. }
  322. },
  323. upload:function(){
  324. this.uploadFileToServe(this.$util.getQuery("id")) ;
  325. },
  326. /*
  327. 执行上传服务:
  328. urlList:要上传的图片:数组类型
  329. */
  330. uploadFileToServe(masterCode) {
  331. let _this=this;
  332. var urlList=_this.urlList;
  333. if (!urlList || urlList.length <= 0) {
  334. return;
  335. };
  336. //console.info(urlList);
  337. //return;
  338. for (let i = 0; i < urlList.length; i++) {
  339. console.info('x-token',_this.$store.state.token.tokenStr);
  340. uni.uploadFile({
  341. url: '/api/Common/UploadImage',
  342. filePath: urlList[i],
  343. name: 'file',
  344. formData: {
  345. createPerson:_this.$store.state.user.supplierCode,
  346. masterCode:masterCode,
  347. attachMentType:'zzSupplierExAttach'
  348. },
  349. headers: {
  350. 'Content-Type': 'multipart/form-data; boundary = ' + new Date().getTime(),
  351. 'X-Token':_this.$store.state.token.tokenStr
  352. //这里要把content-type设置为multipard/form-data,同时还要设置boundary
  353. },
  354. success: (uploadFileRes) => {
  355. console.log("图片上传:",uploadFileRes.data);
  356. this.getDetail(masterCode);
  357. //this.urlList=[];
  358. }
  359. });
  360. }
  361. }
  362. }
  363. }
  364. </script>
  365. <style scoped>
  366. </style>