index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  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="userName">
  5. <el-input
  6. v-model="queryParams.userName"
  7. placeholder="请输入客户姓名"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="约诊医生" prop="doctorName">
  14. <el-input
  15. v-model="queryParams.doctorName"
  16. placeholder="请输入约诊医生"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="商品名称" prop="packageName">
  23. <el-input
  24. v-model="queryParams.packageName"
  25. placeholder="请输入挂载商品名称"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label="订单号" prop="orderCode">
  32. <el-input
  33. v-model="queryParams.orderCode"
  34. placeholder="请输入订单号"
  35. clearable
  36. size="small"
  37. @keyup.enter.native="handleQuery"
  38. />
  39. </el-form-item>
  40. <el-form-item label="当前状态" prop="currentStep">
  41. <el-select v-model="queryParams.currentStep" placeholder="当前状态" clearable size="small">
  42. <el-option
  43. v-for="dict in currentStepOptions"
  44. :key="dict.dictValue"
  45. :label="dict.dictLabel"
  46. :value="dict.dictValue"
  47. />
  48. </el-select>
  49. </el-form-item>
  50. <el-form-item label="完成时间" prop="completedTime">
  51. <el-date-picker clearable size="small"
  52. v-model="queryParams.completedTime"
  53. type="date"
  54. value-format="yyyy-MM-dd"
  55. placeholder="选择完成时间">
  56. </el-date-picker>
  57. </el-form-item>
  58. <el-form-item>
  59. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  60. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  61. </el-form-item>
  62. </el-form>
  63. <el-table border v-loading="loading" :data="collectionScheduleList" @selection-change="handleSelectionChange">
  64. <el-table-column type="selection" width="55" align="center" />
  65. <el-table-column label="客户姓名" align="center" prop="userName" />
  66. <el-table-column label="约诊医生" align="center" prop="doctorName" />
  67. <el-table-column label="订单号" align="center" prop="orderCode" />
  68. <el-table-column label="挂载商品" align="center" prop="packageName" />
  69. <el-table-column label="当前状态" align="center" prop="currentStep">
  70. <template slot-scope="scope">
  71. <el-tag
  72. v-if="scope.row.currentStep != null"
  73. :type="stepColorMap[scope.row.currentStep] || 'info'"
  74. size="small"
  75. >
  76. {{ getStepLabel(scope.row.currentStep) }}
  77. </el-tag>
  78. <span v-else>—</span>
  79. </template>
  80. </el-table-column>
  81. <el-table-column label="完成时间" align="center" prop="completedTime" width="180">
  82. <template slot-scope="scope">
  83. <span>{{ parseTime(scope.row.completedTime, '{y}-{m}-{d}') }}</span>
  84. </template>
  85. </el-table-column>
  86. <el-table-column label="中止时间" align="center" prop="terminatedTime" width="180">
  87. <template slot-scope="scope">
  88. <span>{{ parseTime(scope.row.terminatedTime, '{y}-{m}-{d}') }}</span>
  89. </template>
  90. </el-table-column>
  91. <el-table-column label="备注" align="center" prop="remark" />
  92. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  93. <template slot-scope="scope">
  94. <el-button
  95. size="mini"
  96. type="text"
  97. icon="el-icon-delete"
  98. @click="endProcess(scope.row)"
  99. v-hasPermi="['his:collectionSchedule:stop']"
  100. :disabled="scope.row.status !== 1"
  101. :style="{ color: scope.row.status === 1 ? '#f56c6c' : '#999' }"
  102. >终止</el-button>
  103. </template>
  104. </el-table-column>
  105. </el-table>
  106. <pagination
  107. v-show="total>0"
  108. :total="total"
  109. :page.sync="queryParams.pageNum"
  110. :limit.sync="queryParams.pageSize"
  111. @pagination="getList"
  112. />
  113. <!-- 终止原因弹窗 -->
  114. <el-dialog title="终止进度" :visible.sync="endProcessVisible" width="400px" @close="resetEndForm">
  115. <el-form :model="endForm" ref="endFormRef" label-width="80px">
  116. <el-form-item label="终止原因" prop="remark" :rules="[{ required: true, message: '请输入终止原因', trigger: 'blur' }]">
  117. <el-input
  118. v-model="endForm.remark"
  119. type="textarea"
  120. :rows="4"
  121. placeholder="请输入终止原因"
  122. />
  123. </el-form-item>
  124. </el-form>
  125. <div slot="footer" class="dialog-footer">
  126. <el-button @click="endProcessVisible = false">取 消</el-button>
  127. <el-button type="primary" @click="submitEndProcess">确 定</el-button>
  128. </div>
  129. </el-dialog>
  130. </div>
  131. </template>
  132. <script>
  133. import { listCollectionSchedule, addCollectionSchedule, updateCollectionSchedule, exportCollectionSchedule,getCollectionScheduleSteps,stop } from "@/api/store/collectionSchedule";
  134. export default {
  135. name: "CollectionSchedule",
  136. data() {
  137. // 定义状态颜色映射(若依常用色系)
  138. const stepColorMap = {
  139. 1: 'primary', // 待用户第一次确认 —— 蓝色
  140. 2: 'warning', // 待开方 —— 橙色
  141. 3: 'danger', // 待药师审核 —— 红色
  142. 4: 'success', // 待建议 —— 绿色
  143. 5: 'info', // 待用户二次确认 —— 灰蓝
  144. 6: 'success' // 完成 —— 蓝色
  145. };
  146. return {
  147. // === 新增:终止弹窗相关 ===
  148. endProcessVisible: false,
  149. endForm: {
  150. id: null,
  151. collectionId: null,
  152. remark: ''
  153. },
  154. // 遮罩层
  155. loading: true,
  156. // 导出遮罩层
  157. exportLoading: false,
  158. // 选中数组
  159. ids: [],
  160. // 非单个禁用
  161. single: true,
  162. // 非多个禁用
  163. multiple: true,
  164. // 显示搜索条件
  165. showSearch: true,
  166. // 总条数
  167. total: 0,
  168. // 用户信息采集进度表格数据
  169. collectionScheduleList: [],
  170. // 弹出层标题
  171. title: "",
  172. // 是否显示弹出层
  173. open: false,
  174. // 当前流程节点字典:(1:待用户第一次确认、2:待开方、3:待药师审核、4:待建议、5:待用户二次确认、6:完成);其中带疗法模式有1,2,3,5,6;无疗法模式只有1,4,5,6
  175. currentStepOptions: [],
  176. // 查询参数
  177. queryParams: {
  178. pageNum: 1,
  179. pageSize: 10,
  180. collectionId: null,
  181. userId: null,
  182. userName: null,
  183. doctorId: null,
  184. doctorName: null,
  185. orderCode: null,
  186. packageId: null,
  187. packageName: null,
  188. currentStep: null,
  189. status: null,
  190. completedTime: null,
  191. terminatedTime: null,
  192. terminatedBy: null,
  193. },
  194. // 表单参数
  195. form: {},
  196. // 表单校验
  197. rules: {
  198. },
  199. stepColorMap, // 暴露给模板使用
  200. };
  201. },
  202. created() {
  203. this.getList();
  204. getCollectionScheduleSteps().then(response => {
  205. this.currentStepOptions = response.data;
  206. });
  207. },
  208. methods: {
  209. /** 查询用户信息采集进度列表 */
  210. getList() {
  211. this.loading = true;
  212. listCollectionSchedule(this.queryParams).then(response => {
  213. this.collectionScheduleList = response.rows;
  214. this.total = response.total;
  215. this.loading = false;
  216. });
  217. },
  218. // 取消按钮
  219. cancel() {
  220. this.open = false;
  221. this.reset();
  222. },
  223. // 表单重置
  224. reset() {
  225. this.form = {
  226. id: null,
  227. collectionId: null,
  228. userId: null,
  229. userName: null,
  230. doctorId: null,
  231. doctorName: null,
  232. orderCode: null,
  233. packageId: null,
  234. packageName: null,
  235. currentStep: null,
  236. status: 0,
  237. createTime: null,
  238. completedTime: null,
  239. terminatedTime: null,
  240. terminatedBy: null,
  241. remark: null
  242. };
  243. this.resetForm("form");
  244. },
  245. /** 搜索按钮操作 */
  246. handleQuery() {
  247. this.queryParams.pageNum = 1;
  248. this.getList();
  249. },
  250. /** 重置按钮操作 */
  251. resetQuery() {
  252. this.resetForm("queryForm");
  253. this.handleQuery();
  254. },
  255. /** 终止按钮操作 - 打开弹窗 */
  256. endProcess(row) {
  257. this.endForm.id = row.id;
  258. this.endForm.collectionId = row.collectionId;
  259. this.endForm.remark = '';
  260. this.endProcessVisible = true;
  261. },
  262. /** 提交终止操作 */
  263. /** 提交终止操作 */
  264. submitEndProcess() {
  265. this.$refs["endFormRef"].validate(valid => {
  266. if (valid) {
  267. const { id, collectionId, remark } = this.endForm
  268. this.$confirm('确认终止该采集进度?', '提示', {
  269. confirmButtonText: '确定',
  270. cancelButtonText: '取消',
  271. type: 'warning'
  272. }).then(() => {
  273. stop({ id, collectionId, remark }).then(response => {
  274. this.msgSuccess("终止成功");
  275. this.endProcessVisible = false;
  276. this.getList();
  277. }).catch(() => {
  278. // 可选:错误提示
  279. });
  280. }).catch(() => {
  281. // 取消
  282. });
  283. }
  284. });
  285. },
  286. /** 重置终止表单 */
  287. resetEndForm() {
  288. this.$refs["endFormRef"] && this.$refs["endFormRef"].resetFields();
  289. this.endForm.id = null;
  290. this.endForm.collectionId = null;
  291. this.endForm.remark = '';
  292. },
  293. // 多选框选中数据
  294. handleSelectionChange(selection) {
  295. this.ids = selection.map(item => item.id)
  296. this.single = selection.length!==1
  297. this.multiple = !selection.length
  298. },
  299. /** 新增按钮操作 */
  300. handleAdd() {
  301. this.reset();
  302. this.open = true;
  303. this.title = "添加用户信息采集进度";
  304. },
  305. /** 提交按钮 */
  306. submitForm() {
  307. this.$refs["form"].validate(valid => {
  308. if (valid) {
  309. if (this.form.id != null) {
  310. updateCollectionSchedule(this.form).then(response => {
  311. this.msgSuccess("修改成功");
  312. this.open = false;
  313. this.getList();
  314. });
  315. } else {
  316. addCollectionSchedule(this.form).then(response => {
  317. this.msgSuccess("新增成功");
  318. this.open = false;
  319. this.getList();
  320. });
  321. }
  322. }
  323. });
  324. },
  325. /** 导出按钮操作 */
  326. handleExport() {
  327. const queryParams = this.queryParams;
  328. this.$confirm('是否确认导出所有用户信息采集进度数据项?', "警告", {
  329. confirmButtonText: "确定",
  330. cancelButtonText: "取消",
  331. type: "warning"
  332. }).then(() => {
  333. this.exportLoading = true;
  334. return exportCollectionSchedule(queryParams);
  335. }).then(response => {
  336. this.download(response.msg);
  337. this.exportLoading = false;
  338. }).catch(() => {});
  339. },
  340. getStepLabel(currentStep) {
  341. if (currentStep == null) return '—';
  342. const option = this.currentStepOptions.find(opt => opt.dictValue === currentStep);
  343. return option ? option.dictLabel : '未知状态';
  344. }
  345. }
  346. };
  347. </script>