documentCollectionApprovalExcel.vue 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184
  1. <template>
  2. <div class="container" id="container" v-loading="loading">
  3. <fullscreen :fullscreen.sync="fullscreen" class="container" style="margin: 0;width: 100%;">
  4. <iframe height="100%" width="100%" src="/marketfront/static/views/performance.html" frameborder="0" ref="iframe"
  5. name="excelIframe" id="excelIframe"></iframe>
  6. </fullscreen>
  7. <el-dialog :title="'督办'" :visible.sync="dubanStatus" width="50%" :destroy-on-close="true"
  8. :modal-append-to-body="false" :close-on-click-modal="false">
  9. <el-form ref="form" :model="testModel" :rules="rules">
  10. <div>
  11. <div style="padding: 10px 20%;">
  12. <div style="text-align: center;margin-bottom: 10px;">注:设置督办后,系统会按照设定的周期自动派发</div>
  13. <el-form-item label="派发周期:" label-width="100px" prop="distributeType">
  14. <el-select v-model="testModel.distributeType" placeholder="选择派发周期" style="width: 100%;">
  15. <el-option v-for="({ label, value }, index) in [
  16. { label: '月', value: '0' },
  17. { label: '季度', value: '1' },
  18. { label: '半年', value: '2' },
  19. { label: '年', value: '3' },
  20. ]" :key="index" :label="label" :value="value"></el-option>
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item label="填报日期:" label-width="100px" prop="distributeTime">
  24. <el-date-picker :append-to-body="false" v-model="testModel.distributeTime" size="medium"
  25. type="datetime" placeholder="选择填报日期" @change="handleWrite" style="width: 100%"
  26. :picker-options="pickWrite">
  27. </el-date-picker>
  28. </el-form-item>
  29. <el-form-item label="截至日期:" label-width="100px" prop="distributeEndTime">
  30. <el-date-picker :append-to-body="false" v-model="testModel.distributeEndTime" size="medium"
  31. @change="handleEnd" :unlink-panels="true" type="datetime" placeholder="选择截至日期"
  32. style="width: 100%" :picker-options="pickOptions">
  33. </el-date-picker>
  34. </el-form-item>
  35. </div>
  36. <div slot="footer" style="text-align: right;padding-bottom: 20px;padding-top: 20px">
  37. <el-button @click="dubanStatus = false">取 消</el-button>
  38. <el-button type="primary" @click="processAuthduban()">确 定</el-button>
  39. </div>
  40. </div>
  41. </el-form>
  42. </el-dialog>
  43. <el-dialog :title="'权限设置'" :visible.sync="authSettingStatus" width="100%" :show-close="true"
  44. :modal-append-to-body="false">
  45. <el-form :model="testModel" ref="addInfoList">
  46. <div>
  47. <div class="info-line">
  48. <el-radio v-if="type == '1' || type == '2'" v-model="authType" label="1"
  49. style="margin: 10px">无特殊权限</el-radio>
  50. <div id="noLimit" class="info-line">
  51. <span style="margin-right:10px;margin-left: 10px">负责人:</span>
  52. <el-button v-if="type == '1' || type == '2'" type="primary"
  53. @click="noLimitUserAdd()">组织机构</el-button>
  54. <span style="margin-right: 10px;margin-left: 10px;display: inline-block;color: blue;">{{
  55. noLimitUserName }}</span>
  56. </div>
  57. </div>
  58. <div class="info-line">
  59. <el-radio v-if="type == '1' || type == '2'" v-model="authType" label="2"
  60. style="margin: 10px">特殊权限</el-radio>
  61. <div id="limit">
  62. <div v-for="(item, index) in limitList">
  63. <div style="margin-right: 10px;margin-left: 10px;display: inline-block;">负责人:</div>
  64. <el-button v-if="type == '1' || type == '2'" type="primary"
  65. @click="limitUserAdd(index)">组织机构</el-button>
  66. <div style="margin-right: 10px;margin-left: 10px;display: inline-block;color: blue;">{{
  67. item.userName }}
  68. </div>
  69. <div style="margin-right: 5px;margin-left: 5px;display: inline-block;">可编辑行:从</div>
  70. <el-input v-if="type == '1' || type == '2'" v-model="item.editStart" style="width: 80px;"
  71. oninput="value=value=value.replace(/^(0+)|[^0-9]/g,'')"></el-input>
  72. <div v-else style="margin-right: 5px;margin-left: 5px;display: inline-block;color: blue;">
  73. {{ item.editStart }}</div>
  74. <div style="margin-right: 5px;margin-left: 5px;display: inline-block;">到</div>
  75. <el-input v-if="type == '1' || type == '2'" v-model="item.editEnd" style="width: 80px;"
  76. oninput="value=value.replace(/^(0+)|[^0-9]/g,'')"></el-input>
  77. <div v-else style="margin-right: 5px;margin-left: 5px;display: inline-block;color: blue;">
  78. {{ item.editEnd }}</div>
  79. <div style="margin-right: 5px;margin-left: 5px;display: inline-block;">可编辑列:从</div>
  80. <el-input v-if="type == '1' || type == '2'" v-model="item.editStartCol" style="width: 80px;"
  81. oninput="value=value.replace(/^(0+)|[^\a-\z\A-\Z0-9]/g,'')"></el-input>
  82. <div v-else style="margin-right: 5px;margin-left: 5px;display: inline-block;color: blue;">
  83. {{ item.editStartCol }}</div>
  84. <div style="margin-right: 5px;margin-left: 5px;display: inline-block;">到</div>
  85. <el-input v-if="type == '1' || type == '2'" v-model="item.editEndCol" style="width: 80px;"
  86. oninput="value=value.replace(/^(0+)|[^\a-\z\A-\Z0-9]/g,'')"></el-input>
  87. <div v-else style="margin-right: 5px;margin-left: 5px;display: inline-block;color: blue;">
  88. {{ item.editEndCol }}</div>
  89. <br /><br />
  90. </div>
  91. <el-button style="width: 80px;margin-right: 20px;margin-left: 40px"
  92. v-if="type == '1' || type == '2'" @click="addNewLimitAuth()">添加
  93. </el-button>
  94. <el-button style="width: 80px;margin-right: 20px;margin-left: 40px" type="danger"
  95. v-if="(type == '1' || type == '2') && limitList.length > 1" @click="delNewLimitAuth()">删除
  96. </el-button>
  97. </div>
  98. </div>
  99. <div slot="footer" style="text-align: right;padding-bottom: 20px;padding-top: 20px">
  100. <!-- <el-button @click="closeauthSettingStatus()">取 消</el-button> -->
  101. <el-button type="primary" @click="processAuth()">关 闭</el-button>
  102. </div>
  103. </div>
  104. </el-form>
  105. </el-dialog>
  106. <el-dialog title="选择填报人" :visible.sync="noLimitDialog" width="100%" :destroy-on-close="true"
  107. :modal-append-to-body="false" :close-on-click-modal="false">
  108. <div style="max-height:500px ;">
  109. <deptTreeUserNew v-if="authType == '1'" @treeCheck="treeCheckonly" :defaultList="defaultList"
  110. :type="depttype" :closeList="closeList" :oneORmore="authType" treeListType="1"></deptTreeUserNew>
  111. <deptTreeUserNew v-if="authType == '2'" @treeCheck="treeCheckonly" :defaultList="defaultList"
  112. :type="depttype" :closeList="closeList" :oneORmore="authType" treeListType="1"></deptTreeUserNew>
  113. <div slot="footer" style="text-align: right;padding-bottom: 20px">
  114. <el-button @click="noLimitDialog = false">取 消</el-button>
  115. <el-button type="primary" @click="processNoLimitUsers()">确 定</el-button>
  116. </div>
  117. </div>
  118. </el-dialog>
  119. <el-dialog :title="'提交'" :visible.sync="authDialog" width="50%" :destroy-on-close="true"
  120. :modal-append-to-body="false" :close-on-click-modal="false">
  121. <el-form :model="testModel" ref="addInfoList">
  122. <div>
  123. <div class="info-line">
  124. <span style="margin-right: 20px;margin-left: 40px">选择路径:</span>
  125. <el-select v-model="auditForm.authType" placeholder="选择路径" @change="treeListTypechange">
  126. <el-option v-for="(item, index) in auditBoxList" :key="index" :label="item.name"
  127. :value="item.value"></el-option>
  128. </el-select>
  129. </div>
  130. <br />
  131. <div class="info-line" v-if="auditForm.authType == 1 || auditForm.authType == 2">
  132. <span style="margin-right: 20px;margin-left: 40px">下一步处理人:</span>
  133. <el-button type="primary" @click="auditUserAdd()">选择处理人</el-button>
  134. <span style="width: 80px;margin-right: 20px;margin-left: 20px">{{
  135. auditForm.receiverName
  136. }}</span>
  137. </div>
  138. <br />
  139. <div class="info-line">
  140. <span style="margin-right: 20px;margin-left: 40px;">意见内容:</span>
  141. <el-input type="textarea" v-model="auditForm.reviewOpinion" style="width: 400px"></el-input>
  142. </div>
  143. <br />
  144. <div slot="footer" style="text-align: right;padding-bottom: 20px;padding-top: 20px">
  145. <el-button @click="authDialog = false">取 消</el-button>
  146. <el-button type="primary" @click="processAudit()" :disabled="BtnDisabled">确 定</el-button>
  147. </div>
  148. </div>
  149. </el-form>
  150. </el-dialog>
  151. <el-dialog title="转派" :visible.sync="checkexa" width="100%" :destroy-on-close="true" :modal-append-to-body="false"
  152. :close-on-click-modal="false" v-if="checkexa">
  153. <div>
  154. <deptTreeUserNew @treeCheck="treeCheckonly" :defaultList="defaultList" :type="depttype"
  155. :closeList="closeList" oneORmore="2" treeListType="1"></deptTreeUserNew>
  156. <div slot="footer" style="text-align: right;padding-bottom: 20px">
  157. <el-button type="primary" @click="processAuditUser()" :disabled="BtnDisabled">确 定</el-button>
  158. <el-button @click="checkexa = false">取 消</el-button>
  159. </div>
  160. </div>
  161. </el-dialog>
  162. <el-dialog title="选择下一步处理人" :visible.sync="checkexapeople" width="100%" :destroy-on-close="true"
  163. :modal-append-to-body="false" :close-on-click-modal="false" v-if="checkexapeople">
  164. <div>
  165. <deptTreeUserNew @treeCheck="treeCheckonly" :defaultList="defaultList" :type="depttype"
  166. :closeList="closeList" oneORmore="2" :treeListType="treeListType"></deptTreeUserNew>
  167. <div slot="footer" style="text-align: right;padding-bottom: 20px">
  168. <el-button type="primary" @click="processAuditUserpeople()">确 定</el-button>
  169. <el-button @click="checkexapeople = false">取 消</el-button>
  170. </div>
  171. </div>
  172. </el-dialog>
  173. </div>
  174. </template>
  175. <script>
  176. import myMessage from "../../../components/myMessage.vue"
  177. import deptTreeUserNew from "./newTree.vue"
  178. import deptTreeOnly from "../../../components/deptTreeOnly.vue"
  179. export default {
  180. components: {
  181. myMessage,
  182. deptTreeUserNew,
  183. deptTreeOnly,
  184. },
  185. data() {
  186. let _self = this
  187. return {
  188. pickOptions: {
  189. disabledDate(time) {
  190. return time.getTime() < new Date().getTime() - 8.64e6;
  191. },
  192. },
  193. pickWrite: {
  194. disabledDate(time) {
  195. return time.getTime() < new Date().getTime() - 8.64e6;
  196. },
  197. },
  198. rules: {
  199. distributeType: [
  200. {
  201. required: true,
  202. trigger: "change",
  203. message: "请选择类型",
  204. },
  205. ],
  206. distributeTime: [
  207. {
  208. required: true,
  209. trigger: "blur",
  210. message: "请选择类型",
  211. },
  212. ],
  213. distributeEndTime: [
  214. {
  215. required: true,
  216. trigger: "blur",
  217. message: "请选择类型",
  218. },
  219. ],
  220. },
  221. testModel: {},
  222. authSettingStatus: false,
  223. dubanStatus: false,
  224. BtnDisabled: false,
  225. authType: '1',
  226. oneORmore: 'one',
  227. noLimitUserName: '',
  228. treeListType: '',
  229. id: '',
  230. noLimitUsers: [],
  231. noLimitDialog: false,
  232. exaList: {},
  233. auditForm: {},
  234. defaultList: [],
  235. treeList: [],
  236. closeList: false,
  237. success: false,
  238. depttype: 0,
  239. limitUserIndex: -1,
  240. limitList: [{}],
  241. type: '',
  242. loading: false,
  243. auditBoxList: [{}],
  244. authDialog: false,
  245. auditUserName: '',
  246. auditUserId: '',
  247. issuedId: '',
  248. issuedstatus: '',
  249. //选择审批人
  250. checkexa: false,
  251. checkexapeople: false,
  252. //审批人用到的
  253. treeListonly: {},
  254. excelData: {},
  255. fullscreen: false,
  256. addInfoList: []
  257. }
  258. },
  259. methods: {
  260. // 填报日期
  261. handleWrite(value) {
  262. if (value) {//
  263. let time = value.getTime() + 86400000
  264. let range =
  265. new Date().getTime() > time
  266. ? new Date().getTime()
  267. : time;
  268. this.pickOptions = {
  269. disabledDate(time) {
  270. return time.getTime() < range;
  271. },
  272. };
  273. } else {
  274. this.pickOptions = {
  275. disabledDate(time) {
  276. return time.getTime() < new Date().getTime() - 8.64e6;
  277. },
  278. };
  279. }
  280. },
  281. handleEnd(value) {
  282. // if (value) {
  283. // console.log(3);
  284. // this.pickWrite = {
  285. // disabledDate(time) {
  286. // return time.getTime() > value.getTime();
  287. // },
  288. // };
  289. // let write = new Date(this.testModel.distributeTime).getTime();
  290. // if (this.testModel.distributeTime && value.getTime() < write) {
  291. // this.testModel.distributeEndTime = "";
  292. // }
  293. // } else {
  294. // this.pickWrite = {
  295. // disabledDate(time) {
  296. // return time.getTime() - 8.64e6 < new Date().getTime();
  297. // },
  298. // };
  299. // }
  300. },
  301. auditUserAdd() {
  302. this.checkexapeople = true;
  303. },
  304. treeListTypechange(v) {
  305. console.log(v);
  306. if (v == 1) {
  307. this.treeListType = '3'
  308. } else if (v == 2) {
  309. this.treeListType = '2'
  310. }
  311. },
  312. processAuditUser() {//转派确定
  313. this.BtnDisabled = true
  314. console.log(this.treeListonly);
  315. this.$http({
  316. url: "/market/Issued/forwardIssued",
  317. method: "post",
  318. headers: {
  319. "Content-Type": "application/json",
  320. },
  321. data: {
  322. id: this.issuedId,
  323. receiverId: this.treeListonly[0].key,
  324. receiverName: this.treeListonly[0].label,
  325. excelData: this.excelData,
  326. },
  327. }).then((res) => {
  328. if (res.data.result === 1) {
  329. this.$message({
  330. message: res.data.desc,
  331. type: 'error'
  332. });
  333. } else {
  334. this.$message({
  335. message: '转派成功',
  336. type: 'success'
  337. });
  338. }
  339. this.checkexa = false;
  340. this.BtnDisabled = false
  341. this.$router.push("documentCollectionApproval");
  342. });
  343. },
  344. processAuditUserpeople() {//选人确定
  345. console.log(this.treeListonly);
  346. this.auditForm.receiverId = this.treeListonly[0].key
  347. this.auditForm.receiverName = this.treeListonly[0].label
  348. this.checkexapeople = false;
  349. },
  350. toAudit(sheetName, excelData) {
  351. console.log('提交开启');
  352. this.excelData = excelData;
  353. this.authDialog = true;
  354. },
  355. openAuditWindow(sheetName, excelData) {
  356. // 0待处理
  357. // 1部门人员审批
  358. // 2部门领导审批
  359. // 3退回修改
  360. if (this.issuedstatus == '0') {
  361. this.auditBoxList = [{//转派;部门人员审核;部门领导审批;结束
  362. name: '部门人员审核',
  363. value: '1'
  364. }, {
  365. name: '部门领导审批',
  366. value: '2'
  367. }, {
  368. name: '结束',
  369. value: '4'
  370. }];
  371. } else if (this.issuedstatus == '1') {//退回修改;部门人员审核;部门领导审批;结束
  372. this.auditBoxList = [{
  373. name: '退回修改',
  374. value: '3'
  375. }, {
  376. name: '部门人员审核',
  377. value: '1'
  378. }, {
  379. name: '部门领导审批',
  380. value: '2'
  381. }, {
  382. name: '结束',
  383. value: '4'
  384. }];
  385. } else if (this.issuedstatus == '2') {//退回修改;部门领导审批;结束
  386. this.auditBoxList = [{
  387. name: '退回修改',
  388. value: '3'
  389. }, {
  390. name: '部门领导审批',
  391. value: '2'
  392. }, {
  393. name: '结束',
  394. value: '4'
  395. }];
  396. } else if (this.issuedstatus == '3') {//转派;部门人员审核;部门领导审批
  397. this.auditBoxList = [{
  398. name: '部门人员审核',
  399. value: '1'
  400. }, {
  401. name: '部门领导审批',
  402. value: '2'
  403. }];
  404. }
  405. this.authDialog = true;
  406. this.excelData = excelData;
  407. },
  408. processAudit() {
  409. //检查选项
  410. if (this.auditForm.authType == null) {
  411. this.$message({
  412. message: '请选择路径',
  413. type: 'error'
  414. });
  415. return;
  416. }
  417. if (this.auditForm.authType == '1' || this.auditForm.authType == '2') {
  418. if (this.receiverId == '') {
  419. this.$message({
  420. message: '请选择下一步处理人',
  421. type: 'error'
  422. });
  423. return;
  424. }
  425. }
  426. if (this.auditForm.reviewOpinion
  427. && this.auditForm.reviewOpinion.length > 240) {
  428. this.$message({
  429. message: '意见内容长度不能大于240字',
  430. type: 'error'
  431. });
  432. return;
  433. }
  434. //提交
  435. this.BtnDisabled = true
  436. var _this = this;
  437. var url = '/market/Issued/completeIssued';
  438. this.loading = true;
  439. this.$http({
  440. url: url,
  441. method: "post",
  442. headers: {
  443. "Content-Type": "application/json",
  444. },
  445. data: {
  446. reviewType: this.auditForm.authType,
  447. excelData: this.excelData,
  448. id: this.getUrlKey("id"),
  449. receiverId: this.auditForm.receiverId,
  450. receiverName: this.auditForm.receiverName,
  451. reviewOpinion: this.auditForm.reviewOpinion
  452. },
  453. }).then((res) => {
  454. this.loading = false;
  455. if (res.data.desc == '请编辑回复内容后提交') {
  456. _this.$message({
  457. message: res.data.desc,
  458. type: 'error'
  459. });
  460. } else if (res.data.result === 1) {
  461. _this.$message({
  462. message: res.data.desc,
  463. type: 'error'
  464. });
  465. } else {
  466. this.authDialog = false;
  467. _this.$message({
  468. message: '处理成功',
  469. type: 'success'
  470. });
  471. //没找到关闭标签页之前的临时处理措施
  472. // const newUrl = '#' + this.$route.path + '?type=5&id=' + this.getUrlKey("id");
  473. // console.log(newUrl);
  474. // window.history.replaceState('', '', newUrl);
  475. // document.getElementById('excelIframe').contentWindow.location.reload();
  476. //关闭这个窗口,得找找怎么关闭
  477. //this.$router.go(-1);
  478. this.$router.push("documentCollectionApproval");
  479. }
  480. this.BtnDisabled = false
  481. });
  482. },
  483. addNewTemplate(sheetName, excelData, templateType) {
  484. //console.log(sheetName);
  485. //console.log(excelData);
  486. //console.log(templateType);
  487. //处理一下数据,提交给后端
  488. var authUser = [];
  489. if (this.authType == '1') {
  490. console.log(this.noLimitUsers);
  491. this.noLimitUsers.map((o) => {
  492. authUser.push({
  493. principalId: o.key,
  494. principalName: o.label,
  495. dept: o.groupName,
  496. type: 1
  497. })
  498. });
  499. } else {
  500. //外层是权限组
  501. this.limitList.map((o) => {
  502. //内层是权限用户
  503. console.log(this.limitList);
  504. // authUser.push({
  505. // principalId: o1.key,
  506. // principalName: o1.label,
  507. // dept: o1.groupName,
  508. // type: 2,
  509. // allowEditingColumns: o.editStartCol + ',' + o.editEndCol,
  510. // rowNum: o.editStart + ',' + o.editEnd,
  511. // })
  512. console.log(o.userIds);
  513. o.userIds.map((o1) => {
  514. authUser.push({
  515. principalId: o1.key,
  516. principalName: o1.label,
  517. dept: o1.groupName,
  518. type: 2,
  519. allowEditingColumns: o.editStartCol + ',' + o.editEndCol,
  520. rowNum: o.editStart + ',' + o.editEnd,
  521. })
  522. })
  523. });
  524. }
  525. //console.log(authUser);
  526. //提交
  527. var _this = this;
  528. var url = '/market/FileTemplate/add';
  529. // var recordTime = this.$formatDate(new Date().getTime(), "YYYY-MM-DD HH:mm:ss")
  530. if (this.type == '2') {
  531. url = '/market/FileTemplate/update';
  532. // recordTime = ''
  533. }
  534. this.loading = true;
  535. this.$http({
  536. url: url,
  537. method: "post",
  538. headers: {
  539. "Content-Type": "application/json",
  540. },
  541. data: {
  542. fileTemplateAuthorities: authUser,//选人字段
  543. fileTemplate: {
  544. id: this.getUrlKey('id'),
  545. templateName: sheetName,
  546. excelData: excelData,
  547. templateType: templateType,
  548. status: "0",
  549. distributeEndTime: this.testModel.distributeEndTime ? this.$formatDate(this.testModel.distributeEndTime, "YYYY-MM-DD HH:mm:ss") : '',
  550. distributeTime: this.testModel.distributeTime ? this.$formatDate(this.testModel.distributeTime, "YYYY-MM-DD HH:mm:ss") : '',
  551. distributeType: this.testModel.distributeType,
  552. superviseFlag: this.testModel.superviseFlag ? this.testModel.superviseFlag : '0',
  553. // recordTime: recordTime,
  554. },
  555. },
  556. }).then((res) => {
  557. this.loading = false;
  558. if (res.data.result === 1) {
  559. _this.$message({
  560. message: res.data.desc,
  561. type: 'error'
  562. });
  563. } else {
  564. var msgText = '新增成功';
  565. if (this.type == '2') {
  566. msgText = '修改成功';
  567. }
  568. _this.$message({
  569. message: msgText,
  570. type: 'success'
  571. });
  572. // if (this.type == '1') {
  573. // const newUrl = '#' + this.$route.path + '?type=2&id=' + res.data.body;
  574. // console.log(newUrl);
  575. // window.history.replaceState('', '', newUrl);
  576. // this.type = '2';
  577. // document.getElementById('excelIframe').contentWindow.location.reload();
  578. // }
  579. //this.$store.dispatch('tagsView/delView',this.$route)
  580. // this.$router.go(-1);
  581. this.$router.push("documentCollectionApprovalIssuedMoud");
  582. }
  583. });
  584. },
  585. toZhuanpai(sheetName, excelData) {
  586. console.log('转派开启');
  587. this.checkexa = true;
  588. this.excelData = excelData;
  589. },
  590. zancunClick(sheetName, excelData, templateType) {
  591. //console.log(sheetName);
  592. //console.log(excelData);
  593. //console.log(templateType);
  594. //处理一下数据,提交给后端
  595. var authUser = [];
  596. if (this.authType == '1') {
  597. console.log(this.noLimitUsers);
  598. this.noLimitUsers.map((o) => {
  599. authUser.push({
  600. principalId: o.key,
  601. principalName: o.label,
  602. dept: o.groupName,
  603. type: 1
  604. })
  605. });
  606. } else {
  607. //外层是权限组
  608. this.limitList.map((o) => {
  609. //内层是权限用户
  610. o.userIds.map((o1) => {
  611. authUser.push({
  612. principalId: o1.key,
  613. principalName: o1.label,
  614. dept: o1.groupName,
  615. type: 2,
  616. allowEditingColumns: o.editStartCol + ',' + o.editEndCol,
  617. rowNum: o.editStart + ',' + o.editEnd,
  618. })
  619. })
  620. });
  621. }
  622. //console.log(authUser);
  623. //暂存
  624. var _this = this;
  625. var url = '/market/FileTemplate/add';
  626. // var recordTime = this.$formatDate(new Date().getTime(), "YYYY-MM-DD HH:mm:ss")
  627. if (this.type == '2') {
  628. url = '/market/FileTemplate/update';
  629. // recordTime = ''
  630. }
  631. this.loading = true;
  632. this.$http({
  633. url: url,
  634. method: "post",
  635. headers: {
  636. "Content-Type": "application/json",
  637. },
  638. data: {
  639. fileTemplateAuthorities: authUser,//选人字段
  640. fileTemplate: {
  641. status: "2",
  642. id: this.getUrlKey('id'),
  643. templateName: sheetName,
  644. excelData: excelData,
  645. templateType: templateType,
  646. distributeEndTime: this.testModel.distributeEndTime ? this.$formatDate(this.testModel.distributeEndTime, "YYYY-MM-DD HH:mm:ss") : '',
  647. distributeTime: this.testModel.distributeTime ? this.$formatDate(this.testModel.distributeTime, "YYYY-MM-DD HH:mm:ss") : '',
  648. distributeType: this.testModel.distributeType,
  649. superviseFlag: this.testModel.superviseFlag ? this.testModel.superviseFlag : '0',
  650. // recordTime: recordTime,
  651. },
  652. },
  653. }).then((res) => {
  654. this.loading = false;
  655. if (res.data.result === 1) {
  656. _this.$message({
  657. message: res.data.desc,
  658. type: 'error'
  659. });
  660. } else {
  661. var msgText = '暂存成功';
  662. if (this.type == '2') {
  663. msgText = '修改成功';
  664. }
  665. _this.$message({
  666. message: msgText,
  667. type: 'success'
  668. });
  669. // if (this.type == '1') {
  670. // const newUrl = '#' + this.$route.path + '?type=2&id=' + res.data.body;
  671. // console.log(newUrl);
  672. // window.history.replaceState('', '', newUrl);
  673. // this.type = '2';
  674. // document.getElementById('excelIframe').contentWindow.location.reload();
  675. // }
  676. //this.$store.dispatch('tagsView/delView',this.$route)
  677. //this.$router.go(-1);
  678. this.$router.push("documentCollectionApprovalIssuedMoud");
  679. }
  680. });
  681. },
  682. showAuthDialog() {
  683. this.authSettingStatus = true;
  684. },
  685. showdubanDialog() {
  686. this.dubanStatus = true;
  687. },
  688. getOutUrl() {
  689. this.$router.go(-1);
  690. },
  691. closeauthSettingStatus() {
  692. this.success = true;
  693. if (this.authType == '1') {
  694. if (this.noLimitUsers.length == 0) {
  695. this.success = false;
  696. }
  697. } else if (this.authType == '2') {
  698. this.limitList.map((o) => {
  699. let str = o.editStartCol + o.editEndCol
  700. if (o.userIds == null || o.userIds[0].key == null) {
  701. this.success = false;
  702. }
  703. if (o.editStart == '' || o.editEnd == '' || o.editStart == undefined || o.editEnd == undefined) {
  704. this.success = false;
  705. }
  706. if (o.editStartCol == '' || o.editEndCol == '' || o.editStartCol == undefined || o.editEndCol == undefined) {
  707. this.success = false;
  708. }
  709. if (/^[A-Za-z]*$/.test(str)) {
  710. o.editEndCol = o.editEndCol.toUpperCase()
  711. o.editStartCol = o.editStartCol.toUpperCase()
  712. }
  713. if (parseInt(o.editEnd) <= parseInt(o.editStart)) {
  714. let a = ''
  715. a = o.editStart
  716. o.editStart = o.editEnd
  717. o.editEnd = a
  718. }
  719. if (/^[0-9]+$/.test(str)) {//列信息都为数字
  720. if (parseInt(o.editEndCol) <= parseInt(o.editStartCol)) {
  721. let a = ''
  722. a = o.editStartCol
  723. o.editStartCol = o.editEndCol
  724. o.editEndCol = a
  725. }
  726. } else if (/^[A-Za-z]*$/.test(str)) {//列信息都为字母
  727. if (o.editStartCol.length > o.editEndCol.length) {
  728. let a = ''
  729. a = o.editStartCol
  730. o.editStartCol = o.editEndCol
  731. o.editEndCol = a
  732. } else if (o.editStartCol.length == o.editEndCol.length) {
  733. Array.from(o.editStartCol).map((item, index) => {
  734. if (o.editEndCol[index].charCodeAt() < o.editStartCol[index].charCodeAt()) {
  735. let a = ''
  736. a = o.editStartCol
  737. o.editStartCol = o.editEndCol
  738. o.editEndCol = a
  739. return;
  740. }
  741. })
  742. }
  743. } else {
  744. this.success = false;
  745. }
  746. })
  747. }
  748. if (this.success) {
  749. if (this.type == '1') {
  750. this.$refs.iframe.contentWindow.enableUpload('abc');
  751. } else if (this.type == '2') {
  752. this.$refs.iframe.contentWindow.enableSave('def');
  753. }
  754. }
  755. this.authSettingStatus = false;
  756. },
  757. processAuth() {
  758. // console.log(this.limitList);
  759. //判断一下
  760. this.success = true;
  761. if (this.authType == '1') {
  762. if (this.noLimitUsers.length == 0) {
  763. this.$message({
  764. message: '请选择无特殊权限的负责人',
  765. type: 'error'
  766. });
  767. this.success = false;
  768. return;
  769. }
  770. } else if (this.authType == '2') {
  771. this.limitList.map((o) => {
  772. console.log(o.userIds);
  773. console.log(o.editStart);
  774. console.log(o.editStartCol);
  775. let str = o.editStartCol + o.editEndCol
  776. if (o.userIds == null || o.userIds[0].key == null) {
  777. this.$message({
  778. message: '请选择特殊权限的负责人',
  779. type: 'error'
  780. });
  781. this.success = false;
  782. return;
  783. }
  784. if (o.editStart == '' || o.editEnd == '' || o.editStart == undefined || o.editEnd == undefined) {
  785. this.$message({
  786. message: '请填写可编辑行',
  787. type: 'error'
  788. });
  789. this.success = false;
  790. return;
  791. }
  792. if (o.editStartCol == '' || o.editEndCol == '' || o.editStartCol == undefined || o.editEndCol == undefined) {
  793. this.$message({
  794. message: '请填写可编辑列',
  795. type: 'error'
  796. });
  797. this.success = false;
  798. return;
  799. }
  800. if (/^[A-Za-z]*$/.test(str)) {
  801. o.editEndCol = o.editEndCol.toUpperCase()
  802. o.editStartCol = o.editStartCol.toUpperCase()
  803. }
  804. if (parseInt(o.editEnd) <= parseInt(o.editStart)) {
  805. let a = ''
  806. a = o.editStart
  807. o.editStart = o.editEnd
  808. o.editEnd = a
  809. }
  810. if (/^[0-9]+$/.test(str)) {//列信息都为数字
  811. if (parseInt(o.editEndCol) <= parseInt(o.editStartCol)) {
  812. let a = ''
  813. a = o.editStartCol
  814. o.editStartCol = o.editEndCol
  815. o.editEndCol = a
  816. }
  817. } else if (/^[A-Za-z]*$/.test(str)) {//列信息都为字母
  818. if (o.editStartCol.length > o.editEndCol.length) {
  819. let a = ''
  820. a = o.editStartCol
  821. o.editStartCol = o.editEndCol
  822. o.editEndCol = a
  823. console.log('前长');
  824. } else if (o.editStartCol.length == o.editEndCol.length) {
  825. Array.from(o.editStartCol).map((item, index) => {
  826. // console.log(o.editStartCol[index]);
  827. // console.log(o.editEndCol[index]);
  828. // console.log(o.editEndCol[index].charCodeAt() > o.editStartCol[index].charCodeAt());
  829. if (o.editEndCol[index].charCodeAt() < o.editStartCol[index].charCodeAt()) {
  830. let a = ''
  831. a = o.editStartCol
  832. o.editStartCol = o.editEndCol
  833. o.editEndCol = a
  834. return;
  835. }
  836. })
  837. console.log('等长');
  838. }
  839. } else {
  840. this.$message({
  841. message: '列信息请保持一致',
  842. type: 'error'
  843. });
  844. this.success = false;
  845. return;
  846. }
  847. })
  848. console.log(this.limitList);
  849. }
  850. if (this.success) {
  851. if (this.type == '1') {
  852. this.$refs.iframe.contentWindow.enableUpload('abc');
  853. } else if (this.type == '2') {
  854. this.$refs.iframe.contentWindow.enableSave('def');
  855. }
  856. this.authSettingStatus = false;
  857. }
  858. },
  859. processAuthduban() {
  860. console.log(this.limitList);
  861. this.testModel.superviseFlag = '1'
  862. this.$refs.form.validate((valid) => {
  863. if (valid) {
  864. this.dubanStatus = false
  865. if (this.success) {
  866. if (this.type == '1') {
  867. this.$refs.iframe.contentWindow.enableUpload('abc');
  868. } else if (this.type == '2') {
  869. this.$refs.iframe.contentWindow.enableSave('def');
  870. }
  871. this.authSettingStatus = false;
  872. }
  873. } else {
  874. // this.$message.error("请完善表单信息");
  875. return false;
  876. }
  877. });
  878. },
  879. addNewLimitAuth() {
  880. var _this = this;
  881. if (this.authType == '2') {
  882. console.log(_this.limitList);
  883. if (_this.limitList.length == 0) {
  884. _this.limitList.push({
  885. index: 1
  886. });
  887. } else {
  888. var lastLimitUserList = _this.limitList[_this.limitList.length - 1].userIds[0].key;
  889. if (lastLimitUserList == null) {
  890. _this.$message({
  891. message: '请先选择上一条记录的负责人',
  892. type: 'error'
  893. });
  894. } else {
  895. _this.limitList.push({
  896. userIds: [{
  897. key: null
  898. }]
  899. });
  900. }
  901. }
  902. } else {
  903. _this.$message({
  904. message: '请先选择特殊权限再添加',
  905. type: 'error'
  906. });
  907. }
  908. },
  909. delNewLimitAuth() {
  910. this.limitList.pop()
  911. },
  912. processNoLimitUsers() {
  913. // console.log(this.treeList);
  914. // console.log(this.treeListonly);
  915. var userNameString = '';
  916. if (this.authType == '1') {
  917. this.noLimitUsers = [];
  918. this.treeList.map((o) => {
  919. this.noLimitUsers.push({ key: o.key, label: o.label, groupName: o.groupName });
  920. userNameString += o.label += ' ';
  921. });
  922. this.noLimitUserName = userNameString;
  923. } else {
  924. this.limitList[this.limitUserIndex].userIds = [];
  925. this.treeList.map((o) => {
  926. this.limitList[this.limitUserIndex].userIds.push({ key: o.key, groupName: o.groupName, label: o.label });
  927. userNameString += o.label += ' ';
  928. });
  929. this.limitList[this.limitUserIndex].userName = userNameString;
  930. }
  931. this.exaList = {};
  932. this.defaultList = [];
  933. this.treeList = [];
  934. this.noLimitDialog = false;
  935. },
  936. noLimitUserAdd() {
  937. if (this.authType == '1') {
  938. this.noLimitDialog = true;
  939. } else {
  940. this.$message({
  941. message: '请先选择无特殊权限,再添加负责人',
  942. type: 'error'
  943. });
  944. }
  945. },
  946. limitUserAdd(index) {
  947. if (this.authType == '2') {
  948. this.limitUserIndex = index;
  949. this.noLimitDialog = true;
  950. } else {
  951. this.$message({
  952. message: '请先选择特殊权限,再添加负责人',
  953. type: 'error'
  954. });
  955. }
  956. },
  957. setAuth(id) {
  958. console.log('1111');
  959. var _this = this;
  960. this.id = id
  961. this.$http({
  962. // url: '/market/cIncomeExcelTemplate/getAuthInfo',
  963. url: '/market/FileTemplate/query',
  964. method: "post",
  965. headers: {
  966. "Content-Type": "application/json",
  967. },
  968. data: {
  969. id: id,
  970. type: this.type
  971. },
  972. }).then((res) => {
  973. if (res.data.result === 1) {
  974. _this.$message({
  975. message: '获取负责人信息失败',
  976. type: 'error'
  977. });
  978. } else {
  979. console.log(res.data);
  980. var authUsers = res.data.body.fileTemplateAuthorities ? res.data.body.fileTemplateAuthorities : [{}];
  981. var i = -1;
  982. var nowStart = '';
  983. var nowEnd = '';
  984. this.limitList = [];
  985. this.testModel = res.data.body.excelInfo;
  986. this.noLimitUsers = [];
  987. this.noLimitUserName = '';
  988. if (authUsers.length != 0) {
  989. authUsers.map((o) => {
  990. console.log(o.type);
  991. //无特殊权限的简单一点,有特殊权限的,需要把相同可编辑行的放在一起
  992. if (o.type == '1') {
  993. this.authType = '1';
  994. this.noLimitUsers.push({ key: o.principalId, label: o.principalName, groupName: o.dept });
  995. this.noLimitUserName += o.principalName += ' ';
  996. } else {
  997. this.authType = '2';
  998. // if (o.editStart == nowStart && o.editEnd == nowEnd) {
  999. // var processLimitUser = this.limitList[i];
  1000. // processLimitUser.userIds.push(o.principalId);
  1001. // processLimitUser.userName += o.principalName += ' ';
  1002. // } else {
  1003. // var principalId = [o.principalId];
  1004. // var principalName = o.principalName += ' ';
  1005. console.log(o.allowEditingColumns);
  1006. // console.log(o.rowNum.split(','));
  1007. this.limitList.push({
  1008. userIds: [{ key: o.principalId, groupName: o.dept, label: o.principalName }],
  1009. userName: o.principalName,
  1010. editStart: o.rowNum ? o.rowNum.split(',')[0] : '',
  1011. editEnd: o.rowNum ? o.rowNum.split(',')[1] : '',
  1012. editStartCol: o.allowEditingColumns ? o.allowEditingColumns.split(',')[0] : '',
  1013. editEndCol: o.allowEditingColumns ? o.allowEditingColumns.split(',')[1] : '',
  1014. })
  1015. // nowStart = o.editStart;
  1016. // nowEnd = o.editEnd;
  1017. // i++;
  1018. // }
  1019. console.log(this.limitList);
  1020. }
  1021. });
  1022. }
  1023. }
  1024. });
  1025. },
  1026. //填报人相关
  1027. deletes(val, index) {
  1028. this.treeList.splice(index, 1);
  1029. this.closeList = this.treeList;
  1030. },
  1031. treeCheckonly(v) {
  1032. this.treeList = v;
  1033. this.treeListonly = v;
  1034. },
  1035. treeDelete() {
  1036. this.treeListonly = {};
  1037. this.closeList = !this.closeList;
  1038. },
  1039. getUrlKey(name) {
  1040. return (
  1041. decodeURIComponent(
  1042. (new RegExp("[?|&]" + name + "=" + "([^&;]+?)(&|#|;|$)").exec(
  1043. location.href
  1044. ) || [, ""])[1].replace(/\+/g, "%20")
  1045. ) || null
  1046. );
  1047. },
  1048. processFullScreen() {
  1049. this.fullscreen = !this.fullscreen;
  1050. },
  1051. },
  1052. mounted() {
  1053. this.type = this.getUrlKey("type")
  1054. this.issuedId = this.getUrlKey("id")
  1055. this.issuedstatus = this.getUrlKey("status")
  1056. },
  1057. created() {
  1058. window['fullScreen'] = (rp) => {
  1059. this.processFullScreen(rp);
  1060. }
  1061. window['showAuthDialog'] = (rp) => {
  1062. this.showAuthDialog(rp);
  1063. }
  1064. window['dubanBtnDialog'] = (rp) => {
  1065. this.showdubanDialog(rp);
  1066. }
  1067. window['getOutUrl'] = (rp) => {
  1068. this.getOutUrl(rp);
  1069. }
  1070. window['addNewTemplate'] = (sheetName, excelData, templateType) => {
  1071. this.addNewTemplate(sheetName, excelData, templateType);
  1072. };
  1073. window['toAudit'] = (sheetName, excelData,) => {
  1074. this.toAudit(sheetName, excelData,);
  1075. };
  1076. window['toZhuanpai'] = (sheetName, excelData) => {
  1077. this.toZhuanpai(sheetName, excelData);
  1078. };
  1079. window['zancunClick'] = (sheetName, excelData, templateType) => {
  1080. this.zancunClick(sheetName, excelData, templateType);
  1081. };
  1082. window['setAuth'] = (id) => {
  1083. this.setAuth(id);
  1084. };
  1085. window['openAuditWindow'] = (sheetName, excelData) => {
  1086. this.openAuditWindow(sheetName, excelData);
  1087. };
  1088. }
  1089. }
  1090. </script>
  1091. <style lang="scss" scoped>
  1092. .online {
  1093. width: 100%;
  1094. .el-select {
  1095. width: calc(100% - 100px);
  1096. }
  1097. span {
  1098. vertical-align: top;
  1099. }
  1100. .el-textarea {
  1101. width: calc(100% - 100px);
  1102. }
  1103. .tree {
  1104. width: calc(50% - 60px);
  1105. display: inline-block;
  1106. margin-right: 20px;
  1107. height: 300px;
  1108. overflow-y: scroll;
  1109. .el-icon-error {
  1110. float: right;
  1111. font-size: 20px;
  1112. margin-top: 9px;
  1113. cursor: pointer;
  1114. }
  1115. }
  1116. .treeUser {
  1117. margin: 0;
  1118. border: 1px solid #ddd;
  1119. p {
  1120. background: #f4f4f4;
  1121. padding: 0 20px;
  1122. margin-bottom: 5px;
  1123. }
  1124. }
  1125. .treeUserb {
  1126. width: calc(100% - 100px);
  1127. border: 1px solid #ddd;
  1128. background: #f4f4f4;
  1129. border-radius: 3px;
  1130. height: auto;
  1131. overflow: hidden;
  1132. p {
  1133. display: inline-block;
  1134. padding: 0 20px;
  1135. margin-bottom: 5px;
  1136. }
  1137. }
  1138. }
  1139. </style>
  1140. <style scoped>
  1141. .containerr {
  1142. background: #fff;
  1143. height: calc(100vh);
  1144. width: calc(100vw);
  1145. position: fixed;
  1146. left: 0;
  1147. top: 0;
  1148. overflow: hidden;
  1149. }
  1150. span {
  1151. width: 80px;
  1152. }
  1153. </style>