index.vue.vm 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. <template>
  2. <div class="app-container">
  3. <el-card shadow="never">
  4. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  5. #foreach($column in $columns)
  6. #if($column.query)
  7. #set($dictType=$column.dictType)
  8. #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
  9. #set($parentheseIndex=$column.columnComment.indexOf("("))
  10. #if($parentheseIndex != -1)
  11. #set($comment=$column.columnComment.substring(0, $parentheseIndex))
  12. #else
  13. #set($comment=$column.columnComment)
  14. #end
  15. #if($column.htmlType == "input" || $column.htmlType == "textarea")
  16. <el-form-item label="${comment}" prop="${column.javaField}">
  17. <el-input
  18. v-model="queryParams.${column.javaField}"
  19. placeholder="请输入${comment}"
  20. clearable
  21. @keyup.enter.native="handleQuery"
  22. />
  23. </el-form-item>
  24. #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType)
  25. <el-form-item label="${comment}" prop="${column.javaField}">
  26. <el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable>
  27. <el-option
  28. v-for="dict in dict.type.${dictType}"
  29. :key="dict.value"
  30. :label="dict.label"
  31. :value="dict.value"
  32. />
  33. </el-select>
  34. </el-form-item>
  35. #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType)
  36. <el-form-item label="${comment}" prop="${column.javaField}">
  37. <el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable>
  38. <el-option label="请选择字典生成" value="" />
  39. </el-select>
  40. </el-form-item>
  41. #elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN")
  42. <el-form-item label="${comment}" prop="${column.javaField}">
  43. <el-date-picker clearable
  44. v-model="queryParams.${column.javaField}"
  45. type="date"
  46. value-format="yyyy-MM-dd"
  47. placeholder="请选择${comment}">
  48. </el-date-picker>
  49. </el-form-item>
  50. #elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
  51. <el-form-item label="${comment}">
  52. <el-date-picker
  53. v-model="daterange${AttrName}"
  54. style="width: 240px"
  55. value-format="yyyy-MM-dd HH:mm:ss"
  56. type="daterange"
  57. range-separator="-"
  58. start-placeholder="开始日期"
  59. end-placeholder="结束日期"
  60. :default-time="['00:00:00', '23:59:59']"
  61. ></el-date-picker>
  62. </el-form-item>
  63. #end
  64. #end
  65. #end
  66. <el-form-item>
  67. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  68. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  69. </el-form-item>
  70. </el-form>
  71. </el-card>
  72. <el-card shadow="never" class="mt10">
  73. <el-row :gutter="10" class="mb8">
  74. <el-col :span="1.5">
  75. <el-button
  76. type="primary"
  77. plain
  78. icon="el-icon-plus"
  79. size="mini"
  80. @click="handleAdd"
  81. v-hasPermi="['${moduleName}:${businessName}:add']"
  82. >新增</el-button>
  83. </el-col>
  84. <el-col :span="1.5">
  85. <el-button
  86. type="success"
  87. plain
  88. icon="el-icon-edit"
  89. size="mini"
  90. :disabled="single"
  91. @click="handleUpdate"
  92. v-hasPermi="['${moduleName}:${businessName}:edit']"
  93. >修改</el-button>
  94. </el-col>
  95. <el-col :span="1.5">
  96. <el-button
  97. type="danger"
  98. plain
  99. icon="el-icon-delete"
  100. size="mini"
  101. :disabled="multiple"
  102. @click="handleDelete"
  103. v-hasPermi="['${moduleName}:${businessName}:remove']"
  104. >删除</el-button>
  105. </el-col>
  106. <el-col :span="1.5">
  107. <el-button
  108. type="warning"
  109. plain
  110. icon="el-icon-download"
  111. size="mini"
  112. @click="handleExport"
  113. v-hasPermi="['${moduleName}:${businessName}:export']"
  114. >导出</el-button>
  115. </el-col>
  116. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  117. </el-row>
  118. <el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange">
  119. <el-table-column type="selection" width="55" align="center" />
  120. #foreach($column in $columns)
  121. #set($javaField=$column.javaField)
  122. #set($parentheseIndex=$column.columnComment.indexOf("("))
  123. #if($parentheseIndex != -1)
  124. #set($comment=$column.columnComment.substring(0, $parentheseIndex))
  125. #else
  126. #set($comment=$column.columnComment)
  127. #end
  128. #if($column.pk)
  129. <el-table-column label="${comment}" align="center" prop="${javaField}" v-if="${column.list}"/>
  130. #elseif($column.list && $column.htmlType == "datetime")
  131. <el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
  132. <template slot-scope="scope">
  133. <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
  134. </template>
  135. </el-table-column>
  136. #elseif($column.list && $column.htmlType == "imageUpload")
  137. <el-table-column label="${comment}" align="center" prop="${javaField}" width="100">
  138. <template slot-scope="scope">
  139. <image-preview :src="scope.row.${javaField}" :width="50" :height="50"/>
  140. </template>
  141. </el-table-column>
  142. #elseif($column.list && $column.dictType && "" != $column.dictType)
  143. <el-table-column label="${comment}" align="center" prop="${javaField}">
  144. <template slot-scope="scope">
  145. #if($column.htmlType == "checkbox")
  146. <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/>
  147. #else
  148. <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField}"/>
  149. #end
  150. </template>
  151. </el-table-column>
  152. #elseif($column.list && "" != $javaField)
  153. <el-table-column label="${comment}" align="center" prop="${javaField}" />
  154. #end
  155. #end
  156. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  157. <template slot-scope="scope">
  158. <el-button
  159. size="mini"
  160. type="text"
  161. icon="el-icon-edit"
  162. @click="handleUpdate(scope.row)"
  163. v-hasPermi="['${moduleName}:${businessName}:edit']"
  164. >修改</el-button>
  165. <el-button
  166. size="mini"
  167. type="text"
  168. icon="el-icon-delete"
  169. @click="handleDelete(scope.row)"
  170. v-hasPermi="['${moduleName}:${businessName}:remove']"
  171. >删除</el-button>
  172. </template>
  173. </el-table-column>
  174. </el-table>
  175. <pagination
  176. v-show="total>0"
  177. :total="total"
  178. :page.sync="queryParams.pageNum"
  179. :limit.sync="queryParams.pageSize"
  180. @pagination="getList"
  181. />
  182. </el-card>
  183. <!-- 添加或修改${functionName}对话框 -->
  184. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  185. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  186. #foreach($column in $columns)
  187. #set($field=$column.javaField)
  188. #if($column.insert && !$column.pk)
  189. #set($parentheseIndex=$column.columnComment.indexOf("("))
  190. #if($parentheseIndex != -1)
  191. #set($comment=$column.columnComment.substring(0, $parentheseIndex))
  192. #else
  193. #set($comment=$column.columnComment)
  194. #end
  195. #set($dictType=$column.dictType)
  196. #if($column.htmlType == "input")
  197. <el-form-item label="${comment}" prop="${field}">
  198. <el-input v-model="form.${field}" placeholder="请输入${comment}" />
  199. </el-form-item>
  200. #elseif($column.htmlType == "imageUpload")
  201. <el-form-item label="${comment}" prop="${field}">
  202. <image-upload v-model="form.${field}"/>
  203. </el-form-item>
  204. #elseif($column.htmlType == "fileUpload")
  205. <el-form-item label="${comment}" prop="${field}">
  206. <file-upload v-model="form.${field}"/>
  207. </el-form-item>
  208. #elseif($column.htmlType == "editor")
  209. <el-form-item label="${comment}">
  210. <editor v-model="form.${field}" :min-height="192"/>
  211. </el-form-item>
  212. #elseif($column.htmlType == "select" && "" != $dictType)
  213. <el-form-item label="${comment}" prop="${field}">
  214. <el-select v-model="form.${field}" placeholder="请选择${comment}">
  215. <el-option
  216. v-for="dict in dict.type.${dictType}"
  217. :key="dict.value"
  218. :label="dict.label"
  219. #if($column.javaType == "Integer" || $column.javaType == "Long")
  220. :value="parseInt(dict.value)"
  221. #else
  222. :value="dict.value"
  223. #end
  224. ></el-option>
  225. </el-select>
  226. </el-form-item>
  227. #elseif($column.htmlType == "select" && $dictType)
  228. <el-form-item label="${comment}" prop="${field}">
  229. <el-select v-model="form.${field}" placeholder="请选择${comment}">
  230. <el-option label="请选择字典生成" value="" />
  231. </el-select>
  232. </el-form-item>
  233. #elseif($column.htmlType == "checkbox" && "" != $dictType)
  234. <el-form-item label="${comment}" prop="${field}">
  235. <el-checkbox-group v-model="form.${field}">
  236. <el-checkbox
  237. v-for="dict in dict.type.${dictType}"
  238. :key="dict.value"
  239. :label="dict.value">
  240. {{dict.label}}
  241. </el-checkbox>
  242. </el-checkbox-group>
  243. </el-form-item>
  244. #elseif($column.htmlType == "checkbox" && $dictType)
  245. <el-form-item label="${comment}" prop="${field}">
  246. <el-checkbox-group v-model="form.${field}">
  247. <el-checkbox>请选择字典生成</el-checkbox>
  248. </el-checkbox-group>
  249. </el-form-item>
  250. #elseif($column.htmlType == "radio" && "" != $dictType)
  251. <el-form-item label="${comment}" prop="${field}">
  252. <el-radio-group v-model="form.${field}">
  253. <el-radio
  254. v-for="dict in dict.type.${dictType}"
  255. :key="dict.value"
  256. #if($column.javaType == "Integer" || $column.javaType == "Long")
  257. :label="parseInt(dict.value)"
  258. #else
  259. :label="dict.value"
  260. #end
  261. >{{dict.label}}</el-radio>
  262. </el-radio-group>
  263. </el-form-item>
  264. #elseif($column.htmlType == "radio" && $dictType)
  265. <el-form-item label="${comment}" prop="${field}">
  266. <el-radio-group v-model="form.${field}">
  267. <el-radio label="1">请选择字典生成</el-radio>
  268. </el-radio-group>
  269. </el-form-item>
  270. #elseif($column.htmlType == "datetime")
  271. <el-form-item label="${comment}" prop="${field}">
  272. <el-date-picker clearable
  273. v-model="form.${field}"
  274. type="datetime"
  275. value-format="yyyy-MM-dd HH:mm:ss"
  276. placeholder="请选择${comment}">
  277. </el-date-picker>
  278. </el-form-item>
  279. #elseif($column.htmlType == "textarea")
  280. <el-form-item label="${comment}" prop="${field}">
  281. <el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
  282. </el-form-item>
  283. #end
  284. #end
  285. #end
  286. #if($table.sub)
  287. <el-divider content-position="center">${subTable.functionName}信息</el-divider>
  288. <el-row :gutter="10" class="mb8">
  289. <el-col :span="1.5">
  290. <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd${subClassName}">添加</el-button>
  291. </el-col>
  292. <el-col :span="1.5">
  293. <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDelete${subClassName}">删除</el-button>
  294. </el-col>
  295. </el-row>
  296. <el-table :data="${subclassName}List" :row-class-name="row${subClassName}Index" @selection-change="handle${subClassName}SelectionChange" ref="${subclassName}">
  297. <el-table-column type="selection" width="50" align="center" />
  298. <el-table-column label="序号" align="center" prop="index" width="50"/>
  299. #foreach($column in $subTable.columns)
  300. #set($javaField=$column.javaField)
  301. #set($parentheseIndex=$column.columnComment.indexOf("("))
  302. #if($parentheseIndex != -1)
  303. #set($comment=$column.columnComment.substring(0, $parentheseIndex))
  304. #else
  305. #set($comment=$column.columnComment)
  306. #end
  307. #if($column.pk || $javaField == ${subTableFkclassName})
  308. #elseif($column.list && $column.htmlType == "input")
  309. <el-table-column label="$comment" prop="${javaField}" width="150">
  310. <template slot-scope="scope">
  311. <el-input v-model="scope.row.$javaField" placeholder="请输入$comment" />
  312. </template>
  313. </el-table-column>
  314. #elseif($column.list && $column.htmlType == "datetime")
  315. <el-table-column label="$comment" prop="${javaField}" width="240">
  316. <template slot-scope="scope">
  317. <el-date-picker clearable v-model="scope.row.$javaField" type="date" value-format="yyyy-MM-dd" placeholder="请选择$comment" />
  318. </template>
  319. </el-table-column>
  320. #elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" != $column.dictType)
  321. <el-table-column label="$comment" prop="${javaField}" width="150">
  322. <template slot-scope="scope">
  323. <el-select v-model="scope.row.$javaField" placeholder="请选择$comment">
  324. <el-option
  325. v-for="dict in dict.type.$column.dictType"
  326. :key="dict.value"
  327. :label="dict.label"
  328. :value="dict.value"
  329. ></el-option>
  330. </el-select>
  331. </template>
  332. </el-table-column>
  333. #elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" == $column.dictType)
  334. <el-table-column label="$comment" prop="${javaField}" width="150">
  335. <template slot-scope="scope">
  336. <el-select v-model="scope.row.$javaField" placeholder="请选择$comment">
  337. <el-option label="请选择字典生成" value="" />
  338. </el-select>
  339. </template>
  340. </el-table-column>
  341. #end
  342. #end
  343. </el-table>
  344. #end
  345. </el-form>
  346. <div slot="footer" class="dialog-footer">
  347. <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
  348. <el-button @click="cancel">取 消</el-button>
  349. </div>
  350. </el-dialog>
  351. </div>
  352. </template>
  353. <script>
  354. import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}";
  355. export default {
  356. name: "${BusinessName}",
  357. #if(${dicts} != '')
  358. dicts: [${dicts}],
  359. #end
  360. data() {
  361. return {
  362. // 按钮loading
  363. buttonLoading: false,
  364. // 遮罩层
  365. loading: true,
  366. // 选中数组
  367. ids: [],
  368. #if($table.sub)
  369. // 子表选中数据
  370. checked${subClassName}: [],
  371. #end
  372. // 非单个禁用
  373. single: true,
  374. // 非多个禁用
  375. multiple: true,
  376. // 显示搜索条件
  377. showSearch: true,
  378. // 总条数
  379. total: 0,
  380. // ${functionName}表格数据
  381. ${businessName}List: [],
  382. #if($table.sub)
  383. // ${subTable.functionName}表格数据
  384. ${subclassName}List: [],
  385. #end
  386. // 弹出层标题
  387. title: "",
  388. // 是否显示弹出层
  389. open: false,
  390. #foreach ($column in $columns)
  391. #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
  392. #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
  393. // $comment时间范围
  394. daterange${AttrName}: [],
  395. #end
  396. #end
  397. // 查询参数
  398. queryParams: {
  399. pageNum: 1,
  400. pageSize: 10,
  401. #foreach ($column in $columns)
  402. #if($column.query)
  403. $column.javaField: undefined#if($foreach.count != $columns.size()),#end
  404. #end
  405. #end
  406. },
  407. // 表单参数
  408. form: {},
  409. // 表单校验
  410. rules: {
  411. #foreach ($column in $columns)
  412. #if($column.required)
  413. #set($parentheseIndex=$column.columnComment.indexOf("("))
  414. #if($parentheseIndex != -1)
  415. #set($comment=$column.columnComment.substring(0, $parentheseIndex))
  416. #else
  417. #set($comment=$column.columnComment)
  418. #end
  419. $column.javaField: [
  420. { required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end }
  421. ]#if($foreach.count != $columns.size()),#end
  422. #end
  423. #end
  424. }
  425. };
  426. },
  427. created() {
  428. this.getList();
  429. },
  430. methods: {
  431. /** 查询${functionName}列表 */
  432. getList() {
  433. this.loading = true;
  434. #foreach ($column in $columns)
  435. #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
  436. this.queryParams.params = {};
  437. #break
  438. #end
  439. #end
  440. #foreach ($column in $columns)
  441. #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
  442. #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
  443. if (null != this.daterange${AttrName} && '' != this.daterange${AttrName}) {
  444. this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0];
  445. this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1];
  446. }
  447. #end
  448. #end
  449. list${BusinessName}(this.queryParams).then(response => {
  450. this.${businessName}List = response.rows;
  451. this.total = response.total;
  452. this.loading = false;
  453. });
  454. },
  455. // 取消按钮
  456. cancel() {
  457. this.open = false;
  458. this.reset();
  459. },
  460. // 表单重置
  461. reset() {
  462. this.form = {
  463. #foreach ($column in $columns)
  464. #if($column.htmlType == "checkbox")
  465. $column.javaField: []#if($foreach.count != $columns.size()),#end
  466. #else
  467. $column.javaField: undefined#if($foreach.count != $columns.size()),#end
  468. #end
  469. #end
  470. };
  471. #if($table.sub)
  472. this.${subclassName}List = [];
  473. #end
  474. this.resetForm("form");
  475. },
  476. /** 搜索按钮操作 */
  477. handleQuery() {
  478. this.queryParams.pageNum = 1;
  479. this.getList();
  480. },
  481. /** 重置按钮操作 */
  482. resetQuery() {
  483. #foreach ($column in $columns)
  484. #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
  485. #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
  486. this.daterange${AttrName} = [];
  487. #end
  488. #end
  489. this.resetForm("queryForm");
  490. this.handleQuery();
  491. },
  492. // 多选框选中数据
  493. handleSelectionChange(selection) {
  494. this.ids = selection.map(item => item.${pkColumn.javaField})
  495. this.single = selection.length!==1
  496. this.multiple = !selection.length
  497. },
  498. /** 新增按钮操作 */
  499. handleAdd() {
  500. this.reset();
  501. this.open = true;
  502. this.title = "添加${functionName}";
  503. },
  504. /** 修改按钮操作 */
  505. handleUpdate(row) {
  506. this.loading = true;
  507. this.reset();
  508. const ${pkColumn.javaField} = row.${pkColumn.javaField} || this.ids
  509. get${BusinessName}(${pkColumn.javaField}).then(response => {
  510. this.loading = false;
  511. this.form = response.data;
  512. #foreach ($column in $columns)
  513. #if($column.htmlType == "checkbox")
  514. this.form.$column.javaField = this.form.${column.javaField}.split(",");
  515. #end
  516. #end
  517. #if($table.sub)
  518. this.${subclassName}List = response.data.${subclassName}List;
  519. #end
  520. this.open = true;
  521. this.title = "修改${functionName}";
  522. });
  523. },
  524. /** 提交按钮 */
  525. submitForm() {
  526. this.#[[$]]#refs["form"].validate(valid => {
  527. if (valid) {
  528. this.buttonLoading = true;
  529. #foreach ($column in $columns)
  530. #if($column.htmlType == "checkbox")
  531. this.form.$column.javaField = this.form.${column.javaField}.join(",");
  532. #end
  533. #end
  534. #if($table.sub)
  535. this.form.${subclassName}List = this.${subclassName}List;
  536. #end
  537. if (this.form.${pkColumn.javaField} != null) {
  538. update${BusinessName}(this.form).then(response => {
  539. this.#[[$modal]]#.msgSuccess("修改成功");
  540. this.open = false;
  541. this.getList();
  542. }).finally(() => {
  543. this.buttonLoading = false;
  544. });
  545. } else {
  546. add${BusinessName}(this.form).then(response => {
  547. this.#[[$modal]]#.msgSuccess("新增成功");
  548. this.open = false;
  549. this.getList();
  550. }).finally(() => {
  551. this.buttonLoading = false;
  552. });
  553. }
  554. }
  555. });
  556. },
  557. /** 删除按钮操作 */
  558. handleDelete(row) {
  559. const ${pkColumn.javaField}s = row.${pkColumn.javaField} || this.ids;
  560. this.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + ${pkColumn.javaField}s + '"的数据项?').then(() => {
  561. this.loading = true;
  562. return del${BusinessName}(${pkColumn.javaField}s);
  563. }).then(() => {
  564. this.loading = false;
  565. this.getList();
  566. this.#[[$modal]]#.msgSuccess("删除成功");
  567. }).catch(() => {
  568. }).finally(() => {
  569. this.loading = false;
  570. });
  571. },
  572. #if($table.sub)
  573. /** ${subTable.functionName}序号 */
  574. row${subClassName}Index({ row, rowIndex }) {
  575. row.index = rowIndex + 1;
  576. },
  577. /** ${subTable.functionName}添加按钮操作 */
  578. handleAdd${subClassName}() {
  579. let obj = {};
  580. #foreach($column in $subTable.columns)
  581. #if($column.pk || $column.javaField == ${subTableFkclassName})
  582. #elseif($column.list && "" != $javaField)
  583. obj.$column.javaField = "";
  584. #end
  585. #end
  586. this.${subclassName}List.push(obj);
  587. },
  588. /** ${subTable.functionName}删除按钮操作 */
  589. handleDelete${subClassName}() {
  590. if (this.checked${subClassName}.length == 0) {
  591. this.#[[$modal]]#.msgError("请先选择要删除的${subTable.functionName}数据");
  592. } else {
  593. const ${subclassName}List = this.${subclassName}List;
  594. const checked${subClassName} = this.checked${subClassName};
  595. this.${subclassName}List = ${subclassName}List.filter(function(item) {
  596. return checked${subClassName}.indexOf(item.index) == -1
  597. });
  598. }
  599. },
  600. /** 复选框选中数据 */
  601. handle${subClassName}SelectionChange(selection) {
  602. this.checked${subClassName} = selection.map(item => item.index)
  603. },
  604. #end
  605. /** 导出按钮操作 */
  606. handleExport() {
  607. this.download('${moduleName}/${businessName}/export', {
  608. ...this.queryParams
  609. }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
  610. }
  611. }
  612. };
  613. </script>