ModifyProblem.cshtml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. 
  2. @{
  3. ViewBag.Title = "ModifyProblem";
  4. Layout = "~/Views/MobileProblem/_APPMain.cshtml";
  5. }
  6. <link href="~/Content/Scripts/plugins/mui/css/webuploader.css" rel="stylesheet" />
  7. <link href="~/Content/Scripts/plugins/mui/css/mui.imageviewer.css" rel="stylesheet" />
  8. <link href="~/Content/Style/MobileProductRegist/Mui-Preview.css" rel="stylesheet" />
  9. <script src="~/Content/Style/MobileProductRegist/ProblemIcon.js"></script>
  10. <script src="~/Content/Scripts/plugins/mui/js/webuploader.js?v=1.3"></script>
  11. <script type="text/babel" src="~/Content/Scripts/plugins/mui/js/PlusUploader.js?v=1.81"></script>
  12. <script src="~/Content/Scripts/plugins/mui/js/mui.zoom.js"></script>
  13. <script src="~/Content/Scripts/plugins/mui/js/mui.previewimage.js"></script>
  14. <script src="https://cdn.staticfile.org/vue-resource/1.5.1/vue-resource.min.js"></script>
  15. <script src="~/Content/Scripts/babel.min.js"></script>
  16. <script src="~/Content/Scripts/polyfill.min.js"></script>
  17. <style>
  18. .mui-btn-primary {
  19. border: 1px solid #00aaff;
  20. background-color: #00aaff;
  21. }
  22. .radiodiv {
  23. display: flex;
  24. flex-direction: row;
  25. background-color: white;
  26. font-size: 14px;
  27. padding: 0 10px;
  28. }
  29. .mui-input-row label {
  30. padding: 11px 20px 11px 13px;
  31. margin-left: 20px;
  32. }
  33. .mui-radio input[type='radio'] {
  34. left: 0;
  35. }
  36. [v-cloak] {
  37. display: none;
  38. }
  39. .UplodImg {
  40. display: flex;
  41. justify-content: space-between;
  42. flex-direction: row;
  43. align-content: center;
  44. padding: 7px 27px;
  45. }
  46. .filep {
  47. -webkit-line-clamp: 1;
  48. overflow: hidden;
  49. word-break: break-all;
  50. display: -webkit-box;
  51. -webkit-box-orient: vertical;
  52. text-overflow: ellipsis;
  53. position: absolute;
  54. bottom: 12px;
  55. background-color: rgba(0, 0, 0, 0.6);
  56. font-size: 13px;
  57. color: white;
  58. width: 100px;
  59. }
  60. .destory {
  61. position: absolute;
  62. top: 0;
  63. right: -6px;
  64. width: 10px;
  65. height: 10px;
  66. font-size: 20px;
  67. color: #cc9a9a;
  68. margin-bottom: 11px;
  69. transition: color 0.2s ease-out;
  70. background-color: transparent;
  71. border: transparent;
  72. }
  73. .destory:after {
  74. content: '×';
  75. position: absolute;
  76. top: -10px;
  77. right: 5px;
  78. }
  79. .mui-grid-view.mui-grid-9 .mui-media {
  80. border-right: transparent;
  81. border-bottom: transparent;
  82. }
  83. .Fileflex {
  84. display: flex;
  85. flex-direction: row;
  86. justify-content: flex-start;
  87. flex-wrap: wrap;
  88. align-items: center;
  89. padding:10px;
  90. background-color:white;
  91. }
  92. .destory {
  93. position: absolute;
  94. top: 0;
  95. right: -6px;
  96. width: 10px;
  97. height: 10px;
  98. font-size: 20px;
  99. color: #cc9a9a;
  100. margin-bottom: 11px;
  101. transition: color 0.2s ease-out;
  102. background-color: transparent;
  103. border: transparent;
  104. }
  105. .destory:after {
  106. content: '×';
  107. position: absolute;
  108. top: -10px;
  109. right: 5px;
  110. }
  111. </style>
  112. <div id="vue" v-cloak>
  113. <header class="mui-bar mui-bar-nav">
  114. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" style="color:#ffffff"></a>
  115. <h1 class="mui-title" style="color:white">修改问题</h1>
  116. </header>
  117. <nav class="mui-bar mui-bar-tab">
  118. <button v-on:click="ModifySubmit()" type="button" class="mui-btn mui-btn-primary" style="width:90%;background-color: #2ab8ff;border:none;margin-left:5%">确定修改</button>
  119. </nav>
  120. <div class="mui-content mui-scroll-wrapper" id="pullrefresh">
  121. <div class="mui-scroll">
  122. <h5 class="mui-content-padded">标题</h5>
  123. <div class="mui-input-row" style="margin-top: 7px">
  124. <input v-model="ProblemTitile" id="ProblemTitile" type="text" class="mui-input-clear" placeholder="填写问题标题" style="font-size:15px">
  125. </div>
  126. <h5 class="mui-content-padded">描述</h5>
  127. <div class="mui-input-row" style="font-size:14px">
  128. <textarea v-model="detail" id="detail" rows="8" placeholder="请填写具体的问题描述,以便我们更详细的了解您需要解决的问题。" style="font-size:15px;margin-bottom:-10px"></textarea>
  129. </div>
  130. <div v-if="PersonProperty!='3'">
  131. <h5 class="mui-content-padded">登记来源</h5>
  132. <select v-model="Origin" class="mui-btn mui-btn-block" style="font-size:15px;padding-left:20px">
  133. <option v-for="os in OriginSelec" v-bind:value="os.代码">{{os.显示名}}</option>
  134. </select>
  135. <h5 class="mui-content-padded">问题性质</h5>
  136. <div class="radiodiv">
  137. <div v-for="pn in ProblemNatureSelec" class="mui-input-row mui-radio ">
  138. <label>{{pn.显示名}}</label>
  139. <input v-model="ProblemNature" name="radio3" type="radio" v-bind:value="pn.代码">
  140. </div>
  141. </div>
  142. <h5 class="mui-content-padded">处理状态</h5>
  143. <div class="radiodiv">
  144. <div class="mui-input-row mui-radio ">
  145. <label>未处理</label>
  146. <input v-model="DealStatus" name="radio1" type="radio" value="0">
  147. </div>
  148. <div class="mui-input-row mui-radio ">
  149. <label>已处理</label>
  150. <input v-model="DealStatus" name="radio1" type="radio" value="1">
  151. </div>
  152. </div>
  153. <div v-if="DealStatus==1" class="mui-input-row" style="font-size:14px">
  154. <textarea v-model="DealDetail" rows="6" placeholder="请填写处理描述说明" style="font-size:15px;margin-top:20px"></textarea>
  155. </div>
  156. <h5 class="mui-content-padded">紧急程度</h5>
  157. <div class="radiodiv">
  158. <div v-for="er in ErginSelec" class="mui-input-row mui-radio ">
  159. <label>{{er.显示名}}</label>
  160. <input v-model="ErginID" name="radio2" type="radio" v-bind:value="er.代码">
  161. </div>
  162. </div>
  163. <ul class="mui-table-view">
  164. <li class="mui-table-view-cell" style="font-size:14px">
  165. 要求时间
  166. <button type="button" data-options='{"type":"date","beginYear":2017,"endYear":2019}' class="mui-btn time-btn">
  167. {{RequireTime}}
  168. </button>
  169. </li>
  170. </ul>
  171. <div class="mui-input-row" style="font-size:14px;margin-bottom:10px;margin-top:20px">
  172. <textarea v-model="urgentDetail" id="urgentDetail" rows="6" placeholder="请填写紧急描述说明" style="font-size:15px;"></textarea>
  173. </div>
  174. </div>
  175. <h5 class="mui-content-padded">已提交图片及附件</h5>
  176. <div v-if="File" class="Fileflex">
  177. <template v-for="item in File">
  178. <div v-if="item.类型=='1'" v-bind:id="item.附件ID" style="position:relative">
  179. <img data-preview-src='' data-preview-group='2' v-bind:src="item.图片ID" style='width:50px;height:50px;padding:5px 5px 5px 0'>
  180. <button class="destory" v-on:click="DeleteFile(item.附件ID)"></button>
  181. </div>
  182. <div v-if="item.类型=='2'" v-bind:id="item.附件ID" style="position:relative">
  183. <a style="padding:17px;color:#80b4fb;font-size:14px"><span class="mui-icon mui-icon-paperclip" style="font-size:33px"></span></a>
  184. <button class="destory" style="top:-10px" v-on:click="DeleteFile(item.附件ID)"></button>
  185. </div>
  186. </template>
  187. </div>
  188. <div style="background-color:white;margin-top:10px">
  189. <div class="UplodImg" id="pickImg">
  190. <h4 style="font-weight:400">图片</h4>
  191. <div>
  192. <span class="mui-icon mui-icon-camera" id="pickCamera" style="color:#1296db;margin-right:20px"></span>
  193. <span class="mui-icon mui-icon-image" id="pickPhoto" style="color:#1296db"></span>
  194. </div>
  195. </div>
  196. <ul id="ImgList" class="mui-table-view mui-grid-view mui-grid-9" style="background-color:white;border-color:transparent;margin:0"></ul>
  197. </div>
  198. <div style="background-color:white;border-top: solid 1px #efeff4;">
  199. <div class="UplodImg" id="pickFlie">
  200. <h4 style="font-weight:400">附件</h4>
  201. <span class="mui-icon mui-icon-paperclip" style="color:#1296db"></span>
  202. </div>
  203. <ul id="FileList" class="mui-table-view mui-grid-view mui-grid-9" style="background-color:white;border-color:transparent;"></ul>
  204. </div>
  205. <div style="display:none" id="picker">选择文件</div>
  206. <div style="display:none" id="picker2">选择文件</div>
  207. <button style="margin-top: 30px;display:none;" id="ctlBtn" class="btn btn-default">图片上传</button>
  208. </div>
  209. </div>
  210. </div>
  211. <script type="text/babel">
  212. var Count = 0;
  213. var ProblemProcessIDtoImg;
  214. var lod;
  215. var IsPlus = mui.os.plus ? true : false;
  216. var ID = '@ViewBag.ID';
  217. var PersonProperty = '@ViewBag.PersonProperty';
  218. var vm = new Vue({
  219. el: '#vue',
  220. data: {
  221. ProblemTitile: '',
  222. detail: '',
  223. OriginSelec: '',
  224. Origin: '',
  225. ///问题性质
  226. ProblemNature: '',
  227. ///问题性质选择项
  228. ProblemNatureSelec: null,
  229. ///紧急程度选择项
  230. ErginSelec: null,
  231. ///紧急程度
  232. ErginID: '',
  233. ///紧急描述
  234. urgentDetail: '',
  235. ///紧急处理时间
  236. RequireTime: '请选择时间',
  237. ///项目人员选择的处理状态
  238. DealStatus: 0,
  239. ///处理描述说明
  240. DealDetail: '',
  241. PersonProperty: PersonProperty,
  242. //附件
  243. File:[]
  244. },
  245. watch: {
  246. },
  247. methods: {
  248. ///获取登记来源
  249. GetOriginSelec: function () {
  250. this.$http.get('/MobileProblem/GetComboboxByCode/026').then(function (res) {
  251. this.OriginSelec = res.body;
  252. this.Origin = this.OriginSelec[1].代码;
  253. }, function (res) {
  254. console.log(res.status);
  255. });
  256. },
  257. ///获取问题性质
  258. GetProblemNatureSelec: function () {
  259. this.$http.get('/MobileProblem/GetComboboxByCode/013').then(function (res) {
  260. this.ProblemNatureSelec = res.body;
  261. this.ProblemNature = this.ProblemNatureSelec[0].代码;
  262. }, function (res) {
  263. console.log(res.status);
  264. });
  265. },
  266. ///获取紧急程度选择项
  267. GetErgin: function () {
  268. this.$http.get('/MobileProblem/GetComboboxByCode/014').then(function (res) {
  269. this.ErginSelec = res.body;
  270. this.ErginID = this.ErginSelec[0].代码;
  271. }, function (res) {
  272. console.log(res.status);
  273. });
  274. },
  275. ///实例化日期组件
  276. loadTime: function () {
  277. var that = this;
  278. var btns = $('.time-btn');
  279. btns.each(function (i, btn) {
  280. btn.addEventListener('tap', function () {
  281. var _self = this;
  282. if (_self.picker) {
  283. _self.picker.show(function (rs) {
  284. btn.innerHTML = rs.text;
  285. _self.picker.dispose();
  286. _self.picker = null;
  287. });
  288. } else {
  289. var optionsJson = this.getAttribute('data-options') || '{}';
  290. var options = JSON.parse(optionsJson);
  291. var id = this.getAttribute('id');
  292. _self.picker = new mui.DtPicker(options);
  293. _self.picker.show(function (rs) {
  294. that.RequireTime = rs.text;
  295. _self.picker.dispose();
  296. _self.picker = null;
  297. });
  298. }
  299. }, false);
  300. })
  301. },
  302. //获取问题数据
  303. GetProblem () {
  304. var that = this;
  305. this.$http.get('/MobileProblem/GetProblemInfomation/' + ID).then(function (res) {
  306. that.ProblemTitile = res.body[0].问题标题;
  307. that.detail = res.body[0].问题描述.replace(/<[^>]+>/g, "");
  308. if (that.PersonProperty != '3') {
  309. that.Origin = res.body[0].来源代码;
  310. ///问题性质
  311. that.ProblemNature = res.body[0].问题性质;
  312. ///紧急程度
  313. that.ErginID = res.body[0].紧急代码;
  314. ///紧急描述
  315. that.urgentDetail = res.body[0].紧急描述;
  316. ///紧急处理时间
  317. that.RequireTime = res.body[0].要求时间 ? res.body[0].要求时间 : '请选择时间';
  318. ///项目人员选择的处理状态
  319. that.DealStatus = res.body[0].是否解决;
  320. ///处理描述说明
  321. that.DealDetail = res.body[0].解决方案;
  322. }
  323. }, function (res) {
  324. console.log(res.status);
  325. });
  326. },
  327. //获取附件
  328. GetProblemFlie() {
  329. var that = this;
  330. $.post("/MobileProblem/GetProblemFlie/" + ID, {}, (data) => {
  331. for(var item of data){
  332. if (item.类型 == '1') {
  333. item.图片ID = "/MobileProblem/ViewProblemImage/" + item.附件ID + "?type=o";
  334. }
  335. }
  336. that.File = data;
  337. })
  338. },
  339. //删除附件
  340. DeleteFile (id) {
  341. mui.confirm('确定要删除该附件吗?', '提示', ['否', '是'], function (e) {
  342. if (e.index == 1) {
  343. $.post("/Problem/Delete_Img/"+id, function (data) {
  344. if (data ==1) {
  345. mui.toast("删除成功!", { duration: 'long', type: 'div' });
  346. $("#" + id).remove();
  347. }
  348. else {
  349. mui.toast("删除失败!", { duration: 'long', type: 'div' });
  350. }
  351. })
  352. }
  353. })
  354. },
  355. ModifySubmit() {
  356. var param = {
  357. ProblemTitile: this.ProblemTitile,
  358. detail: this.detail,
  359. DealStatus: this.DealStatus,
  360. DealDetail: this.DealDetail,
  361. ErginID: this.ErginID,
  362. urgentDetail: this.urgentDetail,
  363. RequireTime: this.RequireTime,
  364. Origin: this.Origin,
  365. ProblemNature: this.ProblemNature,
  366. ProblemId: ID
  367. }
  368. lod = mui.showLoading("操作中..", "div");
  369. $.post("/MobileProblem/ModifySubmit", param, function (data) {
  370. if (data.code == 200) {
  371. ProblemProcessIDtoImg = data.msg;
  372. $("#ctlBtn").click();
  373. } else {
  374. mui.toast(data.msg, { duration: 'long', type: 'div' });
  375. }
  376. })
  377. },
  378. ///初始化图片上传插件
  379. ImagUploaderInit: function () {
  380. var that = this;
  381. var $list = $("#ImgList");
  382. var $list2 = $("#FileList");
  383. var $btn = $("#ctlBtn");
  384. var thumbnailWidth = 100;
  385. var thumbnailHeight = 100;
  386. var uploader = WebUploader.create({
  387. // 选完文件后,是否自动上传。
  388. auto: false,
  389. // swf文件路径
  390. swf: '/Content/Scripts/plugins/mui/js/Uploader.swf',
  391. // 文件接收服务端。
  392. server: '/MobileProblem/FlieUploadAndSave',
  393. // 选择文件的按钮。可选。
  394. // 内部根据当前运行是创建,可能是input元素,也可能是flash.
  395. pick: '#picker2',
  396. compress: {
  397. width: 1600,
  398. height: 1600,
  399. // 图片质量,只有type为`image/jpeg`的时候才有效。
  400. quality: 90,
  401. // 是否允许放大,如果想要生成小图的时候不失真,此选项应该设置为false.
  402. allowMagnify: false,
  403. // 是否允许裁剪。
  404. crop: false,
  405. // 是否保留头部meta信息。
  406. preserveHeaders: true,
  407. // 如果发现压缩后文件大小比原来还大,则使用原来图片
  408. // 此属性可能会影响图片自动纠正功能
  409. noCompressIfLarger: false,
  410. // 单位字节,如果图片大小小于此值,不会采用压缩。
  411. compressSize: 0
  412. }
  413. });
  414. uploader.on('fileQueued', function (file) {
  415. var $li = $(
  416. '<li id="' + file.id + '" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><img > <button class="destory" ></button><p class="filep">' + file.name + '</p> </li>'
  417. ),
  418. $img = $li.find('img');
  419. // $list为容器jQuery实例
  420. if (file.type.substring(0, 5) == "image") {
  421. $list.append($li);
  422. } else {
  423. $list2.append('<li id="' + file.id + '" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><span class="mui-icon mui-icon-upload" style="padding-bottom:10px"></span><button class="destory" ></button>' +
  424. '<p class="filep">' + file.name + '</p> </li>');
  425. }
  426. $("#" + file.id).children(".destory").click(() => {
  427. uploader.removeFile(file);
  428. $("#" + file.id).remove();
  429. })
  430. // 创建缩略图
  431. // 如果为非图片文件,可以不用调用此方法。
  432. // thumbnailWidth x thumbnailHeight 为 100 x 100
  433. uploader.makeThumb(file, function (error, src) {
  434. if (error) {
  435. $img.replaceWith('<span>不能预览</span>');
  436. return;
  437. }
  438. $img.attr('src', src);
  439. }, thumbnailWidth, thumbnailHeight);
  440. });
  441. // 文件上传成功,给item添加成功class, 用样式标记上传成功。
  442. uploader.on('uploadSuccess', function (file, response) {
  443. $('#' + file.id).addClass('upload-state-done');
  444. if (response.msg = "1") {
  445. Count += 1;
  446. }
  447. });
  448. // 文件上传失败,显示上传出错。
  449. uploader.on('uploadError', function (file) {
  450. var $li = $('#' + file.id),
  451. $error = $li.find('div.error');
  452. // 避免重复创建
  453. if (!$error.length) {
  454. $error = $('<div class="error"></div>').appendTo($li);
  455. }
  456. $error.text('上传失败');
  457. });
  458. // 完成上传完了,成功或者失败,先删除进度条。
  459. uploader.on('uploadComplete', function (file) {
  460. $('#' + file.id).find('.progress').remove();
  461. });
  462. uploader.on('uploadFinished', function () {
  463. mui.hideLoading(lod);
  464. if (IsPlus) {
  465. that.FivePlusUploder.uplod(ProblemProcessIDtoImg, lod);
  466. } else {
  467. mui.alert("问题修改成功", "提交成功", "确定", function () {
  468. window.location.href = '/MobileProblem/ProblemDetail/' + ID;
  469. }, 'div');
  470. }
  471. });
  472. $btn.on('click', function () {
  473. uploader.options.formData.ProcessId = ProblemProcessIDtoImg;
  474. uploader.upload();
  475. });
  476. if (!IsPlus) {
  477. document.getElementById('pickImg').addEventListener('tap', function () {
  478. $("#picker").find('.webuploader-element-invisible').click();
  479. });
  480. }
  481. document.getElementById('pickFlie').addEventListener('tap', function () {
  482. $("#picker2").find('.webuploader-element-invisible').click();
  483. });
  484. uploader.addButton({
  485. id: '#picker',
  486. innerHTML: '选择文件',
  487. accept: {
  488. title: 'Images',
  489. extensions: 'gif,jpg,jpeg,bmp,png',
  490. mimeTypes: 'image/*',
  491. },
  492. capture: 'camera'
  493. });
  494. },
  495. LoadUploder: function () {
  496. this.ImagUploaderInit();
  497. if (IsPlus) {
  498. this.FivePlusUploder = new FivePlus({
  499. href: '/MobileProblem/ProblemDetail/' + ID,
  500. SuceessText: '修改成功!'
  501. });
  502. }
  503. },
  504. init () {
  505. mui.init();
  506. mui.previewImage();
  507. mui('.mui-scroll-wrapper').scroll()
  508. this.loadTime()
  509. if (this.PersonProperty != '3') {
  510. this.GetOriginSelec();
  511. this.GetProblemNatureSelec();
  512. this.GetErgin();
  513. }
  514. this.GetProblem();
  515. this.GetProblemFlie();
  516. this.LoadUploder();
  517. }
  518. },
  519. mounted: function () {
  520. this.init()
  521. }
  522. })
  523. </script>