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.

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