You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1543 lines
51 KiB

  1. <template>
  2. <div>
  3. <el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList">
  4. <el-form-item :label="'BU'">
  5. <el-select v-model="searchData.bu" placeholder="请选择" clearable style="width: 130px">
  6. <el-option
  7. v-for = "i in userBuList"
  8. :key = "i.buNo"
  9. :label = "i.buDesc"
  10. :value = "i.buNo">
  11. </el-option>
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item :label="'审批规则编码'">
  15. <el-input v-model="searchData.ruleNo" clearable style="width: 120px"></el-input>
  16. </el-form-item>
  17. <el-form-item :label="'审批规则描述'">
  18. <el-input v-model="searchData.ruleDesc" clearable style="width: 120px"></el-input>
  19. </el-form-item>
  20. <el-form-item :label="'状态'">
  21. <el-select clearable v-model="searchData.active" style="width: 120px">
  22. <el-option label="启用" value="Y"></el-option>
  23. <el-option label="禁用" value="N"></el-option>
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item :label="'优先级'">
  27. <el-select clearable v-model="searchData.priority" style="width: 120px">
  28. <el-option label="1" value = 1></el-option>
  29. <el-option label="2" value = 2></el-option>
  30. <el-option label="3" value = 3></el-option>
  31. </el-select>
  32. </el-form-item>
  33. <el-form-item :label="' '">
  34. <el-button @click="getDataList">查询</el-button>
  35. <el-button type="primary" @click="addModal">新增</el-button>
  36. </el-form-item>
  37. </el-form>
  38. <el-table
  39. :height="this.height - 300"
  40. :data="dataList"
  41. ref="mainTable"
  42. highlight-current-row
  43. @row-click="ruleClickRow"
  44. @current-change="changeCurrentRow"
  45. border
  46. style="width: 100%;">
  47. <el-table-column
  48. v-for="(item,index) in columnList" :key="index"
  49. :sortable="item.columnSortable"
  50. :prop="item.columnProp"
  51. :header-align="item.headerAlign"
  52. :show-overflow-tooltip="item.showOverflowTooltip"
  53. :align="item.align"
  54. :fixed="item.fixed==''?false:item.fixed"
  55. :min-width="item.columnWidth"
  56. :label="item.columnLabel">
  57. <template slot-scope="scope">
  58. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  59. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  60. </template>
  61. </el-table-column>
  62. <el-table-column
  63. fixed="right"
  64. header-align="center"
  65. align="center"
  66. width="160"
  67. label="操作">
  68. <template slot-scope="scope">
  69. <el-link style="cursor: pointer" @click="updateModal(scope.row)">修改</el-link>
  70. <el-link style="cursor: pointer" @click="delModal(scope.row)">删除</el-link>
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. <!-- 分页栏 -->
  75. <el-pagination
  76. @size-change="sizeChangeHandle"
  77. @current-change="currentChangeHandle"
  78. :current-page="pageIndex"
  79. :page-sizes="[20, 50, 100, 200, 500]"
  80. :page-size="pageSize"
  81. :total="totalPage"
  82. layout="total, sizes, prev, pager, next, jumper">
  83. </el-pagination>
  84. <!-- 页签 -->
  85. <el-tabs style="margin-top: 0px; width: 100%; height: 100%;" v-model="activeTable" class="customer-tab" type="border-card" @tab-click="tabClick">
  86. <!-- 详情页签 -->
  87. <el-tab-pane label="详情" name="auth_rule_details" style="height: 225px">
  88. <el-form :inline="true" label-position="top" :model="ruleCurrentRow" @keyup.enter.native="getDataList">
  89. <el-form-item :label="'BU'">
  90. <el-input v-model="ruleCurrentRow.buDesc" clearable style="width: 140px"></el-input>
  91. </el-form-item>
  92. <el-form-item :label="'审批规则编码'">
  93. <el-input v-model="ruleCurrentRow.ruleNo" clearable style="width: 140px"></el-input>
  94. </el-form-item>
  95. <el-form-item :label="'审批规则描述'">
  96. <el-input v-model="ruleCurrentRow.ruleDesc" clearable style="width: 345px"></el-input>
  97. </el-form-item>
  98. <el-form-item :label="'状态'">
  99. <el-input v-model="ruleCurrentRow.active" clearable style="width: 140px"></el-input>
  100. </el-form-item>
  101. </el-form>
  102. <el-form :inline="true" label-position="top" :model="ruleCurrentRow" @keyup.enter.native="getDataList">
  103. <el-form-item :label="'最低金额'">
  104. <el-input v-model="ruleCurrentRow.minValue" clearable style="width: 140px"></el-input>
  105. </el-form-item>
  106. <el-form-item :label="'最高金额'">
  107. <el-input v-model="ruleCurrentRow.maxValue" clearable style="width: 140px"></el-input>
  108. </el-form-item>
  109. <el-form-item :label="'优先级'">
  110. <el-input v-model="ruleCurrentRow.priority" clearable style="width: 180px"></el-input>
  111. </el-form-item>
  112. <el-form-item :label="'启用日期'">
  113. <el-input v-model="ruleCurrentRow.phaseInDate" clearable style="width: 150px"></el-input>
  114. </el-form-item>
  115. <el-form-item :label="'停用日期'">
  116. <el-input v-model="ruleCurrentRow.phaseOutDate" clearable style="width: 140px"></el-input>
  117. </el-form-item>
  118. </el-form>
  119. <el-form :inline="true" label-position="top" :model="ruleCurrentRow" @keyup.enter.native="getDataList">
  120. <el-form-item :label="'备注'">
  121. <el-input v-model="ruleCurrentRow.remark" clearable style="width: 804px"></el-input>
  122. </el-form-item>
  123. </el-form>
  124. <el-form :inline="true" label-position="top" :model="ruleCurrentRow" @keyup.enter.native="getDataList">
  125. <el-form-item :label="'创建人'">
  126. <el-input v-model="ruleCurrentRow.createBy" clearable style="width: 140px"></el-input>
  127. </el-form-item>
  128. <el-form-item :label="'创建时间'">
  129. <el-input v-model="ruleCurrentRow.createDate" clearable style="width: 242px"></el-input>
  130. </el-form-item>
  131. <el-form-item :label="'更新人'">
  132. <el-input v-model="ruleCurrentRow.updateBy" clearable style="width: 140px"></el-input>
  133. </el-form-item>
  134. <el-form-item :label="'更新时间'">
  135. <el-input v-model="ruleCurrentRow.updateDate" clearable style="width: 243px"></el-input>
  136. </el-form-item>
  137. </el-form>
  138. </el-tab-pane>
  139. <!-- 审批步骤页签 -->
  140. <el-tab-pane label="审批步骤" name="auth_rule_step" style="height: 100%">
  141. <el-button type="primary" @click="ruleStepAddModal" style="margin-top: -5px">新增</el-button>
  142. <el-table
  143. :height="this.height - 278"
  144. :data="ruleStepDataList"
  145. ref="ruleStepTable"
  146. highlight-current-row
  147. border
  148. style="width: 100%; margin-top: 5px">
  149. <el-table-column
  150. v-for="(item,index) in ruleStepColumnList" :key="index"
  151. :sortable="item.columnSortable"
  152. :prop="item.columnProp"
  153. :header-align="item.headerAlign"
  154. :show-overflow-tooltip="item.showOverflowTooltip"
  155. :align="item.align"
  156. :fixed="item.fixed==''?false:item.fixed"
  157. :min-width="item.columnWidth"
  158. :label="item.columnLabel">
  159. <template slot-scope="scope">
  160. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  161. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  162. </template>
  163. </el-table-column>
  164. <el-table-column
  165. fixed="right"
  166. header-align="center"
  167. align="center"
  168. width="160"
  169. label="操作">
  170. <template slot-scope="scope">
  171. <el-link style="cursor: pointer" @click="ruleStepUpdateModal(scope.row)">修改</el-link>
  172. <el-link style="cursor: pointer" @click="ruleStepDelModal(scope.row)">删除</el-link>
  173. </template>
  174. </el-table-column>
  175. </el-table>
  176. </el-tab-pane>
  177. </el-tabs>
  178. <el-dialog :title="modalData.title" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="600px">
  179. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  180. <el-form-item label="审批规则编码" prop="ruleNo" :rules="rules.ruleNo">
  181. <el-input v-model="modalData.ruleNo" :disabled="modalDisableFlag" style="width: 110px"></el-input>
  182. </el-form-item>
  183. <el-form-item label="审批规则描述" prop="ruleDesc" :rules="rules.ruleDesc">
  184. <el-input v-model="modalData.ruleDesc" :disabled="modalDisableFlag" style="width: 315px"></el-input>
  185. </el-form-item>
  186. <el-form-item label="BU" prop="bu" :rules="rules.bu">
  187. <el-select v-model="modalData.bu" placeholder="请选择" :disabled="modalDisableFlag" style="width: 110px">
  188. <el-option
  189. v-for = "i in userBuList"
  190. :key = "i.buNo"
  191. :label = "i.buDesc"
  192. :value = "i.buNo">
  193. </el-option>
  194. </el-select>
  195. </el-form-item>
  196. </el-form>
  197. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  198. <el-form-item label="最低金额" prop="minValue">
  199. <el-input v-model="modalData.minValue" style="width: 110px"></el-input>
  200. </el-form-item>
  201. <el-form-item label="最高金额" prop="maxValue">
  202. <el-input v-model="modalData.maxValue" style="width: 110px"></el-input>
  203. </el-form-item>
  204. <el-form-item label="优先级" prop="priority" :rules="rules.priority">
  205. <el-select clearable v-model="modalData.priority" :disabled="!modalDisableFlag" style="width: 67px">
  206. <el-option label="1" value = 1></el-option>
  207. <el-option label="2" value = 2></el-option>
  208. <el-option label="3" value = 3></el-option>
  209. </el-select>
  210. </el-form-item>
  211. <el-form-item label="启用日期" prop="phaseInDate" :rules="rules.phaseInDate">
  212. <el-date-picker v-model="modalData.phaseInDate" type="date" placeholder="选择日期" style="width: 110px"></el-date-picker>
  213. </el-form-item>
  214. <el-form-item label="停用日期" prop="phaseOutDate">
  215. <el-date-picker v-model="modalData.phaseOutDate" type="date" :disabled="!modalDisableFlag" placeholder="选择日期" style="width: 110px"></el-date-picker>
  216. </el-form-item>
  217. </el-form>
  218. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  219. <el-form-item label="备注">
  220. <el-input v-model="modalData.remark" style="width: 439px"></el-input>
  221. </el-form-item>
  222. <el-form-item label="状态" prop="active" :rules="rules.active">
  223. <el-select v-model="modalData.active" :disabled="!modalDisableFlag" style="width: 110px">
  224. <el-option label="启用" value="Y"></el-option>
  225. <el-option label="禁用" value="N"></el-option>
  226. </el-select>
  227. </el-form-item>
  228. </el-form>
  229. <el-footer style="height:30px;margin-top: 5px;text-align:center">
  230. <el-button type="primary" @click="saveData">保存</el-button>
  231. <el-button type="primary" @click="modalFlag = false">关闭</el-button>
  232. </el-footer>
  233. </el-dialog>
  234. <el-dialog :title="ruleStepModalData.title" :close-on-click-modal="false" v-drag :visible.sync="ruleStepModalFlag" width="476px">
  235. <el-form :inline="true" label-position="top" :model="ruleStepModalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  236. <el-form-item label="规则编码" prop="ruleNo">
  237. <el-input v-model="ruleStepModalData.ruleNo" :disabled="true" style="width: 110px"></el-input>
  238. </el-form-item>
  239. <el-form-item label="规则描述" prop="ruleDesc">
  240. <el-input v-model="ruleStepModalData.ruleDesc" :disabled="true" style="width: 315px"></el-input>
  241. </el-form-item>
  242. </el-form>
  243. <el-form :inline="true" label-position="top" :model="ruleStepModalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  244. <el-form-item label="步骤号" prop="stepNo" :rules="rules.stepNo">
  245. <el-input v-model="ruleStepModalData.stepNo" :disabled="ruleStepModalDisableFlag" style="width: 110px"></el-input>
  246. </el-form-item>
  247. <el-form-item label="类型" prop="authTypeDb" :rules="rules.authTypeDb">
  248. <el-select clearable v-model="ruleStepModalData.authTypeDb" style="width: 145px" @blur="clearRuleStepModalData">
  249. <el-option label="审批人" value="U"></el-option>
  250. <el-option label="审批组" value="G"></el-option>
  251. </el-select>
  252. </el-form-item>
  253. <el-form-item label=" " prop="firstStepFlag">
  254. <el-checkbox v-model="ruleStepModalData.firstStepFlag" :disabled="this.ruleStepModalData.lastStepFlag === 'Y'" :true-label="'Y'" :false-label="'N'" style="width: 110px;margin-left: 35px">
  255. 首步骤
  256. </el-checkbox>
  257. </el-form-item>
  258. </el-form>
  259. <el-form :inline="true" label-position="top" :model="ruleStepModalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  260. <el-form-item prop="authUserNo" :rules="rules.authUserNo">
  261. <span slot="label" style="" v-if="this.ruleStepModalData.authTypeDb !== 'G' && this.ruleStepModalData.authTypeDb !== '审批组'">
  262. <a herf="#" @click="getBaseList(2003)">审批人</a>
  263. </span>
  264. <span slot="label" style="margin-left: -4px" v-if="this.ruleStepModalData.authTypeDb === 'G' || this.ruleStepModalData.authTypeDb === '审批组'">
  265. 审批人
  266. </span>
  267. <el-input v-model="ruleStepModalData.authUserNo" :disabled="this.ruleStepModalData.authTypeDb === 'G' || this.ruleStepModalData.authTypeDb === '审批组'" @blur="authUserNoBlur" style="width: 110px"></el-input>
  268. </el-form-item>
  269. <el-form-item label="审批人姓名" prop="userDisplay" :rules="rules.userDisplay">
  270. <el-input v-model="ruleStepModalData.userDisplay" disabled style="width: 145px"></el-input>
  271. </el-form-item>
  272. <el-form-item label=" " prop="lastStepFlag">
  273. <el-checkbox v-model="ruleStepModalData.lastStepFlag" :disabled="this.ruleStepModalData.firstStepFlag === 'Y'" :true-label="'Y'" :false-label="'N'" style="width: 110px;margin-left: 35px">
  274. 末步骤
  275. </el-checkbox>
  276. </el-form-item>
  277. </el-form>
  278. <el-form :inline="true" label-position="top" :model="ruleStepModalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  279. <el-form-item prop="authGroupNo" :rules="rules.authGroupNo">
  280. <span slot="label" style="" v-if="this.ruleStepModalData.authTypeDb !== 'U' && this.ruleStepModalData.authTypeDb !== '审批人'">
  281. <a herf="#" @click="getBaseList(218)">审批组编码</a>
  282. </span>
  283. <span slot="label" style="margin-left: -4px" v-if="this.ruleStepModalData.authTypeDb === 'U' || this.ruleStepModalData.authTypeDb === '审批人'">
  284. 审批组编码
  285. </span>
  286. <el-input v-model="ruleStepModalData.authGroupNo" :disabled="this.ruleStepModalData.authTypeDb === 'U' || this.ruleStepModalData.authTypeDb === '审批人'" @blur="authGroupNoBlur" style="width: 110px"></el-input>
  287. </el-form-item>
  288. <el-form-item label="审批组名称" prop="groupDesc" :rules="rules.groupDesc">
  289. <el-input v-model="ruleStepModalData.groupDesc" disabled style="width: 315px"></el-input>
  290. </el-form-item>
  291. </el-form>
  292. <el-footer style="height:30px;margin-top: 5px;text-align:center">
  293. <el-button type="primary" @click="ruleStepSaveData">保存</el-button>
  294. <el-button type="primary" @click="ruleStepModalFlag = false">关闭</el-button>
  295. </el-footer>
  296. </el-dialog>
  297. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  298. </div>
  299. </template>
  300. <script>
  301. import {getSiteAndBuByUserName} from "../../../api/qc/qc";
  302. import {
  303. authRuleSearch, // 审批规则信息列表查询
  304. authRuleSave, // 审批规则信息新增
  305. authRuleEdit, // 审批规则信息编辑
  306. authRuleDelete, // 审批规则信息删除
  307. authRuleStepSearch, // 审批规则步骤信息列表查询
  308. authRuleStepSave, // 审批规则步骤信息新增
  309. authRuleStepEdit, // 审批规则步骤信息编辑
  310. authRuleStepDelete, // 审批规则步骤信息删除
  311. } from '@/api/auth/auth'
  312. import Chooselist from '@/views/modules/common/Chooselist_eam'
  313. import {authBusinessSearch, authGroupSearch} from "../../../api/auth/auth";
  314. export default {
  315. components: {
  316. Chooselist
  317. },
  318. data() {
  319. return {
  320. // 导出
  321. resultList: [],
  322. userBuList: [],
  323. // ======== 行高 ========
  324. height: 200,
  325. // ======== 分页 ========
  326. pageIndex: 1,
  327. pageSize: 20,
  328. totalPage: 0,
  329. authRuleMemberSaveDialog: false,
  330. activeTable: 'auth_rule_details',
  331. searchAuthBusinessData:{
  332. site: this.$store.state.user.site,
  333. userName: this.$store.state.user.name,
  334. username:'',
  335. userDisplay:'',
  336. },
  337. authBusinessList:[],
  338. isAuthBusinessList:[],
  339. allAuthBusinessList:[],
  340. allAuthBusinessSelections:[],
  341. isAuthBusinessSelections:[],
  342. // ======== 选中的当前行数据 ========
  343. ruleCurrentRow: {},
  344. rowData:{},
  345. // 条件查询
  346. searchData: {
  347. site: this.$store.state.user.site,
  348. userName: this.$store.state.user.name,
  349. bu: '',
  350. buNo: '',
  351. ruleNo: '',
  352. ruleDesc: '',
  353. active: '',
  354. priority: '',
  355. page: 1,
  356. limit: 10
  357. },
  358. modalData: {
  359. flag: '',
  360. title: '',
  361. bu: '',
  362. site: this.$store.state.user.site,
  363. userName: this.$store.state.user.name,
  364. buNo: '',
  365. recordType: '',
  366. authRuleId: '',
  367. ruleNo: '',
  368. ruleDesc: '',
  369. priority: '',
  370. phaseInDate: '',
  371. phaseOutDate: '',
  372. remark: '',
  373. active: '',
  374. createBy: '',
  375. updateBy: '',
  376. createDate: '',
  377. updateDate: ''
  378. },
  379. ruleStepModalData: {
  380. flag: '',
  381. title: '',
  382. bu: '',
  383. site: this.$store.state.user.site,
  384. userName: this.$store.state.user.name,
  385. buNo: '',
  386. authStepId: '',
  387. authRuleId: '',
  388. ruleNo: '',
  389. ruleDesc: '',
  390. stepNo: 0,
  391. authTypeDb: '',
  392. authUserNo: '',
  393. userDisplay: '',
  394. authGroupNo: '',
  395. groupDesc: '',
  396. firstStepFlag: '',
  397. lastStepFlag: '',
  398. createBy: '',
  399. updateBy: '',
  400. createDate: '',
  401. updateDate: ''
  402. },
  403. // ======== 数据列表 ========
  404. dataList: [],
  405. ruleStepDataList: [],
  406. // 展示列集
  407. columnList: [
  408. {
  409. userId: this.$store.state.user.name,
  410. functionId: 601005,
  411. serialNumber: '601005Table1BU',
  412. tableId: "601005Table1",
  413. tableName: "审批规则信息表",
  414. columnProp: 'buDesc',
  415. headerAlign: "center",
  416. align: "left",
  417. columnLabel: 'BU',
  418. columnHidden: false,
  419. columnImage: false,
  420. columnSortable: false,
  421. sortLv: 0,
  422. status: true,
  423. fixed: '',
  424. columnWidth: 120
  425. },
  426. {
  427. userId: this.$store.state.user.name,
  428. functionId: 601005,
  429. serialNumber: '601005Table1RuleNo',
  430. tableId: "601005Table1",
  431. tableName: "审批规则信息表",
  432. columnProp: 'ruleNo',
  433. headerAlign: "center",
  434. align: "center",
  435. columnLabel: '审批规则编码',
  436. columnHidden: false,
  437. columnImage: false,
  438. columnSortable: false,
  439. sortLv: 0,
  440. status: true,
  441. fixed: '',
  442. columnWidth: 120
  443. },
  444. {
  445. userId: this.$store.state.user.name,
  446. functionId: 601005,
  447. serialNumber: '601005Table1RuleDesc',
  448. tableId: "601005Table1",
  449. tableName: "审批规则表",
  450. columnProp: 'ruleDesc',
  451. headerAlign: "center",
  452. align: "left",
  453. columnLabel: '审批规则描述',
  454. columnHidden: false,
  455. columnImage: false,
  456. columnSortable: false,
  457. sortLv: 0,
  458. status: true,
  459. fixed: '',
  460. columnWidth: 180
  461. },
  462. {
  463. functionId: 601005,
  464. serialNumber: '601005Table1Active',
  465. tableId: '601005Table1',
  466. tableName: '审批规则信息表',
  467. columnProp: 'active',
  468. headerAlign: 'center',
  469. align: 'center',
  470. columnLabel: '状态',
  471. columnHidden: false,
  472. columnImage: false,
  473. columnSortable: false,
  474. sortLv: 0,
  475. status: true,
  476. fixed: '',
  477. columnWidth: 100
  478. },
  479. {
  480. userId: this.$store.state.user.name,
  481. functionId: 601005,
  482. serialNumber: '601005Table1MinValue',
  483. tableId: "601005Table1",
  484. tableName: "审批规则表",
  485. columnProp: 'minValue',
  486. headerAlign: "center",
  487. align: "right",
  488. columnLabel: '最低金额',
  489. columnHidden: false,
  490. columnImage: false,
  491. columnSortable: false,
  492. sortLv: 0,
  493. status: true,
  494. fixed: '',
  495. columnWidth: 120
  496. },
  497. {
  498. userId: this.$store.state.user.name,
  499. functionId: 601005,
  500. serialNumber: '601005Table1MaxValue',
  501. tableId: "601005Table1",
  502. tableName: "审批规则表",
  503. columnProp: 'maxValue',
  504. headerAlign: "center",
  505. align: "right",
  506. columnLabel: '最高金额',
  507. columnHidden: false,
  508. columnImage: false,
  509. columnSortable: false,
  510. sortLv: 0,
  511. status: true,
  512. fixed: '',
  513. columnWidth: 120
  514. },
  515. {
  516. userId: this.$store.state.user.name,
  517. functionId: 601005,
  518. serialNumber: '601005Table1Remark',
  519. tableId: "601005Table1",
  520. tableName: "审批规则表",
  521. columnProp: 'priority',
  522. headerAlign: "center",
  523. align: "center",
  524. columnLabel: '优先级',
  525. columnHidden: false,
  526. columnImage: false,
  527. columnSortable: false,
  528. sortLv: 0,
  529. status: true,
  530. fixed: '',
  531. columnWidth: 120
  532. },
  533. {
  534. userId: this.$store.state.user.name,
  535. functionId: 601005,
  536. serialNumber: '601005Table1PhaseInDate',
  537. tableId: '601005Table1',
  538. tableName: '审批规则表',
  539. columnProp: 'phaseInDate',
  540. headerAlign: 'center',
  541. align: 'center',
  542. columnLabel: '启用日期',
  543. columnHidden: false,
  544. columnImage: false,
  545. columnSortable: false,
  546. sortLv: 0,
  547. status: true,
  548. fixed: '',
  549. columnWidth: 170
  550. },
  551. {
  552. userId: this.$store.state.user.name,
  553. functionId: 601005,
  554. serialNumber: '601005Table1PhaseOutDate',
  555. tableId: '601005Table1',
  556. tableName: '审批规则表',
  557. columnProp: 'phaseOutDate',
  558. headerAlign: 'center',
  559. align: 'center',
  560. columnLabel: '停用日期',
  561. columnHidden: false,
  562. columnImage: false,
  563. columnSortable: false,
  564. sortLv: 0,
  565. status: true,
  566. fixed: '',
  567. columnWidth: 170
  568. },
  569. {
  570. userId: this.$store.state.user.name,
  571. functionId: 601005,
  572. serialNumber: '601005Table1CreateDate',
  573. tableId: '601005Table1',
  574. tableName: '审批规则表',
  575. columnProp: 'createDate',
  576. headerAlign: 'center',
  577. align: 'center',
  578. columnLabel: '创建时间',
  579. columnHidden: false,
  580. columnImage: false,
  581. columnSortable: false,
  582. sortLv: 0,
  583. status: true,
  584. fixed: '',
  585. columnWidth: 170
  586. },
  587. {
  588. userId: this.$store.state.user.name,
  589. functionId: 601005,
  590. serialNumber: '601005Table1CreateBy',
  591. tableId: "601005Table1",
  592. tableName: "审批规则表",
  593. columnProp: 'createBy',
  594. headerAlign: "center",
  595. align: "center",
  596. columnLabel: '创建人',
  597. columnHidden: false,
  598. columnImage: false,
  599. columnSortable: false,
  600. sortLv: 0,
  601. status: true,
  602. fixed: '',
  603. columnWidth: 100
  604. },
  605. {
  606. userId: this.$store.state.user.name,
  607. functionId: 601005,
  608. serialNumber: '601005Table1UpdateDate',
  609. tableId: "601005Table1",
  610. tableName: "审批规则表",
  611. columnProp: 'updateDate',
  612. headerAlign: "center",
  613. align: "center",
  614. columnLabel: '更新时间',
  615. columnHidden: false,
  616. columnImage: false,
  617. columnSortable: false,
  618. sortLv: 0,
  619. status: true,
  620. fixed: '',
  621. columnWidth: 170
  622. },
  623. {
  624. userId: this.$store.state.user.name,
  625. functionId: 601005,
  626. serialNumber: '601005Table1UpdateBy',
  627. tableId: "601005Table1",
  628. tableName: "审批规则表",
  629. columnProp: 'updateBy',
  630. headerAlign: "center",
  631. align: "center",
  632. columnLabel: '更新人',
  633. columnHidden: false,
  634. columnImage: false,
  635. columnSortable: false,
  636. sortLv: 0,
  637. status: true,
  638. fixed: '',
  639. columnWidth: 100
  640. },
  641. ],
  642. ruleStepColumnList: [
  643. {
  644. userId: this.$store.state.user.name,
  645. functionId: 601005,
  646. serialNumber: '601005Table2StepNo',
  647. tableId: "601005Table2",
  648. tableName: "审批规则步骤表",
  649. columnProp: 'stepNo',
  650. headerAlign: "center",
  651. align: "center",
  652. columnLabel: '步骤号',
  653. columnHidden: false,
  654. columnImage: false,
  655. columnSortable: false,
  656. sortLv: 0,
  657. status: true,
  658. fixed: '',
  659. columnWidth: 60
  660. },
  661. {
  662. userId: this.$store.state.user.name,
  663. functionId: 601005,
  664. serialNumber: '601005Table2AuthTypeDb',
  665. tableId: "601005Table2",
  666. tableName: "审批规则步骤表",
  667. columnProp: 'authTypeDb',
  668. headerAlign: "center",
  669. align: "center",
  670. columnLabel: '类型',
  671. columnHidden: false,
  672. columnImage: false,
  673. columnSortable: false,
  674. sortLv: 0,
  675. status: true,
  676. fixed: '',
  677. columnWidth: 90
  678. },
  679. {
  680. userId: this.$store.state.user.name,
  681. functionId: 601005,
  682. serialNumber: '601005Table2AuthUserNo',
  683. tableId: "601005Table2",
  684. tableName: "审批规则步骤表",
  685. columnProp: 'authUserNo',
  686. headerAlign: "center",
  687. align: "left",
  688. columnLabel: '审批人',
  689. columnHidden: false,
  690. columnImage: false,
  691. columnSortable: false,
  692. sortLv: 0,
  693. status: true,
  694. fixed: '',
  695. columnWidth: 100
  696. },
  697. {
  698. userId: this.$store.state.user.name,
  699. functionId: 601005,
  700. serialNumber: '601005Table2UserDisplay',
  701. tableId: "601005Table2",
  702. tableName: "审批规则步骤表",
  703. columnProp: 'userDisplay',
  704. headerAlign: "center",
  705. align: "left",
  706. columnLabel: '审批人姓名',
  707. columnHidden: false,
  708. columnImage: false,
  709. columnSortable: false,
  710. sortLv: 0,
  711. status: true,
  712. fixed: '',
  713. columnWidth: 100
  714. },
  715. {
  716. userId: this.$store.state.user.name,
  717. functionId: 601005,
  718. serialNumber: '601005Table2AuthGroupNo',
  719. tableId: "601005Table2",
  720. tableName: "审批规则步骤表",
  721. columnProp: 'authGroupNo',
  722. headerAlign: "center",
  723. align: "center",
  724. columnLabel: '审批组编码',
  725. columnHidden: false,
  726. columnImage: false,
  727. columnSortable: false,
  728. sortLv: 0,
  729. status: true,
  730. fixed: '',
  731. columnWidth: 120
  732. },
  733. {
  734. userId: this.$store.state.user.name,
  735. functionId: 601005,
  736. serialNumber: '601005Table2GroupDesc',
  737. tableId: "601005Table2",
  738. tableName: "审批规则步骤表",
  739. columnProp: 'groupDesc',
  740. headerAlign: "center",
  741. align: "left",
  742. columnLabel: '审批组名称',
  743. columnHidden: false,
  744. columnImage: false,
  745. columnSortable: false,
  746. sortLv: 0,
  747. status: true,
  748. fixed: '',
  749. columnWidth: 120
  750. },
  751. {
  752. userId: this.$store.state.user.name,
  753. functionId: 601005,
  754. serialNumber: '601005Table2FirstStepFlag',
  755. tableId: "601005Table2",
  756. tableName: "审批规则步骤表",
  757. columnProp: 'firstStepFlag',
  758. headerAlign: "center",
  759. align: "center",
  760. columnLabel: '首步骤',
  761. columnHidden: false,
  762. columnImage: false,
  763. columnSortable: false,
  764. sortLv: 0,
  765. status: true,
  766. fixed: '',
  767. columnWidth: 50
  768. },
  769. {
  770. userId: this.$store.state.user.name,
  771. functionId: 601005,
  772. serialNumber: '601005Table2LastStepFlag',
  773. tableId: "601005Table2",
  774. tableName: "审批规则步骤表",
  775. columnProp: 'lastStepFlag',
  776. headerAlign: "center",
  777. align: "center",
  778. columnLabel: '末步骤',
  779. columnHidden: false,
  780. columnImage: false,
  781. columnSortable: false,
  782. sortLv: 0,
  783. status: true,
  784. fixed: '',
  785. columnWidth: 50
  786. },
  787. {
  788. userId: this.$store.state.user.name,
  789. functionId: 601005,
  790. serialNumber: '601005Table2CreateDate',
  791. tableId: "601005Table2",
  792. tableName: "审批规则步骤表",
  793. columnProp: 'createDate',
  794. headerAlign: "center",
  795. align: "center",
  796. columnLabel: '创建时间',
  797. columnHidden: false,
  798. columnImage: false,
  799. columnSortable: false,
  800. sortLv: 0,
  801. status: true,
  802. fixed: '',
  803. columnWidth: 170
  804. },
  805. {
  806. userId: this.$store.state.user.name,
  807. functionId: 601005,
  808. serialNumber: '601005Table2CreateBy',
  809. tableId: "601005Table2",
  810. tableName: "审批规则步骤表",
  811. columnProp: 'createBy',
  812. headerAlign: "center",
  813. align: "left",
  814. columnLabel: '创建人',
  815. columnHidden: false,
  816. columnImage: false,
  817. columnSortable: false,
  818. sortLv: 0,
  819. status: true,
  820. fixed: '',
  821. columnWidth: 100
  822. },
  823. {
  824. userId: this.$store.state.user.name,
  825. functionId: 601005,
  826. serialNumber: '601005Table2UpdateDate',
  827. tableId: "601005Table2",
  828. tableName: "审批规则步骤表",
  829. columnProp: 'updateDate',
  830. headerAlign: "center",
  831. align: "center",
  832. columnLabel: '更新时间',
  833. columnHidden: false,
  834. columnImage: false,
  835. columnSortable: false,
  836. sortLv: 0,
  837. status: true,
  838. fixed: '',
  839. columnWidth: 170
  840. },
  841. {
  842. userId: this.$store.state.user.name,
  843. functionId: 601005,
  844. serialNumber: '601005Table2UpdateBy',
  845. tableId: "601005Table2",
  846. tableName: "审批规则步骤表",
  847. columnProp: 'updateBy',
  848. headerAlign: "center",
  849. align: "left",
  850. columnLabel: '更新人',
  851. columnHidden: false,
  852. columnImage: false,
  853. columnSortable: false,
  854. sortLv: 0,
  855. status: true,
  856. fixed: '',
  857. columnWidth: 100
  858. },
  859. ],
  860. rules: {
  861. bu: [
  862. {
  863. required: true,
  864. message: ' ',
  865. trigger: ['blur','change']
  866. }
  867. ],
  868. ruleNo:[
  869. {
  870. required: true,
  871. message: ' ',
  872. trigger: 'change'
  873. }
  874. ],
  875. ruleDesc:[
  876. {
  877. required: true,
  878. message: ' ',
  879. trigger: 'change'
  880. }
  881. ],
  882. active:[
  883. {
  884. required: true,
  885. message: ' ',
  886. trigger: 'change'
  887. }
  888. ],
  889. priority:[
  890. {
  891. required: true,
  892. message: ' ',
  893. trigger: 'change'
  894. }
  895. ],
  896. phaseInDate:[
  897. {
  898. required: true,
  899. message: ' ',
  900. trigger: 'change'
  901. }
  902. ],
  903. stepNo:[
  904. {
  905. required: true,
  906. message: ' ',
  907. trigger: 'change'
  908. }
  909. ],
  910. authTypeDb:[
  911. {
  912. required: true,
  913. message: ' ',
  914. trigger: 'change'
  915. }
  916. ],
  917. authUserNo:[
  918. {
  919. required: true,
  920. message: ' ',
  921. trigger: 'change'
  922. }
  923. ],
  924. userDisplay:[
  925. {
  926. required: true,
  927. message: ' ',
  928. trigger: 'change'
  929. }
  930. ],
  931. authGroupNo:[
  932. {
  933. required: true,
  934. message: ' ',
  935. trigger: 'change'
  936. }
  937. ],
  938. groupDesc:[
  939. {
  940. required: true,
  941. message: ' ',
  942. trigger: 'change'
  943. }
  944. ],
  945. },
  946. // ======== 模态框开关控制 ========
  947. authSearch: false,
  948. authSave: false,
  949. authUpdate: false,
  950. authDelete: false,
  951. modalFlag: false,
  952. ruleStepModalFlag: false,
  953. modalDisableFlag: false,
  954. ruleStepModalDisableFlag: false,
  955. menuId: this.$route.meta.menuId,
  956. };
  957. },
  958. watch: {
  959. searchData: {
  960. deep: true,
  961. handler: function (newV, oldV) {
  962. this.searchData.ruleNo = this.searchData.ruleNo.toUpperCase()
  963. }
  964. },
  965. modalData: {
  966. deep: true,
  967. handler: function (newV, oldV) {
  968. this.modalData.ruleNo = this.modalData.ruleNo.toUpperCase()
  969. }
  970. },
  971. ruleStepModalData: {
  972. deep: true,
  973. handler: function (newV, oldV) {
  974. this.ruleStepModalData.authGroupNo = this.ruleStepModalData.authGroupNo.toUpperCase()
  975. }
  976. }
  977. },
  978. mounted () {
  979. this.$nextTick(() => {
  980. this.height = window.innerHeight - 180
  981. })
  982. },
  983. created() {
  984. // 获取用户的 site 和 bu
  985. this.getSiteAndBuByUserName();
  986. // 获取数据列表
  987. this.getDataList()
  988. },
  989. methods: {
  990. // 获取用户的bu
  991. getSiteAndBuByUserName () {
  992. let tempData = {
  993. username: this.$store.state.user.name,
  994. }
  995. getSiteAndBuByUserName(tempData).then(({data}) => {
  996. if (data.code === 0) {
  997. this.userBuList = data.rows
  998. }
  999. })
  1000. },
  1001. // 每页数
  1002. sizeChangeHandle (val) {
  1003. this.pageSize = val
  1004. this.pageIndex = 1
  1005. this.getDataList()
  1006. },
  1007. // 当前页
  1008. currentChangeHandle (val) {
  1009. this.pageIndex = val
  1010. this.getDataList()
  1011. },
  1012. // 获取基础数据列表S
  1013. getBaseList (val,type) {
  1014. this.tagNo = val
  1015. this.$nextTick(() => {
  1016. let strVal = ''
  1017. let conSql = ''
  1018. if (val === 2003 ) {
  1019. strVal = this.ruleStepModalData.authUserNo
  1020. conSql = " and br.site = '" + this.$store.state.user.site + "'"
  1021. this.$refs.baseList.init(val, strVal, conSql)
  1022. }
  1023. if (val === 218 ) {
  1024. strVal = this.ruleStepModalData.authGroupNo
  1025. this.$refs.baseList.init(val, strVal)
  1026. }
  1027. })
  1028. },
  1029. /* 列表方法的回调 */
  1030. getBaseData (val) {
  1031. if (this.tagNo === 2003) {
  1032. this.ruleStepModalData.authUserNo = val.username
  1033. this.ruleStepModalData.userDisplay = val.user_display
  1034. }
  1035. if (this.tagNo === 218) {
  1036. this.ruleStepModalData.authGroupNo = val.group_no
  1037. this.ruleStepModalData.groupDesc = val.group_desc
  1038. }
  1039. },
  1040. // 获取数据列表
  1041. getDataList () {
  1042. if (this.searchData.bu != null && this.searchData.bu !== '') {
  1043. this.searchData.buNo = this.searchData.bu.split('_')[1]
  1044. }
  1045. this.searchData.limit = this.pageSize
  1046. this.searchData.page = this.pageIndex
  1047. authRuleSearch(this.searchData).then(({data}) => {
  1048. if (data.code === 0) {
  1049. this.dataList = data.page.list
  1050. this.pageIndex = data.page.currPage
  1051. this.pageSize = data.page.pageSize
  1052. this.totalPage = data.page.totalCount
  1053. // 遍历数据列表,将状态转换为中文
  1054. this.dataList.forEach(item => {
  1055. if (item.active === 'Y') {
  1056. item.active = '启用'
  1057. } else {
  1058. item.active = '禁用'
  1059. }
  1060. })
  1061. // 判断是否全部存在数据
  1062. if (this.totalPage > 0) {
  1063. // 设置选中行
  1064. this.$refs.mainTable.setCurrentRow(this.dataList[0])
  1065. // 加载当前的页签的table
  1066. this.refreshCurrentTabTable()
  1067. this.ruleClickRow(this.dataList[0])
  1068. }
  1069. }
  1070. })
  1071. },
  1072. // 获取数据列表
  1073. getRuleStepDataList () {
  1074. authRuleStepSearch(this.ruleCurrentRow).then(({data}) => {
  1075. if (data && data.code === 0) {
  1076. this.ruleStepDataList = data.list
  1077. // 设置选中行
  1078. this.$refs.ruleStepTable.setCurrentRow(this.ruleStepDataList[0])
  1079. for (let i = 0; i < this.ruleStepDataList.length; i++) {
  1080. if (this.ruleStepDataList[i].authTypeDb === 'U') {
  1081. this.ruleStepDataList[i].authTypeDb = '审批人'
  1082. } else {
  1083. this.ruleStepDataList[i].authTypeDb = '审批组'
  1084. }
  1085. }
  1086. }
  1087. })
  1088. },
  1089. addModal () {
  1090. this.modalData = {
  1091. flag: '1',
  1092. title: '审批规则新增',
  1093. bu: this.userBuList[0].buNo,
  1094. buNo: '',
  1095. ruleNo: '',
  1096. ruleDesc: '',
  1097. minValue: '',
  1098. maxValue: '',
  1099. priority: 1,
  1100. phaseInDate: new Date(),
  1101. active: 'Y',
  1102. createBy: this.$store.state.user.name,
  1103. }
  1104. this.modalDisableFlag = false
  1105. this.modalFlag = true
  1106. },
  1107. ruleStepAddModal () {
  1108. this.ruleStepModalData = {
  1109. flag: '1',
  1110. title: '审批规则步骤新增',
  1111. bu: this.userBuList[0].buNo,
  1112. buNo: '',
  1113. authRuleId: this.ruleCurrentRow.authRuleId,
  1114. ruleNo: this.ruleCurrentRow.ruleNo,
  1115. ruleDesc: this.ruleCurrentRow.ruleDesc,
  1116. stepNo: 10,
  1117. authTypeDb: 'U',
  1118. authUserNo: '',
  1119. userDisplay: '',
  1120. authGroupNo: '',
  1121. groupDesc: '',
  1122. firstStepFlag: 'N',
  1123. lastStepFlag: 'N',
  1124. createBy: this.$store.state.user.name,
  1125. }
  1126. // 遍历数据列表,判断步骤号,每次新增步骤号+10
  1127. let stepNoList = []
  1128. for (let i = 0; i < this.ruleStepDataList.length; i++) {
  1129. stepNoList.push(this.ruleStepDataList[i].stepNo)
  1130. }
  1131. if (stepNoList.length > 0) {
  1132. this.ruleStepModalData.stepNo = Math.max.apply(null, stepNoList) + 10
  1133. }
  1134. this.ruleStepModalDisableFlag = false
  1135. this.ruleStepModalFlag = true
  1136. },
  1137. /**
  1138. * 审批规则信息编辑模态框
  1139. * @param row
  1140. */
  1141. updateModal (row) {
  1142. if (row.active) {
  1143. if (row.active === '启用') {
  1144. row.active = 'Y'
  1145. } else {
  1146. row.active = 'N'
  1147. }
  1148. }
  1149. this.modalData = {
  1150. flag: '2',
  1151. title: '审批规则编辑',
  1152. site: row.site,
  1153. authRuleId: row.authRuleId,
  1154. recordType: row.recordType,
  1155. bu: row.site + '_' + row.buNo,
  1156. buNo: row.buNo,
  1157. ruleNo: row.ruleNo,
  1158. ruleDesc: row.ruleDesc,
  1159. minValue: row.minValue,
  1160. maxValue: row.maxValue,
  1161. priority: row.priority,
  1162. phaseInDate: row.phaseInDate,
  1163. phaseOutDate: row.phaseOutDate,
  1164. remark: row.remark,
  1165. active: row.active,
  1166. createBy: row.createBy,
  1167. createDate: row.createDate,
  1168. updateBy: this.$store.state.user.name,
  1169. updateDate: ''
  1170. }
  1171. this.modalDisableFlag = true
  1172. this.modalFlag = true
  1173. },
  1174. /**
  1175. * 审批规则步骤信息编辑模态框
  1176. * @param row
  1177. */
  1178. ruleStepUpdateModal (row) {
  1179. this.ruleStepModalData = {
  1180. flag: '2',
  1181. title: '审批规则步骤编辑',
  1182. site: row.site,
  1183. authStepId: row.authStepId,
  1184. authRuleId: row.authRuleId,
  1185. ruleNo: row.ruleNo,
  1186. ruleDesc: row.ruleDesc,
  1187. stepNo: row.stepNo,
  1188. authTypeDb: row.authTypeDb,
  1189. authUserNo: row.authUserNo,
  1190. userDisplay: row.userDisplay,
  1191. authGroupNo: row.authGroupNo,
  1192. groupDesc: row.groupDesc,
  1193. firstStepFlag: row.firstStepFlag,
  1194. lastStepFlag: row.lastStepFlag,
  1195. createBy: row.createBy,
  1196. createDate: row.createDate,
  1197. updateBy: this.$store.state.user.name,
  1198. updateDate: ''
  1199. }
  1200. this.ruleStepModalDisableFlag = true
  1201. this.ruleStepModalFlag = true
  1202. },
  1203. // ======== 新增/编辑/删除方法 ========
  1204. /**
  1205. * 审批规则信息新增/编辑
  1206. */
  1207. saveData () {
  1208. if (this.modalData.bu === '' || this.modalData.bu == null) {
  1209. this.$message.warning('请选择BU!')
  1210. return
  1211. }
  1212. if (this.modalData.ruleNo === '' || this.modalData.ruleNo == null) {
  1213. this.$message.warning('请填写审批规则编码!')
  1214. return
  1215. }
  1216. if (this.modalData.ruleDesc === '' || this.modalData.ruleDesc == null) {
  1217. this.$message.warning('请填写审批规则描述!')
  1218. return
  1219. }
  1220. if (this.modalData.priority === '' || this.modalData.priority == null) {
  1221. this.$message.warning('请选择优先级!')
  1222. return
  1223. }
  1224. if (this.modalData.phaseInDate === '' || this.modalData.phaseInDate == null) {
  1225. this.$message.warning('请选择启用日期!')
  1226. return
  1227. }
  1228. if (this.modalData.active === '' || this.modalData.active == null) {
  1229. this.$message.warning('请选择状态!')
  1230. return
  1231. }
  1232. if (this.modalData.flag === '1') {
  1233. this.modalData.buNo = this.modalData.bu.split('_')[1]
  1234. this.modalData.site = this.$store.state.user.site
  1235. authRuleSave(this.modalData).then(({data}) => {
  1236. if (data && data.code === 0) {
  1237. this.getDataList()
  1238. this.modalFlag = false
  1239. this.$message({
  1240. message: '操作成功',
  1241. type: 'success',
  1242. duration: 1500,
  1243. onClose: () => {}
  1244. })
  1245. } else {
  1246. this.$alert(data.msg, '错误', {
  1247. confirmButtonText: '确定'
  1248. })
  1249. }
  1250. })
  1251. } else {
  1252. if (this.modalData.active === 'N') {
  1253. if (this.modalData.phaseOutDate === '' || this.modalData.phaseOutDate == null) {
  1254. this.$alert('停用日期不能为空!', '错误', {
  1255. confirmButtonText: '确定'
  1256. })
  1257. return
  1258. }
  1259. }
  1260. authRuleEdit(this.modalData).then(({data}) => {
  1261. if (data && data.code === 0) {
  1262. this.getDataList()
  1263. this.modalFlag = false
  1264. this.$message({
  1265. message: '操作成功',
  1266. type: 'success',
  1267. duration: 1500,
  1268. onClose: () => {}
  1269. })
  1270. } else {
  1271. this.$alert(data.msg, '错误', {
  1272. confirmButtonText: '确定'
  1273. })
  1274. }
  1275. })
  1276. }
  1277. },
  1278. /**
  1279. * 审批规则步骤信息新增/编辑
  1280. */
  1281. ruleStepSaveData () {
  1282. if (this.ruleStepModalData.stepNo === '' || this.ruleStepModalData.stepNo == null) {
  1283. this.$message.warning('请填写步骤号!')
  1284. return
  1285. }
  1286. if (this.ruleStepModalData.authTypeDb === '' || this.ruleStepModalData.authTypeDb == null) {
  1287. this.$message.warning('请选择类型!')
  1288. return
  1289. }
  1290. if (this.ruleStepModalData.authTypeDb === 'U' || this.ruleStepModalData.authTypeDb === '审批人') {
  1291. if (this.ruleStepModalData.authUserNo === '' || this.ruleStepModalData.authUserNo == null) {
  1292. this.$message.warning('请填写审批人!')
  1293. return
  1294. }
  1295. if (this.ruleStepModalData.userDisplay === '' || this.ruleStepModalData.userDisplay == null) {
  1296. this.$alert('该审批人不存在,请重新输入审批人用户名!', '提示', {
  1297. confirmButtonText: '确定',
  1298. type: 'warning'
  1299. })
  1300. return;
  1301. }
  1302. } else {
  1303. if (this.ruleStepModalData.authGroupNo === '' || this.ruleStepModalData.authGroupNo == null) {
  1304. this.$message.warning('请填写审批组编码!')
  1305. return
  1306. }
  1307. if (this.ruleStepModalData.groupDesc === '' || this.ruleStepModalData.groupDesc == null) {
  1308. this.$alert('该审批组不存在,请重新输入审批组编码!', '提示', {
  1309. confirmButtonText: '确定',
  1310. type: 'warning'
  1311. })
  1312. return;
  1313. }
  1314. }
  1315. // 判断步骤号是否为整十的倍数
  1316. if (this.ruleStepModalData.stepNo % 10 !== 0) {
  1317. this.$alert('步骤号必须为整十的倍数(如10、20、30)!', '提示', {
  1318. confirmButtonText: '确定'
  1319. })
  1320. return
  1321. }
  1322. if (this.ruleStepDataList != null && this.ruleStepDataList.length > 0) {
  1323. for (let i = 0; i < this.ruleStepDataList.length; i++) {
  1324. if(this.ruleStepModalData.firstStepFlag === 'Y' && this.ruleStepDataList[i].firstStepFlag === 'Y') {
  1325. this.$alert('该审批步骤下已存在首步骤!', '提示', {
  1326. confirmButtonText: '确定'
  1327. })
  1328. return
  1329. }
  1330. if(this.ruleStepModalData.lastStepFlag === 'Y' && this.ruleStepDataList[i].lastStepFlag === 'Y') {
  1331. this.$alert('该审批步骤下已存在末步骤!', '提示', {
  1332. confirmButtonText: '确定'
  1333. })
  1334. return
  1335. }
  1336. }
  1337. }
  1338. if (this.ruleStepModalData.firstStepFlag === 'Y') {
  1339. this.ruleStepModalData.lastStepFlag = 'N'
  1340. } else if (this.ruleStepModalData.lastStepFlag === 'Y') {
  1341. this.ruleStepModalData.firstStepFlag = 'N'
  1342. } else {
  1343. this.ruleStepModalData.firstStepFlag = 'N'
  1344. this.ruleStepModalData.lastStepFlag = 'N'
  1345. }
  1346. if (this.ruleStepModalData.flag === '1') {
  1347. this.ruleStepModalData.buNo = this.ruleStepModalData.bu.split('_')[1]
  1348. this.ruleStepModalData.site = this.$store.state.user.site
  1349. authRuleStepSave(this.ruleStepModalData).then(({data}) => {
  1350. if (data && data.code === 0) {
  1351. this.getRuleStepDataList()
  1352. this.ruleStepModalFlag = false
  1353. this.$message({
  1354. message: '操作成功',
  1355. type: 'success',
  1356. duration: 1500,
  1357. onClose: () => {}
  1358. })
  1359. } else {
  1360. this.$alert(data.msg, '错误', {
  1361. confirmButtonText: '确定'
  1362. })
  1363. }
  1364. })
  1365. } else {
  1366. if (this.ruleStepModalData.authTypeDb === '审批人') {
  1367. this.ruleStepModalData.authTypeDb = 'U'
  1368. } else {
  1369. this.ruleStepModalData.authTypeDb = 'G'
  1370. }
  1371. authRuleStepEdit(this.ruleStepModalData).then(({data}) => {
  1372. if (data && data.code === 0) {
  1373. this.getRuleStepDataList()
  1374. this.ruleStepModalFlag = false
  1375. this.$message({
  1376. message: '操作成功',
  1377. type: 'success',
  1378. duration: 1500,
  1379. onClose: () => {}
  1380. })
  1381. } else {
  1382. this.$alert(data.msg, '错误', {
  1383. confirmButtonText: '确定'
  1384. })
  1385. }
  1386. })
  1387. }
  1388. },
  1389. /**
  1390. * 审批规则信息删除
  1391. */
  1392. delModal (row) {
  1393. this.$confirm(`是否删除这条审批规则信息?`, '提示', {
  1394. confirmButtonText: '确定',
  1395. cancelButtonText: '取消',
  1396. type: 'warning'
  1397. }).then(() => {
  1398. authRuleDelete(row).then(({data}) => {
  1399. if (data && data.code === 0) {
  1400. this.getDataList()
  1401. this.partSelections = []
  1402. this.$message({
  1403. message: '操作成功',
  1404. type: 'success',
  1405. duration: 1500,
  1406. onClose: () => {}
  1407. })
  1408. } else {
  1409. this.$alert(data.msg, '错误', {
  1410. confirmButtonText: '确定'
  1411. })
  1412. }
  1413. })
  1414. }).catch(() => {
  1415. })
  1416. },
  1417. /**
  1418. * 审批规则步骤信息删除
  1419. */
  1420. ruleStepDelModal (row) {
  1421. this.$confirm(`是否删除这条审批规则步骤信息?`, '提示', {
  1422. confirmButtonText: '确定',
  1423. cancelButtonText: '取消',
  1424. type: 'warning'
  1425. }).then(() => {
  1426. authRuleStepDelete(row).then(({data}) => {
  1427. if (data && data.code === 0) {
  1428. this.getRuleStepDataList()
  1429. this.partSelections = []
  1430. this.$message({
  1431. message: '操作成功',
  1432. type: 'success',
  1433. duration: 1500,
  1434. onClose: () => {}
  1435. })
  1436. } else {
  1437. this.$alert(data.msg, '错误', {
  1438. confirmButtonText: '确定'
  1439. })
  1440. }
  1441. })
  1442. }).catch(() => {
  1443. })
  1444. },
  1445. clearRuleStepModalData () {
  1446. this.ruleStepModalData.authUserNo = ''
  1447. this.ruleStepModalData.userDisplay = ''
  1448. this.ruleStepModalData.authGroupNo = ''
  1449. this.ruleStepModalData.groupDesc = ''
  1450. },
  1451. authUserNoBlur () {
  1452. let params = {
  1453. username: this.ruleStepModalData.authUserNo,
  1454. site: this.$store.state.user.site,
  1455. limit: 1,
  1456. page: 1
  1457. }
  1458. authBusinessSearch(params).then(({data}) => {
  1459. if (data.code === 0) {
  1460. this.ruleStepModalData.userDisplay = data.page.list[0].userDisplay
  1461. } else {
  1462. this.$alert(data.msg, '错误', {
  1463. confirmButtonText: '确定'
  1464. })
  1465. }
  1466. })
  1467. },
  1468. authGroupNoBlur () {
  1469. let params = {
  1470. site: this.$store.state.user.site,
  1471. groupNo: this.ruleStepModalData.authGroupNo,
  1472. active: 'Y',
  1473. limit: 1,
  1474. page: 1
  1475. }
  1476. authGroupSearch(params).then(({data}) => {
  1477. if (data.code === 0) {
  1478. this.ruleStepModalData.groupDesc = data.page.list[0].groupDesc
  1479. } else {
  1480. this.$alert(data.msg, '错误', {
  1481. confirmButtonText: '确定'
  1482. })
  1483. }
  1484. })
  1485. },
  1486. // ======== 列表操作方法 ========
  1487. /**
  1488. * 单机选中审批规则信息
  1489. * @param row
  1490. */
  1491. ruleClickRow(row) {
  1492. this.ruleCurrentRow = JSON.parse(JSON.stringify(row))
  1493. },
  1494. changeCurrentRow (row, oldRow) {
  1495. // 判断是否是获取焦点的事件
  1496. if (row) {
  1497. this.ruleCurrentRow = JSON.parse(JSON.stringify(row))
  1498. //刷新当前页表
  1499. this.refreshCurrentTabTable()
  1500. }
  1501. },
  1502. // 列表表格选择替换
  1503. tabClick (tab, event) {
  1504. // 刷新列表数据
  1505. this.refreshCurrentTabTable()
  1506. },
  1507. refreshCurrentTabTable () {
  1508. if (this.activeTable == 'auth_rule_step') {
  1509. this.getRuleStepDataList()
  1510. }
  1511. },
  1512. }
  1513. }
  1514. </script>