index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="年份" prop="configName">
  5. <el-date-picker
  6. v-model="queryParams.year"
  7. type="year"
  8. value-format="yyyy"
  9. placeholder="选择年"
  10. size="small"
  11. @keyup.enter.native="handleQuery"
  12. >
  13. </el-date-picker>
  14. </el-form-item>
  15. <el-form-item label="部门" prop="sysDeptId">
  16. <el-cascader :options="typeOptionstwo" :props="{value: 'id'}" @change="changeBtn" :show-all-levels="false"></el-cascader>
  17. <!-- <el-select
  18. v-model="queryParams.sysDeptId"
  19. placeholder="请选择部门"
  20. clearable
  21. size="small"
  22. >
  23. <el-option
  24. v-for="dict in typeOptionstwo"
  25. :key="dict.deptId"
  26. :label="dict.deptName"
  27. :value="dict.deptId"
  28. /> -->
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item>
  32. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  33. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  34. </el-form-item>
  35. </el-form>
  36. <el-row :gutter="10" class="mb8">
  37. <el-col :span="1.5">
  38. <el-button
  39. type="primary"
  40. plain
  41. icon="el-icon-plus"
  42. size="mini"
  43. @click="handleAdd"
  44. v-hasPermi="['deptplan:Plan:add']"
  45. >新增</el-button>
  46. </el-col>
  47. <el-col :span="1.5">
  48. <el-button
  49. type="success"
  50. plain
  51. icon="el-icon-edit"
  52. size="mini"
  53. :disabled="single"
  54. @click="handleUpdate"
  55. v-hasPermi="['deptplan:Plan:edit']"
  56. >修改</el-button>
  57. </el-col>
  58. <el-col :span="1.5">
  59. <el-button
  60. type="danger"
  61. plain
  62. icon="el-icon-delete"
  63. size="mini"
  64. :disabled="multiple"
  65. @click="handleDelete"
  66. v-hasPermi="['deptplan:Plan:remove']"
  67. >删除</el-button>
  68. </el-col>
  69. <el-col :span="1.5">
  70. <el-button
  71. type="warning"
  72. plain
  73. icon="el-icon-download"
  74. size="mini"
  75. @click="handleExport"
  76. v-hasPermi="['deptplan:Plan:export']"
  77. >导出</el-button>
  78. </el-col>
  79. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  80. </el-row>
  81. <el-table v-loading="loading" :data="planList" @selection-change="handleSelectionChange">
  82. <el-table-column type="selection" width="55" align="center" />
  83. <el-table-column label="年度" align="center" prop="year" />
  84. <el-table-column label="部门" align="center" prop="deptName" />
  85. <el-table-column label="目标线索数" align="center" prop="plan" />
  86. <el-table-column label="目标签约数" align="center" prop="targetSigningNum" />
  87. <el-table-column label="目标合同金额" align="center" prop="targetContractAmount" />
  88. <el-table-column label="目标到资金额" align="center" prop="targetArrivalAmount" />
  89. <el-table-column label="目标投产项目数" align="center" prop="targetInvestmentNum" />
  90. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  91. <template slot-scope="scope">
  92. <el-button
  93. size="mini"
  94. type="text"
  95. icon="el-icon-edit"
  96. @click="handleUpdate(scope.row)"
  97. v-hasPermi="['deptplan:Plan:edit']"
  98. >修改</el-button>
  99. <el-button
  100. size="mini"
  101. type="text"
  102. icon="el-icon-delete"
  103. @click="handleDelete(scope.row)"
  104. v-hasPermi="['deptplan:Plan:remove']"
  105. >删除</el-button>
  106. </template>
  107. </el-table-column>
  108. </el-table>
  109. <pagination
  110. v-show="total>0"
  111. :total="total"
  112. :page.sync="queryParams.pageNum"
  113. :limit.sync="queryParams.pageSize"
  114. @pagination="getList"
  115. />
  116. <!-- 添加或修改 部门招商计划对话框 -->
  117. <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" width="800px" append-to-body>
  118. <el-form ref="form" :model="form" :rules="rules" label-width="150px">
  119. <el-form-item label="年度" prop="year">
  120. <!-- <el-input v-model="form.year" placeholder="请输入年度" /> -->
  121. <el-date-picker
  122. v-model="form.year"
  123. type="year"
  124. value-format="yyyy"
  125. placeholder="选择年"
  126. style="width: 100%;"
  127. >
  128. </el-date-picker>
  129. </el-form-item>
  130. <el-form-item label="部门" prop="sysDeptId">
  131. <el-cascader :options="typeOptionstwo" :props="{value: 'id'}" @change="changeBtn1" :show-all-levels="false"></el-cascader>
  132. <!-- <el-select
  133. placeholder="系统内置"
  134. clearable
  135. size="small"
  136. style="width: 100%;"
  137. >
  138. <el-option
  139. v-for="dict in typeOptionstwo"
  140. :key="dict.deptId"
  141. :label="dict.deptName"
  142. :value="dict.deptId"
  143. />
  144. </el-select> -->
  145. </el-form-item>
  146. <el-form-item label="目标线索数" prop="plan">
  147. <el-input v-model="form.plan" placeholder="请输入目标线索数" />
  148. </el-form-item>
  149. <el-form-item label="目标签约数" prop="targetSigningNum">
  150. <el-input v-model="form.targetSigningNum" placeholder="请输入目标签约数" />
  151. </el-form-item>
  152. <el-form-item label="目标合同金额" prop="targetContractAmount">
  153. <el-input v-model="form.targetContractAmount" placeholder="请输入目标合同金额" />
  154. </el-form-item>
  155. <el-form-item label="目标到资金额" prop="targetArrivalAmount">
  156. <el-input v-model="form.targetArrivalAmount" placeholder="请输入目标到资金额" />
  157. </el-form-item>
  158. <el-form-item label="目标投产项目数" prop="targetInvestmentNum">
  159. <el-input v-model="form.targetInvestmentNum" placeholder="请输入目标投产项目数" />
  160. </el-form-item>
  161. </el-form>
  162. <div slot="footer" class="dialog-footer">
  163. <el-button type="primary" @click="submitForm">确 定</el-button>
  164. <el-button @click="cancel">取 消</el-button>
  165. </div>
  166. </el-dialog>
  167. </div>
  168. </template>
  169. <script>
  170. import { listPlan, getPlan, delPlan, addPlan, updatePlan, exportPlan } from "@/api/deptplan/plan";
  171. import {listConfigfieu} from "@/api/system/config";
  172. export default {
  173. name: "Plan",
  174. components: {
  175. },
  176. data() {
  177. return {
  178. // 遮罩层
  179. loading: true,
  180. // 选中数组
  181. ids: [],
  182. // 非单个禁用
  183. single: true,
  184. // 非多个禁用
  185. multiple: true,
  186. // 显示搜索条件
  187. showSearch: true,
  188. // 总条数
  189. total: 0,
  190. // 部门招商计划表格数据
  191. planList: [],
  192. // 弹出层标题
  193. title: "",
  194. // 是否显示弹出层
  195. open: false,
  196. typeOptionstwo:[],
  197. // 查询参数
  198. queryParams: {
  199. pageNum: 1,
  200. pageSize: 10,
  201. sysDeptId: null,
  202. isDel: null,
  203. year: null,
  204. plan: null,
  205. targetSigningNum: null,
  206. targetContractAmount: null,
  207. targetArrivalAmount: null,
  208. targetInvestmentNum: null,
  209. typeOptionstwo:[]
  210. },
  211. // 表单参数
  212. form: {},
  213. // 表单校验
  214. rules: {
  215. targetSigningNum:[
  216. { required: true, message: '请输入目标签约数', trigger: 'change' }
  217. ],
  218. targetContractAmount:[
  219. { required: true, message: '请输入目标合同金额', trigger: 'change' }
  220. ],
  221. targetArrivalAmount:[
  222. { required: true, message: '请输入目标到资金额', trigger: 'change' }
  223. ],
  224. targetInvestmentNum:[
  225. { required: true, message: '请输入目标投产项目数', trigger: 'change' }
  226. ],
  227. plan:[
  228. { required: true, message: '请输入计划', trigger: 'change' }
  229. ],
  230. sysDeptId: [
  231. { required: true, message: '请选择部门', trigger: 'change' }
  232. ],
  233. year: [
  234. { type: 'date', required: true, message: '请选择年份', trigger: 'change' }
  235. ],
  236. }
  237. };
  238. },
  239. created() {
  240. this.getList();
  241. this.getListthuy()
  242. },
  243. methods: {
  244. changeBtn(e){
  245. this.queryParams.sysDeptId = e[2]
  246. },
  247. changeBtn1(e){
  248. this.form.sysDeptId = e[2]
  249. },
  250. /** 查询 部门招商计划列表 */
  251. getList() {
  252. this.loading = true;
  253. listPlan(this.queryParams).then(response => {
  254. this.planList = response.rows;
  255. this.total = response.total;
  256. this.loading = false;
  257. });
  258. },
  259. //部门列表
  260. getListthuy() {
  261. this.loading = true;
  262. listConfigfieu().then((response) => {
  263. console.log(response.data)
  264. this.typeOptionstwo = response.data;
  265. // this.fileList = this.queryParams.attachment
  266. // this.total = response.total;
  267. this.loading = false;
  268. });
  269. },
  270. // 取消按钮
  271. cancel() {
  272. this.open = false;
  273. this.reset();
  274. },
  275. // 表单重置
  276. reset() {
  277. this.form = {
  278. id: null,
  279. sysDeptId: null,
  280. createBy: null,
  281. createTime: null,
  282. updateBy: null,
  283. updateTime: null,
  284. isDel: null,
  285. year: null,
  286. plan: null,
  287. targetSigningNum: null,
  288. targetContractAmount: null,
  289. targetArrivalAmount: null,
  290. targetInvestmentNum: null
  291. };
  292. this.resetForm("form");
  293. },
  294. /** 搜索按钮操作 */
  295. handleQuery() {
  296. this.queryParams.pageNum = 1;
  297. this.getList();
  298. },
  299. /** 重置按钮操作 */
  300. resetQuery() {
  301. this.resetForm("queryForm");
  302. this.handleQuery();
  303. },
  304. // 多选框选中数据
  305. handleSelectionChange(selection) {
  306. this.ids = selection.map(item => item.id)
  307. this.single = selection.length!==1
  308. this.multiple = !selection.length
  309. },
  310. /** 新增按钮操作 */
  311. handleAdd() {
  312. this.reset();
  313. this.open = true;
  314. this.title = "添加 部门招商计划";
  315. },
  316. /** 修改按钮操作 */
  317. handleUpdate(row) {
  318. this.reset();
  319. const id = row.id || this.ids
  320. getPlan(id).then(response => {
  321. this.form = response.data;
  322. this.open = true;
  323. this.title = "修改 部门招商计划";
  324. });
  325. },
  326. /** 提交按钮 */
  327. submitForm() {
  328. this.$refs["form"].validate(valid => {
  329. if (valid) {
  330. if (this.form.id != null) {
  331. updatePlan(this.form).then(response => {
  332. this.msgSuccess("修改成功");
  333. this.open = false;
  334. this.getList();
  335. });
  336. } else {
  337. addPlan(this.form).then(response => {
  338. this.msgSuccess("新增成功");
  339. this.open = false;
  340. this.getList();
  341. });
  342. }
  343. }
  344. });
  345. },
  346. /** 删除按钮操作 */
  347. handleDelete(row) {
  348. const ids = row.id || this.ids;
  349. this.$confirm('是否确认删除 部门招商计划编号为"' + ids + '"的数据项?', "警告", {
  350. confirmButtonText: "确定",
  351. cancelButtonText: "取消",
  352. type: "warning"
  353. }).then(function() {
  354. return delPlan(ids);
  355. }).then(() => {
  356. this.getList();
  357. this.msgSuccess("删除成功");
  358. })
  359. },
  360. /** 导出按钮操作 */
  361. handleExport() {
  362. const queryParams = this.queryParams;
  363. this.$confirm('是否确认导出所有 部门招商计划数据项?', "警告", {
  364. confirmButtonText: "确定",
  365. cancelButtonText: "取消",
  366. type: "warning"
  367. }).then(function() {
  368. return exportPlan(queryParams);
  369. }).then(response => {
  370. this.download(response.msg);
  371. })
  372. }
  373. }
  374. };
  375. </script>