feeindex.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. <template>
  2. <el-dialog
  3. title="指标权重明细"
  4. :visible.sync="isShowNormDialog"
  5. :width="'80%'"
  6. :close-on-click-modal="false"
  7. :before-close="closeHandler"
  8. >
  9. <div class="app-container" style="margin: 0px">
  10. <el-form
  11. :model="queryParams"
  12. ref="queryForm"
  13. :inline="true"
  14. v-show="showSearch"
  15. >
  16. <el-form-item label="是否启用" prop="status">
  17. <el-select
  18. v-model="queryParams.status"
  19. placeholder="请选择是否启用"
  20. clearable
  21. filterable
  22. >
  23. <el-option
  24. v-for="(item, index) in 2"
  25. :key="index"
  26. :label="item == 1 ? '启用' : '不启用'"
  27. :value="item == 1 ? 1 : 0"
  28. />
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item>
  32. <el-button type="primary" icon="el-icon-search" @click="handleQuery"
  33. >搜索</el-button
  34. >
  35. <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
  36. </el-form-item>
  37. </el-form>
  38. <el-row :gutter="10" class="mb8">
  39. <el-col :span="1.5">
  40. <el-button
  41. type="primary"
  42. icon="el-icon-plus"
  43. @click="handleAdd"
  44. v-hasPermi="['business:NORMFEE:add']"
  45. >新增</el-button
  46. >
  47. </el-col>
  48. <el-col :span="1.5">
  49. <el-button
  50. type="success"
  51. icon="el-icon-edit"
  52. :disabled="single"
  53. @click="handleUpdate"
  54. v-hasPermi="['business:NORMFEE:edit']"
  55. >修改</el-button
  56. >
  57. </el-col>
  58. <el-col :span="1.5">
  59. <el-button
  60. type="danger"
  61. icon="el-icon-delete"
  62. :disabled="multiple"
  63. @click="handleDelete"
  64. v-hasPermi="['business:NORMFEE:remove']"
  65. >删除</el-button
  66. >
  67. </el-col>
  68. <right-toolbar
  69. :showSearch.sync="showSearch"
  70. @queryTable="getList"
  71. ></right-toolbar>
  72. </el-row>
  73. <el-table :data="normData" @selection-change="handleSelectionChange">
  74. <el-table-column type="selection" width="55" align="center" />
  75. <el-table-column label="分类占比" align="center" prop="normRatio" />
  76. <el-table-column
  77. label="指标参数名称"
  78. align="center"
  79. prop="fname"
  80. width="150"
  81. />
  82. <el-table-column
  83. label="指标编码"
  84. align="center"
  85. prop="fcode"
  86. width="150"
  87. />
  88. <el-table-column
  89. label="计算公式"
  90. align="center"
  91. prop="formula"
  92. width="150"
  93. >
  94. <template slot-scope="scope">
  95. <el-link style="text-decoration: underline;color: #36aafd" @click="formulaDialog(scope.row.id,scope.row.formula)">{{scope.row.formula}}</el-link>
  96. </template>
  97. </el-table-column>
  98. <el-table-column
  99. label="计量单位"
  100. align="center"
  101. prop="funit_dictText"
  102. width="100"
  103. />
  104. <el-table-column
  105. label="权数"
  106. align="center"
  107. prop="fnumber"
  108. width="90"
  109. />
  110. <el-table-column
  111. label="排序"
  112. align="center"
  113. prop="sort"
  114. width="90"
  115. />
  116. <el-table-column
  117. label="绩效公差上下公差占比"
  118. align="center"
  119. prop="msRetio"
  120. width="130"
  121. />
  122. <el-table-column
  123. label="采集公差上下公差占比"
  124. align="center"
  125. prop="dfRetio"
  126. width="130"
  127. />
  128. <el-table-column
  129. label="采集参考值"
  130. align="center"
  131. prop="collValue"
  132. width="130"
  133. />
  134. <el-table-column
  135. label="绩效参考值"
  136. align="center"
  137. prop="meritsValue"
  138. width="130"
  139. />
  140. <el-table-column
  141. label="是否启用"
  142. align="center"
  143. prop="status"
  144. width="100"
  145. >
  146. <template slot-scope="scope">
  147. <el-switch
  148. v-model="scope.row.status"
  149. @change="changeSwitchHandler(scope.row)"
  150. active-color="#13ce66"
  151. inactive-color="#ff4949"
  152. ></el-switch>
  153. </template>
  154. </el-table-column>
  155. <!-- <el-table-column label="启用时间" align="center" prop="startTime" />
  156. <el-table-column label="停用时间" align="center" prop="stopTime" /> -->
  157. <el-table-column
  158. label="备注"
  159. align="center"
  160. prop="remark"
  161. width="150"
  162. />
  163. <el-table-column label="操作" align="center" fixed="right" width="150">
  164. <template slot-scope="scope">
  165. <el-button
  166. size="mini"
  167. type="text"
  168. icon="el-icon-edit"
  169. @click="handleUpdate(scope.row)"
  170. v-hasPermi="['business:NORMFEE:edit']"
  171. >修改</el-button
  172. >
  173. <el-button
  174. size="mini"
  175. type="text"
  176. icon="el-icon-delete"
  177. @click="handleDelete(scope.row)"
  178. v-hasPermi="['business:NORMFEE:remove']"
  179. >删除</el-button
  180. >
  181. <el-button
  182. size="mini"
  183. type="text"
  184. icon="el-icon-edit"
  185. @click="formulaDialog(scope.row.id,scope.row.formula)"
  186. v-hasPermi="['business:NORMFEE:edit']"
  187. >计算公式</el-button>
  188. </template>
  189. </el-table-column>
  190. </el-table>
  191. <pagination
  192. v-show="totalNum > 0"
  193. :total="totalNum"
  194. :page.sync="queryParams.pageNum"
  195. :limit.sync="queryParams.pageSize"
  196. @pagination="getList"
  197. />
  198. <!-- 添加或修改指标权重明细对话框 -->
  199. <el-dialog
  200. :title="title"
  201. :visible.sync="open"
  202. width="600px"
  203. :close-on-click-modal="false"
  204. append-to-body
  205. >
  206. <el-form ref="form" :model="form" :rules="rules" label-width="170px">
  207. <el-form-item label="权数" prop="fnumber">
  208. <el-input
  209. v-model="form.fnumber"
  210. aria-placeholder="请输入数值"
  211. ></el-input>
  212. </el-form-item>
  213. <el-form-item label="排序" prop="sort">
  214. <el-input
  215. v-model="form.sort"
  216. aria-placeholder="请输入数值"
  217. ></el-input>
  218. </el-form-item>
  219. <el-form-item label="分类占比" prop="normRatio">
  220. <el-input v-model="form.normRatio"></el-input>
  221. </el-form-item>
  222. <el-form-item label="计量单位" prop="funit">
  223. <el-select
  224. v-model="form.funit"
  225. @change="selUnitHandler"
  226. placeholder="请选择"
  227. style="width: 100%"
  228. >
  229. <el-option
  230. v-for="dict in unitSel"
  231. :key="dict.dictCode"
  232. :label="dict.dictLabel"
  233. :value="dict.dictValue"
  234. ></el-option>
  235. </el-select>
  236. </el-form-item>
  237. <el-form-item label="指标参数名称" prop="fname">
  238. <el-input v-model="form.fname"></el-input>
  239. </el-form-item>
  240. <el-form-item label="采集公差上下公差占比" prop="dfRetio">
  241. <el-input v-model="form.dfRetio"></el-input>
  242. </el-form-item>
  243. <el-form-item label="绩效公差上下公差占比" prop="dfRetio">
  244. <el-input v-model="form.msRetio"></el-input>
  245. </el-form-item>
  246. <el-form-item label="采集参考值" prop="collValue">
  247. <el-input v-model="form.collValue"></el-input>
  248. </el-form-item>
  249. <el-form-item label="绩效参考值" prop="meritsValue">
  250. <el-input v-model="form.meritsValue"></el-input>
  251. </el-form-item>
  252. <el-form-item label="备注">
  253. <el-input type="textarea" v-model="form.remark"></el-input>
  254. </el-form-item>
  255. </el-form>
  256. <div slot="footer" class="dialog-footer">
  257. <el-button type="primary" @click="submitForm">确 定</el-button>
  258. <el-button @click="cancel">取 消</el-button>
  259. </div>
  260. </el-dialog>
  261. </div>
  262. <formula @closeFormulaHandler="closeFormulaHandler" ref="formula" @dataFormulaHandler="dataFormulaHandler" :id="id" :normId="normId" reset :isShowFormulaDialog="isShowFormulaDialog" />
  263. </el-dialog>
  264. </template>
  265. <script>
  266. import {
  267. listNORMFEE,
  268. getNORMFEE,
  269. delNORMFEE,
  270. addNORMFEE,
  271. updateNORMFEE,
  272. } from "@/api/norm/NORMFEE";
  273. import formula from './formula';
  274. import { listData } from "@/api/system/dict/data";
  275. import { formatDate } from "@/utils/index";
  276. export default {
  277. name: "NORMFEE",
  278. components: {
  279. formula
  280. },
  281. props: {
  282. isShowNormDialog: {
  283. type: Boolean,
  284. default: () => {
  285. return false;
  286. },
  287. },
  288. normId: {
  289. type: String,
  290. default: () => {
  291. return null;
  292. },
  293. },
  294. normData: {
  295. type: Array,
  296. defaultL: () => {
  297. return [];
  298. },
  299. },
  300. totalNum:{
  301. type:Number,
  302. default:0
  303. }
  304. },
  305. data() {
  306. return {
  307. dict: {
  308. type: {
  309. dictType: "",
  310. },
  311. },
  312. // 根路径
  313. baseURL: process.env.VUE_APP_BASE_API,
  314. // 遮罩层
  315. loading: true,
  316. // 选中数组
  317. ids: [],
  318. // 非单个禁用
  319. single: true,
  320. // 非多个禁用
  321. multiple: true,
  322. // 显示搜索条件
  323. showSearch: true,
  324. // 总条数
  325. total: 0,
  326. isShowFormulaDialog: false,
  327. id: '',
  328. // 弹出层标题
  329. title: "",
  330. // 是否显示弹出层
  331. open: false,
  332. // 查询参数
  333. queryParams: {
  334. pageNum: 1,
  335. pageSize: 10,
  336. id: null,
  337. // createTime: null,
  338. // createBy: null,
  339. // updateTime: null,
  340. // updateBy: null,
  341. // delFlag: null,
  342. // deptId: null,
  343. // normId: null,
  344. // normRatio: null,
  345. // fname: null,
  346. // funit: null,
  347. // fnumber: null,
  348. // fvalue: null,
  349. // status: null,
  350. // startTime: null,
  351. // stopTime: null,
  352. // remark: null
  353. },
  354. // 表单参数
  355. form: {},
  356. // 表单校验
  357. rules: {
  358. fnumber: [{ required: true, message: "权数为数值", trigger: "blur" }],
  359. sort: [{ required: true, message: "排序为数值", trigger: "blur" }],
  360. normRatio: [
  361. { required: true, message: "分类占比不能为空", trigger: "blur" },
  362. ],
  363. fname: [
  364. { required: true, message: "指标参数名称不能为空", trigger: "blur" },
  365. ],
  366. funit: [
  367. { required: true, message: "计量单位不能为空", trigger: "blur" },
  368. ],
  369. dfRetio: [
  370. { required: true, message: "公差占比不能为空", trigger: "blur" },
  371. ],
  372. type: [
  373. { required: true, message: "明细类型不能为空", trigger: "blur" },
  374. ],
  375. msRetio: [
  376. {
  377. required: true,
  378. message: "绩效公差上下公差占比不能为空",
  379. trigger: "blur",
  380. },
  381. ],
  382. collValue: [
  383. { required: true, message: "采集参考值不能为空", trigger: "blur" },
  384. ],
  385. meritsValue: [
  386. { required: true, message: "绩效参考值不能为空", trigger: "blur" },
  387. ],
  388. },
  389. unitSel: null,
  390. };
  391. },
  392. mounted() {
  393. listData({
  394. pageNum: 1,
  395. pageSize: 10,
  396. dictType: "norm_uint",
  397. }).then((res) => {
  398. this.unitSel = res.rows;
  399. });
  400. this.getList();
  401. },
  402. methods: {
  403. formulaDialog(id,formula) {
  404. this.isShowFormulaDialog = true;
  405. this.id = id;
  406. // formula使用props传值有延迟,使用ref传入
  407. this.$refs.formula.init(formula)
  408. },
  409. dataFormulaHandler(data) {
  410. this.isShowFormulaDialog = false;
  411. this.queryParams.normId = data;
  412. listNORMFEE(this.queryParams).then((response) => {
  413. response.rows.forEach((item, index) => {
  414. response.rows[index].status = item.status == 0 ? false : true;
  415. });
  416. this.normData = response.rows;
  417. });
  418. },
  419. /** 查询指标权重明细列表 */
  420. getList() {
  421. this.loading = true;
  422. this.queryParams.normId = this.normId;
  423. listNORMFEE(this.queryParams).then((response) => {
  424. response.rows.forEach((item, index) => {
  425. response.rows[index].status = item.status == 0 ? false : true;
  426. });
  427. this.NORMFEEList = response.rows;
  428. this.loading = false;
  429. this.$emit("dataHandler", response.rows);
  430. });
  431. },
  432. // 取消按钮
  433. cancel() {
  434. this.open = false;
  435. this.reset();
  436. },
  437. // 表单重置
  438. reset() {
  439. this.form = {
  440. id: null,
  441. delFlag: null,
  442. deptId: null,
  443. normId: null,
  444. normRatio: null,
  445. fname: null,
  446. funit: null,
  447. fnumber: null,
  448. fvalue: null,
  449. status: "0",
  450. startTime: null,
  451. stopTime: null,
  452. remark: null,
  453. };
  454. this.resetForm("form");
  455. },
  456. /** 搜索按钮操作 */
  457. handleQuery() {
  458. this.queryParams.pageNum = 1;
  459. this.getList();
  460. },
  461. /** 重置按钮操作 */
  462. resetQuery() {
  463. this.resetForm("queryForm");
  464. this.handleQuery();
  465. },
  466. // 多选框选中数据
  467. handleSelectionChange(selection) {
  468. // this.form = selection[0];
  469. this.ids = selection.map((item) => item.id);
  470. this.single = selection.length !== 1;
  471. this.multiple = !selection.length;
  472. },
  473. /** 新增按钮操作 */
  474. handleAdd() {
  475. this.open = true;
  476. this.reset();
  477. this.title = "添加指标权重明细";
  478. },
  479. /** 修改按钮操作 */
  480. handleUpdate(row) {
  481. this.reset();
  482. const id = row.id || this.ids;
  483. getNORMFEE(id).then((response) => {
  484. this.form = response.data;
  485. this.open = true;
  486. // this.form = row;
  487. this.title = "修改指标权重明细";
  488. });
  489. },
  490. /** 提交按钮 */
  491. submitForm() {
  492. this.$refs["form"].validate((valid) => {
  493. this.form.status = 1;
  494. if (valid) {
  495. if (
  496. !(
  497. parseInt(this.form.fnumber) == this.form.fnumber ||
  498. parseFloat(this.form.fnumber) == this.form.fnumber
  499. )
  500. ) {
  501. this.$message.error("权数必须为整数或小数");
  502. return;
  503. }
  504. if (
  505. !(
  506. parseInt(this.form.normRatio) == this.form.normRatio ||
  507. parseFloat(this.form.normRatio) == this.form.normRatio
  508. )
  509. ) {
  510. this.$message.error("分类占比必须为整数或小数");
  511. return;
  512. }
  513. if (
  514. !(
  515. parseInt(this.form.meritsValue) == this.form.meritsValue ||
  516. parseFloat(this.form.meritsValue) == this.form.meritsValue
  517. )
  518. ) {
  519. this.$message.error("绩效参考值必须为整数或小数");
  520. return;
  521. }
  522. if (
  523. !(
  524. parseInt(this.form.collValue) == this.form.collValue ||
  525. parseFloat(this.form.collValue) == this.form.collValue
  526. )
  527. ) {
  528. this.$message.error("采集参考值必须为整数或小数");
  529. return;
  530. }
  531. if (
  532. !(
  533. parseInt(this.form.dfRetio) == this.form.dfRetio ||
  534. parseFloat(this.form.dfRetio) == this.form.dfRetio
  535. )
  536. ) {
  537. this.$message.error("采集公差上下公差占比必须为整数或小数");
  538. return;
  539. }
  540. if (
  541. !(
  542. parseInt(this.form.msRetio) == this.form.msRetio ||
  543. parseFloat(this.form.msRetio) == this.form.msRetio
  544. )
  545. ) {
  546. this.$message.error("绩效公差上下公差占比必须为整数或小数");
  547. return;
  548. }
  549. this.form.normId = this.normId;
  550. this.form.status = 1;
  551. if (this.form.id != null) {
  552. updateNORMFEE(this.form).then(response => {
  553. this.$modal.msgSuccess("修改成功");
  554. this.open = false;
  555. this.getList();
  556. });
  557. } else {
  558. addNORMFEE(this.form).then((response) => {
  559. this.$modal.msgSuccess("新增成功");
  560. this.open = false;
  561. this.getList();
  562. });
  563. }
  564. }
  565. });
  566. },
  567. /** 删除按钮操作 */
  568. handleDelete(row) {
  569. const ids = row.id || this.ids;
  570. getNORMFEE(ids)
  571. .then((response) => {
  572. this.fname = response.data.fname;
  573. this.$modal
  574. .confirm('是否确认删除指标参数名称为"' + this.fname + '"的数据项?')
  575. .then(() => {
  576. return delNORMFEE(ids);
  577. })
  578. .then(() => {
  579. this.getList();
  580. this.$modal.msgSuccess("删除成功");
  581. })
  582. .catch(() => {});
  583. });
  584. },
  585. /** 导出按钮操作 */
  586. handleExport() {
  587. this.download(
  588. "/normFee/export",
  589. {
  590. ...this.queryParams,
  591. },
  592. `NORMFEE_${new Date().getTime()}.xlsx`
  593. );
  594. },
  595. // 关闭Dialog窗口
  596. closeHandler() {
  597. this.$emit("closeHandler");
  598. },
  599. closeFormulaHandler() {
  600. this.isShowFormulaDialog = false;
  601. },
  602. // 选择单位处理
  603. selUnitHandler(val) {
  604. this.form.funit = val;
  605. },
  606. changeSwitchHandler(data) {
  607. let id = data.id;
  608. if (data.status) {
  609. updateNORMFEE({
  610. id,
  611. startTime: formatDate(new Date()),
  612. status: 1,
  613. });
  614. } else {
  615. updateNORMFEE({
  616. id,
  617. stopTime: formatDate(new Date()),
  618. status: 0,
  619. });
  620. }
  621. },
  622. },
  623. };
  624. </script>