zzSupplierExDetail.vue 11 KB

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